-
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
implement a feature to allocate an extra word ahead of each individua… #894
base: master
Are you sure you want to change the base?
Conversation
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.
The PR generally looks okay, but one pity is that the code/mechanism is not reused for mark compact to add the policy-specific extra header word. I suggest ask @wks to review this PR once it is ready.
@@ -102,6 +102,9 @@ is_mmtk_object = ["vo_bit"] | |||
# Enable object pinning, in particular, enable pinning/unpinning, and its metadata | |||
object_pinning = [] | |||
|
|||
# Enable allocate extra header of each individual object |
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.
Better to clarify that VM::EXTRA_HEADER_BYTES
will control the exact size of extra header, and there is no control on the alignment of the extra header. We just guarantee there are EXTRA_HEADER_BYTES
before the address we return. It could be unaligned access if the binding attempts to write pointers to the extra bytes.
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.
Is this feature only intended for debugging, or can be used in a performance setting?
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.
I guess it is only intended for debugging.
// The invariants we checked earlier ensures that we can use cell and object reference interchangably | ||
// We may not really have an object in this cell, but if we do, this object reference is correct. | ||
let potential_object = ObjectReference::from_raw_address(cell); | ||
#[cfg(feature = "extra_header")] | ||
let potential_object = ObjectReference::from_raw_address(cell + VM::EXTRA_HEADER_BYTES); |
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.
The binding can config EXTRA_HEADER_BYTES
, and there is no requirement on what value a binding can use. If a binding uses a value that is not a multiple of the fixed alignment, this code is wrong. You can either introduce some requirements for a 'valid EXTRA_HEADER_BYTES value', or simply change the condition in L264 so we use native_brute_force_sweep
if extra_header
is enabled.
|
@tianleq Can you remind me what was the purpose of this feature? I see the size of the extra word is specified in If the extra word is required by the MMTk for debug purposes, it shouldn't be set in |
@wks |
Right. But we could have some code that is used by both on how to compute a new result based on the extra bytes, and how to align the extra header size. Computing result: mmtk-core/src/util/alloc/markcompact_allocator.rs Lines 55 to 61 in cacb8f6
mmtk-core/src/util/alloc/bumpallocator.rs Lines 73 to 79 in f1359c5
Computing header size: mmtk-core/src/policy/markcompactspace.rs Lines 151 to 158 in cacb8f6
Lines 75 to 82 in f1359c5
|
It does not support malloc marksweep