Skip to content

Commit e4d6b56

Browse files
Support setting the mmtk thread count with MMTK_THREADS
1 parent 17dad25 commit e4d6b56

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gc/mmtk/src/api.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ pub extern "C" fn mmtk_builder_default() -> *mut MMTKBuilder {
4444

4545
const DEFAULT_HEAP_MIN: usize = 1 << 20;
4646

47+
let mmtk_threads: usize = std::env::var("MMTK_THREADS")
48+
.unwrap_or("0".to_string())
49+
.parse::<usize>()
50+
.unwrap_or(0);
51+
4752
let mut mmtk_heap_min = match std::env::var("MMTK_HEAP_MIN") {
4853
Ok(min) => {
4954
let capa = parse_capacity(&min, DEFAULT_HEAP_MIN);
@@ -90,6 +95,10 @@ pub extern "C" fn mmtk_builder_default() -> *mut MMTKBuilder {
9095
// Between 1MiB and 500MiB
9196
builder.options.gc_trigger.set(mmtk_mode);
9297

98+
if mmtk_threads > 0 {
99+
builder.options.threads.set(mmtk_threads);
100+
}
101+
93102
Box::into_raw(Box::new(builder))
94103
}
95104

0 commit comments

Comments
 (0)