-
Notifications
You must be signed in to change notification settings - Fork 39
Spin locks detection enhancements #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… caused by multiple spin cycle iterations.
…s' into spin-locks-detection-enhancements
…on-enhancements # Conflicts: # src/jvm/main/org/jetbrains/kotlinx/lincheck/runner/InvocationResult.kt # src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/InterleavingSequenceTrackableSet.kt # src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt # src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/modelchecking/ModelCheckingStrategy.kt # src/jvm/test/org/jetbrains/kotlinx/lincheck_test/representation/SpinlockEventsCutTests.kt # src/jvm/test/resources/expected_logs/switch_in_the_middle_of_spin_cycle_causes_error.txt
ndkoval
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is an intermediate review. I need to switch to java agents now; after that, I'll finish the review.
| api("org.ow2.asm:asm-commons:$asmVersion") | ||
| api("org.ow2.asm:asm-util:$asmVersion") | ||
| api("org.reflections:reflections:$reflectionsVersion") | ||
| api("net.sf.trove4j:trove4j:3.0.3") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please repackage it to org.jetbrains.kotlinx.lincheck
|
|
||
| package org.jetbrains.kotlinx.lincheck.strategy.managed; | ||
|
|
||
| public class TrackMethodsFlagHolder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rewrite to Kotlin
|
|
||
| package org.jetbrains.kotlinx.lincheck.strategy.managed; | ||
|
|
||
| public class TrackMethodsFlagHolder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you use it only when detecting spin locks?
| className.equals(kotlinx.coroutines.CoroutineExceptionHandler.class.getName()) || | ||
| className.equals(kotlinx.coroutines.CoroutineDispatcher.class.getName()); | ||
| className.equals(kotlinx.coroutines.CoroutineDispatcher.class.getName()) || | ||
| className.equals(TrackMethodsFlagHolder.class.getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly to other Lincheck classes, it should not be transformed by default
| } | ||
|
|
||
| fun rollbackAfterSpinCycleFound() { | ||
| lastNotInitializedNode = initialLastNotInitializedNode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change related to another bug?
| cycleExecutionsHash: Int, | ||
| ): InterleavingHistoryNode { | ||
| check(executions >= executionsBeforeCycle) | ||
| check(executions >= executionsBeforeCycle) { "?" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace "?" with a meaningful message
| if (startIndex > newChain.lastIndex) return | ||
| val firstNewNode = newChain[startIndex] | ||
| val firstNewNodeExecutions = (firstNewNode.executions + firstNewNode.spinCyclePeriod) - executionsCountedEarlier | ||
| val firstNewNodeExecutions = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert the formatting
| cycleOccurred = cycleOccurred, | ||
| cycleLocationsHash = cycleLocationsHash | ||
| cycleLocationsHash = cycleLocationsHash, | ||
| executionsBeforeSpinCycleWithAdditionalEvents = executionsBeforeSpinCycleWithAdditionalEvents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shorten the parameter name
| it.cycleOccurred && executionsCount == it.executions | ||
| } ?: false | ||
|
|
||
| val executionsBeforeSpinCycleWithAdditionalEvents: Int get() = currentNode!!.executionsBeforeSpinCycleWithAdditionalEvents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document
| } else CycleInfo( | ||
| minLastPositionNotRelatedToCycle + 1, | ||
| targetCycleLength | ||
| ) // number of prefix elements with first cycle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the comment in the correct place?
|
The changes will be delivered under #331 |
Closes #219 #218 and adds recursive spin-locks support.
Subtasks:
developwithjavaagent2d