Add SimulatorThread support for Thread subclasses under simulation#29
Merged
ylecaillez merged 1 commit intopingidentity:mainfrom Apr 11, 2026
Merged
Conversation
4b7bbfc to
60ded94
Compare
… simulation Rewrite Thread subclasses to extend SimulatorThread (a VirtualThread injected into java.base via --patch-module) so they run under the deterministic scheduler. This is experimental and may be reverted if it causes more issues than it solves. The approach of patching java.base and rewriting superclass hierarchies is inherently fragile and may break with JDK updates or unusual Thread subclass patterns. Build time: - PatchModuleGenerator strips ACC_FINAL from VirtualThread and compiles SimulatorThread from source, packaging both into opendst-patch.jar - Instrumentation rewrites 'extends Thread' to 'extends SimulatorThread' and redirects super() calls in constructors Runtime: - --patch-module java.base=opendst-patch.jar injects SimulatorThread - installSimulatorThreadCallback() wires the per-node executor and thread attachment callbacks into SimulatorThread's static fields Also removes CDS support as it is incompatible with --patch-module.
60ded94 to
b738cb0
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Solve the 'extends Thread' problem: classes that subclass Thread now run as virtual threads under deterministic simulation.
Build-time:
Runtime:
Also removes CDS support: --patch-module on java.base makes CDS impossible (JVM refuses it), so the --cds/--no-cds flag was dead code.