hotspot/src/share/vm/runtime/sharedRuntime.cpp
changeset 22241 58579a498f3a
parent 22223 82e95c562133
child 22247 cde20a0fa906
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Tue Jan 07 14:26:12 2014 -0800
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed Jan 08 09:49:31 2014 +0100
@@ -494,6 +494,13 @@
     assert(!nm->is_native_method(), "no exception handler");
     assert(nm->header_begin() != nm->exception_begin(), "no exception handler");
     if (nm->is_deopt_pc(return_address)) {
+      // If we come here because of a stack overflow, the stack may be
+      // unguarded. Reguard the stack otherwise if we return to the
+      // deopt blob and the stack bang causes a stack overflow we
+      // crash.
+      bool guard_pages_enabled = thread->stack_yellow_zone_enabled();
+      if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack();
+      assert(guard_pages_enabled, "stack banging in deopt blob may cause crash");
       return SharedRuntime::deopt_blob()->unpack_with_exception();
     } else {
       return nm->exception_begin();