hotspot/src/share/vm/opto/graphKit.cpp
changeset 3600 27aa4477d039
parent 3268 f034e0c86895
child 3797 3f6a7898f912
equal deleted inserted replaced
3599:35bb709f2c62 3600:27aa4477d039
   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(), "");