--- old/src/cpu/x86/vm/globals_x86.hpp 2016-09-02 10:54:51.868898372 -0400 +++ new/src/cpu/x86/vm/globals_x86.hpp 2016-09-02 10:54:50.968893909 -0400 @@ -65,10 +65,10 @@ #ifdef AMD64 // Very large C++ stack frames using solaris-amd64 optimized builds // due to lack of optimization caused by C++ compiler bugs -#define DEFAULT_STACK_SHADOW_PAGES (NOT_WIN64(20) WIN64_ONLY(6) DEBUG_ONLY(+2)) +#define DEFAULT_STACK_SHADOW_PAGES (NOT_WIN64(20) WIN64_ONLY(7) DEBUG_ONLY(+2)) // For those clients that do not use write socket, we allow // the min range value to be below that of the default -#define MIN_STACK_SHADOW_PAGES (NOT_WIN64(10) WIN64_ONLY(6) DEBUG_ONLY(+2)) +#define MIN_STACK_SHADOW_PAGES (NOT_WIN64(10) WIN64_ONLY(7) DEBUG_ONLY(+2)) #else #define DEFAULT_STACK_SHADOW_PAGES (4 DEBUG_ONLY(+5)) #define MIN_STACK_SHADOW_PAGES DEFAULT_STACK_SHADOW_PAGES --- old/src/os/windows/vm/os_windows.cpp 2016-09-02 10:54:55.176914775 -0400 +++ new/src/os/windows/vm/os_windows.cpp 2016-09-02 10:54:54.268910273 -0400 @@ -2504,13 +2504,15 @@ // It write enables the page immediately after protecting it // so just return. if (exception_code == EXCEPTION_ACCESS_VIOLATION) { - JavaThread* thread = (JavaThread*) t; - PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord; - address addr = (address) exceptionRecord->ExceptionInformation[1]; - if (os::is_memory_serialize_page(thread, addr)) { - // Block current thread until the memory serialize page permission restored. - os::block_on_serialize_page_trap(); - return EXCEPTION_CONTINUE_EXECUTION; + if(t != NULL && t->is_Java_thread()) { + JavaThread* thread = (JavaThread*) t; + PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord; + address addr = (address) exceptionRecord->ExceptionInformation[1]; + if (os::is_memory_serialize_page(thread, addr)) { + // Block current thread until the memory serialize page permission restored. + os::block_on_serialize_page_trap(); + return EXCEPTION_CONTINUE_EXECUTION; + } } } @@ -2564,7 +2566,7 @@ } #endif if (thread->stack_guards_enabled()) { - if (_thread_in_Java) { + if (in_java) { frame fr; PEXCEPTION_RECORD exceptionRecord = exceptionInfo->ExceptionRecord; address addr = (address) exceptionRecord->ExceptionInformation[1]; @@ -2576,6 +2578,7 @@ // Yellow zone violation. The o/s has unprotected the first yellow // zone page for us. Note: must call disable_stack_yellow_zone to // update the enabled status, even if the zone contains only one page. + assert(thread->thread_state() != _thread_in_vm, "Undersized StackShadowPages"); thread->disable_stack_yellow_reserved_zone(); // If not in java code, return and hope for the best. return in_java --- old/src/share/vm/runtime/interfaceSupport.hpp 2016-09-02 10:54:57.992928739 -0400 +++ new/src/share/vm/runtime/interfaceSupport.hpp 2016-09-02 10:54:57.096924296 -0400 @@ -219,6 +219,9 @@ trans_from_java(_thread_in_vm); } ~ThreadInVMfromJava() { + if (_thread->stack_yellow_reserved_zone_disabled()) { + _thread->enable_stack_yellow_reserved_zone(); + } trans(_thread_in_vm, _thread_in_Java); // Check for pending. async. exceptions or suspends. if (_thread->has_special_runtime_exit_condition()) _thread->handle_special_runtime_exit_condition(); @@ -314,6 +317,9 @@ // to the _thread_in_vm state. Instead we postpone the handling of // the async exception. + if (_thread->stack_yellow_reserved_zone_disabled()) { + _thread->enable_stack_yellow_reserved_zone(); + } // Check for pending. suspends only. if (_thread->has_special_runtime_exit_condition()) _thread->handle_special_runtime_exit_condition(false);