< prev index next >

src/hotspot/share/c1/c1_IR.cpp

Print this page

 155   }
 156 
 157   assert(method->holder()->is_loaded() , "method holder must be loaded");
 158 
 159   // build graph if monitor pairing is ok
 160   if (create_graph && monitor_pairing_ok()) _start = build_graph(compilation, osr_bci);
 161 }
 162 
 163 
 164 int IRScope::max_stack() const {
 165   int my_max = method()->max_stack();
 166   int callee_max = 0;
 167   for (int i = 0; i < number_of_callees(); i++) {
 168     callee_max = MAX2(callee_max, callee_no(i)->max_stack());
 169   }
 170   return my_max + callee_max;
 171 }
 172 
 173 
 174 bool IRScopeDebugInfo::should_reexecute() {



 175   ciMethod* cur_method = scope()->method();
 176   int       cur_bci    = bci();
 177   if (cur_method != nullptr && cur_bci != SynchronizationEntryBCI) {
 178     Bytecodes::Code code = cur_method->java_code_at_bci(cur_bci);
 179     return Interpreter::bytecode_should_reexecute(code);
 180   } else
 181     return false;
 182 }
 183 
 184 
 185 // Implementation of CodeEmitInfo
 186 
 187 // Stack must be NON-null
 188 CodeEmitInfo::CodeEmitInfo(ValueStack* stack, XHandlers* exception_handlers, bool deoptimize_on_exception)
 189   : _scope_debug_info(nullptr)
 190   , _scope(stack->scope())
 191   , _exception_handlers(exception_handlers)
 192   , _oop_map(nullptr)
 193   , _stack(stack)
 194   , _is_method_handle_invoke(false)
 195   , _deoptimize_on_exception(deoptimize_on_exception)
 196   , _force_reexecute(false) {
 197   assert(_stack != nullptr, "must be non null");
 198 }
 199 
 200 
 201 CodeEmitInfo::CodeEmitInfo(CodeEmitInfo* info, ValueStack* stack)
 202   : _scope_debug_info(nullptr)
 203   , _scope(info->_scope)
 204   , _exception_handlers(nullptr)
 205   , _oop_map(nullptr)
 206   , _stack(stack == nullptr ? info->_stack : stack)
 207   , _is_method_handle_invoke(info->_is_method_handle_invoke)
 208   , _deoptimize_on_exception(info->_deoptimize_on_exception)
 209   , _force_reexecute(info->_force_reexecute) {
 210 
 211   // deep copy of exception handlers
 212   if (info->_exception_handlers != nullptr) {
 213     _exception_handlers = new XHandlers(info->_exception_handlers);
 214   }
 215 }
 216 
 217 
 218 void CodeEmitInfo::record_debug_info(DebugInformationRecorder* recorder, int pc_offset) {
 219   // record the safepoint before recording the debug info for enclosing scopes
 220   recorder->add_safepoint(pc_offset, _oop_map->deep_copy());
 221   bool reexecute = _force_reexecute || _scope_debug_info->should_reexecute();
 222   _scope_debug_info->record_debug_info(recorder, pc_offset, reexecute, _is_method_handle_invoke);
 223   recorder->end_safepoint(pc_offset);
 224 }
 225 
 226 
 227 void CodeEmitInfo::add_register_oop(LIR_Opr opr) {
 228   assert(_oop_map != nullptr, "oop map must already exist");
 229   assert(opr->is_single_cpu(), "should not call otherwise");
 230 
 231   VMReg name = frame_map()->regname(opr);
 232   _oop_map->set_oop(name);
 233 }
 234 
 235 // Mirror the stack size calculation in the deopt code
 236 // How much stack space would we need at this point in the program in
 237 // case of deoptimization?
 238 int CodeEmitInfo::interpreter_frame_size() const {
 239   ValueStack* state = _stack;
 240   int size = 0;
 241   int callee_parameters = 0;
 242   int callee_locals = 0;

 155   }
 156 
 157   assert(method->holder()->is_loaded() , "method holder must be loaded");
 158 
 159   // build graph if monitor pairing is ok
 160   if (create_graph && monitor_pairing_ok()) _start = build_graph(compilation, osr_bci);
 161 }
 162 
 163 
 164 int IRScope::max_stack() const {
 165   int my_max = method()->max_stack();
 166   int callee_max = 0;
 167   for (int i = 0; i < number_of_callees(); i++) {
 168     callee_max = MAX2(callee_max, callee_no(i)->max_stack());
 169   }
 170   return my_max + callee_max;
 171 }
 172 
 173 
 174 bool IRScopeDebugInfo::should_reexecute() {
 175   if (_should_reexecute) {
 176     return true;
 177   }
 178   ciMethod* cur_method = scope()->method();
 179   int       cur_bci    = bci();
 180   if (cur_method != nullptr && cur_bci != SynchronizationEntryBCI) {
 181     Bytecodes::Code code = cur_method->java_code_at_bci(cur_bci);
 182     return Interpreter::bytecode_should_reexecute(code);
 183   } else
 184     return false;
 185 }
 186 

 187 // Implementation of CodeEmitInfo
 188 
 189 // Stack must be NON-null
 190 CodeEmitInfo::CodeEmitInfo(ValueStack* stack, XHandlers* exception_handlers, bool deoptimize_on_exception)
 191   : _scope_debug_info(nullptr)
 192   , _scope(stack->scope())
 193   , _exception_handlers(exception_handlers)
 194   , _oop_map(nullptr)
 195   , _stack(stack)
 196   , _is_method_handle_invoke(false)
 197   , _deoptimize_on_exception(deoptimize_on_exception)
 198   , _force_reexecute(false) {
 199   assert(_stack != nullptr, "must be non null");
 200 }
 201 
 202 
 203 CodeEmitInfo::CodeEmitInfo(CodeEmitInfo* info, ValueStack* stack)
 204   : _scope_debug_info(nullptr)
 205   , _scope(info->_scope)
 206   , _exception_handlers(nullptr)
 207   , _oop_map(nullptr)
 208   , _stack(stack == nullptr ? info->_stack : stack)
 209   , _is_method_handle_invoke(info->_is_method_handle_invoke)
 210   , _deoptimize_on_exception(info->_deoptimize_on_exception)
 211   , _force_reexecute(info->_force_reexecute) {
 212 
 213   // deep copy of exception handlers
 214   if (info->_exception_handlers != nullptr) {
 215     _exception_handlers = new XHandlers(info->_exception_handlers);
 216   }
 217 }
 218 
 219 
 220 void CodeEmitInfo::record_debug_info(DebugInformationRecorder* recorder, int pc_offset, bool maybe_return_as_fields) {
 221   // record the safepoint before recording the debug info for enclosing scopes
 222   recorder->add_safepoint(pc_offset, _oop_map->deep_copy());
 223   bool reexecute = _force_reexecute || _scope_debug_info->should_reexecute();
 224   _scope_debug_info->record_debug_info(recorder, pc_offset, reexecute, _is_method_handle_invoke, maybe_return_as_fields);
 225   recorder->end_safepoint(pc_offset);
 226 }
 227 
 228 
 229 void CodeEmitInfo::add_register_oop(LIR_Opr opr) {
 230   assert(_oop_map != nullptr, "oop map must already exist");
 231   assert(opr->is_single_cpu(), "should not call otherwise");
 232 
 233   VMReg name = frame_map()->regname(opr);
 234   _oop_map->set_oop(name);
 235 }
 236 
 237 // Mirror the stack size calculation in the deopt code
 238 // How much stack space would we need at this point in the program in
 239 // case of deoptimization?
 240 int CodeEmitInfo::interpreter_frame_size() const {
 241   ValueStack* state = _stack;
 242   int size = 0;
 243   int callee_parameters = 0;
 244   int callee_locals = 0;
< prev index next >