-
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
New model checker algorithm #410
Draft
eupp
wants to merge
48
commits into
develop
Choose a base branch
from
new-mc
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
5da52ff
moved all event-structure-related files from the `eventstruct-mc` branch
eupp 3b99739
WIP: fixes after `eventstruct-mc` branch transferring
eupp d5876d9
minor fixes
eupp 2d6a0c1
minor fixes and refactoring
eupp 4b56f1d
transfer atomics tests from eventstruct-mc branch
eupp 2f16111
add EXPERIMENTAL_MODEL_CHECKING instrumentation mode
eupp 0a3c64e
minor fixes
eupp bdc40bd
repair object allocation tracking code
eupp dcabb69
minor fixes
eupp 1408231
repair EventStructureStrategy spin-loop bounding
eupp 76f58b3
add array accesses tests
eupp 2ca6978
fix in `MemoryLocation` and `MemoryTracker`
eupp 47c83b2
transfer System.arraycopy instrumentation from eventstruct-mc branch
eupp 7f9acfe
ransfer `java.lang.reflect.Array.newInstance` instrumentation from ev…
eupp 00f3e3f
add runtime check to avoid intercepting array reads if the array elem…
eupp 3df0107
fix spin-loop bounding in event-structure strategy (reset counters on…
eupp f819285
add VarHandle tests
eupp 40b9d65
fix VarHandle handling logic
eupp 4d14db9
fix `onArrayCopy` (wrap in ignored section)
eupp 38303d1
minor fixes
eupp 265ec40
minor fixes
eupp 7885bcf
bugfixing FieldInheritedFromInterfaceTest (problems with static class…
eupp 8271ed6
WIP: compilation errors fixes after rebase
eupp bd91f74
WIP: compilation errors fixes after rebase (in tests)
eupp 2194f78
restore atomic methods result interception
eupp e62b3d3
restore atomic methods result interception
eupp efaf031
fix debug stats printing
eupp 05a0232
fixes after rebase (fix invocation initialization logic)
eupp 8ec1ab7
minor fixes
eupp 347a27b
fix skipping verification of SpinLoopBoundInvocationResult
eupp eab0e76
minor fixes in `trackAtomicMethodMemoryAccess` method after rebase
eupp 35c6322
fix bug with clocks (perform deep copy of `HBClock` objects)
eupp f60ee52
fix bug in MethodCallTransformer and repair old model checking strategy
eupp 4cd12c7
fix event structure execution reset logic for trace collection replay
eupp 384498a
repair ByteArrayAccessTest/BooleanArrayAccessTest
eupp 81e5655
better fix for validation actor bug in EventStructureStrategy
eupp 8fd399c
fix bug in Execution::isEmpty
eupp c3a4b13
minor infra fixes
eupp 1c99b02
hack to get LocalObjectsTests pass (related to SPIN_BOUND constant --…
eupp cc55529
fix trace collection for the new-mc (do not re-create runner)
eupp 37a9304
bugfix coroutines scheduling and blocking
eupp 3b92001
fix duplicate coroutine resume events
eupp 9553a80
fix a BATSHIT CRAZY BUG in the coroutines runner
eupp 43c7db4
fix ParallelThreadsRunner::Completion::context (make it immutable)
eupp e17af1e
introduce system property to opt-in into experimental model checking
eupp 06de6a6
minor
eupp 6b30fbd
fixes after rebase
eupp c6b9e25
remove obsolete files
eupp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,20 +186,24 @@ public static boolean isRandom(Object any) { | |
* | ||
* @return whether the trace point was created | ||
*/ | ||
public static boolean beforeReadField(Object obj, String className, String fieldName, int codeLocation, | ||
public static boolean beforeReadField(Object obj, String className, String fieldName, String typeDescriptor, int codeLocation, | ||
boolean isStatic, boolean isFinal) { | ||
if (!isStatic && obj == null) return false; // Ignore, NullPointerException will be thrown | ||
return getEventTracker().beforeReadField(obj, className, fieldName, codeLocation, isStatic, isFinal); | ||
return getEventTracker().beforeReadField(obj, className, fieldName, typeDescriptor, codeLocation, isStatic, isFinal); | ||
} | ||
|
||
/** | ||
* Called from the instrumented code before any array cell read. | ||
* | ||
* @return whether the trace point was created | ||
*/ | ||
public static boolean beforeReadArray(Object array, int index, int codeLocation) { | ||
public static boolean beforeReadArray(Object array, int index, String typeDescriptor, int codeLocation) { | ||
if (array == null) return false; // Ignore, NullPointerException will be thrown | ||
return getEventTracker().beforeReadArrayElement(array, index, codeLocation); | ||
return getEventTracker().beforeReadArrayElement(array, index, typeDescriptor, codeLocation); | ||
} | ||
|
||
public static Object interceptReadResult() { | ||
return getEventTracker().interceptReadResult(); | ||
} | ||
|
||
/** | ||
|
@@ -214,20 +218,20 @@ public static void afterRead(Object value) { | |
* | ||
* @return whether the trace point was created | ||
*/ | ||
public static boolean beforeWriteField(Object obj, String className, String fieldName, Object value, int codeLocation, | ||
public static boolean beforeWriteField(Object obj, String className, String fieldName, String typeDescriptor, Object value, int codeLocation, | ||
boolean isStatic, boolean isFinal) { | ||
if (!isStatic && obj == null) return false; // Ignore, NullPointerException will be thrown | ||
return getEventTracker().beforeWriteField(obj, className, fieldName, value, codeLocation, isStatic, isFinal); | ||
return getEventTracker().beforeWriteField(obj, className, fieldName, typeDescriptor, value, codeLocation, isStatic, isFinal); | ||
} | ||
|
||
/** | ||
* Called from the instrumented code before any array cell write. | ||
* | ||
* @return whether the trace point was created | ||
*/ | ||
public static boolean beforeWriteArray(Object array, int index, Object value, int codeLocation) { | ||
public static boolean beforeWriteArray(Object array, int index, String typeDescriptor, Object value, int codeLocation) { | ||
if (array == null) return false; // Ignore, NullPointerException will be thrown | ||
return getEventTracker().beforeWriteArrayElement(array, index, value, codeLocation); | ||
return getEventTracker().beforeWriteArrayElement(array, index, typeDescriptor, value, codeLocation); | ||
} | ||
|
||
/** | ||
|
@@ -250,13 +254,27 @@ public static void afterReflectiveSetter(Object receiver, Object value) { | |
getEventTracker().afterReflectiveSetter(receiver, value); | ||
} | ||
|
||
public static void onArrayCopy(Object srcArray, int srcPos, Object dstArray, int dstPos, int length) { | ||
getEventTracker().onArrayCopy(srcArray, srcPos, dstArray, dstPos, length); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add comment about System.arraycopy |
||
|
||
/** | ||
* Called from the instrumented code before any method call. | ||
* | ||
* @param owner is `null` for public static methods. | ||
* @return true if the method result should be intercepted. TODO: revisit this API decision | ||
*/ | ||
public static void beforeMethodCall(Object owner, String className, String methodName, int codeLocation, int methodId, Object[] params) { | ||
getEventTracker().beforeMethodCall(owner, className, methodName, codeLocation, methodId, params); | ||
public static boolean beforeMethodCall(Object owner, String className, String methodName, int codeLocation, int methodId, Object[] params) { | ||
return getEventTracker().beforeMethodCall(owner, className, methodName, codeLocation, methodId, params); | ||
} | ||
|
||
/** | ||
* Intercepts the result of a method call. | ||
* | ||
* @return The intercepted result of the method call. | ||
*/ | ||
public static Object interceptMethodCallResult() { | ||
return getEventTracker().interceptMethodCallResult(); | ||
} | ||
|
||
/** | ||
|
@@ -294,6 +312,10 @@ public static void afterNewObjectCreation(Object obj) { | |
getEventTracker().afterNewObjectCreation(obj); | ||
} | ||
|
||
public static void afterObjectInitialization(Object obj) { | ||
getEventTracker().afterObjectInitialization(obj); | ||
} | ||
|
||
/** | ||
* Called from the instrumented code to replace [java.lang.Object.hashCode] method call with some | ||
* deterministic value. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ repositories { | |
kotlin { | ||
@OptIn(ExperimentalKotlinGradlePluginApi::class) | ||
compilerOptions { | ||
allWarningsAsErrors = true | ||
// allWarningsAsErrors = true | ||
} | ||
|
||
jvm { | ||
|
@@ -119,7 +119,16 @@ tasks { | |
if (instrumentAllClasses.toBoolean()) { | ||
systemProperty("lincheck.instrumentAllClasses", "true") | ||
} | ||
val extraArgs = mutableListOf<String>() | ||
val extraArgs = mutableListOf<String>( | ||
// flags to import Unsafe module; | ||
// it is used in some tests to check handling of unsafe APIs by Lincheck | ||
"--add-opens", "java.base/jdk.internal.misc=ALL-UNNAMED", | ||
"--add-exports", "java.base/jdk.internal.util=ALL-UNNAMED", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extract |
||
) | ||
val useExperimentalModelChecking: String by project | ||
if (useExperimentalModelChecking.toBoolean()) { | ||
extraArgs.add("-Dlincheck.useExperimentalModelChecking=true") | ||
} | ||
val withEventIdSequentialCheck: String by project | ||
if (withEventIdSequentialCheck.toBoolean()) { | ||
extraArgs.add("-Dlincheck.debug.withEventIdSequentialCheck=true") | ||
|
@@ -157,6 +166,8 @@ tasks { | |
ideaActive -> 10 | ||
else -> 0 | ||
} | ||
// temporarily ignore representation tests, because they are unsupported in the new strategy | ||
// exclude("org/jetbrains/kotlinx/lincheck_test/representation") | ||
} | ||
|
||
val jvmTestIsolated = register<Test>("jvmTestIsolated") { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Re-check if
typeDescriptor
is required (find its 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.
Check if
isPrimitive: Boolean
would be enough.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.
TODO: Extract into separate PR.