-
Notifications
You must be signed in to change notification settings - Fork 113
8335256: [lworld] C2: Remove larval InlineTypeNode #1447
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
Conversation
/issue 8325627 |
👋 Welcome back qamai! A progress list of the required criteria for merging this PR into |
@merykitty 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 2 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the 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 (@TobiHartmann) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
@merykitty |
@merykitty |
Webrevs
|
Great work @merykitty! Thanks a lot for the investigation. When working on the new value object construction model, I was concerned that we might end up with adding identity back to the larvals but I was still naively hoping that we could get around that. Looks like we can't. Maybe you could change the title to something more descriptive for future reference / search. I run this through testing and there are a few issues:
|
@TobiHartmann Thanks a lot for the comprehensive testing, it is really helpful.
This one fails because after removal of some allocations, not only other allocations become eligible for elimination, locks can also be eliminated. As a result, we need to do the whole macro elimination again. I noticed that
This one is an oversight by me. When exiting a constructor, the larval oop is aggressively replaced by the non-larval one in all the frames. This relies on the assumption that all blocks in which the oop is larval has been processed. This is incorrect when we have uncommon traps, which can be processed at any time. As a result, we can only replace the larval oop with the non-larval one in the current frame.
I modified the test to push everything into the local slots, 2 distinct slots are present into the loop, keep the original intention of the test.
This is interesting. This is an oversight from #1424. The issue is that it is hard to decide that 2 nodes are definitely different or definitely the same, especially when the graph may be non-canonical during IGVN. As a result, I resort to a more conservative approach there:
|
Thanks for quickly fixing these issues. I ran another round of testing and there's only one issue left:
|
@TobiHartmann The failure was due to the fact that |
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.
Thanks a lot for this great work and your patience, @merykitty. All tests passed and I had a detailed look at the changes. Looks all good to me, I just left a few questions / comments / suggestions.
@@ -2843,16 +2843,39 @@ void Compile::Optimize() { | |||
|
|||
if (failing()) return; | |||
|
|||
{ | |||
// Eliminate some macro nodes before EA to reduce analysis pressure |
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 something we should consider doing in mainline?
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'm not sure what effect it will have on mainline. For this patch, without this, TestNullableInlineTypes::test85
tries to enter EA with 10k nodes, which it bails out. Trying to eliminate all trivially removable allocations reduces the number to 2k, allows EA to complete successfully. I think it may be more significant on Valhalla because in general we seem to emit a lot more nodes with value objects.
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.
Please let me know what you think about this, perhaps we need to measure the effects on mainline first.
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.
Makes sense. I'd say we put it into Valhalla only for now. We can still consider upstreaming it later.
igvn.set_delay_transform(false); | ||
igvn.optimize(); | ||
if (failing()) return; | ||
|
||
print_method(PHASE_ITER_GVN_AFTER_ELIMINATION, 2); |
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.
Why did you remove the igvn.optimize();
here?
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.
Ah, you added it to eliminate_macro_nodes
.
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, I think it is cleaner that way instead of trailing each mex.eliminate_macro_nodes
with an igvn.optimize()
@TobiHartmann Thanks a lot for your reviews, I think I have addressed all of them. |
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.
Thanks for the nice comments and updates, Quan-Anh. The changes look good to me now!
Thanks very much for the reviews, I have created JDK-8356779 and JDK-8356780. |
@merykitty |
/sponsor |
Going to push as commit 6a6cf4f.
Your commit was automatically rebased without conflicts. |
@TobiHartmann @merykitty Pushed as commit 6a6cf4f. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Hi
The root issue is that a larval value object is fundamentally different from a non-larval one. The most important thing is that it has a unique identity and it expects any modification on 1 reference observable by all other equivalent references. As a result, we need a mechanism to track the identity of a larval object, which
InlineTypeNode
does not provide. My current proposal to fix this issue is to abandon larvalInlineTypeNode
s and use the oop like other objects.It is probably beneficial to have another mechanism to make it easier optimizing larval inline type nodes, but I think it can be a follow-up RFE.
An example regarding the issue with tracking the identity of a larval InlineTypeNode:
Consider this pseudobytecode sequence:
There are 2 equivalent references in the stack at the loop entry. When
Parse::merge
encounters them, it cannot know that these are the same because the back-edge has not been processed yet. As a result, it creates 2 separatePhi
s for these references. Then,invokespecial
will only make the top of the stack a non-larval object, not the next one, which is the one returned to the caller. As a result, we fail withassert(!value->is_InlineType() || !value->as_InlineType()->is_larval(), "returning a larval")
. Worse, if the method is osr-compiled at the loop head, we have 2 separate references fed into the compiled function and there is no way we may know that they are of the same object.Please take a look and leave your reviews, thanks a lot.
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/1447/head:pull/1447
$ git checkout pull/1447
Update a local copy of the PR:
$ git checkout pull/1447
$ git pull https://git.openjdk.org/valhalla.git pull/1447/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1447
View PR using the GUI difftool:
$ git pr show -t 1447
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1447.diff
Using Webrev
Link to Webrev Comment