Skip to content

Commit b17d14e

Browse files
committed
Revert changes to mmtk and memory_manager
1 parent 314dcea commit b17d14e

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/memory_manager.rs

+19
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,25 @@ pub fn initialize_collection<VM: VMBinding>(mmtk: &'static MMTK<VM>, tls: VMThre
494494
mmtk.initialize_collection(tls);
495495
}
496496

497+
/// Process MMTk run-time options. Returns true if the option is processed successfully.
498+
///
499+
/// Arguments:
500+
/// * `mmtk`: A reference to an MMTk instance.
501+
/// * `name`: The name of the option.
502+
/// * `value`: The value of the option (as a string).
503+
pub fn process(builder: &mut MMTKBuilder, name: &str, value: &str) -> bool {
504+
builder.set_option(name, value)
505+
}
506+
507+
/// Process multiple MMTk run-time options. Returns true if all the options are processed successfully.
508+
///
509+
/// Arguments:
510+
/// * `mmtk`: A reference to an MMTk instance.
511+
/// * `options`: a string that is key value pairs separated by white spaces, e.g. "threads=1 stress_factor=4096"
512+
pub fn process_bulk(builder: &mut MMTKBuilder, options: &str) -> bool {
513+
builder.set_options_bulk_by_str(options)
514+
}
515+
497516
/// Return used memory in bytes. MMTk accounts for memory in pages, thus this method always returns a value in
498517
/// page granularity.
499518
///

src/mmtk.rs

+11
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@ impl MMTKBuilder {
7575
}
7676
}
7777

78+
/// Set an option.
79+
pub fn set_option(&mut self, name: &str, val: &str) -> bool {
80+
self.options.set_by_string(name, val)
81+
}
82+
83+
/// Set multiple options by a string. The string should be key-value pairs separated by white spaces,
84+
/// such as `threads=1 stress_factor=4096`.
85+
pub fn set_options_bulk_by_str(&mut self, options: &str) -> bool {
86+
self.options.bulk_set_by_string(options)
87+
}
88+
7889
/// Custom VM layout constants. VM bindings may use this function for compressed or 39-bit heap support.
7990
/// This function must be called before MMTk::new()
8091
pub fn set_vm_layout(&mut self, constants: VMLayout) {

0 commit comments

Comments
 (0)