diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBytecodeTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBytecodeTextTestGenerated.java index 5f18b57e372..8a59aa02aaf 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBytecodeTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBytecodeTextTestGenerated.java @@ -2834,9 +2834,9 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest { } @Test - @TestMetadata("ForInReversedReversedRange.kt") + @TestMetadata("forInReversedReversedRange.kt") public void testForInReversedReversedRange() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/ForInReversedReversedRange.kt"); + runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedRange.kt"); } @Test diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoElementVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoElementVar.kt index 6915d62941d..f140ecd92f5 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoElementVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoElementVar.kt @@ -32,3 +32,10 @@ fun box(): String { // The 1st ICONST_0 is for initializing the array. 2nd is for initializing the index in the lowered for-loop. // 2 ICONST_0 + +// JVM_IR_TEMPLATES +// 5 ILOAD +// 3 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoIndexVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoIndexVar.kt index ba8b3301f30..1d91c2aa375 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoIndexVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInArrayWithIndexNoIndexVar.kt @@ -32,3 +32,10 @@ fun box(): String { // The 1st ICONST_0 is for initializing the array. 2nd is for initializing the index in the lowered for-loop. // 2 ICONST_0 + +// JVM_IR_TEMPLATES +// 3 ILOAD +// 2 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInEmptyArrayWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInEmptyArrayWithIndex.kt index b48eb1195c6..91c51a2eb24 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInEmptyArrayWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInEmptyArrayWithIndex.kt @@ -29,3 +29,10 @@ fun box(): String { // The 1st ICONST_0 is for initializing the array. 2nd is for initializing the index in the lowered for-loop. // 2 ICONST_0 + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 4 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInIntArrayWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInIntArrayWithIndex.kt index db34cd1e8db..695f993240b 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInIntArrayWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInIntArrayWithIndex.kt @@ -30,3 +30,10 @@ fun box(): String { // The 1st ICONST_0 is for initializing the array. 2nd is for initializing the index in the lowered for-loop. // 2 ICONST_0 + +// JVM_IR_TEMPLATES +// 6 ILOAD +// 4 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInObjectArrayWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInObjectArrayWithIndex.kt index 9b9e6881d94..28d1226777e 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInObjectArrayWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInArrayWithIndex/forInObjectArrayWithIndex.kt @@ -32,3 +32,10 @@ fun box(): String { // The 1st ICONST_0 is for initializing the array. 2nd is for initializing the index in the lowered for-loop. // 2 ICONST_0 + +// JVM_IR_TEMPLATES +// 5 ILOAD +// 3 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequence.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequence.kt index bf9e9aaa749..744ccc74354 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequence.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequence.kt @@ -23,3 +23,10 @@ fun test() { // 0 iterator // 0 hasNext // 0 nextChar + +// JVM_IR_TEMPLATES +// 10 ILOAD +// 8 ISTORE +// 0 IADD +// 0 ISUB +// 3 IINC diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceTypeParameter.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceTypeParameter.kt index 151d23cbcd4..e1f81c041c2 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceTypeParameter.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceTypeParameter.kt @@ -19,3 +19,10 @@ fun test(sequence: T) { // 0 nextChar // 1 INVOKEINTERFACE java/lang/CharSequence\.charAt \(I\)C // 1 INVOKEINTERFACE java/lang/CharSequence\.length \(\)I + +// JVM_IR_TEMPLATES +// 3 ILOAD +// 2 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt index 2cd523c7e6b..a2271b5f593 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInCharSequenceWithIndex.kt @@ -33,3 +33,10 @@ fun box(): String { // The ICONST_0 is for initializing the index in the lowered for-loop. // 1 ICONST_0 + +// JVM_IR_TEMPLATES +// 5 ILOAD +// 3 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInEmptyStringWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInEmptyStringWithIndex.kt index 557eab3e205..fbac7c4979b 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInEmptyStringWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInEmptyStringWithIndex.kt @@ -27,3 +27,10 @@ fun box(): String { // The ICONST_0 is for initializing the index in the lowered for-loop. // 1 ICONST_0 + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 4 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndex.kt index f8e5621b2b0..0a42b93ec21 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndex.kt @@ -31,3 +31,10 @@ fun box(): String { // The ICONST_0 is for initializing the index in the lowered for-loop. // 1 ICONST_0 + +// JVM_IR_TEMPLATES +// 6 ILOAD +// 4 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoElementVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoElementVar.kt index 16514945753..672578f9453 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoElementVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoElementVar.kt @@ -33,3 +33,10 @@ fun box(): String { // The ICONST_0 is for initializing the index in the lowered for-loop. // 1 ICONST_0 + +// JVM_IR_TEMPLATES +// 5 ILOAD +// 3 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoIndexVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoIndexVar.kt index 65543114bc3..ce551be73d3 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoIndexVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexNoIndexVar.kt @@ -33,3 +33,10 @@ fun box(): String { // The ICONST_0 is for initializing the index in the lowered for-loop. // 1 ICONST_0 + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 3 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexWithExplicitlyTypedIndexVariable.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexWithExplicitlyTypedIndexVariable.kt index 4638e67914f..087edffe952 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexWithExplicitlyTypedIndexVariable.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInCharSequenceWithIndex/forInStringWithIndexWithExplicitlyTypedIndexVariable.kt @@ -36,3 +36,10 @@ fun box(): String { // The ICONST_0 is for initializing the index in the lowered for-loop. // 1 ICONST_0 + +// JVM_IR_TEMPLATES +// 7 ILOAD +// 4 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInDownToCharMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInDownToCharMinValue.kt index 2f95dabe369..7bfaf3da7a1 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInDownToCharMinValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInDownToCharMinValue.kt @@ -1,3 +1,5 @@ +// IGNORE_BACKEND_FIR: JVM_IR + // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. @@ -23,4 +25,11 @@ fun f(a: Char): Int { // 0 getFirst // 0 getLast // 0 getStep -// 2 IF \ No newline at end of file +// 2 IF + +// JVM_IR_TEMPLATES +// 5 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInDownToIntMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInDownToIntMinValue.kt index f549d731ed4..f63c3a7256b 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInDownToIntMinValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInDownToIntMinValue.kt @@ -1,3 +1,5 @@ +// IGNORE_BACKEND_FIR: JVM_IR + // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. @@ -24,4 +26,11 @@ fun f(a: Int): Int { // 0 getLast // 0 getStep // 2 IF_ICMP -// 2 IF \ No newline at end of file +// 2 IF + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 2 ISTORE +// 0 IADD +// 0 ISUB +// 2 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInDownToLongMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInDownToLongMinValue.kt index b04e9ac4c88..43371eb568f 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInDownToLongMinValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInDownToLongMinValue.kt @@ -1,3 +1,5 @@ +// IGNORE_BACKEND_FIR: JVM_IR + // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. @@ -24,4 +26,11 @@ fun f(a: Long): Int { // 0 getLast // 0 getStep // 2 LCMP -// 2 IF \ No newline at end of file +// 2 IF + +// JVM_IR_TEMPLATES +// 1 ILOAD +// 1 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInArrayListIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInArrayListIndices.kt index 6d6b64f2e71..523eef3d0ae 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInArrayListIndices.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInArrayListIndices.kt @@ -19,3 +19,10 @@ fun box(): String { } // 0 iterator + +// JVM_IR_TEMPLATES +// 3 ILOAD +// 2 ISTORE +// 0 IADD +// 0 ISUB +// 0 IINC diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceIndices.kt index 2274a5ed8c6..b9e847260ca 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceIndices.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceIndices.kt @@ -27,3 +27,9 @@ fun test(s: CharSequence): Int { // 1 IF_ICMPGE // 1 IF +// JVM_IR_TEMPLATES +// 5 ILOAD +// 4 ISTORE +// 2 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceTypeParameterIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceTypeParameterIndices.kt index b9d1a176241..2a019b68ebc 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceTypeParameterIndices.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCharSequenceTypeParameterIndices.kt @@ -27,3 +27,10 @@ fun test(s: T): Int { // 0 IF_ICMPLE // 1 IF_ICMPGE // 1 IF + +// JVM_IR_TEMPLATES +// 5 ILOAD +// 4 ISTORE +// 2 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionImplicitReceiverIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionImplicitReceiverIndices.kt index bddfdc09067..c7b68c04700 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionImplicitReceiverIndices.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionImplicitReceiverIndices.kt @@ -25,3 +25,10 @@ fun Collection.sumIndices(): Int { // 0 IF_ICMPGT // 0 IF_ICMPLE // 1 IF + +// JVM_IR_TEMPLATES +// 5 ILOAD +// 4 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionIndices.kt index ab06d2ffd19..d35db7d8fd4 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionIndices.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionIndices.kt @@ -24,3 +24,10 @@ fun test() { // 0 IF_ICMPGT // 0 IF_ICMPLE // 1 IF + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 4 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionTypeParameterIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionTypeParameterIndices.kt index 66ffeac241b..679ce618771 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionTypeParameterIndices.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInCollectionTypeParameterIndices.kt @@ -25,3 +25,10 @@ fun > test(c: T) { // 0 IF_ICMPGT // 0 IF_ICMPLE // 1 IF + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 4 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInNonOptimizedIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInNonOptimizedIndices.kt index 41b0f16cd41..b4db297b13f 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInNonOptimizedIndices.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInNonOptimizedIndices.kt @@ -23,3 +23,10 @@ fun test(coll: Collection<*>?): Int { // 1 getIndices // 1 getFirst // 1 getLast + +// JVM_IR_TEMPLATES +// 7 ILOAD +// 4 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInObjectArrayIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInObjectArrayIndices.kt index 26d71855207..653ae1bd092 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInObjectArrayIndices.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInObjectArrayIndices.kt @@ -24,3 +24,10 @@ fun test() { // 0 IF_ICMPGT // 0 IF_ICMPLE // 1 IF + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 4 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInPrimitiveArrayIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInPrimitiveArrayIndices.kt index 0e18ea8dcea..d080739b757 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInPrimitiveArrayIndices.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIndices/forInPrimitiveArrayIndices.kt @@ -24,3 +24,10 @@ fun test() { // 0 IF_ICMPGT // 0 IF_ICMPLE // 1 IF + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 4 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInEmptyListWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInEmptyListWithIndex.kt index cae16a1dc14..dcd5cbceec0 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInEmptyListWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInEmptyListWithIndex.kt @@ -28,3 +28,10 @@ fun box(): String { // - Initializing the index in the lowered for-loop. // 1 ICONST_0 + +// JVM_IR_TEMPLATES +// 2 ILOAD +// 2 ISTORE +// 1 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInIterableTypeParameterWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInIterableTypeParameterWithIndex.kt index e92ec007a0d..084b7b386e0 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInIterableTypeParameterWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInIterableTypeParameterWithIndex.kt @@ -25,3 +25,10 @@ fun > test(iterable: T): String { // 1 next // 0 component1 // 0 component2 + +// JVM_IR_TEMPLATES +// 3 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 0 IINC diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndex.kt index b098bf6aa42..40fd587bcbb 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndex.kt @@ -31,3 +31,10 @@ fun box(): String { // The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop. // 2 ICONST_0 + +// JVM_IR_TEMPLATES +// 3 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoElementVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoElementVar.kt index 63cc5f31492..a47fbf8c185 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoElementVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoElementVar.kt @@ -31,3 +31,10 @@ fun box(): String { // The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop. // 2 ICONST_0 + +// JVM_IR_TEMPLATES +// 3 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 0 IINC diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoIndexVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoIndexVar.kt index 3dbed3ecf4a..5ad138cce4f 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoIndexVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexNoIndexVar.kt @@ -31,3 +31,10 @@ fun box(): String { // The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop. // 2 ICONST_0 + +// JVM_IR_TEMPLATES +// 1 ILOAD +// 2 ISTORE +// 1 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexWithExplicitlyTypedIndexVariable.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexWithExplicitlyTypedIndexVariable.kt index 398cc02bf82..f800b6d5436 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexWithExplicitlyTypedIndexVariable.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInIterableWithIndex/forInListWithIndexWithExplicitlyTypedIndexVariable.kt @@ -34,3 +34,10 @@ fun box(): String { // The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop. // 2 ICONST_0 + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInObjectArray.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInObjectArray.kt index 2cddbdd7328..b44307c5fb0 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInObjectArray.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInObjectArray.kt @@ -1,3 +1,5 @@ +// IGNORE_BACKEND_FIR: JVM_IR + // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. @@ -21,4 +23,11 @@ fun f(): Int { // 1 INVOKESTATIC .*\.array \(\) // 1 ARRAYLENGTH // 1 IF_ICMPGE -// 1 IF \ No newline at end of file +// 1 IF + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 3 ISTORE +// 0 IADD +// 0 ISUB +// 2 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInPrimitiveArray.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInPrimitiveArray.kt index 3e759dab3de..a5e89f91a74 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInPrimitiveArray.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInPrimitiveArray.kt @@ -1,3 +1,5 @@ +// IGNORE_BACKEND_FIR: JVM_IR + // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. @@ -27,4 +29,11 @@ fun f(): Int { // 1 INVOKESTATIC .*\.longArray \(\) // 2 ARRAYLENGTH // 2 IF_ICMPGE -// 2 IF \ No newline at end of file +// 2 IF + +// JVM_IR_TEMPLATES +// 7 ILOAD +// 6 ISTORE +// 0 IADD +// 0 ISUB +// 4 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInDownToWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInDownToWithIndex.kt index d3362e0cf17..7fb258e0290 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInDownToWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInDownToWithIndex.kt @@ -37,3 +37,10 @@ fun box(): String { // 0 getFirst // 0 getLast // 0 getStep + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 5 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInIndicesWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInIndicesWithIndex.kt index 784610c55ba..b6347ea68aa 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInIndicesWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInIndicesWithIndex.kt @@ -38,3 +38,10 @@ fun box(): String { // 0 getLast // 0 getStep // 0 getIndices + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 4 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInRangeToWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInRangeToWithIndex.kt index 084c5c21b88..7b252865b27 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInRangeToWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInRangeToWithIndex.kt @@ -37,3 +37,10 @@ fun box(): String { // 0 getFirst // 0 getLast // 0 getStep + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 5 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedStepWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedStepWithIndex.kt index ae85d27c110..f472c68875c 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedStepWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedStepWithIndex.kt @@ -39,3 +39,10 @@ fun box(): String { // 0 getStep // 0 reversed // 0 step + +// JVM_IR_TEMPLATES +// 7 ILOAD +// 6 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedWithIndex.kt index 79f63663e2f..03cdc230f7c 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInReversedWithIndex.kt @@ -38,3 +38,10 @@ fun box(): String { // 0 getLast // 0 getStep // 0 reversed + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 5 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepReversedWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepReversedWithIndex.kt index e7e9f33f866..602b91dc9ac 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepReversedWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepReversedWithIndex.kt @@ -39,3 +39,10 @@ fun box(): String { // 0 getStep // 0 reversed // 0 step + +// JVM_IR_TEMPLATES +// 5 ILOAD +// 5 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepWithIndex.kt index c2e421998f4..e16f847a6fd 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInStepWithIndex.kt @@ -38,3 +38,10 @@ fun box(): String { // 0 getLast // 0 getStep // 0 step + +// JVM_IR_TEMPLATES +// 7 ILOAD +// 6 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInUntilWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInUntilWithIndex.kt index db11336839a..5dd632425ce 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInUntilWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInUntilWithIndex.kt @@ -37,3 +37,10 @@ fun box(): String { // 0 getFirst // 0 getLast // 0 getStep + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 5 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt index 327a27bbbbb..37b1492118e 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt @@ -37,3 +37,10 @@ fun box(): String { // 0 getFirst // 0 getLast // 0 getStep + +// JVM_IR_TEMPLATES +// 2 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNotDestructured.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNotDestructured.kt index 545400b6fde..a9527eb08d9 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNotDestructured.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexNotDestructured.kt @@ -22,3 +22,10 @@ fun box(): String { // 1 next // 0 component1 // 0 component2 + +// JVM_IR_TEMPLATES +// 0 ILOAD +// 0 ISTORE +// 0 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexReversed.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexReversed.kt index 1fe083d3d22..26e5a6fc6bb 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexReversed.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexReversed.kt @@ -23,3 +23,10 @@ fun box(): String { // 1 component1 // 1 component2 // 1 reversed + +// JVM_IR_TEMPLATES +// 0 ILOAD +// 2 ISTORE +// 0 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexWithIndex.kt index 4ef721301b8..deff5d27948 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInProgressionWithIndex/forInWithIndexWithIndex.kt @@ -27,3 +27,10 @@ fun box(): String { // The ICONST_0 is for initializing the index in the lowered for-loop. // 1 ICONST_0 + +// JVM_IR_TEMPLATES +// 2 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharConst.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharConst.kt index 8854d8b7f01..2bebffe8cfd 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharConst.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharConst.kt @@ -30,4 +30,11 @@ fun test(): Int { // JVM_IR_TEMPLATES // 1 IF_ICMPGE -// 1 IF \ No newline at end of file +// 1 IF + +// JVM_IR_TEMPLATES +// 5 ILOAD +// 4 ISTORE +// 2 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharMaxValue.kt index 243dbf90e77..07c2026e3bc 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharMaxValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToCharMaxValue.kt @@ -1,3 +1,5 @@ +// IGNORE_BACKEND_FIR: JVM_IR + // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. @@ -24,4 +26,11 @@ fun f(a: Char): Int { // 0 getLast // 0 getStep // 2 IF_ICMP -// 2 IF \ No newline at end of file +// 2 IF + +// JVM_IR_TEMPLATES +// 5 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToConst.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToConst.kt index 0e3fb0a2977..f70e8feab8f 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToConst.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToConst.kt @@ -27,4 +27,6 @@ fun test(): Int { // 1 IF // 4 ILOAD // 3 ISTORE +// 1 IADD +// 0 ISUB // 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToIntMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToIntMaxValue.kt index e74ea96da14..f9d4e641796 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToIntMaxValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToIntMaxValue.kt @@ -1,3 +1,5 @@ +// IGNORE_BACKEND_FIR: JVM_IR + // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. @@ -24,4 +26,11 @@ fun f(a: Int): Int { // 0 getLast // 0 getStep // 2 IF_ICMP -// 2 IF \ No newline at end of file +// 2 IF + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 2 ISTORE +// 0 IADD +// 0 ISUB +// 2 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongConst.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongConst.kt index 3c594de8274..af8251d660d 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongConst.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongConst.kt @@ -35,4 +35,11 @@ fun test(): Long { // JVM_IR_TEMPLATES // 1 LCMP // 1 IFGE -// 1 IF \ No newline at end of file +// 1 IF + +// JVM_IR_TEMPLATES +// 0 ILOAD +// 0 ISTORE +// 0 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongMaxValue.kt index 886fc86c5e1..88e5aae7969 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongMaxValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToLongMaxValue.kt @@ -1,3 +1,5 @@ +// IGNORE_BACKEND_FIR: JVM_IR + // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. @@ -24,4 +26,11 @@ fun f(a: Long): Int { // 0 getLast // 0 getStep // 2 LCMP -// 2 IF \ No newline at end of file +// 2 IF + +// JVM_IR_TEMPLATES +// 1 ILOAD +// 1 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToQualifiedConst.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToQualifiedConst.kt index cb9c0b81903..a08cfd95c64 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToQualifiedConst.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeToQualifiedConst.kt @@ -33,4 +33,11 @@ fun test(): Int { // JVM_IR_TEMPLATES // 1 IF_ICMPGE -// 1 IF \ No newline at end of file +// 1 IF + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeWithImplicitReceiver.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeWithImplicitReceiver.kt index cbd8d3f6801..8cd10e3cc54 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInRangeWithImplicitReceiver.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInRangeWithImplicitReceiver.kt @@ -22,4 +22,11 @@ fun Int.digitsUpto(end: Int): Int { // 0 getLast // 0 getStep // 2 IF_ICMP -// 2 IF \ No newline at end of file +// 2 IF + +// JVM_IR_TEMPLATES +// 8 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedArrayIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedArrayIndices.kt index 080a8e7bc03..62385353ed2 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedArrayIndices.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedArrayIndices.kt @@ -35,4 +35,11 @@ fun box(): String { // JVM_IR_TEMPLATES // 1 IF_ICMPGT // 1 IF_ICMPLE -// 2 IF \ No newline at end of file +// 2 IF + +// JVM_IR_TEMPLATES +// 7 ILOAD +// 4 ISTORE +// 3 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCharSequenceIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCharSequenceIndices.kt index 830098e512d..4f6558357ca 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCharSequenceIndices.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCharSequenceIndices.kt @@ -36,3 +36,10 @@ fun box(): String { // 1 IF_ICMPGT // 1 IF_ICMPLE // 2 IF + +// JVM_IR_TEMPLATES +// 7 ILOAD +// 4 ISTORE +// 3 IADD +// 1 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCollectionIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCollectionIndices.kt index 5a4e53a74c3..da0a8e93a23 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCollectionIndices.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedCollectionIndices.kt @@ -35,4 +35,11 @@ fun box(): String { // JVM_IR_TEMPLATES // 1 IF_ICMPGT // 1 IF_ICMPLE -// 2 IF \ No newline at end of file +// 2 IF + +// JVM_IR_TEMPLATES +// 7 ILOAD +// 4 ISTORE +// 3 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedDownTo.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedDownTo.kt index 34f72e6ef2e..2dd5747c9fb 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedDownTo.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedDownTo.kt @@ -49,4 +49,11 @@ fun box(): String { // 2 IF_ICMPLE // 1 IFLE // 4 IF -// 2 LCMP \ No newline at end of file +// 2 LCMP + +// JVM_IR_TEMPLATES +// 11 ILOAD +// 9 ISTORE +// 3 IADD +// 1 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedEmptyRangeLiteral.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedEmptyRangeLiteral.kt index dcf79ec981f..4390c7e13f5 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedEmptyRangeLiteral.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedEmptyRangeLiteral.kt @@ -27,3 +27,10 @@ fun box(): String { // 0 getFirst // 0 getLast // 0 getStep + +// JVM_IR_TEMPLATES +// 0 ILOAD +// 2 ISTORE +// 0 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRange.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRange.kt index 1baf3ee07c5..7dbfc223055 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRange.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRange.kt @@ -41,3 +41,10 @@ fun box(): String { // 0 getEnd // 3 getFirst // 3 getLast + +// JVM_IR_TEMPLATES +// 15 ILOAD +// 9 ISTORE +// 3 IADD +// 1 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRangeLiteral.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRangeLiteral.kt index b684b60295a..f9409a01c02 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRangeLiteral.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRangeLiteral.kt @@ -50,4 +50,11 @@ fun box(): String { // 1 IFGT // 1 IFLE // 4 IF -// 2 LCMP \ No newline at end of file +// 2 LCMP + +// JVM_IR_TEMPLATES +// 11 ILOAD +// 9 ISTORE +// 3 IADD +// 1 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedArrayIndices.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedArrayIndices.kt index b3f65f5e0c9..b0745b76da6 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedArrayIndices.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedArrayIndices.kt @@ -27,3 +27,10 @@ fun box(): String { // 0 getFirst // 0 getLast // 0 getStep + +// JVM_IR_TEMPLATES +// 8 ILOAD +// 4 ISTORE +// 3 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedDownTo.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedDownTo.kt index 5b75846317d..9e4567ff3ea 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedDownTo.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedDownTo.kt @@ -53,4 +53,11 @@ fun box(): String { // 1 IFGT // 1 IFLE // 4 IF -// 2 LCMP \ No newline at end of file +// 2 LCMP + +// JVM_IR_TEMPLATES +// 11 ILOAD +// 9 ISTORE +// 3 IADD +// 1 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/ForInReversedReversedRange.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedRange.kt similarity index 94% rename from compiler/testData/codegen/bytecodeText/forLoop/forInReversed/ForInReversedReversedRange.kt rename to compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedRange.kt index 494304afbfb..731b3a290f3 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/ForInReversedReversedRange.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedRange.kt @@ -41,3 +41,10 @@ fun box(): String { // 0 getEnd // 3 getFirst // 3 getLast + +// JVM_IR_TEMPLATES +// 15 ILOAD +// 9 ISTORE +// 3 IADD +// 1 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedReversedRange.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedReversedRange.kt index dd520bd1752..15766d864e8 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedReversedRange.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedReversedRange.kt @@ -41,3 +41,10 @@ fun box(): String { // 0 getEnd // 3 getFirst // 3 getLast + +// JVM_IR_TEMPLATES +// 15 ILOAD +// 9 ISTORE +// 3 IADD +// 1 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedUntil.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedUntil.kt index 250c982c418..592fbbb17f6 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedUntil.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedUntil.kt @@ -49,4 +49,11 @@ fun box(): String { // 3 reversed // 3 getFirst // 3 getLast -// 3 getStep \ No newline at end of file +// 3 getStep + +// JVM_IR_TEMPLATES +// 24 ILOAD +// 12 ISTORE +// 4 IADD +// 1 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedUntil.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedUntil.kt index 259ff412dea..907e753c44e 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedUntil.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedUntil.kt @@ -49,4 +49,11 @@ fun box(): String { // 3 reversed // 3 getFirst // 3 getLast -// 3 getStep \ No newline at end of file +// 3 getStep + +// JVM_IR_TEMPLATES +// 24 ILOAD +// 12 ISTORE +// 4 IADD +// 1 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInEmptySequenceWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInEmptySequenceWithIndex.kt index 3c3b027a558..77b7e2091bc 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInEmptySequenceWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInEmptySequenceWithIndex.kt @@ -28,3 +28,10 @@ fun box(): String { // - Initializing the index in the lowered for-loop. // 1 ICONST_0 + +// JVM_IR_TEMPLATES +// 2 ILOAD +// 2 ISTORE +// 1 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceTypeParameterWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceTypeParameterWithIndex.kt index 5fe54f65a8a..38fbb23a4fe 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceTypeParameterWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceTypeParameterWithIndex.kt @@ -25,3 +25,10 @@ fun > test(sequence: T): String { // 1 next // 0 component1 // 0 component2 + +// JVM_IR_TEMPLATES +// 3 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndex.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndex.kt index 60421e655c5..184f9008fef 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndex.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndex.kt @@ -31,3 +31,10 @@ fun box(): String { // The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop. // 2 ICONST_0 + +// JVM_IR_TEMPLATES +// 3 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoElementVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoElementVar.kt index c884418cd4d..d37a64308a6 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoElementVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoElementVar.kt @@ -31,3 +31,10 @@ fun box(): String { // The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop. // 2 ICONST_0 + +// JVM_IR_TEMPLATES +// 3 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoIndexVar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoIndexVar.kt index 86ba7f25b0f..f449ebaeacc 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoIndexVar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexNoIndexVar.kt @@ -31,3 +31,10 @@ fun box(): String { // The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop. // 2 ICONST_0 + +// JVM_IR_TEMPLATES +// 1 ILOAD +// 2 ISTORE +// 1 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexThrowsCME.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexThrowsCME.kt index 5347ddcfce0..90431bda4c4 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexThrowsCME.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexThrowsCME.kt @@ -41,3 +41,10 @@ fun box(): String { // The 1st ICONST_0 is for initializing the list. 2nd is for cmeThrown. 3rd is for initializing the index in the lowered for-loop. // 3 ICONST_0 + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 5 ISTORE +// 1 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexWithExplicitlyTypedIndexVariable.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexWithExplicitlyTypedIndexVariable.kt index 389e89fd4de..3020c0d6074 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexWithExplicitlyTypedIndexVariable.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInSequenceWithIndexWithExplicitlyTypedIndexVariable.kt @@ -34,3 +34,10 @@ fun box(): String { // The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop. // 2 ICONST_0 + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInStringSpecialized.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInStringSpecialized.kt index 488e3d59356..3f49202d343 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInStringSpecialized.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInStringSpecialized.kt @@ -20,3 +20,10 @@ fun test() { // 0 INVOKEINTERFACE // 1 charAt \(I\)C // 1 length \(\)I + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 3 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilChar.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilChar.kt index b36d158f526..7c95b84ca70 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilChar.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilChar.kt @@ -25,3 +25,10 @@ fun test(a: Char, b: Char): String { // 1 IF_ICMPGE // 0 IF_ICMPLT // 1 IF + +// JVM_IR_TEMPLATES +// 5 ILOAD +// 2 ISTORE +// 1 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMaxValue.kt index ea803f6b522..79423530c94 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMaxValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMaxValue.kt @@ -1,3 +1,5 @@ +// IGNORE_BACKEND_FIR: JVM_IR + // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. @@ -27,3 +29,10 @@ fun f(a: Char): Int { // 1 IF_ICMPGE // 0 IF_ICMPLT // 1 IF + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMinValue.kt index dc0d268c53f..15bae235dfb 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMinValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilCharMinValue.kt @@ -1,3 +1,5 @@ +// IGNORE_BACKEND_FIR: JVM_IR + // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. @@ -25,4 +27,11 @@ fun f(a: Char): Int { // 0 getStep // 1 IFGE -// 1 IF \ No newline at end of file +// 1 IF + +// JVM_IR_TEMPLATES +// 4 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilInt.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilInt.kt index 28c0a8a8c53..90442ef6f3c 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilInt.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilInt.kt @@ -24,3 +24,10 @@ fun test(a: Int, b: Int): Int { // 1 IF_ICMPGE // 1 IF + +// JVM_IR_TEMPLATES +// 6 ILOAD +// 3 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMaxValue.kt index 1ec658f8381..6394346080f 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMaxValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMaxValue.kt @@ -1,3 +1,5 @@ +// IGNORE_BACKEND_FIR: JVM_IR + // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. @@ -26,3 +28,10 @@ fun f(a: Int): Int { // 1 IF_ICMPGE // 1 IF + +// JVM_IR_TEMPLATES +// 3 ILOAD +// 2 ISTORE +// 0 IADD +// 0 ISUB +// 2 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMinValue.kt index ed369f80ae7..962da644a37 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMinValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilIntMinValue.kt @@ -1,3 +1,5 @@ +// IGNORE_BACKEND_FIR: JVM_IR + // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. @@ -29,3 +31,10 @@ fun f(a: Int): Int { // 1 IF_ICMPGE // 1 IF + +// JVM_IR_TEMPLATES +// 3 ILOAD +// 2 ISTORE +// 0 IADD +// 0 ISUB +// 2 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLong.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLong.kt index 1b6265e7193..6cbc3fb0fd4 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLong.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLong.kt @@ -25,3 +25,10 @@ fun test(a: Long, b: Long): Long { // 1 LCMP // 1 IFGE // 1 IF + +// JVM_IR_TEMPLATES +// 0 ILOAD +// 0 ISTORE +// 0 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMaxValue.kt index e2d012a73b7..29e2a14bd27 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMaxValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMaxValue.kt @@ -1,3 +1,5 @@ +// IGNORE_BACKEND_FIR: JVM_IR + // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. @@ -27,3 +29,10 @@ fun f(a: Long): Int { // 1 LCMP // 1 IFGE // 1 IF + +// JVM_IR_TEMPLATES +// 1 ILOAD +// 1 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMinValue.kt index 9f4a80964ff..5c8ccd7b8e6 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMinValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forInUntil/forInUntilLongMinValue.kt @@ -1,3 +1,5 @@ +// IGNORE_BACKEND_FIR: JVM_IR + // IMPORTANT! // Please, when your changes cause failures in bytecodeText tests for 'for' loops, // examine the resulting bytecode shape carefully. @@ -26,3 +28,10 @@ fun f(a: Long): Int { // 1 IFGE // 1 IF + +// JVM_IR_TEMPLATES +// 1 ILOAD +// 1 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/forIntInDownTo.kt b/compiler/testData/codegen/bytecodeText/forLoop/forIntInDownTo.kt index f348020210b..6e96c3673cc 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/forIntInDownTo.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/forIntInDownTo.kt @@ -21,4 +21,11 @@ fun test(): Int { // 0 getFirst // 0 getLast // 1 IF_ICMP -// 1 IF \ No newline at end of file +// 1 IF + +// JVM_IR_TEMPLATES +// 5 ILOAD +// 4 ISTORE +// 1 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/iincGeneration.kt b/compiler/testData/codegen/bytecodeText/forLoop/iincGeneration.kt index bb704b078d5..a2c687a2f58 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/iincGeneration.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/iincGeneration.kt @@ -40,5 +40,8 @@ fun uShortRangeTo(a: UShort, b: UShort) { for (i in a .. b) {} } // 16 IINC // JVM_IR_TEMPLATES +// 136 ILOAD +// 56 ISTORE // 0 IADD -// 20 IINC +// 0 ISUB +// 20 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/intrinsicArrayConstructorsUseCounterLoop.kt b/compiler/testData/codegen/bytecodeText/forLoop/intrinsicArrayConstructorsUseCounterLoop.kt index 8d25daf6edf..6eb14f9aa50 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/intrinsicArrayConstructorsUseCounterLoop.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/intrinsicArrayConstructorsUseCounterLoop.kt @@ -35,4 +35,11 @@ fun testObjectArray(n: Int) = // 0 IF_ICMPGT // 0 IF_CMPEQ -// 8 IF_ICMPGE \ No newline at end of file +// 8 IF_ICMPGE + +// JVM_IR_TEMPLATES +// 56 ILOAD +// 24 ISTORE +// 8 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange1.kt b/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange1.kt index d24916cc6d5..ae9b22b4435 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange1.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange1.kt @@ -27,3 +27,10 @@ fun f() { // JVM_IR_TEMPLATES // 1 IF_ICMPGE // 1 IF + +// JVM_IR_TEMPLATES +// 1 ILOAD +// 1 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC diff --git a/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange2.kt b/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange2.kt index 084fedc7e3e..fd6bc2711a7 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange2.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/primitiveLiteralRange2.kt @@ -19,4 +19,11 @@ fun f(a: Int, b: Int) { // 0 getLast // 0 getStep // 2 IF_ICMP -// 2 IF \ No newline at end of file +// 2 IF + +// JVM_IR_TEMPLATES +// 5 ILOAD +// 1 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/stepped/illegalStepConst.kt b/compiler/testData/codegen/bytecodeText/forLoop/stepped/illegalStepConst.kt index 8297e69152f..d03587c4064 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/stepped/illegalStepConst.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/stepped/illegalStepConst.kt @@ -29,4 +29,11 @@ fun box(): String { // 1 NEW java/lang/IllegalArgumentException // 1 ATHROW // 0 IF -// 0 ARETURN \ No newline at end of file +// 0 ARETURN + +// JVM_IR_TEMPLATES +// 0 ILOAD +// 0 ISTORE +// 0 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOne.kt b/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOne.kt index e468f03715b..8f037f5d09a 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOne.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOne.kt @@ -18,20 +18,6 @@ fun box(): String { // For "step" progressions in JVM IR, when the step is constant and == 1, and "step" is called on a literal progression which we already // know to have a step whose absolute value is 1, we can essentially ignore the "step" call. -// -// Expected lowered form of loop: -// -// // Standard form of loop over progression -// var inductionVar = 1 -// val last = 4 -// if (inductionVar <= last) { -// // Loop is not empty -// do { -// val i = inductionVar -// inductionVar += 1 -// // Loop body -// } while (inductionVar <= last) -// } // 0 iterator // 0 getStart @@ -43,4 +29,11 @@ fun box(): String { // 0 NEW java/lang/IllegalArgumentException // 0 ATHROW // 1 IF_ICMPLE -// 1 IF \ No newline at end of file +// 1 IF + +// JVM_IR_TEMPLATES +// 2 ILOAD +// 2 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOneThenStepOne.kt b/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOneThenStepOne.kt index 03f7ee8aa95..53d93cc0dde 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOneThenStepOne.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepOneThenStepOne.kt @@ -18,20 +18,7 @@ fun box(): String { // For "step" progressions in JVM IR, when the step is constant and == 1, and "step" is called on a literal progression which we already // know to have a step whose absolute value is 1, we can essentially ignore the "step" call. -// -// Expected lowered form of loop: -// -// // Standard form of loop over progression -// var inductionVar = 1 -// val last = 4 -// if (inductionVar <= last) { -// // Loop is not empty -// do { -// val i = inductionVar -// inductionVar += 1 -// // Loop body -// } while (inductionVar <= last) -// } + // 0 iterator // 0 getStart @@ -43,4 +30,11 @@ fun box(): String { // 0 NEW java/lang/IllegalArgumentException // 0 ATHROW // 1 IF_ICMPLE -// 1 IF \ No newline at end of file +// 1 IF + +// JVM_IR_TEMPLATES +// 2 ILOAD +// 2 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepThenReversed.kt b/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepThenReversed.kt index a45cd974a17..eaf4b0bcedf 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepThenReversed.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/stepped/stepThenReversed.kt @@ -19,20 +19,6 @@ fun box(): String { // For "step" progressions in JVM IR, a call to getProgressionLastElement() is made to compute the "last" value. // If the step is non-constant, there is a check that it is > 0, and if not, an IllegalArgumentException is thrown. However, when the // step is constant and > 0, this check does not need to be added. -// -// Expected lowered form of loop: -// -// // Standard form of loop over progression -// val last = 1 -// var inductionVar = getProgressionLastElement(1, 8, 2) -// if (last <= inductionVar) { -// // Loop is not empty -// do { -// val i = inductionVar -// inductionVar += -2 -// // Loop body -// } while (last <= inductionVar) -// } // 0 reversed // 0 iterator @@ -46,4 +32,11 @@ fun box(): String { // 0 ATHROW // 1 IF_ICMPGT // 1 IF_ICMPLE -// 2 IF \ No newline at end of file +// 2 IF + +// JVM_IR_TEMPLATES +// 3 ILOAD +// 2 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToUIntMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToUIntMinValue.kt index 01ab7c32414..7e0422e2c95 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToUIntMinValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToUIntMinValue.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME // IMPORTANT! @@ -29,3 +30,11 @@ fun f(a: UInt): Int { // 2 IF // 0 INVOKESTATIC kotlin/UInt.constructor-impl // 0 INVOKE\w+ kotlin/UInt.(un)?box-impl + + +// JVM_IR_TEMPLATES +// 8 ILOAD +// 6 ISTORE +// 0 IADD +// 0 ISUB +// 2 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToULongMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToULongMinValue.kt index 3682f7b80c5..53bfb08e03e 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToULongMinValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInDownToULongMinValue.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME // IMPORTANT! @@ -29,3 +30,11 @@ fun f(a: ULong): Int { // 2 IF // 0 INVOKESTATIC kotlin/ULong.constructor-impl // 0 INVOKE\w+ kotlin/ULong.(un)?box-impl + + +// JVM_IR_TEMPLATES +// 1 ILOAD +// 1 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInOptimizableUnsignedRange.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInOptimizableUnsignedRange.kt index d45d23280af..5b4b45838c4 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInOptimizableUnsignedRange.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInOptimizableUnsignedRange.kt @@ -67,3 +67,11 @@ fun testULongDownTo(a: ULong, b: ULong): Int { // 0 getStep // 0 INVOKESTATIC kotlin/U(Int|Long).constructor-impl // 0 INVOKE\w+ kotlin/U(Int|Long).(un)?box-impl + + +// JVM_IR_TEMPLATES +// 40 ILOAD +// 27 ISTORE +// 6 IADD +// 0 ISUB +// 3 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToUIntMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToUIntMaxValue.kt index 32d19b7f367..187addbfb31 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToUIntMaxValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToUIntMaxValue.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME // IMPORTANT! @@ -29,3 +30,10 @@ fun f(a: UInt): Int { // 2 IF // 0 INVOKESTATIC kotlin/UInt.constructor-impl // 0 INVOKE\w+ kotlin/UInt.(un)?box-impl + +// JVM_IR_TEMPLATES +// 9 ILOAD +// 6 ISTORE +// 0 IADD +// 0 ISUB +// 2 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToULongMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToULongMaxValue.kt index eb984c85fa1..bf00ec29b91 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToULongMaxValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInRangeToULongMaxValue.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME // IMPORTANT! @@ -29,3 +30,10 @@ fun f(a: ULong): Int { // 2 IF // 0 INVOKESTATIC kotlin/ULong.constructor-impl // 0 INVOKE\w+ kotlin/ULong.(un)?box-impl + +// JVM_IR_TEMPLATES +// 1 ILOAD +// 1 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMaxValue.kt index 68214dfd782..ec46f0084ca 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMaxValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMaxValue.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME // IMPORTANT! @@ -36,4 +37,11 @@ fun f(a: UInt): Int { // JVM_IR_TEMPLATES // 1 INVOKESTATIC kotlin/UnsignedKt.uintCompare // 1 IFGE -// 1 IF \ No newline at end of file +// 1 IF + +// JVM_IR_TEMPLATES +// 7 ILOAD +// 6 ISTORE +// 0 IADD +// 0 ISUB +// 2 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMinValue.kt index 77808f3d312..378396adb31 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMinValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilUIntMinValue.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME // IMPORTANT! @@ -36,3 +37,10 @@ fun f(a: UInt): Int { // JVM_IR_TEMPLATES // 1 IF + +// JVM_IR_TEMPLATES +// 7 ILOAD +// 6 ISTORE +// 0 IADD +// 0 ISUB +// 2 IINC diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMaxValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMaxValue.kt index a33f293b145..f52bb4df903 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMaxValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMaxValue.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME // IMPORTANT! @@ -39,4 +40,11 @@ fun f(a: ULong): Int { // JVM_IR_TEMPLATES // 1 INVOKESTATIC kotlin/UnsignedKt.ulongCompare // 1 IFGE -// 1 IF \ No newline at end of file +// 1 IF + +// JVM_IR_TEMPLATES +// 1 ILOAD +// 1 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMinValue.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMinValue.kt index 82e8312ce28..086ed5482ab 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMinValue.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/forInUntilULongMinValue.kt @@ -1,3 +1,4 @@ +// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME // IMPORTANT! @@ -36,3 +37,10 @@ fun f(a: ULong): Int { // JVM_IR_TEMPLATES // 1 IF + +// JVM_IR_TEMPLATES +// 1 ILOAD +// 1 ISTORE +// 0 IADD +// 0 ISUB +// 1 IINC diff --git a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/illegalStepConst.kt b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/illegalStepConst.kt index 366c5cab316..ef7941e20a5 100644 --- a/compiler/testData/codegen/bytecodeText/forLoop/unsigned/illegalStepConst.kt +++ b/compiler/testData/codegen/bytecodeText/forLoop/unsigned/illegalStepConst.kt @@ -33,3 +33,10 @@ fun box(): String { // 0 ARETURN // 0 INVOKESTATIC kotlin/UInt.constructor-impl // 0 INVOKE\w+ kotlin/UInt.(un)?box-impl + +// JVM_IR_TEMPLATES +// 0 ILOAD +// 0 ISTORE +// 0 IADD +// 0 ISUB +// 0 IINC \ No newline at end of file diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeTextTestGenerated.java index bc9c67402e4..7e18d81788d 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeTextTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeTextTestGenerated.java @@ -2810,9 +2810,9 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { } @Test - @TestMetadata("ForInReversedReversedRange.kt") + @TestMetadata("forInReversedReversedRange.kt") public void testForInReversedReversedRange() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/ForInReversedReversedRange.kt"); + runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedRange.kt"); } @Test diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeTextTestGenerated.java index b81907d8eb0..e111da59da3 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeTextTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeTextTestGenerated.java @@ -2834,9 +2834,9 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest { } @Test - @TestMetadata("ForInReversedReversedRange.kt") + @TestMetadata("forInReversedReversedRange.kt") public void testForInReversedReversedRange() throws Exception { - runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/ForInReversedReversedRange.kt"); + runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedRange.kt"); } @Test