RFR: 8189633: Missing -Xcheck:jni checking for DeleteWeakGlobalRef

David Holmes david.holmes at oracle.com
Wed Jan 3 05:31:42 UTC 2018

Hi Kim,

On 3/01/2018 9:30 AM, Kim Barrett wrote:
> Please review this change to the checking form of DeleteWeakGlobalRef
> to actually perform some checking.  The checking that is now being
> done was cribbed from DeleteGlobalRef.
> CR:
> https://bugs.openjdk.java.net/browse/JDK-8189633
> Webrev:
> http://cr.openjdk.java.net/~kbarrett/8189633/open.00/

Doesn't the fact it is a weak-ref mean that resolving it could return 
NULL, in which case validate_object will trigger a JNI fatal error:

oop jniCheck::validate_object(JavaThread* thr, jobject obj) {
     if (!obj)
         return NULL;
     oop oopObj = jniCheck::validate_handle(thr, obj);
     if (!oopObj) {
       ReportJNIFatalError(thr, fatal_bad_ref_to_jni);
     return oopObj;



> Testing:
> Mach5 hs-tier1,2,3
> I tried running tests locally with -Xcheck:jni, but that ran afoul of
> JDK-8189766.

More information about the hotspot-runtime-dev mailing list