-
Notifications
You must be signed in to change notification settings - Fork 78
Allow MockVM to run GC #1408
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
base: master
Are you sure you want to change the base?
Allow MockVM to run GC #1408
Conversation
|
|
| }*/ | ||
|
|
||
| pub fn reset_cursor(&self, top: Address) { | ||
| // top might be Address::ZERO |
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 where I think Option<NonZeroAddress> can be useful. See #1223
| fn next(&mut self) -> Option<<Self as Iterator>::Item> { | ||
| while self.cursor < self.end { | ||
| if !self.cursor.is_aligned_to(ObjectReference::ALIGNMENT) { | ||
| self.cursor += VM::MIN_ALIGNMENT; |
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.
Currently ObjectReference is required to be aligned to ObjectReference::ALIGNMENT. So even if VM::MIN_ALIGNMENT is smaller than ObjectReference::ALIGNMENT, VO bits can only be set at addresses which are multiples of ObjectReference::ALIGNMENT. I think the algorithm here is wrong (or just outdated). It is pointless to increment the cursor by VM::MIN_ALIGNMENT. It should simply align the cursor up to the next multiple of ObjectReference::ALIGNMENT. And I wonder whether find_last_non_zero_bit_in_metadata_bytes could be more efficient (needs to search forward instead of backward).
This PR made some changes to
MockVMto allow us to run GC in the tests.mock_test_side_metadataandmock_test_header_metadata. We only test withmock_test_side_metadata(as some plans don't run with header metadata).MockVMinstance (otherwise it will cause deadlock when we reentryMockVM)MMTKinstance for mock tests.mock_apito create a mutator. This registers the mutator to mock VM, and can be blocked for GC.