From 0b6b6b74e3b21cd11a576b821ddbd0cc13ab9ab3 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Mon, 8 Jul 2024 23:01:03 +0800 Subject: [PATCH] os_bsd.cpp: fix running VM --- hotspot/src/os/bsd/vm/os_bsd.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git hotspot/src/os/bsd/vm/os_bsd.cpp hotspot/src/os/bsd/vm/os_bsd.cpp index 0c5cebc229..87eec228fa 100644 --- hotspot/src/os/bsd/vm/os_bsd.cpp +++ hotspot/src/os/bsd/vm/os_bsd.cpp @@ -678,7 +678,7 @@ static bool _thread_safety_check(Thread* thread) { return true; } -#ifdef __APPLE__ +#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // library handle for calling objc_registerThreadWithCollector() // without static linking to the libobjc library #define OBJC_LIB "/usr/lib/libobjc.dylib" @@ -688,7 +688,7 @@ extern "C" objc_registerThreadWithCollector_t objc_registerThreadWithCollectorFu objc_registerThreadWithCollector_t objc_registerThreadWithCollectorFunction = NULL; #endif -#ifdef __APPLE__ +#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 static uint64_t locate_unique_thread_id(mach_port_t mach_thread_port) { // Additional thread_id used to correlate threads in SA thread_identifier_info_data_t m_ident_info; @@ -728,7 +728,7 @@ static void *java_start(Thread *thread) { osthread->set_thread_id(os::Bsd::gettid()); -#ifdef __APPLE__ +#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 uint64_t unique_thread_id = locate_unique_thread_id(osthread->thread_id()); guarantee(unique_thread_id != 0, "unique thread id was not found"); osthread->set_unique_thread_id(unique_thread_id); @@ -739,7 +739,7 @@ static void *java_start(Thread *thread) { // initialize floating point control register os::Bsd::init_thread_fpu_state(); -#ifdef __APPLE__ +#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // register thread with objc gc if (objc_registerThreadWithCollectorFunction != NULL) { objc_registerThreadWithCollectorFunction(); @@ -891,7 +891,7 @@ bool os::create_attached_thread(JavaThread* thread) { osthread->set_thread_id(os::Bsd::gettid()); // Store pthread info into the OSThread -#ifdef __APPLE__ +#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 uint64_t unique_thread_id = locate_unique_thread_id(osthread->thread_id()); guarantee(unique_thread_id != 0, "just checking"); osthread->set_unique_thread_id(unique_thread_id); @@ -3803,7 +3803,7 @@ jint os::init_2(void) // initialize thread priority policy prio_init(); -#ifdef __APPLE__ +#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // dynamically link to objective c gc registration void *handleLibObjc = dlopen(OBJC_LIB, RTLD_LAZY); if (handleLibObjc != NULL) {