From f84f3cae97674db9e5016623d88ad476adec19fe Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 27 Dec 2021 23:18:10 +0100 Subject: [PATCH] Decrease operand count in tests on invokedynamic string concat Otherwise the tests are flaky for some reason; stack overflow is thrown from psi2ir sometimes. Probably it has something to do with the fact that the JVM stack which is used by the compiler here is around the default limit (which is 1M). --- .../box/strings/concatDynamicWithConstants.kt | 14 ++++++++------ .../strings/concatDynamicWithSpecialSymbols.kt | 17 +++++++---------- .../IrCodegenBoxWasmTestGenerated.java | 5 +++++ 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/compiler/testData/codegen/box/strings/concatDynamicWithConstants.kt b/compiler/testData/codegen/box/strings/concatDynamicWithConstants.kt index 92febdaede6..08b574bb495 100644 --- a/compiler/testData/codegen/box/strings/concatDynamicWithConstants.kt +++ b/compiler/testData/codegen/box/strings/concatDynamicWithConstants.kt @@ -1,14 +1,13 @@ // Will be executed on JDK 9, 11, 15 // IGNORE_BACKEND: ANDROID + fun test(z: Int): String { val result = "" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + - z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + - z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" + z + "1" - + z + "1" + z + "1" + z + "1" + z + "1" return result } @@ -16,8 +15,11 @@ fun test(z: Int): String { fun box(): String { val result = test(0) - if (result.length != 280) + if (result.length != 208) return "fail 1: ${result.length}" - return if (result != "0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101") "fail 2: ${result}" else "OK" -} \ No newline at end of file + if (result != "0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101") + return "fail 2: $result" + + return "OK" +} diff --git a/compiler/testData/codegen/box/strings/concatDynamicWithSpecialSymbols.kt b/compiler/testData/codegen/box/strings/concatDynamicWithSpecialSymbols.kt index 8d3cf94db93..4a6dc1adfea 100644 --- a/compiler/testData/codegen/box/strings/concatDynamicWithSpecialSymbols.kt +++ b/compiler/testData/codegen/box/strings/concatDynamicWithSpecialSymbols.kt @@ -1,7 +1,5 @@ // Will be executed on JDK 9, 11, 15 // IGNORE_BACKEND: ANDROID -// DONT_TARGET_EXACT_BACKEND: WASM -// WASM_MUTE_REASON: FLAKY fun test(z: Int): String { val result = "" + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + @@ -9,9 +7,7 @@ fun test(z: Int): String { z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + - z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + - z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 2.toChar() - + z + 1.toChar() + z + 1.toChar() + z + 1.toChar() + z + 2.toChar() return result } @@ -19,10 +15,11 @@ fun test(z: Int): String { fun box(): String { val result = test(0) - if (result.length != 280) + if (result.length != 208) return "fail 1: ${result.length}" - return if (result != "0\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u0002") - "fail 2: ${result}" - else "OK" -} \ No newline at end of file + if (result != "0\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u0002") + return "fail 2: $result" + + return "OK" +} diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index d6c6d78ba64..2c534ab6c11 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testOld/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -25681,6 +25681,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/strings/concatDynamicWithConstants.kt"); } + @TestMetadata("concatDynamicWithSpecialSymbols.kt") + public void testConcatDynamicWithSpecialSymbols() throws Exception { + runTest("compiler/testData/codegen/box/strings/concatDynamicWithSpecialSymbols.kt"); + } + @TestMetadata("concatGenericWithNullablePrimitiveUpperBound.kt") public void testConcatGenericWithNullablePrimitiveUpperBound() throws Exception { runTest("compiler/testData/codegen/box/strings/concatGenericWithNullablePrimitiveUpperBound.kt");