-
Notifications
You must be signed in to change notification settings - Fork 68
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
Decuple reference processor from ProcessEdgesWork
#604
Comments
I don't think we need a special type for reference processor. Reference processor could use any type that we use for tracing (currently
|
Neither of them can have subclasses, but plans can customise them by provide different However, if we plan to commit to
If the "special type" means
Here is an in-progress work for |
We implemented object enqueuing by wrapping Ruby now uses the new VM-specific weak reference processing API: #700 This makes the changes of the built-in reference processors unnecessary. Actually we shall replace the built-in reference and finalization processors with OpenJDK-specific and JikesRVM-specific implementations. I am closing this issue. More discussions about migrating to the new weak reference processing API happen in: #694 |
TL;DR: The reference processor is tightly coupled with
ProcessEdgesWork
work packets, making it impossible to support runtimes that can only do object-enqueuing. We can make it general.Problem
Currently, reference-processing work packets
{Soft,Weak,Phantom}RefProcessing
takeProcessEdgesWork
as a parameter. For example:Seeing from the use pattern, it instantiates
E
, passes it toscan_soft_refs
, and calls.flush()
on it. It never callsw.do_work
, which indicatesProcessEdgesWork
is not a sub-task ofSoftRefProcessing
. Instead,SoftRefProcessing
is just stealing some functionalities fromProcessEdgesWork
!Analysis
It uses the
E: ProcessEdgesWork
type for three purposes:E::trace_object
to trace object. Traced soft/weak/phantom references will become softly/weakly/phantomly reachable.E
as an object queue.E::trace_object
takes a queue parameter (currently in the form of aTransitiveClosure
, but will be refactored in Remove TransitiveClosure param from Space::trace_object and Scanning::scan_object #559).w.flush()
does this. It will create aScanObjects
work packet to scan objects.From the analysis, the
SoftRefProcessing
work packet only has two dependencies:trace_object
in the appropriate space, andThe queue is just a
Vec<ObjectReference>
(or whatever that wraps it) and can be created locally.Solution
To move away from
ProcessEdgesWork
, we just need to parameterise{Soft,Weak,Phantom}RefProcessing
with a trait that provides the above two operations, namelytrace_object
andpost_scan_object
.I have a draft for this trait. I call it
TracingDelegate
.They are just the three methods provided by
PlanTraceObject
, except without theKIND
which can be parameterised on concrete implementations.There should be two implementations, one for SFT, and the other for
PlanTraceObject
, just like there areSFTProcessEdges
andPlanProcessEdges
.Then
SoftRefProcessing
can just calltrace_object
from that trait. TheScanObjects
trait can also be refactored to use that trait.The text was updated successfully, but these errors were encountered: