-
Notifications
You must be signed in to change notification settings - Fork 81
Extract common work packet to schedule_common() #471
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
Conversation
wks
left a comment
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.
Looks good for now.
But I think we can further improve readability by using associated types.
|
|
||
| pub fn schedule_common<E: ProcessEdgesWork<VM = VM>>( | ||
| /// Schedule all the common work packets | ||
| pub fn schedule_common< |
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.
This function has too many type parameters. May be simplified using traits and associated types.
| debug!("Nursery GC"); | ||
| self.common() | ||
| .schedule_common::<GenNurseryProcessEdges<VM, GenImmixCopyContext<VM>>>( | ||
| .schedule_common::<Self, GenNurseryProcessEdges<VM, GenImmixCopyContext<VM>>, GenImmixCopyContext<VM>>( |
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.
The type arguments here is especially complicated, with type parameters inside type parameters.
|
Here is my attempt to group together several type parameters using However, it currently crashes the Rust compiler, probably because the constant generic parameter feature is unstable. Comment out the last two lines in fn main() {
work::<StringToScreen>();
// work::<IntToScreenDec>();
// work::<IntToScreenHex>();
} |
I worked on this a bit. We can introduce a new trait: pub trait GCWorkContext<VM: VMBinding> {
type PlanType: Plan<VM = VM>;
type CopyContextType: CopyContext<VM = VM> + GCWorkerLocal;
type ProcessEdgesWorkType: ProcessEdgesWork<VM = VM>;
}We can use this for |
This PR extracts common work packets generation from each plan to a
schedule_common()function. Each plan will call this. This closes #368.