-
Notifications
You must be signed in to change notification settings - Fork 71
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
Unique object enqueuing option #1255
Conversation
Added a constant `VMBinding::UNIQUE_OBJECT_ENQUEUING`. When set to true, MMTk will guarantee that each object is enqueued at most once in each GC. This can be useful for VMs that piggyback on object scanning to visit objects during GC. Implementation-wise, the mark bit is set atomically when `VMBinding::UNIQUE_OBJECT_ENQUEUING` is true. This PR only affects the native MarkSweep space. Other spaces already do this atomically. Fixes: mmtk#1254
This PR intends to fix the immediate problem of MarkSweep enqueuing objects multiple times, which may crash the Ruby binding when there are multiple GC workers and the plan is MarkSweep. I observed that MarkSweepSpace and ImmixSpace do object marking completely differently, and there are code fragments related to marking scattered in |
Re: MarkState refactoring. Yeah I've done it in my branch, but you have to be careful since you can't use it for LOS. LOS mark bits are 2-bits per page not 1-bit per valid object. You could probably just cherry-pick the commit from here: k-sareen@c31c80e |
The "Public API Check" failed. This PR introduces a new API |
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.
Just a minor suggestion. Otherwise it looks good to me.
src/vm/mod.rs
Outdated
/// override this if they need. For example, some VMs piggyback on object-scanning to visit | ||
/// objects during a GC, but may have data race if multiple GC workers visit the same object at | ||
/// the same time. Such VMs can set this constant to `true` to workaround this problem. | ||
const UNIQUE_OBJECT_ENQUEUING: bool = false; |
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.
We can move this to the Scanning
trait. It seems only relevant for scanning.
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.
Agreed. I moved it to the Scanning
trait.
Should update |
It's a bit hard for the current implementation because |
Added a constant
VMBinding::UNIQUE_OBJECT_ENQUEUING
. When set to true, MMTk will guarantee that each object is enqueued at most once in each GC. This can be useful for VMs that piggyback on object scanning to visit objects during GC.Implementation-wise, the mark bit is set atomically when
VMBinding::UNIQUE_OBJECT_ENQUEUING
is true. This PR only affects the native MarkSweep space. Other spaces already do this atomically.Fixes: #1254