[concurrency-interest] jdk9 VarHandle and Fence methods

thurstonn thurston at nomagicsoftware.com
Sun Aug 23 12:17:32 EDT 2015

from unsafe.cpp:

UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapObject(JNIEnv *env, jobject
unsafe, jobject obj, jlong offset, jobject e_h, jobject x_h))


  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;


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.

More information about the Concurrency-interest mailing list