Mercurial > hg > truffle
comparison src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp @ 13031:9ebaac78a8a0 jdk8-b115
Merge
author | amurillo |
---|---|
date | Tue, 05 Nov 2013 14:06:23 -0800 |
parents | d70a665e25d7 |
children | de6a9e811145 |
comparison
equal
deleted
inserted
replaced
13030:205834867346 | 13031:9ebaac78a8a0 |
---|---|
75 # include <ucontext.h> | 75 # include <ucontext.h> |
76 #endif | 76 #endif |
77 | 77 |
78 #if !defined(__APPLE__) && !defined(__NetBSD__) | 78 #if !defined(__APPLE__) && !defined(__NetBSD__) |
79 # include <pthread_np.h> | 79 # include <pthread_np.h> |
80 #endif | |
81 | |
82 // needed by current_stack_region() workaround for Mavericks | |
83 #if defined(__APPLE__) | |
84 # include <errno.h> | |
85 # include <sys/types.h> | |
86 # include <sys/sysctl.h> | |
87 # define DEFAULT_MAIN_THREAD_STACK_PAGES 2048 | |
88 # define OS_X_10_9_0_KERNEL_MAJOR_VERSION 13 | |
80 #endif | 89 #endif |
81 | 90 |
82 #ifdef AMD64 | 91 #ifdef AMD64 |
83 #define SPELL_REG_SP "rsp" | 92 #define SPELL_REG_SP "rsp" |
84 #define SPELL_REG_FP "rbp" | 93 #define SPELL_REG_FP "rbp" |
826 static void current_stack_region(address * bottom, size_t * size) { | 835 static void current_stack_region(address * bottom, size_t * size) { |
827 #ifdef __APPLE__ | 836 #ifdef __APPLE__ |
828 pthread_t self = pthread_self(); | 837 pthread_t self = pthread_self(); |
829 void *stacktop = pthread_get_stackaddr_np(self); | 838 void *stacktop = pthread_get_stackaddr_np(self); |
830 *size = pthread_get_stacksize_np(self); | 839 *size = pthread_get_stacksize_np(self); |
840 // workaround for OS X 10.9.0 (Mavericks) | |
841 // pthread_get_stacksize_np returns 128 pages even though the actual size is 2048 pages | |
842 if (pthread_main_np() == 1) { | |
843 if ((*size) < (DEFAULT_MAIN_THREAD_STACK_PAGES * (size_t)getpagesize())) { | |
844 char kern_osrelease[256]; | |
845 size_t kern_osrelease_size = sizeof(kern_osrelease); | |
846 int ret = sysctlbyname("kern.osrelease", kern_osrelease, &kern_osrelease_size, NULL, 0); | |
847 if (ret == 0) { | |
848 // get the major number, atoi will ignore the minor amd micro portions of the version string | |
849 if (atoi(kern_osrelease) >= OS_X_10_9_0_KERNEL_MAJOR_VERSION) { | |
850 *size = (DEFAULT_MAIN_THREAD_STACK_PAGES*getpagesize()); | |
851 } | |
852 } | |
853 } | |
854 } | |
831 *bottom = (address) stacktop - *size; | 855 *bottom = (address) stacktop - *size; |
832 #elif defined(__OpenBSD__) | 856 #elif defined(__OpenBSD__) |
833 stack_t ss; | 857 stack_t ss; |
834 int rslt = pthread_stackseg_np(pthread_self(), &ss); | 858 int rslt = pthread_stackseg_np(pthread_self(), &ss); |
835 | 859 |