kotlinx.atomicfu JVM/IR compiler plugin support
Merge-request: KT-MR-6541 Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
This commit is contained in:
@@ -23,20 +23,34 @@ class ReferenceArithmetic {
|
||||
val _x = atomic<String?>(null)
|
||||
}
|
||||
|
||||
class VisibilitiesTest {
|
||||
val a = atomic(0)
|
||||
public val b = atomic(1)
|
||||
private val c = atomic(2)
|
||||
internal val d = atomic(3)
|
||||
|
||||
fun test() {
|
||||
a.lazySet(45)
|
||||
b.lazySet(56)
|
||||
c.lazySet(46)
|
||||
d.lazySet(67)
|
||||
}
|
||||
}
|
||||
|
||||
class ArithmeticTest {
|
||||
val local = atomic(0)
|
||||
|
||||
fun testGetValue() {
|
||||
val a = IntArithmetic()
|
||||
a._x.value = 5
|
||||
check(a._x.value == 5)
|
||||
assertEquals(5, a._x.value)
|
||||
var aValue = a._x.value
|
||||
check(aValue == 5)
|
||||
check(a.x == 5)
|
||||
assertEquals(5, aValue)
|
||||
assertEquals(5, a.x)
|
||||
|
||||
local.value = 555
|
||||
aValue = local.value
|
||||
check(local.value == aValue)
|
||||
assertEquals(aValue, local.value)
|
||||
}
|
||||
|
||||
fun testAtomicCallPlaces(): Boolean {
|
||||
@@ -44,76 +58,77 @@ class ArithmeticTest {
|
||||
a._x.value = 5
|
||||
a._x.compareAndSet(5, 42)
|
||||
val res = a._x.compareAndSet(42, 45)
|
||||
check(res)
|
||||
check(a._x.compareAndSet(45, 77))
|
||||
check(!a._x.compareAndSet(95, 77))
|
||||
assertTrue(res)
|
||||
assertTrue(a._x.compareAndSet(45, 77))
|
||||
assertFalse(a._x.compareAndSet(95, 77))
|
||||
return a._x.compareAndSet(77, 88)
|
||||
}
|
||||
|
||||
fun testInt() {
|
||||
val a = IntArithmetic()
|
||||
check(a.x == 0)
|
||||
assertEquals(0, a.x)
|
||||
val update = 3
|
||||
check(a._x.getAndSet(update) == 0)
|
||||
check(a._x.compareAndSet(update, 8))
|
||||
assertEquals(0, a._x.getAndSet(update))
|
||||
assertTrue(a._x.compareAndSet(update, 8))
|
||||
a._x.lazySet(1)
|
||||
check(a.x == 1)
|
||||
check(a._x.getAndSet(2) == 1)
|
||||
check(a.x == 2)
|
||||
check(a._x.getAndIncrement() == 2)
|
||||
check(a.x == 3)
|
||||
check(a._x.getAndDecrement() == 3)
|
||||
check(a.x == 2)
|
||||
check(a._x.getAndAdd(2) == 2)
|
||||
check(a.x == 4)
|
||||
check(a._x.addAndGet(3) == 7)
|
||||
check(a.x == 7)
|
||||
check(a._x.incrementAndGet() == 8)
|
||||
check(a.x == 8)
|
||||
check(a._x.decrementAndGet() == 7)
|
||||
check(a.x == 7)
|
||||
check(a._x.compareAndSet(7, 10))
|
||||
assertEquals(1, a.x)
|
||||
assertEquals(1, a._x.getAndSet(2))
|
||||
assertEquals(2, a.x)
|
||||
assertEquals(2, a._x.getAndIncrement())
|
||||
assertEquals(3, a.x)
|
||||
assertEquals(3, a._x.getAndDecrement())
|
||||
assertEquals(2, a.x)
|
||||
assertEquals(2, a._x.getAndAdd(2))
|
||||
assertEquals(4, a.x)
|
||||
assertEquals(7, a._x.addAndGet(3))
|
||||
assertEquals(7, a.x)
|
||||
assertEquals(8, a._x.incrementAndGet())
|
||||
assertEquals(8, a.x)
|
||||
assertEquals(7, a._x.decrementAndGet())
|
||||
assertEquals(7, a.x)
|
||||
assertTrue(a._x.compareAndSet(7, 10))
|
||||
}
|
||||
|
||||
fun testLong() {
|
||||
val a = LongArithmetic()
|
||||
check(a.z.value == 2424920024888888848)
|
||||
assertEquals(2424920024888888848, a.z.value)
|
||||
a.z.lazySet(8424920024888888848)
|
||||
check(a.z.value == 8424920024888888848)
|
||||
check(a.z.getAndSet(8924920024888888848) == 8424920024888888848)
|
||||
check(a.z.value == 8924920024888888848)
|
||||
check(a.z.incrementAndGet() == 8924920024888888849) // fails
|
||||
check(a.z.value == 8924920024888888849)
|
||||
check(a.z.getAndDecrement() == 8924920024888888849)
|
||||
check(a.z.value == 8924920024888888848)
|
||||
check(a.z.getAndAdd(100000000000000000) == 8924920024888888848)
|
||||
check(a.z.value == 9024920024888888848)
|
||||
check(a.z.addAndGet(-9223372036854775807) == -198452011965886959)
|
||||
check(a.z.value == -198452011965886959)
|
||||
check(a.z.incrementAndGet() == -198452011965886958)
|
||||
check(a.z.value == -198452011965886958)
|
||||
check(a.z.decrementAndGet() == -198452011965886959)
|
||||
check(a.z.value == -198452011965886959)
|
||||
assertEquals(8424920024888888848, a.z.value)
|
||||
assertEquals(8424920024888888848, a.z.getAndSet(8924920024888888848))
|
||||
assertEquals(8924920024888888848, a.z.value)
|
||||
assertEquals(8924920024888888849, a.z.incrementAndGet())
|
||||
assertEquals(8924920024888888849, a.z.value)
|
||||
assertEquals(8924920024888888849, a.z.getAndDecrement())
|
||||
assertEquals(8924920024888888848, a.z.value)
|
||||
assertEquals(8924920024888888848, a.z.getAndAdd(100000000000000000))
|
||||
assertEquals(9024920024888888848, a.z.value)
|
||||
assertEquals(-198452011965886959, a.z.addAndGet(-9223372036854775807))
|
||||
assertEquals(-198452011965886959, a.z.value)
|
||||
assertEquals(-198452011965886958, a.z.incrementAndGet())
|
||||
assertEquals(-198452011965886958, a.z.value)
|
||||
assertEquals(-198452011965886959, a.z.decrementAndGet())
|
||||
assertEquals(-198452011965886959, a.z.value)
|
||||
}
|
||||
|
||||
fun testBoolean() {
|
||||
val a = BooleanArithmetic()
|
||||
check(!a.x)
|
||||
assertEquals(false, a._x.value)
|
||||
assertFalse(a.x)
|
||||
a._x.lazySet(true)
|
||||
check(a.x)
|
||||
check(a._x.getAndSet(true))
|
||||
check(a._x.compareAndSet(true, false))
|
||||
check(!a.x)
|
||||
assertTrue(a.x)
|
||||
assertTrue(a._x.getAndSet(true))
|
||||
assertTrue(a._x.compareAndSet(true, false))
|
||||
assertFalse(a.x)
|
||||
}
|
||||
|
||||
fun testReference() {
|
||||
val a = ReferenceArithmetic()
|
||||
a._x.value = "aaa"
|
||||
check(a._x.value == "aaa")
|
||||
assertEquals("aaa", a._x.value)
|
||||
a._x.lazySet("bb")
|
||||
check(a._x.value == "bb")
|
||||
check(a._x.getAndSet("ccc") == "bb")
|
||||
check(a._x.value == "ccc")
|
||||
assertEquals("bb", a._x.value)
|
||||
assertEquals("bb", a._x.getAndSet("ccc"))
|
||||
assertEquals("ccc", a._x.value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
@kotlin.Metadata
|
||||
public final class ArithmeticTest {
|
||||
// source: 'ArithmeticTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field local$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field local: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method getLocal$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getLocal(): int
|
||||
public final method testAtomicCallPlaces(): boolean
|
||||
public final method testBoolean(): void
|
||||
public final method testGetValue(): void
|
||||
public final method testInt(): void
|
||||
public final method testLong(): void
|
||||
public final method testReference(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ArithmeticTestKt {
|
||||
// source: 'ArithmeticTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class BooleanArithmetic {
|
||||
// source: 'ArithmeticTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field _x$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field _x: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method getX(): boolean
|
||||
public final static @org.jetbrains.annotations.NotNull method get_x$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method get_x(): int
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class IntArithmetic {
|
||||
// source: 'ArithmeticTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field _x$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field _x: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method getX(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method get_x$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method get_x(): int
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LongArithmetic {
|
||||
// source: 'ArithmeticTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field _x$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field _x: long
|
||||
private final static @org.jetbrains.annotations.NotNull field max$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field max: long
|
||||
private final static @org.jetbrains.annotations.NotNull field y$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field y: long
|
||||
private final static @org.jetbrains.annotations.NotNull field z$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field z: long
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method getMax$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
public final method getMax(): long
|
||||
public final method getX(): long
|
||||
public final static @org.jetbrains.annotations.NotNull method getY$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
public final method getY(): long
|
||||
public final static @org.jetbrains.annotations.NotNull method getZ$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
public final method getZ(): long
|
||||
public final static @org.jetbrains.annotations.NotNull method get_x$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
public final method get_x(): long
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ReferenceArithmetic {
|
||||
// source: 'ArithmeticTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field _x$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field _x: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method get_x$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
public final @org.jetbrains.annotations.Nullable method get_x(): java.lang.Object
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class VisibilitiesTest {
|
||||
// source: 'ArithmeticTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field a$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field a: int
|
||||
private final static @org.jetbrains.annotations.NotNull field b$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field b: int
|
||||
private final static @org.jetbrains.annotations.NotNull field c$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field c: int
|
||||
private final static @org.jetbrains.annotations.NotNull field d$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field d: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method getA$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getA(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getB$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getB(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getD$FU$main(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getD$main(): int
|
||||
public final method test(): void
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import kotlinx.atomicfu.*
|
||||
import kotlin.test.*
|
||||
|
||||
class ArrayInlineExtensionTest {
|
||||
val intArr = AtomicIntArray(10)
|
||||
val a = atomic(100)
|
||||
val longArr = AtomicLongArray(10)
|
||||
val refArr = atomicArrayOfNulls<Any?>(5)
|
||||
|
||||
class A(val s: String)
|
||||
|
||||
private inline fun casLoop(to: Int): Int {
|
||||
intArr[0].loop { cur ->
|
||||
if (intArr[0].compareAndSet(cur, to)) return intArr[0].value
|
||||
return 777
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun casLoopExpression(to: Long): Long = longArr[3].loop { cur ->
|
||||
if (longArr[3].compareAndSet(cur, to)) return longArr[3].value
|
||||
return 777
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.extensionLoop(to: Int): Int {
|
||||
loop { cur ->
|
||||
if (compareAndSet(cur, to)) return value
|
||||
return 777
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.extensionLoopExpression(to: Int): Int = loop { cur ->
|
||||
lazySet(cur + 10)
|
||||
return if (compareAndSet(cur, to)) value else incrementAndGet()
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.extensionLoopMixedReceivers(first: Int, second: Int, index: Int): Int {
|
||||
loop { cur ->
|
||||
compareAndSet(cur, first)
|
||||
intArr[index].compareAndSet(first, second)
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.extensionLoopRecursive(to: Int): Int {
|
||||
loop { cur ->
|
||||
compareAndSet(cur, to)
|
||||
a.extensionLoop(5)
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.foo(to: Int): Int {
|
||||
loop { cur ->
|
||||
if (compareAndSet(cur, to)) return 777
|
||||
else return value
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.bar(delta: Int): Int {
|
||||
return foo(value + delta)
|
||||
}
|
||||
|
||||
fun testIntExtensionLoops() {
|
||||
assertEquals(5, casLoop(5))
|
||||
assertEquals(6, casLoopExpression(6))
|
||||
assertEquals(66, intArr[1].extensionLoop(66))
|
||||
assertEquals(66, intArr[2].extensionLoop(66))
|
||||
assertEquals(77, intArr[1].extensionLoopExpression(777))
|
||||
assertEquals(99, intArr[1].extensionLoopMixedReceivers(88, 99, 1))
|
||||
assertEquals(100, intArr[1].extensionLoopRecursive(100))
|
||||
assertEquals(777, intArr[1].bar(100))
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val testClass = ArrayInlineExtensionTest()
|
||||
testClass.testIntExtensionLoops()
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
@kotlin.Metadata
|
||||
public final class ArrayInlineExtensionTest$A {
|
||||
// source: 'ArrayInlineExtensionTest.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field s: java.lang.String
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
|
||||
public final inner class ArrayInlineExtensionTest$A
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ArrayInlineExtensionTest {
|
||||
// source: 'ArrayInlineExtensionTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field a$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field a: int
|
||||
private final @org.jetbrains.annotations.NotNull field intArr: java.util.concurrent.atomic.AtomicIntegerArray
|
||||
private final @org.jetbrains.annotations.NotNull field longArr: java.util.concurrent.atomic.AtomicLongArray
|
||||
private final @org.jetbrains.annotations.NotNull field refArr: java.util.concurrent.atomic.AtomicReferenceArray
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method bar$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
|
||||
public final method bar$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
|
||||
private final method casLoop(p0: int): int
|
||||
private final method casLoopExpression(p0: long): long
|
||||
public final method extensionLoop$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
|
||||
public final method extensionLoop$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
|
||||
public final method extensionLoopExpression$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
|
||||
public final method extensionLoopExpression$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
|
||||
public final method extensionLoopMixedReceivers$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int, p4: int, p5: int): int
|
||||
public final method extensionLoopMixedReceivers$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int, p3: int, p4: int): int
|
||||
public final method extensionLoopRecursive$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
|
||||
public final method extensionLoopRecursive$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
|
||||
public final method foo$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
|
||||
public final method foo$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getA$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getA(): int
|
||||
public final @org.jetbrains.annotations.NotNull method getIntArr(): java.util.concurrent.atomic.AtomicIntegerArray
|
||||
public final @org.jetbrains.annotations.NotNull method getLongArr(): java.util.concurrent.atomic.AtomicLongArray
|
||||
public final @org.jetbrains.annotations.NotNull method getRefArr(): java.util.concurrent.atomic.AtomicReferenceArray
|
||||
public final method loop$atomicfu$array(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicIntegerArray, p1: int, @org.jetbrains.annotations.NotNull p2: kotlin.jvm.functions.Function1): void
|
||||
public final method loop$atomicfu$array(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicLongArray, p1: int, @org.jetbrains.annotations.NotNull p2: kotlin.jvm.functions.Function1): void
|
||||
public final method loop$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
public final method testIntExtensionLoops(): void
|
||||
public final inner class ArrayInlineExtensionTest$A
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ArrayInlineExtensionTestKt {
|
||||
// source: 'ArrayInlineExtensionTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
-3
@@ -16,21 +16,18 @@ class ArrayInlineFunctionTest {
|
||||
|
||||
private fun action(cur: Box?) = cur?.let { Box(cur.n * 10) }
|
||||
|
||||
|
||||
fun testArrayElementUpdate() {
|
||||
refArr[0].lazySet(Box(5))
|
||||
refArr[0].update { cur -> cur?.let { Box(cur.n * 10) } }
|
||||
assertEquals(refArr[0].value!!.n, 50)
|
||||
}
|
||||
|
||||
|
||||
fun testArrayElementGetAndUpdate() {
|
||||
refArr[0].lazySet(Box(5))
|
||||
assertEquals(refArr[0].getAndUpdate { cur -> action(cur) }!!.n, 5)
|
||||
assertEquals(refArr[0].value!!.n, 50)
|
||||
}
|
||||
|
||||
|
||||
fun testArrayElementUpdateAndGet() {
|
||||
refArr[0].lazySet(Box(5))
|
||||
assertEquals(refArr[0].updateAndGet { cur -> action(cur) }!!.n, 50)
|
||||
@@ -0,0 +1,38 @@
|
||||
@kotlin.Metadata
|
||||
final class ArrayInlineFunctionTest$Box {
|
||||
// source: 'ArrayLoopTest.kt'
|
||||
private final field n: int
|
||||
public method <init>(p0: int): void
|
||||
public final method component1(): int
|
||||
public synthetic static method copy$default(p0: ArrayInlineFunctionTest$Box, p1: int, p2: int, p3: java.lang.Object): ArrayInlineFunctionTest$Box
|
||||
public final @org.jetbrains.annotations.NotNull method copy(p0: int): ArrayInlineFunctionTest$Box
|
||||
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
|
||||
public final method getN(): int
|
||||
public method hashCode(): int
|
||||
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
|
||||
private final inner class ArrayInlineFunctionTest$Box
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ArrayInlineFunctionTest {
|
||||
// source: 'ArrayLoopTest.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field anyArr: java.util.concurrent.atomic.AtomicReferenceArray
|
||||
private final @org.jetbrains.annotations.NotNull field refArr: java.util.concurrent.atomic.AtomicReferenceArray
|
||||
public method <init>(): void
|
||||
private final method action(p0: ArrayInlineFunctionTest$Box): ArrayInlineFunctionTest$Box
|
||||
public final @org.jetbrains.annotations.Nullable method getAndUpdate$atomicfu$array(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, @org.jetbrains.annotations.NotNull p2: kotlin.jvm.functions.Function1): java.lang.Object
|
||||
public final method loop$atomicfu$array(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, @org.jetbrains.annotations.NotNull p2: kotlin.jvm.functions.Function1): void
|
||||
public final method testArrayElementGetAndUpdate(): void
|
||||
public final method testArrayElementUpdate(): void
|
||||
public final method testArrayElementUpdateAndGet(): void
|
||||
public final method testSetArrayElementValueInLoop(): void
|
||||
public final method update$atomicfu$array(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, @org.jetbrains.annotations.NotNull p2: kotlin.jvm.functions.Function1): void
|
||||
public final @org.jetbrains.annotations.Nullable method updateAndGet$atomicfu$array(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, @org.jetbrains.annotations.NotNull p2: kotlin.jvm.functions.Function1): java.lang.Object
|
||||
private final inner class ArrayInlineFunctionTest$Box
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ArrayLoopTestKt {
|
||||
// source: 'ArrayLoopTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -5,59 +5,57 @@ class AtomicArrayTest {
|
||||
|
||||
fun testIntArray() {
|
||||
val A = AtomicArrayClass()
|
||||
check(A.intArr[0].compareAndSet(0, 3))
|
||||
check(A.intArr[1].value == 0)
|
||||
assertTrue(A.intArr[0].compareAndSet(0, 3))
|
||||
assertEquals(0, A.intArr[1].value)
|
||||
A.intArr[0].lazySet(5)
|
||||
check(A.intArr[0].value + A.intArr[1].value + A.intArr[2].value == 5)
|
||||
check(A.intArr[0].compareAndSet(5, 10))
|
||||
check(A.intArr[0].getAndDecrement() == 10)
|
||||
check(A.intArr[0].value == 9)
|
||||
assertEquals(5, A.intArr[0].value + A.intArr[1].value + A.intArr[2].value)
|
||||
assertTrue(A.intArr[0].compareAndSet(5, 10))
|
||||
assertEquals(10, A.intArr[0].getAndDecrement())
|
||||
assertEquals(9, A.intArr[0].value)
|
||||
A.intArr[2].value = 2
|
||||
check(A.intArr[2].value == 2)
|
||||
check(A.intArr[2].compareAndSet(2, 34))
|
||||
check(A.intArr[2].value == 34)
|
||||
assertEquals(2, A.intArr[2].value)
|
||||
assertTrue(A.intArr[2].compareAndSet(2, 34))
|
||||
assertEquals(34, A.intArr[2].value)
|
||||
}
|
||||
|
||||
|
||||
fun testLongArray() {
|
||||
val A = AtomicArrayClass()
|
||||
A.longArr[0].value = 2424920024888888848
|
||||
check(A.longArr[0].value == 2424920024888888848)
|
||||
assertEquals(2424920024888888848, A.longArr[0].value)
|
||||
A.longArr[0].lazySet(8424920024888888848)
|
||||
check(A.longArr[0].value == 8424920024888888848)
|
||||
assertEquals(8424920024888888848, A.longArr[0].value)
|
||||
val ac = A.longArr[0].value
|
||||
A.longArr[3].value = ac
|
||||
check(A.longArr[3].getAndSet(8924920024888888848) == 8424920024888888848)
|
||||
check(A.longArr[3].value == 8924920024888888848)
|
||||
assertEquals(8424920024888888848, A.longArr[3].getAndSet(8924920024888888848))
|
||||
assertEquals(8924920024888888848, A.longArr[3].value)
|
||||
val ac1 = A.longArr[3].value
|
||||
A.longArr[4].value = ac1
|
||||
check(A.longArr[4].incrementAndGet() == 8924920024888888849)
|
||||
check(A.longArr[4].value == 8924920024888888849)
|
||||
check(A.longArr[4].getAndDecrement() == 8924920024888888849)
|
||||
check(A.longArr[4].value == 8924920024888888848)
|
||||
assertEquals(8924920024888888849, A.longArr[4].incrementAndGet())
|
||||
assertEquals(8924920024888888849, A.longArr[4].value)
|
||||
assertEquals(8924920024888888849, A.longArr[4].getAndDecrement())
|
||||
assertEquals(8924920024888888848, A.longArr[4].value)
|
||||
A.longArr[4].value = 8924920024888888848
|
||||
check(A.longArr[4].getAndAdd(100000000000000000) == 8924920024888888848)
|
||||
assertEquals(8924920024888888848, A.longArr[4].getAndAdd(100000000000000000))
|
||||
val ac2 = A.longArr[4].value
|
||||
A.longArr[1].value = ac2
|
||||
check(A.longArr[1].value == 9024920024888888848)
|
||||
check(A.longArr[1].addAndGet(-9223372036854775807) == -198452011965886959)
|
||||
check(A.longArr[1].value == -198452011965886959)
|
||||
check(A.longArr[1].incrementAndGet() == -198452011965886958)
|
||||
check(A.longArr[1].value == -198452011965886958)
|
||||
check(A.longArr[1].decrementAndGet() == -198452011965886959)
|
||||
check(A.longArr[1].value == -198452011965886959)
|
||||
assertEquals(9024920024888888848, A.longArr[1].value)
|
||||
assertEquals(-198452011965886959, A.longArr[1].addAndGet(-9223372036854775807))
|
||||
assertEquals(-198452011965886959, A.longArr[1].value)
|
||||
assertEquals(-198452011965886958, A.longArr[1].incrementAndGet())
|
||||
assertEquals(-198452011965886958, A.longArr[1].value)
|
||||
assertEquals(-198452011965886959, A.longArr[1].decrementAndGet())
|
||||
assertEquals(-198452011965886959, A.longArr[1].value)
|
||||
}
|
||||
|
||||
|
||||
fun testBooleanArray() {
|
||||
val A = AtomicArrayClass()
|
||||
check(!A.booleanArr[1].value)
|
||||
A.booleanArr[1].compareAndSet(false, true)
|
||||
assertFalse(A.booleanArr[1].value)
|
||||
assertTrue(A.booleanArr[1].compareAndSet(false, true))
|
||||
A.booleanArr[0].lazySet(true)
|
||||
check(!A.booleanArr[2].getAndSet(true))
|
||||
check(A.booleanArr[0].value && A.booleanArr[1].value && A.booleanArr[2].value)
|
||||
assertFalse(A.booleanArr[2].getAndSet(true))
|
||||
assertTrue(A.booleanArr[0].value && A.booleanArr[1].value && A.booleanArr[2].value)
|
||||
A.booleanArr[0].value = false
|
||||
check(!A.booleanArr[0].value)
|
||||
assertFalse(A.booleanArr[0].value)
|
||||
}
|
||||
|
||||
fun testRefArray() {
|
||||
@@ -65,14 +63,27 @@ class AtomicArrayTest {
|
||||
val a2 = ARef(2)
|
||||
val a3 = ARef(3)
|
||||
A.refArr[0].value = a2
|
||||
check(A.refArr[0].value!!.n == 2)
|
||||
check(A.refArr[0].compareAndSet(a2, a3))
|
||||
check(A.refArr[0].value!!.n == 3)
|
||||
assertEquals(2, A.refArr[0].value!!.n)
|
||||
assertTrue(A.refArr[0].compareAndSet(a2, a3))
|
||||
assertEquals(3, A.refArr[0].value!!.n)
|
||||
val r0 = A.refArr[0].value
|
||||
A.refArr[3].value = r0
|
||||
check(A.refArr[3].value!!.n == 3)
|
||||
assertEquals(3, A.refArr[3].value!!.n)
|
||||
val a = A.a.value
|
||||
check(A.refArr[3].compareAndSet(a3, a))
|
||||
assertTrue(A.refArr[3].compareAndSet(a3, a))
|
||||
}
|
||||
|
||||
fun testAnyArray() {
|
||||
val A = AtomicArrayClass()
|
||||
val s1 = "aaa"
|
||||
val s2 = "bbb"
|
||||
A.anyArr[0].value = s1
|
||||
assertEquals("aaa", A.anyArr[0].value)
|
||||
assertTrue(A.anyArr[0].compareAndSet(s1, s2))
|
||||
assertEquals("bbb", A.anyArr[0].value)
|
||||
val r0 = A.anyArr[0].value
|
||||
A.anyArr[3].value = r0
|
||||
assertEquals("bbb", A.anyArr[3].value)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,5 +104,6 @@ fun box(): String {
|
||||
testClass.testLongArray()
|
||||
testClass.testBooleanArray()
|
||||
testClass.testRefArray()
|
||||
testClass.testAnyArray()
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
@kotlin.Metadata
|
||||
public final class ARef {
|
||||
// source: 'AtomicArrayTest.kt'
|
||||
private final field n: int
|
||||
public method <init>(p0: int): void
|
||||
public final method component1(): int
|
||||
public synthetic static method copy$default(p0: ARef, p1: int, p2: int, p3: java.lang.Object): ARef
|
||||
public final @org.jetbrains.annotations.NotNull method copy(p0: int): ARef
|
||||
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
|
||||
public final method getN(): int
|
||||
public method hashCode(): int
|
||||
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class AtomicArrayClass {
|
||||
// source: 'AtomicArrayTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field a$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field a: java.lang.Object
|
||||
private final @org.jetbrains.annotations.NotNull field anyArr: java.util.concurrent.atomic.AtomicReferenceArray
|
||||
private final @org.jetbrains.annotations.NotNull field booleanArr: java.util.concurrent.atomic.AtomicIntegerArray
|
||||
private final @org.jetbrains.annotations.NotNull field intArr: java.util.concurrent.atomic.AtomicIntegerArray
|
||||
private final @org.jetbrains.annotations.NotNull field longArr: java.util.concurrent.atomic.AtomicLongArray
|
||||
private final @org.jetbrains.annotations.NotNull field refArr: java.util.concurrent.atomic.AtomicReferenceArray
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method getA$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
public final @org.jetbrains.annotations.Nullable method getA(): java.lang.Object
|
||||
public final @org.jetbrains.annotations.NotNull method getAnyArr(): java.util.concurrent.atomic.AtomicReferenceArray
|
||||
public final @org.jetbrains.annotations.NotNull method getBooleanArr(): java.util.concurrent.atomic.AtomicIntegerArray
|
||||
public final @org.jetbrains.annotations.NotNull method getIntArr(): java.util.concurrent.atomic.AtomicIntegerArray
|
||||
public final @org.jetbrains.annotations.NotNull method getLongArr(): java.util.concurrent.atomic.AtomicLongArray
|
||||
public final @org.jetbrains.annotations.NotNull method getRefArr(): java.util.concurrent.atomic.AtomicReferenceArray
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class AtomicArrayTest {
|
||||
// source: 'AtomicArrayTest.kt'
|
||||
public method <init>(): void
|
||||
public final method testAnyArray(): void
|
||||
public final method testBooleanArray(): void
|
||||
public final method testIntArray(): void
|
||||
public final method testLongArray(): void
|
||||
public final method testRefArray(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class AtomicArrayTestKt {
|
||||
// source: 'AtomicArrayTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import kotlinx.atomicfu.*
|
||||
import kotlin.test.*
|
||||
|
||||
class LoopTest {
|
||||
val a = atomic(10)
|
||||
val b = atomic(11)
|
||||
val c = atomic(12)
|
||||
val r = atomic<String>("aaa")
|
||||
val intArr = AtomicIntArray(10)
|
||||
|
||||
private inline fun AtomicInt.extensionEmbeddedLoops(to: Int): Int =
|
||||
loop { cur1 ->
|
||||
compareAndSet(cur1, to)
|
||||
loop { cur2 ->
|
||||
return cur2
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun embeddedLoops(to: Int): Int =
|
||||
a.loop { aValue ->
|
||||
b.loop { bValue ->
|
||||
if (b.compareAndSet(bValue, to)) return aValue + bValue
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun embeddedUpdate(to: Int): Int =
|
||||
a.loop { aValue ->
|
||||
a.compareAndSet(aValue, to)
|
||||
return a.updateAndGet { cur -> cur + 100 }
|
||||
}
|
||||
|
||||
private inline fun AtomicRef<String>.extesntionEmbeddedRefUpdate(to: String): String =
|
||||
loop { value ->
|
||||
compareAndSet(value, to)
|
||||
return updateAndGet { cur -> "${cur}AAA" }
|
||||
}
|
||||
|
||||
fun test() {
|
||||
assertEquals(21, embeddedLoops(12))
|
||||
assertEquals(77, c.extensionEmbeddedLoops(77))
|
||||
assertEquals(66, intArr[0].extensionEmbeddedLoops(66))
|
||||
assertEquals(166, embeddedUpdate(66))
|
||||
assertEquals("bbbAAA", r.extesntionEmbeddedRefUpdate("bbb"))
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val testClass = LoopTest()
|
||||
testClass.test()
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
@kotlin.Metadata
|
||||
public final class ComplexLoopTestKt {
|
||||
// source: 'ComplexLoopTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LoopTest {
|
||||
// source: 'ComplexLoopTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field a$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field a: int
|
||||
private final static @org.jetbrains.annotations.NotNull field b$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field b: int
|
||||
private final static @org.jetbrains.annotations.NotNull field c$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field c: int
|
||||
private final @org.jetbrains.annotations.NotNull field intArr: java.util.concurrent.atomic.AtomicIntegerArray
|
||||
private final static @org.jetbrains.annotations.NotNull field r$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field r: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
private final method embeddedLoops(p0: int): int
|
||||
private final method embeddedUpdate(p0: int): int
|
||||
public final method extensionEmbeddedLoops$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
|
||||
public final method extensionEmbeddedLoops$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
|
||||
public final @org.jetbrains.annotations.NotNull method extesntionEmbeddedRefUpdate$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int, @org.jetbrains.annotations.NotNull p3: java.lang.String): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method extesntionEmbeddedRefUpdate$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, @org.jetbrains.annotations.NotNull p2: java.lang.String): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method getA$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getA(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getB$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getB(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getC$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getC(): int
|
||||
public final @org.jetbrains.annotations.NotNull method getIntArr(): java.util.concurrent.atomic.AtomicIntegerArray
|
||||
public final static @org.jetbrains.annotations.NotNull method getR$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
public final @org.jetbrains.annotations.Nullable method getR(): java.lang.Object
|
||||
public final method loop$atomicfu$array(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicIntegerArray, p1: int, @org.jetbrains.annotations.NotNull p2: kotlin.jvm.functions.Function1): void
|
||||
public final method loop$atomicfu$array(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, @org.jetbrains.annotations.NotNull p2: kotlin.jvm.functions.Function1): void
|
||||
public final method loop$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
public final method loop$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
public final method test(): void
|
||||
public final @org.jetbrains.annotations.Nullable method updateAndGet$atomicfu$array(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, @org.jetbrains.annotations.NotNull p2: kotlin.jvm.functions.Function1): java.lang.Object
|
||||
public final method updateAndGet$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): int
|
||||
public final @org.jetbrains.annotations.Nullable method updateAndGet$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.Object
|
||||
}
|
||||
+15
-7
@@ -4,7 +4,7 @@ import kotlin.test.*
|
||||
private val _topLevelInt = atomic(42)
|
||||
var topLevelInt: Int by _topLevelInt
|
||||
|
||||
var vIntTopLevel by atomic(55)
|
||||
private var topLevelVolatile by atomic(56)
|
||||
|
||||
class DelegatedProperties {
|
||||
private val _a = atomic(42)
|
||||
@@ -30,7 +30,7 @@ class DelegatedProperties {
|
||||
class A (val b: B)
|
||||
class B (val n: Int)
|
||||
|
||||
fun testDelegatedAtomicInt() {
|
||||
fun testDelegatedAtomicInt() {
|
||||
assertEquals(42, a)
|
||||
_a.compareAndSet(42, 56)
|
||||
assertEquals(56, a)
|
||||
@@ -96,6 +96,7 @@ class DelegatedProperties {
|
||||
|
||||
inner class D {
|
||||
var b: Int by _a
|
||||
var c by atomic("aaa")
|
||||
}
|
||||
|
||||
fun testScopedDelegatedProperties() {
|
||||
@@ -107,6 +108,10 @@ class DelegatedProperties {
|
||||
_a.compareAndSet(77, 66)
|
||||
assertEquals(66, _a.value)
|
||||
assertEquals(66, clazz.b)
|
||||
|
||||
assertEquals("aaa", clazz.c)
|
||||
clazz.c = "bbb"
|
||||
assertEquals("bbb", clazz.c)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
@@ -130,15 +135,18 @@ fun testTopLevelDelegatedProperties() {
|
||||
_topLevelInt.compareAndSet(77, 66)
|
||||
assertEquals(66, _topLevelInt.value)
|
||||
assertEquals(66, topLevelInt)
|
||||
}
|
||||
|
||||
assertEquals(55, vIntTopLevel)
|
||||
vIntTopLevel = 70
|
||||
assertEquals(140, vIntTopLevel * 2)
|
||||
fun testTopLevelVolatileProperties() {
|
||||
assertEquals(56, topLevelVolatile)
|
||||
topLevelVolatile = 55
|
||||
assertEquals(110, topLevelVolatile * 2)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val testClass = DelegatedProperties()
|
||||
testClass.test()
|
||||
//testTopLevelDelegatedProperties()
|
||||
testTopLevelDelegatedProperties()
|
||||
testTopLevelVolatileProperties()
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
@kotlin.Metadata
|
||||
public final class DelegatedProperties$A {
|
||||
// source: 'DelegatedPropertiesTest.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field b: DelegatedProperties$B
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: DelegatedProperties$B): void
|
||||
public final @org.jetbrains.annotations.NotNull method getB(): DelegatedProperties$B
|
||||
public final inner class DelegatedProperties$A
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class DelegatedProperties$B {
|
||||
// source: 'DelegatedPropertiesTest.kt'
|
||||
private final field n: int
|
||||
public method <init>(p0: int): void
|
||||
public final method getN(): int
|
||||
public final inner class DelegatedProperties$B
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class DelegatedProperties$D {
|
||||
// source: 'DelegatedPropertiesTest.kt'
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field c: java.lang.Object
|
||||
synthetic final field this$0: DelegatedProperties
|
||||
public method <init>(p0: DelegatedProperties): void
|
||||
public final method getB(): int
|
||||
public final @org.jetbrains.annotations.NotNull method getC(): java.lang.String
|
||||
public final method setB(p0: int): void
|
||||
public final method setC(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final inner class DelegatedProperties$D
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class DelegatedProperties {
|
||||
// source: 'DelegatedPropertiesTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field _a$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field _a: int
|
||||
private final static @org.jetbrains.annotations.NotNull field _b$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field _b: int
|
||||
private final static @org.jetbrains.annotations.NotNull field _l$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field _l: long
|
||||
private final static @org.jetbrains.annotations.NotNull field _ref$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field _ref: java.lang.Object
|
||||
private volatile @kotlin.jvm.Volatile field vBoolean: int
|
||||
private volatile @kotlin.jvm.Volatile field vInt: int
|
||||
private volatile @kotlin.jvm.Volatile field vLong: int
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field vRef: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public synthetic final static method access$get_a$p(p0: DelegatedProperties): int
|
||||
public synthetic final static method access$set_a$p(p0: DelegatedProperties, p1: int): void
|
||||
public final method getA(): int
|
||||
public final method getB(): boolean
|
||||
public final method getL(): long
|
||||
public final @org.jetbrains.annotations.NotNull method getRef(): DelegatedProperties$A
|
||||
public final method getVBoolean(): boolean
|
||||
public final method getVInt(): int
|
||||
public final method getVLong(): int
|
||||
public final @org.jetbrains.annotations.NotNull method getVRef(): DelegatedProperties$A
|
||||
public final method setA(p0: int): void
|
||||
public final method setB(p0: boolean): void
|
||||
public final method setL(p0: long): void
|
||||
public final method setRef(@org.jetbrains.annotations.NotNull p0: DelegatedProperties$A): void
|
||||
public final method setVBoolean(p0: boolean): void
|
||||
public final method setVInt(p0: int): void
|
||||
public final method setVLong(p0: int): void
|
||||
public final method setVRef(@org.jetbrains.annotations.NotNull p0: DelegatedProperties$A): void
|
||||
public final method test(): void
|
||||
public final method testDelegatedAtomicBoolean(): void
|
||||
public final method testDelegatedAtomicInt(): void
|
||||
public final method testDelegatedAtomicLong(): void
|
||||
public final method testDelegatedAtomicRef(): void
|
||||
public final method testScopedDelegatedProperties(): void
|
||||
public final method testVolatileBoolean(): void
|
||||
public final method testVolatileInt(): void
|
||||
public final method testVolatileLong(): void
|
||||
public final method testVolatileRef(): void
|
||||
public final inner class DelegatedProperties$A
|
||||
public final inner class DelegatedProperties$B
|
||||
public final inner class DelegatedProperties$D
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class DelegatedPropertiesTestKt {
|
||||
// source: 'DelegatedPropertiesTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull field _topLevelInt$DelegatedPropertiesTest$VolatileWrapper: _topLevelInt$DelegatedPropertiesTest$VolatileWrapper
|
||||
private volatile static @kotlin.jvm.Volatile field topLevelVolatile: int
|
||||
static method <clinit>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static method getTopLevelInt(): int
|
||||
private final static method getTopLevelVolatile(): int
|
||||
public final static method setTopLevelInt(p0: int): void
|
||||
private final static method setTopLevelVolatile(p0: int): void
|
||||
public final static method testTopLevelDelegatedProperties(): void
|
||||
public final static method testTopLevelVolatileProperties(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class _topLevelInt$DelegatedPropertiesTest$VolatileWrapper {
|
||||
// source: 'DelegatedPropertiesTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field _topLevelInt$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field _topLevelInt: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public synthetic final static method access$get_topLevelInt$FU$p(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public synthetic final static method access$get_topLevelInt$p(p0: _topLevelInt$DelegatedPropertiesTest$VolatileWrapper): int
|
||||
public synthetic final static method access$set_topLevelInt$p(p0: _topLevelInt$DelegatedPropertiesTest$VolatileWrapper, p1: int): void
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
import kotlinx.atomicfu.*
|
||||
import kotlin.test.*
|
||||
|
||||
class LoopTest {
|
||||
val a = atomic(0)
|
||||
val a1 = atomic(1)
|
||||
val b = atomic(true)
|
||||
val l = atomic(5000000000)
|
||||
val r = atomic<A>(A("aaaa"))
|
||||
val rs = atomic<String>("bbbb")
|
||||
|
||||
class A(val s: String)
|
||||
|
||||
private inline fun casLoop(to: Int): Int {
|
||||
a.loop { cur ->
|
||||
if (a.compareAndSet(cur, to)) return a.value
|
||||
return 777
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun casLoopExpression(to: Int): Int = a.loop { cur ->
|
||||
if (a.compareAndSet(cur, to)) return a.value
|
||||
return 777
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.extensionLoop(to: Int): Int {
|
||||
loop { cur ->
|
||||
if (compareAndSet(cur, to)) return value
|
||||
return 777
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.extensionLoopExpression(to: Int): Int = loop { cur ->
|
||||
lazySet(cur + 10)
|
||||
return if (compareAndSet(cur, to)) value else incrementAndGet()
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.extensionLoopMixedReceivers(first: Int, second: Int): Int {
|
||||
loop { cur ->
|
||||
compareAndSet(cur, first)
|
||||
a.compareAndSet(first, second)
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.extensionLoopRecursive(to: Int): Int {
|
||||
loop { cur ->
|
||||
compareAndSet(cur, to)
|
||||
a.extensionLoop(5)
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.foo(to: Int): Int {
|
||||
loop { cur ->
|
||||
if (compareAndSet(cur, to)) return 777
|
||||
else return value
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.bar(delta: Int): Int {
|
||||
return foo(value + delta)
|
||||
}
|
||||
|
||||
fun testIntExtensionLoops() {
|
||||
assertEquals(5, casLoop(5))
|
||||
assertEquals(6, casLoopExpression(6))
|
||||
assertEquals(66, a.extensionLoop(66))
|
||||
assertEquals(77, a.extensionLoopExpression(777))
|
||||
assertEquals(99, a.extensionLoopMixedReceivers(88, 99))
|
||||
assertEquals(5, a.extensionLoopRecursive(100))
|
||||
assertEquals(777, a.bar(100))
|
||||
}
|
||||
}
|
||||
|
||||
private val ref = atomic<String>("aaa")
|
||||
|
||||
private inline fun AtomicRef<String>.topLevelExtensionLoop(to: String): String = loop { cur ->
|
||||
lazySet(cur + to)
|
||||
return value
|
||||
}
|
||||
|
||||
fun testTopLevelExtensionLoop() {
|
||||
assertEquals("aaattt", ref.topLevelExtensionLoop("ttt"))
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val testClass = LoopTest()
|
||||
testClass.testIntExtensionLoops()
|
||||
testTopLevelExtensionLoop()
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
@kotlin.Metadata
|
||||
public final class ExtensionLoopTestKt {
|
||||
// source: 'ExtensionLoopTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull field ref$ExtensionLoopTest$VolatileWrapper: Ref$ExtensionLoopTest$VolatileWrapper
|
||||
static method <clinit>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static method loop$atomicfu$array(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, @org.jetbrains.annotations.NotNull p2: kotlin.jvm.functions.Function1): void
|
||||
public final static method loop$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
public final static method testTopLevelExtensionLoop(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method topLevelExtensionLoop$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int, @org.jetbrains.annotations.NotNull p3: java.lang.String): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method topLevelExtensionLoop$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, @org.jetbrains.annotations.NotNull p2: java.lang.String): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LoopTest$A {
|
||||
// source: 'ExtensionLoopTest.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field s: java.lang.String
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
|
||||
public final inner class LoopTest$A
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LoopTest {
|
||||
// source: 'ExtensionLoopTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field a$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private final static @org.jetbrains.annotations.NotNull field a1$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field a1: int
|
||||
private volatile @kotlin.jvm.Volatile field a: int
|
||||
private final static @org.jetbrains.annotations.NotNull field b$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field b: int
|
||||
private final static @org.jetbrains.annotations.NotNull field l$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field l: long
|
||||
private final static @org.jetbrains.annotations.NotNull field r$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field r: java.lang.Object
|
||||
private final static @org.jetbrains.annotations.NotNull field rs$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field rs: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method bar$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
|
||||
public final method bar$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
|
||||
private final method casLoop(p0: int): int
|
||||
private final method casLoopExpression(p0: int): int
|
||||
public final method extensionLoop$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
|
||||
public final method extensionLoop$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
|
||||
public final method extensionLoopExpression$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
|
||||
public final method extensionLoopExpression$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
|
||||
public final method extensionLoopMixedReceivers$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int, p4: int): int
|
||||
public final method extensionLoopMixedReceivers$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int, p3: int): int
|
||||
public final method extensionLoopRecursive$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
|
||||
public final method extensionLoopRecursive$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
|
||||
public final method foo$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
|
||||
public final method foo$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getA$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getA(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getA1$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getA1(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getB$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getB(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getL$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
public final method getL(): long
|
||||
public final static @org.jetbrains.annotations.NotNull method getR$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
public final @org.jetbrains.annotations.Nullable method getR(): java.lang.Object
|
||||
public final static @org.jetbrains.annotations.NotNull method getRs$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
public final @org.jetbrains.annotations.Nullable method getRs(): java.lang.Object
|
||||
public final method loop$atomicfu$array(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicIntegerArray, p1: int, @org.jetbrains.annotations.NotNull p2: kotlin.jvm.functions.Function1): void
|
||||
public final method loop$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
public final method testIntExtensionLoops(): void
|
||||
public final inner class LoopTest$A
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Ref$ExtensionLoopTest$VolatileWrapper {
|
||||
// source: 'ExtensionLoopTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field ref$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field ref: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public synthetic final static method access$getRef$FU$p(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
@kotlin.Metadata
|
||||
public final class ExtensionsTest {
|
||||
// source: 'ExtensionsTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field a$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field a: int
|
||||
private final static @org.jetbrains.annotations.NotNull field b$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field b: int
|
||||
private final static @org.jetbrains.annotations.NotNull field l$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field l: long
|
||||
private final static @org.jetbrains.annotations.NotNull field s$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field s: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method booleanExtensionArithmetic$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int): void
|
||||
public final method booleanExtensionArithmetic$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater): void
|
||||
public final static @org.jetbrains.annotations.NotNull method getA$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getA(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getB$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getB(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getL$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
public final method getL(): long
|
||||
public final static @org.jetbrains.annotations.NotNull method getS$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
public final @org.jetbrains.annotations.Nullable method getS(): java.lang.Object
|
||||
public final method intExtensionArithmetic$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int): void
|
||||
public final method intExtensionArithmetic$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater): void
|
||||
public final method longExtensionArithmetic$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicLongArray, p2: int): void
|
||||
public final method longExtensionArithmetic$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicLongFieldUpdater): void
|
||||
public final method refExtension$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int): void
|
||||
public final method refExtension$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater): void
|
||||
public final method testExtension(): void
|
||||
public final method testScopedFieldGetters(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ExtensionsTestKt {
|
||||
// source: 'ExtensionsTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
+6
-6
@@ -10,13 +10,13 @@ class IndexArrayElementGetterTest {
|
||||
clazz.intArr[8].value = 3
|
||||
val i = fib(4)
|
||||
val j = fib(5)
|
||||
assertEquals(clazz.intArr[i + j].value, 3)
|
||||
assertEquals(clazz.intArr[fib(4) + fib(5)].value, 3)
|
||||
assertEquals(3, clazz.intArr[i + j].value)
|
||||
assertEquals(3, clazz.intArr[fib(4) + fib(5)].value)
|
||||
clazz.longArr[3].value = 100
|
||||
assertEquals(clazz.longArr[fib(6) - fib(5)].value, 100)
|
||||
assertEquals(clazz.longArr[(fib(6) + fib(4)) % 8].value, 100)
|
||||
assertEquals(clazz.longArr[(fib(6) + fib(4)) % 8].value, 100)
|
||||
assertEquals(clazz.longArr[(fib(4) + fib(5)) % fib(5)].value, 100)
|
||||
assertEquals(100, clazz.longArr[fib(6) - fib(5)].value)
|
||||
assertEquals(100, clazz.longArr[(fib(6) + fib(4)) % 8].value)
|
||||
assertEquals(100, clazz.longArr[(fib(6) + fib(4)) % 8].value)
|
||||
assertEquals(100, clazz.longArr[(fib(4) + fib(5)) % fib(5)].value)
|
||||
}
|
||||
|
||||
class AtomicArrayClass {
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
@kotlin.Metadata
|
||||
public final class IndexArrayElementGetterTest$AtomicArrayClass {
|
||||
// source: 'IndexArrayElementGetterTest.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field intArr: java.util.concurrent.atomic.AtomicIntegerArray
|
||||
private final @org.jetbrains.annotations.NotNull field longArr: java.util.concurrent.atomic.AtomicLongArray
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getIntArr(): java.util.concurrent.atomic.AtomicIntegerArray
|
||||
public final @org.jetbrains.annotations.NotNull method getLongArr(): java.util.concurrent.atomic.AtomicLongArray
|
||||
public final inner class IndexArrayElementGetterTest$AtomicArrayClass
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class IndexArrayElementGetterTest {
|
||||
// source: 'IndexArrayElementGetterTest.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field clazz: IndexArrayElementGetterTest$AtomicArrayClass
|
||||
public method <init>(): void
|
||||
public final method fib(p0: int): int
|
||||
public final method testIndexArrayElementGetting(): void
|
||||
public final inner class IndexArrayElementGetterTest$AtomicArrayClass
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class IndexArrayElementGetterTestKt {
|
||||
// source: 'IndexArrayElementGetterTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
+7
-5
@@ -8,8 +8,9 @@ class InlineExtensionWithTypeParameterTest {
|
||||
private inline fun <S : Segment<S>> AtomicRef<S>.foo(
|
||||
id: Int,
|
||||
startFrom: S
|
||||
) {
|
||||
startFrom.getSegmentId()
|
||||
): Int {
|
||||
lazySet(startFrom)
|
||||
return value.getSegmentId()
|
||||
}
|
||||
|
||||
private inline fun <S : Segment<S>> S.getSegmentId(): Int {
|
||||
@@ -17,10 +18,11 @@ class InlineExtensionWithTypeParameterTest {
|
||||
return cur.id
|
||||
}
|
||||
|
||||
val sref = atomic(SemaphoreSegment(0))
|
||||
|
||||
fun testInlineExtensionWithTypeParameter() {
|
||||
val s = SemaphoreSegment(0)
|
||||
val sref = atomic(s)
|
||||
sref.foo(0, s)
|
||||
val s = SemaphoreSegment(77)
|
||||
assertEquals(77, sref.foo(0, s))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
@kotlin.Metadata
|
||||
public abstract class InlineExtensionWithTypeParameterTest$Segment {
|
||||
// source: 'InlineExtensionWithTypeParameterTest.kt'
|
||||
private final field id: int
|
||||
public method <init>(p0: int): void
|
||||
public final method getId(): int
|
||||
public abstract inner class InlineExtensionWithTypeParameterTest$Segment
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class InlineExtensionWithTypeParameterTest$SemaphoreSegment {
|
||||
// source: 'InlineExtensionWithTypeParameterTest.kt'
|
||||
public method <init>(p0: int): void
|
||||
public final inner class InlineExtensionWithTypeParameterTest$SemaphoreSegment
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class InlineExtensionWithTypeParameterTest {
|
||||
// source: 'InlineExtensionWithTypeParameterTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field sref$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field sref: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method foo$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int, p3: int, @org.jetbrains.annotations.NotNull p4: InlineExtensionWithTypeParameterTest$Segment): int
|
||||
public final method foo$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p2: int, @org.jetbrains.annotations.NotNull p3: InlineExtensionWithTypeParameterTest$Segment): int
|
||||
private final method getSegmentId(p0: InlineExtensionWithTypeParameterTest$Segment): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getSref$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
public final @org.jetbrains.annotations.Nullable method getSref(): java.lang.Object
|
||||
public final method testInlineExtensionWithTypeParameter(): void
|
||||
public abstract inner class InlineExtensionWithTypeParameterTest$Segment
|
||||
public final inner class InlineExtensionWithTypeParameterTest$SemaphoreSegment
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class InlineExtensionWithTypeParameterTestKt {
|
||||
// source: 'InlineExtensionWithTypeParameterTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import kotlinx.atomicfu.*
|
||||
import kotlin.test.*
|
||||
|
||||
class LambdaTest {
|
||||
val a = atomic(0)
|
||||
val rs = atomic<String>("bbbb")
|
||||
|
||||
private inline fun inlineLambda(
|
||||
arg: Int,
|
||||
crossinline block: (Int) -> Unit
|
||||
) = block(arg)
|
||||
|
||||
fun loopInLambda1(to: Int) = inlineLambda(to) sc@ { arg ->
|
||||
a.loop { value ->
|
||||
a.compareAndSet(value, arg)
|
||||
return@sc
|
||||
}
|
||||
}
|
||||
|
||||
fun loopInLambda2(to: Int) = inlineLambda(to) { arg1 ->
|
||||
inlineLambda(arg1) sc@ { arg2 ->
|
||||
a.loop { value ->
|
||||
a.compareAndSet(value, arg2)
|
||||
return@sc
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val testClass = LambdaTest()
|
||||
testClass.loopInLambda1(34)
|
||||
assertEquals(34, testClass.a.value)
|
||||
testClass.loopInLambda1(77)
|
||||
assertEquals(77, testClass.a.value)
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
@kotlin.Metadata
|
||||
public final class LambdaTest {
|
||||
// source: 'LambdaTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field a$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field a: int
|
||||
private final static @org.jetbrains.annotations.NotNull field rs$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field rs: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method getA$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getA(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getRs$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
public final @org.jetbrains.annotations.Nullable method getRs(): java.lang.Object
|
||||
private final method inlineLambda(p0: int, p1: kotlin.jvm.functions.Function1): void
|
||||
public final method loop$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
public final method loopInLambda1(p0: int): void
|
||||
public final method loopInLambda2(p0: int): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LambdaTestKt {
|
||||
// source: 'LambdaTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
+12
-8
@@ -2,33 +2,37 @@ import kotlinx.atomicfu.*
|
||||
import kotlinx.atomicfu.locks.*
|
||||
import kotlin.test.*
|
||||
|
||||
class PropertyDeclarationTest {
|
||||
class LateinitPropertiesTest {
|
||||
private val a: AtomicInt
|
||||
private val head: AtomicRef<String>
|
||||
private val dataRef: AtomicRef<Data>
|
||||
private val lateIntArr: AtomicIntArray
|
||||
private val lateRefArr: AtomicArray<String?>
|
||||
private val lock: ReentrantLock
|
||||
|
||||
private class Data(val n: Int)
|
||||
|
||||
init {
|
||||
a = atomic(0)
|
||||
head = atomic("AAA")
|
||||
lateIntArr = AtomicIntArray(55)
|
||||
lateRefArr = atomicArrayOfNulls<String?>(10)
|
||||
lock = reentrantLock()
|
||||
val data = Data(77)
|
||||
dataRef = atomic(data)
|
||||
val size = 10
|
||||
lateRefArr = atomicArrayOfNulls<String?>(size)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
assertEquals(0, a.value)
|
||||
check(head.compareAndSet("AAA", "BBB"))
|
||||
assertTrue(head.compareAndSet("AAA", "BBB"))
|
||||
assertEquals("BBB", head.value)
|
||||
assertEquals(0, lateIntArr[35].value)
|
||||
assertEquals(77, dataRef.value.n)
|
||||
assertEquals(null, lateRefArr[5].value)
|
||||
assertEquals(null, lock)
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val testClass = PropertyDeclarationTest()
|
||||
val testClass = LateinitPropertiesTest()
|
||||
testClass.test()
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
@kotlin.Metadata
|
||||
final class LateinitPropertiesTest$Data {
|
||||
// source: 'LateinitPropertiesTest.kt'
|
||||
private final field n: int
|
||||
public method <init>(p0: int): void
|
||||
public final method getN(): int
|
||||
private final inner class LateinitPropertiesTest$Data
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LateinitPropertiesTest {
|
||||
// source: 'LateinitPropertiesTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field a$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field a: int
|
||||
private final static @org.jetbrains.annotations.NotNull field dataRef$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field dataRef: java.lang.Object
|
||||
private final static @org.jetbrains.annotations.NotNull field head$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field head: java.lang.Object
|
||||
private final @org.jetbrains.annotations.NotNull field lateIntArr: java.util.concurrent.atomic.AtomicIntegerArray
|
||||
private final @org.jetbrains.annotations.NotNull field lateRefArr: java.util.concurrent.atomic.AtomicReferenceArray
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method test(): void
|
||||
private final inner class LateinitPropertiesTest$Data
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LateinitPropertiesTestKt {
|
||||
// source: 'LateinitPropertiesTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -4,22 +4,22 @@ import kotlin.test.*
|
||||
class LockFreeIntBitsTest {
|
||||
fun testBasic() {
|
||||
val bs = LockFreeIntBits()
|
||||
check(!bs[0])
|
||||
check(bs.bitSet(0))
|
||||
check(bs[0])
|
||||
check(!bs.bitSet(0))
|
||||
assertTrue(!bs[0])
|
||||
assertTrue(bs.bitSet(0))
|
||||
assertTrue(bs[0])
|
||||
assertTrue(!bs.bitSet(0))
|
||||
|
||||
check(!bs[1])
|
||||
check(bs.bitSet(1))
|
||||
check(bs[1])
|
||||
check(!bs.bitSet(1))
|
||||
check(!bs.bitSet(0))
|
||||
assertTrue(!bs[1])
|
||||
assertTrue(bs.bitSet(1))
|
||||
assertTrue(bs[1])
|
||||
assertTrue(!bs.bitSet(1))
|
||||
assertTrue(!bs.bitSet(0))
|
||||
|
||||
check(bs[0])
|
||||
check(bs.bitClear(0))
|
||||
check(!bs.bitClear(0))
|
||||
assertTrue(bs[0])
|
||||
assertTrue(bs.bitClear(0))
|
||||
assertTrue(!bs.bitClear(0))
|
||||
|
||||
check(bs[1])
|
||||
assertTrue(bs[1])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
@kotlin.Metadata
|
||||
public final class LockFreeIntBits {
|
||||
// source: 'LockFreeIntBitsTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field bits$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field bits: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method bitClear(p0: int): boolean
|
||||
public final method bitSet(p0: int): boolean
|
||||
private final method bitUpdate(p0: kotlin.jvm.functions.Function1, p1: kotlin.jvm.functions.Function1): boolean
|
||||
public final method get(p0: int): boolean
|
||||
private final method mask(p0: int): int
|
||||
public final method update$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LockFreeIntBitsTest {
|
||||
// source: 'LockFreeIntBitsTest.kt'
|
||||
public method <init>(): void
|
||||
public final method testBasic(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LockFreeIntBitsTestKt {
|
||||
// source: 'LockFreeIntBitsTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -4,11 +4,11 @@ import kotlin.test.*
|
||||
class LockFreeLongCounterTest {
|
||||
private inline fun testWith(g: LockFreeLongCounter.() -> Long) {
|
||||
val c = LockFreeLongCounter()
|
||||
check(c.g() == 0L)
|
||||
check(c.increment() == 1L)
|
||||
check(c.g() == 1L)
|
||||
check(c.increment() == 2L)
|
||||
check(c.g() == 2L)
|
||||
assertEquals(0L, c.g())
|
||||
assertEquals(1L, c.increment())
|
||||
assertEquals(1L, c.g())
|
||||
assertEquals(2L, c.increment())
|
||||
assertEquals(2L, c.g())
|
||||
}
|
||||
|
||||
fun testBasic() = testWith { get() }
|
||||
@@ -18,15 +18,15 @@ class LockFreeLongCounterTest {
|
||||
fun testAdd2() {
|
||||
val c = LockFreeLongCounter()
|
||||
c.add2()
|
||||
check(c.get() == 2L)
|
||||
assertEquals(2L, c.get())
|
||||
c.add2()
|
||||
check(c.get() == 4L)
|
||||
assertEquals(4L, c.get())
|
||||
}
|
||||
|
||||
fun testSetM2() {
|
||||
val c = LockFreeLongCounter()
|
||||
c.setM2()
|
||||
check(c.get() == -2L)
|
||||
assertEquals(-2L, c.get())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
@kotlin.Metadata
|
||||
final class LockFreeLongCounter$Inner {
|
||||
// source: 'LockFreeLongCounterTest.kt'
|
||||
synthetic final field this$0: LockFreeLongCounter
|
||||
public method <init>(p0: LockFreeLongCounter): void
|
||||
public final method getFromOuter(): long
|
||||
private final inner class LockFreeLongCounter$Inner
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LockFreeLongCounter {
|
||||
// source: 'LockFreeLongCounterTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field counter$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field counter: long
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public synthetic final static method access$getCounter$FU$p(): java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
public final method add2(): long
|
||||
public final method get(): long
|
||||
public final method getInner(): long
|
||||
public final method increment(): long
|
||||
public final method setM2(): void
|
||||
private final inner class LockFreeLongCounter$Inner
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LockFreeLongCounterTest {
|
||||
// source: 'LockFreeLongCounterTest.kt'
|
||||
public method <init>(): void
|
||||
public final method testAdd2(): void
|
||||
public final method testBasic(): void
|
||||
public final method testGetInner(): void
|
||||
public final method testSetM2(): void
|
||||
private final method testWith(p0: kotlin.jvm.functions.Function1): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LockFreeLongCounterTestKt {
|
||||
// source: 'LockFreeLongCounterTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -4,15 +4,15 @@ import kotlin.test.*
|
||||
class LockFreeQueueTest {
|
||||
fun testBasic() {
|
||||
val q = LockFreeQueue()
|
||||
check(q.dequeue() == -1)
|
||||
assertEquals(-1, q.dequeue())
|
||||
q.enqueue(42)
|
||||
check(q.dequeue() == 42)
|
||||
check(q.dequeue() == -1)
|
||||
assertEquals(42, q.dequeue())
|
||||
assertEquals(-1, q.dequeue())
|
||||
q.enqueue(1)
|
||||
q.enqueue(2)
|
||||
check(q.dequeue() == 1)
|
||||
check(q.dequeue() == 2)
|
||||
check(q.dequeue() == -1)
|
||||
assertEquals(1, q.dequeue())
|
||||
assertEquals(2, q.dequeue())
|
||||
assertEquals(-1, q.dequeue())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
@kotlin.Metadata
|
||||
final class LockFreeQueue$Node {
|
||||
// source: 'LockFreeQueueTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field next$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field next: java.lang.Object
|
||||
private final field value: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(p0: int): void
|
||||
public final static @org.jetbrains.annotations.NotNull method getNext$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
public final @org.jetbrains.annotations.Nullable method getNext(): java.lang.Object
|
||||
public final method getValue(): int
|
||||
private final inner class LockFreeQueue$Node
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LockFreeQueue {
|
||||
// source: 'LockFreeQueueTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field head$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field head: java.lang.Object
|
||||
private final static @org.jetbrains.annotations.NotNull field tail$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field tail: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method dequeue(): int
|
||||
public final method enqueue(p0: int): void
|
||||
public final method loop$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
private final inner class LockFreeQueue$Node
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LockFreeQueueTest {
|
||||
// source: 'LockFreeQueueTest.kt'
|
||||
public method <init>(): void
|
||||
public final method testBasic(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LockFreeQueueTestKt {
|
||||
// source: 'LockFreeQueueTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -2,32 +2,31 @@ import kotlinx.atomicfu.*
|
||||
import kotlin.test.*
|
||||
|
||||
class LockFreeStackTest {
|
||||
|
||||
fun testClear() {
|
||||
val s = LockFreeStack<String>()
|
||||
check(s.isEmpty())
|
||||
assertTrue(s.isEmpty())
|
||||
s.pushLoop("A")
|
||||
check(!s.isEmpty())
|
||||
assertTrue(!s.isEmpty())
|
||||
s.clear()
|
||||
check(s.isEmpty())
|
||||
assertTrue(s.isEmpty())
|
||||
}
|
||||
|
||||
fun testPushPopLoop() {
|
||||
val s = LockFreeStack<String>()
|
||||
check(s.isEmpty())
|
||||
assertTrue(s.isEmpty())
|
||||
s.pushLoop("A")
|
||||
check(!s.isEmpty())
|
||||
check(s.popLoop() == "A")
|
||||
check(s.isEmpty())
|
||||
assertTrue(!s.isEmpty())
|
||||
assertEquals("A", s.popLoop())
|
||||
assertTrue(s.isEmpty())
|
||||
}
|
||||
|
||||
fun testPushPopUpdate() {
|
||||
val s = LockFreeStack<String>()
|
||||
check(s.isEmpty())
|
||||
assertTrue(s.isEmpty())
|
||||
s.pushUpdate("A")
|
||||
check(!s.isEmpty())
|
||||
check(s.popUpdate() == "A")
|
||||
check(s.isEmpty())
|
||||
assertTrue(!s.isEmpty())
|
||||
assertEquals("A", s.popUpdate())
|
||||
assertTrue(s.isEmpty())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
@kotlin.Metadata
|
||||
final class LockFreeStack$Node {
|
||||
// source: 'LockFreeStackTest.kt'
|
||||
private final @org.jetbrains.annotations.Nullable field next: LockFreeStack$Node
|
||||
private final field value: java.lang.Object
|
||||
public method <init>(p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: LockFreeStack$Node): void
|
||||
public final @org.jetbrains.annotations.Nullable method getNext(): LockFreeStack$Node
|
||||
public final method getValue(): java.lang.Object
|
||||
private final inner class LockFreeStack$Node
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LockFreeStack {
|
||||
// source: 'LockFreeStackTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field top$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field top: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method clear(): void
|
||||
public final @org.jetbrains.annotations.Nullable method getAndUpdate$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.Object
|
||||
public final method isEmpty(): boolean
|
||||
public final method loop$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
public final @org.jetbrains.annotations.Nullable method popLoop(): java.lang.Object
|
||||
public final @org.jetbrains.annotations.Nullable method popUpdate(): java.lang.Object
|
||||
public final method pushLoop(p0: java.lang.Object): void
|
||||
public final method pushUpdate(p0: java.lang.Object): void
|
||||
public final method update$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
private final inner class LockFreeStack$Node
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LockFreeStackTest {
|
||||
// source: 'LockFreeStackTest.kt'
|
||||
public method <init>(): void
|
||||
public final method testClear(): void
|
||||
public final method testPushPopLoop(): void
|
||||
public final method testPushPopUpdate(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LockFreeStackTestKt {
|
||||
// source: 'LockFreeStackTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
@kotlin.Metadata
|
||||
public final class LockTest {
|
||||
// source: 'LockTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field inProgressLock$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field inProgressLock: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method testLock(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LockTestKt {
|
||||
// source: 'LockTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method reflectionTest(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: java.util.Map): java.util.List
|
||||
public final static method tryAcquire$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int): boolean
|
||||
public final static method tryAcquire$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater): boolean
|
||||
}
|
||||
+98
-51
@@ -2,81 +2,128 @@ import kotlinx.atomicfu.*
|
||||
import kotlin.test.*
|
||||
|
||||
class LoopTest {
|
||||
private val a = atomic(0)
|
||||
private val r = atomic<A>(A("aaaa"))
|
||||
private val rs = atomic<String>("bbbb")
|
||||
val a = atomic(0)
|
||||
val a1 = atomic(1)
|
||||
val b = atomic(true)
|
||||
val l = atomic(5000000000)
|
||||
val r = atomic<A>(A("aaaa"))
|
||||
val rs = atomic<String>("bbbb")
|
||||
|
||||
private class A(val s: String)
|
||||
class A(val s: String)
|
||||
|
||||
private inline fun casLoop(to: Int): Int {
|
||||
a.loop { cur ->
|
||||
if (a.compareAndSet(cur, to)) return a.value
|
||||
return 777
|
||||
fun atomicfuIntLoopTest() {
|
||||
a.loop { value ->
|
||||
if (a.compareAndSet(value, 777)) {
|
||||
assertEquals(777, a.value)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun casLoopExpression(to: Int): Int = a.loop { cur ->
|
||||
if (a.compareAndSet(cur, to)) return a.value
|
||||
return 777
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.extensionLoop(to: Int): Int {
|
||||
loop { cur ->
|
||||
if (compareAndSet(cur, to)) return value
|
||||
return 777
|
||||
fun atomicfuBooleanLoopTest() {
|
||||
b.loop { value ->
|
||||
assertTrue(value)
|
||||
if (!b.value) return
|
||||
if (b.compareAndSet(value, false)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.extensionLoopExpression(to: Int): Int = loop { cur ->
|
||||
lazySet(cur + 10)
|
||||
return if (compareAndSet(cur, to)) value else incrementAndGet()
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.extensionLoopMixedReceivers(first: Int, second: Int): Int {
|
||||
loop { cur ->
|
||||
compareAndSet(cur, first)
|
||||
a.compareAndSet(first, second)
|
||||
return value
|
||||
fun atomicfuLongLoopTest() {
|
||||
l.loop { cur ->
|
||||
if (l.compareAndSet(5000000003, 9000000000)) {
|
||||
return
|
||||
} else {
|
||||
l.incrementAndGet()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun AtomicInt.extensionLoopRecursive(to: Int): Int {
|
||||
loop { cur ->
|
||||
compareAndSet(cur, to)
|
||||
a.extensionLoop(5)
|
||||
return value
|
||||
fun atomicfuRefLoopTest() {
|
||||
r.loop { cur ->
|
||||
assertEquals("aaaa", cur.s)
|
||||
if (r.compareAndSet(cur, A("bbbb"))) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun testIntExtensionLoops() {
|
||||
assertEquals(5, casLoop(5))
|
||||
assertEquals(6, casLoopExpression(6))
|
||||
assertEquals(66, a.extensionLoop(66))
|
||||
assertEquals(77, a.extensionLoopExpression(777))
|
||||
assertEquals(99, a.extensionLoopMixedReceivers(88, 99))
|
||||
assertEquals(5, a.extensionLoopRecursive(100))
|
||||
inline fun atomicfuLoopTest() {
|
||||
atomicfuIntLoopTest()
|
||||
assertEquals(777, a.value)
|
||||
atomicfuBooleanLoopTest()
|
||||
assertFalse(b.value)
|
||||
atomicfuLongLoopTest()
|
||||
assertEquals(9000000000, l.value)
|
||||
atomicfuRefLoopTest()
|
||||
assertEquals("bbbb", r.value.s)
|
||||
}
|
||||
|
||||
private inline fun AtomicRef<A>.casLoop(to: String): String = loop { cur ->
|
||||
if (compareAndSet(cur, A(to))) {
|
||||
val res = value.s
|
||||
return "${res}_AtomicRef<A>"
|
||||
fun atomicfuUpdateTest() {
|
||||
a.value = 0
|
||||
a.update { value ->
|
||||
val newValue = value + 1000
|
||||
if (newValue >= 0) Int.MAX_VALUE else newValue
|
||||
}
|
||||
assertEquals(Int.MAX_VALUE, a.value)
|
||||
b.update { true }
|
||||
assertEquals(true, b.value)
|
||||
assertTrue(b.value)
|
||||
l.value = 0L
|
||||
l.update { cur ->
|
||||
val newValue = cur + 1000
|
||||
if (newValue >= 0L) Long.MAX_VALUE else newValue
|
||||
}
|
||||
assertEquals(Long.MAX_VALUE, l.value)
|
||||
r.lazySet(A("aaaa"))
|
||||
r.update { cur ->
|
||||
A("cccc${cur.s}")
|
||||
}
|
||||
assertEquals("ccccaaaa", r.value.s)
|
||||
}
|
||||
|
||||
private inline fun AtomicRef<String>.casLoop(to: String): String = loop { cur ->
|
||||
if (compareAndSet(cur, to)) return "${value}_AtomicRef<String>"
|
||||
fun atomicfuUpdateAndGetTest() {
|
||||
val res1 = a.updateAndGet { value ->
|
||||
if (value >= 0) Int.MAX_VALUE else value
|
||||
}
|
||||
assertEquals(Int.MAX_VALUE, res1)
|
||||
assertTrue(b.updateAndGet { true })
|
||||
val res2 = l.updateAndGet { cur ->
|
||||
if (cur >= 0L) Long.MAX_VALUE else cur
|
||||
}
|
||||
assertEquals(Long.MAX_VALUE, res2)
|
||||
r.lazySet(A("aaaa"))
|
||||
val res3 = r.updateAndGet { cur ->
|
||||
A("cccc${cur.s}")
|
||||
}
|
||||
assertEquals("ccccaaaa", res3.s)
|
||||
}
|
||||
|
||||
fun testDeclarationWithEqualNames() {
|
||||
check(r.casLoop("kk") == "kk_AtomicRef<A>")
|
||||
check(rs.casLoop("pp") == "pp_AtomicRef<String>")
|
||||
fun atomicfuGetAndUpdateTest() {
|
||||
a.getAndUpdate { value ->
|
||||
if (value >= 0) Int.MAX_VALUE else value
|
||||
}
|
||||
assertEquals(Int.MAX_VALUE, a.value)
|
||||
b.getAndUpdate { true }
|
||||
assertTrue(b.value)
|
||||
l.getAndUpdate { cur ->
|
||||
if (cur >= 0L) Long.MAX_VALUE else cur
|
||||
}
|
||||
assertEquals(Long.MAX_VALUE, l.value)
|
||||
r.lazySet(A("aaaa"))
|
||||
r.getAndUpdate { cur ->
|
||||
A("cccc${cur.s}")
|
||||
}
|
||||
assertEquals("ccccaaaa", r.value.s)
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val testClass = LoopTest()
|
||||
testClass.testIntExtensionLoops()
|
||||
testClass.testDeclarationWithEqualNames()
|
||||
testClass.atomicfuLoopTest()
|
||||
testClass.atomicfuUpdateTest()
|
||||
testClass.atomicfuUpdateAndGetTest()
|
||||
testClass.atomicfuGetAndUpdateTest()
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
@kotlin.Metadata
|
||||
public final class LoopTest$A {
|
||||
// source: 'LoopTest.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field s: java.lang.String
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
|
||||
public final inner class LoopTest$A
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LoopTest {
|
||||
// source: 'LoopTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field a$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private final static @org.jetbrains.annotations.NotNull field a1$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field a1: int
|
||||
private volatile @kotlin.jvm.Volatile field a: int
|
||||
private final static @org.jetbrains.annotations.NotNull field b$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field b: int
|
||||
private final static @org.jetbrains.annotations.NotNull field l$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field l: long
|
||||
private final static @org.jetbrains.annotations.NotNull field r$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field r: java.lang.Object
|
||||
private final static @org.jetbrains.annotations.NotNull field rs$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field rs: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method atomicfuBooleanLoopTest(): void
|
||||
public final method atomicfuGetAndUpdateTest(): void
|
||||
public final method atomicfuIntLoopTest(): void
|
||||
public final method atomicfuLongLoopTest(): void
|
||||
public final method atomicfuLoopTest(): void
|
||||
public final method atomicfuRefLoopTest(): void
|
||||
public final method atomicfuUpdateAndGetTest(): void
|
||||
public final method atomicfuUpdateTest(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method getA$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getA(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getA1$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getA1(): int
|
||||
public final method getAndUpdate$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): int
|
||||
public final method getAndUpdate$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicLongFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): long
|
||||
public final @org.jetbrains.annotations.Nullable method getAndUpdate$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.Object
|
||||
public final static @org.jetbrains.annotations.NotNull method getB$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getB(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getL$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
public final method getL(): long
|
||||
public final static @org.jetbrains.annotations.NotNull method getR$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
public final @org.jetbrains.annotations.Nullable method getR(): java.lang.Object
|
||||
public final static @org.jetbrains.annotations.NotNull method getRs$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
public final @org.jetbrains.annotations.Nullable method getRs(): java.lang.Object
|
||||
public final method loop$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
public final method loop$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicLongFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
public final method loop$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
public final method update$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
public final method update$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicLongFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
public final method update$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
public final method updateAndGet$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): int
|
||||
public final method updateAndGet$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicLongFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): long
|
||||
public final @org.jetbrains.annotations.Nullable method updateAndGet$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.Object
|
||||
public final inner class LoopTest$A
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class LoopTestKt {
|
||||
// source: 'LoopTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
@kotlin.Metadata
|
||||
public final class MultiInit$Companion {
|
||||
// source: 'MultiInitTest.kt'
|
||||
private method <init>(): void
|
||||
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
|
||||
public final method foo(): void
|
||||
public final inner class MultiInit$Companion
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class MultiInit {
|
||||
// source: 'MultiInitTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull field Companion: MultiInit$Companion
|
||||
private final static @org.jetbrains.annotations.NotNull field a$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field a: int
|
||||
private final static @org.jetbrains.annotations.NotNull field b$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field b: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method incA(): int
|
||||
public final method incB(): int
|
||||
public final inner class MultiInit$Companion
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class MultiInitTest {
|
||||
// source: 'MultiInitTest.kt'
|
||||
public method <init>(): void
|
||||
public final method testBasic(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class MultiInitTestKt {
|
||||
// source: 'MultiInitTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
@kotlin.Metadata
|
||||
public final class ParameterizedInlineFunExtensionTest {
|
||||
// source: 'ParameterizedInlineFunExtensionTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field tail$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field tail: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method bar$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int, p3: java.lang.Object, p4: java.lang.Object): java.lang.Object
|
||||
public final method bar$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p2: java.lang.Object, p3: java.lang.Object): java.lang.Object
|
||||
public final method foo$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int, p3: java.lang.Object, p4: java.lang.Object, @org.jetbrains.annotations.NotNull p5: kotlin.jvm.functions.Function1): java.lang.Object
|
||||
public final method foo$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p2: java.lang.Object, p3: java.lang.Object, @org.jetbrains.annotations.NotNull p4: kotlin.jvm.functions.Function1): java.lang.Object
|
||||
public final method testClose(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ParameterizedInlineFunExtensionTestKt {
|
||||
// source: 'ParameterizedInlineFunExtensionTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
@kotlin.Metadata
|
||||
public final class PropertyDeclarationTest {
|
||||
// source: 'PropertyDeclarationTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field a$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field a: int
|
||||
private final static @org.jetbrains.annotations.NotNull field head$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field head: java.lang.Object
|
||||
private final @org.jetbrains.annotations.NotNull field lateIntArr: java.util.concurrent.atomic.AtomicIntegerArray
|
||||
private final @org.jetbrains.annotations.NotNull field lateRefArr: java.util.concurrent.atomic.AtomicReferenceArray
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method test(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class PropertyDeclarationTestKt {
|
||||
// source: 'PropertyDeclarationTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -1,20 +1,34 @@
|
||||
import kotlinx.atomicfu.locks.*
|
||||
import kotlin.test.*
|
||||
|
||||
class ReentrantLockTest {
|
||||
//class ReentrantLockTest {
|
||||
// private val lock = reentrantLock()
|
||||
// private var state = 0
|
||||
//
|
||||
// fun testLockField() {
|
||||
// lock.withLock {
|
||||
// state = 1
|
||||
// }
|
||||
// assertEquals(1, state)
|
||||
// }
|
||||
//}
|
||||
|
||||
class ReentrantLockFieldTest {
|
||||
private val lock = reentrantLock()
|
||||
private var state = 0
|
||||
|
||||
fun testLockField() {
|
||||
fun testLock() {
|
||||
lock.withLock {
|
||||
state = 1
|
||||
}
|
||||
assertEquals(1, state)
|
||||
assertTrue(lock.tryLock())
|
||||
lock.unlock()
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val testClass = ReentrantLockTest()
|
||||
testClass.testLockField()
|
||||
val testClass = ReentrantLockFieldTest()
|
||||
testClass.testLock()
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
@kotlin.Metadata
|
||||
public final class ReentrantLockFieldTest {
|
||||
// source: 'ReentrantLockTest.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field lock: java.util.concurrent.locks.ReentrantLock
|
||||
private field state: int
|
||||
public method <init>(): void
|
||||
public final method testLock(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ReentrantLockTestKt {
|
||||
// source: 'ReentrantLockTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
@kotlin.Metadata
|
||||
public final class AA {
|
||||
// source: 'ScopeTest.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field b: B
|
||||
private final @org.jetbrains.annotations.NotNull field c: C
|
||||
private final field value: int
|
||||
public method <init>(p0: int): void
|
||||
public final @org.jetbrains.annotations.NotNull method getB(): B
|
||||
public final @org.jetbrains.annotations.NotNull method getC(): C
|
||||
public final method getValue(): int
|
||||
public final method manyProperties(@org.jetbrains.annotations.NotNull p0: java.lang.Object): boolean
|
||||
public final method updateToB(@org.jetbrains.annotations.NotNull p0: java.lang.Object): boolean
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class AtomicState {
|
||||
// source: 'ScopeTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field state$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field state: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.Object): void
|
||||
public final static @org.jetbrains.annotations.NotNull method getState$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
public final @org.jetbrains.annotations.Nullable method getState(): java.lang.Object
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class B {
|
||||
// source: 'ScopeTest.kt'
|
||||
private final field value: int
|
||||
public method <init>(p0: int): void
|
||||
public final method getValue(): int
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class C {
|
||||
// source: 'ScopeTest.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field d: D
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: D): void
|
||||
public final @org.jetbrains.annotations.NotNull method getD(): D
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class D {
|
||||
// source: 'ScopeTest.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field e: E
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: E): void
|
||||
public final @org.jetbrains.annotations.NotNull method getE(): E
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class E {
|
||||
// source: 'ScopeTest.kt'
|
||||
private final field x: int
|
||||
public method <init>(p0: int): void
|
||||
public final method getX(): int
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ScopeTest {
|
||||
// source: 'ScopeTest.kt'
|
||||
public method <init>(): void
|
||||
public final method scopeTest(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ScopeTestKt {
|
||||
// source: 'ScopeTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
@kotlin.Metadata
|
||||
public final class SimpleLock {
|
||||
// source: 'SimpleLockTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field _locked$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field _locked: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method loop$atomicfu(@org.jetbrains.annotations.NotNull p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.Nullable p2: java.lang.Object): void
|
||||
public final method withLock(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
final class SimpleLockTest$withLock$result$1 {
|
||||
// source: 'SimpleLockTest.kt'
|
||||
enclosing method SimpleLockTest.withLock()V
|
||||
public final static field INSTANCE: SimpleLockTest$withLock$result$1
|
||||
inner (anonymous) class SimpleLockTest$withLock$result$1
|
||||
static method <clinit>(): void
|
||||
method <init>(): void
|
||||
public synthetic bridge method invoke(): java.lang.Object
|
||||
public final @org.jetbrains.annotations.NotNull method invoke(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class SimpleLockTest {
|
||||
// source: 'SimpleLockTest.kt'
|
||||
inner (anonymous) class SimpleLockTest$withLock$result$1
|
||||
public method <init>(): void
|
||||
public final method withLock(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class SimpleLockTestKt {
|
||||
// source: 'SimpleLockTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
@kotlin.Metadata
|
||||
public final class SynchronizedObjectTest {
|
||||
// source: 'SynchronizedObjectTest.kt'
|
||||
public method <init>(): void
|
||||
private final method bar(): java.lang.String
|
||||
public final method testSync(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class SynchronizedObjectTestKt {
|
||||
// source: 'SynchronizedObjectTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
+80
-81
@@ -18,126 +18,125 @@ private val stringAtomicNullArr = atomicArrayOfNulls<String>(10)
|
||||
class TopLevelPrimitiveTest {
|
||||
|
||||
fun testTopLevelInt() {
|
||||
a.value
|
||||
check(a.value == 0)
|
||||
check(a.getAndSet(3) == 0)
|
||||
check(a.compareAndSet(3, 8))
|
||||
assertEquals(0, a.value)
|
||||
assertEquals(0, a.getAndSet(3))
|
||||
assertTrue(a.compareAndSet(3, 8))
|
||||
a.lazySet(1)
|
||||
check(a.value == 1)
|
||||
check(a.getAndSet(2) == 1)
|
||||
check(a.value == 2)
|
||||
check(a.getAndIncrement() == 2)
|
||||
check(a.value == 3)
|
||||
check(a.getAndDecrement() == 3)
|
||||
check(a.value == 2)
|
||||
check(a.getAndAdd(2) == 2)
|
||||
check(a.value == 4)
|
||||
check(a.addAndGet(3) == 7)
|
||||
check(a.value == 7)
|
||||
check(a.incrementAndGet() == 8)
|
||||
check(a.value == 8)
|
||||
check(a.decrementAndGet() == 7)
|
||||
check(a.value == 7)
|
||||
a.compareAndSet(7, 10)
|
||||
assertEquals(1, a.value)
|
||||
assertEquals(1, a.getAndSet(2))
|
||||
assertEquals(2, a.value)
|
||||
assertEquals(2, a.getAndIncrement())
|
||||
assertEquals(3, a.value)
|
||||
assertEquals(3, a.getAndDecrement())
|
||||
assertEquals(2, a.value)
|
||||
assertEquals(2, a.getAndAdd(2))
|
||||
assertEquals(4, a.value)
|
||||
assertEquals(7, a.addAndGet(3))
|
||||
assertEquals(7, a.value)
|
||||
assertEquals(8, a.incrementAndGet())
|
||||
assertEquals(8, a.value)
|
||||
assertEquals(7, a.decrementAndGet())
|
||||
assertEquals(7, a.value)
|
||||
assertTrue(a.compareAndSet(7, 10))
|
||||
}
|
||||
|
||||
fun testTopLevelLong() {
|
||||
check(b.value == 2424920024888888848)
|
||||
assertEquals(2424920024888888848, b.value)
|
||||
b.lazySet(8424920024888888848)
|
||||
check(b.value == 8424920024888888848)
|
||||
check(b.getAndSet(8924920024888888848) == 8424920024888888848)
|
||||
check(b.value == 8924920024888888848)
|
||||
check(b.incrementAndGet() == 8924920024888888849)
|
||||
check(b.value == 8924920024888888849)
|
||||
check(b.getAndDecrement() == 8924920024888888849)
|
||||
check(b.value == 8924920024888888848)
|
||||
check(b.getAndAdd(100000000000000000) == 8924920024888888848)
|
||||
check(b.value == 9024920024888888848)
|
||||
check(b.addAndGet(-9223372036854775807) == -198452011965886959)
|
||||
check(b.value == -198452011965886959)
|
||||
check(b.incrementAndGet() == -198452011965886958)
|
||||
check(b.value == -198452011965886958)
|
||||
check(b.decrementAndGet() == -198452011965886959)
|
||||
check(b.value == -198452011965886959)
|
||||
assertEquals(8424920024888888848, b.value)
|
||||
assertEquals(8424920024888888848, b.getAndSet(8924920024888888848))
|
||||
assertEquals(8924920024888888848, b.value)
|
||||
assertEquals(8924920024888888849, b.incrementAndGet())
|
||||
assertEquals(8924920024888888849, b.value)
|
||||
assertEquals(8924920024888888849, b.getAndDecrement())
|
||||
assertEquals(8924920024888888848, b.value)
|
||||
assertEquals(8924920024888888848, b.getAndAdd(100000000000000000))
|
||||
assertEquals(9024920024888888848, b.value)
|
||||
assertEquals(-198452011965886959, b.addAndGet(-9223372036854775807))
|
||||
assertEquals(-198452011965886959, b.value)
|
||||
assertEquals(-198452011965886958, b.incrementAndGet())
|
||||
assertEquals(-198452011965886958, b.value)
|
||||
assertEquals(-198452011965886959, b.decrementAndGet())
|
||||
assertEquals(-198452011965886959, b.value)
|
||||
}
|
||||
|
||||
fun testTopLevelBoolean() {
|
||||
check(c.value)
|
||||
assertTrue(c.value)
|
||||
c.lazySet(false)
|
||||
check(!c.value)
|
||||
check(!c.getAndSet(true))
|
||||
check(c.compareAndSet(true, false))
|
||||
check(!c.value)
|
||||
assertFalse(c.value)
|
||||
assertTrue(!c.getAndSet(true))
|
||||
assertTrue(c.compareAndSet(true, false))
|
||||
assertFalse(c.value)
|
||||
}
|
||||
|
||||
fun testTopLevelRef() {
|
||||
check(abcNode.value.b.c.d == 8)
|
||||
assertEquals(8, abcNode.value.b.c.d)
|
||||
val newNode = ANode(BNode(CNode(76)))
|
||||
check(abcNode.getAndSet(newNode).b.c.d == 8)
|
||||
check(abcNode.value.b.c.d == 76)
|
||||
assertEquals(8, abcNode.getAndSet(newNode).b.c.d)
|
||||
assertEquals(76, abcNode.value.b.c.d)
|
||||
val l = IntArray(4){i -> i}
|
||||
any.lazySet(l)
|
||||
check((any.value as IntArray)[2] == 2)
|
||||
assertEquals(2, (any.value as IntArray)[2])
|
||||
}
|
||||
|
||||
fun testTopLevelArrayOfNulls() {
|
||||
check(stringAtomicNullArr[0].value == null)
|
||||
check(stringAtomicNullArr[0].compareAndSet(null, "aa"))
|
||||
assertEquals(null, stringAtomicNullArr[0].value)
|
||||
assertTrue(stringAtomicNullArr[0].compareAndSet(null, "aa"))
|
||||
stringAtomicNullArr[1].lazySet("aa")
|
||||
check(stringAtomicNullArr[0].value == stringAtomicNullArr[1].value)
|
||||
assertTrue(stringAtomicNullArr[0].value == stringAtomicNullArr[1].value)
|
||||
}
|
||||
}
|
||||
|
||||
class TopLevelArrayTest {
|
||||
|
||||
fun testIntArray() {
|
||||
check(intArr[0].compareAndSet(0, 3))
|
||||
check(intArr[1].value == 0)
|
||||
assertTrue(intArr[0].compareAndSet(0, 3))
|
||||
assertEquals(0, intArr[1].value)
|
||||
intArr[0].lazySet(5)
|
||||
check(intArr[0].value + intArr[1].value + intArr[2].value == 5)
|
||||
check(intArr[0].compareAndSet(5, 10))
|
||||
check(intArr[0].getAndDecrement() == 10)
|
||||
check(intArr[0].value == 9)
|
||||
assertEquals(5, intArr[0].value + intArr[1].value + intArr[2].value)
|
||||
assertTrue(intArr[0].compareAndSet(5, 10))
|
||||
assertEquals(10, intArr[0].getAndDecrement())
|
||||
assertEquals(9, intArr[0].value)
|
||||
intArr[2].value = 2
|
||||
check(intArr[2].value == 2)
|
||||
check(intArr[2].compareAndSet(2, 34))
|
||||
check(intArr[2].value == 34)
|
||||
assertEquals(2, intArr[2].value)
|
||||
assertTrue(intArr[2].compareAndSet(2, 34))
|
||||
assertEquals(34, intArr[2].value)
|
||||
}
|
||||
|
||||
fun testLongArray() {
|
||||
longArr[0].value = 2424920024888888848
|
||||
check(longArr[0].value == 2424920024888888848)
|
||||
assertEquals(2424920024888888848, longArr[0].value)
|
||||
longArr[0].lazySet(8424920024888888848)
|
||||
check(longArr[0].value == 8424920024888888848)
|
||||
assertEquals(8424920024888888848, longArr[0].value)
|
||||
val ac = longArr[0].value
|
||||
longArr[3].value = ac
|
||||
check(longArr[3].getAndSet(8924920024888888848) == 8424920024888888848)
|
||||
check(longArr[3].value == 8924920024888888848)
|
||||
assertEquals(8424920024888888848, longArr[3].getAndSet(8924920024888888848))
|
||||
assertEquals(8924920024888888848, longArr[3].value)
|
||||
val ac1 = longArr[3].value
|
||||
longArr[4].value = ac1
|
||||
check(longArr[4].incrementAndGet() == 8924920024888888849)
|
||||
check(longArr[4].value == 8924920024888888849)
|
||||
check(longArr[4].getAndDecrement() == 8924920024888888849)
|
||||
check(longArr[4].value == 8924920024888888848)
|
||||
assertEquals(8924920024888888849, longArr[4].incrementAndGet())
|
||||
assertEquals(8924920024888888849, longArr[4].value)
|
||||
assertEquals(8924920024888888849, longArr[4].getAndDecrement())
|
||||
assertEquals(8924920024888888848, longArr[4].value)
|
||||
longArr[4].value = 8924920024888888848
|
||||
check(longArr[4].getAndAdd(100000000000000000) == 8924920024888888848)
|
||||
assertEquals(8924920024888888848, longArr[4].getAndAdd(100000000000000000))
|
||||
val ac2 = longArr[4].value
|
||||
longArr[1].value = ac2
|
||||
check(longArr[1].value == 9024920024888888848)
|
||||
check(longArr[1].addAndGet(-9223372036854775807) == -198452011965886959)
|
||||
check(longArr[1].value == -198452011965886959)
|
||||
check(longArr[1].incrementAndGet() == -198452011965886958)
|
||||
check(longArr[1].value == -198452011965886958)
|
||||
check(longArr[1].decrementAndGet() == -198452011965886959)
|
||||
check(longArr[1].value == -198452011965886959)
|
||||
assertEquals(9024920024888888848, longArr[1].value)
|
||||
assertEquals(-198452011965886959, longArr[1].addAndGet(-9223372036854775807))
|
||||
assertEquals(-198452011965886959, longArr[1].value)
|
||||
assertEquals(-198452011965886958, longArr[1].incrementAndGet())
|
||||
assertEquals(-198452011965886958, longArr[1].value)
|
||||
assertEquals(-198452011965886959, longArr[1].decrementAndGet())
|
||||
assertEquals(-198452011965886959, longArr[1].value)
|
||||
}
|
||||
|
||||
fun testBooleanArray() {
|
||||
check(!booleanArr[1].value)
|
||||
assertFalse(booleanArr[1].value)
|
||||
booleanArr[1].compareAndSet(false, true)
|
||||
booleanArr[0].lazySet(true)
|
||||
check(!booleanArr[2].getAndSet(true))
|
||||
check(booleanArr[0].value && booleanArr[1].value && booleanArr[2].value)
|
||||
assertFalse(booleanArr[2].getAndSet(true))
|
||||
assertTrue(booleanArr[0].value && booleanArr[1].value && booleanArr[2].value)
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@@ -145,14 +144,14 @@ class TopLevelArrayTest {
|
||||
val a2 = ANode(BNode(CNode(2)))
|
||||
val a3 = ANode(BNode(CNode(3)))
|
||||
refArr[0].value = a2
|
||||
check(refArr[0].value!!.b.c.d == 2)
|
||||
check(refArr[0].compareAndSet(a2, a3))
|
||||
check(refArr[0].value!!.b.c.d == 3)
|
||||
assertEquals(2, refArr[0].value!!.b.c.d)
|
||||
assertTrue(refArr[0].compareAndSet(a2, a3))
|
||||
assertEquals(3, refArr[0].value!!.b.c.d)
|
||||
val r0 = refArr[0].value
|
||||
refArr[3].value = r0
|
||||
check(refArr[3].value!!.b.c.d == 3)
|
||||
assertEquals(3, refArr[3].value!!.b.c.d)
|
||||
val a = abcNode.value
|
||||
check(refArr[3].compareAndSet(a3, a))
|
||||
assertTrue(refArr[3].compareAndSet(a3, a))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
@kotlin.Metadata
|
||||
public final class A$TopLevelTest$VolatileWrapper {
|
||||
// source: 'TopLevelTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field a$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field a: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public synthetic final static method access$getA$FU$p(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ANode {
|
||||
// source: 'TopLevelTest.kt'
|
||||
private final field b: java.lang.Object
|
||||
public method <init>(p0: java.lang.Object): void
|
||||
public final method component1(): java.lang.Object
|
||||
public synthetic static method copy$default(p0: ANode, p1: java.lang.Object, p2: int, p3: java.lang.Object): ANode
|
||||
public final @org.jetbrains.annotations.NotNull method copy(p0: java.lang.Object): ANode
|
||||
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
|
||||
public final method getB(): java.lang.Object
|
||||
public method hashCode(): int
|
||||
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class AbcNode$TopLevelTest$VolatileWrapper {
|
||||
// source: 'TopLevelTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field abcNode$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field abcNode: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public synthetic final static method access$getAbcNode$FU$p(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Any$TopLevelTest$VolatileWrapper {
|
||||
// source: 'TopLevelTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field any$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field any: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public synthetic final static method access$getAny$FU$p(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class B$TopLevelTest$VolatileWrapper {
|
||||
// source: 'TopLevelTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field b$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field b: long
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public synthetic final static method access$getB$FU$p(): java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class BNode {
|
||||
// source: 'TopLevelTest.kt'
|
||||
private final field c: java.lang.Object
|
||||
public method <init>(p0: java.lang.Object): void
|
||||
public final method component1(): java.lang.Object
|
||||
public synthetic static method copy$default(p0: BNode, p1: java.lang.Object, p2: int, p3: java.lang.Object): BNode
|
||||
public final @org.jetbrains.annotations.NotNull method copy(p0: java.lang.Object): BNode
|
||||
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
|
||||
public final method getC(): java.lang.Object
|
||||
public method hashCode(): int
|
||||
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class C$TopLevelTest$VolatileWrapper {
|
||||
// source: 'TopLevelTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field c$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field c: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public synthetic final static method access$getC$FU$p(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class CNode {
|
||||
// source: 'TopLevelTest.kt'
|
||||
private final field d: int
|
||||
public method <init>(p0: int): void
|
||||
public final method component1(): int
|
||||
public synthetic static method copy$default(p0: CNode, p1: int, p2: int, p3: java.lang.Object): CNode
|
||||
public final @org.jetbrains.annotations.NotNull method copy(p0: int): CNode
|
||||
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
|
||||
public final method getD(): int
|
||||
public method hashCode(): int
|
||||
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class TopLevelArrayTest {
|
||||
// source: 'TopLevelTest.kt'
|
||||
public method <init>(): void
|
||||
public final method testBooleanArray(): void
|
||||
public final method testIntArray(): void
|
||||
public final method testLongArray(): void
|
||||
public final method testRefArray(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class TopLevelPrimitiveTest {
|
||||
// source: 'TopLevelTest.kt'
|
||||
public method <init>(): void
|
||||
public final method testTopLevelArrayOfNulls(): void
|
||||
public final method testTopLevelBoolean(): void
|
||||
public final method testTopLevelInt(): void
|
||||
public final method testTopLevelLong(): void
|
||||
public final method testTopLevelRef(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class TopLevelTestKt {
|
||||
// source: 'TopLevelTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull field a$TopLevelTest$VolatileWrapper: A$TopLevelTest$VolatileWrapper
|
||||
public final static @org.jetbrains.annotations.NotNull field abcNode$TopLevelTest$VolatileWrapper: AbcNode$TopLevelTest$VolatileWrapper
|
||||
public final static @org.jetbrains.annotations.NotNull field any$TopLevelTest$VolatileWrapper: Any$TopLevelTest$VolatileWrapper
|
||||
private final static @org.jetbrains.annotations.NotNull field anyRefArr: java.util.concurrent.atomic.AtomicReferenceArray
|
||||
public final static @org.jetbrains.annotations.NotNull field b$TopLevelTest$VolatileWrapper: B$TopLevelTest$VolatileWrapper
|
||||
private final static @org.jetbrains.annotations.NotNull field booleanArr: java.util.concurrent.atomic.AtomicIntegerArray
|
||||
public final static @org.jetbrains.annotations.NotNull field c$TopLevelTest$VolatileWrapper: C$TopLevelTest$VolatileWrapper
|
||||
private final static @org.jetbrains.annotations.NotNull field intArr: java.util.concurrent.atomic.AtomicIntegerArray
|
||||
private final static @org.jetbrains.annotations.NotNull field longArr: java.util.concurrent.atomic.AtomicLongArray
|
||||
private final static @org.jetbrains.annotations.NotNull field refArr: java.util.concurrent.atomic.AtomicReferenceArray
|
||||
private final static @org.jetbrains.annotations.NotNull field stringAtomicNullArr: java.util.concurrent.atomic.AtomicReferenceArray
|
||||
static method <clinit>(): void
|
||||
public synthetic final static method access$getBooleanArr$p(): java.util.concurrent.atomic.AtomicIntegerArray
|
||||
public synthetic final static method access$getIntArr$p(): java.util.concurrent.atomic.AtomicIntegerArray
|
||||
public synthetic final static method access$getLongArr$p(): java.util.concurrent.atomic.AtomicLongArray
|
||||
public synthetic final static method access$getRefArr$p(): java.util.concurrent.atomic.AtomicReferenceArray
|
||||
public synthetic final static method access$getStringAtomicNullArr$p(): java.util.concurrent.atomic.AtomicReferenceArray
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
@kotlin.Metadata
|
||||
final enum class TraceTest$Status {
|
||||
// source: 'TraceTest.kt'
|
||||
private synthetic final static field $VALUES: TraceTest$Status[]
|
||||
public final enum static field END: TraceTest$Status
|
||||
public final enum static field START: TraceTest$Status
|
||||
private synthetic final static method $values(): TraceTest$Status[]
|
||||
static method <clinit>(): void
|
||||
private method <init>(p0: java.lang.String, p1: int): void
|
||||
public static method valueOf(p0: java.lang.String): TraceTest$Status
|
||||
public static method values(): TraceTest$Status[]
|
||||
private final inner class TraceTest$Status
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class TraceTest {
|
||||
// source: 'TraceTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field a$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private final static @org.jetbrains.annotations.NotNull field a1$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field a1: int
|
||||
private final static @org.jetbrains.annotations.NotNull field a2$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field a2: int
|
||||
private final static @org.jetbrains.annotations.NotNull field a3$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field a3: int
|
||||
private volatile @kotlin.jvm.Volatile field a: int
|
||||
private final static @org.jetbrains.annotations.NotNull field s$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field s: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final method test(): void
|
||||
public final method testDefaultTrace(): void
|
||||
public final method testMultipleAppend(): void
|
||||
public final method testNamedTrace(): void
|
||||
public final method testTraceInBlock(): void
|
||||
public final method testTraceWithFormat(): void
|
||||
public final method testTraceWithSize(): void
|
||||
private final inner class TraceTest$Status
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class TraceTestKt {
|
||||
// source: 'TraceTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
@@ -45,10 +45,10 @@ class UncheckedCastTest {
|
||||
|
||||
fun box(): String {
|
||||
val testClass = UncheckedCastTest()
|
||||
testClass.testAtomicValUncheckedCast()
|
||||
testClass.testTopLevelValUnchekedCast()
|
||||
testClass.testArrayValueUncheckedCast()
|
||||
testClass.testArrayValueUncheckedCastInlineFunc()
|
||||
testClass.testAtomicValUncheckedCast()
|
||||
testClass.testInlineFunc()
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
@kotlin.Metadata
|
||||
public final class TopLevelS$UncheckedCastTest$VolatileWrapper {
|
||||
// source: 'UncheckedCastTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field topLevelS$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field topLevelS: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public synthetic final static method access$getTopLevelS$FU$p(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
final class UncheckedCastTest$Box {
|
||||
// source: 'UncheckedCastTest.kt'
|
||||
private final field b: int
|
||||
public method <init>(p0: int): void
|
||||
public final method component1(): int
|
||||
public synthetic static method copy$default(p0: UncheckedCastTest$Box, p1: int, p2: int, p3: java.lang.Object): UncheckedCastTest$Box
|
||||
public final @org.jetbrains.annotations.NotNull method copy(p0: int): UncheckedCastTest$Box
|
||||
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
|
||||
public final method getB(): int
|
||||
public method hashCode(): int
|
||||
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
|
||||
private final inner class UncheckedCastTest$Box
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class UncheckedCastTest {
|
||||
// source: 'UncheckedCastTest.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field a: java.util.concurrent.atomic.AtomicReferenceArray
|
||||
private final static @org.jetbrains.annotations.NotNull field bs$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field bs: java.lang.Object
|
||||
private final static @org.jetbrains.annotations.NotNull field s$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field s: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getString$atomicfu$array(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getString$atomicfu(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater): java.lang.String
|
||||
public final method testArrayValueUncheckedCast(): void
|
||||
public final method testArrayValueUncheckedCastInlineFunc(): void
|
||||
public final method testAtomicValUncheckedCast(): void
|
||||
public final method testInlineFunc(): void
|
||||
public final method testTopLevelValUnchekedCast(): void
|
||||
private final inner class UncheckedCastTest$Box
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class UncheckedCastTestKt {
|
||||
// source: 'UncheckedCastTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull field topLevelS$UncheckedCastTest$VolatileWrapper: TopLevelS$UncheckedCastTest$VolatileWrapper
|
||||
static method <clinit>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
Reference in New Issue
Block a user