< prev index next >

src/share/vm/gc/parallel/psPromotionManager.inline.hpp

Print this page

        

@@ -209,11 +209,11 @@
 
     // Copy obj
     Copy::aligned_disjoint_words((HeapWord*)o, (HeapWord*)new_obj, new_obj_size);
 
     // Now we have to CAS in the header.
-    if (o->cas_forward_to(new_obj, test_mark)) {
+    if (o->cas_forward_to(new_obj, test_mark, memory_order_release)) {
       // We won any races, we "own" this object.
       assert(new_obj == o->forwardee(), "Sanity");
 
       // Increment age if obj still in new generation. Now that
       // we're dealing with a markOop that cannot change, it is

@@ -253,14 +253,18 @@
         CollectedHeap::fill_with_object((HeapWord*) new_obj, new_obj_size);
       }
 
       // don't update this before the unallocation!
       new_obj = o->forwardee();
+      // call acquire for reading fields of new_obj in callers
+      OrderAccess::acquire();
     }
   } else {
     assert(o->is_forwarded(), "Sanity");
     new_obj = o->forwardee();
+    // call acquire for reading fields of new_obj in callers
+    OrderAccess::acquire();
   }
 
   // This code must come after the CAS test, or it will print incorrect
   // information.
   log_develop_trace(gc, scavenge)("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",

@@ -283,13 +287,12 @@
         : copy_to_survivor_space<promote_immediately>(o);
 
   // This code must come after the CAS test, or it will print incorrect
   // information.
   if (log_develop_is_enabled(Trace, gc, scavenge) && o->is_forwarded()) {
-    log_develop_trace(gc, scavenge)("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
-                      "forwarding",
-                      new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size());
+    log_develop_trace(gc, scavenge)("{forwarding %s " PTR_FORMAT " -> " PTR_FORMAT "}",
+                      o->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj));
   }
 
   oopDesc::encode_store_heap_oop_not_null(p, new_obj);
 
   // We cannot mark without test, as some code passes us pointers
< prev index next >