JVM_IR: create temporaries for complex super constructor arguments

As for SAM wrappers, the bytecode sequence

    new A
    dup
    new B
    dup
    invokespecial B.<init>
    invokespecial A.<init>

breaks the inliner, so instead we do

    new B
    dup
    invokespecial B.<init>
    store x
    new A
    dup
    load x
    invokespecial A.<init>
This commit is contained in:
pyos
2019-10-22 10:03:58 +02:00
committed by max-kammerer
parent 42f75b3247
commit 5d8aac456f
6 changed files with 53 additions and 11 deletions
@@ -0,0 +1,13 @@
// IGNORE_BACKEND: JVM
// IGNORE_BACKEND_MULTI_MODULE: JVM
// FILE: 1.kt
package test
open class C(val x: () -> String)
inline fun f(crossinline g: () -> String) = object : C({ g() }) {}
// FILE: 2.kt
import test.*
fun box(): String = f { "OK" }.x()