Fri, 27 Aug 2010 21:31:15 -0700
Merge
1.1 --- a/src/os/linux/vm/os_linux.cpp Wed Aug 25 10:31:45 2010 -0700 1.2 +++ b/src/os/linux/vm/os_linux.cpp Fri Aug 27 21:31:15 2010 -0700 1.3 @@ -2597,10 +2597,14 @@ 1.4 // where we're going to put our guard pages, truncate the mapping at 1.5 // that point by munmap()ping it. This ensures that when we later 1.6 // munmap() the guard pages we don't leave a hole in the stack 1.7 -// mapping. 1.8 +// mapping. This only affects the main/initial thread, but guard 1.9 +// against future OS changes 1.10 bool os::create_stack_guard_pages(char* addr, size_t size) { 1.11 uintptr_t stack_extent, stack_base; 1.12 - if (get_stack_bounds(&stack_extent, &stack_base)) { 1.13 + bool chk_bounds = NOT_DEBUG(os::Linux::is_initial_thread()) DEBUG_ONLY(true); 1.14 + if (chk_bounds && get_stack_bounds(&stack_extent, &stack_base)) { 1.15 + assert(os::Linux::is_initial_thread(), 1.16 + "growable stack in non-initial thread"); 1.17 if (stack_extent < (uintptr_t)addr) 1.18 ::munmap((void*)stack_extent, (uintptr_t)addr - stack_extent); 1.19 } 1.20 @@ -2609,10 +2613,15 @@ 1.21 } 1.22 1.23 // If this is a growable mapping, remove the guard pages entirely by 1.24 -// munmap()ping them. If not, just call uncommit_memory(). 1.25 +// munmap()ping them. If not, just call uncommit_memory(). This only 1.26 +// affects the main/initial thread, but guard against future OS changes 1.27 bool os::remove_stack_guard_pages(char* addr, size_t size) { 1.28 uintptr_t stack_extent, stack_base; 1.29 - if (get_stack_bounds(&stack_extent, &stack_base)) { 1.30 + bool chk_bounds = NOT_DEBUG(os::Linux::is_initial_thread()) DEBUG_ONLY(true); 1.31 + if (chk_bounds && get_stack_bounds(&stack_extent, &stack_base)) { 1.32 + assert(os::Linux::is_initial_thread(), 1.33 + "growable stack in non-initial thread"); 1.34 + 1.35 return ::munmap(addr, size) == 0; 1.36 } 1.37
2.1 --- a/src/share/vm/oops/instanceKlass.cpp Wed Aug 25 10:31:45 2010 -0700 2.2 +++ b/src/share/vm/oops/instanceKlass.cpp Fri Aug 27 21:31:15 2010 -0700 2.3 @@ -382,7 +382,7 @@ 2.4 const char* desc = "Could not initialize class "; 2.5 const char* className = this_oop->external_name(); 2.6 size_t msglen = strlen(desc) + strlen(className) + 1; 2.7 - char* message = NEW_C_HEAP_ARRAY(char, msglen); 2.8 + char* message = NEW_RESOURCE_ARRAY(char, msglen); 2.9 if (NULL == message) { 2.10 // Out of memory: can't create detailed error message 2.11 THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), className);