From cb59935d4bb8ebe9342badab61f29c364f53f487 Mon Sep 17 00:00:00 2001 From: Ben Taylor Date: Tue, 10 Sep 2024 19:12:29 +0000 Subject: [PATCH] JDK-8339882: Replace ThreadLocalStorage::thread with Thread::current_or_null in jdk8 backport of JDK-8183925 --- hotspot/src/os/posix/vm/os_posix.cpp | 2 +- hotspot/src/os/windows/vm/os_windows.cpp | 2 +- hotspot/src/share/vm/runtime/os.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hotspot/src/os/posix/vm/os_posix.cpp b/hotspot/src/os/posix/vm/os_posix.cpp index ac00e85ba11..8b493d4ef3d 100644 --- a/hotspot/src/os/posix/vm/os_posix.cpp +++ b/hotspot/src/os/posix/vm/os_posix.cpp @@ -876,7 +876,7 @@ bool os::ThreadCrashProtection::call(os::CrashProtectionCallback& cb) { Thread::muxAcquire(&_crash_mux, "CrashProtection"); - _protected_thread = ThreadLocalStorage::thread(); + _protected_thread = Thread::current_or_null(); assert(_protected_thread != NULL, "Cannot crash protect a NULL thread"); // we cannot rely on sigsetjmp/siglongjmp to save/restore the signal mask diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index e7c38f1ea7d..3c6145cfbc0 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -4890,7 +4890,7 @@ bool os::ThreadCrashProtection::call(os::CrashProtectionCallback& cb) { Thread::muxAcquire(&_crash_mux, "CrashProtection"); - _protected_thread = ThreadLocalStorage::thread(); + _protected_thread = Thread::current_or_null(); assert(_protected_thread != NULL, "Cannot crash protect a NULL thread"); bool success = true; diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp index 96eed036705..9a1f38414bf 100644 --- a/hotspot/src/share/vm/runtime/os.cpp +++ b/hotspot/src/share/vm/runtime/os.cpp @@ -619,7 +619,7 @@ void* os::malloc(size_t size, MEMFLAGS memflags, const NativeCallStack& stack) { // Since os::malloc can be called when the libjvm.{dll,so} is // first loaded and we don't have a thread yet we must accept NULL also here. - assert(!os::ThreadCrashProtection::is_crash_protected(ThreadLocalStorage::thread()), + assert(!os::ThreadCrashProtection::is_crash_protected(Thread::current_or_null()), "malloc() not allowed when crash protection is set"); if (size == 0) {