-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
8313435: Clean up unused default methods code #15095
Conversation
👋 Welcome back coleenp! A progress list of the required criteria for merging this PR into |
Webrevs
|
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.
Looks good, except for a couple of oddly formatted parameter lists.
@coleenp 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 49 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. ➡️ To integrate this PR with the above commit message to the |
Thanks for reviewing, Kim. |
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.
Generally looks good but a couple of nits/queries.
Thanks
…methods error (aka overpass) methods.
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.
Looks good to me. Thanks for making the BytecodeConstantPool::find_or_add()
method fail early so we don't have potentially invalid bytecodes in the buffer.
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.
Looks good except the new assert needs to be changed back I think.
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 at all sure that BytecodeConstantPool::find_or_add
needs to throw, especially given that requires polluting so much code with TRAPS and CHECK - it looks really awful to see things like:
assem._new(errorName, CHECK_0));
Maybe we should be checking for sufficient space at a higher-level somewhere? I'm not familiar with how this code is actually used.
This seems to have strayed somewhat from the primary cleanup of unused code.
It was my suggestion, because otherwise this code would be returning junk on overflow, leading to invalid code being stored in the buffer.
Yes, there's code that checks after the fact that we have overflown the number for CP indices, and rejects the buffer. However, for security, it's better to not have invalid code in the first place. The places of invalid code generation and error detection are far apart, making the code hard to understand, and easy to mess up by future changes. |
Okay but how do we arrive at that point? This is an internal implementation detail. We should be able to pre-check the capacity and reject higher-up rather than having the lowest method try to throw the exception (the lowest method should just assert). The profilteration of TRAPS and CHECK really looks ugly here. |
There's no ability to pre-check because we don't know how long the constant pool buffer is going to get until we generate the instructions that potentially add entries to the constant pool. Then we know. |
Doesn't |
Maybe it'll generate 4 or 5 constant pool entries but if it's not the first method error, it might not. It might share entries with a previously generated method error. |
There is no reason not to check for an unlikely case of overflow here. If we do have overflow, throwing an exception is better than asserting. This is a safety check to replace silently ignoring this overflow and returning the wrong value. |
Thanks Ioi and Kim for reviewing and David for your comments. There is a lot more opportunity to improve this code but it'll require a lot more study. This cleanup helps. |
Going to push as commit 5c3041c.
Your commit was automatically rebased without conflicts. |
Default methods processing code has unused code (that gets -Wconversion warnings) from when it was used to create bridge (called overpass) method for an early implementation of generic reification in Hotspot.
This change removes unused bytecodeAssembler code and adds a check for methods and constant pool overflow.
Tested with tier1 and runtime/lambda-features tests.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15095/head:pull/15095
$ git checkout pull/15095
Update a local copy of the PR:
$ git checkout pull/15095
$ git pull https://git.openjdk.org/jdk.git pull/15095/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 15095
View PR using the GUI difftool:
$ git pr show -t 15095
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15095.diff
Webrev
Link to Webrev Comment