mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
JVM_IR indy-SAM: use '-Xsam-conversions=indy' if JVM 1.8+, LV 1.5+
This commit is contained in:
committed by
TeamCityServer
parent
bf844aa8e4
commit
00a335129b
@@ -213,13 +213,13 @@ class GenerationState private constructor(
|
||||
val fromConfig = configuration.get(JVMConfigurationKeys.SAM_CONVERSIONS)
|
||||
if (fromConfig != null && target >= fromConfig.minJvmTarget)
|
||||
fromConfig
|
||||
else {
|
||||
// TODO wait for KT-44844 (properly support 'invokedynamic' in JPS incremental compilation)
|
||||
// Use JvmClosureGenerationScheme.INDY if
|
||||
// JVM target is at least JVM_1_8 &&
|
||||
// SamWrapperClassesAreSynthetic language feature is supported
|
||||
else if (
|
||||
target >= JvmClosureGenerationScheme.INDY.minJvmTarget &&
|
||||
languageVersionSettings.supportsFeature(LanguageFeature.SamWrapperClassesAreSynthetic)
|
||||
)
|
||||
JvmClosureGenerationScheme.INDY
|
||||
else
|
||||
JvmClosureGenerationScheme.CLASS
|
||||
}
|
||||
}
|
||||
|
||||
val lambdasScheme = run {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// SAM_CONVERSIONS: CLASS
|
||||
// FILE: J.java
|
||||
|
||||
public class J {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// SAM_CONVERSIONS: CLASS
|
||||
// This optimization is only done by the JVM_IR backend.
|
||||
// IGNORE_BACKEND: JVM
|
||||
// FILE: JFoo.java
|
||||
@@ -17,7 +18,6 @@ fun test() {
|
||||
JFoo.foo(A()::f)
|
||||
}
|
||||
|
||||
// Referenced function called from run(), no wrapper class generated:
|
||||
// 1 NEW A
|
||||
// 2 NEW
|
||||
// 0 INVOKEINTERFACE
|
||||
|
||||
@@ -25,5 +25,11 @@ inline fun inlineFun() {
|
||||
// There should be no generic information in the SAM wrappers.
|
||||
// 0 declaration: void <init>\(kotlin.jvm.functions.Function1<.*, .*>\)
|
||||
// 0 declaration: function extends kotlin.jvm.functions.Function1<.*, .*>
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 2 private final synthetic Lkotlin/jvm/functions/Function1; function
|
||||
// 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
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// ^ JVM_IR back-end generates SAM conversion with invokedynamic
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun box(): String {
|
||||
@@ -13,4 +15,4 @@ fun box(): String {
|
||||
throw Exception("!samJavaClass.isAnonymousClass(): '${samJavaClass.name}'")
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
LineBreakpoint created at samAdapter.kt:6
|
||||
Run Java
|
||||
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.testDelegatedNested, 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