< prev index next >
src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp
Print this page
rev 12346 : 8169373: Work around linux NPTL stack guard error.
Summary: Also skip libc guard page for compiler thread, merge similar code on linux platforms, and streamline libc guard page handling on linuxs390, linuxppc, aixppc.
Reviewed-by: dholmes, dcubed
*** 154,208 ****
address os::current_stack_pointer() {
register void *sp __asm__ ("sp");
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,
// if the CPU splits constants across multiple instructions).
// On SPARC, 0 != %hi(any real address), because there is no
--- 154,163 ----
*** 735,750 ****
// default stack size (compiler thread needs larger stack)
size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
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() {
}
#endif
--- 690,699 ----
< prev index next >