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() != nullptr) {
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 has_ea_local_in_scope = false;
247 bool arg_escape = false;
248 recorder->describe_scope(pc_offset, methodHandle(), scope()->method(), bci(),
249 reexecute, rethrow_exception, is_method_handle_invoke, return_oop,
250 has_ea_local_in_scope, arg_escape, locvals, expvals, monvals);
251 }
252 };
253
254
255 class CodeEmitInfo: public CompilationResourceObj {
256 friend class LinearScan;
257 private:
258 IRScopeDebugInfo* _scope_debug_info;
259 IRScope* _scope;
260 XHandlers* _exception_handlers;
261 OopMap* _oop_map;
262 ValueStack* _stack; // used by deoptimization (contains also monitors
263 bool _is_method_handle_invoke; // true if the associated call site is a MethodHandle call site.
264 bool _deoptimize_on_exception;
265 bool _force_reexecute; // force the reexecute flag on, used for patching stub
266
267 FrameMap* frame_map() const { return scope()->compilation()->frame_map(); }
268 Compilation* compilation() const { return scope()->compilation(); }
269
270 public:
271
272 // use scope from ValueStack
273 CodeEmitInfo(ValueStack* stack, XHandlers* exception_handlers, bool deoptimize_on_exception = false);
274
275 // make a copy
276 CodeEmitInfo(CodeEmitInfo* info, ValueStack* stack = nullptr);
277
278 // accessors
279 OopMap* oop_map() { return _oop_map; }
280 ciMethod* method() const { return _scope->method(); }
281 IRScope* scope() const { return _scope; }
282 XHandlers* exception_handlers() const { return _exception_handlers; }
283 ValueStack* stack() const { return _stack; }
284 bool deoptimize_on_exception() const { return _deoptimize_on_exception; }
285
286 void add_register_oop(LIR_Opr opr);
287 void record_debug_info(DebugInformationRecorder* recorder, int pc_offset);
288
289 bool is_method_handle_invoke() const { return _is_method_handle_invoke; }
290 void set_is_method_handle_invoke(bool x) { _is_method_handle_invoke = x; }
291
292 bool force_reexecute() const { return _force_reexecute; }
293 void set_force_reexecute() { _force_reexecute = true; }
294
295 int interpreter_frame_size() const;
296
297 };
298
299
300 class IR: public CompilationResourceObj {
301 private:
302 Compilation* _compilation; // the current compilation
303 IRScope* _top_scope; // the root of the scope hierarchy
304 int _num_loops; // Total number of loops
305 BlockList* _code; // the blocks in code generation order w/ use counts
306
307 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() != nullptr) {
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 has_ea_local_in_scope = false;
255 bool arg_escape = false;
256 recorder->describe_scope(pc_offset, methodHandle(), scope()->method(), bci(),
257 reexecute, rethrow_exception, is_method_handle_invoke, return_oop, return_scalarized,
258 has_ea_local_in_scope, arg_escape, locvals, expvals, monvals);
259 }
260 };
261
262
263 class CodeEmitInfo: public CompilationResourceObj {
264 friend class LinearScan;
265 private:
266 IRScopeDebugInfo* _scope_debug_info;
267 IRScope* _scope;
268 XHandlers* _exception_handlers;
269 OopMap* _oop_map;
270 ValueStack* _stack; // used by deoptimization (contains also monitors
271 bool _is_method_handle_invoke; // true if the associated call site is a MethodHandle call site.
272 bool _deoptimize_on_exception;
273 bool _force_reexecute; // force the reexecute flag on, used for patching stub
274
275 FrameMap* frame_map() const { return scope()->compilation()->frame_map(); }
276 Compilation* compilation() const { return scope()->compilation(); }
277
278 public:
279
280 // use scope from ValueStack
281 CodeEmitInfo(ValueStack* stack, XHandlers* exception_handlers, bool deoptimize_on_exception = false);
282
283 // make a copy
284 CodeEmitInfo(CodeEmitInfo* info, ValueStack* stack = nullptr);
285
286 // accessors
287 OopMap* oop_map() { return _oop_map; }
288 ciMethod* method() const { return _scope->method(); }
289 IRScope* scope() const { return _scope; }
290 XHandlers* exception_handlers() const { return _exception_handlers; }
291 ValueStack* stack() const { return _stack; }
292 bool deoptimize_on_exception() const { return _deoptimize_on_exception; }
293
294 void add_register_oop(LIR_Opr opr);
295 void record_debug_info(DebugInformationRecorder* recorder, int pc_offset, bool maybe_return_as_fields = false);
296
297 bool is_method_handle_invoke() const { return _is_method_handle_invoke; }
298 void set_is_method_handle_invoke(bool x) { _is_method_handle_invoke = x; }
299
300 bool force_reexecute() const { return _force_reexecute; }
301 void set_force_reexecute() { _force_reexecute = true; }
302
303 int interpreter_frame_size() const;
304
305 };
306
307
308 class IR: public CompilationResourceObj {
309 private:
310 Compilation* _compilation; // the current compilation
311 IRScope* _top_scope; // the root of the scope hierarchy
312 int _num_loops; // Total number of loops
313 BlockList* _code; // the blocks in code generation order w/ use counts
314
315 public:
|