The C1 shared code for generating the intrinsics for the Unsafe.getXXX and Unsafe.putXXX is: void LIRGenerator::do_UnsafeGetObject(UnsafeGetObject* x) { ... if (x->is_volatile() && os::is_MP()) __ membar_acquire(); get_Object_unsafe(reg, src.result(), off.result(), type, x->is_volatile()); if (x->is_volatile() && os::is_MP()) __ membar(); } void LIRGenerator::do_UnsafePutObject(UnsafePutObject* x) { ... if (x->is_volatile() && os::is_MP()) __ membar_release(); put_Object_unsafe(src.result(), off.result(), data.result(), type, x->is_volatile()); } Note that "get" has a final membar(), but it is the "put" that needs it. Also "get" should be "load; acquire" not "acquire; load"
|