-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8362306: HotSpotJVMCIRuntime.getMirror can crash #26346
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 dnsimon! A progress list of the required criteria for merging this PR into |
|
@dougxc 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 45 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 |
Webrevs
|
|
@dougxc Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information. |
| return iklass; | ||
| } | ||
|
|
||
| C2V_VMENTRY_NULL(jobject, asReflectionField, (JNIEnv* env, jobject, ARGUMENT_PAIR(klass), jint index)) |
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.
There is the same pattern in getEncodedFieldAnnotationData, we should probably defend there as well.
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 point: c2c41aa
| CompilerThreadCanCallJava canCallJava(thread, true); // Requires Java support | ||
| InstanceKlass* holder = InstanceKlass::cast(UNPACK_PAIR(Klass, klass)); | ||
| return get_encoded_annotation_data(holder, holder->class_annotations(), true, filter_length, filter_klass_pointers, THREAD, JVMCIENV); | ||
| return get_encoded_annotation_data(holder, holder->class_annotations(), true, filter_length, filter_klass_pointers, THREAD, JVMCI_CHECK_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.
Can JVMCI_CHECK_ be used in return statements? i think the "check and return default value" part would be unreachable.
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.
Indeed - I've been bitten by this before! In this case, it's harmless given that the return statement is anyway the last statement in the method. Still, I'll revert my "fix".
I'm also wondering (again?) why the C++ compiler does not warning about unreachable code.
|
Maybe you could add a test in |
Done: fd44d95 |
JohnTortugo
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.
LGTM
| requireInHotSpot("asReflectionField", JVMCI_CHECK_NULL); | ||
| Klass* klass = UNPACK_PAIR(Klass, klass); | ||
| InstanceKlass* iklass = check_field(klass, index, JVMCIENV); | ||
| InstanceKlass* iklass = check_field(klass, index, JVMCI_CHECK_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.
There's another copy of this idiom in getDeclaredFieldsInfo which might be worth fixing.
|
Thanks for the reviews. /integrate |
|
Going to push as commit 2b11a28.
Your commit was automatically rebased without conflicts. |
This PR fixes
HotSpotJVMCIRuntime.getMirror(ResolvedJavaMethod method)andHotSpotJVMCIRuntime.getMirror(ResolvedJavaField field)so that they return null for<clinit>and an injected field respectively instead of crashing.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26346/head:pull/26346$ git checkout pull/26346Update a local copy of the PR:
$ git checkout pull/26346$ git pull https://git.openjdk.org/jdk.git pull/26346/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26346View PR using the GUI difftool:
$ git pr show -t 26346Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26346.diff
Using Webrev
Link to Webrev Comment