-
Notifications
You must be signed in to change notification settings - Fork 78
Fix stop-the-world race. #450
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
Conversation
a72ce6d to
ba20773
Compare
qinsoon
left a comment
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.
Is the change necessary for the OpenJDK binding change? I feel it probably would work fine without this PR. Though it may not be necessary to stop/resume from the MMTk coordinator thread for OpenJDK, this is still a nice property to have for mmtk-core, as 1. we do have a designated coordinator thread, 2. other VMs may require something like this.
|
@qinsoon It is not necessary. Without this change, the There is an alternative solution, i.e. making it configurable in mmtk-core (an |
I think this sounds good. Can you add that in this PR? It probably can be a build-time feature. |
ba20773 to
9f8e71c
Compare
With the associated commit in the mmtk-openjdk repository, stop-the-world and start-the-world requests no longer have to be made in the MMTk coordinator thread. Considering that some VM may still require the thread that stops the world and the thread that starts the world to be the same, we added a constant in the Collection trait so that VM bindings can override it when needed.
9f8e71c to
af5ba8c
Compare
|
@qinsoon It could be a compile-time feature (as in "Cargo feature"). However, I think it should be set per-instance. There could be two different VMs in one process, and they have different requirements. Instead, I added a I will not change my PR in diff --git a/mmtk/src/collection.rs b/mmtk/src/collection.rs
index 81b6326..2e3f6f4 100644
--- a/mmtk/src/collection.rs
+++ b/mmtk/src/collection.rs
@@ -20,6 +20,8 @@ extern "C" fn create_mutator_scan_work<E: ProcessEdgesWork<VM = OpenJDK>>(
}
impl Collection<OpenJDK> for VMCollection {
+ const COORDINATOR_ONLY_STW: bool = false;
+
fn stop_all_mutators<E: ProcessEdgesWork<VM = OpenJDK>>(tls: VMWorkerThread) {
let f = {
if <OpenJDK as VMBinding>::VMScanning::SCAN_MUTATORS_IN_SAFEPOINT { |
|
@wks I think this PR is good to merge. If you dont have any other change, I will merge this (first mmtk-core and the openjdk fork, then the openjdk binding). |
|
@qinsoon Nope. That's all I am going to change for the three repositories. |
With the associated commit in the mmtk-openjdk repository, stop-the-world and start-the-world requests no longer have to be made in the MMTk coordinator thread.
NOTE: This change will break the current
mmtk-openjdkbinding, because the VM will raise errors if the thread that starts the world is not the thread that stopped the world. Sommtk-openjdkshould only update its dependency to this revision at the same time it applied its corresponding PR for the stop-the-world race fix.