< prev index next >

src/hotspot/share/c1/c1_IR.cpp

Print this page




 162 int IRScope::max_stack() const {
 163   int my_max = method()->max_stack();
 164   int callee_max = 0;
 165   for (int i = 0; i < number_of_callees(); i++) {
 166     callee_max = MAX2(callee_max, callee_no(i)->max_stack());
 167   }
 168   return my_max + callee_max;
 169 }
 170 
 171 
 172 bool IRScopeDebugInfo::should_reexecute() {
 173   ciMethod* cur_method = scope()->method();
 174   int       cur_bci    = bci();
 175   if (cur_method != NULL && cur_bci != SynchronizationEntryBCI) {
 176     Bytecodes::Code code = cur_method->java_code_at_bci(cur_bci);
 177     return Interpreter::bytecode_should_reexecute(code);
 178   } else
 179     return false;
 180 }
 181 



















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




 162 int IRScope::max_stack() const {
 163   int my_max = method()->max_stack();
 164   int callee_max = 0;
 165   for (int i = 0; i < number_of_callees(); i++) {
 166     callee_max = MAX2(callee_max, callee_no(i)->max_stack());
 167   }
 168   return my_max + callee_max;
 169 }
 170 
 171 
 172 bool IRScopeDebugInfo::should_reexecute() {
 173   ciMethod* cur_method = scope()->method();
 174   int       cur_bci    = bci();
 175   if (cur_method != NULL && cur_bci != SynchronizationEntryBCI) {
 176     Bytecodes::Code code = cur_method->java_code_at_bci(cur_bci);
 177     return Interpreter::bytecode_should_reexecute(code);
 178   } else
 179     return false;
 180 }
 181 
 182 void IRScopeDebugInfo::record_debug_info(DebugInformationRecorder* recorder, int pc_offset, bool topmost, bool is_method_handle_invoke, bool maybe_return_as_fields) {
 183   if (caller() != NULL) {
 184     // Order is significant:  Must record caller first.
 185     caller()->record_debug_info(recorder, pc_offset, false/*topmost*/);
 186   }
 187   DebugToken* locvals = recorder->create_scope_values(locals());
 188   DebugToken* expvals = recorder->create_scope_values(expressions());
 189   DebugToken* monvals = recorder->create_monitor_values(monitors());
 190   // reexecute allowed only for the topmost frame
 191   bool reexecute = topmost ? should_reexecute() : false;
 192   bool return_oop = false; // This flag will be ignored since it used only for C2 with escape analysis.
 193   bool rethrow_exception = false;
 194   bool return_vt = false;
 195   if (maybe_return_as_fields) {
 196     return_oop = true;
 197     return_vt = true;
 198   }
 199   recorder->describe_scope(pc_offset, methodHandle(), scope()->method(), bci(), reexecute, rethrow_exception, is_method_handle_invoke, return_oop, return_vt, locvals, expvals, monvals);
 200 }
 201 
 202 // Implementation of CodeEmitInfo
 203 
 204 // Stack must be NON-null
 205 CodeEmitInfo::CodeEmitInfo(ValueStack* stack, XHandlers* exception_handlers, bool deoptimize_on_exception)
 206   : _scope_debug_info(NULL)
 207   , _scope(stack->scope())
 208   , _exception_handlers(exception_handlers)
 209   , _oop_map(NULL)
 210   , _stack(stack)
 211   , _is_method_handle_invoke(false)
 212   , _deoptimize_on_exception(deoptimize_on_exception) {
 213   assert(_stack != NULL, "must be non null");
 214 }
 215 
 216 
 217 CodeEmitInfo::CodeEmitInfo(CodeEmitInfo* info, ValueStack* stack)
 218   : _scope_debug_info(NULL)
 219   , _scope(info->_scope)
 220   , _exception_handlers(NULL)
 221   , _oop_map(NULL)
 222   , _stack(stack == NULL ? info->_stack : stack)
 223   , _is_method_handle_invoke(info->_is_method_handle_invoke)
 224   , _deoptimize_on_exception(info->_deoptimize_on_exception) {
 225 
 226   // deep copy of exception handlers
 227   if (info->_exception_handlers != NULL) {
 228     _exception_handlers = new XHandlers(info->_exception_handlers);
 229   }
 230 }
 231 
 232 
 233 void CodeEmitInfo::record_debug_info(DebugInformationRecorder* recorder, int pc_offset, bool maybe_return_as_fields) {
 234   // record the safepoint before recording the debug info for enclosing scopes
 235   recorder->add_safepoint(pc_offset, _oop_map->deep_copy());
 236   _scope_debug_info->record_debug_info(recorder, pc_offset, true/*topmost*/, _is_method_handle_invoke, maybe_return_as_fields);
 237   recorder->end_safepoint(pc_offset);
 238 }
 239 
 240 
 241 void CodeEmitInfo::add_register_oop(LIR_Opr opr) {
 242   assert(_oop_map != NULL, "oop map must already exist");
 243   assert(opr->is_single_cpu(), "should not call otherwise");
 244 
 245   VMReg name = frame_map()->regname(opr);
 246   _oop_map->set_oop(name);
 247 }
 248 
 249 // Mirror the stack size calculation in the deopt code
 250 // How much stack space would we need at this point in the program in
 251 // case of deoptimization?
 252 int CodeEmitInfo::interpreter_frame_size() const {
 253   ValueStack* state = _stack;
 254   int size = 0;
 255   int callee_parameters = 0;
 256   int callee_locals = 0;


< prev index next >