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 5ed0780c377..1e01270dc2d 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 @@ -50986,6 +50986,70 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } } + @Nested + @TestMetadata("compiler/testData/codegen/box/volatile") + @TestDataPath("$PROJECT_ROOT") + public class Volatile { + @Test + public void testAllFilesPresentInVolatile() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/volatile"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("volatileBool.kt") + public void testVolatileBool() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileBool.kt"); + } + + @Test + @TestMetadata("volatileByte.kt") + public void testVolatileByte() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileByte.kt"); + } + + @Test + @TestMetadata("volatileDouble.kt") + public void testVolatileDouble() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileDouble.kt"); + } + + @Test + @TestMetadata("volatileFloat.kt") + public void testVolatileFloat() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileFloat.kt"); + } + + @Test + @TestMetadata("volatileGeneric.kt") + public void testVolatileGeneric() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileGeneric.kt"); + } + + @Test + @TestMetadata("volatileInt.kt") + public void testVolatileInt() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileInt.kt"); + } + + @Test + @TestMetadata("volatileLong.kt") + public void testVolatileLong() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileLong.kt"); + } + + @Test + @TestMetadata("volatileShort.kt") + public void testVolatileShort() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileShort.kt"); + } + + @Test + @TestMetadata("volatileString.kt") + public void testVolatileString() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileString.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/when") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/testData/codegen/box/volatile/crossModuleIntrinsic.kt b/compiler/testData/codegen/box/volatile/crossModuleIntrinsic.kt new file mode 100644 index 00000000000..b7bb13b3af6 --- /dev/null +++ b/compiler/testData/codegen/box/volatile/crossModuleIntrinsic.kt @@ -0,0 +1,26 @@ +// TARGET_BACKEND: NATIVE +// test is disabled now because of https://youtrack.jetbrains.com/issue/KT-55426 +// IGNORE_BACKEND: NATIVE + +// MODULE: lib +// FILE: lib.kt +@file:OptIn(kotlin.ExperimentalStdlibApi::class) + +import kotlin.native.concurrent.* +import kotlin.concurrent.* + +class Box(@Volatile var value: String) + +// MODULE: main(lib) +// FILE: main.kt + +@file:Suppress("INVISIBLE_MEMBER") + +import kotlin.native.concurrent.* +import kotlin.concurrent.* + +fun box() : String { + val o = "O" + val x = Box(o) + return x.compareAndSwapField(Box::value, o, "K") + x.value +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/volatile/intrinsics.kt b/compiler/testData/codegen/box/volatile/intrinsics.kt new file mode 100644 index 00000000000..702e545cfee --- /dev/null +++ b/compiler/testData/codegen/box/volatile/intrinsics.kt @@ -0,0 +1,109 @@ +// TARGET_BACKEND: NATIVE +// KT-55904 +// IGNORE_BACKEND_K2: NATIVE + +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:OptIn(kotlin.ExperimentalStdlibApi::class) + +import kotlin.native.concurrent.* +import kotlin.concurrent.* + +interface Wrapper { + fun compareAndSwap(expected: T, new: T): T + fun compareAndSet(expected: T, new: T): Boolean + fun getAndSet(expected: T): T +} + +interface IncWrapper : Wrapper { + fun getAndAdd(expected: T): T +} + +interface RefWrapper : Wrapper { +} + + +class IntWrapper(@Volatile var x : Int) : IncWrapper { + override fun compareAndSwap(expected: Int, new: Int) = compareAndSwapField(IntWrapper::x, expected, new) + override fun compareAndSet(expected: Int, new: Int) = compareAndSetField(IntWrapper::x, expected, new) + override fun getAndSet(new: Int) = getAndSetField(IntWrapper::x, new) + override fun getAndAdd(delta: Int) = getAndAddField(IntWrapper::x, delta) +} + +class LongWrapper(@Volatile var x : Long) : IncWrapper { + override fun compareAndSwap(expected: Long, new: Long) = compareAndSwapField(LongWrapper::x, expected, new) + override fun compareAndSet(expected: Long, new: Long) = compareAndSetField(LongWrapper::x, expected, new) + override fun getAndSet(new: Long) = getAndSetField(LongWrapper::x, new) + override fun getAndAdd(delta: Long) = getAndAddField(LongWrapper::x, delta) +} + +class ShortWrapper(@Volatile var x : Short) : IncWrapper { + override fun compareAndSwap(expected: Short, new: Short) = compareAndSwapField(ShortWrapper::x, expected, new) + override fun compareAndSet(expected: Short, new: Short) = compareAndSetField(ShortWrapper::x, expected, new) + override fun getAndSet(new: Short) = getAndSetField(ShortWrapper::x, new) + override fun getAndAdd(delta: Short) = getAndAddField(ShortWrapper::x, delta) +} + +class ByteWrapper(@Volatile var x : Byte) : IncWrapper { + override fun compareAndSwap(expected: Byte, new: Byte) = compareAndSwapField(ByteWrapper::x, expected, new) + override fun compareAndSet(expected: Byte, new: Byte) = compareAndSetField(ByteWrapper::x, expected, new) + override fun getAndSet(new: Byte) = getAndSetField(ByteWrapper::x, new) + override fun getAndAdd(delta: Byte) = getAndAddField(ByteWrapper::x, delta) +} + + +class StringWrapper(@Volatile var x : String) : RefWrapper { + override fun compareAndSwap(expected: String, new: String) = compareAndSwapField(StringWrapper::x, expected, new) + override fun compareAndSet(expected: String, new: String) = compareAndSetField(StringWrapper::x, expected, new) + override fun getAndSet(new: String) = getAndSetField(StringWrapper::x, new) +} + +class GenericWrapper(@Volatile var x : T) : RefWrapper { + override fun compareAndSwap(expected: T, new: T) = compareAndSwapField(GenericWrapper::x, expected, new) + override fun compareAndSet(expected: T, new: T) = compareAndSetField(GenericWrapper::x, expected, new) + override fun getAndSet(new: T) = getAndSetField(GenericWrapper::x, new) +} + + +inline fun testFail(block: () -> Unit, onSuccess: () -> Nothing) { + try { + block() + onSuccess() + } catch (ignored: IllegalArgumentException) { + } +} + +fun test(one: T, two: T, three: T, wrap: (T) -> Wrapper) : String? { + val w = wrap(one) + if (!isExperimentalMM() && w is RefWrapper<*>) { + testFail({ w.compareAndSwap(one, two) }) { return "FAIL 1" } + testFail({ w.compareAndSet(one, two) }) { return "FAIL 2" } + testFail({ w.getAndSet(one) }) { return "FAIL 3" } + return null + } + if (w.compareAndSet(one, two) != true) return "FAIL 4" + if (w.compareAndSet(one, two) != false) return "FAIL 5" + if (w.getAndSet(one) != two) return "FAIL 6" + if (w.getAndSet(one) != one) return "FAIL 7" + if (w.compareAndSwap(one, two) != one) return "FAIL 8" + if (w.compareAndSwap(one, two) != two) return "FAIL 9" + if (w.compareAndSwap(one, two) != two) return "FAIL 10" + if (w.compareAndSwap(two, one) != two) return "FAIL 11" + if (w is IncWrapper) { + if (w.getAndAdd(one) != one) return "FAIL 12" + if (w.getAndAdd(one) != two) return "FAIL 13" + if (w.getAndAdd(one) != three) return "FAIL 14" + } + return null +} + + +fun box() : String { + test(1, 2, 3, ::IntWrapper)?.let { return "Int: $it" } + test(1, 2, 3, ::LongWrapper)?.let { return "Long: $it" } + test(1, 2, 3, ::ShortWrapper)?.let { return "Short: $it" } + test(1, 2, 3, ::ByteWrapper)?.let { return "Byte: $it" } + test("1", "2", "3", ::StringWrapper)?.let { return "String: $it" } + test("1", "2", "3", { GenericWrapper(it) })?.let { return "Generic: $it" } + test(1, 2, 3, { GenericWrapper(it) })?.let { return "Generic: $it" } + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/volatile/messagePassing.kt b/compiler/testData/codegen/box/volatile/messagePassing.kt new file mode 100644 index 00000000000..8a8810edc83 --- /dev/null +++ b/compiler/testData/codegen/box/volatile/messagePassing.kt @@ -0,0 +1,42 @@ +// TARGET_BACKEND: NATIVE + +import kotlin.native.concurrent.* +import kotlin.concurrent.* + + + +@OptIn(kotlin.ExperimentalStdlibApi::class) +@Volatile var x = 0 +var y = -1 + +fun box() : String { + if (Platform.memoryModel != MemoryModel.EXPERIMENTAL) { + // The test doesn't make sense for legacy mm, you can't have anything non-atomic to protect with @Volatile var + return "OK" + } + val w1 = Worker.start() + val w2 = Worker.start() + + val f1 = w1.execute(TransferMode.SAFE, { -> }) { + repeat(10000) { + while (x != 0) {} + y = it + x = 1 + } + "O" + } + val f2 = w2.execute(TransferMode.SAFE, { -> }) { + var result = "K" + repeat(10000) { + while (x != 1) {} + if (y != it) result = "FAIL" + x = 0 + } + result + } + + return (f1.result + f2.result).also { + w1.requestTermination().result + w2.requestTermination().result + } +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/volatile/volatileBool.kt b/compiler/testData/codegen/box/volatile/volatileBool.kt new file mode 100644 index 00000000000..561113519b3 --- /dev/null +++ b/compiler/testData/codegen/box/volatile/volatileBool.kt @@ -0,0 +1,19 @@ +// WITH_STDLIB +// IGNORE_BACKEND: WASM, JS +// IGNORE_BACKEND_K1: JS_IR +// !API_VERSION: 1.9 + +import kotlin.concurrent.* + +@OptIn(kotlin.ExperimentalStdlibApi::class) +class BoolWrapper(@Volatile var x: Boolean) + +val global = BoolWrapper(false) + +fun box() : String { + val local = BoolWrapper(false) + if (global.x || local.x) return "FAIL" + global.x = true + local.x = true + return if (global.x && local.x) "OK" else "FAIL" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/volatile/volatileByte.kt b/compiler/testData/codegen/box/volatile/volatileByte.kt new file mode 100644 index 00000000000..64f90ddad81 --- /dev/null +++ b/compiler/testData/codegen/box/volatile/volatileByte.kt @@ -0,0 +1,19 @@ +// WITH_STDLIB +// IGNORE_BACKEND: WASM, JS +// IGNORE_BACKEND_K1: JS_IR +// !API_VERSION: 1.9 + +import kotlin.concurrent.* + +@OptIn(kotlin.ExperimentalStdlibApi::class) +class ByteWrapper(@Volatile var x: Byte) + +val global = ByteWrapper(1) + +fun box() : String { + val local = ByteWrapper(2) + if (global.x + local.x != 3) return "FAIL" + global.x = 5 + local.x = 6 + return if (global.x + local.x != 11) return "FAIL" else "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/volatile/volatileDouble.kt b/compiler/testData/codegen/box/volatile/volatileDouble.kt new file mode 100644 index 00000000000..c277828172d --- /dev/null +++ b/compiler/testData/codegen/box/volatile/volatileDouble.kt @@ -0,0 +1,19 @@ +// WITH_STDLIB +// IGNORE_BACKEND: WASM, JS +// IGNORE_BACKEND_K1: JS_IR +// !API_VERSION: 1.9 + +import kotlin.concurrent.* + +@OptIn(kotlin.ExperimentalStdlibApi::class) +class DoubleWrapper(@Volatile var x: Double) + +val global = DoubleWrapper(1.5) + +fun box() : String { + val local = DoubleWrapper(2.5) + if (global.x + local.x != 4.0) return "FAIL" + global.x = 5.5 + local.x = 6.5 + return if (global.x + local.x != 12.0) return "FAIL" else "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/volatile/volatileFloat.kt b/compiler/testData/codegen/box/volatile/volatileFloat.kt new file mode 100644 index 00000000000..1159dea8015 --- /dev/null +++ b/compiler/testData/codegen/box/volatile/volatileFloat.kt @@ -0,0 +1,19 @@ +// WITH_STDLIB +// IGNORE_BACKEND: WASM, JS +// IGNORE_BACKEND_K1: JS_IR +// !API_VERSION: 1.9 + +import kotlin.concurrent.* + +@OptIn(kotlin.ExperimentalStdlibApi::class) +class FloatWrapper(@Volatile var x: Float) + +val global = FloatWrapper(1.5f) + +fun box() : String { + val local = FloatWrapper(2.5f) + if (global.x + local.x != 4.0f) return "FAIL" + global.x = 5.5f + local.x = 6.5f + return if (global.x + local.x != 12.0f) return "FAIL" else "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/volatile/volatileGeneric.kt b/compiler/testData/codegen/box/volatile/volatileGeneric.kt new file mode 100644 index 00000000000..853ef8468e4 --- /dev/null +++ b/compiler/testData/codegen/box/volatile/volatileGeneric.kt @@ -0,0 +1,25 @@ +// WITH_STDLIB +// IGNORE_BACKEND: WASM, JS +// IGNORE_BACKEND_K1: JS_IR +// !API_VERSION: 1.9 + +import kotlin.concurrent.* + +@OptIn(kotlin.ExperimentalStdlibApi::class) +class GenericWrapper(@Volatile var x: T) + +val global = GenericWrapper("FA") +val globalLong = GenericWrapper(1L) + +fun box() : String { + val local = GenericWrapper("IL") + val localLong = GenericWrapper(2L) + if (global.x + local.x != "FAIL") return "FAIL 1" + if (globalLong.x + localLong.x != 3L) return "FAIL 2" + global.x = "O" + local.x = "K" + globalLong.x = 5L + localLong.x = 6L + if (globalLong.x + localLong.x != 11L) return "FAIL 3" + return global.x + local.x +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/volatile/volatileInt.kt b/compiler/testData/codegen/box/volatile/volatileInt.kt new file mode 100644 index 00000000000..86d5d535fad --- /dev/null +++ b/compiler/testData/codegen/box/volatile/volatileInt.kt @@ -0,0 +1,19 @@ +// WITH_STDLIB +// IGNORE_BACKEND: WASM, JS +// IGNORE_BACKEND_K1: JS_IR +// !API_VERSION: 1.9 + +import kotlin.concurrent.* + +@OptIn(kotlin.ExperimentalStdlibApi::class) +class IntWrapper(@Volatile var x: Int) + +val global = IntWrapper(1) + +fun box() : String { + val local = IntWrapper(2) + if (global.x + local.x != 3) return "FAIL" + global.x = 5 + local.x = 6 + return if (global.x + local.x != 11) return "FAIL" else "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/volatile/volatileLong.kt b/compiler/testData/codegen/box/volatile/volatileLong.kt new file mode 100644 index 00000000000..0d580453e9f --- /dev/null +++ b/compiler/testData/codegen/box/volatile/volatileLong.kt @@ -0,0 +1,19 @@ +// WITH_STDLIB +// IGNORE_BACKEND: WASM, JS +// IGNORE_BACKEND_K1: JS_IR +// !API_VERSION: 1.9 + +import kotlin.concurrent.* + +@OptIn(kotlin.ExperimentalStdlibApi::class) +class LongWrapper(@Volatile var x: Long) + +val global = LongWrapper(1) + +fun box() : String { + val local = LongWrapper(2) + if (global.x + local.x != 3L) return "FAIL" + global.x = 5 + local.x = 6 + return if (global.x + local.x != 11L) return "FAIL" else "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/volatile/volatileShort.kt b/compiler/testData/codegen/box/volatile/volatileShort.kt new file mode 100644 index 00000000000..1f7732a0637 --- /dev/null +++ b/compiler/testData/codegen/box/volatile/volatileShort.kt @@ -0,0 +1,19 @@ +// WITH_STDLIB +// IGNORE_BACKEND: WASM, JS +// IGNORE_BACKEND_K1: JS_IR +// !API_VERSION: 1.9 + +import kotlin.concurrent.* + +@OptIn(kotlin.ExperimentalStdlibApi::class) +class ShortWrapper(@Volatile var x: Short) + +val global = ShortWrapper(1) + +fun box() : String { + val local = ShortWrapper(2) + if (global.x + local.x != 3) return "FAIL" + global.x = 5 + local.x = 6 + return if (global.x + local.x != 11) return "FAIL" else "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/volatile/volatileString.kt b/compiler/testData/codegen/box/volatile/volatileString.kt new file mode 100644 index 00000000000..c5609eeb700 --- /dev/null +++ b/compiler/testData/codegen/box/volatile/volatileString.kt @@ -0,0 +1,19 @@ +// WITH_STDLIB +// IGNORE_BACKEND: WASM, JS +// IGNORE_BACKEND_K1: JS_IR +// !API_VERSION: 1.9 + +import kotlin.concurrent.* + +@OptIn(kotlin.ExperimentalStdlibApi::class) +class StringWrapper(@Volatile var x: String) + +val global = StringWrapper("FA") + +fun box() : String { + val local = StringWrapper("IL") + if (global.x + local.x != "FAIL") return "FAIL" + global.x = "O" + local.x = "K" + return global.x + local.x +} \ 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 07738768e01..b8a0604bcd3 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 @@ -48952,6 +48952,70 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/volatile") + @TestDataPath("$PROJECT_ROOT") + public class Volatile { + @Test + public void testAllFilesPresentInVolatile() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/volatile"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Test + @TestMetadata("volatileBool.kt") + public void testVolatileBool() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileBool.kt"); + } + + @Test + @TestMetadata("volatileByte.kt") + public void testVolatileByte() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileByte.kt"); + } + + @Test + @TestMetadata("volatileDouble.kt") + public void testVolatileDouble() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileDouble.kt"); + } + + @Test + @TestMetadata("volatileFloat.kt") + public void testVolatileFloat() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileFloat.kt"); + } + + @Test + @TestMetadata("volatileGeneric.kt") + public void testVolatileGeneric() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileGeneric.kt"); + } + + @Test + @TestMetadata("volatileInt.kt") + public void testVolatileInt() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileInt.kt"); + } + + @Test + @TestMetadata("volatileLong.kt") + public void testVolatileLong() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileLong.kt"); + } + + @Test + @TestMetadata("volatileShort.kt") + public void testVolatileShort() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileShort.kt"); + } + + @Test + @TestMetadata("volatileString.kt") + public void testVolatileString() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileString.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/when") @TestDataPath("$PROJECT_ROOT") 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 eccd08dc411..2e1e307de16 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 @@ -50986,6 +50986,70 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/volatile") + @TestDataPath("$PROJECT_ROOT") + public class Volatile { + @Test + public void testAllFilesPresentInVolatile() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/volatile"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("volatileBool.kt") + public void testVolatileBool() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileBool.kt"); + } + + @Test + @TestMetadata("volatileByte.kt") + public void testVolatileByte() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileByte.kt"); + } + + @Test + @TestMetadata("volatileDouble.kt") + public void testVolatileDouble() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileDouble.kt"); + } + + @Test + @TestMetadata("volatileFloat.kt") + public void testVolatileFloat() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileFloat.kt"); + } + + @Test + @TestMetadata("volatileGeneric.kt") + public void testVolatileGeneric() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileGeneric.kt"); + } + + @Test + @TestMetadata("volatileInt.kt") + public void testVolatileInt() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileInt.kt"); + } + + @Test + @TestMetadata("volatileLong.kt") + public void testVolatileLong() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileLong.kt"); + } + + @Test + @TestMetadata("volatileShort.kt") + public void testVolatileShort() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileShort.kt"); + } + + @Test + @TestMetadata("volatileString.kt") + public void testVolatileString() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileString.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/when") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index b23eee7b6a3..7790c2d1a50 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -39776,6 +39776,64 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/volatile") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Volatile extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInVolatile() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/volatile"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("volatileBool.kt") + public void testVolatileBool() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileBool.kt"); + } + + @TestMetadata("volatileByte.kt") + public void testVolatileByte() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileByte.kt"); + } + + @TestMetadata("volatileDouble.kt") + public void testVolatileDouble() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileDouble.kt"); + } + + @TestMetadata("volatileFloat.kt") + public void testVolatileFloat() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileFloat.kt"); + } + + @TestMetadata("volatileGeneric.kt") + public void testVolatileGeneric() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileGeneric.kt"); + } + + @TestMetadata("volatileInt.kt") + public void testVolatileInt() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileInt.kt"); + } + + @TestMetadata("volatileLong.kt") + public void testVolatileLong() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileLong.kt"); + } + + @TestMetadata("volatileShort.kt") + public void testVolatileShort() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileShort.kt"); + } + + @TestMetadata("volatileString.kt") + public void testVolatileString() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileString.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/when") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java index 5c2104a948a..67ededdcd8a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java @@ -36336,6 +36336,70 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/volatile") + @TestDataPath("$PROJECT_ROOT") + public class Volatile { + @Test + public void testAllFilesPresentInVolatile() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/volatile"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @Test + @TestMetadata("volatileBool.kt") + public void testVolatileBool() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileBool.kt"); + } + + @Test + @TestMetadata("volatileByte.kt") + public void testVolatileByte() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileByte.kt"); + } + + @Test + @TestMetadata("volatileDouble.kt") + public void testVolatileDouble() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileDouble.kt"); + } + + @Test + @TestMetadata("volatileFloat.kt") + public void testVolatileFloat() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileFloat.kt"); + } + + @Test + @TestMetadata("volatileGeneric.kt") + public void testVolatileGeneric() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileGeneric.kt"); + } + + @Test + @TestMetadata("volatileInt.kt") + public void testVolatileInt() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileInt.kt"); + } + + @Test + @TestMetadata("volatileLong.kt") + public void testVolatileLong() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileLong.kt"); + } + + @Test + @TestMetadata("volatileShort.kt") + public void testVolatileShort() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileShort.kt"); + } + + @Test + @TestMetadata("volatileString.kt") + public void testVolatileString() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileString.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/when") @TestDataPath("$PROJECT_ROOT") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java index a51a9792024..a2535021201 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java @@ -36516,6 +36516,70 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/volatile") + @TestDataPath("$PROJECT_ROOT") + public class Volatile { + @Test + public void testAllFilesPresentInVolatile() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/volatile"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @Test + @TestMetadata("volatileBool.kt") + public void testVolatileBool() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileBool.kt"); + } + + @Test + @TestMetadata("volatileByte.kt") + public void testVolatileByte() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileByte.kt"); + } + + @Test + @TestMetadata("volatileDouble.kt") + public void testVolatileDouble() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileDouble.kt"); + } + + @Test + @TestMetadata("volatileFloat.kt") + public void testVolatileFloat() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileFloat.kt"); + } + + @Test + @TestMetadata("volatileGeneric.kt") + public void testVolatileGeneric() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileGeneric.kt"); + } + + @Test + @TestMetadata("volatileInt.kt") + public void testVolatileInt() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileInt.kt"); + } + + @Test + @TestMetadata("volatileLong.kt") + public void testVolatileLong() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileLong.kt"); + } + + @Test + @TestMetadata("volatileShort.kt") + public void testVolatileShort() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileShort.kt"); + } + + @Test + @TestMetadata("volatileString.kt") + public void testVolatileString() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileString.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/when") @TestDataPath("$PROJECT_ROOT") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index 3604b97fa79..53f7f981b42 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -36516,6 +36516,70 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/volatile") + @TestDataPath("$PROJECT_ROOT") + public class Volatile { + @Test + public void testAllFilesPresentInVolatile() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/volatile"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @Test + @TestMetadata("volatileBool.kt") + public void testVolatileBool() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileBool.kt"); + } + + @Test + @TestMetadata("volatileByte.kt") + public void testVolatileByte() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileByte.kt"); + } + + @Test + @TestMetadata("volatileDouble.kt") + public void testVolatileDouble() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileDouble.kt"); + } + + @Test + @TestMetadata("volatileFloat.kt") + public void testVolatileFloat() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileFloat.kt"); + } + + @Test + @TestMetadata("volatileGeneric.kt") + public void testVolatileGeneric() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileGeneric.kt"); + } + + @Test + @TestMetadata("volatileInt.kt") + public void testVolatileInt() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileInt.kt"); + } + + @Test + @TestMetadata("volatileLong.kt") + public void testVolatileLong() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileLong.kt"); + } + + @Test + @TestMetadata("volatileShort.kt") + public void testVolatileShort() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileShort.kt"); + } + + @Test + @TestMetadata("volatileString.kt") + public void testVolatileString() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileString.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/when") @TestDataPath("$PROJECT_ROOT") 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 a283d047d35..1701b155fc7 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 @@ -32701,6 +32701,64 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest } } + @TestMetadata("compiler/testData/codegen/box/volatile") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Volatile extends AbstractIrCodegenBoxWasmTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); + } + + public void testAllFilesPresentInVolatile() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/volatile"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + + @TestMetadata("volatileBool.kt") + public void testVolatileBool() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileBool.kt"); + } + + @TestMetadata("volatileByte.kt") + public void testVolatileByte() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileByte.kt"); + } + + @TestMetadata("volatileDouble.kt") + public void testVolatileDouble() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileDouble.kt"); + } + + @TestMetadata("volatileFloat.kt") + public void testVolatileFloat() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileFloat.kt"); + } + + @TestMetadata("volatileGeneric.kt") + public void testVolatileGeneric() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileGeneric.kt"); + } + + @TestMetadata("volatileInt.kt") + public void testVolatileInt() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileInt.kt"); + } + + @TestMetadata("volatileLong.kt") + public void testVolatileLong() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileLong.kt"); + } + + @TestMetadata("volatileShort.kt") + public void testVolatileShort() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileShort.kt"); + } + + @TestMetadata("volatileString.kt") + public void testVolatileString() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileString.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/when") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java index e9be1338435..01ae56c066b 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java @@ -40162,6 +40162,97 @@ public class K2NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/volatile") + @TestDataPath("$PROJECT_ROOT") + @Tag("codegen") + @UseExtTestCaseGroupProvider() + @K2Pipeline() + public class Volatile { + @Test + public void testAllFilesPresentInVolatile() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/volatile"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("crossModuleIntrinsic.kt") + public void testCrossModuleIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/volatile/crossModuleIntrinsic.kt"); + } + + @Test + @TestMetadata("intrinsics.kt") + public void testIntrinsics() throws Exception { + runTest("compiler/testData/codegen/box/volatile/intrinsics.kt"); + } + + @Test + @TestMetadata("intrinsicsOnGlobal.kt") + public void testIntrinsicsOnGlobal() throws Exception { + runTest("compiler/testData/codegen/box/volatile/intrinsicsOnGlobal.kt"); + } + + @Test + @TestMetadata("messagePassing.kt") + public void testMessagePassing() throws Exception { + runTest("compiler/testData/codegen/box/volatile/messagePassing.kt"); + } + + @Test + @TestMetadata("volatileBool.kt") + public void testVolatileBool() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileBool.kt"); + } + + @Test + @TestMetadata("volatileByte.kt") + public void testVolatileByte() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileByte.kt"); + } + + @Test + @TestMetadata("volatileDouble.kt") + public void testVolatileDouble() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileDouble.kt"); + } + + @Test + @TestMetadata("volatileFloat.kt") + public void testVolatileFloat() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileFloat.kt"); + } + + @Test + @TestMetadata("volatileGeneric.kt") + public void testVolatileGeneric() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileGeneric.kt"); + } + + @Test + @TestMetadata("volatileInt.kt") + public void testVolatileInt() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileInt.kt"); + } + + @Test + @TestMetadata("volatileLong.kt") + public void testVolatileLong() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileLong.kt"); + } + + @Test + @TestMetadata("volatileShort.kt") + public void testVolatileShort() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileShort.kt"); + } + + @Test + @TestMetadata("volatileString.kt") + public void testVolatileString() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileString.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/when") @TestDataPath("$PROJECT_ROOT") diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java index 67dd339cb77..7b37dde40f7 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java @@ -39663,6 +39663,90 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest } } + @Nested + @TestMetadata("compiler/testData/codegen/box/volatile") + @TestDataPath("$PROJECT_ROOT") + @Tag("codegen") + @UseExtTestCaseGroupProvider() + public class Volatile { + @Test + public void testAllFilesPresentInVolatile() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/volatile"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("crossModuleIntrinsic.kt") + public void testCrossModuleIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/volatile/crossModuleIntrinsic.kt"); + } + + @Test + @TestMetadata("intrinsics.kt") + public void testIntrinsics() throws Exception { + runTest("compiler/testData/codegen/box/volatile/intrinsics.kt"); + } + + @Test + @TestMetadata("messagePassing.kt") + public void testMessagePassing() throws Exception { + runTest("compiler/testData/codegen/box/volatile/messagePassing.kt"); + } + + @Test + @TestMetadata("volatileBool.kt") + public void testVolatileBool() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileBool.kt"); + } + + @Test + @TestMetadata("volatileByte.kt") + public void testVolatileByte() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileByte.kt"); + } + + @Test + @TestMetadata("volatileDouble.kt") + public void testVolatileDouble() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileDouble.kt"); + } + + @Test + @TestMetadata("volatileFloat.kt") + public void testVolatileFloat() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileFloat.kt"); + } + + @Test + @TestMetadata("volatileGeneric.kt") + public void testVolatileGeneric() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileGeneric.kt"); + } + + @Test + @TestMetadata("volatileInt.kt") + public void testVolatileInt() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileInt.kt"); + } + + @Test + @TestMetadata("volatileLong.kt") + public void testVolatileLong() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileLong.kt"); + } + + @Test + @TestMetadata("volatileShort.kt") + public void testVolatileShort() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileShort.kt"); + } + + @Test + @TestMetadata("volatileString.kt") + public void testVolatileString() throws Exception { + runTest("compiler/testData/codegen/box/volatile/volatileString.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/when") @TestDataPath("$PROJECT_ROOT")