-
Notifications
You must be signed in to change notification settings - Fork 69
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
Tidy up mutator scan API #875
Conversation
* Remove Scanning::SCAN_MUTATORS_IN_SAFEPOINT, and Scanning::SINGLE_THREAD_MUTATOR_SCANNING. * Remove Scanning::scan_roots_in_all_mutator_threads. * Remove Collection::prepare_mutator * Update comments for a few methods
I also just realized that the GC state is never updated to |
Right. We should require the binding to use the callback. Bindings should use the callback, but do not have to implement |
That feels like a bit of a waste though? We'll end up scheduling empty |
But I also realized that if the binding doesn't execute the |
Perhaps we should just flush the mutators in |
It should fix a crash in JikesRVM caused by overflown stack overwriting objects in the VM space.
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.
My understanding of the discussion was that if the binding/VM can't tell us when its threads are ready for scanning, then we should still provide a way to flush each mutator. Or is that the binding's job? If it is, then it should be documented.
I think we conclude that a binding will tell us when the thread is ready to be scanned. It can tell us as soon as a thread is stopped, or after all the threads are stopped. But the binding has to tell us that. Flushing mutator is not a binding's job. MMTk will do that. We require a binding to tell us if a thread can be scanned, and we schedule |
Right. I'm getting hung up on the case where the binding/VM doesn't differentiate between thread roots and other kinds of roots. In that case the binding will just dump all roots into the Also can we rename the |
// TODO: The stack scanning work won't start immediately, as the `Prepare` bucket is not opened yet (the bucket is opened in notify_mutators_paused). | ||
// Should we push to Unconstrained instead? |
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.
Someone may want some work to be done before scanning any stacks, but currently there is no such things. For Ruby, "potential pinning parents" (PPP) needs to be handled before transitive closure, but can be done at the same time as stack scanning.
We also had some issue letting OpenJDK report the yielding of individual threads. See mmtk/openjdk#9 There used to be something called report_java_thread_yield
, but we removed that. So the current status is that OpenJDK can only report that all threads have come to a stop.
I think we can leave the code as is for now. After we figure out how to report the yielding of each thread (for OpenJDK 11, 17 and 22), we can make another attempt and move the ScanStackRoot
work packet to Unconstrained
or another bucket.
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.
There is the prepare_mutator
function for VM-specific behaviour. But this PR would remove that.
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.
Someone may want some work to be done before scanning any stacks, but currently there is no such things. For Ruby, "potential pinning parents" (PPP) needs to be handled before transitive closure, but can be done at the same time as stack scanning.
The binding can do whatever work is needed before it tells MMTk that the thread is ready. For the Ruby case, the binding can just schedule the PPP work to a bucket prior to the Closure bucket.
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.
There is the
prepare_mutator
function for VM-specific behaviour. But this PR would remove that.
Yeah. I think it is confusing about when we should invoke it. For the old timing where we call prepare_mutator
, the binding can do it before returning stop_all_mutators
. JikesRVM is the only binding we know that uses the method. I changed it to https://github.com/mmtk/mmtk-jikesrvm/pull/147/files#diff-54f4f04a18788baf9bf66cff8c4256151b680087e3490fb8e8f62e2d60ad9fabR30.
I would suggest simply calling it |
I have renamed the packet to |
Co-authored-by: Kunshan Wang <wks1986@gmail.com>
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.
LGTM. But bindings need to adapt to this change, too.
This PR closes mmtk#496. * Remove Scanning::SCAN_MUTATORS_IN_SAFEPOINT, and Scanning::SINGLE_THREAD_MUTATOR_SCANNING. * Remove Scanning::scan_roots_in_all_mutator_threads. * Remove Collection::prepare_mutator * Update comments for a few methods
This PR closes #496.