-
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
Support time and random native calls in trace debugger #541
base: develop
Are you sure you want to change the base?
Conversation
93fb82c
to
5f3b23e
Compare
…ts for deterministic randomness and fix found bugs
5f3b23e
to
f9ed737
Compare
@@ -83,7 +81,18 @@ abstract class ManagedStrategy( | |||
// Tracker of objects' allocations and object graph topology. | |||
protected abstract val objectTracker: ObjectTracker? | |||
// Tracker of objects' identity hash codes. | |||
internal abstract val identityHashCodeTracker: ObjectIdentityHashCodeTracker | |||
private val identityHashCodeTracker = ObjectIdentityHashCodeTracker() | |||
private val nativeMethodCallStatesTracker = NativeMethodCallStatesTracker() |
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 add comment similar to other trackers.
internal abstract val identityHashCodeTracker: ObjectIdentityHashCodeTracker | ||
private val identityHashCodeTracker = ObjectIdentityHashCodeTracker() | ||
private val nativeMethodCallStatesTracker = NativeMethodCallStatesTracker() | ||
internal val traceDebuggerEventTrackers: Map<TraceDebuggerTracker, AbstractTraceDebuggerEventTracker> = mapOf( |
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.
Add an empty line before this tracker.
} | ||
internal fun closeTraceDebuggerTrackers() { | ||
traceDebuggerEventTrackers.values.forEach { it.close() } | ||
} |
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.
Add missing empty lines.
@@ -1153,6 +1164,12 @@ abstract class ManagedStrategy( | |||
objectTracker?.registerNewObject(obj) | |||
} | |||
} | |||
|
|||
override fun getNativeCallStateOrNull(id: Id): Any? = nativeMethodCallStatesTracker.getStateOrNull(id) |
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.
Empty line + wrap method body in {}
or put on next line.
* with this file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package org.jetbrains.kotlinx.lincheck.strategy.managed |
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.
Anything ASM or bytecode related should be put in transformation
subpackage.
val expectedResult = List(10) { 0 } | ||
require(randomList == expectedResult) { "Wrong randomizer: $randomList != $expectedResult" } | ||
} | ||
} |
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: add representation test for native method call trackers
void advanceCurrentTraceDebuggerEventTrackerId(TraceDebuggerTracker tracker, long oldId); | ||
|
||
Object getNativeCallStateOrNull(long id); | ||
void setNativeCallState(long id, Object state); |
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.
Think about how these methods should interact with beforeMethodCall
and other method tracking functions.
@@ -66,34 +72,94 @@ internal class DeterministicHashCodeTransformer( | |||
} | |||
|
|||
/** | |||
* [DeterministicTimeTransformer] tracks invocations of [System.nanoTime] and [System.currentTimeMillis] methods, | |||
* [FakeDeterministicTimeTransformer] tracks invocations of [System.nanoTime] and [System.currentTimeMillis] methods, |
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.
Let's now split it into DeterministicRandomTransformers.kt
and DeterministicTimeTransformers.kt
.
No description provided.