JVM_IR indy-SAM: use '-Xsam-conversions=indy' if JVM 1.8+, LV 1.5+
This commit is contained in:
@@ -213,13 +213,13 @@ class GenerationState private constructor(
|
|||||||
val fromConfig = configuration.get(JVMConfigurationKeys.SAM_CONVERSIONS)
|
val fromConfig = configuration.get(JVMConfigurationKeys.SAM_CONVERSIONS)
|
||||||
if (fromConfig != null && target >= fromConfig.minJvmTarget)
|
if (fromConfig != null && target >= fromConfig.minJvmTarget)
|
||||||
fromConfig
|
fromConfig
|
||||||
else {
|
else if (
|
||||||
// TODO wait for KT-44844 (properly support 'invokedynamic' in JPS incremental compilation)
|
target >= JvmClosureGenerationScheme.INDY.minJvmTarget &&
|
||||||
// Use JvmClosureGenerationScheme.INDY if
|
languageVersionSettings.supportsFeature(LanguageFeature.SamWrapperClassesAreSynthetic)
|
||||||
// JVM target is at least JVM_1_8 &&
|
)
|
||||||
// SamWrapperClassesAreSynthetic language feature is supported
|
JvmClosureGenerationScheme.INDY
|
||||||
|
else
|
||||||
JvmClosureGenerationScheme.CLASS
|
JvmClosureGenerationScheme.CLASS
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val lambdasScheme = run {
|
val lambdasScheme = run {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// SAM_CONVERSIONS: CLASS
|
||||||
// FILE: J.java
|
// FILE: J.java
|
||||||
|
|
||||||
public class J {
|
public class J {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// SAM_CONVERSIONS: CLASS
|
||||||
// This optimization is only done by the JVM_IR backend.
|
// This optimization is only done by the JVM_IR backend.
|
||||||
// IGNORE_BACKEND: JVM
|
// IGNORE_BACKEND: JVM
|
||||||
// FILE: JFoo.java
|
// FILE: JFoo.java
|
||||||
@@ -17,7 +18,6 @@ fun test() {
|
|||||||
JFoo.foo(A()::f)
|
JFoo.foo(A()::f)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Referenced function called from run(), no wrapper class generated:
|
|
||||||
// 1 NEW A
|
// 1 NEW A
|
||||||
// 2 NEW
|
// 2 NEW
|
||||||
// 0 INVOKEINTERFACE
|
// 0 INVOKEINTERFACE
|
||||||
|
|||||||
@@ -25,5 +25,11 @@ inline fun inlineFun() {
|
|||||||
// There should be no generic information in the SAM wrappers.
|
// There should be no generic information in the SAM wrappers.
|
||||||
// 0 declaration: void <init>\(kotlin.jvm.functions.Function1<.*, .*>\)
|
// 0 declaration: void <init>\(kotlin.jvm.functions.Function1<.*, .*>\)
|
||||||
// 0 declaration: function extends kotlin.jvm.functions.Function1<.*, .*>
|
// 0 declaration: function extends kotlin.jvm.functions.Function1<.*, .*>
|
||||||
|
|
||||||
|
// JVM_TEMPLATES
|
||||||
// 2 private final synthetic Lkotlin/jvm/functions/Function1; function
|
// 2 private final synthetic Lkotlin/jvm/functions/Function1; function
|
||||||
// 2 <init>\(Lkotlin/jvm/functions/Function1;\)V
|
// 2 <init>\(Lkotlin/jvm/functions/Function1;\)V
|
||||||
|
|
||||||
|
// JVM_IR_TEMPLATES
|
||||||
|
// 1 private final synthetic Lkotlin/jvm/functions/Function1; function
|
||||||
|
// 1 <init>\(Lkotlin/jvm/functions/Function1;\)V
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// ^ JVM_IR back-end generates SAM conversion with invokedynamic
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// IGNORE_BACKEND: JVM_IR
|
||||||
LineBreakpoint created at samAdapter.kt:6
|
LineBreakpoint created at samAdapter.kt:6
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
@@ -103,3 +103,7 @@ org.jetbrains.kotlin.idea.caches.resolve.IdeCompiledLightClassTestGenerated.Scri
|
|||||||
org.jetbrains.kotlin.idea.caches.resolve.IdeCompiledLightClassTestGenerated.Script.testInnerClasses, KT-44472,,
|
org.jetbrains.kotlin.idea.caches.resolve.IdeCompiledLightClassTestGenerated.Script.testInnerClasses, KT-44472,,
|
||||||
org.jetbrains.kotlin.idea.caches.resolve.IdeCompiledLightClassTestGenerated.testDelegatedNested, KT-44472,,
|
org.jetbrains.kotlin.idea.caches.resolve.IdeCompiledLightClassTestGenerated.testDelegatedNested, KT-44472,,
|
||||||
org.jetbrains.kotlin.idea.caches.resolve.IdeCompiledLightClassTestGenerated.testDelegation, KT-44472,,
|
org.jetbrains.kotlin.idea.caches.resolve.IdeCompiledLightClassTestGenerated.testDelegation, KT-44472,,
|
||||||
|
org.jetbrains.kotlin.jps.build.IncrementalJvmJpsTestGenerated.WithJava.JavaUsedInKotlin.SamConversions.testMethodAdded, KT-44844 fixed in IDEA 212,,
|
||||||
|
org.jetbrains.kotlin.jps.build.IncrementalJvmJpsTestGenerated.WithJava.JavaUsedInKotlin.SamConversions.testMethodAddedSamAdapter, KT-44844 fixed in IDEA 212,,
|
||||||
|
org.jetbrains.kotlin.jps.build.IncrementalJvmJpsTestGenerated.WithJava.JavaUsedInKotlin.SamConversions.testMethodSignatureChanged, KT-44844 fixed in IDEA 212,,
|
||||||
|
org.jetbrains.kotlin.jps.build.IncrementalJvmJpsTestGenerated.WithJava.JavaUsedInKotlin.SamConversions.testMethodSignatureChangedSamAdapter, KT-44844 fixed in IDEA 212,,
|
||||||
|
|||||||
|
Reference in New Issue
Block a user