189 bool wrote_volatile () const { return _wrote_volatile; }
190 };
191
192
193 //
194 // IRScopeDebugInfo records the debug information for a particular IRScope
195 // in a particular CodeEmitInfo. This allows the information to be computed
196 // once early enough for the OopMap to be available to the LIR and also to be
197 // reemited for different pcs using the same CodeEmitInfo without recomputing
198 // everything.
199 //
200
201 class IRScopeDebugInfo: public CompilationResourceObj {
202 private:
203 IRScope* _scope;
204 int _bci;
205 GrowableArray<ScopeValue*>* _locals;
206 GrowableArray<ScopeValue*>* _expressions;
207 GrowableArray<MonitorValue*>* _monitors;
208 IRScopeDebugInfo* _caller;
209
210 public:
211 IRScopeDebugInfo(IRScope* scope,
212 int bci,
213 GrowableArray<ScopeValue*>* locals,
214 GrowableArray<ScopeValue*>* expressions,
215 GrowableArray<MonitorValue*>* monitors,
216 IRScopeDebugInfo* caller):
217 _scope(scope)
218 , _bci(bci)
219 , _locals(locals)
220 , _expressions(expressions)
221 , _monitors(monitors)
222 , _caller(caller) {}
223
224
225 IRScope* scope() { return _scope; }
226 int bci() { return _bci; }
227 GrowableArray<ScopeValue*>* locals() { return _locals; }
228 GrowableArray<ScopeValue*>* expressions() { return _expressions; }
229 GrowableArray<MonitorValue*>* monitors() { return _monitors; }
230 IRScopeDebugInfo* caller() { return _caller; }
231
232 //Whether we should reexecute this bytecode for deopt
233 bool should_reexecute();
234
235 void record_debug_info(DebugInformationRecorder* recorder, int pc_offset, bool reexecute, bool is_method_handle_invoke = false) {
236 if (caller() != NULL) {
237 // Order is significant: Must record caller first.
238 caller()->record_debug_info(recorder, pc_offset, false/*reexecute*/);
239 }
240 DebugToken* locvals = recorder->create_scope_values(locals());
241 DebugToken* expvals = recorder->create_scope_values(expressions());
242 DebugToken* monvals = recorder->create_monitor_values(monitors());
243 // reexecute allowed only for the topmost frame
244 bool return_oop = false; // This flag will be ignored since it used only for C2 with escape analysis.
245 bool rethrow_exception = false;
246 bool is_opt_native = false;
247 bool has_ea_local_in_scope = false;
248 bool arg_escape = false;
249 recorder->describe_scope(pc_offset, methodHandle(), scope()->method(), bci(),
250 reexecute, rethrow_exception, is_method_handle_invoke, is_opt_native, return_oop,
251 has_ea_local_in_scope, arg_escape, locvals, expvals, monvals);
252 }
253 };
254
255
256 class CodeEmitInfo: public CompilationResourceObj {
257 friend class LinearScan;
258 private:
259 IRScopeDebugInfo* _scope_debug_info;
260 IRScope* _scope;
261 XHandlers* _exception_handlers;
262 OopMap* _oop_map;
263 ValueStack* _stack; // used by deoptimization (contains also monitors
264 bool _is_method_handle_invoke; // true if the associated call site is a MethodHandle call site.
265 bool _deoptimize_on_exception;
266 bool _force_reexecute; // force the reexecute flag on, used for patching stub
267
268 FrameMap* frame_map() const { return scope()->compilation()->frame_map(); }
269 Compilation* compilation() const { return scope()->compilation(); }
270
271 public:
272
273 // use scope from ValueStack
274 CodeEmitInfo(ValueStack* stack, XHandlers* exception_handlers, bool deoptimize_on_exception = false);
275
276 // make a copy
277 CodeEmitInfo(CodeEmitInfo* info, ValueStack* stack = NULL);
278
279 // accessors
280 OopMap* oop_map() { return _oop_map; }
281 ciMethod* method() const { return _scope->method(); }
282 IRScope* scope() const { return _scope; }
283 XHandlers* exception_handlers() const { return _exception_handlers; }
284 ValueStack* stack() const { return _stack; }
285 bool deoptimize_on_exception() const { return _deoptimize_on_exception; }
286
287 void add_register_oop(LIR_Opr opr);
288 void record_debug_info(DebugInformationRecorder* recorder, int pc_offset);
289
290 bool is_method_handle_invoke() const { return _is_method_handle_invoke; }
291 void set_is_method_handle_invoke(bool x) { _is_method_handle_invoke = x; }
292
293 bool force_reexecute() const { return _force_reexecute; }
294 void set_force_reexecute() { _force_reexecute = true; }
295
296 int interpreter_frame_size() const;
297
298 };
299
300
301 class IR: public CompilationResourceObj {
302 private:
303 Compilation* _compilation; // the current compilation
304 IRScope* _top_scope; // the root of the scope hierarchy
305 int _num_loops; // Total number of loops
306 BlockList* _code; // the blocks in code generation order w/ use counts
307
308 public:
|
189 bool wrote_volatile () const { return _wrote_volatile; }
190 };
191
192
193 //
194 // IRScopeDebugInfo records the debug information for a particular IRScope
195 // in a particular CodeEmitInfo. This allows the information to be computed
196 // once early enough for the OopMap to be available to the LIR and also to be
197 // reemited for different pcs using the same CodeEmitInfo without recomputing
198 // everything.
199 //
200
201 class IRScopeDebugInfo: public CompilationResourceObj {
202 private:
203 IRScope* _scope;
204 int _bci;
205 GrowableArray<ScopeValue*>* _locals;
206 GrowableArray<ScopeValue*>* _expressions;
207 GrowableArray<MonitorValue*>* _monitors;
208 IRScopeDebugInfo* _caller;
209 bool _should_reexecute;
210
211 public:
212 IRScopeDebugInfo(IRScope* scope,
213 int bci,
214 GrowableArray<ScopeValue*>* locals,
215 GrowableArray<ScopeValue*>* expressions,
216 GrowableArray<MonitorValue*>* monitors,
217 IRScopeDebugInfo* caller,
218 bool should_reexecute):
219 _scope(scope)
220 , _bci(bci)
221 , _locals(locals)
222 , _expressions(expressions)
223 , _monitors(monitors)
224 , _caller(caller)
225 , _should_reexecute(should_reexecute) {}
226
227
228 IRScope* scope() { return _scope; }
229 int bci() { return _bci; }
230 GrowableArray<ScopeValue*>* locals() { return _locals; }
231 GrowableArray<ScopeValue*>* expressions() { return _expressions; }
232 GrowableArray<MonitorValue*>* monitors() { return _monitors; }
233 IRScopeDebugInfo* caller() { return _caller; }
234
235 //Whether we should reexecute this bytecode for deopt
236 bool should_reexecute();
237
238 void record_debug_info(DebugInformationRecorder* recorder, int pc_offset, bool reexecute, bool is_method_handle_invoke = false, bool maybe_return_as_fields = false) {
239 if (caller() != NULL) {
240 // Order is significant: Must record caller first.
241 caller()->record_debug_info(recorder, pc_offset, false/*reexecute*/);
242 }
243 DebugToken* locvals = recorder->create_scope_values(locals());
244 DebugToken* expvals = recorder->create_scope_values(expressions());
245 DebugToken* monvals = recorder->create_monitor_values(monitors());
246 // reexecute allowed only for the topmost frame
247 bool return_oop = false;
248 bool return_scalarized = false;
249 if (maybe_return_as_fields) {
250 return_oop = true;
251 return_scalarized = true;
252 }
253 bool rethrow_exception = false;
254 bool is_opt_native = false;
255 bool has_ea_local_in_scope = false;
256 bool arg_escape = false;
257 recorder->describe_scope(pc_offset, methodHandle(), scope()->method(), bci(),
258 reexecute, rethrow_exception, is_method_handle_invoke, is_opt_native, return_oop, return_scalarized,
259 has_ea_local_in_scope, arg_escape, locvals, expvals, monvals);
260 }
261 };
262
263
264 class CodeEmitInfo: public CompilationResourceObj {
265 friend class LinearScan;
266 private:
267 IRScopeDebugInfo* _scope_debug_info;
268 IRScope* _scope;
269 XHandlers* _exception_handlers;
270 OopMap* _oop_map;
271 ValueStack* _stack; // used by deoptimization (contains also monitors
272 bool _is_method_handle_invoke; // true if the associated call site is a MethodHandle call site.
273 bool _deoptimize_on_exception;
274 bool _force_reexecute; // force the reexecute flag on, used for patching stub
275
276 FrameMap* frame_map() const { return scope()->compilation()->frame_map(); }
277 Compilation* compilation() const { return scope()->compilation(); }
278
279 public:
280
281 // use scope from ValueStack
282 CodeEmitInfo(ValueStack* stack, XHandlers* exception_handlers, bool deoptimize_on_exception = false);
283
284 // make a copy
285 CodeEmitInfo(CodeEmitInfo* info, ValueStack* stack = NULL);
286
287 // accessors
288 OopMap* oop_map() { return _oop_map; }
289 ciMethod* method() const { return _scope->method(); }
290 IRScope* scope() const { return _scope; }
291 XHandlers* exception_handlers() const { return _exception_handlers; }
292 ValueStack* stack() const { return _stack; }
293 bool deoptimize_on_exception() const { return _deoptimize_on_exception; }
294
295 void add_register_oop(LIR_Opr opr);
296 void record_debug_info(DebugInformationRecorder* recorder, int pc_offset, bool maybe_return_as_fields = false);
297
298 bool is_method_handle_invoke() const { return _is_method_handle_invoke; }
299 void set_is_method_handle_invoke(bool x) { _is_method_handle_invoke = x; }
300
301 bool force_reexecute() const { return _force_reexecute; }
302 void set_force_reexecute() { _force_reexecute = true; }
303
304 int interpreter_frame_size() const;
305
306 };
307
308
309 class IR: public CompilationResourceObj {
310 private:
311 Compilation* _compilation; // the current compilation
312 IRScope* _top_scope; // the root of the scope hierarchy
313 int _num_loops; // Total number of loops
314 BlockList* _code; // the blocks in code generation order w/ use counts
315
316 public:
|