-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
8260605: Various java.lang.invoke cleanups #2300
Conversation
👋 Welcome back redestad! A progress list of the required criteria for merging this PR into |
Webrevs
|
@cl4es This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@@ -339,8 +339,8 @@ private ClassWriter classFilePrologue() { | |||
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS + ClassWriter.COMPUTE_FRAMES); | |||
setClassWriter(cw); | |||
cw.visit(Opcodes.V1_8, NOT_ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER, | |||
CLASS_PREFIX + className, null, INVOKER_SUPER_NAME, null); | |||
cw.visitSource(SOURCE_PREFIX + className, null); | |||
CLASS_PREFIX.concat(className), null, INVOKER_SUPER_NAME, null); |
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 prefer to use the existing common pattern using +
as I believe this gain is in the noise.
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 goal here was to remove/reduce allocations and excess calls - and using String.concat might have been excessive.
The bulk of the overhead is the potentially many CLASS_PREFIX + className
calls, often via className()
. Calculating this once and storing it in an instance field prefixedClassName
is more profitable and help better disambiguates between className
and className()
- which sound like they should be the same but aren't.
result = invokeWithManyArguments(bootstrapMethod, caller, name, type, argv); | ||
maybeReBoxElements(argv); | ||
if (argv.length > 6) { | ||
result = invokeWithManyArguments(bootstrapMethod, caller, name, type, argv); |
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'd be cleaner to move this to the default case in line 162 and 174 instead of having this special if-block.
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 catch!
@@ -415,7 +409,6 @@ public static MethodType genericMethodType(int objectArgCount) { | |||
*/ | |||
public MethodType changeParameterType(int num, Class<?> nptype) { | |||
if (parameterType(num) == nptype) return this; | |||
checkPtype(nptype); |
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.
nptype
is never void but what about the check if nptype
is not null?
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.
Other methods that delegate to makeImpl
aren't doing up-front validation, so this change was made to get things more in line. It might be good to spell out that makeImpl
does these checks for all its callers, though. (The makeImpl
fast-path that execute before the validation can never return an invalid MethodType)
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 we have a public API implementation to check the arguments upfront for readability. In particular for this case, the validation cost is negligible and removing the validation makes the code unclear where the validation is done. I prefer to keep the validation there. It should check that nptype
is non-null and not void.class
.
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, I mis-read your comment. I now see that makeImpl
does the argument validation. Adding the comment would be helpful.
@@ -85,6 +85,7 @@ | |||
|
|||
/** Name of new class */ | |||
private final String className; | |||
private final String prefixedClassName; |
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.
Adding a field for the class name is a good change. I was tempted to rename className
at one point to name
which can be a class name in internal form or a simple name. It now makes more sense to do the renaming s/className/name
and s/prefixedClassName/className
. What do you think?
…put validation commentary
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 doing the renames. Looks good.
@cl4es 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 116 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 |
/integrate |
@cl4es Since your change was applied there have been 128 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 63eae8f. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Progress
Issue
Reviewers
Download
To checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/2300/head:pull/2300
$ git checkout pull/2300
To update a local copy of the PR:
$ git checkout pull/2300
$ git pull https://git.openjdk.java.net/jdk pull/2300/head