Skip to content
Permalink
Browse files
8272138: ZGC: Adopt relaxed ordering for self-healing
Co-authored-by: Hao Tang <albert.th@alibaba-inc.com>
Reviewed-by: eosterlund, pliden
  • Loading branch information
2 people authored and pliden committed Aug 11, 2021
1 parent 5350b99 commit 846cc88f9452a63269130b7fe17f504deaf2a773
Showing with 6 additions and 2 deletions.
  1. +1 −1 src/hotspot/share/gc/z/zBarrier.inline.hpp
  2. +5 −1 src/hotspot/share/gc/z/zForwarding.inline.hpp
@@ -117,7 +117,7 @@ inline void ZBarrier::self_heal(volatile oop* p, uintptr_t addr, uintptr_t heal_

for (;;) {
// Heal
const uintptr_t prev_addr = Atomic::cmpxchg((volatile uintptr_t*)p, addr, heal_addr);
const uintptr_t prev_addr = Atomic::cmpxchg((volatile uintptr_t*)p, addr, heal_addr, memory_order_relaxed);
if (prev_addr == addr) {
// Success
return;
@@ -136,8 +136,12 @@ inline uintptr_t ZForwarding::insert(uintptr_t from_index, uintptr_t to_offset,
const ZForwardingEntry new_entry(from_index, to_offset);
const ZForwardingEntry old_entry; // Empty

// Make sure that object copy is finished
// before forwarding table installation
OrderAccess::release();

for (;;) {
const ZForwardingEntry prev_entry = Atomic::cmpxchg(entries() + *cursor, old_entry, new_entry, memory_order_release);
const ZForwardingEntry prev_entry = Atomic::cmpxchg(entries() + *cursor, old_entry, new_entry, memory_order_relaxed);
if (!prev_entry.populated()) {
// Success
return to_offset;

1 comment on commit 846cc88

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 846cc88 Aug 11, 2021

Please sign in to comment.