From d080297c20dd6363ed92ce349ba66e83f2726a57 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Tue, 5 Jul 2022 11:25:27 +0200 Subject: [PATCH] Revert "Add tests on variable spilling with debug mode enabled" This reverts commit 65bb6abae4380c13825ea1ecc0e42ae181f604fb. --- .../FirBlackBoxCodegenTestGenerated.java | 58 ---------- compiler/testData/cli/jvm/extraHelp.out | 2 - .../varSpilling/debugMode/backEdge.kt | 57 ---------- .../coroutines/varSpilling/debugMode/if.kt | 76 ------------- .../varSpilling/debugMode/nullCleanup.kt | 57 ---------- .../varSpilling/debugMode/nullNotSpill.kt | 55 ---------- .../varSpilling/debugMode/simple.kt | 59 ---------- .../varSpilling/debugMode/twoRefs.kt | 62 ----------- .../debugMode/unusedParamNotSpill.kt | 44 -------- .../coroutines/varSpilling/debugMode/when.kt | 103 ------------------ .../codegen/BlackBoxCodegenTestGenerated.java | 10 -- .../IrBlackBoxCodegenTestGenerated.java | 58 ---------- .../JvmEnvironmentConfigurationDirectives.kt | 2 - .../AbstractJvmBlackBoxCodegenTestBase.kt | 7 -- .../JvmEnvironmentConfigurator.kt | 2 - .../LightAnalysisModeTestGenerated.java | 13 --- .../js/test/JsCodegenBoxTestGenerated.java | 10 -- .../test/ir/IrJsCodegenBoxTestGenerated.java | 10 -- .../IrCodegenBoxWasmTestGenerated.java | 13 --- .../NativeCodegenBoxTestGenerated.java | 12 -- 20 files changed, 710 deletions(-) delete mode 100644 compiler/testData/codegen/box/coroutines/varSpilling/debugMode/backEdge.kt delete mode 100644 compiler/testData/codegen/box/coroutines/varSpilling/debugMode/if.kt delete mode 100644 compiler/testData/codegen/box/coroutines/varSpilling/debugMode/nullCleanup.kt delete mode 100644 compiler/testData/codegen/box/coroutines/varSpilling/debugMode/nullNotSpill.kt delete mode 100644 compiler/testData/codegen/box/coroutines/varSpilling/debugMode/simple.kt delete mode 100644 compiler/testData/codegen/box/coroutines/varSpilling/debugMode/twoRefs.kt delete mode 100644 compiler/testData/codegen/box/coroutines/varSpilling/debugMode/unusedParamNotSpill.kt delete mode 100644 compiler/testData/codegen/box/coroutines/varSpilling/debugMode/when.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index f80e4304126..df74c03b0e0 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -13227,64 +13227,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/varSpilling/cleanup/when.kt"); } } - - @Nested - @TestMetadata("compiler/testData/codegen/box/coroutines/varSpilling/debugMode") - @TestDataPath("$PROJECT_ROOT") - public class DebugMode { - @Test - public void testAllFilesPresentInDebugMode() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/varSpilling/debugMode"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); - } - - @Test - @TestMetadata("backEdge.kt") - public void testBackEdge() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/backEdge.kt"); - } - - @Test - @TestMetadata("if.kt") - public void testIf() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/if.kt"); - } - - @Test - @TestMetadata("nullCleanup.kt") - public void testNullCleanup() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/nullCleanup.kt"); - } - - @Test - @TestMetadata("nullNotSpill.kt") - public void testNullNotSpill() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/nullNotSpill.kt"); - } - - @Test - @TestMetadata("simple.kt") - public void testSimple() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/simple.kt"); - } - - @Test - @TestMetadata("twoRefs.kt") - public void testTwoRefs() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/twoRefs.kt"); - } - - @Test - @TestMetadata("unusedParamNotSpill.kt") - public void testUnusedParamNotSpill() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/unusedParamNotSpill.kt"); - } - - @Test - @TestMetadata("when.kt") - public void testWhen() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/when.kt"); - } - } } } diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out index fe4f852fb8f..db0ecfc323d 100644 --- a/compiler/testData/cli/jvm/extraHelp.out +++ b/compiler/testData/cli/jvm/extraHelp.out @@ -28,8 +28,6 @@ where advanced options include: -Xir-do-not-clear-binding-context When using the IR backend, do not clear BindingContext between psi2ir and lowerings -Xemit-jvm-type-annotations Emit JVM type annotations in bytecode - -Xdebug Enable debug mode for compilation. - Currently this includes spilling all variables in a suspending context regardless their liveness. -Xjvm-enable-preview Allow using features from Java language that are in preview phase. Works as `--enable-preview` in Java. All class files are marked as preview-generated thus it won't be possible to use them in release environment -Xenhance-type-parameter-types-to-def-not-null diff --git a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/backEdge.kt b/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/backEdge.kt deleted file mode 100644 index 38057f1fa95..00000000000 --- a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/backEdge.kt +++ /dev/null @@ -1,57 +0,0 @@ -// WITH_STDLIB -// FULL_JDK -// TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND: JVM -import kotlin.coroutines.* -import kotlin.coroutines.intrinsics.* - -fun blackhole(vararg a: Any?) {} - -val spilledVariables = mutableSetOf>() - -var c: Continuation? = null - -suspend fun saveSpilledVariables() = suspendCoroutineUninterceptedOrReturn { continuation -> - spilledVariables.clear() - for (field in continuation.javaClass.declaredFields) { - if (field.name != "label" && (field.name.length != 3 || field.name[1] != '$')) continue - field.isAccessible = true - spilledVariables += field.name to "${field.get(continuation)}" - } - c = continuation - COROUTINE_SUSPENDED -} - -suspend fun test() { - for (i in 0..1) { - saveSpilledVariables() - val a = "a" - saveSpilledVariables() - blackhole(a) - } -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(Continuation(EmptyCoroutineContext) { - it.getOrThrow() - }) -} - -fun box(): String { - builder { - test() - } - - val continuationName = "Continuation at BackEdgeKt\$box\$1.invokeSuspend(backEdge.kt:42)" - if (spilledVariables != setOf("label" to "1", "I$0" to "0", "L$0" to continuationName, "L$1" to "null")) return "FAIL 1: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "2", "I$0" to "0", "L$0" to continuationName, "L$1" to "a")) return "FAIL 2: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "1", "I$0" to "1", "L$0" to continuationName, "L$1" to "a")) return "FAIL 3: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "2", "I$0" to "1", "L$0" to continuationName, "L$1" to "a")) return "FAIL 4: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "2", "I$0" to "1", "L$0" to continuationName, "L$1" to "a")) return "FAIL 5: $spilledVariables" - - return "OK" -} \ No newline at end of file diff --git a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/if.kt b/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/if.kt deleted file mode 100644 index 0df3640d240..00000000000 --- a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/if.kt +++ /dev/null @@ -1,76 +0,0 @@ -// WITH_STDLIB -// FULL_JDK -// TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND: JVM -import kotlin.coroutines.* -import kotlin.coroutines.intrinsics.* - -fun blackhole(vararg a: Any?) {} - -val spilledVariables = mutableSetOf>() - -var c: Continuation? = null - -suspend fun saveSpilledVariables() = suspendCoroutineUninterceptedOrReturn { continuation -> - spilledVariables.clear() - for (field in continuation.javaClass.declaredFields) { - if (field.name != "label" && (field.name.length != 3 || field.name[1] != '$')) continue - field.isAccessible = true - val fieldValue = when (val obj = field.get(continuation)) { - is Array<*> -> obj.joinToString(prefix = "[", postfix = "]") - else -> obj - } - spilledVariables += field.name to "$fieldValue" - } - c = continuation - COROUTINE_SUSPENDED -} - -suspend fun test(check: Boolean) { - if (check) { - val a = "a1" - saveSpilledVariables() - blackhole(a) - } else { - val a = "a2" - val b = "b2" - saveSpilledVariables() - blackhole(a, b) - } - saveSpilledVariables() -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(Continuation(EmptyCoroutineContext) { - it.getOrThrow() - }) -} - -fun box(): String { - builder { - test(true) - } - - var continuationName = "Continuation at IfKt\$box\$1.invokeSuspend(if.kt:51)" - if (spilledVariables != setOf("label" to "1", "Z$0" to "true", "L$0" to continuationName, "L$1" to "a1", "L$2" to "null")) - return "FAIL 1: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "3", "Z$0" to "true", "L$0" to continuationName, "L$1" to "a1", "L$2" to "[a1]")) - return "FAIL 2: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "3", "Z$0" to "true", "L$0" to continuationName, "L$1" to "a1", "L$2" to "[a1]")) - return "FAIL 3: $spilledVariables" - - builder { - test(false) - } - - continuationName = "Continuation at IfKt\$box\$2.invokeSuspend(if.kt:65)" - if (spilledVariables != setOf("label" to "2", "Z$0" to "false", "L$0" to continuationName, "L$1" to "a2", "L$2" to "b2")) return "FAIL 4: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "3", "Z$0" to "false", "L$0" to continuationName, "L$1" to "a2", "L$2" to "b2")) return "FAIL 5: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "3", "Z$0" to "false", "L$0" to continuationName, "L$1" to "a2", "L$2" to "b2")) return "FAIL 6: $spilledVariables" - - return "OK" -} \ No newline at end of file diff --git a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/nullCleanup.kt b/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/nullCleanup.kt deleted file mode 100644 index c170169c100..00000000000 --- a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/nullCleanup.kt +++ /dev/null @@ -1,57 +0,0 @@ -// WITH_STDLIB -// FULL_JDK -// TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND: JVM -import kotlin.coroutines.* -import kotlin.coroutines.intrinsics.* - -fun blackhole(vararg a: Any?) {} - -val spilledVariables = mutableSetOf>() - -var c: Continuation? = null - -suspend fun saveSpilledVariables() = suspendCoroutineUninterceptedOrReturn { continuation -> - spilledVariables.clear() - for (field in continuation.javaClass.declaredFields) { - if (field.name != "label" && (field.name.length != 3 || field.name[1] != '$')) continue - field.isAccessible = true - val fieldValue = when (val obj = field.get(continuation)) { - is Array<*> -> obj.joinToString(prefix = "[", postfix = "]") - else -> obj - } - spilledVariables += field.name to "$fieldValue" - } - c = continuation - COROUTINE_SUSPENDED -} - -suspend fun test() { - var a: String? = "a" - saveSpilledVariables() - blackhole(a) - a = null - saveSpilledVariables() - blackhole(a) -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(Continuation(EmptyCoroutineContext) { - it.getOrThrow() - }) -} - -fun box(): String { - builder { - test() - } - - val continuationName = "Continuation at NullCleanupKt\$box\$1.invokeSuspend(nullCleanup.kt:46)" - if (spilledVariables != setOf("label" to "1", "L$0" to continuationName, "L$1" to "a")) return "FAIL 1: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "2", "L$0" to continuationName, "L$1" to "[a]")) return "FAIL 2: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "2", "L$0" to continuationName, "L$1" to "[a]")) return "FAIL 3: $spilledVariables" - - return "OK" -} \ No newline at end of file diff --git a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/nullNotSpill.kt b/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/nullNotSpill.kt deleted file mode 100644 index e75a7482605..00000000000 --- a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/nullNotSpill.kt +++ /dev/null @@ -1,55 +0,0 @@ -// WITH_STDLIB -// FULL_JDK -// TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND: JVM -import kotlin.coroutines.* -import kotlin.coroutines.intrinsics.* - -fun blackhole(vararg a: Any?) {} - -val spilledVariables = mutableSetOf>() - -var c: Continuation? = null - -suspend fun saveSpilledVariables() = suspendCoroutineUninterceptedOrReturn { continuation -> - spilledVariables.clear() - for (field in continuation.javaClass.declaredFields) { - if (field.name != "label" && (field.name.length != 3 || field.name[1] != '$')) continue - field.isAccessible = true - val fieldValue = when (val obj = field.get(continuation)) { - is Array<*> -> obj.joinToString(prefix = "[", postfix = "]") - else -> obj - } - spilledVariables += field.name to "$fieldValue" - } - c = continuation - COROUTINE_SUSPENDED -} - -suspend fun test() { - val a = null - saveSpilledVariables() - blackhole(a) - saveSpilledVariables() -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(Continuation(EmptyCoroutineContext) { - it.getOrThrow() - }) -} - -fun box(): String { - builder { - test() - } - - val continuationName = "Continuation at NullNotSpillKt\$box\$1.invokeSuspend(nullNotSpill.kt:44)" - if (spilledVariables != setOf("label" to "1", "L$0" to continuationName, "L$1" to "null")) return "FAIL 1: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "2", "L$0" to continuationName, "L$1" to "[null]")) return "FAIL 2: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "2", "L$0" to continuationName, "L$1" to "[null]")) return "FAIL 3: $spilledVariables" - - return "OK" -} \ No newline at end of file diff --git a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/simple.kt b/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/simple.kt deleted file mode 100644 index ece156fbaf8..00000000000 --- a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/simple.kt +++ /dev/null @@ -1,59 +0,0 @@ -// WITH_STDLIB -// FULL_JDK -// TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND: JVM -import kotlin.coroutines.* -import kotlin.coroutines.intrinsics.* - -fun blackhole(vararg a: Any?) {} - -val spilledVariables = mutableSetOf>() - -var c: Continuation? = null - -suspend fun saveSpilledVariables() = suspendCoroutineUninterceptedOrReturn { continuation -> - spilledVariables.clear() - for (field in continuation.javaClass.declaredFields) { - if (field.name != "label" && (field.name.length != 3 || field.name[1] != '$')) continue - field.isAccessible = true - val fieldValue = when (val obj = field.get(continuation)) { - is Array<*> -> obj.joinToString(prefix = "[", postfix = "]") - else -> obj - } - spilledVariables += field.name to "$fieldValue" - } - c = continuation - COROUTINE_SUSPENDED -} - -suspend fun test() { - val a = "a" - saveSpilledVariables() - blackhole(a) - saveSpilledVariables() -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(Continuation(EmptyCoroutineContext) { - it.getOrThrow() - }) -} - -fun box(): String { - builder { - test() - } - - val continuationName = "Continuation at SimpleKt\$box\$1.invokeSuspend(simple.kt:44)" - if (spilledVariables != setOf("label" to "1", "L$0" to continuationName, "L$1" to "a", "L$2" to "null")) return "FAIL 1: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "2", "L$0" to continuationName, "L$1" to "a", "L$2" to "[a]")) return "FAIL 2: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "2", "L$0" to continuationName, "L$1" to "a", "L$2" to "[a]")) return "FAIL 3: $spilledVariables" - - return "OK" -} - -fun main() { - println(box()) -} \ No newline at end of file diff --git a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/twoRefs.kt b/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/twoRefs.kt deleted file mode 100644 index 0709e752bf0..00000000000 --- a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/twoRefs.kt +++ /dev/null @@ -1,62 +0,0 @@ -// WITH_STDLIB -// FULL_JDK -// TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND: JVM -import kotlin.coroutines.* -import kotlin.coroutines.intrinsics.* - -fun blackhole(vararg a: Any?) {} - -val spilledVariables = mutableSetOf>() - -var c: Continuation? = null - -suspend fun saveSpilledVariables() = suspendCoroutineUninterceptedOrReturn { continuation -> - spilledVariables.clear() - for (field in continuation.javaClass.declaredFields) { - if (field.name != "label" && (field.name.length != 3 || field.name[1] != '$')) continue - field.isAccessible = true - val fieldValue = when (val obj = field.get(continuation)) { - is Array<*> -> obj.joinToString(prefix = "[", postfix = "]") - else -> obj - } - spilledVariables += field.name to "$fieldValue" - } - c = continuation - COROUTINE_SUSPENDED -} - -suspend fun test(a: String, b: String) { - saveSpilledVariables() - blackhole(a) - saveSpilledVariables() - blackhole(b) - saveSpilledVariables() -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(Continuation(EmptyCoroutineContext) { - it.getOrThrow() - }) -} - -fun box(): String { - builder { - test("a", "b") - } - - val continuationName = "Continuation at TwoRefsKt\$box\$1.invokeSuspend(twoRefs.kt:45)" - if (spilledVariables != setOf("label" to "1", "L$0" to "a", "L$1" to "b", "L$2" to continuationName, "L$3" to "null")) return "FAIL 1: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "2", "L$0" to "a", "L$1" to "b", "L$2" to continuationName, "L$3" to "[a]")) return "FAIL 2: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "3", "L$0" to "a", "L$1" to "b", "L$2" to continuationName, "L$3" to "[b]")) return "FAIL 3: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "3", "L$0" to "a", "L$1" to "b", "L$2" to continuationName, "L$3" to "[b]")) return "FAIL 4: $spilledVariables" - - return "OK" -} - -fun main() { - println(box()) -} \ No newline at end of file diff --git a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/unusedParamNotSpill.kt b/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/unusedParamNotSpill.kt deleted file mode 100644 index 8648f7469ca..00000000000 --- a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/unusedParamNotSpill.kt +++ /dev/null @@ -1,44 +0,0 @@ -// WITH_STDLIB -// FULL_JDK -// TARGET_BACKEND: JVM_IR -import kotlin.coroutines.* -import kotlin.coroutines.intrinsics.* - -fun blackhole(vararg a: Any?) {} - -val spilledVariables = mutableSetOf>() - -var c: Continuation? = null - -suspend fun saveSpilledVariables() = suspendCoroutineUninterceptedOrReturn { continuation -> - spilledVariables.clear() - for (field in continuation.javaClass.declaredFields) { - if (field.name != "label" && (field.name.length != 3 || field.name[1] != '$')) continue - field.isAccessible = true - spilledVariables += field.name to "${field.get(continuation)}" - } - c = continuation - COROUTINE_SUSPENDED -} - -val test: suspend (Int) -> Unit = { unused -> - saveSpilledVariables() -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(Continuation(EmptyCoroutineContext) { - it.getOrThrow() - }) -} - -fun box(): String { - builder { - test(1) - } - - if (spilledVariables != setOf("label" to "1")) return "FAIL 1: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "1")) return "FAIL 2: $spilledVariables" - - return "OK" -} \ No newline at end of file diff --git a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/when.kt b/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/when.kt deleted file mode 100644 index ffcd6692b0e..00000000000 --- a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/when.kt +++ /dev/null @@ -1,103 +0,0 @@ -// WITH_STDLIB -// FULL_JDK -// TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND: JVM -import kotlin.coroutines.* -import kotlin.coroutines.intrinsics.* - -fun blackhole(vararg a: Any?) {} - -val spilledVariables = mutableSetOf>() - -var c: Continuation? = null - -suspend fun saveSpilledVariables() = suspendCoroutineUninterceptedOrReturn { continuation -> - spilledVariables.clear() - for (field in continuation.javaClass.declaredFields) { - if (field.name != "label" && (field.name.length != 3 || field.name[1] != '$')) continue - field.isAccessible = true - val fieldValue = when (val obj = field.get(continuation)) { - is Array<*> -> obj.joinToString(prefix = "[", postfix = "]") - else -> obj - } - spilledVariables += field.name to "$fieldValue" - } - c = continuation - COROUTINE_SUSPENDED -} - -suspend fun test(check: Int) { - when (check) { - 0 -> { - val a = "a0" - saveSpilledVariables() - blackhole(a) - } - 1 -> { - val a = "a1" - val b = "b1" - saveSpilledVariables() - blackhole(a, b) - } - else -> { - val a = "a2" - val b = "b2" - val c = 1 - saveSpilledVariables() - blackhole(a, b, c) - } - } - saveSpilledVariables() -} - -fun builder(c: suspend () -> Unit) { - c.startCoroutine(Continuation(EmptyCoroutineContext) { - it.getOrThrow() - }) -} - -fun box(): String { - builder { - test(0) - } - - var continuationName = "Continuation at WhenKt\$box\$1.invokeSuspend(when.kt:61)" - if (spilledVariables != setOf("label" to "1", "I$0" to "0", "I$1" to "0", "I$2" to "0", "L$0" to continuationName, "L$1" to "a0", "L$2" to "null")) - return "FAIL 1: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "4", "I$0" to "0", "I$1" to "0", "I$2" to "0", "L$0" to continuationName, "L$1" to "a0", "L$2" to "[a0]")) - return "FAIL 2: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "4", "I$0" to "0", "I$1" to "0", "I$2" to "0", "L$0" to continuationName, "L$1" to "a0", "L$2" to "[a0]")) - return "FAIL 3: $spilledVariables" - - builder { - test(1) - } - - continuationName = "Continuation at WhenKt\$box\$2.invokeSuspend(when.kt:75)" - if (spilledVariables != setOf("label" to "2", "I$0" to "1", "I$1" to "1", "I$2" to "0", "L$0" to continuationName, "L$1" to "a1", "L$2" to "b1")) - return "FAIL 4: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "4", "I$0" to "1", "I$1" to "1", "I$2" to "0", "L$0" to continuationName, "L$1" to "a1", "L$2" to "b1")) - return "FAIL 5: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "4", "I$0" to "1", "I$1" to "1", "I$2" to "0", "L$0" to continuationName, "L$1" to "a1", "L$2" to "b1")) - return "FAIL 6: $spilledVariables" - - builder { - test(2) - } - - continuationName = "Continuation at WhenKt\$box\$3.invokeSuspend(when.kt:89)" - if (spilledVariables != setOf("label" to "3", "I$0" to "2", "I$1" to "2", "I$2" to "1", "L$0" to continuationName, "L$1" to "a2", "L$2" to "b2")) - return "FAIL 7: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "4", "I$0" to "2", "I$1" to "2", "I$2" to "1", "L$0" to continuationName, "L$1" to "a2", "L$2" to "b2")) - return "FAIL 8: $spilledVariables" - c?.resume(Unit) - if (spilledVariables != setOf("label" to "4", "I$0" to "2", "I$1" to "2", "I$2" to "1", "L$0" to continuationName, "L$1" to "a2", "L$2" to "b2")) - return "FAIL 9: $spilledVariables" - - return "OK" -} \ No newline at end of file diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 014ef4491ea..f541b0e5400 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -13107,16 +13107,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/varSpilling/cleanup/when.kt"); } } - - @Nested - @TestMetadata("compiler/testData/codegen/box/coroutines/varSpilling/debugMode") - @TestDataPath("$PROJECT_ROOT") - public class DebugMode { - @Test - public void testAllFilesPresentInDebugMode() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/varSpilling/debugMode"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); - } - } } } diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 1fe681136c6..cd0782898dd 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -13227,64 +13227,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/varSpilling/cleanup/when.kt"); } } - - @Nested - @TestMetadata("compiler/testData/codegen/box/coroutines/varSpilling/debugMode") - @TestDataPath("$PROJECT_ROOT") - public class DebugMode { - @Test - public void testAllFilesPresentInDebugMode() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/varSpilling/debugMode"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); - } - - @Test - @TestMetadata("backEdge.kt") - public void testBackEdge() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/backEdge.kt"); - } - - @Test - @TestMetadata("if.kt") - public void testIf() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/if.kt"); - } - - @Test - @TestMetadata("nullCleanup.kt") - public void testNullCleanup() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/nullCleanup.kt"); - } - - @Test - @TestMetadata("nullNotSpill.kt") - public void testNullNotSpill() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/nullNotSpill.kt"); - } - - @Test - @TestMetadata("simple.kt") - public void testSimple() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/simple.kt"); - } - - @Test - @TestMetadata("twoRefs.kt") - public void testTwoRefs() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/twoRefs.kt"); - } - - @Test - @TestMetadata("unusedParamNotSpill.kt") - public void testUnusedParamNotSpill() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/unusedParamNotSpill.kt"); - } - - @Test - @TestMetadata("when.kt") - public void testWhen() throws Exception { - runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/when.kt"); - } - } } } diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/JvmEnvironmentConfigurationDirectives.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/JvmEnvironmentConfigurationDirectives.kt index 621cd5eda4e..36c0c25d753 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/JvmEnvironmentConfigurationDirectives.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/JvmEnvironmentConfigurationDirectives.kt @@ -77,6 +77,4 @@ object JvmEnvironmentConfigurationDirectives : SimpleDirectivesContainer() { description = "Enable serialization of JVM IR", additionalParser = JvmSerializeIrMode.Companion::fromString ) - - val ENABLE_DEBUG_MODE by directive("Enable debug mode for compilation") } diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractJvmBlackBoxCodegenTestBase.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractJvmBlackBoxCodegenTestBase.kt index 2e694e85e4f..315dd6a8493 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractJvmBlackBoxCodegenTestBase.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractJvmBlackBoxCodegenTestBase.kt @@ -24,7 +24,6 @@ import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.USE_JAVAC_BASE import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JDK_KIND import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.JVM_TARGET import org.jetbrains.kotlin.test.directives.ConfigurationDirectives.WITH_STDLIB -import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.ENABLE_DEBUG_MODE import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicDiagnosticsHandler import org.jetbrains.kotlin.test.frontend.fir.handlers.FirDiagnosticsHandler import org.jetbrains.kotlin.test.model.* @@ -82,12 +81,6 @@ abstract class AbstractJvmBlackBoxCodegenTestBase