-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8304928: Optimize ClassDesc.resolveConstantDesc #13252
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
|
👋 Welcome back liach! A progress list of the required criteria for merging this PR into |
Webrevs
|
| } | ||
|
|
||
| static boolean isPrimitiveArray(String referenceTypeDescriptorString) { | ||
| return referenceTypeDescriptorString.charAt(referenceTypeDescriptorString.length() - 1) != ';'; |
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 also needs to check if it starts with [
| return referenceTypeDescriptorString.charAt(referenceTypeDescriptorString.length() - 1) != ';'; | |
| return referenceTypeDescriptorString.startsWith("[") && | |
| referenceTypeDescriptorString.charAt(referenceTypeDescriptorString.length() - 1) != ';'; |
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 intend this to be a ReferenceClassDesc-specifc check. I think moving isPrimitiveArray as a private method in ReferenceClassDesc would be better, as the startsWith("[") is already implied (at least before valhalla, non-array, i.e. class or interface descriptors must end with a semicolon.
| NEW { | ||
| @Override | ||
| Class<?> call(MethodHandles.Lookup lookup, ClassDesc cd) throws ReflectiveOperationException { | ||
| return resolveReference(lookup, cd); | ||
| } | ||
| }, |
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 think this benchmark doesn't need this case as that's the implementation of resolveConstantDesc. Was it there when you developed this fix? Same for MethodTypeDesc benchmark.
| @Measurement(iterations = 6, time = 1) | ||
| @Fork(1) | ||
| @State(Scope.Benchmark) | ||
| public class MethodTypeDescResolve { |
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.
Better to separate this benchmark from this PR. Probably the optimization done in PR 10991 should be a separate patch from JDK-8294961 and this benchmark could be included there.
|
Done. Now the benchmark explicitly measures the 3 reference types, with new result in line with previous observations here: https://jmh.morethan.io/?gists=21c462f4879f6166b3308a41c092d51e,1aeae6ff40a129f89dbfedcb874cfd37 The |
|
If you don't mind, please also check out #12986, which avoids casting the result to |
This would work. |
mlchung
left a comment
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. The new benchmark is cleaner.
|
@liach 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 8 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 (@mlchung) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
|
/integrate |
|
/sponsor |
|
Going to push as commit cccb019.
Your commit was automatically rebased without conflicts. |
This patch optimizes ClassDesc.resolveConstantDesc for array classes. Otherwise, the performance of reference class resolution remain unchanged.
A benchmark comparing resolution for reference arrays, primitive arrays, and class or interfaces is included in this patch, and the result comparison on my machine is available at https://jmh.morethan.io/?gists=21c462f4879f6166b3308a41c092d51e,1aeae6ff40a129f89dbfedcb874cfd37
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13252/head:pull/13252$ git checkout pull/13252Update a local copy of the PR:
$ git checkout pull/13252$ git pull https://git.openjdk.org/jdk.git pull/13252/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 13252View PR using the GUI difftool:
$ git pr show -t 13252Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13252.diff