8338538: [JVMCI] Allow HotSpotJVMCIRuntime#getJObjectValue to be called by a HotSpot CompileBroker compiler thread

Reviewed-by: dnsimon
This commit is contained in:
Tomáš Zezula 2024-08-26 16:49:48 +00:00 committed by Doug Simon
parent 3f00da84b3
commit a15af6998e

View File

@ -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);