Skip to content

Commit

Permalink
8338538: [JVMCI] Allow HotSpotJVMCIRuntime#getJObjectValue to be call…
Browse files Browse the repository at this point in the history
…ed by a HotSpot CompileBroker compiler thread

Reviewed-by: dnsimon
  • Loading branch information
tzezula authored and Doug Simon committed Aug 26, 2024
1 parent 3f00da8 commit a15af69
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,10 @@ C2V_END

C2V_VMENTRY_0(jlong, getJObjectValue, (JNIEnv* env, jobject, jobject constant_jobject))
requireNotInHotSpot("getJObjectValue", JVMCI_CHECK_0);
if (!THREAD->has_last_Java_frame()) {
JVMCI_THROW_MSG_0(IllegalStateException, err_msg("Cannot call getJObjectValue without Java frame anchor"));
// Ensure that current JNI handle scope is not the top-most JNIHandleBlock as handles
// in that scope are only released when the thread exits.
if (!THREAD->has_last_Java_frame() && THREAD->active_handles()->pop_frame_link() == nullptr) {
JVMCI_THROW_MSG_0(IllegalStateException, err_msg("Cannot call getJObjectValue without Java frame anchor or a pushed JNI handle block"));
}
JVMCIObject constant = JVMCIENV->wrap(constant_jobject);
Handle constant_value = JVMCIENV->asConstant(constant, JVMCI_CHECK_0);
Expand Down

0 comments on commit a15af69

Please sign in to comment.