-
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
Use macro to generate process edges for plans #575
Conversation
Performance result for this PR. This PR only changes GC. These results show the stop-the-world time. More results can be found in the links at the end. The results are based on d09c58a (with the Perf links (not publicly visible) semispacehttps://squirrel.anu.edu.au/plotty/yilin/yp-2015/#0|bear-2022-05-05-Thu-100348-ss-macro-process-edges-new&benchmark^build^invocation^iteration&bmtime^time.other^time.stw&|10&iteration^1^2|20&1^invocation|30&1&benchmark&build;jdk-mmtk-master|41&Histogram%20(with%20CI)^build^benchmark&gen immixhttps://squirrel.anu.edu.au/plotty/yilin/yp-2015/#0|bear-2022-05-02-Mon-095232-genix-macro-process-edges-new&benchmark^build^invocation^iteration&bmtime^time.other^time.stw&|10&iteration^1^2|20&1^invocation|30&1&benchmark&build;jdk-mmtk-master|41&Histogram%20(with%20CI)^build^benchmark&immixhttps://squirrel.anu.edu.au/plotty/yilin/yp-2015/#0|bear-2022-04-28-Thu-152509-immix-macro-process-edges&benchmark^build^invocation^iteration&bmtime^time.other^time.stw&|10&iteration^1^2|20&1^invocation|30&1&benchmark&build;jdk-mmtk-master|41&Histogram%20(with%20CI)^build^benchmark& |
Now it is provided as a hook **after** scan_object. It no longer customises how to do scan_object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly OK, except some minor spelling, documentation and structural problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR. It helps refactor a large part of the codebase and makes the code cleaner and shorter. It also removes the dynamic dispatch introduced in SFTProcessEdges
.
Here're some of my high-level concerns:
- The macro and the unification of
trace_object
forces all the policies to have the sametrace_object
signature. But different policies will have different implementations oftrace_object
with different behaviours and parameters, or even different return values. One immediate drawback of this PR is that if a policy wants to pass one more argument, it has to change the unified interface, which will also change the macro definition code and all the other policies to adapt to the interface change. This adds a cost to future development. #[derive(PlanTraceObject)]
implies that each plan or policy can only be bind to onetrace_object
implementation. For GC like Immix which requires multiple implementations, it has to introduce another generic argsTraceKind
. I'm afraid this is probably not a nice and clean approach.TraceKind
was introduced only because ImmixSpace has two differentProcessEdges
, and they share a large amount of common code. But this is not the case for other policies. For policies with multiple differentProcessEdges
andtrace_object
, introducingTraceKind
again inPlanTraceObject
will only make things more complicated.- In addition, different policies defines different
TraceKind
values, this makes the meaning ofTraceKind
become different at different places. This also makes the compiler (or human) harder to check if all theTraceKind
value matching and comparison code are written correctly.
- In addition, different policies defines different
Thanks for the reviews. Before going into each comment, I will just address your concerns first.
Do you have an example in your mind about extra parameters in
Depending on For your concern about using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably have only one macro crate called mmtk-macros
rather than multiple macro crate for different features, such as mmtk-macro-trace-object
.
We may have more macros in the future. Then,
- Different macros may share common utilities, such as handling attributes.
- The sub crates that contain macros will also appear on crates.io
The second point matters. If we have multiple crates, then there will be multiple mmtk-macro-xxx
crates on crates.io. They will be visible to the world as:
- https://crates.io/crates/mmtk-macro-trace-object
- https://crates.io/crates/mmtk-macro-foo
- https://crates.io/crates/mmtk-macro-bar
- https://crates.io/crates/mmtk-macro-baz
- ...
And they need to be versioned, too. If we add more features, we will introduce even more crates. Although having multiple crates doesn't seem to violate crates.io's policy (They do, however, disallow "using an automated tool to claim ownership of a large number of package names".), it is much harder to maintain so many crates.
PlanProcessEdge/PlanScanObjects to scheduler::gc_work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me now. Please make sure Wenyu's comments are also addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR adds
PlanProcessEdges
, and a few macros/traits that are used inPlanProcessEdges
. 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.PolicyTraceObject
. Each policy provides an implementation of this. With this trait, a plan no longer include any policy-specific code in trace object.PlanTraceObject
and related macros. With the macro, plan implementer can declaratively specify trace object behavior with attributes, and the implementation ofPlanTraceObject
will be generated by the macro.PlanProcessEdges
. This usesPlanTraceObject
to provide a general implementation ofProcessEdgesWork
. We no longer need any plan-specific process edges work.