-
Notifications
You must be signed in to change notification settings - Fork 397
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
WIP: Fix for incorrectly marked collected reference on X86 #3035
Conversation
The commit message is worrying me and seems wrong. The result of aiadd and aladd can be a collected reference if they're internal pointer. There is an API to compute the collectedness of a data. It's |
@liqunl Could you give some examples when the result of TR::aiadd/TR::aladd should return a collected reference? |
I was confused because there are similar concepts on symbol and on node, they are slightly different than the concept in codegen. On Node and Symbol, collected reference and internal pointer are both considered to be collected, but there is addition flag for internal pointer which is used by codegen to create gc map for it (when it also has a pinning array) but not to treat them as the real collected reference. I agree that aiadd/aladd can't be collected refenrence regardless of whether they're internal pointers. I have no issue with the commit message now. |
@vijaysun-omr could you review? I think this is popping up a fair number of failures in recent builds. |
else if (comp->generateArraylets() && root->getOpCodeValue() == TR::aiadd) | ||
// arraylets: aiadd is technically internal pointer into spine object, but isn't marked as internal pointer | ||
tempReg = _cg->allocateRegister(); | ||
else |
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 presume this allocateCollectedReferenceRegister section of code is the one that was causing problems ?
Could you please elaborate on the actual problem that you are fixing ?
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 result register (tempReg
here) was incorrectly marked as a collected reference, when the aiadd
/aladd
node is not internal pointer. As a result, an invalid GC map entry may be introduced and causes GC assertions.
I cannot think of any valid reasons that this result could be collected; therefore, all branches are now to allocate a "non-collected" register instead of "collected" ones.
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.
It seems we would have used an uncollected register if the isInternalPointer flag would have been "true" on this aiadd/aladd. I expect this node flag would be set on all aiadd/aladd in Java but I guess you saw some case where that flag was not set (?) If so, how did such a node originate ?
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.
It is from Value Propagation where a TR::arraycopy
gets generated. The source and destination children are TR::aladd
.
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.
If these aladds created by arraycopy generation in value propagation don't have the internal pointer flag set, then we should consider setting the flag and see if that fixes the failure.
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.
But either way aladd
shouldn't return a collected reference. It doesn't make sense to create a collected reference from [address+offset].
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.
Agreed, but it's preferable to fix a bug in common code if we can so that each platform does'nt have to make changes.
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.
Good suggestion. @liqunl kindly agreed to investigate why root->isInternalPointer()
answered no as a separate issue.
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.
It seems like VP arraycopy transformation creates an aiadd/aladd without setting the flag. I'm trying to find where the node is created.
It seems the title of the PR may have been changed based on @liqunl earlier comment but the PR description and the commit message are still using the words that she requested a change to. Can you please change the commit message and be more descriptive in terms of why this change was needed ? i.e. under what situation were we using a collected reference register for an aiadd/aladd ? |
@genie-omr build xlinux win |
I have no problem with the wording now, but I agree that we need a more descriptive commit message. |
Commit messages have been updated. Sanity tests may need be restarted. |
Created #3040 to set internal pointer node flags in VP. |
@vijaysun-omr and @0dvictor I'm not sure if this is the fix we want in general. #3046 was just merged to fix the missing flag. In general we seem to have a principle of offsets to a collected reference result in a collected reference unless the result is explicitly marked as an internal pointer not to be reported to the GC. removing the functionality to allow collected reference to be generated from collected references via explicit offsets not marked internalPointer because Java doesn't use the feature doesn't seem to be quite the right solution. Now there may be another good reason for removing it, but VP failing to set a flag that is required by current convention doesn't seem like a problem the codegen should be trying to fix as alluded to earlier. |
@andrewcraik raised a good point. I think our different points of views came from different understanding of the semantics of Marking this PR as WIP for now. |
@0dvictor any updates on this? |
Not yet. I don't think we can progress this further until the semantics of |
The result register of TR::aiadd/TR::aladd was incorrectly marked as a collected reference, when the aiadd/aladd node is not internal pointer. As a result, an invalid GC map entry may be introduced and causes GC assertions. The result of TR::aiadd/TR::aladd can never be a collected reference, fixing it. Signed-off-by: Victor Ding <[email protected]>
The result register of TR::aiadd/TR::aladd was incorrectly marked as a
collected reference, when the aiadd/aladd node is not internal pointer.
As a result, an invalid GC map entry may be introduced and causes GC assertions.
The result of TR::aiadd/TR::aladd can never be a collected reference, fixing it.
Signed-off-by: Victor Ding [email protected]