-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR adds internal pointer support. It supersedes #1155 which provides a simple but inefficient implementation for internal pointers. This PR is based on #1159 which adds requirements for object reference alignment. This PR * adds `memory_manager::find_object_from_internal_pointer` * The call is dispatched using SFT to each space. * Large object space only checks the first word in VO bit for every page. * Mark sweep and immix space only searches for the max object size for those spaces. * Allow iterating side metadata bits. * Allow loading raw byte/word in side metadata.
- Loading branch information
Showing
30 changed files
with
1,503 additions
and
152 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
use criterion::Criterion; | ||
|
||
#[cfg(feature = "is_mmtk_object")] | ||
use mmtk::util::test_util::fixtures::*; | ||
use mmtk::util::test_util::mock_method::*; | ||
use mmtk::util::test_util::mock_vm::{write_mockvm, MockVM}; | ||
|
||
pub fn bench(c: &mut Criterion) { | ||
// Setting a larger heap, although the GC should be disabled in the MockVM | ||
#[cfg(feature = "is_mmtk_object")] | ||
let mut fixture = MutatorFixture::create_with_heapsize(1 << 30); | ||
|
||
// Normal objects | ||
// 16KB object -- we want to make sure the object can fit into any normal space (e.g. immix space or mark sweep space) | ||
const NORMAL_OBJECT_SIZE: usize = 16 * 1024; | ||
write_mockvm(|mock| { | ||
*mock = MockVM { | ||
get_object_size: MockMethod::new_fixed(Box::new(|_| NORMAL_OBJECT_SIZE)), | ||
is_collection_enabled: MockMethod::new_fixed(Box::new(|_| false)), | ||
..MockVM::default() | ||
} | ||
}); | ||
|
||
c.bench_function("internal pointer - normal objects", |_b| { | ||
#[cfg(feature = "is_mmtk_object")] | ||
{ | ||
use mmtk::memory_manager; | ||
use mmtk::AllocationSemantics; | ||
let addr = memory_manager::alloc( | ||
&mut fixture.mutator, | ||
NORMAL_OBJECT_SIZE, | ||
8, | ||
0, | ||
AllocationSemantics::Default, | ||
); | ||
let obj_ref = MockVM::object_start_to_ref(addr); | ||
memory_manager::post_alloc( | ||
&mut fixture.mutator, | ||
obj_ref, | ||
NORMAL_OBJECT_SIZE, | ||
AllocationSemantics::Default, | ||
); | ||
let obj_end = addr + NORMAL_OBJECT_SIZE; | ||
_b.iter(|| { | ||
memory_manager::find_object_from_internal_pointer::<MockVM>( | ||
obj_end - 1, | ||
NORMAL_OBJECT_SIZE, | ||
); | ||
}) | ||
} | ||
#[cfg(not(feature = "is_mmtk_object"))] | ||
panic!("The benchmark requires is_mmtk_object feature to run"); | ||
}); | ||
|
||
// Large objects | ||
// 16KB object | ||
const LARGE_OBJECT_SIZE: usize = 16 * 1024; | ||
write_mockvm(|mock| { | ||
*mock = MockVM { | ||
get_object_size: MockMethod::new_fixed(Box::new(|_| LARGE_OBJECT_SIZE)), | ||
is_collection_enabled: MockMethod::new_fixed(Box::new(|_| false)), | ||
..MockVM::default() | ||
} | ||
}); | ||
c.bench_function("internal pointer - large objects", |_b| { | ||
#[cfg(feature = "is_mmtk_object")] | ||
{ | ||
use mmtk::memory_manager; | ||
use mmtk::AllocationSemantics; | ||
let addr = memory_manager::alloc( | ||
&mut fixture.mutator, | ||
LARGE_OBJECT_SIZE, | ||
8, | ||
0, | ||
AllocationSemantics::Los, | ||
); | ||
let obj_ref = MockVM::object_start_to_ref(addr); | ||
memory_manager::post_alloc( | ||
&mut fixture.mutator, | ||
obj_ref, | ||
LARGE_OBJECT_SIZE, | ||
AllocationSemantics::Los, | ||
); | ||
let obj_end = addr + LARGE_OBJECT_SIZE; | ||
_b.iter(|| { | ||
memory_manager::find_object_from_internal_pointer::<MockVM>( | ||
obj_end - 1, | ||
LARGE_OBJECT_SIZE, | ||
); | ||
}) | ||
} | ||
#[cfg(not(feature = "is_mmtk_object"))] | ||
panic!("The benchmark requires is_mmtk_object feature to run"); | ||
}); | ||
} |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod alloc; | ||
pub mod internal_pointer; | ||
pub mod sft; |
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
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
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
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
Oops, something went wrong.