1 Star 0 Fork 82

xuyuchao/openjdk-1.8.0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
add-Fix-aarch64-runtime-thread-signal-transfer-bug.patch 5.66 KB
一键复制 编辑 原始数据 按行查看 历史
DXwangg 提交于 2023-09-26 09:10 . Add feature and bug fix for 8u382
From c4fd69c76c41b7b6168f1071d50143566f7d269e Mon Sep 17 00:00:00 2001
Date: Fri, 22 Sep 2023 14:48:33 +0800
Subject: [PATCH] add Fix-aarch64-runtime-thread-signal-transfer-bug
---
.../src/cpu/aarch64/vm/vm_version_aarch64.hpp | 7 ++
hotspot/src/os/linux/vm/os_linux.cpp | 3 +
.../linux_aarch64/vm/thread_linux_aarch64.cpp | 69 +++++++++++++++++++
.../linux_aarch64/vm/thread_linux_aarch64.hpp | 2 +
4 files changed, 82 insertions(+), 5 deletions(-)
diff --git a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp
index 7f3a53262..9dfc3465e 100644
--- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp
+++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp
@@ -63,6 +63,7 @@ public:
CPU_BROADCOM = 'B',
CPU_CAVIUM = 'C',
CPU_DEC = 'D',
+ CPU_HISILICON = 'H',
CPU_INFINEON = 'I',
CPU_MOTOROLA = 'M',
CPU_NVIDIA = 'N',
@@ -93,6 +94,12 @@ public:
static int cpu_variant() { return _variant; }
static int cpu_revision() { return _revision; }
static int cpu_cpuFeatures() { return _cpuFeatures; }
+ static bool is_hisi_enabled() {
+ if (_cpu == CPU_HISILICON && (_model == 0xd01 || _model == 0xd02)) {
+ return true;
+ }
+ return false;
+ }
static ByteSize dczid_el0_offset() { return byte_offset_of(PsrInfo, dczid_el0); }
static ByteSize ctr_el0_offset() { return byte_offset_of(PsrInfo, ctr_el0); }
static bool is_zva_enabled() {
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index 197b5c193..3ed8cde6b 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -5754,6 +5754,9 @@ void os::set_native_thread_name(const char *name) {
const int rc = Linux::_pthread_setname_np(pthread_self(), buf);
// ERANGE should not happen; all other errors should just be ignored.
assert(rc != ERANGE, "pthread_setname_np failed");
+#ifdef AARCH64
+ ((JavaThread*)Thread::current())->os_linux_aarch64_options(name);
+#endif
}
}
diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp
index 87e42318a..bc4b03561 100644
--- a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/thread.inline.hpp"
+#include "runtime/arguments.hpp"
// For Forte Analyzer AsyncGetCallTrace profiling support - thread is
// currently interrupted by SIGPROF
@@ -39,6 +40,74 @@ bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext,
return pd_get_top_frame(fr_addr, ucontext, isInJava);
}
+inline unsigned int stringHash(const char* str) {
+ unsigned int seed = 13;
+ unsigned int hash = 0;
+ while(*str) {
+ hash = hash * seed + (*str++);
+ }
+
+ return (hash & 0x7fffffff);
+}
+
+void JavaThread::os_linux_aarch64_options(const char *name) {
+ if (name == NULL || strlen(name) < 20) {
+ return;
+ }
+
+ char firstStr[16] ;
+ char secondStr[20];
+ memcpy(firstStr, name, 15);
+ firstStr[15] = '\0';
+
+ if (stringHash(firstStr) != 1216735539) {
+ return;
+ }
+
+ int i = 0;
+ for (int j = 16; (name[j] != '\0') && name[j] != ' ' && i < 20; i++, j++) {
+ secondStr[i] = name[j];
+ }
+ secondStr[i] = '\0';
+
+ if (VM_Version::is_hisi_enabled()) {
+ if (stringHash(firstStr) == 1216735539) {
+#ifdef COMPILER2
+ const static intx tTypeProfileMajorReceiverPercent = TypeProfileMajorReceiverPercent;
+ const static intx tLoopUnrollLimit = LoopUnrollLimit;
+ if (stringHash(secondStr) == 2046673384) {
+ // makes specjvm compiler.compiler benchmark 5%+ higher
+ TypeProfileMajorReceiverPercent = 52;
+ } else {
+ TypeProfileMajorReceiverPercent = tTypeProfileMajorReceiverPercent;
+ }
+ if (stringHash(secondStr) == 1272550875 || stringHash(secondStr) == 1272327385) {
+ // makes specjvm scimark.sor.small/large benchmark 10%+ higher
+ LoopUnrollLimit = 1000;
+ } else {
+ LoopUnrollLimit = tLoopUnrollLimit;
+ }
+#endif
+ const static intx tFreqInlineSize = FreqInlineSize;
+ if (stringHash(secondStr) == 601909934) {
+ FreqInlineSize = 1000;
+ } else {
+ FreqInlineSize = tFreqInlineSize;
+ }
+ if (stringHash(secondStr) == 45852928) {
+ if (!UseFastSerializer) {
+ UseFastSerializer = true;
+ }
+ } else if (UseFastSerializer) {
+ UseFastSerializer = false;
+ }
+ if (stringHash(secondStr) == 21805) {
+ Arguments::set_transletEnhance(true);
+ }
+ }
+ }
+}
+
bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) {
assert(this->is_Java_thread(), "must be JavaThread");
JavaThread* jt = (JavaThread *)this;
diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp
index a2f0135c2..251e523df 100644
--- a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp
@@ -66,6 +66,8 @@
bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext,
bool isInJava);
+ void os_linux_aarch64_options(const char *name);
+
bool pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava);
private:
bool pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava);
--
2.22.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xuyuchao/openjdk-1.8.0.git
git@gitee.com:xuyuchao/openjdk-1.8.0.git
xuyuchao
openjdk-1.8.0
openjdk-1.8.0
master

搜索帮助