changeset 57439:153bd98146fc

8235982: AArch64: Insufficient memory barriers in shadow region algorithm Summary: The memory barriers used for synchronizing ParallelCompactData::RegionData::_shadow_state and ParallelCompactData::RegionData::shadow_region are insufficient to prevent reordering of loads. Reviewed-by: tschatzl, sjohanss
author ngasson
date Wed, 18 Dec 2019 11:20:13 +0100
parents 5b4e75523380
children 1c844398e041
files src/hotspot/share/gc/parallel/psParallelCompact.hpp
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/parallel/psParallelCompact.hpp	Wed Dec 18 10:04:53 2019 +0100
+++ b/src/hotspot/share/gc/parallel/psParallelCompact.hpp	Wed Dec 18 11:20:13 2019 +0100
@@ -630,25 +630,25 @@
 }
 
 inline bool ParallelCompactData::RegionData::mark_normal() {
-  return Atomic::cmpxchg(&_shadow_state, UnusedRegion, NormalRegion, memory_order_relaxed) == UnusedRegion;
+  return Atomic::cmpxchg(&_shadow_state, UnusedRegion, NormalRegion) == UnusedRegion;
 }
 
 inline bool ParallelCompactData::RegionData::mark_shadow() {
   if (_shadow_state != UnusedRegion) return false;
-  return Atomic::cmpxchg(&_shadow_state, UnusedRegion, ShadowRegion, memory_order_relaxed) == UnusedRegion;
+  return Atomic::cmpxchg(&_shadow_state, UnusedRegion, ShadowRegion) == UnusedRegion;
 }
 
 inline void ParallelCompactData::RegionData::mark_filled() {
-  int old = Atomic::cmpxchg(&_shadow_state, ShadowRegion, FilledShadow, memory_order_relaxed);
+  int old = Atomic::cmpxchg(&_shadow_state, ShadowRegion, FilledShadow);
   assert(old == ShadowRegion, "Fail to mark the region as filled");
 }
 
 inline bool ParallelCompactData::RegionData::mark_copied() {
-  return Atomic::cmpxchg(&_shadow_state, FilledShadow, CopiedShadow, memory_order_relaxed) == FilledShadow;
+  return Atomic::cmpxchg(&_shadow_state, FilledShadow, CopiedShadow) == FilledShadow;
 }
 
 void ParallelCompactData::RegionData::shadow_to_normal() {
-  int old = Atomic::cmpxchg(&_shadow_state, ShadowRegion, NormalRegion, memory_order_relaxed);
+  int old = Atomic::cmpxchg(&_shadow_state, ShadowRegion, NormalRegion);
   assert(old == ShadowRegion, "Fail to mark the region as finish");
 }