< prev index next >

src/hotspot/share/c1/c1_IR.hpp

Print this page

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) {
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, 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              _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 = nullptr);
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     force_reexecute() const         { return _force_reexecute;             }
291   void     set_force_reexecute()           { _force_reexecute = true;             }
292 
293   int interpreter_frame_size() const;
294 
295 };
296 
297 
298 class IR: public CompilationResourceObj {
299  private:
300   Compilation*     _compilation;                 // the current compilation
301   IRScope*         _top_scope;                   // the root of the scope hierarchy
302   int              _num_loops;                   // Total number of loops
303   BlockList*       _code;                        // the blocks in code generation order w/ use counts
304 
305  public:
306   // creation
307   IR(Compilation* compilation, ciMethod* method, int osr_bci);
308 

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 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, 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              _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 = nullptr);
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     force_reexecute() const         { return _force_reexecute;             }
299   void     set_force_reexecute()           { _force_reexecute = true;             }
300 
301   int interpreter_frame_size() const;
302 
303 };
304 
305 
306 class IR: public CompilationResourceObj {
307  private:
308   Compilation*     _compilation;                 // the current compilation
309   IRScope*         _top_scope;                   // the root of the scope hierarchy
310   int              _num_loops;                   // Total number of loops
311   BlockList*       _code;                        // the blocks in code generation order w/ use counts
312 
313  public:
314   // creation
315   IR(Compilation* compilation, ciMethod* method, int osr_bci);
316 
< prev index next >