Support disjoint objects #663
Draft
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.
At this moment, I just drafted the interface for the VM.
The VM binding shall implement
Scanning::handle_buffers, and MMTk core shall implement a plan-specificBufferHandler, pass it to the VM binding so it can call back. InScanning::handle_buffers, the VM calls methods ofBufferHandlerto (1) retain an existing buffer, or (2) allocate a new buffer (GC thread cannot callMutator::alloc, so this method should be necessary). I documented the contract (desired behaviour of the VM binding) in the comments.What remains to be designed/implemented includes
handle_bufferssufficient to support all plans? (non-moving plans like MS, evacuating plans like SemiSpace, and MarkCompact)handle_bufferscalled in each plan?I think it is sufficient. My expectation is that "if the VM implements the
Scanning::handle_buffersmethod as I specified in its comment, it should always work, regardless of the plan". But each plan may call thathandle_buffersat different time to make use of it.handle_buffersmay be called during the forwarding phase (after objects are marked, but before both objects and buffers are copied). MarkCompact can hook into theBufferHandlerimplementation to work out the space needed to hold new buffers and their locations. But what should happen when the GC actually copies the buffer? Do all the objects and buffers need to be copied in any particular order? How to remember the sizes of buffers?