IC mangling: Use old mangling scheme in FIR tests

instead of ignoring them.
This affects all unsigned tests.
This commit is contained in:
Ilmir Usmanov
2020-11-15 18:46:01 +01:00
parent 2cd9016016
commit 89d45bf909
212 changed files with 285 additions and 34 deletions
@@ -74,22 +74,34 @@ public class GenerateRangesCodegenTestData {
private static final List<String> JVM_IR_FAILING_UNSIGNED_EXPRESSION_TESTS = Collections.emptyList();
private static final List<String> FIR_FAILING_UNSIGNED_LITERAL_TESTS = new ArrayList<String>() {{
private static final List<String> USE_OLD_MANGLING_IN_UNSIGNED_LITERAL_TESTS = new ArrayList<String>() {{
add("inexactDownToMinValue");
add("progressionMaxValueMinusTwoToMaxValue");
add("inexactToMaxValue");
add("simpleRangeWithNonConstantEnds");
add("maxValueMinusTwoToMaxValue");
add("progressionDownToMinValue");
add("overflowZeroToMinValue");
}};
private static final List<String> FIR_FAILING_UNSIGNED_EXPRESSION_TESTS = new ArrayList<String>() {{
private static final List<String> USE_OLD_MANGLING_IN_UNSIGNED_EXPRESSION_TESTS = new ArrayList<String>() {{
add("inexactDownToMinValue");
add("progressionMaxValueMinusTwoToMaxValue");
add("inexactToMaxValue");
add("simpleRangeWithNonConstantEnds");
add("maxValueMinusTwoToMaxValue");
add("progressionDownToMinValue");
add("openRange");
add("overflowZeroDownToMaxValue");
add("reversedBackSequence");
add("overflowZeroToMinValue");
add("simpleDownTo");
add("emptyDownto");
add("reversedInexactSteppedDownTo");
add("simpleSteppedDownTo");
add("oneElementDownTo");
add("reversedEmptyBackSequence");
add("inexactSteppedDownTo");
}};
static {
@@ -156,7 +168,13 @@ public class GenerateRangesCodegenTestData {
out.printf("// IGNORE_BACKEND: %s%n%n", backendName);
}
private static void writeToFile(File file, String generatedBody, boolean isForUnsigned, boolean ignoreJvmIR, boolean ignoreFir) {
private static void writeToFile(
File file,
String generatedBody,
boolean isForUnsigned,
boolean ignoreJvmIR,
boolean useOldManglingScheme
) {
PrintWriter out;
try {
//noinspection IOResourceOpenedButNotSafelyClosed
@@ -173,8 +191,8 @@ public class GenerateRangesCodegenTestData {
out.println("// KJS_WITH_FULL_RUNTIME");
out.println("// Auto-generated by " + GenerateRangesCodegenTestData.class.getName() + ". DO NOT EDIT!");
out.println("// WITH_RUNTIME");
if (ignoreFir) {
out.println("// IGNORE_BACKEND_FIR: JVM_IR");
if (useOldManglingScheme) {
out.println("// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME");
}
out.println();
// Import min/max values, but only in case when the generated test case actually uses them (not to clutter tests which don't)
@@ -258,10 +276,10 @@ public class GenerateRangesCodegenTestData {
writeToFile(new File(AS_EXPRESSION_DIR, fileName), asExpressionBody.toString(), false, false, false);
writeToFile(new File(UNSIGNED_AS_LITERAL_DIR, fileName), unsignedAsLiteralBody.toString(), true,
JVM_IR_FAILING_UNSIGNED_LITERAL_TESTS.contains(testFunName),
FIR_FAILING_UNSIGNED_LITERAL_TESTS.contains(testFunName));
USE_OLD_MANGLING_IN_UNSIGNED_LITERAL_TESTS.contains(testFunName));
writeToFile(new File(UNSIGNED_AS_EXPRESSION_DIR, fileName), unsignedAsExpressionBody.toString(), true,
JVM_IR_FAILING_UNSIGNED_EXPRESSION_TESTS.contains(testFunName),
FIR_FAILING_UNSIGNED_EXPRESSION_TESTS.contains(testFunName));
USE_OLD_MANGLING_IN_UNSIGNED_EXPRESSION_TESTS.contains(testFunName));
}
}
}
@@ -19,7 +19,54 @@ object GenerateSteppedRangesCodegenTestData {
private val KT_34166_AFFECTED_FILENAMES = setOf("illegalStepZero.kt", "illegalStepNegative.kt", "illegalStepNonConst.kt")
private val JVM_IR_FAILING_FOR_UNSIGNED_FILENAMES = setOf<String>()
private val FIR_FAILING_FOR_UNSIGNED_FILENAMES = setOf("minValueToMaxValueStepMaxValue.kt", "zeroToMaxValueStepMaxValue.kt")
private val USE_OLD_MANGLING_SCHEME = setOf(
"minValueToMaxValueStepMaxValue.kt",
"zeroToMaxValueStepMaxValue.kt",
"emptyDownto.kt",
"emptyProgression.kt",
"emptyProgressionToMinValue.kt",
"illegalStepNegative.kt",
"illegalStepNonConst.kt",
"illegalStepThenLegalStep.kt",
"illegalStepZero.kt",
"inexactSteppedDownTo.kt",
"legalStepThenIllegalStep.kt",
"maxValueToMinValueStepMaxValue.kt",
"maxValueToOneStepMaxValue.kt",
"maxValueToZeroStepMaxValue.kt",
"mixedTypeStep.kt",
"oneElementDownTo.kt",
"openRange.kt",
"overflowZeroDownToMaxValue.kt",
"overflowZeroToMinValue.kt",
"progressionToNonConst.kt",
"reversedBackSequence.kt",
"reversedEmptyBackSequence.kt",
"reversedInexactSteppedDownTo.kt",
"reversedThenStep.kt",
"reversedThenStepThenReversed.kt",
"reversedThenStepThenReversedThenStep.kt",
"simpleDownTo.kt",
"simpleSteppedDownTo.kt",
"singleElementStepTwo.kt",
"stepNonConst.kt",
"stepOne.kt",
"stepOneThenStepOne.kt",
"stepThenReversed.kt",
"stepThenReversedThenStep.kt",
"stepThenReversedThenStepThenReversed.kt",
"stepThenSameStep.kt",
"stepToOutsideRange.kt",
"stepToSameLast.kt",
"stepToSameLastThenStepOne.kt",
"stepToSameLastThenStepToSameLast.kt",
"stepToSameLastThenStepToSmallerLast.kt",
"stepToSmallerLast.kt",
"stepToSmallerLastThenStepOne.kt",
"stepToSmallerLastThenStepToSameLast.kt",
"stepToSmallerLastThenStepToSmallerLast.kt",
"unsignedRangeIterator.kt",
)
private enum class Type(val type: String, val isLong: Boolean = false, val isUnsigned: Boolean = false) {
INT("Int"),
@@ -165,14 +212,14 @@ object GenerateSteppedRangesCodegenTestData {
fullSubdir: File,
asLiteral: Boolean,
shouldIgnoreForJvmIR: Boolean = false,
shouldIgnoreForFir: Boolean = false,
shouldUseOldManglingScheme: Boolean = false,
) {
fullSubdir.mkdirs()
PrintWriter(File(fullSubdir, fileName)).use {
with(it) {
println("// $PREAMBLE_MESSAGE")
if (shouldIgnoreForFir) {
println("// IGNORE_BACKEND_FIR: JVM_IR")
if (shouldUseOldManglingScheme) {
println("// KOTLIN_CONFIGURATION_FLAGS: +JVM.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME")
}
if (shouldIgnoreForJvmIR) {
println("// IGNORE_BACKEND: JVM_IR")
@@ -225,7 +272,7 @@ object GenerateSteppedRangesCodegenTestData {
File(UNSIGNED_TEST_DATA_DIR, fullSubdirPath),
asLiteral,
shouldIgnoreForJvmIR = fileName in JVM_IR_FAILING_FOR_UNSIGNED_FILENAMES,
shouldIgnoreForFir = fileName in FIR_FAILING_FOR_UNSIGNED_FILENAMES,
shouldUseOldManglingScheme = fileName in USE_OLD_MANGLING_SCHEME,
)
}
if (signedTests.isNotEmpty()) {