1.1 --- a/src/share/vm/runtime/deoptimization.cpp Tue Jan 07 16:02:10 2014 +0100 1.2 +++ b/src/share/vm/runtime/deoptimization.cpp Wed Jan 08 09:49:31 2014 +0100 1.3 @@ -1224,9 +1224,19 @@ 1.4 load_class_by_index(constant_pool, index, THREAD); 1.5 if (HAS_PENDING_EXCEPTION) { 1.6 // Exception happened during classloading. We ignore the exception here, since it 1.7 - // is going to be rethrown since the current activation is going to be deoptimzied and 1.8 + // is going to be rethrown since the current activation is going to be deoptimized and 1.9 // the interpreter will re-execute the bytecode. 1.10 CLEAR_PENDING_EXCEPTION; 1.11 + // Class loading called java code which may have caused a stack 1.12 + // overflow. If the exception was thrown right before the return 1.13 + // to the runtime the stack is no longer guarded. Reguard the 1.14 + // stack otherwise if we return to the uncommon trap blob and the 1.15 + // stack bang causes a stack overflow we crash. 1.16 + assert(THREAD->is_Java_thread(), "only a java thread can be here"); 1.17 + JavaThread* thread = (JavaThread*)THREAD; 1.18 + bool guard_pages_enabled = thread->stack_yellow_zone_enabled(); 1.19 + if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack(); 1.20 + assert(guard_pages_enabled, "stack banging in uncommon trap blob may cause crash"); 1.21 } 1.22 } 1.23