RFR(S): 8165489: Missing G1 barrier in Unsafe_GetObjectVolatile

Mikael Gerdin mikael.gerdin at oracle.com
Mon Sep 12 13:06:23 UTC 2016


Hi Martin,

On 2016-09-06 13:11, Doerr, Martin wrote:
> Hi Kim,
>
> as discussed in the thread for JDK-8165018, I created a bug and a webrev:
> http://cr.openjdk.java.net/~mdoerr/8165489_G1_Unsafe/webrev.00/

inline void G1SATB_registerReference(oop o, jlong offset, oop v)

* Since this is local to unsafe.cpp you should make it "static"
* I think "inline" is not really needed, especially since there is an 
intrinsic for Unsafe::getObjectVolatile.
* Since the function does not unconditionally register the reference a 
more complete name for the function would become very long, perhaps it 
should be split into two separate ones:

static bool is_java_lang_ref_Reference_write(oop o, jlong offset) {
...
}

#if INCLUDE_ALL_GCS
static void ensure_referent_alive(oop v) {
   if (v != NULL) {
     G1SATB.....
   }
}
#else
static void ensure_referent_alive(oop v) {}
#endif



so the code in Unsafe_GetObject would be something like:

if (is_java_lang_ref_Reference_write(p, offset)) {
   ensure_referent_alive(v);
}


/Mikael

>
> Please review.
>
> Thanks for the discussion and for sponsoring.
>
> Best regards,
> Martin
>


More information about the hotspot-gc-dev mailing list