< prev index next >

src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp

Print this page

        

@@ -1923,28 +1923,13 @@
     assert(cmpval != newval, "cmp and new values must be in different registers");
     assert(cmpval != addr, "cmp and addr must be in different registers");
     assert(newval != addr, "new value and addr must be in different registers");
 
     if ( op->code() == lir_cas_obj) {
-#ifdef _LP64
-      if (UseCompressedOops) {
-        __ encode_heap_oop(cmpval);
-        __ mov(rscratch1, newval);
-        __ encode_heap_oop(rscratch1);
-        if (os::is_MP()) {
-          __ lock();
-        }
-        // cmpval (rax) is implicitly used by this instruction
-        __ cmpxchgl(rscratch1, Address(addr, 0));
-      } else
-#endif
-      {
-        if (os::is_MP()) {
-          __ lock();
-        }
-        __ cmpxchgptr(newval, Address(addr, 0));
-      }
+      Register tmp1 = op->tmp1()->as_register();
+      Register tmp2 = op->tmp2()->as_register();
+      __ cmpxchg_oop(NULL, Address(addr, 0), cmpval, newval, true, true, tmp1, tmp2);
     } else {
       assert(op->code() == lir_cas_int, "lir_cas_int expected");
       if (os::is_MP()) {
         __ lock();
       }

@@ -3044,10 +3029,13 @@
   Register src_pos = op->src_pos()->as_register();
   Register dst_pos = op->dst_pos()->as_register();
   Register length  = op->length()->as_register();
   Register tmp = op->tmp()->as_register();
 
+  __ resolve_for_read(IN_HEAP, src);
+  __ resolve_for_write(IN_HEAP, dst);
+
   CodeStub* stub = op->stub();
   int flags = op->flags();
   BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
   if (basic_type == T_ARRAY) basic_type = T_OBJECT;
 

@@ -3482,10 +3470,11 @@
     Register scratch = noreg;
     if (UseBiasedLocking) {
       scratch = op->scratch_opr()->as_register();
     }
     assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
+    __ resolve_for_write(IN_HEAP, obj);
     // add debug info for NullPointerException only if one is possible
     int null_check_offset = __ lock_object(hdr, obj, lock, scratch, *op->stub()->entry());
     if (op->info() != NULL) {
       add_debug_info_for_null_check(null_check_offset, op->info());
     }

@@ -3999,21 +3988,12 @@
       __ xchgl(data->as_register(), as_Address(src->as_address_ptr()));
     }
   } else if (data->is_oop()) {
     assert (code == lir_xchg, "xadd for oops");
     Register obj = data->as_register();
-#ifdef _LP64
-    if (UseCompressedOops) {
-      __ encode_heap_oop(obj);
-      __ xchgl(obj, as_Address(src->as_address_ptr()));
-      __ decode_heap_oop(obj);
-    } else {
-      __ xchgptr(obj, as_Address(src->as_address_ptr()));
-    }
-#else
-    __ xchgl(obj, as_Address(src->as_address_ptr()));
-#endif
+    assert (tmp->is_register(), "should be register");
+    __ xchg_oop(obj, as_Address(src->as_address_ptr()), tmp->as_register());
   } else if (data->type() == T_LONG) {
 #ifdef _LP64
     assert(data->as_register_lo() == data->as_register_hi(), "should be a single register");
     if (code == lir_xadd) {
       if (os::is_MP()) {
< prev index next >