WIP: Add RefScanPolicy to object-scanning methods of Scanning#1437
Draft
wks wants to merge 11 commits intommtk:masterfrom
Draft
WIP: Add RefScanPolicy to object-scanning methods of Scanning#1437wks wants to merge 11 commits intommtk:masterfrom
wks wants to merge 11 commits intommtk:masterfrom
Conversation
The VM binding only needs to know the `RefScanPolicy` trait but not its implementations.
"StrongClosure" and "StrongOnly" are too similar.
This makes the type parameter implicit and make it unnecessary to write `<_, Closure>`.
Otherwise `Closure` may be ambiguous. This also makes it looks like the `EnumName::Variant` style.
We change the `tls` from `VMWorkerThread` to `VMThread` because mutator threads can also scan objects in write barriers.
wks
added a commit
to wks/mmtk-openjdk
that referenced
this pull request
Feb 3, 2026
mmtk-core introduced `RefScanPolicy` in object-scanning functions. We selectively visit strong and/or weak references according to the `RefScanPolicy`. Related PR: mmtk/mmtk-core#1437
Collaborator
Author
|
binding-refs |
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.
We add a
RefScanPolicytype parameter in object-scanning functions (scan_objectandscan_object_and_trace_edges) in theScanningtrait. It tells the VM binding whether it should visit strong and/or weak reference fields using the callback argument, and whether it should "discover" weak references in VM-specific ways if the VM chooses to do so.This PR is intended to pave a path for porting the OpenJDK-style reference processing from the
lxrbranch and eventually supporting LXR.We also made some minor changes to the object-scanning functions.
tlsparameter ofsupport_slot_enqueuing,scan_objectandscan_object_and_trace_edgesis nowVMThreadinstead ofVMWorkerThread. This allows mutator threads to scan objects in write barriers without a workaround.SlotVisitorandObjectTracertype parameters are replaced with implicitimpltypes. Because object-scanning functions now take an explicitRefScanPolicytype parameter, we makeSlotVisitorandObjectTracerimplicit to avoid the unnecessary_like inscan_object::<_, ref_scan_policy::Closure>.TODO:
lxrbranch.Decide whether we should add aWe just useRefScanPolicyimplementation for barriers.ref_scan_poilcy::StrongOnlyfor the SATB barrier.Fixes: #1376
Fixes: #1375