Skip to content

Commit a15af69

Browse files
tzezulaDoug Simon
authored andcommitted
8338538: [JVMCI] Allow HotSpotJVMCIRuntime#getJObjectValue to be called by a HotSpot CompileBroker compiler thread
Reviewed-by: dnsimon
1 parent 3f00da8 commit a15af69

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/hotspot/share/jvmci/jvmciCompilerToVM.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,10 @@ C2V_END
710710

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

0 commit comments

Comments
 (0)