-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8349860: Make Class.isArray(), Class.isInterface() and Class.isPrimitive() non-native #23572
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 coleenp! A progress list of the required criteria for merging this PR into |
|
@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 124 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 |
src/java.base/share/classes/jdk/internal/reflect/Reflection.java
Outdated
Show resolved
Hide resolved
...g/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java
Outdated
Show resolved
Hide resolved
|
We often need to determine what primitive type a |
|
I had a look at Wrapper.forPrimitiveType() and it's not an intrinsic so I don't really know how hot it is. It's a comparison, vs getting a field out of Class<?>. Not sure how to measure it. So I can't address it in this change. |
|
@cl4es Can you offer some insight here? |
|
Touching |
Webrevs
|
| // Otherwise it returns its argument value which is the _the_class Klass*. | ||
| // Please, refer to the description in the jvmtiThreadSate.hpp. | ||
| // Please, refer to the description in the jvmtiThreadState.hpp. | ||
|
|
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.
Does this "RedefineClasses support" comment still belong 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.
I think so. The comment in jvmtiThreadState.hpp has details why this is. We do a mirror switch before verification apparently because of bug 6214132 it says.
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.
Just a few passing comments as this is mainly compiler stuff.
Does the SA not need any updates in relation to 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.
Is the change to isInterface and isPrimitive performance neutral?
As @IntrinsicCandidates, there would be some performance gain.
| // Please, refer to the description in the jvmtiThreadSate.hpp. | ||
| // Please, refer to the description in the jvmtiThreadState.hpp. | ||
|
|
||
| JVM_ENTRY(jboolean, JVM_IsInterface(JNIEnv *env, jclass cls)) |
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.
JVM_IsInteface is deleted in Class.c, what purpose is 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.
The old classfile verifier uses JVM_IsInterface.
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 looking at this change.
| // Otherwise it returns its argument value which is the _the_class Klass*. | ||
| // Please, refer to the description in the jvmtiThreadSate.hpp. | ||
| // Please, refer to the description in the jvmtiThreadState.hpp. | ||
|
|
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 so. The comment in jvmtiThreadState.hpp has details why this is. We do a mirror switch before verification apparently because of bug 6214132 it says.
Co-authored-by: David Holmes <62092539+dholmes-ora@users.noreply.github.com>
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!
Regarding @IntrinsicCandidate and its effects on JIT-compiler inlining decisions, @ForceInline could be added, but IMO it's not necessary since new implementations are small.
|
Thanks Vladimir for review and for answering my earlier questions on this change. |
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.
LGTM! As @iwanowww said, not inlining such trivial methods seems more like an inliner bug/enhancement opportunity.
No, the SA doesn't know about these compiler intrinsics. |
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 limited changes to the Java codebase looks reasonable. We should probably get a double check from Alan or some other architect.
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.
A nice simplification.
|
Thanks for reviewing Roger. |
|
Thanks for reviewing Dean, Roger, Vladimir, Yudi and Chen, and comments David. |
|
Going to push as commit c413549.
Your commit was automatically rebased without conflicts. |
Class.isInterface() can check modifier flags, Class.isArray() can check whether component mirror is non-null and Class.isPrimitive() needs a new final transient boolean in java.lang.Class that the JVM code initializes.
Tested with tier1-4 and performance tests.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23572/head:pull/23572$ git checkout pull/23572Update a local copy of the PR:
$ git checkout pull/23572$ git pull https://git.openjdk.org/jdk.git pull/23572/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23572View PR using the GUI difftool:
$ git pr show -t 23572Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23572.diff
Using Webrev
Link to Webrev Comment