Skip to content
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

Decouple root scanning from ProcessEdgesWork. #598

Closed
wants to merge 2 commits into from

Conversation

wks
Copy link
Collaborator

@wks wks commented May 19, 2022

This draft PR is a proposal for changing the root-scanning interface.

When scanning roots, the VM should only report what roots it has, not deciding what work packets to create. But currently, scan_thread_root, scan_thread_roots and scan_vm_specific_root take a generic type parameter <E: ProcessEdgesWork> which binds them to a ProcessEdgesWork. This may not be general enough, in two ways:

  1. Some VMs cannot present roots as edges. They can only present roots as nodes because they cannot update the root edges. One example is the Ruby VM. It uses conservative stack scanning, and cannot update roots. It gives the GC a list of values on the stack, and some of them are roots (can be filtered using the is_mmtk_object function in the core).
  2. Some GC algorithms do root scanning significantly differently than our current ProcessEdgesWork. Although ProcessEdgesWork is still a trait, it is too tied to some kinds of GC. For example, it contains the logic of tracing objects and scanning objects (via ScanObjects). The real culprit is the ProcessEdgesWork.

However, from the code in this PR, we observe that we need to wrap ProcessEdgesWork in such a complicated manner just to get a chance to call the plan-specific trace_object function. Probably it is easier to do this refactoring if we eliminate (or weaken) the ProcessEdgesWork trait first.

wks added 2 commits May 17, 2022 23:43
During root scanning, the VM should only report lists of roots.  It is
the responsibility of mmtk-core (particularly the Plan), not the VM, to
decide what work packet to create for the roots.

This commit introduces a RootsHandlerFactory.  It provides factory
methods for creating work packets from a list of edges (for updating
root edges) or nodes (which pins the roots).  Concrete plans provide
concrete factories and decide what work packets to use.
@wks
Copy link
Collaborator Author

wks commented Jun 24, 2022

Superseded by #611

@wks wks closed this Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant