From 02b5b931d4abef099de89ef14016570f96e22980 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Wed, 10 Mar 2021 07:39:29 +0300 Subject: [PATCH] Revert "JVM_IR indy-SAM: use '-Xsam-conversions=indy' if JVM 1.8+, LV 1.5+" This reverts commit 679756ad --- .../kotlin/codegen/state/GenerationState.kt | 12 ++++++------ .../bytecodeText/sam/samWrapperInInlineLambda.kt | 1 - .../bytecodeText/sam/samWrapperOfReference.kt | 2 +- .../codegen/bytecodeText/sam/samWrapperRawTypes.kt | 6 ------ compiler/testData/codegen/java9/box/kt36984.kt | 4 +--- .../testData/stepping/stepInto/samAdapter.out | 1 - tests/mute-common.csv | 4 ---- 7 files changed, 8 insertions(+), 22 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt index 2762a4abb61..baf2c282898 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt @@ -213,13 +213,13 @@ class GenerationState private constructor( val fromConfig = configuration.get(JVMConfigurationKeys.SAM_CONVERSIONS) if (fromConfig != null && target >= fromConfig.minJvmTarget) fromConfig - else if ( - target >= JvmClosureGenerationScheme.INDY.minJvmTarget && - languageVersionSettings.supportsFeature(LanguageFeature.SamWrapperClassesAreSynthetic) - ) - JvmClosureGenerationScheme.INDY - else + 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 JvmClosureGenerationScheme.CLASS + } } val lambdasScheme = run { diff --git a/compiler/testData/codegen/bytecodeText/sam/samWrapperInInlineLambda.kt b/compiler/testData/codegen/bytecodeText/sam/samWrapperInInlineLambda.kt index c3f5e372ea3..b4f83ded013 100644 --- a/compiler/testData/codegen/bytecodeText/sam/samWrapperInInlineLambda.kt +++ b/compiler/testData/codegen/bytecodeText/sam/samWrapperInInlineLambda.kt @@ -1,4 +1,3 @@ -// SAM_CONVERSIONS: CLASS // FILE: J.java public class J { diff --git a/compiler/testData/codegen/bytecodeText/sam/samWrapperOfReference.kt b/compiler/testData/codegen/bytecodeText/sam/samWrapperOfReference.kt index 23c85c47db3..b0e5071ab8c 100644 --- a/compiler/testData/codegen/bytecodeText/sam/samWrapperOfReference.kt +++ b/compiler/testData/codegen/bytecodeText/sam/samWrapperOfReference.kt @@ -1,4 +1,3 @@ -// SAM_CONVERSIONS: CLASS // This optimization is only done by the JVM_IR backend. // IGNORE_BACKEND: JVM // FILE: JFoo.java @@ -18,6 +17,7 @@ fun test() { JFoo.foo(A()::f) } +// Referenced function called from run(), no wrapper class generated: // 1 NEW A // 2 NEW // 0 INVOKEINTERFACE diff --git a/compiler/testData/codegen/bytecodeText/sam/samWrapperRawTypes.kt b/compiler/testData/codegen/bytecodeText/sam/samWrapperRawTypes.kt index af728765eea..c8886a50cf1 100644 --- a/compiler/testData/codegen/bytecodeText/sam/samWrapperRawTypes.kt +++ b/compiler/testData/codegen/bytecodeText/sam/samWrapperRawTypes.kt @@ -25,11 +25,5 @@ inline fun inlineFun() { // There should be no generic information in the SAM wrappers. // 0 declaration: void \(kotlin.jvm.functions.Function1<.*, .*>\) // 0 declaration: function extends kotlin.jvm.functions.Function1<.*, .*> - -// JVM_TEMPLATES // 2 private final synthetic Lkotlin/jvm/functions/Function1; function // 2 \(Lkotlin/jvm/functions/Function1;\)V - -// JVM_IR_TEMPLATES -// 1 private final synthetic Lkotlin/jvm/functions/Function1; function -// 1 \(Lkotlin/jvm/functions/Function1;\)V diff --git a/compiler/testData/codegen/java9/box/kt36984.kt b/compiler/testData/codegen/java9/box/kt36984.kt index 1488adc42b7..2d7b725c713 100644 --- a/compiler/testData/codegen/java9/box/kt36984.kt +++ b/compiler/testData/codegen/java9/box/kt36984.kt @@ -1,6 +1,4 @@ // TARGET_BACKEND: JVM -// IGNORE_BACKEND: JVM_IR -// ^ JVM_IR back-end generates SAM conversion with invokedynamic // WITH_RUNTIME fun box(): String { @@ -15,4 +13,4 @@ fun box(): String { throw Exception("!samJavaClass.isAnonymousClass(): '${samJavaClass.name}'") return "OK" -} +} \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepInto/samAdapter.out b/idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepInto/samAdapter.out index d794677211d..b7499b8d4ab 100644 --- a/idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepInto/samAdapter.out +++ b/idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepInto/samAdapter.out @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR LineBreakpoint created at samAdapter.kt:6 Run Java Connected to the target VM diff --git a/tests/mute-common.csv b/tests/mute-common.csv index 0135912db41..bf13f1265df 100644 --- a/tests/mute-common.csv +++ b/tests/mute-common.csv @@ -103,7 +103,3 @@ 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,,