-
Notifications
You must be signed in to change notification settings - Fork 34
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
Spin locks detection enchancements #331
Conversation
# Conflicts: # bootstrap/src/sun/nio/ch/lincheck/EventTracker.kt # src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt # src/jvm/main/org/jetbrains/kotlinx/lincheck/transformation/LincheckClassVisitor.kt # src/jvm/test/org/jetbrains/kotlinx/lincheck_test/AbstractLincheckTest.kt
.../main/org/jetbrains/kotlinx/lincheck/strategy/managed/modelchecking/ModelCheckingStrategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/TracePoint.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/LoopDetector.kt
Outdated
Show resolved
Hide resolved
src/jvm/test/org/jetbrains/kotlinx/lincheck_test/representation/ScalaBugTest.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/LoopDetector.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/LoopDetector.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/transformation/CodeLocations.kt
Outdated
Show resolved
Hide resolved
src/jvm/test/org/jetbrains/kotlinx/lincheck_test/AbstractLincheckTest.kt
Show resolved
Hide resolved
src/jvm/test/resources/expected_logs/obstruction_freedom_violation_with_no_detected_cycle.txt
Show resolved
Hide resolved
.../main/org/jetbrains/kotlinx/lincheck/strategy/managed/modelchecking/ModelCheckingStrategy.kt
Outdated
Show resolved
Hide resolved
@avpotapov00, could you please check the documentation with Grammarly or Grazie? |
* Provides the prefix output for the [TraceNode]. | ||
* @see TraceNodePrefixFactory | ||
*/ | ||
internal fun interface PrefixProvider { |
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.
Isn't it always the same string for each instance?
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.
What do you mean?
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.
It is not the same string, prefix reflects depth call and sometimes includes arrows parts of the spin cycle. See the implementation and usages.
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.
When you create a new PrefixProvider, does it always generate the same prefix? Or how does it work? What does Provider
mean?
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 take a look at the org.jetbrains.kotlinx.lincheck.strategy.managed.TraceNodePrefixFactory
documentation: it is described there.
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
@@ -821,6 +828,7 @@ abstract class ManagedStrategy( | |||
null | |||
} | |||
newSwitchPoint(iThread, codeLocation, tracePoint) | |||
loopDetector.beforeWriteArrayElement(array, index, value) |
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.
Should it be called before newSwitchPoint
or after? Why?
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.
In the current implementation it doesn't matter. But it looks more logical after the newSwitchPoint call as after we back to a thread we want to trace field read after the switch, not before (as it will actually happen).
@@ -797,6 +803,7 @@ abstract class ManagedStrategy( | |||
null | |||
} | |||
newSwitchPoint(iThread, codeLocation, tracePoint) | |||
loopDetector.beforeWriteField(obj, value) |
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.
Should it be called before newSwitchPoint or after? Why?
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.
In the current implementation it doesn't matter. But it looks more logical after the newSwitchPoint
call as after we back to a thread we want to trace field read after the switch, not before (as it will actually happen).
src/jvm/test/org/jetbrains/kotlinx/lincheck_test/representation/RecursiveSpinLockTest.kt
Outdated
Show resolved
Hide resolved
src/jvm/test/org/jetbrains/kotlinx/lincheck_test/representation/RecursiveSpinLockTest.kt
Outdated
Show resolved
Hide resolved
General comment: would the current IDEA plugin work with this PR being merged? |
# Conflicts: # bootstrap/src/sun/nio/ch/lincheck/EventTracker.kt # src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt # src/jvm/test/resources/expected_logs/spin_lock_events_cut_inner_loop.txt
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.
@eupp, please review the recent changes and merge the PR when it's ready.
Closes #218, #219, adds recursive spin locks support and overall spin locks detection enhancements.