8044090: C1: Old value instead of new one is passed to post-barrier in UnsafeGetAndSetObject
authoriveresov
Wed, 28 May 2014 07:59:23 -1000
changeset 24677 db68f26d4f1b
parent 24676 1db7e277df87
child 24678 9bb217f7f313
8044090: C1: Old value instead of new one is passed to post-barrier in UnsafeGetAndSetObject Summary: Pass correct value to post-barrier in UnsafeGetAndSetObject Reviewed-by: roland, vlivanov
hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp
--- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Wed May 28 14:42:00 2014 +0400
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Wed May 28 07:59:23 2014 -1000
@@ -1221,10 +1221,8 @@
   bool is_obj = (type == T_ARRAY || type == T_OBJECT);
   LIR_Opr offset = off.result();
 
-  if (data != dst) {
-    __ move(data, dst);
-    data = dst;
-  }
+  // Because we want a 2-arg form of xchg
+  __ move(data, dst);
 
   assert (!x->is_add() && (type == T_INT || (is_obj LP64_ONLY(&& UseCompressedOops))), "unexpected type");
   LIR_Address* addr;
@@ -1254,7 +1252,7 @@
     pre_barrier(ptr, LIR_OprFact::illegalOpr /* pre_val */,
                 true /* do_load */, false /* patch */, NULL);
   }
-  __ xchg(LIR_OprFact::address(addr), data, dst, tmp);
+  __ xchg(LIR_OprFact::address(addr), dst, dst, tmp);
   if (is_obj) {
     // Seems to be a precise address
     post_barrier(ptr, data);