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
231
232
233 // Implementation of IR
234
235 IR::IR(Compilation* compilation, ciMethod* method, int osr_bci) :
236 _locals_size(in_WordSize(-1))
237 , _num_loops(0) {
238 // setup IR fields
239 _compilation = compilation;
240 _top_scope = new IRScope(compilation, NULL, -1, method, osr_bci, true);
241 _code = NULL;
242 }
243
244
245 void IR::optimize_blocks() {
246 Optimizer opt(this);
247 if (!compilation()->profile_branches()) {
248 if (DoCEE) {
249 opt.eliminate_conditional_expressions();
250 #ifndef PRODUCT
251 if (PrintCFG || PrintCFG1) { tty->print_cr("CFG after CEE"); print(true); }
|
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;
238 int popframe_extra_args = 0;
239
240 if (JvmtiExport::can_pop_frame() && state->kind() != ValueStack::StateBefore) {
241 ciMethod* method = state->scope()->method();
242 int bci = state->bci();
243 popframe_extra_args = MAX2(-method->stack_effect_if_at_invoke(bci), 0);
244 }
245
246 while (state != NULL) {
247 int locks = state->locks_size();
248 int temps = state->stack_size();
249 bool is_top_frame = (state->caller_state() == NULL);
250 ciMethod* method = state->scope()->method();
251
252 int frame_size = BytesPerWord * Interpreter::size_activation<ciMethod>(method,
253 temps + callee_parameters,
254 popframe_extra_args,
255 locks,
256 callee_parameters,
257 callee_locals,
258 is_top_frame);
259 size += frame_size;
260
261 callee_parameters = method->size_of_parameters();
262 callee_locals = method->max_locals();
263 popframe_extra_args = 0;
264 state = state->caller_state();
265 }
266 return size + Deoptimization::last_frame_adjust(0, callee_locals) * BytesPerWord;
267 }
268
269 // Implementation of IR
270
271 IR::IR(Compilation* compilation, ciMethod* method, int osr_bci) :
272 _locals_size(in_WordSize(-1))
273 , _num_loops(0) {
274 // setup IR fields
275 _compilation = compilation;
276 _top_scope = new IRScope(compilation, NULL, -1, method, osr_bci, true);
277 _code = NULL;
278 }
279
280
281 void IR::optimize_blocks() {
282 Optimizer opt(this);
283 if (!compilation()->profile_branches()) {
284 if (DoCEE) {
285 opt.eliminate_conditional_expressions();
286 #ifndef PRODUCT
287 if (PrintCFG || PrintCFG1) { tty->print_cr("CFG after CEE"); print(true); }
|