913 if (nm->is_deopt_pc(pc)) {
914 deopting = true;
915 RegisterMap map(thread, false);
916 frame deoptee = thread->last_frame().sender(&map);
917 assert(deoptee.is_deoptimized_frame(), "must be deopted");
918 // Adjust the pc back to the original throwing pc
919 pc = deoptee.pc();
920 }
921
922 // If we are forcing an unwind because of stack overflow then deopt is
923 // irrelevant sice we are throwing the frame away anyway.
924
925 if (deopting && !force_unwind) {
926 handler_address = SharedRuntime::deopt_blob()->unpack_with_exception();
927 } else {
928
929 handler_address =
930 force_unwind ? NULL : nm->handler_for_exception_and_pc(exception, pc);
931
932 if (handler_address == NULL) {
933 handler_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true);
934 assert (handler_address != NULL, "must have compiled handler");
935 // Update the exception cache only when the unwind was not forced.
936 if (!force_unwind) {
937 nm->add_handler_for_exception_and_pc(exception,pc,handler_address);
938 }
939 } else {
940 assert(handler_address == SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true), "Must be the same");
941 }
942 }
943
944 thread->set_exception_pc(pc);
945 thread->set_exception_handler_pc(handler_address);
946 thread->set_exception_stack_size(0);
947
948 // Check if the exception PC is a MethodHandle call site.
949 thread->set_is_method_handle_return(nm->is_method_handle_return(pc));
950 }
951
952 // Restore correct return pc. Was saved above.
953 thread->set_exception_oop(exception());
954 return handler_address;
955
956 JRT_END
|
913 if (nm->is_deopt_pc(pc)) {
914 deopting = true;
915 RegisterMap map(thread, false);
916 frame deoptee = thread->last_frame().sender(&map);
917 assert(deoptee.is_deoptimized_frame(), "must be deopted");
918 // Adjust the pc back to the original throwing pc
919 pc = deoptee.pc();
920 }
921
922 // If we are forcing an unwind because of stack overflow then deopt is
923 // irrelevant sice we are throwing the frame away anyway.
924
925 if (deopting && !force_unwind) {
926 handler_address = SharedRuntime::deopt_blob()->unpack_with_exception();
927 } else {
928
929 handler_address =
930 force_unwind ? NULL : nm->handler_for_exception_and_pc(exception, pc);
931
932 if (handler_address == NULL) {
933 oop original_exception = exception();
934 handler_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true);
935 assert (handler_address != NULL, "must have compiled handler");
936 // Update the exception cache only when the unwind was not forced
937 // and there didn't happen another exception during the computation of the
938 // compiled exception handler. (Notice that the comparison below may wrongly fail
939 // because a GC can happen while the compiled exception handler is computed.
940 // But that should be a very rare case and updating the exception cache only
941 // during the next exception occurence should have no measurable performance impact.
942 if (!force_unwind && original_exception == exception()) {
943 nm->add_handler_for_exception_and_pc(exception,pc,handler_address);
944 }
945 } else {
946 assert(handler_address == SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true), "Must be the same");
947 }
948 }
949
950 thread->set_exception_pc(pc);
951 thread->set_exception_handler_pc(handler_address);
952 thread->set_exception_stack_size(0);
953
954 // Check if the exception PC is a MethodHandle call site.
955 thread->set_is_method_handle_return(nm->is_method_handle_return(pc));
956 }
957
958 // Restore correct return pc. Was saved above.
959 thread->set_exception_oop(exception());
960 return handler_address;
961
962 JRT_END
|