640 extern "C" objc_registerThreadWithCollector_t objc_registerThreadWithCollectorFunction; |
640 extern "C" objc_registerThreadWithCollector_t objc_registerThreadWithCollectorFunction; |
641 objc_registerThreadWithCollector_t objc_registerThreadWithCollectorFunction = NULL; |
641 objc_registerThreadWithCollector_t objc_registerThreadWithCollectorFunction = NULL; |
642 #endif |
642 #endif |
643 |
643 |
644 #ifdef __APPLE__ |
644 #ifdef __APPLE__ |
645 static uint64_t locate_unique_thread_id() { |
645 static uint64_t locate_unique_thread_id(mach_port_t mach_thread_port) { |
646 // Additional thread_id used to correlate threads in SA |
646 // Additional thread_id used to correlate threads in SA |
647 thread_identifier_info_data_t m_ident_info; |
647 thread_identifier_info_data_t m_ident_info; |
648 mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT; |
648 mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT; |
649 |
649 |
650 thread_info(::mach_thread_self(), THREAD_IDENTIFIER_INFO, |
650 thread_info(mach_thread_port, THREAD_IDENTIFIER_INFO, |
651 (thread_info_t) &m_ident_info, &count); |
651 (thread_info_t) &m_ident_info, &count); |
|
652 |
652 return m_ident_info.thread_id; |
653 return m_ident_info.thread_id; |
653 } |
654 } |
654 #endif |
655 #endif |
655 |
656 |
656 // Thread start routine for all newly created threads |
657 // Thread start routine for all newly created threads |
677 sync->notify_all(); |
678 sync->notify_all(); |
678 return NULL; |
679 return NULL; |
679 } |
680 } |
680 |
681 |
681 #ifdef __APPLE__ |
682 #ifdef __APPLE__ |
682 // thread_id is mach thread on macos |
683 // thread_id is mach thread on macos, which pthreads graciously caches and provides for us |
683 osthread->set_thread_id(::mach_thread_self()); |
684 mach_port_t thread_id = ::pthread_mach_thread_np(::pthread_self()); |
684 osthread->set_unique_thread_id(locate_unique_thread_id()); |
685 guarantee(thread_id != 0, "thread id missing from pthreads"); |
|
686 osthread->set_thread_id(thread_id); |
|
687 |
|
688 uint64_t unique_thread_id = locate_unique_thread_id(thread_id); |
|
689 guarantee(unique_thread_id != 0, "unique thread id was not found"); |
|
690 osthread->set_unique_thread_id(unique_thread_id); |
685 #else |
691 #else |
686 // thread_id is pthread_id on BSD |
692 // thread_id is pthread_id on BSD |
687 osthread->set_thread_id(::pthread_self()); |
693 osthread->set_thread_id(::pthread_self()); |
688 #endif |
694 #endif |
689 // initialize signal mask for this thread |
695 // initialize signal mask for this thread |
841 return false; |
847 return false; |
842 } |
848 } |
843 |
849 |
844 // Store pthread info into the OSThread |
850 // Store pthread info into the OSThread |
845 #ifdef __APPLE__ |
851 #ifdef __APPLE__ |
846 osthread->set_thread_id(::mach_thread_self()); |
852 // thread_id is mach thread on macos, which pthreads graciously caches and provides for us |
847 osthread->set_unique_thread_id(locate_unique_thread_id()); |
853 mach_port_t thread_id = ::pthread_mach_thread_np(::pthread_self()); |
|
854 guarantee(thread_id != 0, "just checking"); |
|
855 osthread->set_thread_id(thread_id); |
|
856 |
|
857 uint64_t unique_thread_id = locate_unique_thread_id(thread_id); |
|
858 guarantee(unique_thread_id != 0, "just checking"); |
|
859 osthread->set_unique_thread_id(unique_thread_id); |
848 #else |
860 #else |
849 osthread->set_thread_id(::pthread_self()); |
861 osthread->set_thread_id(::pthread_self()); |
850 #endif |
862 #endif |
851 osthread->set_pthread_id(::pthread_self()); |
863 osthread->set_pthread_id(::pthread_self()); |
852 |
864 |
2265 |
2277 |
2266 void os::large_page_init() { |
2278 void os::large_page_init() { |
2267 } |
2279 } |
2268 |
2280 |
2269 |
2281 |
2270 char* os::reserve_memory_special(size_t bytes, char* req_addr, bool exec) { |
2282 char* os::reserve_memory_special(size_t bytes, size_t alignment, char* req_addr, bool exec) { |
|
2283 fatal("This code is not used or maintained."); |
|
2284 |
2271 // "exec" is passed in but not used. Creating the shared image for |
2285 // "exec" is passed in but not used. Creating the shared image for |
2272 // the code cache doesn't have an SHM_X executable permission to check. |
2286 // the code cache doesn't have an SHM_X executable permission to check. |
2273 assert(UseLargePages && UseSHM, "only for SHM large pages"); |
2287 assert(UseLargePages && UseSHM, "only for SHM large pages"); |
2274 |
2288 |
2275 key_t key = IPC_PRIVATE; |
2289 key_t key = IPC_PRIVATE; |
3227 |
3241 |
3228 // We don't activate signal checker if libjsig is in place, we trust ourselves |
3242 // We don't activate signal checker if libjsig is in place, we trust ourselves |
3229 // and if UserSignalHandler is installed all bets are off |
3243 // and if UserSignalHandler is installed all bets are off |
3230 if (CheckJNICalls) { |
3244 if (CheckJNICalls) { |
3231 if (libjsig_is_loaded) { |
3245 if (libjsig_is_loaded) { |
3232 tty->print_cr("Info: libjsig is activated, all active signal checking is disabled"); |
3246 if (PrintJNIResolving) { |
|
3247 tty->print_cr("Info: libjsig is activated, all active signal checking is disabled"); |
|
3248 } |
3233 check_signals = false; |
3249 check_signals = false; |
3234 } |
3250 } |
3235 if (AllowUserSignalHandlers) { |
3251 if (AllowUserSignalHandlers) { |
3236 tty->print_cr("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled"); |
3252 if (PrintJNIResolving) { |
|
3253 tty->print_cr("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled"); |
|
3254 } |
3237 check_signals = false; |
3255 check_signals = false; |
3238 } |
3256 } |
3239 } |
3257 } |
3240 } |
3258 } |
3241 } |
3259 } |