blob: ede7f7ceceeaba353460005b55a7c50fd0aec346 [file]
// RUN_PIPELINE_TILL: CODEGEN
// DISABLE_IR_VISIBILITY_CHECKS: ANY
// DIAGNOSTICS: -ERROR_SUPPRESSION -NOTHING_TO_INLINE
// LANGUAGE: +IrIntraModuleInlinerBeforeKlibSerialization +IrCrossModuleInlinerBeforeKlibSerialization
// MODULE: lib
// FILE: lib.kt
@file:OptIn(kotlin.ExperimentalStdlibApi::class)
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
import kotlin.native.concurrent.*
import kotlin.concurrent.*
@Volatile
internal var v: Int = 0
internal fun set(newValue: Int) {
::v.atomicSetField(newValue)
}
inline internal fun compareAndSet(expected: Int, newValue: Int): Boolean =
::v.compareAndSetField(expected, newValue)
class C {
@Volatile
internal var v: Int = 0
internal fun getAndSet(newValue: Int): Int =
this::v.getAndSetField(newValue)
inline internal fun getAndAdd(delta: Int): Int =
this::v.getAndAddField(delta)
}
// MODULE: test()(lib)
// FILE: test.kt
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
import kotlin.native.concurrent.*
import kotlin.concurrent.*
fun box(): String {
v
::v.<!LEAKED_VOLATILE_FIELD!>atomicGetField()<!>
set(1)
<!LEAKED_VOLATILE_FIELD!>compareAndSet(1, 2)<!>
val c = C()
c.v
c::v.<!LEAKED_VOLATILE_FIELD!>compareAndExchangeField(0, 1)<!>
c.getAndSet(2)
c.<!LEAKED_VOLATILE_FIELD!>getAndAdd(3)<!>
return "OK"
}