# HG changeset patch # User tonyp # Date 1283191093 25200 # Node ID f208bf19192da540dbb62c198f935661353e5651 # Parent 75107ee8712ff20a76c50bfefee8f15d0be8ee01# Parent 8397081c7ac15b952d289e1ef9a6f475f47c0e9f Merge diff -r 75107ee8712f -r f208bf19192d src/os/linux/vm/os_linux.cpp --- a/src/os/linux/vm/os_linux.cpp Mon Aug 30 13:00:51 2010 -0400 +++ b/src/os/linux/vm/os_linux.cpp Mon Aug 30 10:58:13 2010 -0700 @@ -2597,10 +2597,14 @@ // where we're going to put our guard pages, truncate the mapping at // that point by munmap()ping it. This ensures that when we later // munmap() the guard pages we don't leave a hole in the stack -// mapping. +// mapping. This only affects the main/initial thread, but guard +// against future OS changes bool os::create_stack_guard_pages(char* addr, size_t size) { uintptr_t stack_extent, stack_base; - if (get_stack_bounds(&stack_extent, &stack_base)) { + bool chk_bounds = NOT_DEBUG(os::Linux::is_initial_thread()) DEBUG_ONLY(true); + if (chk_bounds && get_stack_bounds(&stack_extent, &stack_base)) { + assert(os::Linux::is_initial_thread(), + "growable stack in non-initial thread"); if (stack_extent < (uintptr_t)addr) ::munmap((void*)stack_extent, (uintptr_t)addr - stack_extent); } @@ -2609,10 +2613,15 @@ } // If this is a growable mapping, remove the guard pages entirely by -// munmap()ping them. If not, just call uncommit_memory(). +// munmap()ping them. If not, just call uncommit_memory(). This only +// affects the main/initial thread, but guard against future OS changes bool os::remove_stack_guard_pages(char* addr, size_t size) { uintptr_t stack_extent, stack_base; - if (get_stack_bounds(&stack_extent, &stack_base)) { + bool chk_bounds = NOT_DEBUG(os::Linux::is_initial_thread()) DEBUG_ONLY(true); + if (chk_bounds && get_stack_bounds(&stack_extent, &stack_base)) { + assert(os::Linux::is_initial_thread(), + "growable stack in non-initial thread"); + return ::munmap(addr, size) == 0; } diff -r 75107ee8712f -r f208bf19192d src/share/vm/oops/instanceKlass.cpp --- a/src/share/vm/oops/instanceKlass.cpp Mon Aug 30 13:00:51 2010 -0400 +++ b/src/share/vm/oops/instanceKlass.cpp Mon Aug 30 10:58:13 2010 -0700 @@ -382,7 +382,7 @@ const char* desc = "Could not initialize class "; const char* className = this_oop->external_name(); size_t msglen = strlen(desc) + strlen(className) + 1; - char* message = NEW_C_HEAP_ARRAY(char, msglen); + char* message = NEW_RESOURCE_ARRAY(char, msglen); if (NULL == message) { // Out of memory: can't create detailed error message THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), className);