[atomicfu-JVM] Preparation for commonization of JVM and K/N transformers

The following updates in the JVM/IR plugin were made:
* Lots of refactoring with preparation for K/N support: commonization of transformations.
* Improved error handling (checks for visibility constraints, appending message about usage constraints in case of an error).
* Explicit requirements for the visibility of atomic properties: to prevent leaking they should be private/internal or be members of private/internal classes.
* Fixed visibility of generated properties: volatile properties are always private and atomic updaters have the same visibility as the original atomic property.
* Volatile fields are generated from scratch and original atomic properties are removed.
* Delegated properties support is fixed (only declaration in the same scope is allowed).
* Non-inline atomic extensions are forbidden.
* For top-level atomics: only one wrapper class per file (with corresponding visibility) is generated.
* Bug fixes.

The corresponding tickets: 
https://github.com/Kotlin/kotlinx-atomicfu/issues/322
KT-60528



Merge-request: KT-MR-10579
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
This commit is contained in:
mvicsokolova
2023-07-20 13:59:23 +00:00
committed by Space Team
parent 6ca95dc338
commit 5c5367d377
92 changed files with 3480 additions and 2575 deletions
@@ -139,6 +139,17 @@ inline fun IrProperty.addGetter(builder: IrFunctionBuilder.() -> Unit = {}): IrS
} }
} }
inline fun IrProperty.addSetter(builder: IrFunctionBuilder.() -> Unit = {}): IrSimpleFunction =
IrFunctionBuilder().run {
name = Name.special("<set-${this@addSetter.name}>")
builder()
factory.buildFunction(this).also { setter ->
this@addSetter.setter = setter
setter.correspondingPropertySymbol = this@addSetter.symbol
setter.parent = this@addSetter.parent
}
}
fun IrProperty.addDefaultGetter(parentClass: IrClass, builtIns: IrBuiltIns) { fun IrProperty.addDefaultGetter(parentClass: IrClass, builtIns: IrBuiltIns) {
val field = backingField!! val field = backingField!!
addGetter { addGetter {
+1 -1
View File
@@ -138,4 +138,4 @@ kotlin.build.internal.gradle.setup=true
# ===================== # =====================
# Enable new dependency resolution | KT-58319 # Enable new dependency resolution | KT-58319
kotlin.mpp.import.enableKgpDependencyResolution=true kotlin.mpp.import.enableKgpDependencyResolution=true
@@ -0,0 +1,101 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlinx.atomicfu.compiler.backend.common
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.ir.IrBuiltIns
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
import org.jetbrains.kotlin.ir.builders.declarations.addConstructor
import org.jetbrains.kotlin.ir.builders.declarations.buildClass
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.IrExternalPackageFragmentImpl
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection
import org.jetbrains.kotlin.ir.util.createImplicitParameterDeclarationWithWrappedDescriptor
import org.jetbrains.kotlin.ir.util.getSimpleFunction
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.Variance
abstract class AbstractAtomicSymbols(
val context: IrPluginContext,
private val moduleFragment: IrModuleFragment
) {
val irBuiltIns: IrBuiltIns = context.irBuiltIns
protected val irFactory: IrFactory = IrFactoryImpl
abstract val volatileAnnotationClass: IrClass
val volatileAnnotationConstructorCall: IrConstructorCall
get() {
val volatileAnnotationConstructor = buildAnnotationConstructor(volatileAnnotationClass)
return IrConstructorCallImpl.fromSymbolOwner(volatileAnnotationConstructor.returnType, volatileAnnotationConstructor.symbol)
}
abstract fun createBuilder(
symbol: IrSymbol,
startOffset: Int = UNDEFINED_OFFSET,
endOffset: Int = UNDEFINED_OFFSET
): AbstractAtomicfuIrBuilder
val invoke1Symbol = irBuiltIns.functionN(1).getSimpleFunction("invoke")!!
fun function1Type(argType: IrType, returnType: IrType) = buildSimpleType(
irBuiltIns.functionN(1).symbol,
listOf(argType, returnType)
)
object ATOMICFU_GENERATED_CLASS : IrDeclarationOriginImpl("ATOMICFU_GENERATED_CLASS", isSynthetic = true)
object ATOMICFU_GENERATED_FUNCTION : IrDeclarationOriginImpl("ATOMICFU_GENERATED_FUNCTION", isSynthetic = true)
object ATOMICFU_GENERATED_FIELD : IrDeclarationOriginImpl("ATOMICFU_GENERATED_FIELD", isSynthetic = true)
object ATOMICFU_GENERATED_PROPERTY : IrDeclarationOriginImpl("ATOMICFU_GENERATED_PROPERTY", isSynthetic = true)
object ATOMICFU_GENERATED_PROPERTY_ACCESSOR : IrDeclarationOriginImpl("ATOMICFU_GENERATED_PROPERTY_ACCESSOR", isSynthetic = true)
protected fun createPackage(packageName: String): IrPackageFragment =
IrExternalPackageFragmentImpl.createEmptyExternalPackageFragment(
moduleFragment.descriptor,
FqName(packageName)
)
protected fun createClass(
irPackage: IrPackageFragment,
shortName: String,
classKind: ClassKind,
classModality: Modality,
isValueClass: Boolean = false,
): IrClassSymbol = irFactory.buildClass {
name = Name.identifier(shortName)
kind = classKind
modality = classModality
isValue = isValueClass
}.apply {
parent = irPackage
createImplicitParameterDeclarationWithWrappedDescriptor()
}.symbol
private fun buildAnnotationConstructor(annotationClass: IrClass): IrConstructor =
annotationClass.addConstructor { isPrimary = true }
private fun buildSimpleType(
symbol: IrClassifierSymbol,
typeParameters: List<IrType>
): IrSimpleType =
IrSimpleTypeImpl(
classifier = symbol,
hasQuestionMark = false,
arguments = typeParameters.map { makeTypeProjection(it, Variance.INVARIANT) },
annotations = emptyList()
)
}
@@ -0,0 +1,225 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlinx.atomicfu.compiler.backend.common
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.ir.IrBuiltIns
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
import org.jetbrains.kotlin.ir.builders.*
import org.jetbrains.kotlin.ir.builders.declarations.*
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.*
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.util.capitalizeDecapitalize.decapitalizeAsciiOnly
abstract class AbstractAtomicfuIrBuilder(
private val irBuiltIns: IrBuiltIns,
symbol: IrSymbol,
startOffset: Int,
endOffset: Int
) : IrBuilderWithScope(IrGeneratorContextBase(irBuiltIns), Scope(symbol), startOffset, endOffset) {
abstract val atomicSymbols: AbstractAtomicSymbols
fun irGetProperty(property: IrProperty, dispatchReceiver: IrExpression?) =
irCall(property.getter?.symbol ?: error("Getter is not defined for the property ${property.render()}")).apply {
this.dispatchReceiver = dispatchReceiver?.deepCopyWithSymbols()
}
fun irCallWithArgs(symbol: IrSimpleFunctionSymbol, dispatchReceiver: IrExpression?, extensionReceiver: IrExpression?, valueArguments: List<IrExpression?>) =
irCall(symbol).apply {
this.dispatchReceiver = dispatchReceiver
this.extensionReceiver = extensionReceiver
valueArguments.forEachIndexed { i, arg ->
putValueArgument(i, arg)
}
}
fun irVolatileField(
name: String,
type: IrType,
initValue: IrExpression?,
annotations: List<IrConstructorCall>,
parentContainer: IrDeclarationContainer
): IrField =
context.irFactory.buildField {
this.name = Name.identifier(name)
this.type = type
isFinal = false
isStatic = parentContainer is IrFile
visibility = DescriptorVisibilities.PRIVATE
origin = AbstractAtomicSymbols.ATOMICFU_GENERATED_FIELD
}.apply {
initializer = initValue?.let { IrExpressionBodyImpl(it) }
this.annotations = annotations + atomicSymbols.volatileAnnotationConstructorCall
this.parent = parentContainer
}
fun buildClassInstance(
irClass: IrClass,
parentContainer: IrDeclarationContainer,
isStatic: Boolean
): IrField =
context.irFactory.buildField {
this.name = Name.identifier(irClass.name.asString().decapitalizeAsciiOnly())
type = irClass.defaultType
isFinal = true
this.isStatic = isStatic
this.visibility = DescriptorVisibilities.PRIVATE
origin = AbstractAtomicSymbols.ATOMICFU_GENERATED_FIELD
}.apply {
initializer = IrExpressionBodyImpl(
IrConstructorCallImpl.fromSymbolOwner(
irClass.defaultType,
irClass.primaryConstructor!!.symbol
)
)
this.parent = parentContainer
}
fun IrExpression.toBoolean() = irNotEquals(this, irInt(0)) as IrCall
fun irClassWithPrivateConstructor(
name: String,
visibility: DescriptorVisibility,
parentContainer: IrDeclarationContainer
): IrClass = context.irFactory.buildClass {
this.name = Name.identifier(name)
kind = ClassKind.CLASS
origin = AbstractAtomicSymbols.ATOMICFU_GENERATED_CLASS
}.apply {
val irClass = this
this.parent = parentContainer
parentContainer.addChild(irClass)
thisReceiver = buildValueParameter(irClass) {
this.name = Name.identifier("\$this")
type = IrSimpleTypeImpl(irClass.symbol, false, emptyList(), emptyList())
}
irClass.visibility = visibility
addConstructor {
isPrimary = true
}.apply {
body = atomicSymbols.createBuilder(symbol).irBlockBody(startOffset, endOffset) {
+irDelegatingConstructorCall(context.irBuiltIns.anyClass.owner.constructors.single())
+IrInstanceInitializerCallImpl(startOffset, endOffset, irClass.symbol, context.irBuiltIns.unitType)
}
this.visibility = DescriptorVisibilities.PRIVATE // constructor of the wrapper class should be private
}
}
fun IrDeclarationContainer.replacePropertyAtIndex(
field: IrField,
visibility: DescriptorVisibility,
isVar: Boolean,
isStatic: Boolean,
index: Int
): IrProperty = buildPropertyWithAccessors(field, visibility, isVar, isStatic, this).also { declarations[index] = it }
fun IrDeclarationContainer.addProperty(
field: IrField,
visibility: DescriptorVisibility,
isVar: Boolean,
isStatic: Boolean
): IrProperty = buildPropertyWithAccessors(field, visibility, isVar, isStatic, this).also { declarations.add(it) }
private fun buildPropertyWithAccessors(
field: IrField,
visibility: DescriptorVisibility,
isVar: Boolean,
isStatic: Boolean,
parentContainer: IrDeclarationContainer
) = context.irFactory.buildProperty {
this.name = field.name
this.visibility = visibility
this.isVar = isVar
origin = AbstractAtomicSymbols.ATOMICFU_GENERATED_PROPERTY
}.apply {
backingField = field
field.correspondingPropertySymbol = this.symbol
parent = parentContainer
addGetter(isStatic, parentContainer, irBuiltIns)
if (isVar) {
addSetter(isStatic, parentContainer, irBuiltIns)
}
}
private fun IrProperty.addGetter(isStatic: Boolean, parentContainer: IrDeclarationContainer, irBuiltIns: IrBuiltIns) {
val property = this
val field = requireNotNull(backingField) { "BackingField of the property $property should not be null"}
addGetter {
visibility = property.visibility
returnType = field.type
origin = AbstractAtomicSymbols.ATOMICFU_GENERATED_PROPERTY_ACCESSOR
}.apply {
dispatchReceiverParameter = if (isStatic) null else (parentContainer as? IrClass)?.thisReceiver?.deepCopyWithSymbols(this)
body = factory.createBlockBody(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, listOf(
IrReturnImpl(
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
irBuiltIns.nothingType,
symbol,
IrGetFieldImpl(
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
field.symbol,
field.type,
dispatchReceiverParameter?.let {
IrGetValueImpl(
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
it.type,
it.symbol
)
}
)
)
)
)
}
}
private fun IrProperty.addSetter(isStatic: Boolean, parentClass: IrDeclarationContainer, irBuiltIns: IrBuiltIns) {
val property = this
val field = requireNotNull(property.backingField) { "BackingField of the property $property should not be null"}
this@addSetter.addSetter {
visibility = property.visibility
returnType = irBuiltIns.unitType
origin = AbstractAtomicSymbols.ATOMICFU_GENERATED_PROPERTY_ACCESSOR
}.apply {
dispatchReceiverParameter = if (isStatic) null else (parentClass as? IrClass)?.thisReceiver?.deepCopyWithSymbols(this)
addValueParameter("value", field.type)
val value = IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, valueParameters[0].type, valueParameters[0].symbol)
body = factory.createBlockBody(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, listOf(
IrReturnImpl(
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
irBuiltIns.unitType,
symbol,
IrSetFieldImpl(
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
field.symbol,
dispatchReceiverParameter?.let {
IrGetValueImpl(
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
it.type,
it.symbol
)
},
value,
irBuiltIns.unitType
)
)
)
)
}
}
}
@@ -0,0 +1,736 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlinx.atomicfu.compiler.backend.common
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.backend.common.lower.parents
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.IrStatement
import org.jetbrains.kotlin.ir.builders.irExprBody
import org.jetbrains.kotlin.ir.builders.irGetField
import org.jetbrains.kotlin.ir.builders.irSetField
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrTypeOperatorCallImpl
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.ir.visitors.*
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
private const val ATOMICFU = "atomicfu"
private const val ARRAY = "array"
private const val AFU_PKG = "kotlinx.atomicfu"
private const val TRACE_BASE_TYPE = "TraceBase"
private const val ATOMIC_VALUE_FACTORY = "atomic"
private const val INVOKE = "invoke"
private const val APPEND = "append"
private const val GET = "get"
private const val VOLATILE = "\$volatile"
private const val VOLATILE_WRAPPER_SUFFIX = "\$VolatileWrapper\$$ATOMICFU"
abstract class AbstractAtomicfuTransformer(val pluginContext: IrPluginContext) {
companion object {
const val CONSTRAINTS_MESSAGE =
"\n\nPlease make sure that you follow these constraints for using atomic properties:\n" +
" * To ensure that atomic properties are not accessed out of the current Kotlin module, it is necessary to declare atomic properties as private or internal,\n" +
" or make the containing class private or internal.\n" +
" To expose the atomic property value to the public, use a delegated property declared in the same scope, e.g: \n" +
" ```\n" +
" private val _a = atomic<T>(initial) \n" +
" public var a: T by _a \n" +
" ```\n" +
" * Only perform operations directly on atomic values:\n" +
" * Avoid storing references to atomic values in local variables, e.g.\n" +
" ```\n" +
" val top = atomic<Node?>(null)\n" +
" top.compareAndSet(null, Node(1)) // OK: direct invocation on the atomic property is allowed \n" +
" ```\n" +
" ```\n" +
" val tmp = top\n" +
" tmp.compareAndSet(null, Node(1)) // DON'T DO THIS: invocation on a local variable is NOT allowed \n" +
" ```\n" +
" * Do not leak references to atomic values in other way (return, pass as params, etc).\n" +
" * Avoid introducing complex data flow within parameters of atomic operations:\n" +
" Instead of top.compareAndSet(cur, <complex_expression>) use \n" +
" ```\n" +
" val newValue = <complex_expression>\n" +
" top.compareAndSet(cur, newValue) \n" +
" ```\n" +
"\n"
}
abstract val atomicSymbols: AbstractAtomicSymbols
protected val irBuiltIns = pluginContext.irBuiltIns
private val ATOMICFU_INLINE_FUNCTIONS = setOf("loop", "update", "getAndUpdate", "updateAndGet")
private val ATOMIC_VALUE_TYPES = setOf("AtomicInt", "AtomicLong", "AtomicBoolean", "AtomicRef")
private val ATOMIC_ARRAY_TYPES = setOf("AtomicIntArray", "AtomicLongArray", "AtomicBooleanArray", "AtomicArray")
protected val atomicPropertyToVolatile = mutableMapOf<IrProperty, IrProperty>()
protected val propertyToAtomicHandler = mutableMapOf<IrProperty, IrProperty>()
fun transform(moduleFragment: IrModuleFragment) {
transformAtomicProperties(moduleFragment)
transformAtomicExtensions(moduleFragment)
transformAtomicFunctions(moduleFragment)
finalTransformationCheck(moduleFragment)
for (irFile in moduleFragment.files) {
irFile.patchDeclarationParents()
}
}
protected abstract val atomicPropertiesTransformer: AtomicPropertiesTransformer
protected abstract val atomicExtensionsTransformer: AtomicExtensionTransformer
protected abstract val atomicFunctionsTransformer: AtomicFunctionCallTransformer
private fun transformAtomicProperties(moduleFragment: IrModuleFragment) {
for (irFile in moduleFragment.files) {
irFile.transform(atomicPropertiesTransformer, null)
}
}
private fun transformAtomicExtensions(moduleFragment: IrModuleFragment) {
for (irFile in moduleFragment.files) {
irFile.transform(atomicExtensionsTransformer, null)
}
}
private fun transformAtomicFunctions(moduleFragment: IrModuleFragment) {
for (irFile in moduleFragment.files) {
irFile.transform(atomicFunctionsTransformer, null)
}
}
private fun finalTransformationCheck(moduleFragment: IrModuleFragment) {
val finalTransformationChecker = FinalTransformationChecker()
for (irFile in moduleFragment.files) {
irFile.accept(finalTransformationChecker, null)
}
}
protected abstract inner class AtomicPropertiesTransformer : IrElementTransformer<IrFunction?> {
override fun visitClass(declaration: IrClass, data: IrFunction?): IrStatement {
val declarationsToBeRemoved = mutableListOf<IrDeclaration>()
declaration.declarations.withIndex().filter { isPropertyOfAtomicfuType(it.value) }.forEach {
transformAtomicProperty(it.value as IrProperty, it.index, declarationsToBeRemoved)
}
declaration.declarations.removeAll(declarationsToBeRemoved)
return super.visitClass(declaration, data)
}
override fun visitFile(declaration: IrFile, data: IrFunction?): IrFile {
val declarationsToBeRemoved = mutableListOf<IrDeclaration>()
declaration.declarations.withIndex().filter { isPropertyOfAtomicfuType(it.value) }.forEach {
transformAtomicProperty(it.value as IrProperty, it.index, declarationsToBeRemoved)
}
declaration.declarations.removeAll(declarationsToBeRemoved)
return super.visitFile(declaration, data)
}
private fun transformAtomicProperty(atomicProperty: IrProperty, index: Int, declarationsToBeRemoved: MutableList<IrDeclaration>) {
val parentContainer = atomicProperty.parents.firstIsInstance<IrDeclarationContainer>()
val isTopLevel = parentContainer is IrFile || (parentContainer is IrClass && parentContainer.kind == ClassKind.OBJECT)
when {
atomicProperty.isAtomic() -> {
if (isTopLevel) {
atomicProperty.checkVisibility()
parentContainer.addTransformedStaticAtomic(atomicProperty, index)
} else {
atomicProperty.checkVisibility()
(parentContainer as IrClass).addTransformedInClassAtomic(atomicProperty, index)
}.also {
declarationsToBeRemoved.add(atomicProperty)
}
}
atomicProperty.isAtomicArray() -> {
atomicProperty.checkVisibility()
parentContainer.addTransformedAtomicArray(atomicProperty, index)?.also {
declarationsToBeRemoved.add(atomicProperty)
}
}
atomicProperty.isDelegatedToAtomic() -> parentContainer.transformDelegatedAtomic(atomicProperty)
atomicProperty.isTrace() -> declarationsToBeRemoved.add(atomicProperty)
else -> {}
}
}
/**
* Generates a volatile property that can be atomically updated instead of the given atomic property
* and adds it to the parent class.
* Returns the volatile property.
*/
abstract fun IrClass.addTransformedInClassAtomic(atomicProperty: IrProperty, index: Int): IrProperty
/**
* Generates a volatile property that can be atomically updated instead of the given static atomic property
* and adds it to the parent container.
* Returns the voaltile property.
*/
abstract fun IrDeclarationContainer.addTransformedStaticAtomic(atomicProperty: IrProperty, index: Int): IrProperty
/**
* Generates an array that can be atomically updated instead of the given atomic array
* and adds it to the parent class.
* Returns the new property or null if transformation was skipped.
* NOTE: skipping transformation is supported for K/N backend, because arrays are currently not supported there.
*/
abstract fun IrDeclarationContainer.addTransformedAtomicArray(atomicProperty: IrProperty, index: Int): IrProperty?
/**
* Transforms the given property that was delegated to the atomic property:
* delegates accessors to the volatile property that was generated instead of the atomic property.
*/
private fun IrDeclarationContainer.transformDelegatedAtomic(atomicProperty: IrProperty) {
val getDelegate = atomicProperty.backingField?.initializer?.expression
require(getDelegate is IrCall) { "Expected initializer of the delegated property ${this.render()} is IrCall but found ${getDelegate?.render()}" }
val delegateVolatileField = when {
getDelegate.isAtomicFactoryCall() -> {
/**
* 1. Property delegated to atomic factory invocation is transformed to the volatile property:
*
* var a by atomic(0) --> @Volatile var a = 0
* get() = a
* set(value: Int) { a = value }
*/
with(atomicSymbols.createBuilder(atomicProperty.symbol)) {
buildVolatileBackingField(atomicProperty, this@transformDelegatedAtomic, false).also {
declarations.add(it)
}
}
}
getDelegate.symbol.owner.isGetter -> {
/**
* 2. Property delegated to another atomic property:
* it's accessors should get/set the value of the delegate (that is already transformed to the atomically updated volatile property).
*
* val _a = atomic(0) @Volatile _a = 0 (+ atomic updaters)
* var a by _a --> @Volatile var a = 0
* get() = _a
* set(value: Int) { _a = value }
*/
val delegate = getDelegate.getCorrespondingProperty()
check(delegate.parent == atomicProperty.parent) {
"The delegated property [${atomicProperty.render()}] declared in [${atomicProperty.parent.render()}] should be declared in the same scope " +
"as the corresponding atomic property [${delegate.render()}] declared in [${delegate.parent.render()}]." + CONSTRAINTS_MESSAGE}
val volatileProperty = atomicPropertyToVolatile[delegate] ?: error("The delegate property was not transformed: ${delegate.render()}.")
volatileProperty.backingField ?: error("Transformed atomic field should have a non-null backingField.")
}
else -> error("Unexpected initializer of the delegated property ${this.render()}")
}
atomicProperty.getter?.transformAccessor(delegateVolatileField)
atomicProperty.setter?.transformAccessor(delegateVolatileField)
atomicProperty.backingField = null
}
private fun IrSimpleFunction.transformAccessor(delegateVolatileField: IrField) {
val dispatchReceiver =
if (delegateVolatileField.parent is IrClass && delegateVolatileField.parentAsClass.name.asString().contains(VOLATILE_WRAPPER_SUFFIX)) {
getStaticVolatileWrapperInstance(delegateVolatileField.parentAsClass)
} else {
dispatchReceiverParameter?.capture()
}
with(atomicSymbols.createBuilder(symbol)) {
body = irExprBody(
if (this@transformAccessor.isGetter) {
irGetField(dispatchReceiver, delegateVolatileField)
} else {
irSetField(dispatchReceiver, delegateVolatileField, this@transformAccessor.valueParameters[0].capture())
}
)
}
}
/**
* Generates a private volatile field initialized with the initial value of the given atomic property:
* private val a = atomic(0) --> private @Volatile a: Int = 0
*/
protected fun AbstractAtomicfuIrBuilder.buildVolatileBackingField(
atomicProperty: IrProperty,
parentContainer: IrDeclarationContainer,
tweakBooleanToInt: Boolean
): IrField {
val atomicField = requireNotNull(atomicProperty.backingField) { "BackingField of atomic property $atomicProperty should not be null." }
val fieldType = atomicField.type.atomicToPrimitiveType()
val initializer = atomicField.initializer?.expression
if (initializer == null) {
val initBlock = atomicField.getInitBlockForField(parentContainer)
val initExprWithIndex = initBlock.getInitExprWithIndexFromInitBlock(atomicField.symbol)
?: error("Expected property ${atomicProperty.render()} initialization in init block ${initBlock.render()}.")
val atomicFactoryCall = initExprWithIndex.value.value
val initExprIndex = initExprWithIndex.index
val initValue = atomicFactoryCall.getAtomicFactoryValueArgument()
return irVolatileField(
atomicProperty.name.asString() + VOLATILE,
// JVM: AtomicBoolean is transformed to a volatile Int field (boolean fields can only be updated with AtomicIntegerFieldUpdater)
// K/N: AtomicBoolean should be a volatile Boolean field
if (tweakBooleanToInt && fieldType.isBoolean()) irBuiltIns.intType else fieldType,
null,
atomicField.annotations,
parentContainer
).also {
initBlock.updateFieldInitialization(atomicField.symbol, it.symbol, initValue, initExprIndex)
}
} else {
val initValue = initializer.getAtomicFactoryValueArgument()
return irVolatileField(
atomicProperty.name.asString() + VOLATILE,
// JVM: AtomicBoolean is transformed to a volatile Int field (boolean fields can only be updated with AtomicIntegerFieldUpdater)
// K/N: AtomicBoolean should be a volatile Boolean field
if (tweakBooleanToInt && fieldType.isBoolean()) irBuiltIns.intType else fieldType,
initValue,
atomicField.annotations,
parentContainer
)
}
}
/**
* In case if atomic property is initialized in init block it's declaration is replaced with the volatile property
* and initialization of the backing field is also performed in the init block:
*
* private val _a: AtomicInt --> @Volatile var _a: Int
*
* init { init {
* _a = atomic(0) _a = 0
* } }
*/
protected fun IrAnonymousInitializer.getInitExprWithIndexFromInitBlock(
oldFieldSymbol: IrFieldSymbol
): IndexedValue<IrSetField>? =
body.statements.withIndex().singleOrNull { it.value is IrSetField && (it.value as IrSetField).symbol == oldFieldSymbol }?.let {
@Suppress("UNCHECKED_CAST")
it as IndexedValue<IrSetField>
}
protected fun IrAnonymousInitializer.updateFieldInitialization(
oldFieldSymbol: IrFieldSymbol,
volatileFieldSymbol: IrFieldSymbol,
initExpr: IrExpression,
index: Int
) {
// save the order of field initialization in init block
body.statements.singleOrNull {
it is IrSetField && it.symbol == oldFieldSymbol
}?.let {
it as IrSetField
with(atomicSymbols.createBuilder(it.symbol)) {
body.statements[index] = irSetField(it.receiver, volatileFieldSymbol.owner, initExpr)
}
}
}
protected fun IrField.getInitBlockForField(parentContainer: IrDeclarationContainer): IrAnonymousInitializer {
for (declaration in parentContainer.declarations) {
if (declaration is IrAnonymousInitializer) {
if (declaration.body.statements.any { it is IrSetField && it.symbol == this.symbol }) {
return declaration
}
}
}
error(
"Failed to find initialization of the property [${this.correspondingPropertySymbol?.owner?.render()}] in the init block of the class [${this.parent.render()}].\n" +
"Please avoid complex data flow in property initialization, e.g. instead of this:\n" +
"```\n" +
"val a: AtomicInt\n" +
"init {\n" +
" if (foo()) {\n" +
" a = atomic(0)\n" +
" } else { \n" +
" a = atomic(1)\n" +
" }\n" +
"}\n" +
"use simple direct assignment expression to initialize the property:\n" +
"```\n" +
"val a: AtomicInt\n" +
"init {\n" +
" val initValue = if (foo()) 0 else 1\n" +
" a = atomic(initValue)\n" +
"}\n" +
"```\n" + CONSTRAINTS_MESSAGE
)
}
// atomic(value = 0) -> 0
private fun IrExpression.getAtomicFactoryValueArgument(): IrExpression {
require(this is IrCall) { "Expected atomic factory invocation but found: ${this.render()}." }
return getValueArgument(0)?.deepCopyWithSymbols()
?: error("Atomic factory should take at least one argument: ${this.render()}.")
}
// AtomicIntArray(size = 10) -> 10
protected fun IrExpression.getArraySizeArgument(): IrExpression {
require(this is IrFunctionAccessExpression) {
"Expected atomic array factory invocation, but found: ${this.render()}."
}
return getValueArgument(0)?.deepCopyWithSymbols()
?: error("Atomic array factory should take at least one argument: ${this.render()}.")
}
private fun IrProperty.checkVisibility() =
check((visibility == DescriptorVisibilities.PRIVATE || visibility == DescriptorVisibilities.INTERNAL) ||
(parent is IrClass &&
(parentAsClass.visibility == DescriptorVisibilities.PRIVATE || parentAsClass.visibility == DescriptorVisibilities.INTERNAL))) {
"To ensure that atomic properties are not accessed out of the current Kotlin module, it is necessary to declare atomic properties as private or internal.\n" +
"Please consider declaring [${this.atomicfuRender()}] from [${this.parent.render()}] as a private or internal property." +
if (parent is IrClass) ",\nYou may also make the containing class [${parentAsClass.render()}] private or internal.\n" else "\n" +
"Alternatively, if you need to expose the atomic property value to the public, you can use a delegated property declared within the same scope, e.g:\n" +
"```\n" +
"private val _a = atomic<T>(initial) \n" +
"public var a: T by _a \n" +
"```\n"
}
protected fun IrProperty.getMinVisibility(): DescriptorVisibility {
// To protect atomic properties from leaking out of the current sourceSet, they are required to be internal or private,
// or the containing class may be internal or private.
// This method returns the minimal visibility between the property visibility and the class visibility applied to atomic updaters or volatile wrappers.
val classVisibility = if (this.parent is IrClass) parentAsClass.visibility else DescriptorVisibilities.PUBLIC
val compare = visibility.compareTo(classVisibility) ?: -1 // in case of non-comparable visibilities (e.g. local and private) return property visibility
return if (compare > 0) classVisibility else visibility
}
}
protected abstract inner class AtomicExtensionTransformer : IrElementTransformerVoid() {
override fun visitFile(declaration: IrFile): IrFile {
declaration.transformAllAtomicExtensions()
return super.visitFile(declaration)
}
override fun visitClass(declaration: IrClass): IrStatement {
declaration.transformAllAtomicExtensions()
return super.visitClass(declaration)
}
abstract fun IrDeclarationContainer.transformAllAtomicExtensions()
}
protected abstract inner class AtomicFunctionCallTransformer : IrElementTransformer<IrFunction?> {
override fun visitFunction(declaration: IrFunction, data: IrFunction?): IrStatement {
return super.visitFunction(declaration, declaration)
}
override fun visitCall(expression: IrCall, data: IrFunction?): IrElement {
(expression.extensionReceiver ?: expression.dispatchReceiver)?.transform(this, data)?.let {
val propertyGetterCall = if (it is IrTypeOperatorCallImpl) it.argument else it // <get-_a>()
if (propertyGetterCall.type.isAtomicValueType()) {
val valueType = if (it is IrTypeOperatorCallImpl) {
// If receiverExpression is a cast `s as AtomicRef<String>`
// then valueType is the type argument of Atomic* class `String`
(it.type as IrSimpleType).arguments[0] as IrSimpleType
} else {
propertyGetterCall.type.atomicToPrimitiveType()
}
val isArrayReceiver = propertyGetterCall.isArrayElementReceiver(data)
if (expression.symbol.owner.isFromKotlinxAtomicfuPackage()) {
/**
* Transform invocations of functions from kotlinx.atomicfu on atomics properties or atomic array elements:
*
* <get-_a>().compareAndSet(10, 45)
* <get-intArr>()[1].getAndSet(10)
* <get-_a>().updateAndGet { cur -> cur + 100 }
*/
val functionName = expression.symbol.owner.name.asString()
if (functionName in ATOMICFU_INLINE_FUNCTIONS) {
val loopCall = transformedAtomicfuInlineFunctionCall(
expression = expression,
functionName = functionName,
valueType = valueType,
getPropertyReceiver = propertyGetterCall,
isArrayReceiver = isArrayReceiver,
parentFunction = data
)
return super.visitCall(loopCall, data)
}
val irCall = if (isArrayReceiver) {
transformAtomicUpdateCallOnArrayElement(
expression = expression,
functionName = functionName,
valueType = valueType,
getPropertyReceiver = propertyGetterCall,
parentFunction = data
)
} else {
transformAtomicUpdateCallOnProperty(
expression = expression,
functionName = functionName,
valueType = valueType,
castType = if (it is IrTypeOperatorCall) valueType else null,
getPropertyReceiver = propertyGetterCall,
parentFunction = data
)
}
return super.visitExpression(irCall, data)
}
if (expression.symbol.owner.isInline && expression.extensionReceiver != null) {
/**
* Transform invocation of Atomic* extension functions, delegating them to the corresponding transformed atomic extensions:
*
* val _a = atomic(0)
* inline fun AtomicInt.foo() { ... }
* _a.foo()
*/
val declaration = expression.symbol.owner
val irCall = transformAtomicExtensionCall(
expression = expression,
originalAtomicExtension = declaration,
getPropertyReceiver = propertyGetterCall,
isArrayReceiver = isArrayReceiver,
parentFunction = data
)
return super.visitCall(irCall, data)
}
}
}
return super.visitCall(expression, data)
}
abstract fun transformAtomicUpdateCallOnProperty(
expression: IrCall,
functionName: String,
valueType: IrType,
castType: IrType?,
getPropertyReceiver: IrExpression,
parentFunction: IrFunction?
): IrExpression
abstract fun transformAtomicUpdateCallOnArrayElement(
expression: IrCall,
functionName: String,
valueType: IrType,
getPropertyReceiver: IrExpression,
parentFunction: IrFunction?
): IrExpression
abstract fun transformedAtomicfuInlineFunctionCall(
expression: IrCall,
functionName: String,
valueType: IrType,
getPropertyReceiver: IrExpression,
isArrayReceiver: Boolean,
parentFunction: IrFunction?
): IrCall
abstract fun transformAtomicExtensionCall(
expression: IrCall,
originalAtomicExtension: IrSimpleFunction,
getPropertyReceiver: IrExpression,
isArrayReceiver: Boolean,
parentFunction: IrFunction?
): IrCall
abstract fun IrDeclarationContainer.getTransformedAtomicExtension(
declaration: IrSimpleFunction,
isArrayReceiver: Boolean
): IrSimpleFunction
override fun visitGetValue(expression: IrGetValue, data: IrFunction?): IrExpression {
/**
* During transformation of atomic extensions value parameters are changed, though the body is just copied from the original declaration.
* This function replaces capturing of old value parameters with new parameters in the body of a transformed atomic extension.
*
* JVM example:
*
* inline fun AtomicInt.foo(to: Int) { --> inline fun foo$atomicfu(dispatchReceiver: Any?, handler: j.u.c.a.AtomicIntegerFieldUpdater, to': Int) {
* compareAndSet(0, to) handler.compareAndSet(0, to) // there is no parameter `to` in the new signature,
* // it should be replaced with `to'`
* } }
*/
if (expression.symbol is IrValueParameterSymbol) {
val valueParameter = expression.symbol.owner as IrValueParameter
val parent = valueParameter.parent
// skip value parameters of lambdas
if (parent is IrFunctionImpl && parent.origin == IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA) return expression
if (data != null && data.isTransformedAtomicExtension() &&
parent is IrFunctionImpl && !parent.isTransformedAtomicExtension()) {
return valueParameter.remapValueParameter(data)?.capture() ?: super.visitGetValue(expression, data)
}
}
return super.visitGetValue(expression, data)
}
abstract fun IrValueParameter.remapValueParameter(transformedExtension: IrFunction): IrValueParameter?
abstract fun IrFunction.isTransformedAtomicExtension(): Boolean
abstract fun IrExpression.isArrayElementReceiver(
parentFunction: IrFunction?
): Boolean
override fun visitBlockBody(body: IrBlockBody, data: IrFunction?): IrBody {
// Erase messages added by the Trace object from the function body:
// val trace = Trace(size)
// Messages may be added via trace invocation:
// trace { "Doing something" }
// or via multi-append of arguments:
// trace.append(index, "CAS", value)
body.statements.removeIf {
it.isTraceCall()
}
return super.visitBlockBody(body, data)
}
override fun visitContainerExpression(expression: IrContainerExpression, data: IrFunction?): IrExpression {
// Erase messages added by the Trace object from blocks.
expression.statements.removeIf {
it.isTraceCall()
}
return super.visitContainerExpression(expression, data)
}
}
private inner class FinalTransformationChecker: IrElementTransformer<IrFunction?> {
override fun visitFunction(declaration: IrFunction, data: IrFunction?): IrStatement {
return super.visitFunction(declaration, declaration)
}
override fun visitCall(expression: IrCall, data: IrFunction?): IrElement {
if (expression.symbol.owner.isGetter && (expression.type.isAtomicValueType() || expression.type.isAtomicArrayType())) {
val atomicProperty = expression.getCorrespondingProperty()
if ((atomicProperty.parent as IrDeclarationContainer).declarations.contains(atomicProperty)) {
error("Untransformed atomic property [${atomicProperty.atomicfuRender()}] is found in ${data?.render()}.\n" +
"Probably some constraints on usage of atomic properties were violated." + CONSTRAINTS_MESSAGE)
} else {
error("Function invocation is expected on the atomic property [${atomicProperty.atomicfuRender()}] in ${data?.render()}.\n" +
"Please invoke atomic get or update function." + CONSTRAINTS_MESSAGE)
}
}
return super.visitCall(expression, data)
}
}
// Util transformer functions
protected fun getStaticVolatileWrapperInstance(volatileWrapperClass: IrClass): IrExpression {
val volatileWrapperClassInstance = volatileWrapperClass.parentDeclarationContainer.declarations.find {
it is IrProperty && it.backingField?.type?.classOrNull == volatileWrapperClass.symbol
} ?: error("Instance of ${volatileWrapperClass.name.asString()} was not found in the parent class ${volatileWrapperClass.parentDeclarationContainer.render()}")
return with(atomicSymbols.createBuilder(volatileWrapperClass.symbol)) {
irGetProperty(volatileWrapperClassInstance as IrProperty, null)
}
}
private fun IrFunction.isFromKotlinxAtomicfuPackage(): Boolean = parentDeclarationContainer.kotlinFqName.asString().startsWith(AFU_PKG)
private fun isPropertyOfAtomicfuType(declaration: IrDeclaration): Boolean =
declaration is IrProperty && declaration.backingField?.type?.classFqName?.parent()?.asString() == AFU_PKG
private fun IrProperty.isAtomic(): Boolean =
!isDelegated && backingField?.type?.isAtomicValueType() ?: false
private fun IrProperty.isDelegatedToAtomic(): Boolean =
isDelegated && backingField?.type?.isAtomicValueType() ?: false
private fun IrProperty.isAtomicArray(): Boolean =
backingField?.type?.isAtomicArrayType() ?: false
private fun IrProperty.isTrace(): Boolean =
backingField?.type?.isTraceBaseType() ?: false
protected fun IrType.isAtomicValueType() =
classFqName?.let {
it.parent().asString() == AFU_PKG && it.shortName().asString() in ATOMIC_VALUE_TYPES
} ?: false
private fun IrType.isAtomicArrayType() =
classFqName?.let {
it.parent().asString() == AFU_PKG && it.shortName().asString() in ATOMIC_ARRAY_TYPES
} ?: false
private fun IrType.isTraceBaseType() =
classFqName?.let {
it.parent().asString() == AFU_PKG && it.shortName().asString() == TRACE_BASE_TYPE
} ?: false
private fun IrCall.isTraceInvoke(): Boolean =
symbol.owner.isFromKotlinxAtomicfuPackage() &&
symbol.owner.name.asString() == INVOKE &&
symbol.owner.dispatchReceiverParameter?.type?.isTraceBaseType() == true
private fun IrCall.isTraceAppend(): Boolean =
symbol.owner.isFromKotlinxAtomicfuPackage() &&
symbol.owner.name.asString() == APPEND &&
symbol.owner.dispatchReceiverParameter?.type?.isTraceBaseType() == true
private fun IrStatement.isTraceCall() = this is IrCall && (isTraceInvoke() || isTraceAppend())
protected fun IrCall.isArrayElementGetter(): Boolean =
dispatchReceiver?.let {
it.type.isAtomicArrayType() && symbol.owner.name.asString() == GET
} ?: false
protected fun IrType.atomicToPrimitiveType(): IrType =
when(classFqName?.shortName()?.asString()) {
"AtomicInt" -> irBuiltIns.intType
"AtomicLong" -> irBuiltIns.longType
"AtomicBoolean" -> irBuiltIns.booleanType
"AtomicRef" -> irBuiltIns.anyNType
else -> error("Expected kotlinx.atomicfu.(AtomicInt|AtomicLong|AtomicBoolean|AtomicRef) type, but found ${this.render()}" + CONSTRAINTS_MESSAGE)
}
protected fun IrCall.isAtomicFactoryCall(): Boolean =
symbol.owner.isFromKotlinxAtomicfuPackage() && symbol.owner.name.asString() == ATOMIC_VALUE_FACTORY &&
type.isAtomicValueType()
protected fun IrFunction.isAtomicExtension(): Boolean =
if (extensionReceiverParameter != null && extensionReceiverParameter!!.type.isAtomicValueType()) {
require(this.isInline) { "Non-inline extension functions on kotlinx.atomicfu.Atomic* classes are not allowed, " +
"please add inline modifier to the function ${this.render()}." }
require(this.visibility == DescriptorVisibilities.PRIVATE || this.visibility == DescriptorVisibilities.INTERNAL) {
"Only private or internal extension functions on kotlinx.atomicfu.Atomic* classes are allowed, " +
"please make the extension function ${this.render()} private or internal."
}
true
} else false
protected fun IrCall.getCorrespondingProperty(): IrProperty =
symbol.owner.correspondingPropertySymbol?.owner
?: error("Atomic property accessor ${this.render()} expected to have non-null correspondingPropertySymbol" + CONSTRAINTS_MESSAGE)
protected fun IrExpression.isThisReceiver() =
this is IrGetValue && symbol.owner.name.asString() == "<this>"
protected val IrDeclaration.parentDeclarationContainer: IrDeclarationContainer
get() = parents.filterIsInstance<IrDeclarationContainer>().firstOrNull()
?: error("In the sequence of parents for ${this.render()} no IrDeclarationContainer was found")
protected val IrFunction.containingFunction: IrFunction
get() {
if (this.origin != IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA) return this
return parents.filterIsInstance<IrFunction>().firstOrNull {
it.origin != IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA
} ?: error("In the sequence of parents for the local function ${this.render()} no containing function was found")
}
// A.kt -> A$VolatileWrapper$atomicfu
// B -> B$VolatileWrapper$atomicfu
protected fun mangleVolatileWrapperClassName(parent: IrDeclarationContainer): String =
((if (parent is IrFile) parent.name else (parent as IrClass).name.asString())).substringBefore(".") + VOLATILE_WRAPPER_SUFFIX
protected fun mangleAtomicExtensionName(name: String, isArrayReceiver: Boolean) =
if (isArrayReceiver) "$name$$ATOMICFU$$ARRAY" else "$name$$ATOMICFU"
protected fun String.isMangledAtomicArrayExtension() = endsWith("$$ATOMICFU$$ARRAY")
protected fun IrClass.isVolatileWrapper(v: DescriptorVisibility): Boolean =
this.name.asString() == mangleVolatileWrapperClassName(this.parent as IrDeclarationContainer) + "$" + v
protected fun IrValueParameter.capture(): IrGetValue = IrGetValueImpl(startOffset, endOffset, symbol.owner.type, symbol)
protected fun IrType.isObject() = classOrNull?.owner?.kind == ClassKind.OBJECT
protected fun IrProperty.atomicfuRender(): String =
"val " + name.asString() + ": " + backingField?.type?.render()
}
@@ -19,11 +19,6 @@ import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
import org.jetbrains.kotlin.ir.expressions.IrTypeOperator.* import org.jetbrains.kotlin.ir.expressions.IrTypeOperator.*
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.platform.isJs import org.jetbrains.kotlin.platform.isJs
import org.jetbrains.kotlinx.atomicfu.compiler.backend.*
import org.jetbrains.kotlinx.atomicfu.compiler.backend.buildCall
import org.jetbrains.kotlinx.atomicfu.compiler.backend.buildGetterType
import org.jetbrains.kotlinx.atomicfu.compiler.backend.buildSetterType
import org.jetbrains.kotlinx.atomicfu.compiler.backend.getBackingField
private const val AFU_PKG = "kotlinx.atomicfu" private const val AFU_PKG = "kotlinx.atomicfu"
private const val LOCKS = "locks" private const val LOCKS = "locks"
@@ -1,9 +1,9 @@
/* /*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
package org.jetbrains.kotlinx.atomicfu.compiler.backend package org.jetbrains.kotlinx.atomicfu.compiler.backend.js
import org.jetbrains.kotlin.backend.common.extensions.* import org.jetbrains.kotlin.backend.common.extensions.*
import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.*
@@ -61,7 +61,7 @@ internal fun buildCall(
internal fun IrFactory.buildBlockBody(statements: List<IrStatement>) = internal fun IrFactory.buildBlockBody(statements: List<IrStatement>) =
createBlockBody(UNDEFINED_OFFSET, UNDEFINED_OFFSET, statements) createBlockBody(UNDEFINED_OFFSET, UNDEFINED_OFFSET, statements)
internal fun buildSetField( internal fun IrPluginContext.buildSetField(
symbol: IrFieldSymbol, symbol: IrFieldSymbol,
receiver: IrExpression?, receiver: IrExpression?,
value: IrExpression, value: IrExpression,
@@ -73,7 +73,7 @@ internal fun buildSetField(
symbol, symbol,
receiver, receiver,
value, value,
value.type, irBuiltIns.unitType,
IrStatementOrigin.GET_PROPERTY, IrStatementOrigin.GET_PROPERTY,
superQualifierSymbol superQualifierSymbol
) )
@@ -94,7 +94,7 @@ internal fun buildGetField(
superQualifierSymbol superQualifierSymbol
) )
internal fun buildFunctionSimpleType( internal fun buildSimpleType(
symbol: IrClassifierSymbol, symbol: IrClassifierSymbol,
typeParameters: List<IrType> typeParameters: List<IrType>
): IrSimpleType = ): IrSimpleType =
@@ -124,9 +124,6 @@ internal fun IrExpression.isConstNull() = this is IrConst<*> && this.kind.asStri
internal fun IrField.getterName() = "<get-${name.asString()}>" internal fun IrField.getterName() = "<get-${name.asString()}>"
internal fun IrField.setterName() = "<set-${name.asString()}>" internal fun IrField.setterName() = "<set-${name.asString()}>"
internal fun String.getFieldName() = "<get-(\\w+)>".toRegex().find(this)?.groupValues?.get(1)
?: error("Getter name $this does not match special name pattern <get-fieldName>")
internal fun IrFunctionAccessExpression.getValueArguments() = internal fun IrFunctionAccessExpression.getValueArguments() =
(0 until valueArgumentsCount).map { i -> (0 until valueArgumentsCount).map { i ->
getValueArgument(i) getValueArgument(i)
@@ -135,18 +132,18 @@ internal fun IrFunctionAccessExpression.getValueArguments() =
internal fun IrValueParameter.capture() = buildGetValue(UNDEFINED_OFFSET, UNDEFINED_OFFSET, symbol) internal fun IrValueParameter.capture() = buildGetValue(UNDEFINED_OFFSET, UNDEFINED_OFFSET, symbol)
internal fun IrPluginContext.buildGetterType(valueType: IrType): IrSimpleType = internal fun IrPluginContext.buildGetterType(valueType: IrType): IrSimpleType =
buildFunctionSimpleType( buildSimpleType(
irBuiltIns.functionN(0).symbol, irBuiltIns.functionN(0).symbol,
listOf(valueType) listOf(valueType)
) )
internal fun IrPluginContext.buildSetterType(valueType: IrType): IrSimpleType = internal fun IrPluginContext.buildSetterType(valueType: IrType): IrSimpleType =
buildFunctionSimpleType( buildSimpleType(
irBuiltIns.functionN(1).symbol, irBuiltIns.functionN(1).symbol,
listOf(valueType, irBuiltIns.unitType) listOf(valueType, irBuiltIns.unitType)
) )
private fun buildSetField(backingField: IrField, ownerClass: IrExpression?, value: IrGetValue): IrSetField { private fun IrPluginContext.buildSetField(backingField: IrField, ownerClass: IrExpression?, value: IrGetValue): IrSetField {
val receiver = if (ownerClass is IrTypeOperatorCall) ownerClass.argument as IrGetValue else ownerClass val receiver = if (ownerClass is IrTypeOperatorCall) ownerClass.argument as IrGetValue else ownerClass
return buildSetField( return buildSetField(
symbol = backingField.symbol, symbol = backingField.symbol,
@@ -260,10 +257,6 @@ internal fun IrCall.getBackingField(): IrField =
propertySymbol.owner.backingField ?: error("Property expected to have backing field") propertySymbol.owner.backingField ?: error("Property expected to have backing field")
} ?: error("Atomic property accessor ${this.render()} expected to have non-null correspondingPropertySymbol") } ?: error("Atomic property accessor ${this.render()} expected to have non-null correspondingPropertySymbol")
internal fun IrCall.getCorrespondingProperty(): IrProperty =
symbol.owner.correspondingPropertySymbol?.owner
?: error("Atomic property accessor ${this.render()} expected to have non-null correspondingPropertySymbol")
@OptIn(FirIncompatiblePluginAPI::class) @OptIn(FirIncompatiblePluginAPI::class)
internal fun IrPluginContext.referencePackageFunction( internal fun IrPluginContext.referencePackageFunction(
packageName: String, packageName: String,
@@ -304,119 +297,6 @@ internal fun IrPluginContext.getArrayConstructorSymbol(
} }
} }
internal fun IrPluginContext.buildPropertyForBackingField(
field: IrField,
parent: IrDeclarationContainer,
visibility: DescriptorVisibility,
isStatic: Boolean
): IrProperty =
irFactory.buildProperty {
name = field.name
this.visibility = visibility // equal to the atomic property visibility
}.apply {
backingField = field
this.parent = parent
if (!isStatic) {
addDefaultGetter(this, field.parent as IrClass)
} else {
addStaticGetter(this)
}
parent.declarations.add(this)
}
internal fun IrPluginContext.addDefaultGetter(property: IrProperty, parentClass: IrDeclarationContainer) {
val field = property.backingField!!
property.addGetter {
origin = IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR
visibility = property.visibility
returnType = field.type
}.apply {
dispatchReceiverParameter = if (parentClass is IrClass && parentClass.kind == ClassKind.OBJECT) {
null
} else {
(parentClass as? IrClass)?.thisReceiver?.deepCopyWithSymbols(this)
}
body = factory.createBlockBody(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, listOf(
IrReturnImpl(
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
irBuiltIns.nothingType,
symbol,
IrGetFieldImpl(
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
field.symbol,
field.type,
dispatchReceiverParameter?.let {
IrGetValueImpl(
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
it.type,
it.symbol
)
}
)
)
)
)
}
}
internal fun IrPluginContext.addStaticGetter(property: IrProperty) {
val field = property.backingField!!
property.addGetter {
origin = IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR
visibility = property.visibility
returnType = field.type
}.apply {
dispatchReceiverParameter = null
body = factory.createBlockBody(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, listOf(
IrReturnImpl(
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
irBuiltIns.nothingType,
symbol,
IrGetFieldImpl(
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
symbol = field.symbol,
type = field.type,
receiver = null
)
)
)
)
}
}
internal fun IrPluginContext.buildClassInstance(
irClass: IrClass,
parent: IrDeclarationContainer,
visibility: DescriptorVisibility,
isStatic: Boolean
): IrProperty =
buildPropertyForBackingField(
field = buildClassInstanceField(irClass, parent),
parent = parent,
visibility = visibility,
isStatic = isStatic
)
private fun IrPluginContext.buildClassInstanceField(irClass: IrClass, parent: IrDeclarationContainer) =
// build a backing field for the wrapper class instance property
irFactory.buildField {
this.name = Name.identifier(irClass.name.asString().decapitalizeAsciiOnly())
type = irClass.defaultType
isFinal = true
isStatic = true
visibility = DescriptorVisibilities.PRIVATE
}.apply {
initializer = IrExpressionBodyImpl(
IrConstructorCallImpl.fromSymbolOwner(
irClass.defaultType,
irClass.primaryConstructor!!.symbol
)
)
this.parent = parent
}
private fun IrSimpleType.getArrayClassFqName(): FqName = private fun IrSimpleType.getArrayClassFqName(): FqName =
classifier.signature?.let { signature -> classifier.signature?.let { signature ->
signature.getDeclarationNameBySignature().let { name -> signature.getDeclarationNameBySignature().let { name ->
@@ -430,4 +310,3 @@ internal fun IdSignature.getDeclarationNameBySignature(): String? {
val commonSignature = if (this is IdSignature.AccessorSignature) accessorSignature else asPublic() val commonSignature = if (this is IdSignature.AccessorSignature) accessorSignature else asPublic()
return commonSignature?.declarationFqName return commonSignature?.declarationFqName
} }
@@ -5,27 +5,24 @@
package org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm package org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.backend.common.ir.* import org.jetbrains.kotlin.backend.common.ir.*
import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.* import org.jetbrains.kotlin.ir.*
import org.jetbrains.kotlin.ir.builders.declarations.* import org.jetbrains.kotlin.ir.builders.declarations.*
import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.*
import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.expressions.impl.*
import org.jetbrains.kotlin.ir.symbols.* import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.*
import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.name.* import org.jetbrains.kotlin.name.*
import org.jetbrains.kotlinx.atomicfu.compiler.backend.* import org.jetbrains.kotlinx.atomicfu.compiler.backend.common.AbstractAtomicSymbols
// Contains IR declarations needed by the atomicfu plugin. class JvmAtomicSymbols(
class AtomicSymbols( context: IrPluginContext,
val irBuiltIns: IrBuiltIns, moduleFragment: IrModuleFragment
private val moduleFragment: IrModuleFragment ): AbstractAtomicSymbols(context, moduleFragment) {
) {
private val irFactory: IrFactory = IrFactoryImpl
private val javaLang: IrPackageFragment = createPackage("java.lang") private val javaLang: IrPackageFragment = createPackage("java.lang")
private val javaUtilConcurrent: IrPackageFragment = createPackage("java.util.concurrent.atomic") private val javaUtilConcurrent: IrPackageFragment = createPackage("java.util.concurrent.atomic")
private val kotlinJvm: IrPackageFragment = createPackage("kotlin.jvm") private val kotlinJvm: IrPackageFragment = createPackage("kotlin.jvm")
@@ -439,6 +436,9 @@ class AtomicSymbols(
atomicRefFieldUpdaterClass atomicRefFieldUpdaterClass
) )
override fun createBuilder(symbol: IrSymbol, startOffset: Int, endOffset: Int) =
JvmAtomicfuIrBuilder(this, symbol, startOffset, endOffset)
fun getJucaAFUClass(valueType: IrType): IrClassSymbol = fun getJucaAFUClass(valueType: IrType): IrClassSymbol =
when { when {
valueType.isInt() -> atomicIntFieldUpdaterClass valueType.isInt() -> atomicIntFieldUpdaterClass
@@ -503,19 +503,6 @@ class AtomicSymbols(
UNDEFINED_OFFSET, UNDEFINED_OFFSET, irBuiltIns.kClassClass.starProjectedType, irBuiltIns.kClassClass, classType UNDEFINED_OFFSET, UNDEFINED_OFFSET, irBuiltIns.kClassClass.starProjectedType, irBuiltIns.kClassClass, classType
) )
fun function0Type(returnType: IrType) = buildFunctionSimpleType(
irBuiltIns.functionN(0).symbol,
listOf(returnType)
)
fun function1Type(argType: IrType, returnType: IrType) = buildFunctionSimpleType(
irBuiltIns.functionN(1).symbol,
listOf(argType, returnType)
)
val invoke0Symbol = irBuiltIns.functionN(0).getSimpleFunction("invoke")!!
val invoke1Symbol = irBuiltIns.functionN(1).getSimpleFunction("invoke")!!
private fun buildIrGet( private fun buildIrGet(
type: IrType, type: IrType,
receiver: IrExpression?, receiver: IrExpression?,
@@ -531,55 +518,7 @@ class AtomicSymbols(
dispatchReceiver = receiver dispatchReceiver = receiver
} }
private val volatileConstructor = buildAnnotationConstructor(buildClass(JvmNames.VOLATILE_ANNOTATION_FQ_NAME, ClassKind.ANNOTATION_CLASS, kotlinJvm)) override val volatileAnnotationClass: IrClass
val volatileAnnotationConstructorCall = get() = context.referenceClass(ClassId(FqName("kotlin.jvm"), Name.identifier("Volatile")))?.owner
IrConstructorCallImpl.fromSymbolOwner(volatileConstructor.returnType, volatileConstructor.symbol) ?: error("kotlin.jvm.Volatile class is not found")
fun buildClass(
fqName: FqName,
classKind: ClassKind,
parent: IrDeclarationContainer
): IrClass = irFactory.buildClass {
name = fqName.shortName()
kind = classKind
}.apply {
val irClass = this
this.parent = parent
parent.addChild(irClass)
thisReceiver = buildValueParameter(irClass) {
name = Name.identifier("\$this")
type = IrSimpleTypeImpl(irClass.symbol, false, emptyList(), emptyList())
}
}
private fun buildAnnotationConstructor(annotationClass: IrClass): IrConstructor =
annotationClass.addConstructor { isPrimary = true }
private fun createPackage(packageName: String): IrPackageFragment =
IrExternalPackageFragmentImpl.createEmptyExternalPackageFragment(
moduleFragment.descriptor,
FqName(packageName)
)
private fun createClass(
irPackage: IrPackageFragment,
shortName: String,
classKind: ClassKind,
classModality: Modality,
isValueClass: Boolean = false,
): IrClassSymbol = irFactory.buildClass {
name = Name.identifier(shortName)
kind = classKind
modality = classModality
isValue = isValueClass
}.apply {
parent = irPackage
createImplicitParameterDeclarationWithWrappedDescriptor()
}.symbol
fun createBuilder(
symbol: IrSymbol,
startOffset: Int = UNDEFINED_OFFSET,
endOffset: Int = UNDEFINED_OFFSET
) = AtomicfuIrBuilder(this, symbol, startOffset, endOffset)
} }
@@ -5,25 +5,25 @@
package org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm package org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
import org.jetbrains.kotlin.ir.builders.* import org.jetbrains.kotlin.ir.builders.*
import org.jetbrains.kotlin.ir.builders.declarations.buildField
import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBodyImpl
import org.jetbrains.kotlin.ir.symbols.* import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlinx.atomicfu.compiler.backend.common.AbstractAtomicSymbols
import org.jetbrains.kotlinx.atomicfu.compiler.backend.common.AbstractAtomicfuIrBuilder
// An IR builder with access to AtomicSymbols and convenience methods to build IR constructions for atomicfu JVM/IR transformation. // An IR builder with access to AtomicSymbols and convenience methods to build IR constructions for atomicfu JVM/IR transformation.
class AtomicfuIrBuilder internal constructor( class JvmAtomicfuIrBuilder internal constructor(
val atomicSymbols: AtomicSymbols, override val atomicSymbols: JvmAtomicSymbols,
symbol: IrSymbol, symbol: IrSymbol,
startOffset: Int, startOffset: Int,
endOffset: Int endOffset: Int
) : IrBuilderWithScope(IrGeneratorContextBase(atomicSymbols.irBuiltIns), Scope(symbol), startOffset, endOffset) { ) : AbstractAtomicfuIrBuilder(atomicSymbols.irBuiltIns, symbol, startOffset, endOffset) {
fun getProperty(property: IrProperty, dispatchReceiver: IrExpression?) =
irCall(property.getter?.symbol ?: error("Getter is not defined for the property ${property.render()}")).apply {
this.dispatchReceiver = dispatchReceiver?.deepCopyWithSymbols()
}
// a$FU.get(obj) // a$FU.get(obj)
fun atomicGetValue(valueType: IrType, receiver: IrExpression, obj: IrExpression) = fun atomicGetValue(valueType: IrType, receiver: IrExpression, obj: IrExpression) =
@@ -39,14 +39,50 @@ class AtomicfuIrBuilder internal constructor(
putValueArgument(0, index) putValueArgument(0, index)
} }
fun irCallWithArgs(symbol: IrSimpleFunctionSymbol, dispatchReceiver: IrExpression?, valueArguments: List<IrExpression?>) = fun irJavaAtomicArrayField(
irCall(symbol).apply { name: Name,
this.dispatchReceiver = dispatchReceiver arrayClass: IrClassSymbol,
valueArguments.forEachIndexed { i, arg -> isStatic: Boolean,
putValueArgument(i, arg) annotations: List<IrConstructorCall>,
} size: IrExpression,
dispatchReceiver: IrExpression?,
parentContainer: IrDeclarationContainer
): IrField =
context.irFactory.buildField {
this.name = name
type = arrayClass.defaultType
this.isFinal = true
this.isStatic = isStatic
visibility = DescriptorVisibilities.PRIVATE
origin = AbstractAtomicSymbols.ATOMICFU_GENERATED_FIELD
}.apply {
this.initializer = IrExpressionBodyImpl(
newJavaAtomicArray(arrayClass, size, dispatchReceiver)
)
this.annotations = annotations
this.parent = parentContainer
} }
fun irJavaAtomicFieldUpdater(volatileField: IrField, parentClass: IrClass): IrField {
// Generate an atomic field updater for the volatile backing field of the given property:
// val a = atomic(0)
// volatile var a: Int = 0
// val a$FU = AtomicIntegerFieldUpdater.newUpdater(parentClass, "a")
val fuClass = atomicSymbols.getJucaAFUClass(volatileField.type)
val fieldName = volatileField.name.asString()
return context.irFactory.buildField {
name = Name.identifier("$fieldName\$FU")
type = fuClass.defaultType
isFinal = true
isStatic = true
visibility = DescriptorVisibilities.PRIVATE
origin = AbstractAtomicSymbols.ATOMICFU_GENERATED_FIELD
}.apply {
initializer = irExprBody(newJavaAtomicFieldUpdater(fuClass, parentClass, atomicSymbols.irBuiltIns.anyNType, fieldName))
parent = parentClass
}
}
// atomicArr.compareAndSet(index, expect, update) // atomicArr.compareAndSet(index, expect, update)
fun callAtomicArray( fun callAtomicArray(
arrayClassSymbol: IrClassSymbol, arrayClassSymbol: IrClassSymbol,
@@ -70,15 +106,15 @@ class AtomicfuIrBuilder internal constructor(
fun callFieldUpdater( fun callFieldUpdater(
fieldUpdaterSymbol: IrClassSymbol, fieldUpdaterSymbol: IrClassSymbol,
functionName: String, functionName: String,
dispatchReceiver: IrExpression?, getAtomicHandler: IrExpression,
obj: IrExpression?, classInstanceContainingField: IrExpression?,
valueArguments: List<IrExpression?>, valueArguments: List<IrExpression?>,
castType: IrType?, castType: IrType?,
isBooleanReceiver: Boolean, isBooleanReceiver: Boolean,
): IrExpression { ): IrExpression {
val irCall = irCall(atomicSymbols.getAtomicHandlerFunctionSymbol(fieldUpdaterSymbol, functionName)).apply { val irCall = irCall(atomicSymbols.getAtomicHandlerFunctionSymbol(fieldUpdaterSymbol, functionName)).apply {
this.dispatchReceiver = dispatchReceiver this.dispatchReceiver = getAtomicHandler
putValueArgument(0, obj) // instance of the class, containing the field putValueArgument(0, classInstanceContainingField) // instance of the class, containing the field
valueArguments.forEachIndexed { index, arg -> valueArguments.forEachIndexed { index, arg ->
putValueArgument(index + 1, arg) // function arguments putValueArgument(index + 1, arg) // function arguments
} }
@@ -91,17 +127,15 @@ class AtomicfuIrBuilder internal constructor(
return if (isBooleanReceiver && irCall.type.isInt()) irCall.toBoolean() else irCall return if (isBooleanReceiver && irCall.type.isInt()) irCall.toBoolean() else irCall
} }
private fun IrExpression.toBoolean() = irNotEquals(this, irInt(0)) as IrCall
fun callAtomicExtension( fun callAtomicExtension(
symbol: IrSimpleFunctionSymbol, symbol: IrSimpleFunctionSymbol,
dispatchReceiver: IrExpression?, dispatchReceiver: IrExpression?,
syntheticValueArguments: List<IrExpression?>, syntheticValueArguments: List<IrExpression?>,
valueArguments: List<IrExpression?> valueArguments: List<IrExpression?>
) = irCallWithArgs(symbol, dispatchReceiver, syntheticValueArguments + valueArguments) ) = irCallWithArgs(symbol, dispatchReceiver, null, syntheticValueArguments + valueArguments)
// val a$FU = j.u.c.a.AtomicIntegerFieldUpdater.newUpdater(A::class, "a") // val a$FU = j.u.c.a.AtomicIntegerFieldUpdater.newUpdater(A::class, "a")
fun newUpdater( private fun newJavaAtomicFieldUpdater(
fieldUpdaterClass: IrClassSymbol, fieldUpdaterClass: IrClassSymbol,
parentClass: IrClass, parentClass: IrClass,
valueType: IrType, valueType: IrType,
@@ -117,7 +151,7 @@ class AtomicfuIrBuilder internal constructor(
} }
// val atomicArr = j.u.c.a.AtomicIntegerArray(size) // val atomicArr = j.u.c.a.AtomicIntegerArray(size)
fun newJucaAtomicArray( fun newJavaAtomicArray(
atomicArrayClass: IrClassSymbol, atomicArrayClass: IrClassSymbol,
size: IrExpression, size: IrExpression,
dispatchReceiver: IrExpression? dispatchReceiver: IrExpression?
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
import org.jetbrains.kotlin.ir.visitors.acceptVoid import org.jetbrains.kotlin.ir.visitors.acceptVoid
import org.jetbrains.kotlin.platform.isJs import org.jetbrains.kotlin.platform.isJs
import org.jetbrains.kotlin.platform.jvm.isJvm import org.jetbrains.kotlin.platform.jvm.isJvm
import org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicSymbols import org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.JvmAtomicSymbols
import org.jetbrains.kotlinx.atomicfu.compiler.backend.js.AtomicfuJsIrTransformer import org.jetbrains.kotlinx.atomicfu.compiler.backend.js.AtomicfuJsIrTransformer
import org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer import org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer
@@ -27,7 +27,7 @@ public open class AtomicfuLoweringExtension : IrGenerationExtension {
pluginContext: IrPluginContext pluginContext: IrPluginContext
) { ) {
if (pluginContext.platform.isJvm()) { if (pluginContext.platform.isJvm()) {
val atomicSymbols = AtomicSymbols(pluginContext.irBuiltIns, moduleFragment) val atomicSymbols = JvmAtomicSymbols(pluginContext, moduleFragment)
AtomicfuJvmIrTransformer(pluginContext, atomicSymbols).transform(moduleFragment) AtomicfuJvmIrTransformer(pluginContext, atomicSymbols).transform(moduleFragment)
} }
if (pluginContext.platform.isJs()) { if (pluginContext.platform.isJs()) {
@@ -62,4 +62,4 @@ fun FileLoweringPass.runOnFileInOrder(irFile: IrFile) {
declaration.acceptChildrenVoid(this) declaration.acceptChildrenVoid(this)
} }
}) })
} }
@@ -5,16 +5,9 @@
package org.jetbrains.kotlinx.atomicfu package org.jetbrains.kotlinx.atomicfu
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.ObsoleteTestInfrastructure
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoots import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoots
import org.jetbrains.kotlin.codegen.AbstractAsmLikeInstructionListingTest
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar.ExtensionStorage import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar.ExtensionStorage
import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
import org.jetbrains.kotlin.test.model.TestModule import org.jetbrains.kotlin.test.model.TestModule
@@ -27,13 +20,12 @@ import java.io.File
private val coreLibraryPath = getLibraryJar("kotlinx.atomicfu.AtomicFU") private val coreLibraryPath = getLibraryJar("kotlinx.atomicfu.AtomicFU")
private val kotlinTestPath = getLibraryJar("kotlin.test.AssertionsKt") private val kotlinTestPath = getLibraryJar("kotlin.test.AssertionsKt")
private val javaUtilConcurrentPath = getLibraryJar("java.util.concurrent.atomic.AtomicIntegerFieldUpdater")
private val kotlinJvm = getLibraryJar("kotlin.jvm.JvmField") private val kotlinJvm = getLibraryJar("kotlin.jvm.JvmField")
open class AbstractAtomicfuJvmIrTest : AbstractIrBlackBoxCodegenTest() { open class AbstractAtomicfuJvmIrTest : AbstractIrBlackBoxCodegenTest() {
override fun configure(builder: TestConfigurationBuilder) { override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder) super.configure(builder)
val librariesPaths = listOf(coreLibraryPath!!, kotlinTestPath!!, javaUtilConcurrentPath!!, kotlinJvm!!) val librariesPaths = listOf(coreLibraryPath!!, kotlinTestPath!!, kotlinJvm!!)
builder.configureForKotlinxAtomicfu(librariesPaths) builder.configureForKotlinxAtomicfu(librariesPaths)
} }
} }
@@ -25,171 +25,237 @@ public class AtomicfuJsIrTestGenerated extends AbstractAtomicfuJsIrTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
} }
@Test @Nested
@TestMetadata("ArithmeticTest.kt") @TestMetadata("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions")
public void testArithmeticTest() throws Exception { @TestDataPath("$PROJECT_ROOT")
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ArithmeticTest.kt"); public class Atomic_extensions {
@Test
public void testAllFilesPresentInAtomic_extensions() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("ArrayInlineExtensionTest.kt")
public void testArrayInlineExtensionTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/ArrayInlineExtensionTest.kt");
}
@Test
@TestMetadata("ArrayLoopTest.kt")
public void testArrayLoopTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/ArrayLoopTest.kt");
}
@Test
@TestMetadata("ComplexLoopTest.kt")
public void testComplexLoopTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/ComplexLoopTest.kt");
}
@Test
@TestMetadata("ExtensionLoopTest.kt")
public void testExtensionLoopTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/ExtensionLoopTest.kt");
}
@Test
@TestMetadata("ExtensionsTest.kt")
public void testExtensionsTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/ExtensionsTest.kt");
}
@Test
@TestMetadata("InlineExtensionWithTypeParameterTest.kt")
public void testInlineExtensionWithTypeParameterTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/InlineExtensionWithTypeParameterTest.kt");
}
@Test
@TestMetadata("LambdaTest.kt")
public void testLambdaTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/LambdaTest.kt");
}
@Test
@TestMetadata("LockFreeIntBitsTest.kt")
public void testLockFreeIntBitsTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/LockFreeIntBitsTest.kt");
}
@Test
@TestMetadata("LockTest.kt")
public void testLockTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/LockTest.kt");
}
@Test
@TestMetadata("ParameterizedInlineFunExtensionTest.kt")
public void testParameterizedInlineFunExtensionTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/ParameterizedInlineFunExtensionTest.kt");
}
} }
@Test @Nested
@TestMetadata("ArrayInlineExtensionTest.kt") @TestMetadata("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic")
public void testArrayInlineExtensionTest() throws Exception { @TestDataPath("$PROJECT_ROOT")
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ArrayInlineExtensionTest.kt"); public class Atomics_basic {
@Test
public void testAllFilesPresentInAtomics_basic() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("ArithmeticTest.kt")
public void testArithmeticTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/ArithmeticTest.kt");
}
@Test
@TestMetadata("AtomicArrayTest.kt")
public void testAtomicArrayTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/AtomicArrayTest.kt");
}
@Test
@TestMetadata("IndexArrayElementGetterTest.kt")
public void testIndexArrayElementGetterTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/IndexArrayElementGetterTest.kt");
}
@Test
@TestMetadata("InitializationOrderTest.kt")
public void testInitializationOrderTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/InitializationOrderTest.kt");
}
@Test
@TestMetadata("LateinitPropertiesTest.kt")
public void testLateinitPropertiesTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/LateinitPropertiesTest.kt");
}
@Test
@TestMetadata("LockFreeLongCounterTest.kt")
public void testLockFreeLongCounterTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/LockFreeLongCounterTest.kt");
}
@Test
@TestMetadata("LockFreeQueueTest.kt")
public void testLockFreeQueueTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/LockFreeQueueTest.kt");
}
@Test
@TestMetadata("LockFreeStackTest.kt")
public void testLockFreeStackTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/LockFreeStackTest.kt");
}
@Test
@TestMetadata("LoopTest.kt")
public void testLoopTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/LoopTest.kt");
}
@Test
@TestMetadata("MultiInitTest.kt")
public void testMultiInitTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/MultiInitTest.kt");
}
@Test
@TestMetadata("ScopeTest.kt")
public void testScopeTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/ScopeTest.kt");
}
@Test
@TestMetadata("SimpleLockTest.kt")
public void testSimpleLockTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/SimpleLockTest.kt");
}
@Test
@TestMetadata("UncheckedCastTest.kt")
public void testUncheckedCastTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/UncheckedCastTest.kt");
}
} }
@Test @Nested
@TestMetadata("ArrayLoopTest.kt") @TestMetadata("plugins/atomicfu/atomicfu-compiler/testData/box/delegated")
public void testArrayLoopTest() throws Exception { @TestDataPath("$PROJECT_ROOT")
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ArrayLoopTest.kt"); public class Delegated {
@Test
public void testAllFilesPresentInDelegated() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box/delegated"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("DelegatedPropertiesTest.kt")
public void testDelegatedPropertiesTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/delegated/DelegatedPropertiesTest.kt");
}
} }
@Test @Nested
@TestMetadata("AtomicArrayTest.kt") @TestMetadata("plugins/atomicfu/atomicfu-compiler/testData/box/locks")
public void testAtomicArrayTest() throws Exception { @TestDataPath("$PROJECT_ROOT")
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/AtomicArrayTest.kt"); public class Locks {
@Test
public void testAllFilesPresentInLocks() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box/locks"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("ReentrantLockTest.kt")
public void testReentrantLockTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/locks/ReentrantLockTest.kt");
}
@Test
@TestMetadata("SynchronizedObjectTest.kt")
public void testSynchronizedObjectTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/locks/SynchronizedObjectTest.kt");
}
} }
@Test @Nested
@TestMetadata("ComplexLoopTest.kt") @TestMetadata("plugins/atomicfu/atomicfu-compiler/testData/box/top-level")
public void testComplexLoopTest() throws Exception { @TestDataPath("$PROJECT_ROOT")
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ComplexLoopTest.kt"); public class Top_level {
@Test
public void testAllFilesPresentInTop_level() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box/top-level"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("FieldInObjectTest.kt")
public void testFieldInObjectTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/top-level/FieldInObjectTest.kt");
}
@Test
@TestMetadata("TopLevelTest.kt")
public void testTopLevelTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/top-level/TopLevelTest.kt");
}
} }
@Test @Nested
@TestMetadata("DelegatedPropertiesTest.kt") @TestMetadata("plugins/atomicfu/atomicfu-compiler/testData/box/trace")
public void testDelegatedPropertiesTest() throws Exception { @TestDataPath("$PROJECT_ROOT")
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/DelegatedPropertiesTest.kt"); public class Trace {
} @Test
public void testAllFilesPresentInTrace() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box/trace"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test @Test
@TestMetadata("ExtensionLoopTest.kt") @TestMetadata("TraceTest.kt")
public void testExtensionLoopTest() throws Exception { public void testTraceTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ExtensionLoopTest.kt"); runTest("plugins/atomicfu/atomicfu-compiler/testData/box/trace/TraceTest.kt");
} }
@Test
@TestMetadata("ExtensionsTest.kt")
public void testExtensionsTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ExtensionsTest.kt");
}
@Test
@TestMetadata("FieldInObjectTest.kt")
public void testFieldInObjectTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/FieldInObjectTest.kt");
}
@Test
@TestMetadata("IndexArrayElementGetterTest.kt")
public void testIndexArrayElementGetterTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/IndexArrayElementGetterTest.kt");
}
@Test
@TestMetadata("InlineExtensionWithTypeParameterTest.kt")
public void testInlineExtensionWithTypeParameterTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/InlineExtensionWithTypeParameterTest.kt");
}
@Test
@TestMetadata("LambdaTest.kt")
public void testLambdaTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LambdaTest.kt");
}
@Test
@TestMetadata("LateinitPropertiesTest.kt")
public void testLateinitPropertiesTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LateinitPropertiesTest.kt");
}
@Test
@TestMetadata("LockFreeIntBitsTest.kt")
public void testLockFreeIntBitsTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LockFreeIntBitsTest.kt");
}
@Test
@TestMetadata("LockFreeLongCounterTest.kt")
public void testLockFreeLongCounterTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LockFreeLongCounterTest.kt");
}
@Test
@TestMetadata("LockFreeQueueTest.kt")
public void testLockFreeQueueTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LockFreeQueueTest.kt");
}
@Test
@TestMetadata("LockFreeStackTest.kt")
public void testLockFreeStackTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LockFreeStackTest.kt");
}
@Test
@TestMetadata("LockTest.kt")
public void testLockTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LockTest.kt");
}
@Test
@TestMetadata("LoopTest.kt")
public void testLoopTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LoopTest.kt");
}
@Test
@TestMetadata("MultiInitTest.kt")
public void testMultiInitTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/MultiInitTest.kt");
}
@Test
@TestMetadata("ParameterizedInlineFunExtensionTest.kt")
public void testParameterizedInlineFunExtensionTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ParameterizedInlineFunExtensionTest.kt");
}
@Test
@TestMetadata("ReentrantLockTest.kt")
public void testReentrantLockTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ReentrantLockTest.kt");
}
@Test
@TestMetadata("ScopeTest.kt")
public void testScopeTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ScopeTest.kt");
}
@Test
@TestMetadata("SimpleLockTest.kt")
public void testSimpleLockTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/SimpleLockTest.kt");
}
@Test
@TestMetadata("SynchronizedObjectTest.kt")
public void testSynchronizedObjectTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/SynchronizedObjectTest.kt");
}
@Test
@TestMetadata("TopLevelTest.kt")
public void testTopLevelTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/TopLevelTest.kt");
}
@Test
@TestMetadata("TraceTest.kt")
public void testTraceTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/TraceTest.kt");
}
@Test
@TestMetadata("UncheckedCastTest.kt")
public void testUncheckedCastTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/UncheckedCastTest.kt");
} }
} }
@@ -25,171 +25,237 @@ public class AtomicfuJvmIrTestGenerated extends AbstractAtomicfuJvmIrTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
} }
@Test @Nested
@TestMetadata("ArithmeticTest.kt") @TestMetadata("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions")
public void testArithmeticTest() throws Exception { @TestDataPath("$PROJECT_ROOT")
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ArithmeticTest.kt"); public class Atomic_extensions {
@Test
public void testAllFilesPresentInAtomic_extensions() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("ArrayInlineExtensionTest.kt")
public void testArrayInlineExtensionTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/ArrayInlineExtensionTest.kt");
}
@Test
@TestMetadata("ArrayLoopTest.kt")
public void testArrayLoopTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/ArrayLoopTest.kt");
}
@Test
@TestMetadata("ComplexLoopTest.kt")
public void testComplexLoopTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/ComplexLoopTest.kt");
}
@Test
@TestMetadata("ExtensionLoopTest.kt")
public void testExtensionLoopTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/ExtensionLoopTest.kt");
}
@Test
@TestMetadata("ExtensionsTest.kt")
public void testExtensionsTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/ExtensionsTest.kt");
}
@Test
@TestMetadata("InlineExtensionWithTypeParameterTest.kt")
public void testInlineExtensionWithTypeParameterTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/InlineExtensionWithTypeParameterTest.kt");
}
@Test
@TestMetadata("LambdaTest.kt")
public void testLambdaTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/LambdaTest.kt");
}
@Test
@TestMetadata("LockFreeIntBitsTest.kt")
public void testLockFreeIntBitsTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/LockFreeIntBitsTest.kt");
}
@Test
@TestMetadata("LockTest.kt")
public void testLockTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/LockTest.kt");
}
@Test
@TestMetadata("ParameterizedInlineFunExtensionTest.kt")
public void testParameterizedInlineFunExtensionTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomic_extensions/ParameterizedInlineFunExtensionTest.kt");
}
} }
@Test @Nested
@TestMetadata("ArrayInlineExtensionTest.kt") @TestMetadata("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic")
public void testArrayInlineExtensionTest() throws Exception { @TestDataPath("$PROJECT_ROOT")
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ArrayInlineExtensionTest.kt"); public class Atomics_basic {
@Test
public void testAllFilesPresentInAtomics_basic() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("ArithmeticTest.kt")
public void testArithmeticTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/ArithmeticTest.kt");
}
@Test
@TestMetadata("AtomicArrayTest.kt")
public void testAtomicArrayTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/AtomicArrayTest.kt");
}
@Test
@TestMetadata("IndexArrayElementGetterTest.kt")
public void testIndexArrayElementGetterTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/IndexArrayElementGetterTest.kt");
}
@Test
@TestMetadata("InitializationOrderTest.kt")
public void testInitializationOrderTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/InitializationOrderTest.kt");
}
@Test
@TestMetadata("LateinitPropertiesTest.kt")
public void testLateinitPropertiesTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/LateinitPropertiesTest.kt");
}
@Test
@TestMetadata("LockFreeLongCounterTest.kt")
public void testLockFreeLongCounterTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/LockFreeLongCounterTest.kt");
}
@Test
@TestMetadata("LockFreeQueueTest.kt")
public void testLockFreeQueueTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/LockFreeQueueTest.kt");
}
@Test
@TestMetadata("LockFreeStackTest.kt")
public void testLockFreeStackTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/LockFreeStackTest.kt");
}
@Test
@TestMetadata("LoopTest.kt")
public void testLoopTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/LoopTest.kt");
}
@Test
@TestMetadata("MultiInitTest.kt")
public void testMultiInitTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/MultiInitTest.kt");
}
@Test
@TestMetadata("ScopeTest.kt")
public void testScopeTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/ScopeTest.kt");
}
@Test
@TestMetadata("SimpleLockTest.kt")
public void testSimpleLockTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/SimpleLockTest.kt");
}
@Test
@TestMetadata("UncheckedCastTest.kt")
public void testUncheckedCastTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/atomics_basic/UncheckedCastTest.kt");
}
} }
@Test @Nested
@TestMetadata("ArrayLoopTest.kt") @TestMetadata("plugins/atomicfu/atomicfu-compiler/testData/box/delegated")
public void testArrayLoopTest() throws Exception { @TestDataPath("$PROJECT_ROOT")
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ArrayLoopTest.kt"); public class Delegated {
@Test
public void testAllFilesPresentInDelegated() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box/delegated"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("DelegatedPropertiesTest.kt")
public void testDelegatedPropertiesTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/delegated/DelegatedPropertiesTest.kt");
}
} }
@Test @Nested
@TestMetadata("AtomicArrayTest.kt") @TestMetadata("plugins/atomicfu/atomicfu-compiler/testData/box/locks")
public void testAtomicArrayTest() throws Exception { @TestDataPath("$PROJECT_ROOT")
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/AtomicArrayTest.kt"); public class Locks {
@Test
public void testAllFilesPresentInLocks() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box/locks"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("ReentrantLockTest.kt")
public void testReentrantLockTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/locks/ReentrantLockTest.kt");
}
@Test
@TestMetadata("SynchronizedObjectTest.kt")
public void testSynchronizedObjectTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/locks/SynchronizedObjectTest.kt");
}
} }
@Test @Nested
@TestMetadata("ComplexLoopTest.kt") @TestMetadata("plugins/atomicfu/atomicfu-compiler/testData/box/top-level")
public void testComplexLoopTest() throws Exception { @TestDataPath("$PROJECT_ROOT")
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ComplexLoopTest.kt"); public class Top_level {
@Test
public void testAllFilesPresentInTop_level() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box/top-level"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("FieldInObjectTest.kt")
public void testFieldInObjectTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/top-level/FieldInObjectTest.kt");
}
@Test
@TestMetadata("TopLevelTest.kt")
public void testTopLevelTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/top-level/TopLevelTest.kt");
}
} }
@Test @Nested
@TestMetadata("DelegatedPropertiesTest.kt") @TestMetadata("plugins/atomicfu/atomicfu-compiler/testData/box/trace")
public void testDelegatedPropertiesTest() throws Exception { @TestDataPath("$PROJECT_ROOT")
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/DelegatedPropertiesTest.kt"); public class Trace {
} @Test
public void testAllFilesPresentInTrace() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/atomicfu/atomicfu-compiler/testData/box/trace"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test @Test
@TestMetadata("ExtensionLoopTest.kt") @TestMetadata("TraceTest.kt")
public void testExtensionLoopTest() throws Exception { public void testTraceTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ExtensionLoopTest.kt"); runTest("plugins/atomicfu/atomicfu-compiler/testData/box/trace/TraceTest.kt");
} }
@Test
@TestMetadata("ExtensionsTest.kt")
public void testExtensionsTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ExtensionsTest.kt");
}
@Test
@TestMetadata("FieldInObjectTest.kt")
public void testFieldInObjectTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/FieldInObjectTest.kt");
}
@Test
@TestMetadata("IndexArrayElementGetterTest.kt")
public void testIndexArrayElementGetterTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/IndexArrayElementGetterTest.kt");
}
@Test
@TestMetadata("InlineExtensionWithTypeParameterTest.kt")
public void testInlineExtensionWithTypeParameterTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/InlineExtensionWithTypeParameterTest.kt");
}
@Test
@TestMetadata("LambdaTest.kt")
public void testLambdaTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LambdaTest.kt");
}
@Test
@TestMetadata("LateinitPropertiesTest.kt")
public void testLateinitPropertiesTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LateinitPropertiesTest.kt");
}
@Test
@TestMetadata("LockFreeIntBitsTest.kt")
public void testLockFreeIntBitsTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LockFreeIntBitsTest.kt");
}
@Test
@TestMetadata("LockFreeLongCounterTest.kt")
public void testLockFreeLongCounterTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LockFreeLongCounterTest.kt");
}
@Test
@TestMetadata("LockFreeQueueTest.kt")
public void testLockFreeQueueTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LockFreeQueueTest.kt");
}
@Test
@TestMetadata("LockFreeStackTest.kt")
public void testLockFreeStackTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LockFreeStackTest.kt");
}
@Test
@TestMetadata("LockTest.kt")
public void testLockTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LockTest.kt");
}
@Test
@TestMetadata("LoopTest.kt")
public void testLoopTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/LoopTest.kt");
}
@Test
@TestMetadata("MultiInitTest.kt")
public void testMultiInitTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/MultiInitTest.kt");
}
@Test
@TestMetadata("ParameterizedInlineFunExtensionTest.kt")
public void testParameterizedInlineFunExtensionTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ParameterizedInlineFunExtensionTest.kt");
}
@Test
@TestMetadata("ReentrantLockTest.kt")
public void testReentrantLockTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ReentrantLockTest.kt");
}
@Test
@TestMetadata("ScopeTest.kt")
public void testScopeTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/ScopeTest.kt");
}
@Test
@TestMetadata("SimpleLockTest.kt")
public void testSimpleLockTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/SimpleLockTest.kt");
}
@Test
@TestMetadata("SynchronizedObjectTest.kt")
public void testSynchronizedObjectTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/SynchronizedObjectTest.kt");
}
@Test
@TestMetadata("TopLevelTest.kt")
public void testTopLevelTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/TopLevelTest.kt");
}
@Test
@TestMetadata("TraceTest.kt")
public void testTraceTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/TraceTest.kt");
}
@Test
@TestMetadata("UncheckedCastTest.kt")
public void testUncheckedCastTest() throws Exception {
runTest("plugins/atomicfu/atomicfu-compiler/testData/box/UncheckedCastTest.kt");
} }
} }
@@ -1,146 +0,0 @@
import kotlinx.atomicfu.*
import kotlin.test.*
class IntArithmetic {
val _x = atomic(0)
val x get() = _x.value
}
class LongArithmetic {
val _x = atomic(4294967296)
val x get() = _x.value
val y = atomic(5000000000)
val z = atomic(2424920024888888848)
val max = atomic(9223372036854775807)
}
class BooleanArithmetic {
val _x = atomic(false)
val x get() = _x.value
}
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
assertEquals(5, a._x.value)
var aValue = a._x.value
assertEquals(5, aValue)
assertEquals(5, a.x)
local.value = 555
aValue = local.value
assertEquals(aValue, local.value)
}
fun testAtomicCallPlaces(): Boolean {
val a = IntArithmetic()
a._x.value = 5
a._x.compareAndSet(5, 42)
val res = a._x.compareAndSet(42, 45)
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()
assertEquals(0, a.x)
val update = 3
assertEquals(0, a._x.getAndSet(update))
assertTrue(a._x.compareAndSet(update, 8))
a._x.lazySet(1)
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()
assertEquals(2424920024888888848, a.z.value)
a.z.lazySet(8424920024888888848)
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()
assertEquals(false, a._x.value)
assertFalse(a.x)
a._x.lazySet(true)
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"
assertEquals("aaa", a._x.value)
a._x.lazySet("bb")
assertEquals("bb", a._x.value)
assertEquals("bb", a._x.getAndSet("ccc"))
assertEquals("ccc", a._x.value)
}
}
fun box(): String {
val testClass = ArithmeticTest()
testClass.testGetValue()
if (!testClass.testAtomicCallPlaces()) return "testAtomicCallPlaces: FAILED"
testClass.testInt()
testClass.testLong()
testClass.testBoolean()
testClass.testReference()
return "OK"
}
@@ -1,103 +0,0 @@
@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
}
@@ -1,50 +0,0 @@
@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
private final method bar$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private final method bar$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private final method casLoop(p0: int): int
private final method casLoopExpression(p0: long): long
private final method extensionLoop$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private final method extensionLoop$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private final method extensionLoopExpression$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private final method extensionLoopExpression$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private final method extensionLoopMixedReceivers$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int, p4: int, p5: int): int
private final method extensionLoopMixedReceivers$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int, p3: int, p4: int): int
private final method extensionLoopRecursive$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private final method extensionLoopRecursive$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private final method foo$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private final method foo$atomicfu(p0: java.lang.Object, 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
private final method loop$atomicfu$array(p0: java.util.concurrent.atomic.AtomicIntegerArray, p1: int, p2: kotlin.jvm.functions.Function1): void
private final method loop$atomicfu$array(p0: java.util.concurrent.atomic.AtomicLongArray, p1: int, p2: kotlin.jvm.functions.Function1): void
private final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, 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
}
@@ -1,51 +0,0 @@
@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
}
@@ -1,44 +0,0 @@
@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
private final method extensionEmbeddedLoops$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private final method extensionEmbeddedLoops$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private final method extesntionEmbeddedRefUpdate$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int, p3: java.lang.String): java.lang.String
private final method extesntionEmbeddedRefUpdate$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, 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
private final method loop$atomicfu$array(p0: java.util.concurrent.atomic.AtomicIntegerArray, p1: int, p2: kotlin.jvm.functions.Function1): void
private final method loop$atomicfu$array(p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, p2: kotlin.jvm.functions.Function1): void
private final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
public final method test(): void
private final method updateAndGet$atomicfu$array(p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, p2: kotlin.jvm.functions.Function1): java.lang.Object
private final method updateAndGet$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): int
private final method updateAndGet$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): java.lang.Object
}
@@ -1,81 +0,0 @@
@kotlin.Metadata
public final class ExtensionLoopTestKt {
// source: 'ExtensionLoopTest.kt'
private 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
private final static method loop$atomicfu$array(p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, p2: kotlin.jvm.functions.Function1): void
private final static method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
public final static method testTopLevelExtensionLoop(): void
private final static method topLevelExtensionLoop$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int, p3: java.lang.String): java.lang.String
private final static method topLevelExtensionLoop$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, 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
private final method bar$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private final method bar$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private final method casLoop(p0: int): int
private final method casLoopExpression(p0: int): int
private final method extensionLoop$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private final method extensionLoop$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private final method extensionLoopExpression$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private final method extensionLoopExpression$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private final method extensionLoopMixedReceivers$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int, p4: int): int
private final method extensionLoopMixedReceivers$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int, p3: int): int
private final method extensionLoopRecursive$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private final method extensionLoopRecursive$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private final method foo$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private final method foo$atomicfu(p0: java.lang.Object, 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
private final method loop$atomicfu$array(p0: java.util.concurrent.atomic.AtomicIntegerArray, p1: int, p2: kotlin.jvm.functions.Function1): void
private final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
public final method testIntExtensionLoops(): void
public final inner class LoopTest$A
}
@kotlin.Metadata
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
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic final static method access$getRef$FU$p(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
}
@@ -1,38 +0,0 @@
@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
}
@@ -1,118 +0,0 @@
@kotlin.Metadata
public final class DelegatedProvider$_a$DelegatedProvider$VolatileWrapper {
// source: 'FieldInObjectTest.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
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic final static method access$get_a$p(p0: DelegatedProvider$_a$DelegatedProvider$VolatileWrapper): int
public synthetic final static method access$set_a$p(p0: DelegatedProvider$_a$DelegatedProvider$VolatileWrapper, p1: int): void
public final static @org.jetbrains.annotations.NotNull method get_a$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
public final method get_a(): int
public final inner class DelegatedProvider$_a$DelegatedProvider$VolatileWrapper
}
@kotlin.Metadata
public final class DelegatedProvider {
// source: 'FieldInObjectTest.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: DelegatedProvider
private final static @org.jetbrains.annotations.NotNull field _a$DelegatedProvider$VolatileWrapper: DelegatedProvider$_a$DelegatedProvider$VolatileWrapper
private volatile @kotlin.jvm.Volatile field vInt: int
static method <clinit>(): void
private method <init>(): void
public final method getA(): int
public final method getVInt(): int
public final static @org.jetbrains.annotations.NotNull method get_a$DelegatedProvider$VolatileWrapper(): DelegatedProvider$_a$DelegatedProvider$VolatileWrapper
public final method setA(p0: int): void
public final method setVInt(p0: int): void
public final inner class DelegatedProvider$_a$DelegatedProvider$VolatileWrapper
}
@kotlin.Metadata
public final class FieldInObjectTestKt {
// source: 'FieldInObjectTest.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
private final static method testDelegatedPropertiesInObject(): void
private final static method testFieldInObject(): void
public final inner class DelegatedProvider$_a$DelegatedProvider$VolatileWrapper
public final inner class Provider$_ref$Provider$VolatileWrapper
public final inner class Provider$_x$Provider$VolatileWrapper
}
@kotlin.Metadata
final class Provider$Port$Provider$VolatileWrapper {
// source: 'FieldInObjectTest.kt'
private final static @org.jetbrains.annotations.NotNull field port$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private volatile @kotlin.jvm.Volatile field port: int
static method <clinit>(): void
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic final static method access$getPort$FU$p(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private final inner class Provider$Port$Provider$VolatileWrapper
public final inner class kotlin/random/Random$Default
}
@kotlin.Metadata
final class Provider$_l$Provider$VolatileWrapper {
// source: 'FieldInObjectTest.kt'
private final static @org.jetbrains.annotations.NotNull field _l$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
private volatile @kotlin.jvm.Volatile field _l: long
static method <clinit>(): void
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic final static method access$get_l$FU$p(): java.util.concurrent.atomic.AtomicLongFieldUpdater
private final inner class Provider$_l$Provider$VolatileWrapper
}
@kotlin.Metadata
public final class Provider$_ref$Provider$VolatileWrapper {
// source: 'FieldInObjectTest.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
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public final static @org.jetbrains.annotations.NotNull method get_ref$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
public final @org.jetbrains.annotations.Nullable method get_ref(): java.lang.Object
public final inner class Provider$_ref$Provider$VolatileWrapper
}
@kotlin.Metadata
public final class Provider$_x$Provider$VolatileWrapper {
// source: 'FieldInObjectTest.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
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public final static @org.jetbrains.annotations.NotNull method get_x$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
public final method get_x(): int
public final inner class Provider$_x$Provider$VolatileWrapper
}
@kotlin.Metadata
public final class Provider {
// source: 'FieldInObjectTest.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: Provider
private final static @org.jetbrains.annotations.NotNull field _l$Provider$VolatileWrapper: Provider$_l$Provider$VolatileWrapper
private final static @org.jetbrains.annotations.NotNull field _ref$Provider$VolatileWrapper: Provider$_ref$Provider$VolatileWrapper
private final static @org.jetbrains.annotations.NotNull field _x$Provider$VolatileWrapper: Provider$_x$Provider$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 port$Provider$VolatileWrapper: Provider$Port$Provider$VolatileWrapper
private final static @org.jetbrains.annotations.NotNull field refArr: java.util.concurrent.atomic.AtomicReferenceArray
static method <clinit>(): void
private method <init>(): void
public final static @org.jetbrains.annotations.NotNull method getIntArr(): java.util.concurrent.atomic.AtomicIntegerArray
public final method getL(): long
public final static @org.jetbrains.annotations.NotNull method getLongArr(): java.util.concurrent.atomic.AtomicLongArray
public final static @org.jetbrains.annotations.NotNull method getRefArr(): java.util.concurrent.atomic.AtomicReferenceArray
public final static @org.jetbrains.annotations.NotNull method get_ref$Provider$VolatileWrapper(): Provider$_ref$Provider$VolatileWrapper
public final static @org.jetbrains.annotations.NotNull method get_x$Provider$VolatileWrapper(): Provider$_x$Provider$VolatileWrapper
public final method next(): int
private final inner class Provider$Port$Provider$VolatileWrapper
private final inner class Provider$_l$Provider$VolatileWrapper
public final inner class Provider$_ref$Provider$VolatileWrapper
public final inner class Provider$_x$Provider$VolatileWrapper
}
@@ -1,26 +0,0 @@
@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
}
@@ -1,37 +0,0 @@
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"
}
@@ -1,24 +0,0 @@
@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
private final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, 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
}
@@ -1,31 +0,0 @@
@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
}
@@ -1,41 +0,0 @@
@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
private final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, 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
}
@@ -1,18 +0,0 @@
@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
private final static method tryAcquire$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int): boolean
private final static method tryAcquire$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater): boolean
}
@@ -1,66 +0,0 @@
@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
private final method getAndUpdate$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): int
private final method getAndUpdate$atomicfu(p0: java.util.concurrent.atomic.AtomicLongFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): long
private final method getAndUpdate$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, 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
private final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicLongFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private final method update$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private final method update$atomicfu(p0: java.util.concurrent.atomic.AtomicLongFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private final method update$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private final method updateAndGet$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): int
private final method updateAndGet$atomicfu(p0: java.util.concurrent.atomic.AtomicLongFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): long
private final method updateAndGet$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, 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
}
@@ -1,19 +0,0 @@
@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
private final method bar$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int, p3: java.lang.Object, p4: java.lang.Object): java.lang.Object
private final method bar$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p2: java.lang.Object, p3: java.lang.Object): java.lang.Object
private final method foo$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int, p3: java.lang.Object, p4: java.lang.Object, p5: kotlin.jvm.functions.Function1): java.lang.Object
private final method foo$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p2: java.lang.Object, p3: java.lang.Object, 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
}
@@ -1,19 +0,0 @@
@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,145 +0,0 @@
@kotlin.Metadata
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
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): 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
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
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic final static method access$getAbcNode$FU$p(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
}
@kotlin.Metadata
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
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic final static method access$getAny$FU$p(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
}
@kotlin.Metadata
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
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): 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
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
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): 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'
private final static @org.jetbrains.annotations.NotNull field a$TopLevelTest$VolatileWrapper: A$TopLevelTest$VolatileWrapper
private final static @org.jetbrains.annotations.NotNull field abcNode$TopLevelTest$VolatileWrapper: AbcNode$TopLevelTest$VolatileWrapper
private 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
private 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
private 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$getA$TopLevelTest$VolatileWrapper$p(): A$TopLevelTest$VolatileWrapper
public synthetic final static method access$getAbcNode$TopLevelTest$VolatileWrapper$p(): AbcNode$TopLevelTest$VolatileWrapper
public synthetic final static method access$getAny$TopLevelTest$VolatileWrapper$p(): Any$TopLevelTest$VolatileWrapper
public synthetic final static method access$getB$TopLevelTest$VolatileWrapper$p(): B$TopLevelTest$VolatileWrapper
public synthetic final static method access$getBooleanArr$p(): java.util.concurrent.atomic.AtomicIntegerArray
public synthetic final static method access$getC$TopLevelTest$VolatileWrapper$p(): C$TopLevelTest$VolatileWrapper
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
}
@@ -1,46 +0,0 @@
@kotlin.Metadata
final enum class TraceTest$Status {
// source: 'TraceTest.kt'
private synthetic final static field $ENTRIES: kotlin.enums.EnumEntries
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 @org.jetbrains.annotations.NotNull method getEntries(): kotlin.enums.EnumEntries
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
}
@@ -1,54 +0,0 @@
@kotlin.Metadata
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
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): 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
private final method getString$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int): java.lang.String
private final method getString$atomicfu(p0: java.lang.Object, 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'
private final static @org.jetbrains.annotations.NotNull field topLevelS$UncheckedCastTest$VolatileWrapper: TopLevelS$UncheckedCastTest$VolatileWrapper
static method <clinit>(): void
public synthetic final static method access$getTopLevelS$UncheckedCastTest$VolatileWrapper$p(): TopLevelS$UncheckedCastTest$VolatileWrapper
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -2,10 +2,10 @@ import kotlinx.atomicfu.*
import kotlin.test.* import kotlin.test.*
class ArrayInlineExtensionTest { class ArrayInlineExtensionTest {
val intArr = AtomicIntArray(10) private val intArr = AtomicIntArray(10)
val a = atomic(100) private val a = atomic(100)
val longArr = AtomicLongArray(10) private val longArr = AtomicLongArray(10)
val refArr = atomicArrayOfNulls<Any?>(5) private val refArr = atomicArrayOfNulls<Any?>(5)
class A(val s: String) class A(val s: String)
@@ -0,0 +1,51 @@
@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 synthetic final static field a$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field a$volatile: int
private synthetic final field intArr: java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final field longArr: java.util.concurrent.atomic.AtomicLongArray
private synthetic final field refArr: java.util.concurrent.atomic.AtomicReferenceArray
static method <clinit>(): void
public method <init>(): void
private synthetic final method bar$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private synthetic final method bar$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private final method casLoop(p0: int): int
private final method casLoopExpression(p0: long): long
private synthetic final method extensionLoop$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private synthetic final method extensionLoop$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private synthetic final method extensionLoopExpression$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private synthetic final method extensionLoopExpression$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private synthetic final method extensionLoopMixedReceivers$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int, p4: int, p5: int): int
private synthetic final method extensionLoopMixedReceivers$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int, p3: int, p4: int): int
private synthetic final method extensionLoopRecursive$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private synthetic final method extensionLoopRecursive$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private synthetic final method foo$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private synthetic final method foo$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private synthetic final static method getA$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA$volatile(): int
private synthetic final method getIntArr(): java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final method getLongArr(): java.util.concurrent.atomic.AtomicLongArray
private synthetic final method getRefArr(): java.util.concurrent.atomic.AtomicReferenceArray
private synthetic final method loop$atomicfu$array(p0: java.util.concurrent.atomic.AtomicIntegerArray, p1: int, p2: kotlin.jvm.functions.Function1): void
private synthetic final method loop$atomicfu$array(p0: java.util.concurrent.atomic.AtomicLongArray, p1: int, p2: kotlin.jvm.functions.Function1): void
private synthetic final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private synthetic final method setA$volatile(p0: int): 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
}
@@ -16,18 +16,20 @@ final class ArrayInlineFunctionTest$Box {
@kotlin.Metadata @kotlin.Metadata
public final class ArrayInlineFunctionTest { public final class ArrayInlineFunctionTest {
// source: 'ArrayLoopTest.kt' // source: 'ArrayLoopTest.kt'
private final @org.jetbrains.annotations.NotNull field anyArr: java.util.concurrent.atomic.AtomicReferenceArray private synthetic final field anyArr: java.util.concurrent.atomic.AtomicReferenceArray
private final @org.jetbrains.annotations.NotNull field refArr: java.util.concurrent.atomic.AtomicReferenceArray private synthetic final field refArr: java.util.concurrent.atomic.AtomicReferenceArray
public method <init>(): void public method <init>(): void
private final method action(p0: ArrayInlineFunctionTest$Box): ArrayInlineFunctionTest$Box private final method action(p0: ArrayInlineFunctionTest$Box): ArrayInlineFunctionTest$Box
private final method getAndUpdate$atomicfu$array(p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, p2: kotlin.jvm.functions.Function1): java.lang.Object private synthetic final method getAndUpdate$atomicfu$array(p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, p2: kotlin.jvm.functions.Function1): java.lang.Object
private final method loop$atomicfu$array(p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, p2: kotlin.jvm.functions.Function1): void private synthetic final method getAnyArr(): java.util.concurrent.atomic.AtomicReferenceArray
private synthetic final method getRefArr(): java.util.concurrent.atomic.AtomicReferenceArray
private synthetic final method loop$atomicfu$array(p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, p2: kotlin.jvm.functions.Function1): void
public final method testArrayElementGetAndUpdate(): void public final method testArrayElementGetAndUpdate(): void
public final method testArrayElementUpdate(): void public final method testArrayElementUpdate(): void
public final method testArrayElementUpdateAndGet(): void public final method testArrayElementUpdateAndGet(): void
public final method testSetArrayElementValueInLoop(): void public final method testSetArrayElementValueInLoop(): void
private final method update$atomicfu$array(p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, p2: kotlin.jvm.functions.Function1): void private synthetic final method update$atomicfu$array(p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, p2: kotlin.jvm.functions.Function1): void
private final method updateAndGet$atomicfu$array(p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, p2: kotlin.jvm.functions.Function1): java.lang.Object private synthetic final method updateAndGet$atomicfu$array(p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, p2: kotlin.jvm.functions.Function1): java.lang.Object
private final inner class ArrayInlineFunctionTest$Box private final inner class ArrayInlineFunctionTest$Box
} }
@@ -2,11 +2,11 @@ import kotlinx.atomicfu.*
import kotlin.test.* import kotlin.test.*
class LoopTest { class LoopTest {
val a = atomic(10) private val a = atomic(10)
val b = atomic(11) private val b = atomic(11)
val c = atomic(12) private val c = atomic(12)
val r = atomic<String>("aaa") private val r = atomic<String>("aaa")
val intArr = AtomicIntArray(10) private val intArr = AtomicIntArray(10)
private inline fun AtomicInt.extensionEmbeddedLoops(to: Int): Int = private inline fun AtomicInt.extensionEmbeddedLoops(to: Int): Int =
loop { cur1 -> loop { cur1 ->
@@ -0,0 +1,48 @@
@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 synthetic final static field a$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field a$volatile: int
private synthetic final static field b$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field b$volatile: int
private synthetic final static field c$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field c$volatile: int
private synthetic final field intArr: java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final static field r$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field r$volatile: 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
private synthetic final method extensionEmbeddedLoops$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private synthetic final method extensionEmbeddedLoops$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private synthetic final method extesntionEmbeddedRefUpdate$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int, p3: java.lang.String): java.lang.String
private synthetic final method extesntionEmbeddedRefUpdate$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p2: java.lang.String): java.lang.String
private synthetic final static method getA$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA$volatile(): int
private synthetic final static method getB$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getB$volatile(): int
private synthetic final static method getC$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getC$volatile(): int
private synthetic final method getIntArr(): java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final static method getR$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getR$volatile(): java.lang.Object
private synthetic final method loop$atomicfu$array(p0: java.util.concurrent.atomic.AtomicIntegerArray, p1: int, p2: kotlin.jvm.functions.Function1): void
private synthetic final method loop$atomicfu$array(p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, p2: kotlin.jvm.functions.Function1): void
private synthetic final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private synthetic final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private synthetic final method setA$volatile(p0: int): void
private synthetic final method setB$volatile(p0: int): void
private synthetic final method setC$volatile(p0: int): void
private synthetic final method setR$volatile(p0: java.lang.Object): void
public final method test(): void
private synthetic final method updateAndGet$atomicfu$array(p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, p2: kotlin.jvm.functions.Function1): java.lang.Object
private synthetic final method updateAndGet$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): int
private synthetic final method updateAndGet$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): java.lang.Object
}
@@ -2,12 +2,12 @@ import kotlinx.atomicfu.*
import kotlin.test.* import kotlin.test.*
class LoopTest { class LoopTest {
val a = atomic(0) private val a = atomic(0)
val a1 = atomic(1) private val a1 = atomic(1)
val b = atomic(true) private val b = atomic(true)
val l = atomic(5000000000) private val l = atomic(5000000000)
val r = atomic<A>(A("aaaa")) private val r = atomic<A>(A("aaaa"))
val rs = atomic<String>("bbbb") private val rs = atomic<String>("bbbb")
class A(val s: String) class A(val s: String)
@@ -0,0 +1,91 @@
@kotlin.Metadata
synthetic final class ExtensionLoopTest$VolatileWrapper$atomicfu$private {
// source: 'ExtensionLoopTest.kt'
private synthetic final static field ref$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field ref$volatile: java.lang.Object
static method <clinit>(): void
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic final static method access$getRef$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final static method getRef$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getRef$volatile(): java.lang.Object
private synthetic final method setRef$volatile(p0: java.lang.Object): void
}
@kotlin.Metadata
public final class ExtensionLoopTestKt {
// source: 'ExtensionLoopTest.kt'
private synthetic final static field extensionLoopTest$VolatileWrapper$atomicfu$private: ExtensionLoopTest$VolatileWrapper$atomicfu$private
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
private synthetic final static method getExtensionLoopTest$VolatileWrapper$atomicfu$private(): ExtensionLoopTest$VolatileWrapper$atomicfu$private
private synthetic final static method loop$atomicfu$array(p0: java.util.concurrent.atomic.AtomicReferenceArray, p1: int, p2: kotlin.jvm.functions.Function1): void
private synthetic final static method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
public final static method testTopLevelExtensionLoop(): void
private synthetic final static method topLevelExtensionLoop$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int, p3: java.lang.String): java.lang.String
private synthetic final static method topLevelExtensionLoop$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, 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 synthetic final static field a$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field a$volatile: int
private synthetic final static field a1$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field a1$volatile: int
private synthetic final static field b$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field b$volatile: int
private synthetic final static field l$volatile$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic volatile field l$volatile: long
private synthetic final static field r$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field r$volatile: java.lang.Object
private synthetic final static field rs$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field rs$volatile: java.lang.Object
static method <clinit>(): void
public method <init>(): void
private synthetic final method bar$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private synthetic final method bar$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private final method casLoop(p0: int): int
private final method casLoopExpression(p0: int): int
private synthetic final method extensionLoop$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private synthetic final method extensionLoop$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private synthetic final method extensionLoopExpression$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private synthetic final method extensionLoopExpression$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private synthetic final method extensionLoopMixedReceivers$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int, p4: int): int
private synthetic final method extensionLoopMixedReceivers$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int, p3: int): int
private synthetic final method extensionLoopRecursive$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private synthetic final method extensionLoopRecursive$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private synthetic final method foo$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int, p3: int): int
private synthetic final method foo$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p2: int): int
private synthetic final static method getA$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA$volatile(): int
private synthetic final static method getA1$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA1$volatile(): int
private synthetic final static method getB$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getB$volatile(): int
private synthetic final static method getL$volatile$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic final method getL$volatile(): long
private synthetic final static method getR$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getR$volatile(): java.lang.Object
private synthetic final static method getRs$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getRs$volatile(): java.lang.Object
private synthetic final method loop$atomicfu$array(p0: java.util.concurrent.atomic.AtomicIntegerArray, p1: int, p2: kotlin.jvm.functions.Function1): void
private synthetic final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private synthetic final method setA$volatile(p0: int): void
private synthetic final method setA1$volatile(p0: int): void
private synthetic final method setB$volatile(p0: int): void
private synthetic final method setL$volatile(p0: long): void
private synthetic final method setR$volatile(p0: java.lang.Object): void
private synthetic final method setRs$volatile(p0: java.lang.Object): void
public final method testIntExtensionLoops(): void
public final inner class LoopTest$A
}
@@ -2,10 +2,10 @@ import kotlinx.atomicfu.*
import kotlin.test.* import kotlin.test.*
class ExtensionsTest { class ExtensionsTest {
val a = atomic(0) private val a = atomic(0)
val l = atomic(0L) private val l = atomic(0L)
val s = atomic<String?>(null) private val s = atomic<String?>(null)
val b = atomic(true) private val b = atomic(true)
fun testScopedFieldGetters() { fun testScopedFieldGetters() {
check(a.value == 0) check(a.value == 0)
@@ -31,7 +31,7 @@ class ExtensionsTest {
check(a.compareAndSet(7, 10)) check(a.compareAndSet(7, 10))
} }
inline fun AtomicInt.intExtensionArithmetic() { private inline fun AtomicInt.intExtensionArithmetic() {
value = 0 value = 0
check(value == 0) check(value == 0)
val update = 3 val update = 3
@@ -58,7 +58,7 @@ class ExtensionsTest {
check(value == 55) check(value == 55)
} }
inline fun AtomicLong.longExtensionArithmetic() { private inline fun AtomicLong.longExtensionArithmetic() {
value = 2424920024888888848 value = 2424920024888888848
check(value == 2424920024888888848) check(value == 2424920024888888848)
lazySet(8424920024888888848) lazySet(8424920024888888848)
@@ -79,7 +79,7 @@ class ExtensionsTest {
check(value == -198452011965886959) check(value == -198452011965886959)
} }
inline fun AtomicRef<String?>.refExtension() { private inline fun AtomicRef<String?>.refExtension() {
value = "aaa" value = "aaa"
check(value == "aaa") check(value == "aaa")
lazySet("bb") lazySet("bb")
@@ -88,7 +88,7 @@ class ExtensionsTest {
check(value == "ccc") check(value == "ccc")
} }
inline fun AtomicBoolean.booleanExtensionArithmetic() { private inline fun AtomicBoolean.booleanExtensionArithmetic() {
value = false value = false
check(!value) check(!value)
lazySet(true) lazySet(true)
@@ -112,4 +112,4 @@ fun box(): String {
testClass.testScopedFieldGetters() testClass.testScopedFieldGetters()
testClass.testExtension() testClass.testExtension()
return "OK" return "OK"
} }
@@ -0,0 +1,42 @@
@kotlin.Metadata
public final class ExtensionsTest {
// source: 'ExtensionsTest.kt'
private synthetic final static field a$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field a$volatile: int
private synthetic final static field b$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field b$volatile: int
private synthetic final static field l$volatile$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic volatile field l$volatile: long
private synthetic final static field s$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field s$volatile: java.lang.Object
static method <clinit>(): void
public method <init>(): void
private synthetic final method booleanExtensionArithmetic$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int): void
private synthetic final method booleanExtensionArithmetic$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater): void
private synthetic final static method getA$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA$volatile(): int
private synthetic final static method getB$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getB$volatile(): int
private synthetic final static method getL$volatile$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic final method getL$volatile(): long
private synthetic final static method getS$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getS$volatile(): java.lang.Object
private synthetic final method intExtensionArithmetic$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int): void
private synthetic final method intExtensionArithmetic$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater): void
private synthetic final method longExtensionArithmetic$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicLongArray, p2: int): void
private synthetic final method longExtensionArithmetic$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicLongFieldUpdater): void
private synthetic final method refExtension$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int): void
private synthetic final method refExtension$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater): void
private synthetic final method setA$volatile(p0: int): void
private synthetic final method setB$volatile(p0: int): void
private synthetic final method setL$volatile(p0: long): void
private synthetic final method setS$volatile(p0: java.lang.Object): 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
}
@@ -18,7 +18,7 @@ class InlineExtensionWithTypeParameterTest {
return cur.id return cur.id
} }
val sref = atomic(SemaphoreSegment(0)) private val sref = atomic(SemaphoreSegment(0))
fun testInlineExtensionWithTypeParameter() { fun testInlineExtensionWithTypeParameter() {
val s = SemaphoreSegment(77) val s = SemaphoreSegment(77)
@@ -30,4 +30,4 @@ fun box(): String {
val testClass = InlineExtensionWithTypeParameterTest() val testClass = InlineExtensionWithTypeParameterTest()
testClass.testInlineExtensionWithTypeParameter() testClass.testInlineExtensionWithTypeParameter()
return "OK" return "OK"
} }
@@ -18,15 +18,16 @@ public final class InlineExtensionWithTypeParameterTest$SemaphoreSegment {
@kotlin.Metadata @kotlin.Metadata
public final class InlineExtensionWithTypeParameterTest { public final class InlineExtensionWithTypeParameterTest {
// source: 'InlineExtensionWithTypeParameterTest.kt' // source: 'InlineExtensionWithTypeParameterTest.kt'
private final static @org.jetbrains.annotations.NotNull field sref$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater private synthetic final static field sref$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field sref: java.lang.Object private synthetic volatile field sref$volatile: java.lang.Object
static method <clinit>(): void static method <clinit>(): void
public method <init>(): void public method <init>(): void
private final method foo$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int, p3: int, p4: InlineExtensionWithTypeParameterTest$Segment): int private synthetic final method foo$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int, p3: int, p4: InlineExtensionWithTypeParameterTest$Segment): int
private final method foo$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p2: int, p3: InlineExtensionWithTypeParameterTest$Segment): int private synthetic final method foo$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p2: int, p3: InlineExtensionWithTypeParameterTest$Segment): int
private final method getSegmentId(p0: 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 private synthetic final static method getSref$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
public final @org.jetbrains.annotations.Nullable method getSref(): java.lang.Object private synthetic final method getSref$volatile(): java.lang.Object
private synthetic final method setSref$volatile(p0: java.lang.Object): void
public final method testInlineExtensionWithTypeParameter(): void public final method testInlineExtensionWithTypeParameter(): void
public abstract inner class InlineExtensionWithTypeParameterTest$Segment public abstract inner class InlineExtensionWithTypeParameterTest$Segment
public final inner class InlineExtensionWithTypeParameterTest$SemaphoreSegment public final inner class InlineExtensionWithTypeParameterTest$SemaphoreSegment
@@ -0,0 +1,52 @@
import kotlinx.atomicfu.*
import kotlin.test.*
class LambdaTest {
private val a = atomic(0)
private val rs = atomic<String>("bbbb")
private inline fun <T> inlineLambda(
arg: T,
crossinline block: (T) -> 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 loopInLambda2Ref(to: String) = inlineLambda(to) { arg1 ->
inlineLambda(arg1) sc@ { arg2 ->
rs.loop { value ->
rs.compareAndSet(value, arg2)
return@sc
}
}
}
fun test() {
loopInLambda1(34)
assertEquals(34, a.value)
loopInLambda1(77)
assertEquals(77, a.value)
loopInLambda2Ref("bbb")
assertEquals("bbb", rs.value)
}
}
fun box(): String {
val testClass = LambdaTest()
testClass.test()
return "OK"
}
@@ -0,0 +1,31 @@
@kotlin.Metadata
public final class LambdaTest {
// source: 'LambdaTest.kt'
private synthetic final static field a$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field a$volatile: int
private synthetic final static field rs$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field rs$volatile: java.lang.Object
static method <clinit>(): void
public method <init>(): void
public synthetic final static method access$getA$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
public synthetic final static method access$getRs$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final static method getA$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA$volatile(): int
private synthetic final static method getRs$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getRs$volatile(): java.lang.Object
private final method inlineLambda(p0: java.lang.Object, p1: kotlin.jvm.functions.Function1): void
private synthetic final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private synthetic final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
public final method loopInLambda1(p0: int): void
public final method loopInLambda2(p0: int): void
public final method loopInLambda2Ref(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
private synthetic final method setA$volatile(p0: int): void
private synthetic final method setRs$volatile(p0: java.lang.Object): void
public final method test(): void
}
@kotlin.Metadata
public final class LambdaTestKt {
// source: 'LambdaTest.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -1,16 +1,19 @@
@kotlin.Metadata @kotlin.Metadata
public final class LockFreeIntBits { public final class LockFreeIntBits {
// source: 'LockFreeIntBitsTest.kt' // source: 'LockFreeIntBitsTest.kt'
private final static @org.jetbrains.annotations.NotNull field bits$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater private synthetic final static field bits$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private volatile @kotlin.jvm.Volatile field bits: int private synthetic volatile field bits$volatile: int
static method <clinit>(): void static method <clinit>(): void
public method <init>(): void public method <init>(): void
public final method bitClear(p0: int): boolean public final method bitClear(p0: int): boolean
public final method bitSet(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 private final method bitUpdate(p0: kotlin.jvm.functions.Function1, p1: kotlin.jvm.functions.Function1): boolean
public final method get(p0: int): boolean public final method get(p0: int): boolean
private synthetic final static method getBits$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getBits$volatile(): int
private final method mask(p0: int): int private final method mask(p0: int): int
private final method update$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void private synthetic final method setBits$volatile(p0: int): void
private synthetic final method update$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
} }
@kotlin.Metadata @kotlin.Metadata
@@ -0,0 +1,21 @@
@kotlin.Metadata
public final class LockTest {
// source: 'LockTest.kt'
private synthetic final static field inProgressLock$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field inProgressLock$volatile: int
static method <clinit>(): void
public method <init>(): void
private synthetic final static method getInProgressLock$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getInProgressLock$volatile(): int
private synthetic final method setInProgressLock$volatile(p0: int): 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
private synthetic final static method tryAcquire$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerArray, p2: int): boolean
private synthetic final static method tryAcquire$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicIntegerFieldUpdater): boolean
}
@@ -0,0 +1,22 @@
@kotlin.Metadata
public final class ParameterizedInlineFunExtensionTest {
// source: 'ParameterizedInlineFunExtensionTest.kt'
private synthetic final static field tail$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field tail$volatile: java.lang.Object
static method <clinit>(): void
public method <init>(): void
private synthetic final method bar$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int, p3: java.lang.Object, p4: java.lang.Object): java.lang.Object
private synthetic final method bar$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p2: java.lang.Object, p3: java.lang.Object): java.lang.Object
private synthetic final method foo$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int, p3: java.lang.Object, p4: java.lang.Object, p5: kotlin.jvm.functions.Function1): java.lang.Object
private synthetic final method foo$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p2: java.lang.Object, p3: java.lang.Object, p4: kotlin.jvm.functions.Function1): java.lang.Object
private synthetic final static method getTail$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getTail$volatile(): java.lang.Object
private synthetic final method setTail$volatile(p0: java.lang.Object): void
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,130 @@
import kotlinx.atomicfu.*
import kotlin.test.*
class IntArithmetic {
private val _x = atomic(0)
val x get() = _x.value
private val local = atomic(0)
private fun testGetValue() {
_x.value = 5
assertEquals(5, _x.value)
var aValue = _x.value
assertEquals(5, aValue)
assertEquals(5, x)
local.value = 555
aValue = local.value
assertEquals(aValue, local.value)
}
private fun testAtomicCallPlaces() {
_x.value = 5
_x.compareAndSet(5, 42)
val res = _x.compareAndSet(42, 45)
assertTrue(res)
assertTrue(_x.compareAndSet(45, 77))
assertFalse(_x.compareAndSet(95, 77))
assertTrue(_x.compareAndSet(77, 88))
}
private fun testInt() {
_x.value = 0
assertEquals(0, x)
val update = 3
assertEquals(0, _x.getAndSet(update))
assertTrue(_x.compareAndSet(update, 8))
_x.lazySet(1)
assertEquals(1, x)
assertEquals(1, _x.getAndSet(2))
assertEquals(2, x)
assertEquals(2, _x.getAndIncrement())
assertEquals(3, x)
assertEquals(3, _x.getAndDecrement())
assertEquals(2, x)
assertEquals(2, _x.getAndAdd(2))
assertEquals(4, x)
assertEquals(7, _x.addAndGet(3))
assertEquals(7, x)
assertEquals(8, _x.incrementAndGet())
assertEquals(8, x)
assertEquals(7, _x.decrementAndGet())
assertEquals(7, x)
assertTrue(_x.compareAndSet(7, 10))
}
fun test() {
testGetValue()
testAtomicCallPlaces()
testInt()
}
}
class LongArithmetic {
private val _x = atomic(4294967296)
val x get() = _x.value
private val y = atomic(5000000000)
private val z = atomic(2424920024888888848)
private val max = atomic(9223372036854775807)
fun testLong() {
assertEquals(2424920024888888848, z.value)
z.lazySet(8424920024888888848)
assertEquals(8424920024888888848, z.value)
assertEquals(8424920024888888848, z.getAndSet(8924920024888888848))
assertEquals(8924920024888888848, z.value)
assertEquals(8924920024888888849, z.incrementAndGet())
assertEquals(8924920024888888849, z.value)
assertEquals(8924920024888888849, z.getAndDecrement())
assertEquals(8924920024888888848, z.value)
assertEquals(8924920024888888848, z.getAndAdd(100000000000000000))
assertEquals(9024920024888888848, z.value)
assertEquals(-198452011965886959, z.addAndGet(-9223372036854775807))
assertEquals(-198452011965886959, z.value)
assertEquals(-198452011965886958, z.incrementAndGet())
assertEquals(-198452011965886958, z.value)
assertEquals(-198452011965886959, z.decrementAndGet())
assertEquals(-198452011965886959, z.value)
}
}
class BooleanArithmetic {
private val _x = atomic(false)
val x get() = _x.value
fun testBoolean() {
assertEquals(false, _x.value)
assertFalse(x)
_x.lazySet(true)
assertTrue(x)
assertTrue(_x.getAndSet(true))
assertTrue(_x.compareAndSet(true, false))
assertFalse(x)
}
}
class ReferenceArithmetic {
private val _x = atomic<String?>(null)
fun testReference() {
_x.value = "aaa"
assertEquals("aaa", _x.value)
_x.lazySet("bb")
assertEquals("bb", _x.value)
assertEquals("bb", _x.getAndSet("ccc"))
assertEquals("ccc", _x.value)
}
}
fun box(): String {
val intClass = IntArithmetic()
intClass.test()
val longClass = LongArithmetic()
longClass.testLong()
val booleanClass = BooleanArithmetic()
booleanClass.testBoolean()
val refClass = ReferenceArithmetic()
refClass.testReference()
return "OK"
}
@@ -0,0 +1,83 @@
@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 synthetic final static field _x$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field _x$volatile: int
static method <clinit>(): void
public method <init>(): void
public final method getX(): boolean
private synthetic final static method get_x$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method get_x$volatile(): int
private synthetic final method set_x$volatile(p0: int): void
public final method testBoolean(): void
}
@kotlin.Metadata
public final class IntArithmetic {
// source: 'ArithmeticTest.kt'
private synthetic final static field _x$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field _x$volatile: int
private synthetic final static field local$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field local$volatile: int
static method <clinit>(): void
public method <init>(): void
private synthetic final static method getLocal$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getLocal$volatile(): int
public final method getX(): int
private synthetic final static method get_x$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method get_x$volatile(): int
private synthetic final method setLocal$volatile(p0: int): void
private synthetic final method set_x$volatile(p0: int): void
public final method test(): void
private final method testAtomicCallPlaces(): void
private final method testGetValue(): void
private final method testInt(): void
}
@kotlin.Metadata
public final class LongArithmetic {
// source: 'ArithmeticTest.kt'
private synthetic final static field _x$volatile$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic volatile field _x$volatile: long
private synthetic final static field max$volatile$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic volatile field max$volatile: long
private synthetic final static field y$volatile$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic volatile field y$volatile: long
private synthetic final static field z$volatile$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic volatile field z$volatile: long
static method <clinit>(): void
public method <init>(): void
private synthetic final static method getMax$volatile$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic final method getMax$volatile(): long
public final method getX(): long
private synthetic final static method getY$volatile$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic final method getY$volatile(): long
private synthetic final static method getZ$volatile$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic final method getZ$volatile(): long
private synthetic final static method get_x$volatile$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic final method get_x$volatile(): long
private synthetic final method setMax$volatile(p0: long): void
private synthetic final method setY$volatile(p0: long): void
private synthetic final method setZ$volatile(p0: long): void
private synthetic final method set_x$volatile(p0: long): void
public final method testLong(): void
}
@kotlin.Metadata
public final class ReferenceArithmetic {
// source: 'ArithmeticTest.kt'
private synthetic final static field _x$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field _x$volatile: java.lang.Object
static method <clinit>(): void
public method <init>(): void
private synthetic final static method get_x$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method get_x$volatile(): java.lang.Object
private synthetic final method set_x$volatile(p0: java.lang.Object): void
public final method testReference(): void
}
@@ -87,13 +87,13 @@ class AtomicArrayTest {
} }
} }
class AtomicArrayClass { private class AtomicArrayClass {
val intArr = AtomicIntArray(10) val intArr = AtomicIntArray(10)
val longArr = AtomicLongArray(10) val longArr = AtomicLongArray(10)
val booleanArr = AtomicBooleanArray(10) val booleanArr = AtomicBooleanArray(10)
val refArr = atomicArrayOfNulls<ARef>(10) val refArr = atomicArrayOfNulls<ARef>(10)
val anyArr = atomicArrayOfNulls<Any?>(10) val anyArr = atomicArrayOfNulls<Any?>(10)
val a = atomic(ARef(8)) internal val a = atomic(ARef(8))
} }
data class ARef(val n: Int) data class ARef(val n: Int)
@@ -106,4 +106,4 @@ fun box(): String {
testClass.testRefArray() testClass.testRefArray()
testClass.testAnyArray() testClass.testAnyArray()
return "OK" return "OK"
} }
@@ -0,0 +1,53 @@
@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
final class AtomicArrayClass {
// source: 'AtomicArrayTest.kt'
private synthetic final static field a$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field a$volatile: java.lang.Object
private synthetic final field anyArr: java.util.concurrent.atomic.AtomicReferenceArray
private synthetic final field booleanArr: java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final field intArr: java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final field longArr: java.util.concurrent.atomic.AtomicLongArray
private synthetic final field refArr: java.util.concurrent.atomic.AtomicReferenceArray
static method <clinit>(): void
public method <init>(): void
public synthetic final static method access$getA$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final static method getA$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getA$volatile(): java.lang.Object
public synthetic final method getAnyArr(): java.util.concurrent.atomic.AtomicReferenceArray
public synthetic final method getBooleanArr(): java.util.concurrent.atomic.AtomicIntegerArray
public synthetic final method getIntArr(): java.util.concurrent.atomic.AtomicIntegerArray
public synthetic final method getLongArr(): java.util.concurrent.atomic.AtomicLongArray
public synthetic final method getRefArr(): java.util.concurrent.atomic.AtomicReferenceArray
private synthetic final method setA$volatile(p0: java.lang.Object): void
}
@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
}
@@ -19,7 +19,7 @@ class IndexArrayElementGetterTest {
assertEquals(100, clazz.longArr[(fib(4) + fib(5)) % fib(5)].value) assertEquals(100, clazz.longArr[(fib(4) + fib(5)) % fib(5)].value)
} }
class AtomicArrayClass { private class AtomicArrayClass {
val intArr = AtomicIntArray(10) val intArr = AtomicIntArray(10)
val longArr = AtomicLongArray(10) val longArr = AtomicLongArray(10)
} }
@@ -29,4 +29,4 @@ fun box(): String {
val testClass = IndexArrayElementGetterTest() val testClass = IndexArrayElementGetterTest()
testClass.testIndexArrayElementGetting() testClass.testIndexArrayElementGetting()
return "OK" return "OK"
} }
@@ -0,0 +1,26 @@
@kotlin.Metadata
final class IndexArrayElementGetterTest$AtomicArrayClass {
// source: 'IndexArrayElementGetterTest.kt'
private synthetic final field intArr: java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final field longArr: java.util.concurrent.atomic.AtomicLongArray
public method <init>(): void
public synthetic final method getIntArr(): java.util.concurrent.atomic.AtomicIntegerArray
public synthetic final method getLongArr(): java.util.concurrent.atomic.AtomicLongArray
private 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
private 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
}
@@ -0,0 +1,33 @@
import kotlinx.atomicfu.*
import kotlin.test.*
private class AAA {
private val _counter = atomic(5L)
val counterValue: Long get() = _counter.value
val delegateCounterValue by _counter
val lateInitInt: AtomicInt
val intArr: AtomicIntArray
// test ensures that transformation does not change the order of initialization
init {
lateInitInt = atomic(10)
assertTrue(lateInitInt.compareAndSet(10, 100))
assertEquals(100, lateInitInt.value)
intArr = AtomicIntArray(10)
intArr[0].value = 10
assertTrue(intArr[0].compareAndSet(10, 100))
intArr[1].value = 20
}
init {
assertEquals(5L, _counter.value)
assertEquals(5L,counterValue)
assertEquals(5L, delegateCounterValue)
assertEquals(120, intArr[0].value + intArr[1].value)
}
}
fun box(): String {
val intClass = AAA()
return "OK"
}
@@ -0,0 +1,26 @@
@kotlin.Metadata
final class AAA {
// source: 'InitializationOrderTest.kt'
private synthetic final static field _counter$volatile$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic volatile field _counter$volatile: long
private synthetic final field intArr: java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final static field lateInitInt$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field lateInitInt$volatile: int
static method <clinit>(): void
public method <init>(): void
public final method getCounterValue(): long
public final method getDelegateCounterValue(): long
public synthetic final method getIntArr(): java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final static method getLateInitInt$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getLateInitInt$volatile(): int
private synthetic final static method get_counter$volatile$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic final method get_counter$volatile(): long
private synthetic final method setLateInitInt$volatile(p0: int): void
private synthetic final method set_counter$volatile(p0: long): void
}
@kotlin.Metadata
public final class InitializationOrderTestKt {
// source: 'InitializationOrderTest.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -0,0 +1,42 @@
@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 synthetic final static field a$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field a$volatile: int
private synthetic final static field dataRef$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field dataRef$volatile: java.lang.Object
private synthetic final static field head$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field head$volatile: java.lang.Object
private synthetic final field lateIntArr: java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final field lateRefArr: java.util.concurrent.atomic.AtomicReferenceArray
static method <clinit>(): void
public method <init>(): void
private synthetic final static method getA$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA$volatile(): int
private synthetic final static method getDataRef$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getDataRef$volatile(): java.lang.Object
private synthetic final static method getHead$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getHead$volatile(): java.lang.Object
private synthetic final method getLateIntArr(): java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final method getLateRefArr(): java.util.concurrent.atomic.AtomicReferenceArray
private synthetic final method setA$volatile(p0: int): void
private synthetic final method setDataRef$volatile(p0: java.lang.Object): void
private synthetic final method setHead$volatile(p0: java.lang.Object): 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
}
@@ -10,15 +10,18 @@ final class LockFreeLongCounter$Inner {
@kotlin.Metadata @kotlin.Metadata
public final class LockFreeLongCounter { public final class LockFreeLongCounter {
// source: 'LockFreeLongCounterTest.kt' // source: 'LockFreeLongCounterTest.kt'
private final static @org.jetbrains.annotations.NotNull field counter$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater private synthetic final static field counter$volatile$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
private volatile @kotlin.jvm.Volatile field counter: long private synthetic volatile field counter$volatile: long
static method <clinit>(): void static method <clinit>(): void
public method <init>(): void public method <init>(): void
public synthetic final static method access$getCounter$FU$p(): java.util.concurrent.atomic.AtomicLongFieldUpdater public synthetic final static method access$getCounter$volatile$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
public final method add2(): long public final method add2(): long
public final method get(): long public final method get(): long
private synthetic final static method getCounter$volatile$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic final method getCounter$volatile(): long
public final method getInner(): long public final method getInner(): long
public final method increment(): long public final method increment(): long
private synthetic final method setCounter$volatile(p0: long): void
public final method setM2(): void public final method setM2(): void
private final inner class LockFreeLongCounter$Inner private final inner class LockFreeLongCounter$Inner
} }
@@ -52,4 +52,4 @@ fun box(): String {
val testClass = LockFreeQueueTest() val testClass = LockFreeQueueTest()
testClass.testBasic() testClass.testBasic()
return "OK" return "OK"
} }
@@ -0,0 +1,49 @@
@kotlin.Metadata
final class LockFreeQueue$Node {
// source: 'LockFreeQueueTest.kt'
private synthetic final static field next$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field next$volatile: java.lang.Object
private final field value: int
static method <clinit>(): void
public method <init>(p0: int): void
public synthetic final static method access$getNext$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final static method getNext$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getNext$volatile(): java.lang.Object
public final method getValue(): int
private synthetic final method setNext$volatile(p0: java.lang.Object): void
private final inner class LockFreeQueue$Node
}
@kotlin.Metadata
public final class LockFreeQueue {
// source: 'LockFreeQueueTest.kt'
private synthetic final static field head$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field head$volatile: java.lang.Object
private synthetic final static field tail$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field tail$volatile: java.lang.Object
static method <clinit>(): void
public method <init>(): void
public final method dequeue(): int
public final method enqueue(p0: int): void
private synthetic final static method getHead$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getHead$volatile(): java.lang.Object
private synthetic final static method getTail$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getTail$volatile(): java.lang.Object
private synthetic final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private synthetic final method setHead$volatile(p0: java.lang.Object): void
private synthetic final method setTail$volatile(p0: 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
}
@@ -12,19 +12,22 @@ final class LockFreeStack$Node {
@kotlin.Metadata @kotlin.Metadata
public final class LockFreeStack { public final class LockFreeStack {
// source: 'LockFreeStackTest.kt' // source: 'LockFreeStackTest.kt'
private final static @org.jetbrains.annotations.NotNull field top$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater private synthetic final static field top$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field top: java.lang.Object private synthetic volatile field top$volatile: java.lang.Object
static method <clinit>(): void static method <clinit>(): void
public method <init>(): void public method <init>(): void
public final method clear(): void public final method clear(): void
private final method getAndUpdate$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): java.lang.Object private synthetic final method getAndUpdate$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): java.lang.Object
private synthetic final static method getTop$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getTop$volatile(): java.lang.Object
public final method isEmpty(): boolean public final method isEmpty(): boolean
private final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void private synthetic final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
public final @org.jetbrains.annotations.Nullable method popLoop(): java.lang.Object public final @org.jetbrains.annotations.Nullable method popLoop(): java.lang.Object
public final @org.jetbrains.annotations.Nullable method popUpdate(): 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 pushLoop(p0: java.lang.Object): void
public final method pushUpdate(p0: java.lang.Object): void public final method pushUpdate(p0: java.lang.Object): void
private final method update$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void private synthetic final method setTop$volatile(p0: java.lang.Object): void
private synthetic final method update$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private final inner class LockFreeStack$Node private final inner class LockFreeStack$Node
} }
@@ -2,12 +2,12 @@ import kotlinx.atomicfu.*
import kotlin.test.* import kotlin.test.*
class LoopTest { class LoopTest {
val a = atomic(0) private val a = atomic(0)
val a1 = atomic(1) private val a1 = atomic(1)
val b = atomic(true) private val b = atomic(true)
val l = atomic(5000000000) private val l = atomic(5000000000)
val r = atomic<A>(A("aaaa")) private val r = atomic<A>(A("aaaa"))
val rs = atomic<String>("bbbb") private val rs = atomic<String>("bbbb")
class A(val s: String) class A(val s: String)
@@ -49,7 +49,7 @@ class LoopTest {
} }
} }
inline fun atomicfuLoopTest() { fun atomicfuLoopTest() {
atomicfuIntLoopTest() atomicfuIntLoopTest()
assertEquals(777, a.value) assertEquals(777, a.value)
atomicfuBooleanLoopTest() atomicfuBooleanLoopTest()
@@ -0,0 +1,72 @@
@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 synthetic final static field a$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field a$volatile: int
private synthetic final static field a1$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field a1$volatile: int
private synthetic final static field b$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field b$volatile: int
private synthetic final static field l$volatile$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic volatile field l$volatile: long
private synthetic final static field r$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field r$volatile: java.lang.Object
private synthetic final static field rs$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field rs$volatile: 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
private synthetic final static method getA$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA$volatile(): int
private synthetic final static method getA1$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA1$volatile(): int
private synthetic final method getAndUpdate$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): int
private synthetic final method getAndUpdate$atomicfu(p0: java.util.concurrent.atomic.AtomicLongFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): long
private synthetic final method getAndUpdate$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): java.lang.Object
private synthetic final static method getB$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getB$volatile(): int
private synthetic final static method getL$volatile$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic final method getL$volatile(): long
private synthetic final static method getR$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getR$volatile(): java.lang.Object
private synthetic final static method getRs$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getRs$volatile(): java.lang.Object
private synthetic final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private synthetic final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicLongFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private synthetic final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private synthetic final method setA$volatile(p0: int): void
private synthetic final method setA1$volatile(p0: int): void
private synthetic final method setB$volatile(p0: int): void
private synthetic final method setL$volatile(p0: long): void
private synthetic final method setR$volatile(p0: java.lang.Object): void
private synthetic final method setRs$volatile(p0: java.lang.Object): void
private synthetic final method update$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private synthetic final method update$atomicfu(p0: java.util.concurrent.atomic.AtomicLongFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private synthetic final method update$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private synthetic final method updateAndGet$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): int
private synthetic final method updateAndGet$atomicfu(p0: java.util.concurrent.atomic.AtomicLongFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): long
private synthetic final method updateAndGet$atomicfu(p0: java.util.concurrent.atomic.AtomicReferenceFieldUpdater, p1: kotlin.jvm.functions.Function1, 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
}
@@ -11,14 +11,20 @@ public final class MultiInit$Companion {
public final class MultiInit { public final class MultiInit {
// source: 'MultiInitTest.kt' // source: 'MultiInitTest.kt'
public final static @org.jetbrains.annotations.NotNull field Companion: MultiInit$Companion 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 synthetic final static field a$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private volatile @kotlin.jvm.Volatile field a: int private synthetic volatile field a$volatile: int
private final static @org.jetbrains.annotations.NotNull field b$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater private synthetic final static field b$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private volatile @kotlin.jvm.Volatile field b: int private synthetic volatile field b$volatile: int
static method <clinit>(): void static method <clinit>(): void
public method <init>(): void public method <init>(): void
private synthetic final static method getA$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA$volatile(): int
private synthetic final static method getB$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getB$volatile(): int
public final method incA(): int public final method incA(): int
public final method incB(): int public final method incB(): int
private synthetic final method setA$volatile(p0: int): void
private synthetic final method setB$volatile(p0: int): void
public final inner class MultiInit$Companion public final inner class MultiInit$Companion
} }
@@ -23,7 +23,7 @@ class D (val e: E)
class E (val x: Int) class E (val x: Int)
class AtomicState(value: Any) { private class AtomicState(value: Any) {
val state = atomic<Any?>(value) val state = atomic<Any?>(value)
} }
@@ -42,4 +42,4 @@ fun box(): String {
val testClass = ScopeTest() val testClass = ScopeTest()
testClass.scopeTest() testClass.scopeTest()
return "OK" return "OK"
} }
@@ -13,14 +13,16 @@ public final class AA {
} }
@kotlin.Metadata @kotlin.Metadata
public final class AtomicState { final class AtomicState {
// source: 'ScopeTest.kt' // source: 'ScopeTest.kt'
private final static @org.jetbrains.annotations.NotNull field state$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater private synthetic final static field state$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field state: java.lang.Object private synthetic volatile field state$volatile: java.lang.Object
static method <clinit>(): void static method <clinit>(): void
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.Object): 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 synthetic final static method access$getState$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
public final @org.jetbrains.annotations.Nullable method getState(): java.lang.Object private synthetic final static method getState$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getState$volatile(): java.lang.Object
private synthetic final method setState$volatile(p0: java.lang.Object): void
} }
@kotlin.Metadata @kotlin.Metadata
@@ -1,11 +1,14 @@
@kotlin.Metadata @kotlin.Metadata
public final class SimpleLock { public final class SimpleLock {
// source: 'SimpleLockTest.kt' // source: 'SimpleLockTest.kt'
private final static @org.jetbrains.annotations.NotNull field _locked$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater private synthetic final static field _locked$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private volatile @kotlin.jvm.Volatile field _locked: int private synthetic volatile field _locked$volatile: int
static method <clinit>(): void static method <clinit>(): void
public method <init>(): void public method <init>(): void
private final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void private synthetic final static method get_locked$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method get_locked$volatile(): int
private synthetic final method loop$atomicfu(p0: java.util.concurrent.atomic.AtomicIntegerFieldUpdater, p1: kotlin.jvm.functions.Function1, p2: java.lang.Object): void
private synthetic final method set_locked$volatile(p0: int): void
public final method withLock(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object public final method withLock(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object
} }
@@ -0,0 +1,65 @@
@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
synthetic final class UncheckedCastTest$VolatileWrapper$atomicfu$private {
// source: 'UncheckedCastTest.kt'
private synthetic final static field topLevelS$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field topLevelS$volatile: java.lang.Object
static method <clinit>(): void
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic final static method access$getTopLevelS$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final static method getTopLevelS$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getTopLevelS$volatile(): java.lang.Object
private synthetic final method setTopLevelS$volatile(p0: java.lang.Object): void
}
@kotlin.Metadata
public final class UncheckedCastTest {
// source: 'UncheckedCastTest.kt'
private synthetic final field a: java.util.concurrent.atomic.AtomicReferenceArray
private synthetic final static field bs$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field bs$volatile: java.lang.Object
private synthetic final static field s$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field s$volatile: java.lang.Object
static method <clinit>(): void
public method <init>(): void
private synthetic final method getA(): java.util.concurrent.atomic.AtomicReferenceArray
private synthetic final static method getBs$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getBs$volatile(): java.lang.Object
private synthetic final static method getS$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getS$volatile(): java.lang.Object
private synthetic final method getString$atomicfu$array(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceArray, p2: int): java.lang.String
private synthetic final method getString$atomicfu(p0: java.lang.Object, p1: java.util.concurrent.atomic.AtomicReferenceFieldUpdater): java.lang.String
private synthetic final method setBs$volatile(p0: java.lang.Object): void
private synthetic final method setS$volatile(p0: java.lang.Object): void
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'
private synthetic final static field uncheckedCastTest$VolatileWrapper$atomicfu$private: UncheckedCastTest$VolatileWrapper$atomicfu$private
static method <clinit>(): void
public synthetic final static method access$getUncheckedCastTest$VolatileWrapper$atomicfu$private(): UncheckedCastTest$VolatileWrapper$atomicfu$private
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
private synthetic final static method getUncheckedCastTest$VolatileWrapper$atomicfu$private(): UncheckedCastTest$VolatileWrapper$atomicfu$private
}
@@ -104,22 +104,12 @@ class DelegatedProperties {
assertEquals(99, vRef.b.n) assertEquals(99, vRef.b.n)
} }
inner class D {
var c by atomic("aaa")
}
fun testScopedVolatileProperties() {
val clazz = D()
assertEquals("aaa", clazz.c)
clazz.c = "bbb"
assertEquals("bbb", clazz.c)
}
fun testDelegatedVariablesFlow() { fun testDelegatedVariablesFlow() {
_a.lazySet(55) _a.lazySet(55)
assertEquals(55, _a.value) assertEquals(55, _a.value)
assertEquals(55, a) assertEquals(55, a)
var aValue = a var aValue = a
assertEquals(55, aValue)
} }
fun test() { fun test() {
@@ -131,7 +121,6 @@ class DelegatedProperties {
testVolatileBoolean() testVolatileBoolean()
testVolatileLong() testVolatileLong()
testVolatileRef() testVolatileRef()
testScopedVolatileProperties()
testDelegatedVariablesFlow() testDelegatedVariablesFlow()
} }
} }
@@ -17,32 +17,21 @@ public final class DelegatedProperties$B {
public final inner class DelegatedProperties$B 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 @org.jetbrains.annotations.NotNull method getC(): java.lang.String
public final method setC(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
public final inner class DelegatedProperties$D
}
@kotlin.Metadata @kotlin.Metadata
public final class DelegatedProperties { public final class DelegatedProperties {
// source: 'DelegatedPropertiesTest.kt' // source: 'DelegatedPropertiesTest.kt'
private final static @org.jetbrains.annotations.NotNull field _a$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater private synthetic final static field _a$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private volatile @kotlin.jvm.Volatile field _a: int private synthetic volatile field _a$volatile: int
private final static @org.jetbrains.annotations.NotNull field _b$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater private synthetic final static field _b$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private volatile @kotlin.jvm.Volatile field _b: int private synthetic volatile field _b$volatile: int
private final static @org.jetbrains.annotations.NotNull field _l$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater private synthetic final static field _l$volatile$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
private volatile @kotlin.jvm.Volatile field _l: long private synthetic volatile field _l$volatile: long
private final static @org.jetbrains.annotations.NotNull field _ref$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater private synthetic final static field _ref$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field _ref: java.lang.Object private synthetic volatile field _ref$volatile: java.lang.Object
private volatile @kotlin.jvm.Volatile field vBoolean: int private synthetic volatile field vBoolean$volatile: boolean
private volatile @kotlin.jvm.Volatile field vInt: int private synthetic volatile field vInt$volatile: int
private volatile @kotlin.jvm.Volatile field vLong: int private synthetic volatile field vLong$volatile: int
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field vRef: java.lang.Object private synthetic volatile field vRef$volatile: java.lang.Object
static method <clinit>(): void static method <clinit>(): void
public method <init>(): void public method <init>(): void
public final method getA(): int public final method getA(): int
@@ -54,6 +43,14 @@ public final class DelegatedProperties {
private final method getVInt(): int private final method getVInt(): int
private final method getVLong(): int private final method getVLong(): int
private final method getVRef(): DelegatedProperties$A private final method getVRef(): DelegatedProperties$A
private synthetic final static method get_a$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method get_a$volatile(): int
private synthetic final static method get_b$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method get_b$volatile(): int
private synthetic final static method get_l$volatile$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic final method get_l$volatile(): long
private synthetic final static method get_ref$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method get_ref$volatile(): java.lang.Object
public final method setA(p0: int): void public final method setA(p0: int): void
private final method setB(p0: boolean): void private final method setB(p0: boolean): void
private final method setL(p0: long): void private final method setL(p0: long): void
@@ -63,29 +60,48 @@ public final class DelegatedProperties {
private final method setVInt(p0: int): void private final method setVInt(p0: int): void
private final method setVLong(p0: int): void private final method setVLong(p0: int): void
private final method setVRef(p0: DelegatedProperties$A): void private final method setVRef(p0: DelegatedProperties$A): void
private synthetic final method set_a$volatile(p0: int): void
private synthetic final method set_b$volatile(p0: int): void
private synthetic final method set_l$volatile(p0: long): void
private synthetic final method set_ref$volatile(p0: java.lang.Object): void
public final method test(): void public final method test(): void
public final method testDelegatedAtomicBoolean(): void public final method testDelegatedAtomicBoolean(): void
public final method testDelegatedAtomicInt(): void public final method testDelegatedAtomicInt(): void
public final method testDelegatedAtomicLong(): void public final method testDelegatedAtomicLong(): void
public final method testDelegatedAtomicRef(): void public final method testDelegatedAtomicRef(): void
public final method testDelegatedVariablesFlow(): void public final method testDelegatedVariablesFlow(): void
public final method testScopedVolatileProperties(): void
public final method testVolatileBoolean(): void public final method testVolatileBoolean(): void
public final method testVolatileInt(): void public final method testVolatileInt(): void
public final method testVolatileLong(): void public final method testVolatileLong(): void
public final method testVolatileRef(): void public final method testVolatileRef(): void
public final inner class DelegatedProperties$A public final inner class DelegatedProperties$A
public final inner class DelegatedProperties$B public final inner class DelegatedProperties$B
public final inner class DelegatedProperties$D }
@kotlin.Metadata
synthetic final class DelegatedPropertiesTest$VolatileWrapper$atomicfu$private {
// source: 'DelegatedPropertiesTest.kt'
private synthetic final static field _topLevelInt$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field _topLevelInt$volatile: int
static method <clinit>(): void
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic final static method access$get_topLevelInt$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
public synthetic final static method access$get_topLevelInt$volatile$p(p0: DelegatedPropertiesTest$VolatileWrapper$atomicfu$private): int
public synthetic final static method access$set_topLevelInt$volatile$p(p0: DelegatedPropertiesTest$VolatileWrapper$atomicfu$private, p1: int): void
private synthetic final static method get_topLevelInt$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method get_topLevelInt$volatile(): int
private synthetic final method set_topLevelInt$volatile(p0: int): void
} }
@kotlin.Metadata @kotlin.Metadata
public final class DelegatedPropertiesTestKt { public final class DelegatedPropertiesTestKt {
// source: 'DelegatedPropertiesTest.kt' // source: 'DelegatedPropertiesTest.kt'
private final static @org.jetbrains.annotations.NotNull field _topLevelInt$DelegatedPropertiesTest$VolatileWrapper: _topLevelInt$DelegatedPropertiesTest$VolatileWrapper private synthetic final static field delegatedPropertiesTest$VolatileWrapper$atomicfu$private: DelegatedPropertiesTest$VolatileWrapper$atomicfu$private
private volatile static @kotlin.jvm.Volatile field topLevelVolatile: int private synthetic volatile static field topLevelVolatile$volatile: int
static method <clinit>(): void static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
private synthetic final static method getDelegatedPropertiesTest$VolatileWrapper$atomicfu$private(): DelegatedPropertiesTest$VolatileWrapper$atomicfu$private
public final static method getTopLevelInt(): int public final static method getTopLevelInt(): int
private final static method getTopLevelVolatile(): int private final static method getTopLevelVolatile(): int
public final static method setTopLevelInt(p0: int): void public final static method setTopLevelInt(p0: int): void
@@ -93,16 +109,3 @@ public final class DelegatedPropertiesTestKt {
public final static method testTopLevelDelegatedProperties(): void public final static method testTopLevelDelegatedProperties(): void
public final static method testTopLevelVolatileProperties(): void public final static method testTopLevelVolatileProperties(): void
} }
@kotlin.Metadata
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
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): 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
}
@@ -2,7 +2,7 @@ import kotlinx.atomicfu.*
import kotlin.test.* import kotlin.test.*
import kotlin.random.* import kotlin.random.*
object Provider { private object Provider {
private val port = atomic(Random.nextInt(20, 90) * 100) private val port = atomic(Random.nextInt(20, 90) * 100)
fun next(): Int = port.incrementAndGet() fun next(): Int = port.incrementAndGet()
@@ -18,8 +18,8 @@ object Provider {
val refArr = atomicArrayOfNulls<Any?>(5) val refArr = atomicArrayOfNulls<Any?>(5)
} }
object DelegatedProvider { private object DelegatedProvider {
val _a = atomic(42) internal val _a = atomic(42)
var a: Int by _a var a: Int by _a
var vInt by atomic(77) var vInt by atomic(77)
@@ -0,0 +1,97 @@
@kotlin.Metadata
synthetic final class DelegatedProvider$DelegatedProvider$VolatileWrapper$atomicfu$private {
// source: 'FieldInObjectTest.kt'
private synthetic final static field _a$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field _a$volatile: int
static method <clinit>(): void
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic final static method access$get_a$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
public synthetic final static method access$get_a$volatile$p(p0: DelegatedProvider$DelegatedProvider$VolatileWrapper$atomicfu$private): int
public synthetic final static method access$set_a$volatile$p(p0: DelegatedProvider$DelegatedProvider$VolatileWrapper$atomicfu$private, p1: int): void
private synthetic final static method get_a$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method get_a$volatile(): int
private synthetic final method set_a$volatile(p0: int): void
private synthetic inner class DelegatedProvider$DelegatedProvider$VolatileWrapper$atomicfu$private
}
@kotlin.Metadata
final class DelegatedProvider {
// source: 'FieldInObjectTest.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: DelegatedProvider
private synthetic final static field delegatedProvider$VolatileWrapper$atomicfu$private: DelegatedProvider$DelegatedProvider$VolatileWrapper$atomicfu$private
private synthetic volatile field vInt$volatile: int
static method <clinit>(): void
private method <init>(): void
public synthetic final static method access$getDelegatedProvider$VolatileWrapper$atomicfu$private(): DelegatedProvider$DelegatedProvider$VolatileWrapper$atomicfu$private
public final method getA(): int
private synthetic final static method getDelegatedProvider$VolatileWrapper$atomicfu$private(): DelegatedProvider$DelegatedProvider$VolatileWrapper$atomicfu$private
public final method getVInt(): int
public final method setA(p0: int): void
public final method setVInt(p0: int): void
private synthetic inner class DelegatedProvider$DelegatedProvider$VolatileWrapper$atomicfu$private
}
@kotlin.Metadata
public final class FieldInObjectTestKt {
// source: 'FieldInObjectTest.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
private final static method testDelegatedPropertiesInObject(): void
private final static method testFieldInObject(): void
private synthetic inner class DelegatedProvider$DelegatedProvider$VolatileWrapper$atomicfu$private
private synthetic inner class Provider$Provider$VolatileWrapper$atomicfu$private
}
@kotlin.Metadata
synthetic final class Provider$Provider$VolatileWrapper$atomicfu$private {
// source: 'FieldInObjectTest.kt'
private synthetic final static field _l$volatile$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic volatile field _l$volatile: long
private synthetic final static field _ref$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field _ref$volatile: java.lang.Object
private synthetic final static field _x$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field _x$volatile: int
private synthetic final static field port$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field port$volatile: int
static method <clinit>(): void
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic final static method access$getPort$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
public synthetic final static method access$get_l$volatile$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
public synthetic final static method access$get_ref$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
public synthetic final static method access$get_x$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final static method getPort$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getPort$volatile(): int
private synthetic final static method get_l$volatile$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic final method get_l$volatile(): long
private synthetic final static method get_ref$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method get_ref$volatile(): java.lang.Object
private synthetic final static method get_x$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method get_x$volatile(): int
private synthetic final method setPort$volatile(p0: int): void
private synthetic final method set_l$volatile(p0: long): void
private synthetic final method set_ref$volatile(p0: java.lang.Object): void
private synthetic final method set_x$volatile(p0: int): void
private synthetic inner class Provider$Provider$VolatileWrapper$atomicfu$private
public final inner class kotlin/random/Random$Default
}
@kotlin.Metadata
final class Provider {
// source: 'FieldInObjectTest.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: Provider
private synthetic final static field intArr: java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final static field longArr: java.util.concurrent.atomic.AtomicLongArray
private synthetic final static field provider$VolatileWrapper$atomicfu$private: Provider$Provider$VolatileWrapper$atomicfu$private
private synthetic final static field refArr: java.util.concurrent.atomic.AtomicReferenceArray
static method <clinit>(): void
private method <init>(): void
public synthetic final static method access$getProvider$VolatileWrapper$atomicfu$private(): Provider$Provider$VolatileWrapper$atomicfu$private
public synthetic final method getIntArr(): java.util.concurrent.atomic.AtomicIntegerArray
public final method getL(): long
public synthetic final method getLongArr(): java.util.concurrent.atomic.AtomicLongArray
private synthetic final static method getProvider$VolatileWrapper$atomicfu$private(): Provider$Provider$VolatileWrapper$atomicfu$private
public synthetic final method getRefArr(): java.util.concurrent.atomic.AtomicReferenceArray
public final method next(): int
private synthetic inner class Provider$Provider$VolatileWrapper$atomicfu$private
}
@@ -7,6 +7,12 @@ private val c = atomic(true)
private val abcNode = atomic(ANode(BNode(CNode(8)))) private val abcNode = atomic(ANode(BNode(CNode(8))))
private val any = atomic<Any?>(null) private val any = atomic<Any?>(null)
internal val a_internal = atomic(0)
internal val b_internal = atomic(2424920024888888848)
internal val c_internal = atomic(true)
internal val abcNode_internal = atomic(ANode(BNode(CNode(8))))
internal val any_internal = atomic<Any?>(null)
private val intArr = AtomicIntArray(3) private val intArr = AtomicIntArray(3)
private val longArr = AtomicLongArray(5) private val longArr = AtomicLongArray(5)
private val booleanArr = AtomicBooleanArray(4) private val booleanArr = AtomicBooleanArray(4)
@@ -0,0 +1,162 @@
@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 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 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 synthetic final class TopLevelTest$VolatileWrapper$atomicfu$internal {
// source: 'TopLevelTest.kt'
private synthetic final static field a_internal$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field a_internal$volatile: int
private synthetic final static field abcNode_internal$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field abcNode_internal$volatile: java.lang.Object
private synthetic final static field any_internal$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field any_internal$volatile: java.lang.Object
private synthetic final static field b_internal$volatile$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic volatile field b_internal$volatile: long
private synthetic final static field c_internal$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field c_internal$volatile: int
static method <clinit>(): void
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic final static method getA_internal$volatile$FU$main(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA_internal$volatile(): int
public synthetic final static method getAbcNode_internal$volatile$FU$main(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getAbcNode_internal$volatile(): java.lang.Object
public synthetic final static method getAny_internal$volatile$FU$main(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getAny_internal$volatile(): java.lang.Object
public synthetic final static method getB_internal$volatile$FU$main(): java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic final method getB_internal$volatile(): long
public synthetic final static method getC_internal$volatile$FU$main(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getC_internal$volatile(): int
private synthetic final method setA_internal$volatile(p0: int): void
private synthetic final method setAbcNode_internal$volatile(p0: java.lang.Object): void
private synthetic final method setAny_internal$volatile(p0: java.lang.Object): void
private synthetic final method setB_internal$volatile(p0: long): void
private synthetic final method setC_internal$volatile(p0: int): void
}
@kotlin.Metadata
synthetic final class TopLevelTest$VolatileWrapper$atomicfu$private {
// source: 'TopLevelTest.kt'
private synthetic final static field a$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field a$volatile: int
private synthetic final static field abcNode$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field abcNode$volatile: java.lang.Object
private synthetic final static field any$volatile$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic volatile field any$volatile: java.lang.Object
private synthetic final static field b$volatile$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic volatile field b$volatile: long
private synthetic final static field c$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field c$volatile: int
static method <clinit>(): void
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic final static method access$getA$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
public synthetic final static method access$getAbcNode$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
public synthetic final static method access$getAny$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
public synthetic final static method access$getB$volatile$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
public synthetic final static method access$getC$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final static method getA$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA$volatile(): int
private synthetic final static method getAbcNode$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getAbcNode$volatile(): java.lang.Object
private synthetic final static method getAny$volatile$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
private synthetic final method getAny$volatile(): java.lang.Object
private synthetic final static method getB$volatile$FU(): java.util.concurrent.atomic.AtomicLongFieldUpdater
private synthetic final method getB$volatile(): long
private synthetic final static method getC$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getC$volatile(): int
private synthetic final method setA$volatile(p0: int): void
private synthetic final method setAbcNode$volatile(p0: java.lang.Object): void
private synthetic final method setAny$volatile(p0: java.lang.Object): void
private synthetic final method setB$volatile(p0: long): void
private synthetic final method setC$volatile(p0: int): void
}
@kotlin.Metadata
public final class TopLevelTestKt {
// source: 'TopLevelTest.kt'
private synthetic final static field anyRefArr: java.util.concurrent.atomic.AtomicReferenceArray
private synthetic final static field booleanArr: java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final static field intArr: java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final static field longArr: java.util.concurrent.atomic.AtomicLongArray
private synthetic final static field refArr: java.util.concurrent.atomic.AtomicReferenceArray
private synthetic final static field stringAtomicNullArr: java.util.concurrent.atomic.AtomicReferenceArray
private synthetic final static field topLevelTest$VolatileWrapper$atomicfu$internal: TopLevelTest$VolatileWrapper$atomicfu$internal
private synthetic final static field topLevelTest$VolatileWrapper$atomicfu$private: TopLevelTest$VolatileWrapper$atomicfu$private
static method <clinit>(): void
public synthetic final static method access$getBooleanArr(): java.util.concurrent.atomic.AtomicIntegerArray
public synthetic final static method access$getIntArr(): java.util.concurrent.atomic.AtomicIntegerArray
public synthetic final static method access$getLongArr(): java.util.concurrent.atomic.AtomicLongArray
public synthetic final static method access$getRefArr(): java.util.concurrent.atomic.AtomicReferenceArray
public synthetic final static method access$getStringAtomicNullArr(): java.util.concurrent.atomic.AtomicReferenceArray
public synthetic final static method access$getTopLevelTest$VolatileWrapper$atomicfu$private(): TopLevelTest$VolatileWrapper$atomicfu$private
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
private synthetic final static method getAnyRefArr(): java.util.concurrent.atomic.AtomicReferenceArray
private synthetic final static method getBooleanArr(): java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final static method getIntArr(): java.util.concurrent.atomic.AtomicIntegerArray
private synthetic final static method getLongArr(): java.util.concurrent.atomic.AtomicLongArray
private synthetic final static method getRefArr(): java.util.concurrent.atomic.AtomicReferenceArray
private synthetic final static method getStringAtomicNullArr(): java.util.concurrent.atomic.AtomicReferenceArray
public synthetic final static method getTopLevelTest$VolatileWrapper$atomicfu$internal(): TopLevelTest$VolatileWrapper$atomicfu$internal
private synthetic final static method getTopLevelTest$VolatileWrapper$atomicfu$private(): TopLevelTest$VolatileWrapper$atomicfu$private
}
@@ -0,0 +1,61 @@
@kotlin.Metadata
final enum class TraceTest$Status {
// source: 'TraceTest.kt'
private synthetic final static field $ENTRIES: kotlin.enums.EnumEntries
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 @org.jetbrains.annotations.NotNull method getEntries(): kotlin.enums.EnumEntries
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 synthetic final static field a$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field a$volatile: int
private synthetic final static field a1$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field a1$volatile: int
private synthetic final static field a2$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field a2$volatile: int
private synthetic final static field a3$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field a3$volatile: int
private synthetic final static field s$volatile$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic volatile field s$volatile: int
static method <clinit>(): void
public method <init>(): void
private synthetic final static method getA$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA$volatile(): int
private synthetic final static method getA1$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA1$volatile(): int
private synthetic final static method getA2$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA2$volatile(): int
private synthetic final static method getA3$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getA3$volatile(): int
private synthetic final static method getS$volatile$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
private synthetic final method getS$volatile(): int
private synthetic final method setA$volatile(p0: int): void
private synthetic final method setA1$volatile(p0: int): void
private synthetic final method setA2$volatile(p0: int): void
private synthetic final method setA3$volatile(p0: int): void
private synthetic final method setS$volatile(p0: int): 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
}