-
Notifications
You must be signed in to change notification settings - Fork 69
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 Edge::update_for_forwarding #1037
Draft
wks
wants to merge
5
commits into
mmtk:master
Choose a base branch
from
wks:feature/edge-update
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3739e8a
Skip slots where `Edge::load()` returns NULL
wks 13b73d6
More non-null assertions in spaces.
wks 45fe7c9
Update documentation
wks 87604f6
Merge branch 'master' into feature/early-null-check
wks e11038a
Implement Edge::update_for_forwarding
wks 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
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.
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.
Can you do
new_object.is_null() && object == new_object
? That would fix the case where we overwrite references for objects that were not moved.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 am expecting the
updater
(usually implemented bytrace_object
) to do that test inside (if necessary at all) so that we don't need to checkobject == new_object
here. One example is the nursery (for GenCopy and GenImmix). It always moves the object, so it doesn't need to check. It actually doesdebug_assert!(!self.plan.is_object_in_nursery(new_object));
which impliesnew_object
cannot be equal toobject
.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.
Hm? I don't follow.
trace_object
can't store the new object (if any) into the slot. It will only return an object referenceThere 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.
That's right.
trace_object
doesn't do the storing. However, the contract of theupdater
closure is, if it returnsObjectReference::NULL
, thenEdge::update_for_forwarding
will not do the storing.process_edge
implements theupdater
closure. After executinglet new_object = trace_object(object)
, it should check ifnew_object == object
and, if they are equal, returnObjectReference::NULL
from theupdater
closure. CurrentlyProcessEdgesWork::process_edge
is not doing this because I don't want to change the semantics of the existingProcessEdgesWork::process_edge
. We may give it a try by addingif new_object == object { return ObjectReference::NULL; } else { return new_object; }
there. IIRC, @qinsoon once tried doing this check aftertrace_object
, and it is not always profitable. We may give it another try, but at this moment, I want to make sure the closure itself doesn't introduce extra cost.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 believe Yi's work made it an
Option<ObjectReference>
. That has more overhead since it doesn't condense into ausize
(givenObjectReference::NULL
exists). I don't think we should retain the current semantics since we know the current semantics are broken. There is no need to store the same object again into the slotThere 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.
Related issues:
My previous experiment showed that the performance impact is negligible. So we have reasons to replace the constant
OVERWRITE_REFERENCE
and the invocationP::may_move_objects::<KIND>()
with an actualnew_object == object
check. But we'll probably do it in a separate PR to address #574 specifically.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.
Sure. Alternatively, we can make a PR for fixing that right now (since it should be simple to fix) and then merge that first, given this PR is a "design" PR and I'm not sure if we've decided what's the best way to review them yet
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.
Yes. That's a good idea.
I think this can be an "MEP", too, but this may not be as controversal as removing
ObjectReference::NULL
. Since I already made this PR, I think I will test the performance with the OpenJDK binding and, if it performas well, I'll write up an "MEP" for this, too, and welcome everyone to discuss. Actually I still have some design questions about this. One is whether we need a way to update slots atomically. The LXR branch sometimes does "compare exchange" on slots.