diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java index 6de2e1a90d2..40c1c1f2bc8 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java @@ -4632,6 +4632,12 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn runTest("compiler/testData/codegen/boxInline/special/loopInStoreLoadChains2.kt"); } + @Test + @TestMetadata("monitorEnterExit.kt") + public void testMonitorEnterExit() throws Exception { + runTest("compiler/testData/codegen/boxInline/special/monitorEnterExit.kt"); + } + @Test @TestMetadata("plusAssign.kt") public void testPlusAssign() throws Exception { diff --git a/compiler/testData/codegen/boxInline/special/monitorEnterExit.kt b/compiler/testData/codegen/boxInline/special/monitorEnterExit.kt new file mode 100644 index 00000000000..7c9eadf8822 --- /dev/null +++ b/compiler/testData/codegen/boxInline/special/monitorEnterExit.kt @@ -0,0 +1,20 @@ +// TARGET_BACKEND: JVM_IR +// WITH_RUNTIME +// FILE: mySynchronized.kt + +import kotlin.jvm.internal.unsafe.* + +public inline fun mySynchronized(lock: Any, block: () -> R): R { + @Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE", "INVISIBLE_MEMBER") + monitorEnter(lock) + try { + return block() + } + finally { + @Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE", "INVISIBLE_MEMBER") + monitorExit(lock) + } +} + +// FILE: box.kt +fun box() = mySynchronized(Any()) { "OK" } \ No newline at end of file diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java index 032b7b3cb33..e8b0dd5a561 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java @@ -4632,6 +4632,12 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli runTest("compiler/testData/codegen/boxInline/special/loopInStoreLoadChains2.kt"); } + @Test + @TestMetadata("monitorEnterExit.kt") + public void testMonitorEnterExit() throws Exception { + runTest("compiler/testData/codegen/boxInline/special/monitorEnterExit.kt"); + } + @Test @TestMetadata("plusAssign.kt") public void testPlusAssign() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java index 2c7fade71e5..3946c829658 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -4632,6 +4632,12 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC runTest("compiler/testData/codegen/boxInline/special/loopInStoreLoadChains2.kt"); } + @Test + @TestMetadata("monitorEnterExit.kt") + public void testMonitorEnterExit() throws Exception { + runTest("compiler/testData/codegen/boxInline/special/monitorEnterExit.kt"); + } + @Test @TestMetadata("plusAssign.kt") public void testPlusAssign() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java index ce1f509f64c..2e384d07c0c 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -4530,6 +4530,12 @@ public class IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends Ab runTest("compiler/testData/codegen/boxInline/special/loopInStoreLoadChains2.kt"); } + @Test + @TestMetadata("monitorEnterExit.kt") + public void testMonitorEnterExit() throws Exception { + runTest("compiler/testData/codegen/boxInline/special/monitorEnterExit.kt"); + } + @Test @TestMetadata("plusAssign.kt") public void testPlusAssign() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java index 9be803d391b..6baf01777fb 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java @@ -4632,6 +4632,12 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO runTest("compiler/testData/codegen/boxInline/special/loopInStoreLoadChains2.kt"); } + @Test + @TestMetadata("monitorEnterExit.kt") + public void testMonitorEnterExit() throws Exception { + runTest("compiler/testData/codegen/boxInline/special/monitorEnterExit.kt"); + } + @Test @TestMetadata("plusAssign.kt") public void testPlusAssign() throws Exception {