-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8362832: compiler/macronodes/TestTopInMacroElimination.java hits assert(false) failed: unexpected node #27903
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?
Conversation
👋 Welcome back bmaillard! A progress list of the required criteria for merging this PR into |
@benoitmaillard This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 155 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@vnkozlov) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
@benoitmaillard The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
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 agree with fix.
This PR prevents hitting an assert caused by encountering
top
while following the memoryslice associated with a field when eliminating allocations in macro node elimination. This situation
is the result of another elimination (boxing node elimination) that happened at the same
macro expansion iteration.
Analysis
The issue appears in the macro expansion phase. We have a nested
synchronized
block,with the outer block synchronizing on
new A()
and the inner one onTestTopInMacroElimination.class
.In the inner
synchronized
block we have anInteger.valueOf
call in a loop.In
PhaseMacroExpand::eliminate_boxing_node
we are getting rid of theInteger.valueOf
call, as it is a non-escaping boxing node. After having eliminated the call,
PhaseMacroExpand::process_users_of_allocation
takes care of the users of the removed node.There, we replace usages of the fallthrough memory projection with
top
.In the same macro expansion iteration, we later attempt to get rid of the
new A()
allocationin
PhaseMacroExpand::create_scalarized_object_description
. There, we have to makesure that all safepoints can still see the object fields as if the allocation was never deleted.
For this, we attempt to find the last value on the slice of each specific field (
a
in this case). Because field
a
is never written to, and it is not explicitely initialized,there is no
Store
associated to it and not even a dedicated memory slice (we end uptaking the
Bot
input onMergeMem
nodes). By going up the memory chain, we eventuallyencounter the
MemBarReleaseLock
whose input was set totop
. This is where the assertis hit.
Proposed Fix
In the end I opted for an analog fix as the similar JDK-8325030.
If we get
top
fromscan_mem_chain
inPhaseMacroExpand::value_from_mem
, then we can safelyreturn
top
as well. This means that the safepoint will havetop
as data input, but this willeventually cleaned up by the next round of IGVN.
Another (tempting) option would have been to simply return
nullptr
fromPhaseMacroExpand::value_from_mem
when encouteringtop
. However this would result in bailingout from eliminating this allocation temporarily and effectively delaying it to a subsqequent
macro expansion round.
Testing
Thank you for reviewing!
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27903/head:pull/27903
$ git checkout pull/27903
Update a local copy of the PR:
$ git checkout pull/27903
$ git pull https://git.openjdk.org/jdk.git pull/27903/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27903
View PR using the GUI difftool:
$ git pr show -t 27903
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27903.diff
Using Webrev
Link to Webrev Comment