-
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
ProcessEdgesWork must die #599
Labels
P-normal
Priority: Normal.
Comments
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TL;DR: There is no common way of processing edges.
ProcessEdgesWork
is not really common. It is only common to full-heap tracing GC. What's worse, the current stack-scanning API (Scanning::scan_xxxx_root
) depends on this trait.And ProcessEdgesBase must die, too.
TODO list
ProcessEdgesWork
into a concrete work packet for tracing.trace: impl TransitiveClosure
fromtrace_object
. Remove TransitiveClosure param from Space::trace_object and Scanning::scan_object #559ProcessEdgesWork
. Decouple root scanning from ProcessEdgesWork. #598Problem
There is nothing in common among edge-processing work packets.
From the name
ProcessEdgesWork
, we infer that it represents a work packet that processes edges. But, seriously, what's in common for all work packets that process edges? Nothing.Currently,
ProcessEdgesWork
has several algorithms or abstract methods built-in:trace_object
, and (optionally) store back to the edge.trace_object
, and create (and optionally execute) aScanObjects
work packet.Are they common to all work packets that process edges? Well, they are, for common stop-the-world full-heap tracing GC. All such GC algorithms, including MarkSweep, MarkCompact, SemiSpace, Immix, GenCopy, GenImmix (that is, everything we have in the current master branch), do tracing like this.
trace_object
. It only traces objects in the nursery. Currently,GenNurseryProcessEdges
is the only hand-written plan-specificProcessEdgesWork
implementation.trace_object
and enqueuing, and certainly not recursively scanning objects and processing edges beyond them.The stack-scanning interface is tightly coupled with
ProcessEdgesWork
.The
Scanning::scan_xxxxx_root
methods take a<E: ProcessEdgesWork>
type parameter. The VM is supposed to create work packets that implementsProcessEdgesWork
. Given thatProcessEdgesWork
is not general enough, this can be harmful for GC algorithms that does not match what the currentProcessEdgesWork
is designed for.The following snippet is from https://github.com/wenyuzhao/mmtk-core/blob/lxr-merge/src/util/cm.rs#L206
From the code snippet above, we observe that:
self.base
is completely unused.CMImmixCollectRootEdges
implementsProcessEdgesWork
for the sole reason that it needs to be passed to root-scanning functions.CMImmixCollectRootEdges
does not fit the design ofProcessEdgesWork
. Thetrace_object
function is leftunimplemented!()
becauseCMImmixCollectRootEdges
does not trace objects at all. It does not flush the object bufferbase.node
, either.What should we do?
We should convert the current
ProcessEdgesWork
trait into a concrete work packet. The behaviour oftrace_object
may differ according to the strategy of delegatingtrace_object
to the appropriate space. We can choose fromPlanTraceObject
We can parameterise the work packet (using generics and/or data parameters) to customise the strategy.
We should also change the root-scanning API to decouple it from
ProcessEdgesWork
. The goal is, stack-scanning interface should only present to the mmtk-core lists of edges. Concretely, the edges can beThe root-scanning API must not dictate what kind of work packets mmtk-core should create to handle the root edges. Particularly, the API should not force the work packets created for handling those root edges implement the
ProcessEdgesWork
trait. The kind of work packets should be decided by the plan. As a result,CMImmixCollectRootEdges
should not need to implementProcessEdgesWork
, or embedProcessEdgesBase
inside it, because the stack-scanning API no longer require it.There is some proof-of-concept work going on: #598 From the code, we see it is easier to refactor
ProcessEdgesWork
before fixing the root-scanning API, or to do the two refactoring at the same time.Dependencies
It will be easier if we remove the
trace: impl TransitiveClosure
parameter fromtrace_object
first. Currently, thistrace: impl TransitiveClosure
parameter forms a two-way dependency betweenProcessEdgesWork
andtrace_object
, becausetrace_object
will call back toProcessEdgesWork::process_node
. See #559The text was updated successfully, but these errors were encountered: