< prev index next >

src/hotspot/share/c1/c1_IR.hpp

Print this page

192   bool          wrote_stable() const             { return _wrote_stable; }
193 };
194 
195 
196 //
197 // IRScopeDebugInfo records the debug information for a particular IRScope
198 // in a particular CodeEmitInfo.  This allows the information to be computed
199 // once early enough for the OopMap to be available to the LIR and also to be
200 // reemited for different pcs using the same CodeEmitInfo without recomputing
201 // everything.
202 //
203 
204 class IRScopeDebugInfo: public CompilationResourceObj {
205  private:
206   IRScope*                      _scope;
207   int                           _bci;
208   GrowableArray<ScopeValue*>*   _locals;
209   GrowableArray<ScopeValue*>*   _expressions;
210   GrowableArray<MonitorValue*>* _monitors;
211   IRScopeDebugInfo*             _caller;

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       _scope(scope)
221     , _bci(bci)
222     , _locals(locals)
223     , _expressions(expressions)
224     , _monitors(monitors)
225     , _caller(caller) {}

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) {
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; // This flag will be ignored since it used only for C2 with escape analysis.





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

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