-
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
Static memory snapshot collecting and restoring #418
Conversation
Let's rebase on |
c77bef2
to
dd0160d
Compare
336e12d
to
8eac5dc
Compare
...m/main/org/jetbrains/kotlinx/lincheck/strategy/managed/modelchecking/ModelCheckingCTest.java
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
...ain/org/jetbrains/kotlinx/lincheck/transformation/transformers/SnapshotTrackerTransformer.kt
Outdated
Show resolved
Hide resolved
...ain/org/jetbrains/kotlinx/lincheck/transformation/transformers/SnapshotTrackerTransformer.kt
Outdated
Show resolved
Hide resolved
...ain/org/jetbrains/kotlinx/lincheck/transformation/transformers/SnapshotTrackerTransformer.kt
Outdated
Show resolved
Hide resolved
...ain/org/jetbrains/kotlinx/lincheck/transformation/transformers/SnapshotTrackerTransformer.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/SnapshotTracker.kt
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/SnapshotTracker.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/SnapshotTracker.kt
Outdated
Show resolved
Hide resolved
src/jvm/test/resources/expected_logs/var_handle/varhandle_boolean_representation.txt
Show resolved
Hide resolved
.../org/jetbrains/kotlinx/lincheck_test/strategy/modelchecking/snapshot/AtomicFUSnapshotTest.kt
Outdated
Show resolved
Hide resolved
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.
@dmitrii-artuhov Please fix a few remaining minor issues, otherwise looks good to me.
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedCTestConfiguration.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedOptions.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/SnapshotTracker.kt
Show resolved
Hide resolved
.../org/jetbrains/kotlinx/lincheck/transformation/transformers/SharedMemoryAccessTransformer.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/util/ObjectGraph.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/util/UnsafeHolder.kt
Outdated
Show resolved
Hide resolved
} | ||
return null | ||
|
||
restoreStaticMemorySnapshot() |
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.
But do you need additional call to restoreStaticMemorySnapshot
here, if there is already a call to it in ManagedStrategy::run
?
@eupp I've rewritten it, see the modified |
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/Strategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/Strategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/Strategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/transformation/SafeClassWriter.java
Show resolved
Hide resolved
@@ -91,6 +90,14 @@ internal class LincheckClassVisitor( | |||
} | |||
if (methodName == "<init>") { | |||
mv = ObjectCreationTransformer(fileName, className, methodName, mv.newAdapter()) | |||
mv = run { |
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.
Can we treat <init>
similar to normal functions?
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.
I did not try including <init>
methods in the whole transformation chain. Right now I only require tracking fields/arrays accesses and other constructor invocations inside <init>
method bodies.
Maybe the feature of integrating constructors in full transformation chain should be a separate PR, since there are might be tricky spots where to account for #424
This PR partly resolves issue #389
Here we introduced a lazy-tracking feature which aims to only track and restore variables reachable from static memory iff the variables were accessed perviously via read or write operations. Yet, there are still problems (see issue) that are left to be tackled in separate PRs.
Proposed solutions in this PR:
System.arraycopy(...)
)SafeClassWriter::getCommonSuperClass(...)
. Thanks to @ndkoval for help!