diff --git a/src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/AtomicReferenceNames.kt b/src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/AtomicReferenceNames.kt index 8ccb0279e..e2e0f1dd2 100644 --- a/src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/AtomicReferenceNames.kt +++ b/src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/AtomicReferenceNames.kt @@ -13,11 +13,8 @@ package org.jetbrains.kotlinx.lincheck.strategy.managed import kotlinx.atomicfu.AtomicArray import kotlinx.atomicfu.AtomicBooleanArray import kotlinx.atomicfu.AtomicIntArray -import org.jetbrains.kotlinx.lincheck.allDeclaredFieldWithSuperclasses import org.jetbrains.kotlinx.lincheck.strategy.managed.AtomicReferenceMethodType.* -import org.jetbrains.kotlinx.lincheck.strategy.managed.AtomicReferenceNames.AtomicReferenceOwnerWithName.* -import org.jetbrains.kotlinx.lincheck.strategy.managed.AtomicReferenceNames.TraverseResult.* -import java.lang.reflect.Modifier +import org.jetbrains.kotlinx.lincheck.strategy.managed.OwnerWithName.* import java.util.* import java.util.concurrent.atomic.AtomicIntegerArray import java.util.concurrent.atomic.AtomicLongArray @@ -37,16 +34,16 @@ internal object AtomicReferenceNames { atomicReference: Any, parameters: Array ): AtomicReferenceMethodType { - val receiverAndName = getAtomicReferenceReceiverAndName(testObject, atomicReference) + val receiverAndName = FieldSearchHelper.findFinalFieldWithOwner(testObject, atomicReference) return if (receiverAndName != null) { if (isAtomicArrayIndexMethodCall(atomicReference, parameters)) { when (receiverAndName) { - is InstanceOwnerWithName -> InstanceFieldAtomicArrayMethod(receiverAndName.receiver, receiverAndName.fieldName, parameters[0] as Int) + is InstanceOwnerWithName -> InstanceFieldAtomicArrayMethod(receiverAndName.owner, receiverAndName.fieldName, parameters[0] as Int) is StaticOwnerWithName -> StaticFieldAtomicArrayMethod(receiverAndName.clazz, receiverAndName.fieldName, parameters[0] as Int) } } else { when (receiverAndName) { - is InstanceOwnerWithName -> AtomicReferenceInstanceMethod(receiverAndName.receiver, receiverAndName.fieldName) + is InstanceOwnerWithName -> AtomicReferenceInstanceMethod(receiverAndName.owner, receiverAndName.fieldName) is StaticOwnerWithName -> AtomicReferenceStaticMethod(receiverAndName.clazz, receiverAndName.fieldName) } } @@ -69,70 +66,7 @@ internal object AtomicReferenceNames { atomicReference is AtomicBooleanArray } - private fun getAtomicReferenceReceiverAndName(testObject: Any, reference: Any): AtomicReferenceOwnerWithName? = - runCatching { - val visitedObjects: MutableSet = Collections.newSetFromMap(IdentityHashMap()) - return when (val result = findObjectField(testObject, reference, visitedObjects)) { - is FieldName -> result.fieldName - MultipleFieldsMatching, NotFound -> null - } - }.getOrElse { exception -> - exception.printStackTrace() - null - } - - private sealed interface TraverseResult { - data object NotFound : TraverseResult - data class FieldName(val fieldName: AtomicReferenceOwnerWithName) : TraverseResult - data object MultipleFieldsMatching : TraverseResult - } - - private fun findObjectField(testObject: Any?, value: Any, visitedObjects: MutableSet): TraverseResult { - if (testObject == null) return NotFound - var fieldName: AtomicReferenceOwnerWithName? = null - // We take all the fields from the hierarchy. - // If two or more fields match (===) the AtomicReference object, we fall back to the default behavior, - // so there is no problem that we can receive some fields of the same name and the same type. - for (field in testObject::class.java.allDeclaredFieldWithSuperclasses) { - if (field.type.isPrimitive || !field.trySetAccessible()) continue - val fieldValue = field.get(testObject) - if (fieldValue in visitedObjects) continue - visitedObjects += testObject - - if (fieldValue === value) { - if (fieldName != null) return MultipleFieldsMatching - - fieldName = if (Modifier.isStatic(field.modifiers)) { - StaticOwnerWithName(field.name, testObject::class.java) - } else { - InstanceOwnerWithName(field.name, testObject) - } - continue - } - when (val result = findObjectField(fieldValue, value, visitedObjects)) { - is FieldName -> { - if (fieldName != null) { - return MultipleFieldsMatching - } else { - fieldName = result.fieldName - } - } - - MultipleFieldsMatching -> return result - NotFound -> {} - } - } - return if (fieldName != null) FieldName(fieldName) else NotFound - } - - private sealed class AtomicReferenceOwnerWithName(val fieldName: String) { - class StaticOwnerWithName(fieldName: String, val clazz: Class<*>) : - AtomicReferenceOwnerWithName(fieldName) - - class InstanceOwnerWithName(fieldName: String, val receiver: Any) : - AtomicReferenceOwnerWithName(fieldName) - } } /** diff --git a/src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/FieldSearchHelper.kt b/src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/FieldSearchHelper.kt new file mode 100644 index 000000000..ce1f01b45 --- /dev/null +++ b/src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/FieldSearchHelper.kt @@ -0,0 +1,103 @@ +/* + * Lincheck + * + * Copyright (C) 2019 - 2024 JetBrains s.r.o. + * + * This Source Code Form is subject to the terms of the + * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed + * with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +package org.jetbrains.kotlinx.lincheck.strategy.managed + +import kotlinx.atomicfu.AtomicArray +import kotlinx.atomicfu.AtomicRef +import org.jetbrains.kotlinx.lincheck.allDeclaredFieldWithSuperclasses +import org.jetbrains.kotlinx.lincheck.strategy.managed.FieldSearchHelper.TraverseResult.* +import org.jetbrains.kotlinx.lincheck.strategy.managed.OwnerWithName.* +import org.jetbrains.kotlinx.lincheck.util.readFieldViaUnsafe +import sun.misc.Unsafe +import java.lang.reflect.Modifier +import java.util.* +import java.util.concurrent.atomic.AtomicReference +import java.util.concurrent.atomic.AtomicReferenceArray + + +/** + * Utility class that helps to determine if the provided field stored in only one + * final field of a tested object. + */ +internal object FieldSearchHelper { + + /** + * Determines if the [value] is stored in the only one field of the [testObject] and this + * field is final. + * In case the [value] is not found or accessible by multiple fields, the function returns `null`. + */ + internal fun findFinalFieldWithOwner(testObject: Any, value: Any): OwnerWithName? = runCatching { + val visitedObjects: MutableSet = Collections.newSetFromMap(IdentityHashMap()) + return when (val result = findObjectField(testObject, value, visitedObjects)) { + is FieldName -> result.field + MultipleFieldsMatching, NotFound, FoundInNonFinalField -> null + } + }.getOrElse { exception -> + exception.printStackTrace() + null + } + + private sealed interface TraverseResult { + data object NotFound : TraverseResult + data class FieldName(val field: OwnerWithName) : TraverseResult + data object MultipleFieldsMatching : TraverseResult + data object FoundInNonFinalField: TraverseResult + } + + private fun findObjectField(testObject: Any?, value: Any, visitedObjects: MutableSet): TraverseResult { + if (testObject == null) return NotFound + var fieldName: OwnerWithName? = null + // We take all the fields from the hierarchy. + // If two or more fields match (===) the AtomicReference object, we fall back to the default behavior, + // so there is no problem that we can receive some fields of the same name and the same type. + for (field in testObject::class.java.allDeclaredFieldWithSuperclasses) { + if (field.type.isPrimitive) continue + val fieldValue = readFieldViaUnsafe(testObject, field, Unsafe::getObject) + + if (fieldValue in visitedObjects) continue + visitedObjects += testObject + + if (fieldValue === value) { + if (fieldName != null) return MultipleFieldsMatching + if (!Modifier.isFinal(field.modifiers)) return FoundInNonFinalField + + fieldName = if (Modifier.isStatic(field.modifiers)) { + StaticOwnerWithName(field.name, testObject::class.java) + } else { + InstanceOwnerWithName(field.name, testObject) + } + continue + } + when (val result = findObjectField(fieldValue, value, visitedObjects)) { + is FieldName -> { + if (fieldName != null) { + return MultipleFieldsMatching + } else { + fieldName = result.field + } + } + + MultipleFieldsMatching, FoundInNonFinalField -> return result + NotFound -> {} + } + } + return if (fieldName != null) FieldName(fieldName) else NotFound + } + +} + +internal sealed class OwnerWithName(val fieldName: String) { + class StaticOwnerWithName(fieldName: String, val clazz: Class<*>) : + OwnerWithName(fieldName) + + class InstanceOwnerWithName(fieldName: String, val owner: Any) : + OwnerWithName(fieldName) +} \ No newline at end of file diff --git a/src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt b/src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt index abc7b6c54..2def36af1 100644 --- a/src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt +++ b/src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt @@ -24,6 +24,7 @@ import sun.nio.ch.lincheck.* import kotlinx.coroutines.* import org.jetbrains.kotlinx.lincheck.strategy.managed.AtomicFieldUpdaterNames.getAtomicFieldUpdaterName import org.jetbrains.kotlinx.lincheck.strategy.managed.AtomicReferenceMethodType.* +import org.jetbrains.kotlinx.lincheck.strategy.managed.FieldSearchHelper.findFinalFieldWithOwner import org.jetbrains.kotlinx.lincheck.strategy.managed.ObjectLabelFactory.adornedStringRepresentation import org.jetbrains.kotlinx.lincheck.strategy.managed.ObjectLabelFactory.cleanObjectNumeration import org.jetbrains.kotlinx.lincheck.strategy.managed.UnsafeName.* @@ -1293,10 +1294,23 @@ abstract class ManagedStrategy( /** * Returns beautiful string representation of the [owner]. * If the [owner] is `this` of the current method, then returns `null`. + * Otherwise, we try to find if this [owner] is stored in only one field in the testObject + * and this field is final. If such field is found we construct beautiful representation for + * this field owner (if it's not a current `this`, again) and the field name. + * Otherwise, return beautiful representation for the provided [owner]. */ private fun findOwnerName(owner: Any): String? { + // If the current owner is this - no owner needed. if (isOwnerCurrentContext(owner)) return null - return adornedStringRepresentation(owner) + val fieldWithOwner = findFinalFieldWithOwner(runner.testInstance, owner) ?: return adornedStringRepresentation(owner) + // If such a field is found - construct representation with its owner and name. + return if (fieldWithOwner is OwnerWithName.InstanceOwnerWithName) { + val fieldOwner = fieldWithOwner.owner + val fieldName = fieldWithOwner.fieldName + if (!isOwnerCurrentContext(fieldOwner)) { + "${adornedStringRepresentation(fieldOwner)}.$fieldName" + } else fieldName + } else null } /** diff --git a/src/jvm/test/org/jetbrains/kotlinx/lincheck_test/representation/AtomicReferencesNamesTests.kt b/src/jvm/test/org/jetbrains/kotlinx/lincheck_test/representation/AtomicReferencesNamesTests.kt index 2e3a6e682..b49063b48 100644 --- a/src/jvm/test/org/jetbrains/kotlinx/lincheck_test/representation/AtomicReferencesNamesTests.kt +++ b/src/jvm/test/org/jetbrains/kotlinx/lincheck_test/representation/AtomicReferencesNamesTests.kt @@ -14,16 +14,16 @@ import java.util.concurrent.atomic.* class AtomicReferencesNamesTest : BaseFailingTest("atomic_references_names_trace.txt") { - private var atomicReference = AtomicReference(Node(1)) - private var atomicInteger = AtomicInteger(0) - private var atomicLong = AtomicLong(0L) - private var atomicBoolean = AtomicBoolean(true) + private val atomicReference = AtomicReference(Node(1)) + private val atomicInteger = AtomicInteger(0) + private val atomicLong = AtomicLong(0L) + private val atomicBoolean = AtomicBoolean(true) - private var atomicReferenceArray = AtomicReferenceArray(arrayOf(Node(1))) - private var atomicIntegerArray = AtomicIntegerArray(intArrayOf(0)) - private var atomicLongArray = AtomicLongArray(longArrayOf(0L)) + private val atomicReferenceArray = AtomicReferenceArray(arrayOf(Node(1))) + private val atomicIntegerArray = AtomicIntegerArray(intArrayOf(0)) + private val atomicLongArray = AtomicLongArray(longArrayOf(0L)) - private var wrapper = AtomicReferenceWrapper() + private val wrapper = AtomicReferenceWrapper() override fun actionsForTrace() { atomicReference.compareAndSet(atomicReference.get(), Node(2)) diff --git a/src/jvm/test/org/jetbrains/kotlinx/lincheck_test/representation/InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt b/src/jvm/test/org/jetbrains/kotlinx/lincheck_test/representation/InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt index 13e0de19d..08b113fd1 100644 --- a/src/jvm/test/org/jetbrains/kotlinx/lincheck_test/representation/InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt +++ b/src/jvm/test/org/jetbrains/kotlinx/lincheck_test/representation/InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt @@ -28,10 +28,10 @@ import java.util.concurrent.atomic.AtomicInteger class InterleavingAnalysisPresentInSpinCycleFirstIterationTest { // Counter thar causes spin-lock in spinLock operation - private var counter = AtomicInteger(0) + private val counter = AtomicInteger(0) // Trigger to increment and decrement in spin-cycle to check in causeSpinLock operation - private var shouldAlwaysBeZero = AtomicInteger(0) - private var illegalInterleavingFound = AtomicBoolean(false) + private val shouldAlwaysBeZero = AtomicInteger(0) + private val illegalInterleavingFound = AtomicBoolean(false) @Operation fun causeSpinLock() { diff --git a/src/jvm/test/resources/expected_logs/atomic_references_names_trace.txt b/src/jvm/test/resources/expected_logs/atomic_references_names_trace.txt index 35d773f8e..f6f4fb483 100644 --- a/src/jvm/test/resources/expected_logs/atomic_references_names_trace.txt +++ b/src/jvm/test/resources/expected_logs/atomic_references_names_trace.txt @@ -29,54 +29,30 @@ Detailed trace: | counter.READ: 0 at BaseFailingTest.increment(BaseFailingTest.kt:30) | | | counter.WRITE(1) at BaseFailingTest.increment(BaseFailingTest.kt:30) | | | actionsForTrace() at BaseFailingTest.increment(BaseFailingTest.kt:31) | | -| atomicReference.READ: AtomicReference#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:29) | | -| atomicReference.READ: AtomicReference#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:29) | | | atomicReference.get(): Node#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:29) | | | atomicReference.compareAndSet(Node#1,Node#2): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:29) | | -| atomicReference.READ: AtomicReference#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:30) | | | atomicReference.set(Node#3) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:30) | | -| atomicInteger.READ: AtomicInteger#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:32) | | -| atomicInteger.READ: AtomicInteger#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:32) | | | atomicInteger.get(): 0 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:32) | | | atomicInteger.compareAndSet(0,2): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:32) | | -| atomicInteger.READ: AtomicInteger#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:33) | | | atomicInteger.set(3) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:33) | | -| atomicLong.READ: AtomicLong#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:35) | | -| atomicLong.READ: AtomicLong#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:35) | | | atomicLong.get(): 0 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:35) | | | atomicLong.compareAndSet(0,2): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:35) | | -| atomicLong.READ: AtomicLong#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:36) | | | atomicLong.set(3) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:36) | | -| atomicBoolean.READ: AtomicBoolean#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:38) | | -| atomicBoolean.READ: AtomicBoolean#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:38) | | | atomicBoolean.get(): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:38) | | | atomicBoolean.compareAndSet(true,true): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:38) | | -| atomicBoolean.READ: AtomicBoolean#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:39) | | | atomicBoolean.set(false) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:39) | | -| atomicReferenceArray.READ: AtomicReferenceArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:41) | | -| atomicReferenceArray.READ: AtomicReferenceArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:41) | | | atomicReferenceArray[0].get(): Node#4 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:41) | | | atomicReferenceArray[0].compareAndSet(Node#4,Node#5): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:41) | | -| atomicReferenceArray.READ: AtomicReferenceArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:42) | | | atomicReferenceArray[0].set(Node#6) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:42) | | -| atomicIntegerArray.READ: AtomicIntegerArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:44) | | -| atomicIntegerArray.READ: AtomicIntegerArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:44) | | | atomicIntegerArray[0].get(): 0 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:44) | | | atomicIntegerArray[0].compareAndSet(0,1): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:44) | | -| atomicIntegerArray.READ: AtomicIntegerArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:45) | | | atomicIntegerArray[0].set(2) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:45) | | -| atomicLongArray.READ: AtomicLongArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:47) | | -| atomicLongArray.READ: AtomicLongArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:47) | | | atomicLongArray[0].get(): 0 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:47) | | | atomicLongArray[0].compareAndSet(0,1): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:47) | | -| atomicLongArray.READ: AtomicLongArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:48) | | | atomicLongArray[0].set(2) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:48) | | -| wrapper.READ: AtomicReferenceWrapper#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:50) | | -| AtomicReferenceWrapper#1.reference.set(Node#7) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:50) | | -| wrapper.READ: AtomicReferenceWrapper#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:51) | | -| AtomicReferenceWrapper#1.array.length(): 10 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:51) | | -| wrapper.READ: AtomicReferenceWrapper#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:52) | | -| AtomicReferenceWrapper#1.array[0].compareAndSet(1,2): false at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:52) | | +| wrapper.reference.set(Node#7) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:50) | | +| wrapper.array.length(): 10 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:51) | | +| wrapper.array[0].compareAndSet(1,2): false at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:52) | | | AtomicReferencesNamesTest.staticValue.compareAndSet(0,2): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:54) | | | AtomicReferencesNamesTest.staticValue.set(0) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:55) | | | AtomicReferenceWrapper.staticValue.compareAndSet(1,2): false at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:57) | | @@ -86,54 +62,30 @@ Detailed trace: | result: 0 | | | | counter.WRITE(1) at BaseFailingTest.increment(BaseFailingTest.kt:30) | | | actionsForTrace() at BaseFailingTest.increment(BaseFailingTest.kt:31) | -| | atomicReference.READ: AtomicReference#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:29) | -| | atomicReference.READ: AtomicReference#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:29) | | | atomicReference.get(): Node#3 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:29) | | | atomicReference.compareAndSet(Node#3,Node#8): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:29) | -| | atomicReference.READ: AtomicReference#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:30) | | | atomicReference.set(Node#9) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:30) | -| | atomicInteger.READ: AtomicInteger#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:32) | -| | atomicInteger.READ: AtomicInteger#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:32) | | | atomicInteger.get(): 3 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:32) | | | atomicInteger.compareAndSet(3,2): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:32) | -| | atomicInteger.READ: AtomicInteger#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:33) | | | atomicInteger.set(3) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:33) | -| | atomicLong.READ: AtomicLong#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:35) | -| | atomicLong.READ: AtomicLong#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:35) | | | atomicLong.get(): 3 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:35) | | | atomicLong.compareAndSet(3,2): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:35) | -| | atomicLong.READ: AtomicLong#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:36) | | | atomicLong.set(3) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:36) | -| | atomicBoolean.READ: AtomicBoolean#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:38) | -| | atomicBoolean.READ: AtomicBoolean#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:38) | | | atomicBoolean.get(): false at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:38) | | | atomicBoolean.compareAndSet(false,true): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:38) | -| | atomicBoolean.READ: AtomicBoolean#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:39) | | | atomicBoolean.set(false) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:39) | -| | atomicReferenceArray.READ: AtomicReferenceArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:41) | -| | atomicReferenceArray.READ: AtomicReferenceArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:41) | | | atomicReferenceArray[0].get(): Node#6 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:41) | | | atomicReferenceArray[0].compareAndSet(Node#6,Node#10): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:41) | -| | atomicReferenceArray.READ: AtomicReferenceArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:42) | | | atomicReferenceArray[0].set(Node#11) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:42) | -| | atomicIntegerArray.READ: AtomicIntegerArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:44) | -| | atomicIntegerArray.READ: AtomicIntegerArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:44) | | | atomicIntegerArray[0].get(): 2 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:44) | | | atomicIntegerArray[0].compareAndSet(2,1): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:44) | -| | atomicIntegerArray.READ: AtomicIntegerArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:45) | | | atomicIntegerArray[0].set(2) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:45) | -| | atomicLongArray.READ: AtomicLongArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:47) | -| | atomicLongArray.READ: AtomicLongArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:47) | | | atomicLongArray[0].get(): 2 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:47) | | | atomicLongArray[0].compareAndSet(2,1): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:47) | -| | atomicLongArray.READ: AtomicLongArray#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:48) | | | atomicLongArray[0].set(2) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:48) | -| | wrapper.READ: AtomicReferenceWrapper#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:50) | -| | AtomicReferenceWrapper#1.reference.set(Node#12) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:50) | -| | wrapper.READ: AtomicReferenceWrapper#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:51) | -| | AtomicReferenceWrapper#1.array.length(): 10 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:51) | -| | wrapper.READ: AtomicReferenceWrapper#1 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:52) | -| | AtomicReferenceWrapper#1.array[0].compareAndSet(1,2): false at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:52) | +| | wrapper.reference.set(Node#12) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:50) | +| | wrapper.array.length(): 10 at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:51) | +| | wrapper.array[0].compareAndSet(1,2): false at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:52) | | | AtomicReferencesNamesTest.staticValue.compareAndSet(0,2): true at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:54) | | | AtomicReferencesNamesTest.staticValue.set(0) at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:55) | | | AtomicReferenceWrapper.staticValue.compareAndSet(1,2): false at AtomicReferencesNamesTest.actionsForTrace(AtomicReferencesNamesTests.kt:57) | diff --git a/src/jvm/test/resources/expected_logs/jdk_unsafe_trace.txt b/src/jvm/test/resources/expected_logs/jdk_unsafe_trace.txt index b6b88890e..153f4f32b 100644 --- a/src/jvm/test/resources/expected_logs/jdk_unsafe_trace.txt +++ b/src/jvm/test/resources/expected_logs/jdk_unsafe_trace.txt @@ -10,55 +10,55 @@ The following interleaving leads to the error: | Thread 1 | Thread 2 | | -------------------------------------------------------------------------------------------------------------------------------------------- | | | increment(): 0 | -| | counter.READ: 0 at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:82) | +| | counter.READ: 0 at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:80) | | | switch | | increment(): 0 | | -| | counter.WRITE(1) at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:82) | -| | actionsJustForTrace() at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:83) | +| | counter.WRITE(1) at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:80) | +| | actionsJustForTrace() at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:81) | | | result: 0 | | -------------------------------------------------------------------------------------------------------------------------------------------- | Detailed trace: -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Thread 1 | Thread 2 | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| | increment(): 0 | -| | counter.READ: 0 at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:82) | -| | switch | -| increment(): 0 | | -| counter.READ: 0 at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:82) | | -| counter.WRITE(1) at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:82) | | -| actionsJustForTrace() at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:83) | | -| ConcurrentHashMap#1.put(1,2): null at JdkUnsafeTraceRepresentationTest.actionsJustForTrace(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:99) | | -| putVal(1,2,false): null at ConcurrentHashMap.put(ConcurrentHashMap.java:1006) | | -| table.READ: null at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1014) | | -| initTable(): Array#1 at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1017) | | -| table.READ: null at ConcurrentHashMap.initTable(ConcurrentHashMap.java:2293) | | -| sizeCtl.READ: 0 at ConcurrentHashMap.initTable(ConcurrentHashMap.java:2294) | | -| sizeCtl.compareAndSetInt(0,-1): true at ConcurrentHashMap.initTable(ConcurrentHashMap.java:2296) | | -| table.READ: null at ConcurrentHashMap.initTable(ConcurrentHashMap.java:2298) | | -| table.WRITE(Array#1) at ConcurrentHashMap.initTable(ConcurrentHashMap.java:2302) | | -| sizeCtl.WRITE(12) at ConcurrentHashMap.initTable(ConcurrentHashMap.java:2306) | | -| ConcurrentHashMap.tabAt(Array#1,1): null at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1018) | | -| Array#1[1].getReferenceAcquire(): null at ConcurrentHashMap.tabAt(ConcurrentHashMap.java:760) | | -| ConcurrentHashMap.casTabAt(Array#1,1,null,Node#1): true at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1019) | | -| Array#1[1].compareAndSetReference(null,Node#1): true at ConcurrentHashMap.casTabAt(ConcurrentHashMap.java:765) | | -| addCount(1,0) at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1075) | | -| counterCells.READ: null at ConcurrentHashMap.addCount(ConcurrentHashMap.java:2326) | | -| baseCount.READ: 0 at ConcurrentHashMap.addCount(ConcurrentHashMap.java:2326) | | -| baseCount.compareAndSetLong(0,1): true at ConcurrentHashMap.addCount(ConcurrentHashMap.java:2327) | | -| sizeCtl.READ: 12 at ConcurrentHashMap.addCount(ConcurrentHashMap.java:2343) | | -| result: 0 | | -| | counter.WRITE(1) at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:82) | -| | actionsJustForTrace() at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:83) | -| | ConcurrentHashMap#1.put(1,2): 2 at JdkUnsafeTraceRepresentationTest.actionsJustForTrace(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:99) | -| | putVal(1,2,false): 2 at ConcurrentHashMap.put(ConcurrentHashMap.java:1006) | -| | table.READ: Array#1 at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1014) | -| | ConcurrentHashMap.tabAt(Array#1,1): Node#1 at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1018) | -| | Array#1[1].getReferenceAcquire(): Node#1 at ConcurrentHashMap.tabAt(ConcurrentHashMap.java:760) | -| | MONITORENTER at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1031) | -| | ConcurrentHashMap.tabAt(Array#1,1): Node#1 at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1032) | -| | Array#1[1].getReferenceAcquire(): Node#1 at ConcurrentHashMap.tabAt(ConcurrentHashMap.java:760) | -| | MONITOREXIT at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1065) | -| | result: 0 | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Thread 1 | Thread 2 | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| | increment(): 0 | +| | counter.READ: 0 at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:80) | +| | switch | +| increment(): 0 | | +| counter.READ: 0 at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:80) | | +| counter.WRITE(1) at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:80) | | +| actionsJustForTrace() at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:81) | | +| hashMap.put(1,2): null at JdkUnsafeTraceRepresentationTest.actionsJustForTrace(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:97) | | +| putVal(1,2,false): null at ConcurrentHashMap.put(ConcurrentHashMap.java:1006) | | +| table.READ: null at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1014) | | +| initTable(): Array#1 at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1017) | | +| table.READ: null at ConcurrentHashMap.initTable(ConcurrentHashMap.java:2293) | | +| sizeCtl.READ: 0 at ConcurrentHashMap.initTable(ConcurrentHashMap.java:2294) | | +| sizeCtl.compareAndSetInt(0,-1): true at ConcurrentHashMap.initTable(ConcurrentHashMap.java:2296) | | +| table.READ: null at ConcurrentHashMap.initTable(ConcurrentHashMap.java:2298) | | +| table.WRITE(Array#1) at ConcurrentHashMap.initTable(ConcurrentHashMap.java:2302) | | +| sizeCtl.WRITE(12) at ConcurrentHashMap.initTable(ConcurrentHashMap.java:2306) | | +| ConcurrentHashMap.tabAt(Array#1,1): null at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1018) | | +| Array#1[1].getReferenceAcquire(): null at ConcurrentHashMap.tabAt(ConcurrentHashMap.java:760) | | +| ConcurrentHashMap.casTabAt(Array#1,1,null,Node#1): true at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1019) | | +| Array#1[1].compareAndSetReference(null,Node#1): true at ConcurrentHashMap.casTabAt(ConcurrentHashMap.java:765) | | +| addCount(1,0) at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1075) | | +| counterCells.READ: null at ConcurrentHashMap.addCount(ConcurrentHashMap.java:2326) | | +| baseCount.READ: 0 at ConcurrentHashMap.addCount(ConcurrentHashMap.java:2326) | | +| baseCount.compareAndSetLong(0,1): true at ConcurrentHashMap.addCount(ConcurrentHashMap.java:2327) | | +| sizeCtl.READ: 12 at ConcurrentHashMap.addCount(ConcurrentHashMap.java:2343) | | +| result: 0 | | +| | counter.WRITE(1) at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:80) | +| | actionsJustForTrace() at JdkUnsafeTraceRepresentationTest.increment(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:81) | +| | hashMap.put(1,2): 2 at JdkUnsafeTraceRepresentationTest.actionsJustForTrace(UnsafeUpdaterVarHandleTraceRepresentationTests.kt:97) | +| | putVal(1,2,false): 2 at ConcurrentHashMap.put(ConcurrentHashMap.java:1006) | +| | table.READ: Array#1 at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1014) | +| | ConcurrentHashMap.tabAt(Array#1,1): Node#1 at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1018) | +| | Array#1[1].getReferenceAcquire(): Node#1 at ConcurrentHashMap.tabAt(ConcurrentHashMap.java:760) | +| | MONITORENTER at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1031) | +| | ConcurrentHashMap.tabAt(Array#1,1): Node#1 at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1032) | +| | Array#1[1].getReferenceAcquire(): Node#1 at ConcurrentHashMap.tabAt(ConcurrentHashMap.java:760) | +| | MONITOREXIT at ConcurrentHashMap.putVal(ConcurrentHashMap.java:1065) | +| | result: 0 | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/src/jvm/test/resources/expected_logs/obstruction_freedom_violation_events_cut.txt b/src/jvm/test/resources/expected_logs/obstruction_freedom_violation_events_cut.txt index ba1b4a61e..5b1ef2f9e 100644 --- a/src/jvm/test/resources/expected_logs/obstruction_freedom_violation_events_cut.txt +++ b/src/jvm/test/resources/expected_logs/obstruction_freedom_violation_events_cut.txt @@ -10,12 +10,12 @@ The following interleaving leads to the error: | Thread 1 | Thread 2 | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | enqueue(-1) | -| | MSQueueBlocking#1.enqueue(-1) at ObstructionFreedomViolationEventsCutTest.enqueue(SpinlockEventsCutTests.kt:33) | +| | q.enqueue(-1) at ObstructionFreedomViolationEventsCutTest.enqueue(SpinlockEventsCutTests.kt:33) | | | tail.get(): Node#1 at MSQueueBlocking.enqueue(ObstructionFreedomViolationTest.kt:27) | | | Node#1.next.compareAndSet(null,Node#2): true at MSQueueBlocking.enqueue(ObstructionFreedomViolationTest.kt:28) | | | switch | | enqueue(1) | | -| MSQueueBlocking#1.enqueue(1) at ObstructionFreedomViolationEventsCutTest.enqueue(SpinlockEventsCutTests.kt:33) | | +| q.enqueue(1) at ObstructionFreedomViolationEventsCutTest.enqueue(SpinlockEventsCutTests.kt:33) | | | /* The following events repeat infinitely: */ | | | tail.get(): Node#1 at MSQueueBlocking.enqueue(ObstructionFreedomViolationTest.kt:27) | | | Node#1.next.compareAndSet(null,Node#3): false at MSQueueBlocking.enqueue(ObstructionFreedomViolationTest.kt:28) | | @@ -27,12 +27,12 @@ Detailed trace: | Thread 1 | Thread 2 | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | enqueue(-1) | -| | MSQueueBlocking#1.enqueue(-1) at ObstructionFreedomViolationEventsCutTest.enqueue(SpinlockEventsCutTests.kt:33) | +| | q.enqueue(-1) at ObstructionFreedomViolationEventsCutTest.enqueue(SpinlockEventsCutTests.kt:33) | | | tail.get(): Node#1 at MSQueueBlocking.enqueue(ObstructionFreedomViolationTest.kt:27) | | | Node#1.next.compareAndSet(null,Node#2): true at MSQueueBlocking.enqueue(ObstructionFreedomViolationTest.kt:28) | | | switch | | enqueue(1) | | -| MSQueueBlocking#1.enqueue(1) at ObstructionFreedomViolationEventsCutTest.enqueue(SpinlockEventsCutTests.kt:33) | | +| q.enqueue(1) at ObstructionFreedomViolationEventsCutTest.enqueue(SpinlockEventsCutTests.kt:33) | | | /* The following events repeat infinitely: */ | | | tail.get(): Node#1 at MSQueueBlocking.enqueue(ObstructionFreedomViolationTest.kt:27) | | | Node#1.next.compareAndSet(null,Node#3): false at MSQueueBlocking.enqueue(ObstructionFreedomViolationTest.kt:28) | | diff --git a/src/jvm/test/resources/expected_logs/state_representation.txt b/src/jvm/test/resources/expected_logs/state_representation.txt index 7134fd5a0..981121a29 100644 --- a/src/jvm/test/resources/expected_logs/state_representation.txt +++ b/src/jvm/test/resources/expected_logs/state_representation.txt @@ -10,41 +10,41 @@ | ------------------------------- | The following interleaving leads to the error: -| ---------------------------------------------------------------------------------------------------------------------------- | -| Thread 1 | Thread 2 | -| ---------------------------------------------------------------------------------------------------------------------------- | -| | operation(): 3 | -| | counter.READ: AtomicInteger#1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:35) | -| | counter.incrementAndGet(): 1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:35) | -| | STATE: 1 | -| | counter.READ: AtomicInteger#1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:36) | -| | switch | -| operation(): 2 | | -| STATE: 3 | | -| | counter.getAndIncrement(): 3 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:36) | -| | STATE: 4 | -| | result: 3 | -| ---------------------------------------------------------------------------------------------------------------------------- | +| ----------------------------------------------------------------------------------------------------------------------------------- | +| Thread 1 | Thread 2 | +| ----------------------------------------------------------------------------------------------------------------------------------- | +| | operation(): 3 | +| | counter.READ: AtomicInteger#1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:35) | +| | AtomicInteger#1.incrementAndGet(): 1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:35) | +| | STATE: 1 | +| | counter.READ: AtomicInteger#1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:36) | +| | switch | +| operation(): 2 | | +| STATE: 3 | | +| | AtomicInteger#1.getAndIncrement(): 3 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:36) | +| | STATE: 4 | +| | result: 3 | +| ----------------------------------------------------------------------------------------------------------------------------------- | Detailed trace: -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Thread 1 | Thread 2 | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| | operation(): 3 | -| | counter.READ: AtomicInteger#1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:35) | -| | counter.incrementAndGet(): 1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:35) | -| | STATE: 1 | -| | counter.READ: AtomicInteger#1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:36) | -| | switch | -| operation(): 2 | | -| counter.READ: AtomicInteger#1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:35) | | -| counter.incrementAndGet(): 2 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:35) | | -| STATE: 2 | | -| counter.READ: AtomicInteger#1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:36) | | -| counter.getAndIncrement(): 2 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:36) | | -| STATE: 3 | | -| result: 2 | | -| | counter.getAndIncrement(): 3 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:36) | -| | STATE: 4 | -| | result: 3 | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Thread 1 | Thread 2 | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| | operation(): 3 | +| | counter.READ: AtomicInteger#1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:35) | +| | AtomicInteger#1.incrementAndGet(): 1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:35) | +| | STATE: 1 | +| | counter.READ: AtomicInteger#1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:36) | +| | switch | +| operation(): 2 | | +| counter.READ: AtomicInteger#1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:35) | | +| AtomicInteger#1.incrementAndGet(): 2 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:35) | | +| STATE: 2 | | +| counter.READ: AtomicInteger#1 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:36) | | +| AtomicInteger#1.getAndIncrement(): 2 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:36) | | +| STATE: 3 | | +| result: 2 | | +| | AtomicInteger#1.getAndIncrement(): 3 at ModelCheckingStateReportingTest.operation(StateRepresentationTest.kt:36) | +| | STATE: 4 | +| | result: 3 | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/src/jvm/test/resources/expected_logs/suspend_trace_reporting.txt b/src/jvm/test/resources/expected_logs/suspend_trace_reporting.txt index 851a8fd77..72eb087cf 100644 --- a/src/jvm/test/resources/expected_logs/suspend_trace_reporting.txt +++ b/src/jvm/test/resources/expected_logs/suspend_trace_reporting.txt @@ -6,39 +6,39 @@ | ----------------------------------- | The following interleaving leads to the error: -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Thread 1 | Thread 2 | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| bar(): -1 | | -| barStarted.WRITE(true) at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:38) | | -| MutexImpl#1.lock(null): Unit#1 at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:73) | | -| MutexImpl.lock$suspendImpl(MutexImpl#1,null,): Unit#1 at MutexImpl.lock(Mutex.kt:0) | | -| MutexImpl#1.tryLock(null): true at MutexImpl.lock$suspendImpl(Mutex.kt:171) | | -| tryLockImpl(null): 0 at MutexImpl.tryLock(Mutex.kt:183) | | -| tryAcquire(): true at MutexImpl.tryLockImpl(Mutex.kt:189) | | -| owner.get(): at MutexImpl.tryLockImpl(Mutex.kt:190) | | -| switch | | -| | foo(): SUSPENDED + void | -| | barStarted.READ: true at SuspendTraceReportingTest.foo(SuspendTraceReportingTest.kt:29) | -| | canEnterForbiddenBlock.WRITE(true) at SuspendTraceReportingTest.foo(SuspendTraceReportingTest.kt:29) | -| | MutexImpl#1.lock(null): COROUTINE_SUSPENDED at SuspendTraceReportingTest.foo(SuspendTraceReportingTest.kt:63) | -| | MutexImpl.lock$suspendImpl(MutexImpl#1,null,): COROUTINE_SUSPENDED at MutexImpl.lock(Mutex.kt:0) | -| | MutexImpl#1.tryLock(null): false at MutexImpl.lock$suspendImpl(Mutex.kt:171) | -| | MutexImpl#1.lockSuspend(null): COROUTINE_SUSPENDED at MutexImpl.lock$suspendImpl(Mutex.kt:172) | -| | acquire() at MutexImpl.lockSuspend(Mutex.kt:177) | -| | .getResult(): COROUTINE_SUSPENDED at MutexImpl.lockSuspend(Mutex.kt:321) | -| | trySuspend(): true at CancellableContinuationImpl.getResult(CancellableContinuationImpl.kt:300) | -| | getParentHandle(): null at CancellableContinuationImpl.getResult(CancellableContinuationImpl.kt:310) | -| | installParentHandle(): ChildContinuation#1 at CancellableContinuationImpl.getResult(CancellableContinuationImpl.kt:311) | -| | switch (reason: coroutine is suspended) | -| | result: SUSPENDED + void | -| owner.set(null) at MutexImpl.tryLockImpl(Mutex.kt:191) | | -| counter.READ: 0 at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:40) | | -| counter.WRITE(1) at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:40) | | -| MutexImpl#1.unlock(null) at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:77) | | -| canEnterForbiddenBlock.READ: true at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:42) | | -| result: -1 | | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Thread 1 | Thread 2 | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| bar(): -1 | | +| barStarted.WRITE(true) at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:38) | | +| lock.lock(null): Unit#1 at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:73) | | +| MutexImpl.lock$suspendImpl(MutexImpl#1,null,): Unit#1 at MutexImpl.lock(Mutex.kt:0) | | +| SuspendTraceReportingTest#1.lock.tryLock(null): true at MutexImpl.lock$suspendImpl(Mutex.kt:171) | | +| tryLockImpl(null): 0 at MutexImpl.tryLock(Mutex.kt:183) | | +| tryAcquire(): true at MutexImpl.tryLockImpl(Mutex.kt:189) | | +| owner.get(): at MutexImpl.tryLockImpl(Mutex.kt:190) | | +| switch | | +| | foo(): SUSPENDED + void | +| | barStarted.READ: true at SuspendTraceReportingTest.foo(SuspendTraceReportingTest.kt:29) | +| | canEnterForbiddenBlock.WRITE(true) at SuspendTraceReportingTest.foo(SuspendTraceReportingTest.kt:29) | +| | lock.lock(null): COROUTINE_SUSPENDED at SuspendTraceReportingTest.foo(SuspendTraceReportingTest.kt:63) | +| | MutexImpl.lock$suspendImpl(MutexImpl#1,null,): COROUTINE_SUSPENDED at MutexImpl.lock(Mutex.kt:0) | +| | SuspendTraceReportingTest#1.lock.tryLock(null): false at MutexImpl.lock$suspendImpl(Mutex.kt:171) | +| | SuspendTraceReportingTest#1.lock.lockSuspend(null): COROUTINE_SUSPENDED at MutexImpl.lock$suspendImpl(Mutex.kt:172) | +| | acquire() at MutexImpl.lockSuspend(Mutex.kt:177) | +| | .getResult(): COROUTINE_SUSPENDED at MutexImpl.lockSuspend(Mutex.kt:321) | +| | trySuspend(): true at CancellableContinuationImpl.getResult(CancellableContinuationImpl.kt:300) | +| | getParentHandle(): null at CancellableContinuationImpl.getResult(CancellableContinuationImpl.kt:310) | +| | installParentHandle(): ChildContinuation#1 at CancellableContinuationImpl.getResult(CancellableContinuationImpl.kt:311) | +| | switch (reason: coroutine is suspended) | +| | result: SUSPENDED + void | +| owner.set(null) at MutexImpl.tryLockImpl(Mutex.kt:191) | | +| counter.READ: 0 at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:40) | | +| counter.WRITE(1) at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:40) | | +| lock.unlock(null) at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:77) | | +| canEnterForbiddenBlock.READ: true at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:42) | | +| result: -1 | | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | Detailed trace: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -46,9 +46,9 @@ Detailed trace: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | bar(): -1 | | | barStarted.WRITE(true) at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:38) | | -| MutexImpl#1.lock(null): Unit#1 at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:73) | | +| lock.lock(null): Unit#1 at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:73) | | | MutexImpl.lock$suspendImpl(MutexImpl#1,null,): Unit#1 at MutexImpl.lock(Mutex.kt:0) | | -| MutexImpl#1.tryLock(null): true at MutexImpl.lock$suspendImpl(Mutex.kt:171) | | +| SuspendTraceReportingTest#1.lock.tryLock(null): true at MutexImpl.lock$suspendImpl(Mutex.kt:171) | | | tryLockImpl(null): 0 at MutexImpl.tryLock(Mutex.kt:183) | | | tryAcquire(): true at MutexImpl.tryLockImpl(Mutex.kt:189) | | | _availablePermits.get(): 1 at SemaphoreImpl.tryAcquire(Semaphore.kt:159) | | @@ -58,13 +58,13 @@ Detailed trace: | | foo(): SUSPENDED + void | | | barStarted.READ: true at SuspendTraceReportingTest.foo(SuspendTraceReportingTest.kt:29) | | | canEnterForbiddenBlock.WRITE(true) at SuspendTraceReportingTest.foo(SuspendTraceReportingTest.kt:29) | -| | MutexImpl#1.lock(null): COROUTINE_SUSPENDED at SuspendTraceReportingTest.foo(SuspendTraceReportingTest.kt:63) | +| | lock.lock(null): COROUTINE_SUSPENDED at SuspendTraceReportingTest.foo(SuspendTraceReportingTest.kt:63) | | | MutexImpl.lock$suspendImpl(MutexImpl#1,null,): COROUTINE_SUSPENDED at MutexImpl.lock(Mutex.kt:0) | -| | MutexImpl#1.tryLock(null): false at MutexImpl.lock$suspendImpl(Mutex.kt:171) | +| | SuspendTraceReportingTest#1.lock.tryLock(null): false at MutexImpl.lock$suspendImpl(Mutex.kt:171) | | | tryLockImpl(null): 1 at MutexImpl.tryLock(Mutex.kt:183) | | | tryAcquire(): false at MutexImpl.tryLockImpl(Mutex.kt:189) | | | _availablePermits.get(): 0 at SemaphoreImpl.tryAcquire(Semaphore.kt:159) | -| | MutexImpl#1.lockSuspend(null): COROUTINE_SUSPENDED at MutexImpl.lock$suspendImpl(Mutex.kt:172) | +| | SuspendTraceReportingTest#1.lock.lockSuspend(null): COROUTINE_SUSPENDED at MutexImpl.lock$suspendImpl(Mutex.kt:172) | | | acquire() at MutexImpl.lockSuspend(Mutex.kt:177) | | | decPermits(): 0 at SemaphoreImpl.acquire(Semaphore.kt:413) | | | _availablePermits.getAndDecrement(): 0 at SemaphoreImpl.decPermits(Semaphore.kt:237) | @@ -96,7 +96,7 @@ Detailed trace: | owner.set(null) at MutexImpl.tryLockImpl(Mutex.kt:191) | | | counter.READ: 0 at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:40) | | | counter.WRITE(1) at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:40) | | -| MutexImpl#1.unlock(null) at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:77) | | +| lock.unlock(null) at SuspendTraceReportingTest.bar(SuspendTraceReportingTest.kt:77) | | | isLocked(): true at MutexImpl.unlock(Mutex.kt:213) | | | getAvailablePermits(): 0 at MutexImpl.isLocked(Mutex.kt:149) | | | _availablePermits.get(): -1 at SemaphoreImpl.getAvailablePermits(Semaphore.kt:152) | | diff --git a/src/jvm/test/resources/expected_logs/switch_in_the_middle_of_spin_cycle_causes_error.txt b/src/jvm/test/resources/expected_logs/switch_in_the_middle_of_spin_cycle_causes_error.txt index d336ddebb..df8ccc484 100644 --- a/src/jvm/test/resources/expected_logs/switch_in_the_middle_of_spin_cycle_causes_error.txt +++ b/src/jvm/test/resources/expected_logs/switch_in_the_middle_of_spin_cycle_causes_error.txt @@ -10,40 +10,29 @@ The number next to an exception name helps you find its stack trace provided aft --- The following interleaving leads to the error: -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Thread 1 | Thread 2 | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| | spinLock(): IllegalStateException #2 | -| | switch | -| causeSpinLock(): IllegalStateException #1 | | -| counter.READ: AtomicInteger#1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:39) | | -| counter.incrementAndGet(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:39) | | -| shouldAlwaysBeZero.READ: AtomicInteger#2 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:41) | | -| switch | | -| | counter.READ: AtomicInteger#1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:50) | -| | /* The following events repeat infinitely: */ | -| | counter.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:50) | -| | counter.READ: AtomicInteger#1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:51) | -| | counter.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:51) | -| | shouldAlwaysBeZero.READ: AtomicInteger#2 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:52) | -| | shouldAlwaysBeZero.incrementAndGet(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:52) | -| | illegalInterleavingFound.READ: AtomicBoolean#1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:53) | -| | illegalInterleavingFound.get(): false at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:53) | -| | shouldAlwaysBeZero.READ: AtomicInteger#2 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:54) | -| | switch (reason: active lock detected) | -| shouldAlwaysBeZero.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:41) | | -| illegalInterleavingFound.READ: AtomicBoolean#1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:42) | | -| illegalInterleavingFound.set(true) at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:42) | | -| result: IllegalStateException #1 | | -| | shouldAlwaysBeZero.decrementAndGet(): 0 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:54) | -| | counter.READ: AtomicInteger#1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:51) | -| | counter.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:51) | -| | shouldAlwaysBeZero.READ: AtomicInteger#2 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:52) | -| | shouldAlwaysBeZero.incrementAndGet(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:52) | -| | illegalInterleavingFound.READ: AtomicBoolean#1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:53) | -| | illegalInterleavingFound.get(): true at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:53) | -| | result: IllegalStateException #2 | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Thread 1 | Thread 2 | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| | spinLock(): IllegalStateException #2 | +| | switch | +| causeSpinLock(): IllegalStateException #1 | | +| counter.incrementAndGet(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:39) | | +| switch | | +| | /* The following events repeat infinitely: */ | +| | counter.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:50) | +| | counter.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:51) | +| | shouldAlwaysBeZero.incrementAndGet(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:52) | +| | illegalInterleavingFound.get(): false at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:53) | +| | switch (reason: active lock detected) | +| shouldAlwaysBeZero.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:41) | | +| illegalInterleavingFound.set(true) at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:42) | | +| result: IllegalStateException #1 | | +| | shouldAlwaysBeZero.decrementAndGet(): 0 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:54) | +| | counter.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:51) | +| | shouldAlwaysBeZero.incrementAndGet(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:52) | +| | illegalInterleavingFound.get(): true at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:53) | +| | result: IllegalStateException #2 | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | Exception stack traces: #1: java.lang.IllegalStateException: Illegal interleaving during spin-cycle found @@ -53,37 +42,26 @@ Exception stack traces: at org.jetbrains.kotlinx.lincheck_test.representation.InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:53) Detailed trace: -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Thread 1 | Thread 2 | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| | spinLock(): IllegalStateException #2 | -| | switch | -| causeSpinLock(): IllegalStateException #1 | | -| counter.READ: AtomicInteger#1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:39) | | -| counter.incrementAndGet(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:39) | | -| shouldAlwaysBeZero.READ: AtomicInteger#2 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:41) | | -| switch | | -| | counter.READ: AtomicInteger#1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:50) | -| | /* The following events repeat infinitely: */ | -| | counter.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:50) | -| | counter.READ: AtomicInteger#1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:51) | -| | counter.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:51) | -| | shouldAlwaysBeZero.READ: AtomicInteger#2 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:52) | -| | shouldAlwaysBeZero.incrementAndGet(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:52) | -| | illegalInterleavingFound.READ: AtomicBoolean#1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:53) | -| | illegalInterleavingFound.get(): false at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:53) | -| | shouldAlwaysBeZero.READ: AtomicInteger#2 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:54) | -| | switch (reason: active lock detected) | -| shouldAlwaysBeZero.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:41) | | -| illegalInterleavingFound.READ: AtomicBoolean#1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:42) | | -| illegalInterleavingFound.set(true) at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:42) | | -| result: IllegalStateException #1 | | -| | shouldAlwaysBeZero.decrementAndGet(): 0 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:54) | -| | counter.READ: AtomicInteger#1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:51) | -| | counter.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:51) | -| | shouldAlwaysBeZero.READ: AtomicInteger#2 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:52) | -| | shouldAlwaysBeZero.incrementAndGet(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:52) | -| | illegalInterleavingFound.READ: AtomicBoolean#1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:53) | -| | illegalInterleavingFound.get(): true at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:53) | -| | result: IllegalStateException #2 | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Thread 1 | Thread 2 | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| | spinLock(): IllegalStateException #2 | +| | switch | +| causeSpinLock(): IllegalStateException #1 | | +| counter.incrementAndGet(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:39) | | +| switch | | +| | /* The following events repeat infinitely: */ | +| | counter.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:50) | +| | counter.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:51) | +| | shouldAlwaysBeZero.incrementAndGet(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:52) | +| | illegalInterleavingFound.get(): false at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:53) | +| | switch (reason: active lock detected) | +| shouldAlwaysBeZero.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:41) | | +| illegalInterleavingFound.set(true) at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.causeSpinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:42) | | +| result: IllegalStateException #1 | | +| | shouldAlwaysBeZero.decrementAndGet(): 0 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:54) | +| | counter.get(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:51) | +| | shouldAlwaysBeZero.incrementAndGet(): 1 at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:52) | +| | illegalInterleavingFound.get(): true at InterleavingAnalysisPresentInSpinCycleFirstIterationTest.spinLock(InterleavingAnalysisPresentInSpinCycleFirstIterationTest.kt:53) | +| | result: IllegalStateException #2 | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/src/jvm/test/resources/expected_logs/unsafe_representation_trace.txt b/src/jvm/test/resources/expected_logs/unsafe_representation_trace.txt index 33382694c..e99a676f5 100644 --- a/src/jvm/test/resources/expected_logs/unsafe_representation_trace.txt +++ b/src/jvm/test/resources/expected_logs/unsafe_representation_trace.txt @@ -34,7 +34,7 @@ Detailed trace: | value.READ: 2 at UnsafeTraceRepresentationTest.actionsForTrace(UnsafeTraceRepresentationTest.kt:25) | | | value.compareAndSwapInt(2,3): true at UnsafeTraceRepresentationTest.actionsForTrace(UnsafeTraceRepresentationTest.kt:25) | | | UnsafeTraceRepresentationTest.staticNode.compareAndSwapObject(IntWrapper#4,IntWrapper#5): false at UnsafeTraceRepresentationTest.actionsForTrace(UnsafeTraceRepresentationTest.kt:27) | | -| IntWrapper#3.value.compareAndSwapInt(4,6): true at UnsafeTraceRepresentationTest.actionsForTrace(UnsafeTraceRepresentationTest.kt:28) | | +| node.value.compareAndSwapInt(4,6): true at UnsafeTraceRepresentationTest.actionsForTrace(UnsafeTraceRepresentationTest.kt:28) | | | result: 0 | | | | counter.WRITE(1) at BaseFailingTest.increment(BaseFailingTest.kt:30) | | | actionsForTrace() at BaseFailingTest.increment(BaseFailingTest.kt:31) | @@ -43,6 +43,6 @@ Detailed trace: | | value.READ: 3 at UnsafeTraceRepresentationTest.actionsForTrace(UnsafeTraceRepresentationTest.kt:25) | | | value.compareAndSwapInt(3,3): true at UnsafeTraceRepresentationTest.actionsForTrace(UnsafeTraceRepresentationTest.kt:25) | | | UnsafeTraceRepresentationTest.staticNode.compareAndSwapObject(IntWrapper#4,IntWrapper#7): false at UnsafeTraceRepresentationTest.actionsForTrace(UnsafeTraceRepresentationTest.kt:27) | -| | IntWrapper#6.value.compareAndSwapInt(4,6): true at UnsafeTraceRepresentationTest.actionsForTrace(UnsafeTraceRepresentationTest.kt:28) | +| | node.value.compareAndSwapInt(4,6): true at UnsafeTraceRepresentationTest.actionsForTrace(UnsafeTraceRepresentationTest.kt:28) | | | result: 0 | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/src/jvm/test/resources/expected_logs/var_handle/varhandle_reference_representation.txt b/src/jvm/test/resources/expected_logs/var_handle/varhandle_reference_representation.txt index 5ff0b4426..6a48e6f53 100644 --- a/src/jvm/test/resources/expected_logs/var_handle/varhandle_reference_representation.txt +++ b/src/jvm/test/resources/expected_logs/var_handle/varhandle_reference_representation.txt @@ -39,8 +39,8 @@ Detailed trace: | Array#1[1].compareAndSet(IntWrapper#6,IntWrapper#7): false at VarHandleReferenceRepresentationTest.actionsForTrace(VarHandleRepresentationTests.kt:31) | | | array.READ: Array#1 at VarHandleReferenceRepresentationTest.actionsForTrace(VarHandleRepresentationTests.kt:32) | | | Array#1[1].set(IntWrapper#8) at VarHandleReferenceRepresentationTest.actionsForTrace(VarHandleRepresentationTests.kt:32) | | -| Wrapper#1.value.compareAndSet(1,2): true at VarHandleReferenceRepresentationTest.actionsForTrace(VarHandleRepresentationTests.kt:34) | | -| Wrapper#1.value.set(3) at VarHandleReferenceRepresentationTest.actionsForTrace(VarHandleRepresentationTests.kt:35) | | +| valueWrapper.value.compareAndSet(1,2): true at VarHandleReferenceRepresentationTest.actionsForTrace(VarHandleRepresentationTests.kt:34) | | +| valueWrapper.value.set(3) at VarHandleReferenceRepresentationTest.actionsForTrace(VarHandleRepresentationTests.kt:35) | | | result: 0 | | | | counter.WRITE(1) at BaseFailingTest.increment(BaseFailingTest.kt:30) | | | actionsForTrace() at BaseFailingTest.increment(BaseFailingTest.kt:31) | @@ -54,7 +54,7 @@ Detailed trace: | | Array#1[1].compareAndSet(IntWrapper#13,IntWrapper#14): false at VarHandleReferenceRepresentationTest.actionsForTrace(VarHandleRepresentationTests.kt:31) | | | array.READ: Array#1 at VarHandleReferenceRepresentationTest.actionsForTrace(VarHandleRepresentationTests.kt:32) | | | Array#1[1].set(IntWrapper#15) at VarHandleReferenceRepresentationTest.actionsForTrace(VarHandleRepresentationTests.kt:32) | -| | Wrapper#1.value.compareAndSet(1,2): false at VarHandleReferenceRepresentationTest.actionsForTrace(VarHandleRepresentationTests.kt:34) | -| | Wrapper#1.value.set(3) at VarHandleReferenceRepresentationTest.actionsForTrace(VarHandleRepresentationTests.kt:35) | +| | valueWrapper.value.compareAndSet(1,2): false at VarHandleReferenceRepresentationTest.actionsForTrace(VarHandleRepresentationTests.kt:34) | +| | valueWrapper.value.set(3) at VarHandleReferenceRepresentationTest.actionsForTrace(VarHandleRepresentationTests.kt:35) | | | result: 0 | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |