comparison src/share/vm/runtime/sharedRuntime.cpp @ 7154:5d0bb7d52783

changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
author Doug Simon <doug.simon@oracle.com>
date Wed, 12 Dec 2012 21:36:40 +0100
parents 1baf7f1e3f23
children 291ffc492eb6
comparison
equal deleted inserted replaced
7153:c421c19b7bf8 7154:5d0bb7d52783
628 bool force_unwind, bool top_frame_only) { 628 bool force_unwind, bool top_frame_only) {
629 assert(nm != NULL, "must exist"); 629 assert(nm != NULL, "must exist");
630 ResourceMark rm; 630 ResourceMark rm;
631 631
632 #ifdef GRAAL 632 #ifdef GRAAL
633 // lookup exception handler for this pc 633 if (nm->is_compiled_by_graal()) {
634 int catch_pco = ret_pc - nm->code_begin(); 634 // lookup exception handler for this pc
635 ExceptionHandlerTable table(nm); 635 int catch_pco = ret_pc - nm->code_begin();
636 HandlerTableEntry *t = table.entry_for(catch_pco, -1, 0); 636 ExceptionHandlerTable table(nm);
637 if (t != NULL) { 637 HandlerTableEntry *t = table.entry_for(catch_pco, -1, 0);
638 return nm->code_begin() + t->pco(); 638 if (t != NULL) {
639 } else { 639 return nm->code_begin() + t->pco();
640 // there is no exception handler for this pc => deoptimize 640 } else {
641 nm->make_not_entrant(); 641 // there is no exception handler for this pc => deoptimize
642 JavaThread* thread = JavaThread::current(); 642 nm->make_not_entrant();
643 RegisterMap reg_map(thread); 643 JavaThread* thread = JavaThread::current();
644 frame runtime_frame = thread->last_frame(); 644 RegisterMap reg_map(thread);
645 frame caller_frame = runtime_frame.sender(&reg_map); 645 frame runtime_frame = thread->last_frame();
646 Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_not_compiled_exception_handler); 646 frame caller_frame = runtime_frame.sender(&reg_map);
647 return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls(); 647 Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_not_compiled_exception_handler);
648 } 648 return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
649 649 }
650 #else 650 }
651 #endif
651 652
652 ScopeDesc* sd = nm->scope_desc_at(ret_pc); 653 ScopeDesc* sd = nm->scope_desc_at(ret_pc);
653 // determine handler bci, if any 654 // determine handler bci, if any
654 EXCEPTION_MARK; 655 EXCEPTION_MARK;
655 656
726 guarantee(false, "missing exception handler"); 727 guarantee(false, "missing exception handler");
727 return NULL; 728 return NULL;
728 } 729 }
729 730
730 return nm->code_begin() + t->pco(); 731 return nm->code_begin() + t->pco();
731 #endif
732 } 732 }
733 733
734 JRT_ENTRY(void, SharedRuntime::throw_AbstractMethodError(JavaThread* thread)) 734 JRT_ENTRY(void, SharedRuntime::throw_AbstractMethodError(JavaThread* thread))
735 // These errors occur only at call sites 735 // These errors occur only at call sites
736 throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_AbstractMethodError()); 736 throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_AbstractMethodError());
869 869
870 #ifndef PRODUCT 870 #ifndef PRODUCT
871 _implicit_null_throws++; 871 _implicit_null_throws++;
872 #endif 872 #endif
873 #ifdef GRAAL 873 #ifdef GRAAL
874 target_pc = deoptimize_for_implicit_exception(thread, pc, nm, Deoptimization::Reason_null_check); 874 if (nm->is_compiled_by_graal()) {
875 #else 875 target_pc = deoptimize_for_implicit_exception(thread, pc, nm, Deoptimization::Reason_null_check);
876 } else {
877 #endif
876 target_pc = nm->continuation_for_implicit_exception(pc); 878 target_pc = nm->continuation_for_implicit_exception(pc);
879 #ifdef GRAAL
880 }
877 #endif 881 #endif
878 // If there's an unexpected fault, target_pc might be NULL, 882 // If there's an unexpected fault, target_pc might be NULL,
879 // in which case we want to fall through into the normal 883 // in which case we want to fall through into the normal
880 // error handling code. 884 // error handling code.
881 } 885 }
889 guarantee(nm != NULL, "must have containing nmethod for implicit division-by-zero exceptions"); 893 guarantee(nm != NULL, "must have containing nmethod for implicit division-by-zero exceptions");
890 #ifndef PRODUCT 894 #ifndef PRODUCT
891 _implicit_div0_throws++; 895 _implicit_div0_throws++;
892 #endif 896 #endif
893 #ifdef GRAAL 897 #ifdef GRAAL
894 if (TraceSignals) { 898 if (nm->is_compiled_by_graal()) {
895 tty->print_cr("Graal implicit div0"); 899 if (TraceSignals) {
900 tty->print_cr("Graal implicit div0");
901 }
902 target_pc = deoptimize_for_implicit_exception(thread, pc, nm, Deoptimization::Reason_div0_check);
903 } else {
904 #endif
905 target_pc = nm->continuation_for_implicit_exception(pc);
906 #ifdef GRAAL
896 } 907 }
897 target_pc = deoptimize_for_implicit_exception(thread, pc, nm, Deoptimization::Reason_div0_check);
898 #else
899 target_pc = nm->continuation_for_implicit_exception(pc);
900 #endif 908 #endif
901 // If there's an unexpected fault, target_pc might be NULL, 909 // If there's an unexpected fault, target_pc might be NULL,
902 // in which case we want to fall through into the normal 910 // in which case we want to fall through into the normal
903 // error handling code. 911 // error handling code.
904 break; // fall through 912 break; // fall through