Skip to content

Clean up cargo features: feature vs option vs const booleanΒ #775

@qinsoon

Description

@qinsoon

I am talking about cargo features, our runtime options, and const booleans in the code. They all change MMTk's behaviours. But they have obvious differences, and I think we should be careful about this.

The following is what I propose:

  1. Adding const booleans is a trivial change, as they are not public to the users. We should feel free to add as long as they are useful to developers in the future.
  2. We have to use cargo features if
    1. we need conditional compilation (e.g. optional base spaces, alloc bit).
    2. our users (bindings) want something out of box for every build (e.g. non-moving immix).
  3. We have to use runtime options if we want to configure something at runtime.
  4. If we can freely choose between cargo features and runtime options, we should prefer using runtime options as they do not require a rebuild.

With this proposal, we may consider making the following changes:

  • sanity: feature -> runtime option. It just involves scheduling sanity work. There is a check in every ProcessEdgesWork, we need to make sure this does not introduce overhead.
  • perf_counter: feature -> (removed). perf_counter only works on linux, we can use cfg(target_os = "linux") instead. We also have runtime options to set perf events, which should be sufficient.
  • object_pining: feature -> (removed). We can just include all the methods about object pinning.
  • nogc_no_zeroing: feature -> const boolean.
  • single_worker: feature -> (removed). We can just use the options threads to set worker threads.
  • immix_zero_on_release: feature -> const boolean. This is just an option for developing and debugging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions