src/share/vm/opto/callnode.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6833129 Sdiff src/share/vm/opto

src/share/vm/opto/callnode.hpp

Print this page




 171   virtual uint match_edge(uint idx) const;
 172 };
 173 
 174 //-------------------------------JVMState-------------------------------------
 175 // A linked list of JVMState nodes captures the whole interpreter state,
 176 // plus GC roots, for all active calls at some call site in this compilation
 177 // unit.  (If there is no inlining, then the list has exactly one link.)
 178 // This provides a way to map the optimized program back into the interpreter,
 179 // or to let the GC mark the stack.
 180 class JVMState : public ResourceObj {
 181 private:
 182   JVMState*         _caller;    // List pointer for forming scope chains
 183   uint              _depth;     // One mroe than caller depth, or one.
 184   uint              _locoff;    // Offset to locals in input edge mapping
 185   uint              _stkoff;    // Offset to stack in input edge mapping
 186   uint              _monoff;    // Offset to monitors in input edge mapping
 187   uint              _scloff;    // Offset to fields of scalar objs in input edge mapping
 188   uint              _endoff;    // Offset to end of input edge mapping
 189   uint              _sp;        // Jave Expression Stack Pointer for this state
 190   int               _bci;       // Byte Code Index of this JVM point

 191   ciMethod*         _method;    // Method Pointer
 192   SafePointNode*    _map;       // Map node associated with this scope
 193 public:
 194   friend class Compile;
 195 
 196   // Because JVMState objects live over the entire lifetime of the
 197   // Compile object, they are allocated into the comp_arena, which
 198   // does not get resource marked or reset during the compile process
 199   void *operator new( size_t x, Compile* C ) { return C->comp_arena()->Amalloc(x); }
 200   void operator delete( void * ) { } // fast deallocation
 201 
 202   // Create a new JVMState, ready for abstract interpretation.
 203   JVMState(ciMethod* method, JVMState* caller);
 204   JVMState(int stack_size);  // root state; has a null method
 205 
 206   // Access functions for the JVM
 207   uint              locoff() const { return _locoff; }
 208   uint              stkoff() const { return _stkoff; }
 209   uint              argoff() const { return _stkoff + _sp; }
 210   uint              monoff() const { return _monoff; }
 211   uint              scloff() const { return _scloff; }
 212   uint              endoff() const { return _endoff; }
 213   uint              oopoff() const { return debug_end(); }
 214 
 215   int            loc_size() const { return _stkoff - _locoff; }
 216   int            stk_size() const { return _monoff - _stkoff; }
 217   int            mon_size() const { return _scloff - _monoff; }
 218   int            scl_size() const { return _endoff - _scloff; }
 219 
 220   bool        is_loc(uint i) const { return i >= _locoff && i < _stkoff; }
 221   bool        is_stk(uint i) const { return i >= _stkoff && i < _monoff; }
 222   bool        is_mon(uint i) const { return i >= _monoff && i < _scloff; }
 223   bool        is_scl(uint i) const { return i >= _scloff && i < _endoff; }
 224 
 225   uint              sp()     const { return _sp; }
 226   int               bci()    const { return _bci; }

 227   bool          has_method() const { return _method != NULL; }
 228   ciMethod*         method() const { assert(has_method(), ""); return _method; }
 229   JVMState*         caller() const { return _caller; }
 230   SafePointNode*    map()    const { return _map; }
 231   uint              depth()  const { return _depth; }
 232   uint        debug_start()  const; // returns locoff of root caller
 233   uint        debug_end()    const; // returns endoff of self
 234   uint        debug_size()   const {
 235     return loc_size() + sp() + mon_size() + scl_size();
 236   }
 237   uint        debug_depth()  const; // returns sum of debug_size values at all depths
 238 
 239   // Returns the JVM state at the desired depth (1 == root).
 240   JVMState* of_depth(int d) const;
 241 
 242   // Tells if two JVM states have the same call chain (depth, methods, & bcis).
 243   bool same_calls_as(const JVMState* that) const;
 244 
 245   // Monitors (monitors are stored as (boxNode, objNode) pairs
 246   enum { logMonitorEdges = 1 };


 251   bool is_monitor_box(uint off)    const {
 252     assert(is_mon(off), "should be called only for monitor edge");
 253     return (0 == bitfield(off - monoff(), 0, logMonitorEdges));
 254   }
 255   bool is_monitor_use(uint off)    const { return (is_mon(off)
 256                                                    && is_monitor_box(off))
 257                                              || (caller() && caller()->is_monitor_use(off)); }
 258 
 259   // Initialization functions for the JVM
 260   void              set_locoff(uint off) { _locoff = off; }
 261   void              set_stkoff(uint off) { _stkoff = off; }
 262   void              set_monoff(uint off) { _monoff = off; }
 263   void              set_scloff(uint off) { _scloff = off; }
 264   void              set_endoff(uint off) { _endoff = off; }
 265   void              set_offsets(uint off) {
 266     _locoff = _stkoff = _monoff = _scloff = _endoff = off;
 267   }
 268   void              set_map(SafePointNode *map) { _map = map; }
 269   void              set_sp(uint sp) { _sp = sp; }
 270   void              set_bci(int bci) { _bci = bci; }

 271 
 272   // Miscellaneous utility functions
 273   JVMState* clone_deep(Compile* C) const;    // recursively clones caller chain
 274   JVMState* clone_shallow(Compile* C) const; // retains uncloned caller
 275 
 276 #ifndef PRODUCT
 277   void      format(PhaseRegAlloc *regalloc, const Node *n, outputStream* st) const;
 278   void      dump_spec(outputStream *st) const;
 279   void      dump_on(outputStream* st) const;
 280   void      dump() const {
 281     dump_on(tty);
 282   }
 283 #endif
 284 };
 285 
 286 //------------------------------SafePointNode----------------------------------
 287 // A SafePointNode is a subclass of a MultiNode for convenience (and
 288 // potential code sharing) only - conceptually it is independent of
 289 // the Node semantics.
 290 class SafePointNode : public MultiNode {




 171   virtual uint match_edge(uint idx) const;
 172 };
 173 
 174 //-------------------------------JVMState-------------------------------------
 175 // A linked list of JVMState nodes captures the whole interpreter state,
 176 // plus GC roots, for all active calls at some call site in this compilation
 177 // unit.  (If there is no inlining, then the list has exactly one link.)
 178 // This provides a way to map the optimized program back into the interpreter,
 179 // or to let the GC mark the stack.
 180 class JVMState : public ResourceObj {
 181 private:
 182   JVMState*         _caller;    // List pointer for forming scope chains
 183   uint              _depth;     // One mroe than caller depth, or one.
 184   uint              _locoff;    // Offset to locals in input edge mapping
 185   uint              _stkoff;    // Offset to stack in input edge mapping
 186   uint              _monoff;    // Offset to monitors in input edge mapping
 187   uint              _scloff;    // Offset to fields of scalar objs in input edge mapping
 188   uint              _endoff;    // Offset to end of input edge mapping
 189   uint              _sp;        // Jave Expression Stack Pointer for this state
 190   int               _bci;       // Byte Code Index of this JVM point
 191   bool              _reexecute; // Whether this bytecode need to be re-executed
 192   ciMethod*         _method;    // Method Pointer
 193   SafePointNode*    _map;       // Map node associated with this scope
 194 public:
 195   friend class Compile;
 196 
 197   // Because JVMState objects live over the entire lifetime of the
 198   // Compile object, they are allocated into the comp_arena, which
 199   // does not get resource marked or reset during the compile process
 200   void *operator new( size_t x, Compile* C ) { return C->comp_arena()->Amalloc(x); }
 201   void operator delete( void * ) { } // fast deallocation
 202 
 203   // Create a new JVMState, ready for abstract interpretation.
 204   JVMState(ciMethod* method, JVMState* caller);
 205   JVMState(int stack_size);  // root state; has a null method
 206 
 207   // Access functions for the JVM
 208   uint              locoff() const { return _locoff; }
 209   uint              stkoff() const { return _stkoff; }
 210   uint              argoff() const { return _stkoff + _sp; }
 211   uint              monoff() const { return _monoff; }
 212   uint              scloff() const { return _scloff; }
 213   uint              endoff() const { return _endoff; }
 214   uint              oopoff() const { return debug_end(); }
 215 
 216   int            loc_size() const { return _stkoff - _locoff; }
 217   int            stk_size() const { return _monoff - _stkoff; }
 218   int            mon_size() const { return _scloff - _monoff; }
 219   int            scl_size() const { return _endoff - _scloff; }
 220 
 221   bool        is_loc(uint i) const { return i >= _locoff && i < _stkoff; }
 222   bool        is_stk(uint i) const { return i >= _stkoff && i < _monoff; }
 223   bool        is_mon(uint i) const { return i >= _monoff && i < _scloff; }
 224   bool        is_scl(uint i) const { return i >= _scloff && i < _endoff; }
 225 
 226   uint                      sp()     const { return _sp; }
 227   int                      bci()    const { return _bci; }
 228   bool        should_reexecute() const { return _reexecute; }
 229   bool              has_method() const { return _method != NULL; }
 230   ciMethod*             method() const { assert(has_method(), ""); return _method; }
 231   JVMState*             caller() const { return _caller; }
 232   SafePointNode*           map()    const { return _map; }
 233   uint                   depth()  const { return _depth; }
 234   uint             debug_start()  const; // returns locoff of root caller
 235   uint               debug_end()    const; // returns endoff of self
 236   uint              debug_size()   const {
 237     return loc_size() + sp() + mon_size() + scl_size();
 238   }
 239   uint        debug_depth()  const; // returns sum of debug_size values at all depths
 240 
 241   // Returns the JVM state at the desired depth (1 == root).
 242   JVMState* of_depth(int d) const;
 243 
 244   // Tells if two JVM states have the same call chain (depth, methods, & bcis).
 245   bool same_calls_as(const JVMState* that) const;
 246 
 247   // Monitors (monitors are stored as (boxNode, objNode) pairs
 248   enum { logMonitorEdges = 1 };


 253   bool is_monitor_box(uint off)    const {
 254     assert(is_mon(off), "should be called only for monitor edge");
 255     return (0 == bitfield(off - monoff(), 0, logMonitorEdges));
 256   }
 257   bool is_monitor_use(uint off)    const { return (is_mon(off)
 258                                                    && is_monitor_box(off))
 259                                              || (caller() && caller()->is_monitor_use(off)); }
 260 
 261   // Initialization functions for the JVM
 262   void              set_locoff(uint off) { _locoff = off; }
 263   void              set_stkoff(uint off) { _stkoff = off; }
 264   void              set_monoff(uint off) { _monoff = off; }
 265   void              set_scloff(uint off) { _scloff = off; }
 266   void              set_endoff(uint off) { _endoff = off; }
 267   void              set_offsets(uint off) {
 268     _locoff = _stkoff = _monoff = _scloff = _endoff = off;
 269   }
 270   void              set_map(SafePointNode *map) { _map = map; }
 271   void              set_sp(uint sp) { _sp = sp; }
 272   void              set_bci(int bci) { _bci = bci; }
 273   void              set_reexecute(bool reexec) {_reexecute = reexec;}
 274 
 275   // Miscellaneous utility functions
 276   JVMState* clone_deep(Compile* C) const;    // recursively clones caller chain
 277   JVMState* clone_shallow(Compile* C) const; // retains uncloned caller
 278 
 279 #ifndef PRODUCT
 280   void      format(PhaseRegAlloc *regalloc, const Node *n, outputStream* st) const;
 281   void      dump_spec(outputStream *st) const;
 282   void      dump_on(outputStream* st) const;
 283   void      dump() const {
 284     dump_on(tty);
 285   }
 286 #endif
 287 };
 288 
 289 //------------------------------SafePointNode----------------------------------
 290 // A SafePointNode is a subclass of a MultiNode for convenience (and
 291 // potential code sharing) only - conceptually it is independent of
 292 // the Node semantics.
 293 class SafePointNode : public MultiNode {


src/share/vm/opto/callnode.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File