Skip to content

Porting Guide: Include information on implementing certain language/runtime features #621

Open
@qinsoon

Description

@qinsoon

We should include some dedicated chapters in our Porting Guide that introduce how to implement certain language or VM features when using MMTk, for example:

  • GC initialization
  • Command line options
  • Thread local structure (Mutator)
    • OS (native) thread,
    • M*P VM thread ("goroutine", Erlang process, ...)
    • coroutine ("greenlet", Lua "thread", ...)
    • Ruby Ractor and GIL
  • Fast paths in the binding
    • Allocation fast paths
    • Barrier fast paths
  • Weak references and finalizers
    • Involves Scanning::process_weak_refs and basic theories of weak references, reachability, etc.
  • Conservative GC
    • Conservative stack scanning: Involves VO bits and object pinning (RootsWorkFactory::create_process_pinning_roots_work), may even transitive pinning.
    • Conservative object/field scanning: Involves "potential pinning parents" and the memory_manager::pin_object API.
  • Object pinning
    • Involves different kinds of pinning APIs, including pinning roots, and the non-root memory_manager::pin_object API.
  • Interior pointers
    • Involves VO bits and linear scanning.
  • Address-based hashing

We can also add a more comprehensive FAQ which answers smaller questions in a few sentences, and links bigger questions to one of the dedicated sections above, or part of the API doc.

Adding dedicated sections to those topics

We often receive questions on our Zulip channels about how to support VMs that need specific features, such as finalizers, object pinning, and so on. Each of them involve some feature sets of MMTk. We will introduce those features (such as Scanning::process_weak_ref, the VO bits metadata, the "object_pinning" Cargo feature, etc.) in those sections.

Different sections may overlap in the set of features involved. For example, both conservative stack scanning and native interface need object pinning, and both conservative stack scanning and interior pointers need VO bits. That's OK, and the same feature may be described from different perspectives. The canonical description of those features is still the API documentation (generated from the doc comments of Rust functions, types, modules, etc.).

The FAQ

This is supposed to be the first thing a user should look at when they have a question. It can be a long list, including many questions users may ask. We don't have to answer everything there, but instead we may provide links to porting guide sections or API doc pages.

Some examples:

Q: Can I get the number of GCs happened since the VM starts?
A: MMTk doesn't have an API for getting GC count, yet. But you can maintain your own counter and increment it in Collection::resume_mutators.
Q: My VM scans stacks conservatively. Can I do this with MMTk?
A: Read the section for conservative GC: (insert link to the section here)
Q: Does MMTk support naive reference counting?
A: It sucks. Try MarkSweep instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docArea: DocumentationC-missingCategory: Missing stuff that should be addedP-normalPriority: Normal.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions