# HG changeset patch # User goetz # Date 1478619036 -3600 # Node ID 6d0778be46e55de100e8b4cbc9a97496f4882703 # Parent a67614dce6cda463f03093ffa5aaf08f14230e57 8169373: Work around linux NPTL stack guard error. Summary: Also skip OS guard page for compiler thread, merge similar code on linux platforms, and streamline OS guard page handling on linuxs390, linuxppc, aixppc. Reviewed-by: dholmes diff --git a/src/os/aix/vm/os_aix.cpp b/src/os/aix/vm/os_aix.cpp --- a/src/os/aix/vm/os_aix.cpp +++ b/src/os/aix/vm/os_aix.cpp @@ -852,13 +852,13 @@ assert(thread->osthread() == NULL, "caller responsible"); - // Allocate the OSThread object + // Allocate the OSThread object. OSThread* osthread = new OSThread(NULL, NULL); if (osthread == NULL) { return false; } - // set the correct thread state + // Set the correct thread state. osthread->set_thread_type(thr_type); // Initial state is ALLOCATED but not INITIALIZED @@ -866,7 +866,7 @@ thread->set_osthread(osthread); - // init thread attributes + // Init thread attributes. pthread_attr_t attr; pthread_attr_init(&attr); guarantee(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) == 0, "???"); @@ -875,15 +875,18 @@ if (os::Aix::on_aix()) { guarantee(pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM) == 0, "???"); guarantee(pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED) == 0, "???"); - } // end: aix + } // Start in suspended state, and in os::thread_start, wake the thread up. guarantee(pthread_attr_setsuspendstate_np(&attr, PTHREAD_CREATE_SUSPENDED_NP) == 0, "???"); - // calculate stack size if it's not specified by caller + // Calculate stack size if it's not specified by caller. size_t stack_size = os::Posix::get_initial_stack_size(thr_type, req_stack_size); pthread_attr_setstacksize(&attr, stack_size); + // libc guard page + pthread_attr_setguardsize(&attr, os::Aix::default_guard_size(thr_type)); + pthread_t tid; int ret = pthread_create(&tid, &attr, (void* (*)(void*)) thread_native_entry, thread); @@ -899,7 +902,7 @@ pthread_attr_destroy(&attr); if (ret != 0) { - // Need to clean up stuff we've allocated so far + // Need to clean up stuff we've allocated so far. thread->set_osthread(NULL); delete osthread; return false; @@ -3036,6 +3039,18 @@ return chained; } +size_t os::Aix::default_guard_size(os::ThreadType thr_type) { + // Creating guard pages is very expensive. Java thread has HotSpot + // guard pages, so only enable libc guard pages for non-Java threads. + // + // Aix can have different page sizes for stack (4K) and heap (64K). + // As Hotspot knows only one page size, we assume the stack has + // the same page size as the heap. Returning page_size() here can + // cause 16 guard pages which we want to avoid. Thus we return 4K + // which will be rounded to the real page size by the OS. + return ((thr_type == java_thread || thr_type == compiler_thread) ? 0 : 4*K); +} + struct sigaction* os::Aix::get_preinstalled_handler(int sig) { if (sigismember(&sigs, sig)) { return &sigact[sig]; diff --git a/src/os/aix/vm/os_aix.hpp b/src/os/aix/vm/os_aix.hpp --- a/src/os/aix/vm/os_aix.hpp +++ b/src/os/aix/vm/os_aix.hpp @@ -140,6 +140,9 @@ // libpthread version string static void libpthread_init(); + // Return default OS guard size for the specified thread type. + static size_t default_guard_size(os::ThreadType thr_type); + // Function returns true if we run on OS/400 (pase), false if we run // on AIX. static bool on_pase() { diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp --- a/src/os/linux/vm/os_linux.cpp +++ b/src/os/linux/vm/os_linux.cpp @@ -723,8 +723,15 @@ pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - // calculate stack size if it's not specified by caller + // Calculate stack size if it's not specified by caller. size_t stack_size = os::Posix::get_initial_stack_size(thr_type, req_stack_size); + // In the Linux NPTL pthread implementation the guard size mechanism + // is not implemented properly. The posix standard requires to add + // the size of the guard pages to the stack size, instead Linux + // takes the space out of 'stacksize'. Thus we adapt the requested + // stack_size by the size of the guard pages to mimick proper + // behaviour. + stack_size = align_size_up(stack_size + os::Linux::default_guard_size(thr_type), vm_page_size()); pthread_attr_setstacksize(&attr, stack_size); // glibc guard page @@ -2840,6 +2847,13 @@ return false; } +size_t os::Linux::default_guard_size(os::ThreadType thr_type) { + // Creating guard page is very expensive. Java thread has HotSpot + // guard page, only enable glibc guard page for non-Java threads. + // (Remember: compiler thread is a java thread, too!) + return ((thr_type == java_thread || thr_type == compiler_thread) ? 0 : page_size()); +} + // rebuild_cpu_to_node_map() constructs a table mapping cpud id to node id. // The table is later used in get_node_by_cpu(). void os::Linux::rebuild_cpu_to_node_map() { @@ -6072,6 +6086,100 @@ return yes; } + +// Java/Compiler thread: +// +// Low memory addresses +// P0 +------------------------+ +// | |\ JavaThread created by VM does not have glibc +// | glibc guard page | - guard, attached Java thread usually has +// | |/ 1 page glibc guard. +// P1 +------------------------+ Thread::stack_base() - Thread::stack_size() +// | |\ +// | HotSpot Guard Pages | - red and yellow pages +// | |/ +// +------------------------+ JavaThread::stack_yellow_zone_base() +// | |\ +// | Normal Stack | - +// | |/ +// P2 +------------------------+ Thread::stack_base() +// +// Non-Java thread: +// +// Low memory addresses +// P0 +------------------------+ +// | |\ +// | glibc guard page | - usually 1 page +// | |/ +// P1 +------------------------+ Thread::stack_base() - Thread::stack_size() +// | |\ +// | Normal Stack | - +// | |/ +// P2 +------------------------+ Thread::stack_base() +// +// ** P1 (aka bottom) and size ( P2 = P1 - size) are the address and stack size returned from +// pthread_attr_getstack() +// ** Due to NPTL implementation error, linux takes the OS guard page out +// of the stack size given in pthread_attr. We work around this for +// threads created by the VM (We adapt bottom to be P1 and size accordingly.) +// +#ifndef ZERO +static void current_stack_region(address * bottom, size_t * size) { + if (os::Linux::is_initial_thread()) { + // initial thread needs special handling because pthread_getattr_np() + // may return bogus value. + *bottom = os::Linux::initial_thread_stack_bottom(); + *size = os::Linux::initial_thread_stack_size(); + } else { + pthread_attr_t attr; + + int rslt = pthread_getattr_np(pthread_self(), &attr); + + // JVM needs to know exact stack location, abort if it fails + if (rslt != 0) { + if (rslt == ENOMEM) { + vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); + } else { + fatal("pthread_getattr_np failed with errno = %d", rslt); + } + } + + if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) { + fatal("Can not locate current stack attributes!"); + } + + // Work around NPTL stack guard error. + size_t guard_size = 0; + rslt = pthread_attr_getguardsize(&attr, &guard_size); + if (rslt != 0) { + fatal("pthread_attr_getguardsize failed with errno = %d", rslt); + } + *bottom += guard_size; + *size -= guard_size; + + pthread_attr_destroy(&attr); + + } + assert(os::current_stack_pointer() >= *bottom && + os::current_stack_pointer() < *bottom + *size, "just checking"); +} + +address os::current_stack_base() { + address bottom; + size_t size; + current_stack_region(&bottom, &size); + return (bottom + size); +} + +size_t os::current_stack_size() { + // stack size includes normal stack and HotSpot guard pages + address bottom; + size_t size; + current_stack_region(&bottom, &size); + return size; +} +#endif + static inline struct timespec get_mtime(const char* filename) { struct stat st; int ret = os::stat(filename, &st); diff --git a/src/os/posix/vm/os_posix.cpp b/src/os/posix/vm/os_posix.cpp --- a/src/os/posix/vm/os_posix.cpp +++ b/src/os/posix/vm/os_posix.cpp @@ -1096,6 +1096,8 @@ int detachstate = 0; pthread_attr_getstacksize(attr, &stack_size); pthread_attr_getguardsize(attr, &guard_size); + // Work around linux NPTL implementation error, see also os::create_thread() in os_linux.cpp. + LINUX_ONLY(stack_size -= guard_size); pthread_attr_getdetachstate(attr, &detachstate); jio_snprintf(buf, buflen, "stacksize: " SIZE_FORMAT "k, guardsize: " SIZE_FORMAT "k, %s", stack_size / 1024, guard_size / 1024, diff --git a/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp b/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp --- a/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp +++ b/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp @@ -535,13 +535,15 @@ //////////////////////////////////////////////////////////////////////////////// // thread stack -size_t os::Posix::_compiler_thread_min_stack_allowed = 128 * K; -size_t os::Posix::_java_thread_min_stack_allowed = 128 * K; +// These sizes exclude OS stack guard pages, but include +// the VM guard pages. +size_t os::Posix::_compiler_thread_min_stack_allowed = 512 * K; +size_t os::Posix::_java_thread_min_stack_allowed = 512 * K; size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K; -// return default stack size for thr_type +// Return default stack size for thr_type. size_t os::Posix::default_stack_size(os::ThreadType thr_type) { - // default stack size (compiler thread needs larger stack) + // Default stack size (compiler thread needs larger stack). size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M); return s; } diff --git a/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp b/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp --- a/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp +++ b/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp @@ -484,91 +484,6 @@ return s; } -size_t os::Linux::default_guard_size(os::ThreadType thr_type) { - // Creating guard page is very expensive. Java thread has HotSpot - // guard page, only enable glibc guard page for non-Java threads. - return (thr_type == java_thread ? 0 : page_size()); -} - -// Java thread: -// -// Low memory addresses -// +------------------------+ -// | |\ JavaThread created by VM does not have glibc -// | glibc guard page | - guard, attached Java thread usually has -// | |/ 1 page glibc guard. -// P1 +------------------------+ Thread::stack_base() - Thread::stack_size() -// | |\ -// | HotSpot Guard Pages | - red and yellow pages -// | |/ -// +------------------------+ JavaThread::stack_yellow_zone_base() -// | |\ -// | Normal Stack | - -// | |/ -// P2 +------------------------+ Thread::stack_base() -// -// Non-Java thread: -// -// Low memory addresses -// +------------------------+ -// | |\ -// | glibc guard page | - usually 1 page -// | |/ -// P1 +------------------------+ Thread::stack_base() - Thread::stack_size() -// | |\ -// | Normal Stack | - -// | |/ -// P2 +------------------------+ Thread::stack_base() -// -// ** P1 (aka bottom) and size ( P2 = P1 - size) are the address and stack size returned from -// pthread_attr_getstack() - -static void current_stack_region(address * bottom, size_t * size) { - if (os::Linux::is_initial_thread()) { - // initial thread needs special handling because pthread_getattr_np() - // may return bogus value. - *bottom = os::Linux::initial_thread_stack_bottom(); - *size = os::Linux::initial_thread_stack_size(); - } else { - pthread_attr_t attr; - - int rslt = pthread_getattr_np(pthread_self(), &attr); - - // JVM needs to know exact stack location, abort if it fails - if (rslt != 0) { - if (rslt == ENOMEM) { - vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); - } else { - fatal("pthread_getattr_np failed with errno = %d", rslt); - } - } - - if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) { - fatal("Can not locate current stack attributes!"); - } - - pthread_attr_destroy(&attr); - - } - assert(os::current_stack_pointer() >= *bottom && - os::current_stack_pointer() < *bottom + *size, "just checking"); -} - -address os::current_stack_base() { - address bottom; - size_t size; - current_stack_region(&bottom, &size); - return (bottom + size); -} - -size_t os::current_stack_size() { - // stack size includes normal stack and HotSpot guard pages - address bottom; - size_t size; - current_stack_region(&bottom, &size); - return size; -} - ///////////////////////////////////////////////////////////////////////////// // helper functions for fatal error handler diff --git a/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp b/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp --- a/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp +++ b/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp @@ -535,8 +535,8 @@ //////////////////////////////////////////////////////////////////////////////// // thread stack -size_t os::Posix::_compiler_thread_min_stack_allowed = 128 * K; -size_t os::Posix::_java_thread_min_stack_allowed = 128 * K; +size_t os::Posix::_compiler_thread_min_stack_allowed = 384 * K; +size_t os::Posix::_java_thread_min_stack_allowed = 384 * K; size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K; // return default stack size for thr_type @@ -546,89 +546,6 @@ return s; } -size_t os::Linux::default_guard_size(os::ThreadType thr_type) { - return 2 * page_size(); -} - -// Java thread: -// -// Low memory addresses -// +------------------------+ -// | |\ JavaThread created by VM does not have glibc -// | glibc guard page | - guard, attached Java thread usually has -// | |/ 1 page glibc guard. -// P1 +------------------------+ Thread::stack_base() - Thread::stack_size() -// | |\ -// | HotSpot Guard Pages | - red and yellow pages -// | |/ -// +------------------------+ JavaThread::stack_yellow_zone_base() -// | |\ -// | Normal Stack | - -// | |/ -// P2 +------------------------+ Thread::stack_base() -// -// Non-Java thread: -// -// Low memory addresses -// +------------------------+ -// | |\ -// | glibc guard page | - usually 1 page -// | |/ -// P1 +------------------------+ Thread::stack_base() - Thread::stack_size() -// | |\ -// | Normal Stack | - -// | |/ -// P2 +------------------------+ Thread::stack_base() -// -// ** P1 (aka bottom) and size ( P2 = P1 - size) are the address and stack size returned from -// pthread_attr_getstack() - -static void current_stack_region(address * bottom, size_t * size) { - if (os::Linux::is_initial_thread()) { - // initial thread needs special handling because pthread_getattr_np() - // may return bogus value. - *bottom = os::Linux::initial_thread_stack_bottom(); - *size = os::Linux::initial_thread_stack_size(); - } else { - pthread_attr_t attr; - - int rslt = pthread_getattr_np(pthread_self(), &attr); - - // JVM needs to know exact stack location, abort if it fails - if (rslt != 0) { - if (rslt == ENOMEM) { - vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); - } else { - fatal("pthread_getattr_np failed with errno = %d", rslt); - } - } - - if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) { - fatal("Can not locate current stack attributes!"); - } - - pthread_attr_destroy(&attr); - - } - assert(os::current_stack_pointer() >= *bottom && - os::current_stack_pointer() < *bottom + *size, "just checking"); -} - -address os::current_stack_base() { - address bottom; - size_t size; - current_stack_region(&bottom, &size); - return (bottom + size); -} - -size_t os::current_stack_size() { - // stack size includes normal stack and HotSpot guard pages - address bottom; - size_t size; - current_stack_region(&bottom, &size); - return size; -} - ///////////////////////////////////////////////////////////////////////////// // helper functions for fatal error handler diff --git a/src/os_cpu/linux_s390/vm/os_linux_s390.cpp b/src/os_cpu/linux_s390/vm/os_linux_s390.cpp --- a/src/os_cpu/linux_s390/vm/os_linux_s390.cpp +++ b/src/os_cpu/linux_s390/vm/os_linux_s390.cpp @@ -473,103 +473,19 @@ //////////////////////////////////////////////////////////////////////////////// // thread stack +// These sizes exclude OS stack guard pages, but include +// the VM guard pages. size_t os::Posix::_compiler_thread_min_stack_allowed = 128 * K; -size_t os::Posix::_java_thread_min_stack_allowed = 128 * K; +size_t os::Posix::_java_thread_min_stack_allowed = 236 * K; size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K; -// return default stack size for thr_type +// Return default stack size for thr_type. size_t os::Posix::default_stack_size(os::ThreadType thr_type) { - // default stack size (compiler thread needs larger stack) + // Default stack size (compiler thread needs larger stack). size_t s = (thr_type == os::compiler_thread ? 4 * M : 1024 * K); return s; } -size_t os::Linux::default_guard_size(os::ThreadType thr_type) { - // z/Architecture: put 2 guard pages right in the middle of thread stack. This value - // should be consistent with the value used by register stack handling code. - return 2 * page_size(); -} - -// Java thread: -// -// Low memory addresses -// +------------------------+ -// | |\ -// | glibc guard page | - Right in the middle of stack, 2 pages -// | |/ -// P1 +------------------------+ Thread::stack_base() - Thread::stack_size() -// | |\ -// | HotSpot Guard Pages | - red and yellow pages -// | |/ -// +------------------------+ JavaThread::stack_yellow_zone_base() -// | |\ -// | Normal Stack | - -// | |/ -// P2 +------------------------+ Thread::stack_base() -// -// Non-Java thread: -// -// Low memory addresses -// +------------------------+ -// | |\ -// | glibc guard page | - Right in the middle of stack, 2 pages -// | |/ -// P1 +------------------------+ Thread::stack_base() - Thread::stack_size() -// | |\ -// | Normal Stack | - -// | |/ -// P2 +------------------------+ Thread::stack_base() -// -// ** P2 is the address returned from pthread_attr_getstackaddr(), P2 - P1 -// is the stack size returned by pthread_attr_getstacksize(). - - -static void current_stack_region(address * bottom, size_t * size) { - if (os::Linux::is_initial_thread()) { - // Initial thread needs special handling because pthread_getattr_np() - // may return bogus value. - *bottom = os::Linux::initial_thread_stack_bottom(); - *size = os::Linux::initial_thread_stack_size(); - } else { - pthread_attr_t attr; - - int rslt = pthread_getattr_np(pthread_self(), &attr); - - // JVM needs to know exact stack location, abort if it fails - if (rslt != 0) { - if (rslt == ENOMEM) { - vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); - } else { - fatal("pthread_getattr_np failed with errno = %d", rslt); - } - } - - if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) { - fatal("Can not locate current stack attributes!"); - } - - pthread_attr_destroy(&attr); - - } - assert(os::current_stack_pointer() >= *bottom && - os::current_stack_pointer() < *bottom + *size, "just checking"); -} - -address os::current_stack_base() { - address bottom; - size_t size; - current_stack_region(&bottom, &size); - return (bottom + size); -} - -size_t os::current_stack_size() { - // stack size includes normal stack and HotSpot guard pages - address bottom; - size_t size; - current_stack_region(&bottom, &size); - return size; -} - ///////////////////////////////////////////////////////////////////////////// // helper functions for fatal error handler diff --git a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp --- a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp +++ b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp @@ -156,51 +156,6 @@ return (address)sp; } -static void current_stack_region(address* bottom, size_t* size) { - if (os::Linux::is_initial_thread()) { - // initial thread needs special handling because pthread_getattr_np() - // may return bogus value. - *bottom = os::Linux::initial_thread_stack_bottom(); - *size = os::Linux::initial_thread_stack_size(); - } else { - pthread_attr_t attr; - - int rslt = pthread_getattr_np(pthread_self(), &attr); - - // JVM needs to know exact stack location, abort if it fails - if (rslt != 0) { - if (rslt == ENOMEM) { - vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); - } else { - fatal("pthread_getattr_np failed with errno = %d", rslt); - } - } - - if (pthread_attr_getstack(&attr, (void**)bottom, size) != 0) { - fatal("Can not locate current stack attributes!"); - } - - pthread_attr_destroy(&attr); - } - assert(os::current_stack_pointer() >= *bottom && - os::current_stack_pointer() < *bottom + *size, "just checking"); -} - -address os::current_stack_base() { - address bottom; - size_t size; - current_stack_region(&bottom, &size); - return bottom + size; -} - -size_t os::current_stack_size() { - // stack size includes normal stack and HotSpot guard pages - address bottom; - size_t size; - current_stack_region(&bottom, &size); - return size; -} - char* os::non_memory_address_word() { // Must never look like an address returned by reserve_memory, // even in its subfields (as defined by the CPU immediate fields, @@ -737,12 +692,6 @@ return s; } -size_t os::Linux::default_guard_size(os::ThreadType thr_type) { - // Creating guard page is very expensive. Java thread has HotSpot - // guard page, only enable glibc guard page for non-Java threads. - return (thr_type == java_thread ? 0 : page_size()); -} - #ifndef PRODUCT void os::verify_stack_alignment() { } diff --git a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp --- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp @@ -698,91 +698,6 @@ return s; } -size_t os::Linux::default_guard_size(os::ThreadType thr_type) { - // Creating guard page is very expensive. Java thread has HotSpot - // guard page, only enable glibc guard page for non-Java threads. - return (thr_type == java_thread ? 0 : page_size()); -} - -// Java thread: -// -// Low memory addresses -// +------------------------+ -// | |\ JavaThread created by VM does not have glibc -// | glibc guard page | - guard, attached Java thread usually has -// | |/ 1 page glibc guard. -// P1 +------------------------+ Thread::stack_base() - Thread::stack_size() -// | |\ -// | HotSpot Guard Pages | - red and yellow pages -// | |/ -// +------------------------+ JavaThread::stack_yellow_zone_base() -// | |\ -// | Normal Stack | - -// | |/ -// P2 +------------------------+ Thread::stack_base() -// -// Non-Java thread: -// -// Low memory addresses -// +------------------------+ -// | |\ -// | glibc guard page | - usually 1 page -// | |/ -// P1 +------------------------+ Thread::stack_base() - Thread::stack_size() -// | |\ -// | Normal Stack | - -// | |/ -// P2 +------------------------+ Thread::stack_base() -// -// ** P1 (aka bottom) and size ( P2 = P1 - size) are the address and stack size returned from -// pthread_attr_getstack() - -static void current_stack_region(address * bottom, size_t * size) { - if (os::Linux::is_initial_thread()) { - // initial thread needs special handling because pthread_getattr_np() - // may return bogus value. - *bottom = os::Linux::initial_thread_stack_bottom(); - *size = os::Linux::initial_thread_stack_size(); - } else { - pthread_attr_t attr; - - int rslt = pthread_getattr_np(pthread_self(), &attr); - - // JVM needs to know exact stack location, abort if it fails - if (rslt != 0) { - if (rslt == ENOMEM) { - vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); - } else { - fatal("pthread_getattr_np failed with errno = %d", rslt); - } - } - - if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) { - fatal("Can not locate current stack attributes!"); - } - - pthread_attr_destroy(&attr); - - } - assert(os::current_stack_pointer() >= *bottom && - os::current_stack_pointer() < *bottom + *size, "just checking"); -} - -address os::current_stack_base() { - address bottom; - size_t size; - current_stack_region(&bottom, &size); - return (bottom + size); -} - -size_t os::current_stack_size() { - // stack size includes normal stack and HotSpot guard pages - address bottom; - size_t size; - current_stack_region(&bottom, &size); - return size; -} - ///////////////////////////////////////////////////////////////////////////// // helper functions for fatal error handler diff --git a/src/os_cpu/linux_zero/vm/os_linux_zero.cpp b/src/os_cpu/linux_zero/vm/os_linux_zero.cpp --- a/src/os_cpu/linux_zero/vm/os_linux_zero.cpp +++ b/src/os_cpu/linux_zero/vm/os_linux_zero.cpp @@ -320,12 +320,6 @@ return s; } -size_t os::Linux::default_guard_size(os::ThreadType thr_type) { - // Only enable glibc guard pages for non-Java threads - // (Java threads have HotSpot guard pages) - return (thr_type == java_thread ? 0 : page_size()); -} - static void current_stack_region(address *bottom, size_t *size) { pthread_attr_t attr; int res = pthread_getattr_np(pthread_self(), &attr);