-
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
Moving ScanObjects::do_work to the plan #576
Comments
The idea looks fine. But |
I ended up with an implementation of In theory the generated code should be doing the same as before (with policy-specific scan work packet). |
I suggest changing In aspect-oriented programming terms, I examined what ImmixSpace does in More over, I would like to add object enqueuing (see #581). By doing this, I will change impl<E: ProcessEdgesWork> GCWork<E::VM> for ScanObjects<E> {
fn do_work(&mut self, worker: &mut GCWorker<E::VM>, _mmtk: &'static MMTK<E::VM>) {
trace!("ScanObjects");
{
let tls = worker.tls;
let mut edges_closure = EdgesClosure::<E>::new(worker);
let mut objects_closure = ObjectsClosure::<E>::new(worker);
for object in &self.buffer {
use crate::vm::Scanning;
if <E::VM as VMBinding>::VMScanning::support_edge_enqueuing {
// Do edge-enqueuing as we do it now.
<E::VM as VMBinding>::VMScanning::scan_object(tls, *object, &mut edges_closure);
} else {
// Additionally support object-enqueuing.
<E::VM as VMBinding>::VMScanning::scan_object_and_process_edges(tls, *object, |to_obj| {
trace_object(to_obj, &mut objects_closure)
);
}
// This is called no matter how an object is scanned,
// so ImmixSpace remain oblivious of object-enqueuing or edge-enqueuing.
self.plan.post_scan_object(*object);
}
}
trace!("ScanObjects End");
}
} If ImmixSpace provides an "around advice" to |
This sounds good. I probably will just cherry-pick your commit to my PR. |
This PR adds `PlanProcessEdges`, and a few macros/traits that are used in `PlanProcessEdges`. This PR removes policy-specific code from plan, and use macros to generate trace object work for each plan. This PR closes #258, and closes #576. * add a trait `PolicyTraceObject`. Each policy provides an implementation of this. With this trait, a plan no longer include any policy-specific code in trace object. * add a trait `PlanTraceObject` and related macros. With the macro, plan implementer can declaratively specify trace object behavior with attributes, and the implementation of `PlanTraceObject` will be generated by the macro. * add a type `PlanProcessEdges`. This uses `PlanTraceObject` to provide a general implementation of `ProcessEdgesWork`. We no longer need any plan-specific process edges work.
TL;DR: If
ScanObjects
is plan-specific, why not letPlan
do whatScanObjects::do_work
does, so thatScanObjects
is no longer plan-specific?Status Quo
Now we have
ScanObjects
ScanObjectsAndMarkLines
Only Immix uses the latter. Because it uses the latter, Immix also has
ImmixProcessEdges
GenImmixMatureProcessEdges
They only exist because they need the special
ScanObjectsAndMarkLines
But we don't want so many plan-specific work packets.
Proposal.
Just one
ScanObjects
. NoScanObjectsAndMarkLines
.We move
ScanObjects::do_work
to Plan.If Immix is special, it can just override the plan.
And we can delete
ScanObjectsAndMarkLines
.The text was updated successfully, but these errors were encountered: