1 Star 0 Fork 25

何大鹏/openjdk-17

forked from src-openEuler/openjdk-17 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
8272138-ZGC-Adopt-relaxed-ordering-for-self-healing.patch 1.90 KB
一键复制 编辑 原始数据 按行查看 历史
kuen 提交于 2022-04-26 10:42 . I54NOQ: init jdk17.0.3-ga
From 8f29e9c5ec26a5f726ddd0557e046e66c1c94e10 Mon Sep 17 00:00:00 2001
Date: Wed, 8 Dec 2021 16:23:26 +0800
Subject: [PATCH] [Backport] 8272138: ZGC: Adopt relaxed ordering for self-healing
Reference: https://bugs.openjdk.java.net/browse/JDK-8272138
---
src/hotspot/share/gc/z/zBarrier.inline.hpp | 2 +-
src/hotspot/share/gc/z/zForwarding.inline.hpp | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/hotspot/share/gc/z/zBarrier.inline.hpp b/src/hotspot/share/gc/z/zBarrier.inline.hpp
index 0fa611005..2eaebfcfd 100644
--- a/src/hotspot/share/gc/z/zBarrier.inline.hpp
+++ b/src/hotspot/share/gc/z/zBarrier.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;
diff --git a/src/hotspot/share/gc/z/zForwarding.inline.hpp b/src/hotspot/share/gc/z/zForwarding.inline.hpp
index 31bf72929..cff6d7a90 100644
--- a/src/hotspot/share/gc/z/zForwarding.inline.hpp
+++ b/src/hotspot/share/gc/z/zForwarding.inline.hpp
@@ -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);
+ const ZForwardingEntry prev_entry = Atomic::cmpxchg(entries() + *cursor, old_entry, new_entry, memory_order_relaxed);
if (!prev_entry.populated()) {
// Success
return to_offset;
--
2.19.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/he-dapeng-01/openjdk-17.git
git@gitee.com:he-dapeng-01/openjdk-17.git
he-dapeng-01
openjdk-17
openjdk-17
master

搜索帮助