Skip to content

Remove env_var and command_line from options #1240

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

Merged
merged 8 commits into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/userguide/src/migration/prefix.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,29 @@ Notes for the mmtk-core developers:

<!-- Insert new versions here -->

## 0.32.0

### `Options` no longer differentiates between environment variables and command line arguments.

```admonish tldr
We replaced both `Options::set_from_command_line` and `Options::set_from_env_var` with
`Options::set_from_string` because all options can now be set via either environment variable or
command line arguments.
```

API changes:

- module `util::options`
+ `Options::set_from_command_line`: Removed.
* Use `Options::set_from_string` instead.
+ `Options::set_from_env_var`: Removed.
* Use `Options::set_from_string` instead.
+ `Options::set_bulk_from_command_line`: Removed.
* Use `Options::set_bulk_from_string` instead.
+ All `<T>` in `MMTKOption<T>` now must implement `FromStr`.
* This means you can parse a string into `T` when setting an `MMTKOption<T>`. For
example, `options.plan.set(user_input.parse()?);`.

## 0.30.0

### `live_bytes_in_last_gc` becomes a runtime option, and returns a map for live bytes in each space
Expand Down
4 changes: 2 additions & 2 deletions src/mmtk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ impl MMTKBuilder {

/// Set an option.
pub fn set_option(&mut self, name: &str, val: &str) -> bool {
self.options.set_from_command_line(name, val)
self.options.set_from_string(name, val)
}

/// Set multiple options by a string. The string should be key-value pairs separated by white spaces,
/// such as `threads=1 stress_factor=4096`.
pub fn set_options_bulk_by_str(&mut self, options: &str) -> bool {
self.options.set_bulk_from_command_line(options)
self.options.set_bulk_from_string(options)
}

/// Custom VM layout constants. VM bindings may use this function for compressed or 39-bit heap support.
Expand Down
Loading
Loading