< prev index next >

src/hotspot/share/c1/c1_IR.hpp

Print this page

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 topmost, 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/*topmost*/);
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 reexecute = topmost ? should_reexecute() : false;
245     bool return_oop = false; // This flag will be ignored since it used only for C2 with escape analysis.





246     bool rethrow_exception = false;
247     bool is_opt_native = 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, is_opt_native, 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 
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   int interpreter_frame_size() const;
294 };
295 
296 
297 class IR: public CompilationResourceObj {
298  private:
299   Compilation*     _compilation;                 // the current compilation
300   IRScope*         _top_scope;                   // the root of the scope hierarchy
301   int              _num_loops;                   // Total number of loops
302   BlockList*       _code;                        // the blocks in code generation order w/ use counts
303 
304  public:
305   // creation
306   IR(Compilation* compilation, ciMethod* method, int osr_bci);
307 
308   // accessors

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 topmost, 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/*topmost*/);
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 reexecute = topmost ? should_reexecute() : false;
248     bool return_oop = false;
249     bool return_scalarized = false;
250     if (maybe_return_as_fields) {
251       return_oop = true;
252       return_scalarized = true;
253     }
254     bool rethrow_exception = false;
255     bool is_opt_native = 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, is_opt_native, 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 
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   int interpreter_frame_size() const;
302 };
303 
304 
305 class IR: public CompilationResourceObj {
306  private:
307   Compilation*     _compilation;                 // the current compilation
308   IRScope*         _top_scope;                   // the root of the scope hierarchy
309   int              _num_loops;                   // Total number of loops
310   BlockList*       _code;                        // the blocks in code generation order w/ use counts
311 
312  public:
313   // creation
314   IR(Compilation* compilation, ciMethod* method, int osr_bci);
315 
316   // accessors
< prev index next >