-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to allow enough virtual memory for nursery with constrained virtual
memory environment.
- Loading branch information
Showing
5 changed files
with
121 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/vm/tests/mock_tests/mock_test_nursery_virtual_memory_constrained.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// GITHUB-CI: MMTK_PLAN=GenImmix | ||
|
||
use super::mock_test_prelude::*; | ||
|
||
use crate::util::heap::layout::vm_layout::*; | ||
use crate::util::options::*; | ||
|
||
#[test] | ||
pub fn constrained() { | ||
with_mockvm( | ||
default_setup, | ||
|| { | ||
// 4G heap with a 32 bits vm layout. | ||
const MB: usize = 1024 * 1024; | ||
let heap_size = 4096 * MB; | ||
let fixture = MutatorFixture::create_with_builder(|builder| { | ||
builder.set_vm_layout(VMLayout::new_32bit()); | ||
builder | ||
.options | ||
.nursery | ||
.set(NurserySize::ProportionalBounded { | ||
min: 0.1f64, | ||
max: 1.0f64, | ||
}); | ||
builder | ||
.options | ||
.gc_trigger | ||
.set(GCTriggerSelector::FixedHeapSize(heap_size)); | ||
}); | ||
// Use the default 32MB virtual memory. | ||
assert_eq!( | ||
fixture | ||
.mmtk() | ||
.get_options() | ||
.nursery | ||
.estimate_virtual_memory_in_bytes(heap_size), | ||
32 * MB, | ||
); | ||
}, | ||
no_cleanup, | ||
) | ||
} |
42 changes: 42 additions & 0 deletions
42
src/vm/tests/mock_tests/mock_test_nursery_virtual_memory_not_constrained.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// GITHUB-CI: MMTK_PLAN=GenImmix | ||
|
||
use super::mock_test_prelude::*; | ||
|
||
use crate::util::heap::layout::vm_layout::*; | ||
use crate::util::options::*; | ||
|
||
#[test] | ||
pub fn non_constrained() { | ||
with_mockvm( | ||
default_setup, | ||
|| { | ||
// 100M heap with a 32 bits vm layout. | ||
const MB: usize = 1024 * 1024; | ||
let heap_size = 100 * MB; | ||
let fixture = MutatorFixture::create_with_builder(|builder| { | ||
builder.set_vm_layout(VMLayout::new_32bit()); | ||
builder | ||
.options | ||
.nursery | ||
.set(NurserySize::ProportionalBounded { | ||
min: 0.1f64, | ||
max: 1.0f64, | ||
}); | ||
builder | ||
.options | ||
.gc_trigger | ||
.set(GCTriggerSelector::FixedHeapSize(heap_size)); | ||
}); | ||
// We should use 100M virtual memory for nursery. | ||
assert_eq!( | ||
fixture | ||
.mmtk() | ||
.get_options() | ||
.nursery | ||
.estimate_virtual_memory_in_bytes(heap_size), | ||
heap_size | ||
); | ||
}, | ||
no_cleanup, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters