[concurrency-interest] jdk9 VarHandle and Fence methods

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Aug 24 05:07:51 EDT 2015


That *is* a GC write barrier. While it may have an internal memory
semantics that affects the actual semantics of reference CAS, its
effects are not advertised.

-Aleksey

P.S. Somewhat amusingly, C2 intrinsic for reference CAS implemented a
success-only GC write barrier only recently:
  https://bugs.openjdk.java.net/browse/JDK-8019968


On 08/23/2015 08:30 PM, Vitaly Davidovich wrote:
> That's likely a store/write barrier for GC (i.e. card mark).
> 
> sent from my phone
> 
> On Aug 23, 2015 1:17 PM, "thurstonn" <thurston at nomagicsoftware.com
> <mailto:thurston at nomagicsoftware.com>> wrote:
> 
>     from unsafe.cpp:
> 
>     UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapObject(JNIEnv *env, jobject
>     unsafe, jobject obj, jlong offset, jobject e_h, jobject x_h))
> 
>       UnsafeWrapper("Unsafe_CompareAndSwapObject");
> 
>       oop x = JNIHandles::resolve(x_h);
> 
>       oop e = JNIHandles::resolve(e_h);
> 
>       oop p = JNIHandles::resolve(obj);
> 
>       HeapWord* addr = (HeapWord *)index_oop_from_field_offset_long(p,
>     offset);
> 
>       oop res = oopDesc::atomic_compare_exchange_oop(x, addr, e, true);
> 
>       jboolean success  = (res == e);
> 
>      * if (success)
> 
>         update_barrier_set((void*)addr, x);*
> 
>       return success;
> 
>     UNSAFE_END
> 
>     That's what I was referring to; I  presumed update_barrier_set
>     resulted in
>     some sort of store fence
> 
> 
> 
>     --
>     View this message in context:
>     http://jsr166-concurrency.10961.n7.nabble.com/jdk9-VarHandle-and-Fence-methods-tp12666p12688.html
>     Sent from the JSR166 Concurrency mailing list archive at Nabble.com.
>     _______________________________________________
>     Concurrency-interest mailing list
>     Concurrency-interest at cs.oswego.edu
>     <mailto:Concurrency-interest at cs.oswego.edu>
>     http://cs.oswego.edu/mailman/listinfo/concurrency-interest
> 
> 
> 
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20150824/53f4705d/attachment.bin>


More information about the Concurrency-interest mailing list