JVM_IR: add test for calling monitorEnter/Exit from serialized code.
This commit is contained in:
committed by
TeamCityServer
parent
dffb22de9d
commit
28bff2ba4f
+6
@@ -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 {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// FILE: mySynchronized.kt
|
||||
|
||||
import kotlin.jvm.internal.unsafe.*
|
||||
|
||||
public inline fun <R> 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" }
|
||||
+6
@@ -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 {
|
||||
|
||||
+6
@@ -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 {
|
||||
|
||||
+6
@@ -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 {
|
||||
|
||||
+6
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user