src/share/vm/c1/c1_Runtime1.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/c1

src/share/vm/c1/c1_Runtime1.cpp

Print this page
rev 6851 : 8054224: Recursive method that was compiled by C1 is unable to catch StackOverflowError
Summary: do not update exception cache if exception is replaced when thrown
Reviewed-by:


 529     // New exception handling mechanism can support inlined methods
 530     // with exception handlers since the mappings are from PC to PC
 531 
 532     // debugging support
 533     // tracing
 534     if (TraceExceptions) {
 535       ttyLocker ttyl;
 536       ResourceMark rm;
 537       tty->print_cr("Exception <%s> (" INTPTR_FORMAT ") thrown in compiled method <%s> at PC " INTPTR_FORMAT " for thread " INTPTR_FORMAT "",
 538                     exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread));
 539     }
 540     // for AbortVMOnException flag
 541     NOT_PRODUCT(Exceptions::debug_check_abort(exception));
 542 
 543     // Clear out the exception oop and pc since looking up an
 544     // exception handler can cause class loading, which might throw an
 545     // exception and those fields are expected to be clear during
 546     // normal bytecode execution.
 547     thread->clear_exception_oop_and_pc();
 548 


 549     continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false);
 550     // If an exception was thrown during exception dispatch, the exception oop may have changed
 551     thread->set_exception_oop(exception());
 552     thread->set_exception_pc(pc);
 553 
 554     // the exception cache is used only by non-implicit exceptions
 555     if (continuation != NULL) {



 556       nm->add_handler_for_exception_and_pc(exception, pc, continuation);
 557     }
 558   }
 559 
 560   thread->set_vm_result(exception());
 561   // Set flag if return address is a method handle call site.
 562   thread->set_is_method_handle_return(nm->is_method_handle_return(pc));
 563 
 564   if (TraceExceptions) {
 565     ttyLocker ttyl;
 566     ResourceMark rm;
 567     tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT,
 568                   p2i(thread), p2i(continuation), p2i(pc));
 569   }
 570 
 571   return continuation;
 572 JRT_END
 573 
 574 // Enter this method from compiled code only if there is a Java exception handler
 575 // in the method handling the exception.




 529     // New exception handling mechanism can support inlined methods
 530     // with exception handlers since the mappings are from PC to PC
 531 
 532     // debugging support
 533     // tracing
 534     if (TraceExceptions) {
 535       ttyLocker ttyl;
 536       ResourceMark rm;
 537       tty->print_cr("Exception <%s> (" INTPTR_FORMAT ") thrown in compiled method <%s> at PC " INTPTR_FORMAT " for thread " INTPTR_FORMAT "",
 538                     exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread));
 539     }
 540     // for AbortVMOnException flag
 541     NOT_PRODUCT(Exceptions::debug_check_abort(exception));
 542 
 543     // Clear out the exception oop and pc since looking up an
 544     // exception handler can cause class loading, which might throw an
 545     // exception and those fields are expected to be clear during
 546     // normal bytecode execution.
 547     thread->clear_exception_oop_and_pc();
 548 
 549     Handle original_exception(thread, exception());
 550 
 551     continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false);
 552     // If an exception was thrown during exception dispatch, the exception oop may have changed
 553     thread->set_exception_oop(exception());
 554     thread->set_exception_pc(pc);
 555 
 556     // the exception cache is used only by non-implicit exceptions
 557     // Update the exception cache only when there didn't happen
 558     // another exception during the computation of the compiled
 559     // exception handler.
 560     if (continuation != NULL && original_exception() == exception()) {
 561       nm->add_handler_for_exception_and_pc(exception, pc, continuation);
 562     }
 563   }
 564 
 565   thread->set_vm_result(exception());
 566   // Set flag if return address is a method handle call site.
 567   thread->set_is_method_handle_return(nm->is_method_handle_return(pc));
 568 
 569   if (TraceExceptions) {
 570     ttyLocker ttyl;
 571     ResourceMark rm;
 572     tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT,
 573                   p2i(thread), p2i(continuation), p2i(pc));
 574   }
 575 
 576   return continuation;
 577 JRT_END
 578 
 579 // Enter this method from compiled code only if there is a Java exception handler
 580 // in the method handling the exception.


src/share/vm/c1/c1_Runtime1.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File