7010665: Misplaced membar in C1 implementation of Unsafe.get/putXXX
authordholmes
Sun, 09 Jan 2011 17:16:16 -0500
changeset 7894 48e7725b6bc4
parent 7725 88030b16fe3d
child 7895 e71bad345f3a
7010665: Misplaced membar in C1 implementation of Unsafe.get/putXXX Summary: Modify membars to match regular volatile variable handling Reviewed-by: iveresov, kvn, never
hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Fri Jan 07 13:59:48 2011 -0800
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Sun Jan 09 17:16:16 2011 -0500
@@ -1990,9 +1990,8 @@
 
   LIR_Opr reg = reg = rlock_result(x, x->basic_type());
 
+  get_Object_unsafe(reg, src.result(), off.result(), type, x->is_volatile());
   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();
 }
 
 
@@ -2014,6 +2013,7 @@
 
   if (x->is_volatile() && os::is_MP()) __ membar_release();
   put_Object_unsafe(src.result(), off.result(), data.result(), type, x->is_volatile());
+  if (x->is_volatile() && os::is_MP()) __ membar();
 }