-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8318694: [JVMCI] disable can_call_java in most contexts for libjvmci compiler threads #16383
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
| #define JNI_THROW(caller, name, msg) do { \ | ||
| jint __throw_res = env->ThrowNew(JNIJVMCI::name::clazz(), msg); \ | ||
| if (__throw_res != JNI_OK) { \ | ||
| tty->print_cr("Throwing " #name " in " caller " returned %d", __throw_res); \ |
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 VM should prefer event logging over printing to the console.
| if (strstr(val, "<trace>") != nullptr) { | ||
| tty->print_cr("CompilerToVM.lookupType: %s", str); | ||
| } else if (strstr(val, str) != nullptr) { | ||
| } else if (strstr(str, val) != nullptr) { |
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.
This fixes an existing bug: the test is meant to be whether val is a substring of str, not the other way around.
|
👋 Welcome back dnsimon! A progress list of the required criteria for merging this PR into |
4df5494 to
3e70e6e
Compare
| C2V_END | ||
|
|
||
| C2V_VMENTRY_NULL(jobject, lookupType, (JNIEnv* env, jobject, jstring jname, ARGUMENT_PAIR(accessing_klass), jint accessing_klass_loader, jboolean resolve)) | ||
| CompilerThreadCanCallJava canCallJava(thread, resolve); // Resolution requires Java calls |
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.
This is currently required by libgraal - it may be fixable in future.
5457928 to
0c0b192
Compare
0c0b192 to
9fc5ad9
Compare
Webrevs
|
| print_stack_element_to_stream(st, bte._mirror, bte._method_id, bte._version, bte._bci, bte._name); | ||
| } | ||
| { | ||
| if (THREAD->can_call_java()) { |
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.
This allows java_lang_Throwable::print_stack_trace to be used in contexts where Java calls cannot be made.
f47527a to
cc78b7b
Compare
|
@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. |
cc78b7b to
b7181d7
Compare
|
@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. |
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't comment on all the details of the changes, but I don't see anything untoward in general.
Thanks.
|
@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 86 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 |
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.
This looks better than I'd imagined.
|
Should we convert any assert only |
Makes sense to me. There are only 3 such assertions and none of them are on performance critical paths:
What do you think @dholmes-ora @vnkozlov ? |
| JavaType fieldHolder = lookupType(holderIndex, opcode); | ||
|
|
||
| if (fieldHolder instanceof HotSpotResolvedObjectTypeImpl) { | ||
| if (fieldHolder instanceof HotSpotResolvedObjectTypeImpl) { |
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.
| if (fieldHolder instanceof HotSpotResolvedObjectTypeImpl) { | |
| if (fieldHolder instanceof HotSpotResolvedObjectTypeImpl) { |
Normally we use asserts for things that are absolutely expected to be uncovered during testing - things that are purely internal VM concerns and for which a failure is a VM coding error. So I don't think it is necessary to change these to guarantees provided we have sufficient test coverage. The guarantee may not hurt but the same could be said for many other assertions. |
|
With GraalVM, we're doing a lot more testing with product builds than fastdebug builds as the majority of checks are done at the Java level and fastdebug just slows everything down. In that testing context, guarantees are much more useful. Given the importance of the "can_call_java" invariant, would you agree that converting these 3 specific assertions to guarantees is justified? |
|
The majority of hotspot testing is done on fastdebug and performance is not considered an issue there. But I don't have a hard objection to these three asserts becoming guarantees. |
|
Thanks for all the reviews and useful input. /integrate |
|
Going to push as commit d354141.
Your commit was automatically rebased without conflicts. |
Hmmm... I hope this doesn't mean that the GraalVM project has changed the |
No, we did not change this in the tier testing. I was referring to the Graal CI. |
Thanks for the info. Does this mean that the Graal CI is running its own Tier[1-8] |
|
I meant does that mean that Graal CI is running its own Graal-Tier[1-N] and it not |
|
The Graal CI system is completely disjoint from mach5-based JDK testing. |
This PR reduces the context in which a libjvmci CompilerThread can make a Java call. By default, a CompileThread for a JVMCI compiler can make Java calls (as jarjvmci only works that way). When libjvmci calls into the VM via a CompilerToVM native method, it enters a scope where Java calls are disabled until either the call returns or a nested scope is entered that re-enables Java calls. The latter is required for the Truffle use case described in JDK-8318694 as well as for a few other VM entry points where libgraal currently still requires the ability to make Java calls (e.g. to load the Java classes used for boxing primitives). We may be able to eventually eliminate all need for libgraal to make Java calls but this PR is a first step in the right direction.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16383/head:pull/16383$ git checkout pull/16383Update a local copy of the PR:
$ git checkout pull/16383$ git pull https://git.openjdk.org/jdk.git pull/16383/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 16383View PR using the GUI difftool:
$ git pr show -t 16383Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16383.diff
Webrev
Link to Webrev Comment