-
Notifications
You must be signed in to change notification settings - Fork 74
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
Reorganize src/scheduler/gc_work.rs #1279
Comments
We really should rename all of them at the same time. For example |
Maybe we just call it |
I think 'too long' is not a good reason to rename a type, if it is clear and not ambiguous. We don't want a short name that is not clear while the old name is more or less accepted. The criteria for choosing a name when it is first introduced should be different from renaming when the name was already introduced. We need a better reason to rename. |
I mean frankly, they are confusing as well. The verbosity doesn't help. |
Can you elaborate in which way they are confusing? |
I just don't understand why
In general, I think we are eager to abstract away things into traits when they may not really be necessary. For example, the aforementioned |
Regarding #1281, maybe we can move The trait |
I added it because I think
Maybe we can rename it to
They are made into traits because we don't want to expose their implementations to the users. And a principle of defining a general API is depending on interfaces (traits) instead of depending on implementations. And as I said before, there may be multiple implementations when we do the refactoring. So using traits can hide all those details from the VM binding. |
I feel like that is making it worse, personally. I feel like this may need to be discussed with everyone, because I do still believe longer type names are bad since it just adds to the noise. |
That's intended. I want everyone to know it is bad so we want to remove it every time we see it. It is a constant reminder that the status quo is not ideal and it needs some fundamental changes. |
Please don't do this. The better way is to document and write this down clearly. For example, I have no clue that you deliberately use bad names to 'convey' the idea. |
You are right. It's better to mention this intention in the comment. |
The file
src/scheduler/gc_work.rs
contains about 1200 lines of code, with more than 20 structs and more than 50impl
items.This made it difficult for developers to find the right type or function when they want to make modification to MMTk. But one design goal of MMTk is to make this easy.
Reorganizing this file into multiple files
We can categorize the work packets and traits by their use cases.
Unless specified, items listed below are
struct
items.ScheduleCollection
StopMutators
Prepare
PrepareMutator
PrepareCollector
Release
ReleaseMutator
ReleaseCollector
VMPostForwarding
(running concurrently withRelease
)ScanMutatorRoots
ScanVMSpecificRoots
ProcessEdgesWorkRootsWorkFactory
(implementsRootsWorkFactory
defined insrc/vm/scanning.rs
)RootsKind
ProcessEdgesBase
(This is all about processing slots instead of edges).ProcessEdgesWork
(This part really needs to be refactored.ProcessEdgesWork::trace_object
shouldn't be specific to slot-enqueued tracing.)SFTProcessEdges
PlanProcessEdges
ProcessEdgesWorkTracer
(implementsObjectTracer
defined insrc/vm/scanning.rs
)UnsupportedProcessEdges
ScanObjectsWork
ScanObjects
PlanScanObjects
ProcessRootNode
(for pinning and transitive-pinning roots)ProcessEdgesWorkTracerContext
(implementsTracerContext
defined insrc/vm/scanning.rs
)VMProcessWeakRefs
VMForwardWeakRefs
Refactoring slots-processing work packets
In the early stage of the Rust port, MMTk was very focused on slot-enqueuing tracing because that's what OpenJDK and JikesRVM do. One design decision which I think is bad is that it mixed up "edge processing" and "slots processing".
trace_object
, and store back forwarded reference.trace_object(obj) -> new_obj
method. This effectively visits an object graph edge that points toobj
, regardless whetherobj
is loaded from a givenSlot
or obtained in VM-specific ways inScanning::scan_object_and_trace_edges
. In the end, if a VM binding only supports node-enqueuing tracing (such as Ruby), we have to wrapProcessEdgesWork
behind theObjectTracer
trait which only provides thetrace_object
method (that is,ProcessEdgesWorkTracer
).I had a branch that refactors the
trace_object
into a dedicated type and leaves theProcessEdgesWork
dedicated to slot processing. The code is here: #1278, but it is very old.And #599 contains more information about my intended refactoring.
The text was updated successfully, but these errors were encountered: