Mercurial > hg > truffle
comparison src/share/vm/opto/graphKit.cpp @ 900:9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
Summary: developed a reexecute logic for the interpreter to reexecute the bytecode when deopt happens
Reviewed-by: kvn, never, jrose, twisti
author | cfang |
---|---|
date | Fri, 31 Jul 2009 17:12:33 -0700 |
parents | fc4be448891f |
children | 8fe1963e3964 |
comparison
equal
deleted
inserted
replaced
899:55cb84cd1247 | 900:9987d9d5eb0e |
---|---|
618 BuildCutout::~BuildCutout() { | 618 BuildCutout::~BuildCutout() { |
619 GraphKit* kit = _kit; | 619 GraphKit* kit = _kit; |
620 assert(kit->stopped(), "cutout code must stop, throw, return, etc."); | 620 assert(kit->stopped(), "cutout code must stop, throw, return, etc."); |
621 } | 621 } |
622 | 622 |
623 //---------------------------PreserveReexecuteState---------------------------- | |
624 PreserveReexecuteState::PreserveReexecuteState(GraphKit* kit) { | |
625 _kit = kit; | |
626 _sp = kit->sp(); | |
627 _reexecute = kit->jvms()->_reexecute; | |
628 } | |
629 PreserveReexecuteState::~PreserveReexecuteState() { | |
630 _kit->jvms()->_reexecute = _reexecute; | |
631 _kit->set_sp(_sp); | |
632 } | |
623 | 633 |
624 //------------------------------clone_map-------------------------------------- | 634 //------------------------------clone_map-------------------------------------- |
625 // Implementation of PreserveJVMState | 635 // Implementation of PreserveJVMState |
626 // | 636 // |
627 // Only clone_map(...) here. If this function is only used in the | 637 // Only clone_map(...) here. If this function is only used in the |
736 return true; | 746 return true; |
737 } | 747 } |
738 | 748 |
739 #endif //ASSERT | 749 #endif //ASSERT |
740 | 750 |
751 // Helper function for enforcing certain bytecodes to reexecute if | |
752 // deoptimization happens | |
753 static bool should_reexecute_implied_by_bytecode(JVMState *jvms) { | |
754 ciMethod* cur_method = jvms->method(); | |
755 int cur_bci = jvms->bci(); | |
756 if (cur_method != NULL && cur_bci != InvocationEntryBci) { | |
757 Bytecodes::Code code = cur_method->java_code_at_bci(cur_bci); | |
758 return Interpreter::bytecode_should_reexecute(code); | |
759 } else | |
760 return false; | |
761 } | |
762 | |
741 // Helper function for adding JVMState and debug information to node | 763 // Helper function for adding JVMState and debug information to node |
742 void GraphKit::add_safepoint_edges(SafePointNode* call, bool must_throw) { | 764 void GraphKit::add_safepoint_edges(SafePointNode* call, bool must_throw) { |
743 // Add the safepoint edges to the call (or other safepoint). | 765 // Add the safepoint edges to the call (or other safepoint). |
744 | 766 |
745 // Make sure dead locals are set to top. This | 767 // Make sure dead locals are set to top. This |
778 } | 800 } |
779 | 801 |
780 // do not scribble on the input jvms | 802 // do not scribble on the input jvms |
781 JVMState* out_jvms = youngest_jvms->clone_deep(C); | 803 JVMState* out_jvms = youngest_jvms->clone_deep(C); |
782 call->set_jvms(out_jvms); // Start jvms list for call node | 804 call->set_jvms(out_jvms); // Start jvms list for call node |
805 | |
806 // For a known set of bytecodes, the interpreter should reexecute them if | |
807 // deoptimization happens. We set the reexecute state for them here | |
808 if (out_jvms->is_reexecute_undefined() && //don't change if already specified | |
809 should_reexecute_implied_by_bytecode(out_jvms)) { | |
810 out_jvms->set_should_reexecute(true); //NOTE: youngest_jvms not changed | |
811 } | |
783 | 812 |
784 // Presize the call: | 813 // Presize the call: |
785 debug_only(uint non_debug_edges = call->req()); | 814 debug_only(uint non_debug_edges = call->req()); |
786 call->add_req_batch(top(), youngest_jvms->debug_depth()); | 815 call->add_req_batch(top(), youngest_jvms->debug_depth()); |
787 assert(call->req() == non_debug_edges + youngest_jvms->debug_depth(), ""); | 816 assert(call->req() == non_debug_edges + youngest_jvms->debug_depth(), ""); |