@@ -148,10 +148,6 @@ inline oop PSPromotionManager::copy_to_survivor_space(oop o) {
148148 if (!m.is_forwarded ()) {
149149 return copy_unmarked_to_survivor_space<promote_immediately>(o, m);
150150 } else {
151- // Ensure any loads from the forwardee follow all changes that precede
152- // the release-cmpxchg that performed the forwarding, possibly in some
153- // other thread.
154- OrderAccess::acquire ();
155151 // Return the already installed forwardee.
156152 return m.forwardee ();
157153 }
@@ -258,8 +254,11 @@ inline oop PSPromotionManager::copy_unmarked_to_survivor_space(oop o,
258254 ContinuationGCSupport::transform_stack_chunk (new_obj);
259255
260256 // Now we have to CAS in the header.
261- // Make copy visible to threads reading the forwardee.
262- oop forwardee = o->forward_to_atomic (new_obj, test_mark, memory_order_release);
257+ // Because the forwarding is done with memory_order_relaxed there is no
258+ // ordering with the above copy. Clients that get the forwardee must not
259+ // examine its contents without other synchronization, since the contents
260+ // may not be up to date for them.
261+ oop forwardee = o->forward_to_atomic (new_obj, test_mark, memory_order_relaxed);
263262 if (forwardee == nullptr ) { // forwardee is null when forwarding is successful
264263 // We won any races, we "own" this object.
265264 assert (new_obj == o->forwardee (), " Sanity" );
@@ -295,9 +294,6 @@ inline oop PSPromotionManager::copy_unmarked_to_survivor_space(oop o,
295294 return new_obj;
296295 } else {
297296 // We lost, someone else "owns" this object.
298- // Ensure loads from the forwardee follow all changes that preceded the
299- // release-cmpxchg that performed the forwarding in another thread.
300- OrderAccess::acquire ();
301297
302298 assert (o->is_forwarded (), " Object must be forwarded if the cas failed." );
303299 assert (o->forwardee () == forwardee, " invariant" );
0 commit comments