1 /* |
1 /* |
2 * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright (c) 2012, 2015 SAP SE. All rights reserved. |
3 * Copyright (c) 2012, 2016 SAP SE. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or modify it |
6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as |
7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. |
8 * published by the Free Software Foundation. |
790 } |
790 } |
791 |
791 |
792 const pthread_t pthread_id = ::pthread_self(); |
792 const pthread_t pthread_id = ::pthread_self(); |
793 const tid_t kernel_thread_id = ::thread_self(); |
793 const tid_t kernel_thread_id = ::thread_self(); |
794 |
794 |
795 log_info(os, thread)("Thread is alive (pthread id " UINTX_FORMAT ", tid " UINTX_FORMAT ")", |
795 log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT ").", |
796 (uintx) pthread_id, (uintx) kernel_thread_id); |
796 os::current_thread_id(), (uintx) kernel_thread_id); |
797 |
797 |
798 // Normally, pthread stacks on AIX live in the data segment (are allocated with malloc() |
798 // Normally, pthread stacks on AIX live in the data segment (are allocated with malloc() |
799 // by the pthread library). In rare cases, this may not be the case, e.g. when third-party |
799 // by the pthread library). In rare cases, this may not be the case, e.g. when third-party |
800 // tools hook pthread_create(). In this case, we may run into problems establishing |
800 // tools hook pthread_create(). In this case, we may run into problems establishing |
801 // guard pages on those stacks, because the stacks may reside in memory which is not |
801 // guard pages on those stacks, because the stacks may reside in memory which is not |
802 // protectable (shmated). |
802 // protectable (shmated). |
803 if (thread->stack_base() > ::sbrk(0)) { |
803 if (thread->stack_base() > ::sbrk(0)) { |
804 log_warning(os, thread)("Thread " UINTX_FORMAT ": stack not in data segment.", (uintx)pthread_id); |
804 log_warning(os, thread)("Thread stack not in data segment."); |
805 } |
805 } |
806 |
806 |
807 // Try to randomize the cache line index of hot stack frames. |
807 // Try to randomize the cache line index of hot stack frames. |
808 // This helps when threads of the same stack traces evict each other's |
808 // This helps when threads of the same stack traces evict each other's |
809 // cache lines. The threads can be either from the same JVM instance, or |
809 // cache lines. The threads can be either from the same JVM instance, or |
833 assert(osthread->get_state() == RUNNABLE, "invalid os thread state"); |
833 assert(osthread->get_state() == RUNNABLE, "invalid os thread state"); |
834 |
834 |
835 // Call one more level start routine. |
835 // Call one more level start routine. |
836 thread->run(); |
836 thread->run(); |
837 |
837 |
838 log_info(os, thread)("Thread finished (pthread id " UINTX_FORMAT ", tid " UINTX_FORMAT ").", |
838 log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT ").", |
839 (uintx) pthread_id, (uintx) kernel_thread_id); |
839 os::current_thread_id(), (uintx) kernel_thread_id); |
840 |
840 |
841 return 0; |
841 return 0; |
842 } |
842 } |
843 |
843 |
844 bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { |
844 bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { |
976 |
976 |
977 // initialize signal mask for this thread |
977 // initialize signal mask for this thread |
978 // and save the caller's signal mask |
978 // and save the caller's signal mask |
979 os::Aix::hotspot_sigmask(thread); |
979 os::Aix::hotspot_sigmask(thread); |
980 |
980 |
981 log_info(os, thread)("Thread attached (pthread id " UINTX_FORMAT ", tid " UINTX_FORMAT ")", |
981 log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT ").", |
982 (uintx) pthread_id, (uintx) kernel_thread_id); |
982 os::current_thread_id(), (uintx) kernel_thread_id); |
983 |
983 |
984 return true; |
984 return true; |
985 } |
985 } |
986 |
986 |
987 void os::pd_start_thread(Thread* thread) { |
987 void os::pd_start_thread(Thread* thread) { |