-
Notifications
You must be signed in to change notification settings - Fork 75
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
Internal pointer support #1165
Merged
Merged
Internal pointer support #1165
Changes from 10 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
b9beda8
Add methods to find non zero value from contiguous side metadata.
qinsoon b28c077
Require object reference to be aligned
qinsoon 3ea862a
Update docs
qinsoon 26d7893
Allow access raw byte/word from side metadata. Find base reference using
qinsoon 60b8163
Merge remote-tracking branch 'my-fork/aligned-obj-ref' into feature/i…
qinsoon f4363a9
Some basic tests. Use SFT to dispatch calls to find base reference.
qinsoon 6a3610a
Add micro benchmarks for internal pointers
qinsoon e6f82a6
Try load word when we search back
qinsoon 20716ac
Some cleanup
qinsoon 9dac372
Tidy up. More tests.
qinsoon 2497124
Remove the use of Option::inspect for Rust 1.71
qinsoon 6ce0d2c
Introduce a constant IN_OBJECT_ADDRESS_OFFSET
qinsoon 80253fd
Fix missing imports in DummyVM
qinsoon c284fe5
Fix a few issues in the comments
qinsoon 3aee387
Apply cargo fmt to dummyvm
qinsoon 29dfce4
Minor changes to ObjectReference based on the review
qinsoon d977063
Minor updates to the docs on is_mmtk_object
qinsoon 55a2f00
Merge remote-tracking branch 'my-fork/aligned-obj-ref' into feature/i…
qinsoon f0bc857
Address reviews.
qinsoon ac49cad
Fix bench
qinsoon 61c8d89
Derive Eq for PlanSelector
qinsoon 1bb2d14
Merge branch 'master' into feature/internal-pointer-fast
qinsoon de05ffa
Add migration guide for this PR, and add missing links for last PR.
qinsoon 3cd2a99
Cargo fmt
qinsoon da90e2b
Fix broken doc link
qinsoon 8f7670a
Fix a few more issues from reviews
qinsoon 9fa6530
Move the implementation of is_mmtk_objct and
qinsoon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,97 @@ | ||
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::vm::ObjectModel; | ||
use mmtk::AllocationSemantics; | ||
let addr = memory_manager::alloc( | ||
&mut fixture.mutator, | ||
NORMAL_OBJECT_SIZE, | ||
8, | ||
0, | ||
AllocationSemantics::Default, | ||
); | ||
let obj_ref = MockVM::address_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::vm::ObjectModel; | ||
use mmtk::AllocationSemantics; | ||
let addr = memory_manager::alloc( | ||
&mut fixture.mutator, | ||
LARGE_OBJECT_SIZE, | ||
8, | ||
0, | ||
AllocationSemantics::Los, | ||
); | ||
let obj_ref = MockVM::address_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
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is some data for this micro benchmark.
The naive implementation (
find_prev_non_zero_value_simple
, similar to #1155): check every aligned data address until we find the object.Check every byte in side metadata until we find VO bit, and compute it back to the VO address
Check every word in side metadata until we find VO bit, and compute it back to the VO address
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After applying the suggestion in #1165 (comment), we only check if the metadata address is mapped for every chunk. The performance is further improved.