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