RFR: 8336663: [JVMCI] VM Crash on ZGC due to incompatible handle returned by HotSpotJVMCIRuntime#getJObjectValue

Tom Rodriguez never at openjdk.org
Wed Jul 17 19:00:40 UTC 2024


On Wed, 17 Jul 2024 17:09:46 GMT, Tomáš Zezula <duke at openjdk.org> wrote:

> The `HotSpotJVMCIRuntime#getJObjectValue` method returns a real JNI local handle instead of a JVMCI handle to prevent random crashes on ZGC.

src/hotspot/share/jvmci/jvmciCompilerToVM.cpp line 715:

> 713:     JVMCIObject constant = JVMCIENV->wrap(constant_jobject);
> 714:     Handle constant_value = JVMCIENV->asConstant(constant, JVMCI_CHECK_0);
> 715:     jobject jni_handle = JNIHandles::make_local(THREAD, constant_value());

Who is responsible for cleaning up these local refs?  My recollection is that they are allocated in the top most containing scope but if you haven't introduced new JNI scope they will never get released.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20219#discussion_r1681584955


More information about the hotspot-compiler-dev mailing list