JVM_IR KT-34594 strip fake variable initialization during inlining
This commit is contained in:
Vendored
+4
-4
@@ -17,13 +17,13 @@ fun box(): String {
|
||||
}
|
||||
|
||||
|
||||
// Shared variable slots (x1, x2):
|
||||
// 4 ILOAD 6
|
||||
// 4 ISTORE 6
|
||||
|
||||
// Temporary variable for 'x2++' + store to fake variable marking the outer `run`:
|
||||
// 2 ISTORE 1
|
||||
|
||||
// 0 NEW
|
||||
// 0 GETFIELD
|
||||
// 0 PUTFIELD
|
||||
|
||||
// No fake variables for @InlineOnly functions
|
||||
// 0 ILOAD 6
|
||||
// 0 ISTORE 6
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ fun main(args: Array<String>) {
|
||||
@BuilderInference
|
||||
suspend fun SequenceScope<Int>.awaitSeq(): Int = 42
|
||||
|
||||
// 1 LINENUMBER 9 L19
|
||||
// 1 LOCALVARIABLE a I L[0-9]+ L18
|
||||
// 1 LINENUMBER 9 L18
|
||||
// 1 LOCALVARIABLE a I L[0-9]+ L17
|
||||
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
Vendored
+2
-2
@@ -16,5 +16,5 @@ fun box(): String {
|
||||
// 0 component1
|
||||
// 0 component2
|
||||
|
||||
// The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop.
|
||||
// 2 ICONST_0
|
||||
// - Initializing the index in the lowered for-loop.
|
||||
// 1 ICONST_0
|
||||
|
||||
compiler/testData/codegen/bytecodeText/forLoop/forInSequenceWithIndex/forInEmptySequenceWithIndex.kt
Vendored
+2
-2
@@ -16,5 +16,5 @@ fun box(): String {
|
||||
// 0 component1
|
||||
// 0 component2
|
||||
|
||||
// The 1st ICONST_0 is for initializing the list. 2nd is for initializing the index in the lowered for-loop.
|
||||
// 2 ICONST_0
|
||||
// - Initializing the index in the lowered for-loop.
|
||||
// 1 ICONST_0
|
||||
|
||||
@@ -49,4 +49,5 @@ class A {
|
||||
|
||||
fun calcRequiredLayoutSize(count: Int, max: Int, toInt: Int) = 0
|
||||
|
||||
// 3 ISTORE 10
|
||||
|
||||
// 2 ISTORE 10
|
||||
+13
-7
@@ -1,17 +1,23 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
||||
@kotlin.internal.InlineOnly
|
||||
inline fun inlineOnlyFun() = 42
|
||||
inline fun inlineOnlyFun(): Int {
|
||||
var unused = 0
|
||||
var used1 = 0
|
||||
var used2 = 0
|
||||
++used2
|
||||
return 42 + used1
|
||||
}
|
||||
|
||||
fun test() = inlineOnlyFun()
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 1 LDC 0
|
||||
// 1 ICONST_0
|
||||
// 0 ISTORE 1
|
||||
// 2 ISTORE 0
|
||||
// 5 ICONST_0
|
||||
// 6 ISTORE
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 0 LDC 0
|
||||
// 0 ICONST_0
|
||||
// 0 ISTORE 1
|
||||
// 0 ISTORE 0
|
||||
// 5 ICONST_0
|
||||
// 5 ISTORE
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.math.sin
|
||||
|
||||
fun test(x: Double) = sin(x)
|
||||
|
||||
// 0 LDC 0
|
||||
// 0 ICONST_0
|
||||
// 0 ISTORE
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(xs: List<String>) =
|
||||
xs.map { it.length }
|
||||
|
||||
// $i$f$map, $i$f$mapTo, $i$a$-map-NoFakeVariableForInlineOnlyFunMapKt$test$1
|
||||
// 3 ICONST_0
|
||||
// 3 ISTORE
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() = run {
|
||||
var tmp = 0
|
||||
"OK"
|
||||
}
|
||||
|
||||
// 2 LOCALVARIABLE
|
||||
// 1 LOCALVARIABLE tmp I
|
||||
// 1 LOCALVARIABLE \$i\$a\$-run-NoFakeVariableForInlineOnlyFunWithLambdaKt\$test\$1 I
|
||||
|
||||
// 0 LDC 0
|
||||
// 2 ICONST_0
|
||||
// 2 ISTORE
|
||||
Reference in New Issue
Block a user