src/os/bsd/vm/os_bsd.cpp

changeset 6462
e2722a66aba7
parent 6460
f42f2e2a1518
parent 5578
4c84d351cca9
child 6472
2b8e28fdf503
     1.1 --- a/src/os/bsd/vm/os_bsd.cpp	Thu Aug 22 09:39:54 2013 -0700
     1.2 +++ b/src/os/bsd/vm/os_bsd.cpp	Thu Sep 05 11:04:39 2013 -0700
     1.3 @@ -642,13 +642,14 @@
     1.4  #endif
     1.5  
     1.6  #ifdef __APPLE__
     1.7 -static uint64_t locate_unique_thread_id() {
     1.8 +static uint64_t locate_unique_thread_id(mach_port_t mach_thread_port) {
     1.9    // Additional thread_id used to correlate threads in SA
    1.10    thread_identifier_info_data_t     m_ident_info;
    1.11    mach_msg_type_number_t            count = THREAD_IDENTIFIER_INFO_COUNT;
    1.12  
    1.13 -  thread_info(::mach_thread_self(), THREAD_IDENTIFIER_INFO,
    1.14 +  thread_info(mach_thread_port, THREAD_IDENTIFIER_INFO,
    1.15                (thread_info_t) &m_ident_info, &count);
    1.16 +
    1.17    return m_ident_info.thread_id;
    1.18  }
    1.19  #endif
    1.20 @@ -679,9 +680,14 @@
    1.21    }
    1.22  
    1.23  #ifdef __APPLE__
    1.24 -  // thread_id is mach thread on macos
    1.25 -  osthread->set_thread_id(::mach_thread_self());
    1.26 -  osthread->set_unique_thread_id(locate_unique_thread_id());
    1.27 +  // thread_id is mach thread on macos, which pthreads graciously caches and provides for us
    1.28 +  mach_port_t thread_id = ::pthread_mach_thread_np(::pthread_self());
    1.29 +  guarantee(thread_id != 0, "thread id missing from pthreads");
    1.30 +  osthread->set_thread_id(thread_id);
    1.31 +
    1.32 +  uint64_t unique_thread_id = locate_unique_thread_id(thread_id);
    1.33 +  guarantee(unique_thread_id != 0, "unique thread id was not found");
    1.34 +  osthread->set_unique_thread_id(unique_thread_id);
    1.35  #else
    1.36    // thread_id is pthread_id on BSD
    1.37    osthread->set_thread_id(::pthread_self());
    1.38 @@ -843,8 +849,14 @@
    1.39  
    1.40    // Store pthread info into the OSThread
    1.41  #ifdef __APPLE__
    1.42 -  osthread->set_thread_id(::mach_thread_self());
    1.43 -  osthread->set_unique_thread_id(locate_unique_thread_id());
    1.44 +  // thread_id is mach thread on macos, which pthreads graciously caches and provides for us
    1.45 +  mach_port_t thread_id = ::pthread_mach_thread_np(::pthread_self());
    1.46 +  guarantee(thread_id != 0, "just checking");
    1.47 +  osthread->set_thread_id(thread_id);
    1.48 +
    1.49 +  uint64_t unique_thread_id = locate_unique_thread_id(thread_id);
    1.50 +  guarantee(unique_thread_id != 0, "just checking");
    1.51 +  osthread->set_unique_thread_id(unique_thread_id);
    1.52  #else
    1.53    osthread->set_thread_id(::pthread_self());
    1.54  #endif
    1.55 @@ -1115,7 +1127,7 @@
    1.56  
    1.57  intx os::current_thread_id() {
    1.58  #ifdef __APPLE__
    1.59 -  return (intx)::mach_thread_self();
    1.60 +  return (intx)::pthread_mach_thread_np(::pthread_self());
    1.61  #else
    1.62    return (intx)::pthread_self();
    1.63  #endif
    1.64 @@ -2267,7 +2279,9 @@
    1.65  }
    1.66  
    1.67  
    1.68 -char* os::reserve_memory_special(size_t bytes, char* req_addr, bool exec) {
    1.69 +char* os::reserve_memory_special(size_t bytes, size_t alignment, char* req_addr, bool exec) {
    1.70 +  fatal("This code is not used or maintained.");
    1.71 +
    1.72    // "exec" is passed in but not used.  Creating the shared image for
    1.73    // the code cache doesn't have an SHM_X executable permission to check.
    1.74    assert(UseLargePages && UseSHM, "only for SHM large pages");
    1.75 @@ -3229,11 +3243,15 @@
    1.76      // and if UserSignalHandler is installed all bets are off
    1.77      if (CheckJNICalls) {
    1.78        if (libjsig_is_loaded) {
    1.79 -        tty->print_cr("Info: libjsig is activated, all active signal checking is disabled");
    1.80 +        if (PrintJNIResolving) {
    1.81 +          tty->print_cr("Info: libjsig is activated, all active signal checking is disabled");
    1.82 +        }
    1.83          check_signals = false;
    1.84        }
    1.85        if (AllowUserSignalHandlers) {
    1.86 -        tty->print_cr("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled");
    1.87 +        if (PrintJNIResolving) {
    1.88 +          tty->print_cr("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled");
    1.89 +        }
    1.90          check_signals = false;
    1.91        }
    1.92      }
    1.93 @@ -4692,3 +4710,8 @@
    1.94    return n;
    1.95  }
    1.96  
    1.97 +#ifndef PRODUCT
    1.98 +void TestReserveMemorySpecial_test() {
    1.99 +  // No tests available for this platform
   1.100 +}
   1.101 +#endif

mercurial