-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8333749: Consolidate ConstantDesc conversion in java.base #19585
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 |
@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 21 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 (@cl4es, @JornVernee) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
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 to me. Probably should get someone to OK changes in foreign/abi (@JornVernee perhaps?).
There are some pre-existing places where we call ReferenceClassDescImpl.ofValidated
directly that could probably be switched over to ConstantUtils.classDesc
for slightly nicer code. Or - if it matters - add a referenceClassDesc
which avoids the type.isPrimitive
test.
@@ -249,14 +253,14 @@ private static Class<?> newProxyClass(Class<?> intfc) { | |||
|
|||
// the field name holding the method handle for this method | |||
String fieldName = "m" + count++; | |||
var mt = methodType(m.getReturnType(), JLRA.getExecutableSharedParameterTypes(m), true); | |||
var mt = methodDesc(m.getReturnType(), JLRA.getExecutableSharedParameterTypes(m)); |
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.
var mt = methodDesc(m.getReturnType(), JLRA.getExecutableSharedParameterTypes(m)); | |
var md = methodDesc(m.getReturnType(), JLRA.getExecutableSharedParameterTypes(m)); |
.wrapperType() | ||
.describeConstable() | ||
.orElseThrow()); | ||
cb.instanceOf(classDesc(Wrapper.forBasicType(classLabel) |
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 have a patch somewhere to cache the wrapper class desc in sun.invoke.util.Wrapper
, both as a micro-optimization and to help disambigutate the unfortunately named (my bad) Wrapper::classDescriptor
method. Maybe we can roll that into this..?
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.
Feel free, or you can get your patch merged first and then I base off yours if yours is ready.
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.
Created a PR you could fold into this, if you'd like: liachmodded#1
@@ -466,9 +468,9 @@ private void doBindings(List<Binding> bindings) { | |||
case Copy copy -> emitCopyBuffer(copy); | |||
case Allocate allocate -> emitAllocBuffer(allocate); | |||
case BoxAddress boxAddress -> emitBoxAddress(boxAddress); | |||
case SegmentBase unused -> emitSegmentBase(); | |||
case SegmentBase _ -> emitSegmentBase(); |
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.
Seem a bit too far detached from the changes at hand for a drive-by code cleanup?
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.
My uncontrollable urges to fix these minor IDE warnings... Please allow these fixes, as I have similar changes in ProxyGenerator as well.
src/java.base/share/classes/jdk/internal/constant/ConstantUtils.java
Outdated
Show resolved
Hide resolved
I think the main advantage of
|
…Name to ConstantUtils.binaryNameToDesc
…consolidate-todesc
This could probably also update jdk/src/java.base/share/classes/java/lang/Class.java Lines 4709 to 4713 in 40b2fbd
|
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 incremental improvements.
/contributor add redestad |
@liach |
|
No: they are missing checks against initial, trailing, or consecutive . or / separators. We can do that in a future patch, with proper test additions. |
Thanks for the reviews! /integrate |
/sponsor |
Going to push as commit 8d2f9e5.
Your commit was automatically rebased without conflicts. |
In java.base, especially in bytecode generators, we have many different methods converting known valid Class and MethodType into ClassDesc and MethodTypeDesc. These conversions should be consolidated into the same utility method for the ease of future maintenance.
Progress
Issue
Reviewers
Contributors
<redestad@openjdk.org>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19585/head:pull/19585
$ git checkout pull/19585
Update a local copy of the PR:
$ git checkout pull/19585
$ git pull https://git.openjdk.org/jdk.git pull/19585/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19585
View PR using the GUI difftool:
$ git pr show -t 19585
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19585.diff
Webrev
Link to Webrev Comment