< prev index next >

src/share/vm/opto/phaseX.hpp

Print this page
rev 8961 : [mq]: diff-shenandoah.patch


 173          _zcon_max = (uint)T_CONFLICT
 174   };
 175   ConINode* _icons[_icon_max - _icon_min + 1];   // cached jint constant nodes
 176   ConLNode* _lcons[_lcon_max - _lcon_min + 1];   // cached jlong constant nodes
 177   ConNode*  _zcons[_zcon_max + 1];               // cached is_zero_type nodes
 178   void init_con_caches();
 179 
 180   // Support both int and long caches because either might be an intptr_t,
 181   // so they show up frequently in address computations.
 182 
 183 public:
 184   PhaseTransform( PhaseNumber pnum );
 185   PhaseTransform( Arena *arena, PhaseNumber pnum );
 186   PhaseTransform( PhaseTransform *phase, PhaseNumber pnum );
 187 
 188   Arena*      arena()   { return _arena; }
 189   Type_Array& types()   { return _types; }
 190   // _nodes is used in varying ways by subclasses, which define local accessors
 191 
 192 public:


 193   // Get a previously recorded type for the node n.
 194   // This type must already have been recorded.
 195   // If you want the type of a very new (untransformed) node,
 196   // you must use type_or_null, and test the result for NULL.
 197   const Type* type(const Node* n) const {
 198     assert(n != NULL, "must not be null");
 199     const Type* t = _types.fast_lookup(n->_idx);
 200     assert(t != NULL, "must set before get");
 201     return t;
 202   }
 203   // Get a previously recorded type for the node n,
 204   // or else return NULL if there is none.
 205   const Type* type_or_null(const Node* n) const {
 206     return _types.fast_lookup(n->_idx);
 207   }
 208   // Record a type for a node.
 209   void    set_type(const Node* n, const Type *t) {
 210     assert(t != NULL, "type must not be null");
 211     _types.map(n->_idx, t);
 212   }


 240   // Make an idealized constant, i.e., one of ConINode, ConPNode, ConFNode, etc.
 241   // Same as transform(ConNode::make(t)).
 242   ConNode* makecon(const Type* t);
 243   virtual ConNode* uncached_makecon(const Type* t)  // override in PhaseValues
 244   { ShouldNotCallThis(); return NULL; }
 245 
 246   // Fast int or long constant.  Same as TypeInt::make(i) or TypeLong::make(l).
 247   ConINode* intcon(jint i);
 248   ConLNode* longcon(jlong l);
 249 
 250   // Fast zero or null constant.  Same as makecon(Type::get_zero_type(bt)).
 251   ConNode* zerocon(BasicType bt);
 252 
 253   // Return a node which computes the same function as this node, but
 254   // in a faster or cheaper fashion.
 255   virtual Node *transform( Node *n ) = 0;
 256 
 257   // Return whether two Nodes are equivalent.
 258   // Must not be recursive, since the recursive version is built from this.
 259   // For pessimistic optimizations this is simply pointer equivalence.
 260   bool eqv(const Node* n1, const Node* n2) const { return n1 == n2; }
 261 
 262   // For pessimistic passes, the return type must monotonically narrow.
 263   // For optimistic  passes, the return type must monotonically widen.
 264   // It is possible to get into a "death march" in either type of pass,
 265   // where the types are continually moving but it will take 2**31 or
 266   // more steps to converge.  This doesn't happen on most normal loops.
 267   //
 268   // Here is an example of a deadly loop for an optimistic pass, along
 269   // with a partial trace of inferred types:
 270   //    x = phi(0,x'); L: x' = x+1; if (x' >= 0) goto L;
 271   //    0                 1                join([0..max], 1)
 272   //    [0..1]            [1..2]           join([0..max], [1..2])
 273   //    [0..2]            [1..3]           join([0..max], [1..3])
 274   //      ... ... ...
 275   //    [0..max]          [min]u[1..max]   join([0..max], [min..max])
 276   //    [0..max] ==> fixpoint
 277   // We would have proven, the hard way, that the iteration space is all
 278   // non-negative ints, with the loop terminating due to 32-bit overflow.
 279   //
 280   // Here is the corresponding example for a pessimistic pass:




 173          _zcon_max = (uint)T_CONFLICT
 174   };
 175   ConINode* _icons[_icon_max - _icon_min + 1];   // cached jint constant nodes
 176   ConLNode* _lcons[_lcon_max - _lcon_min + 1];   // cached jlong constant nodes
 177   ConNode*  _zcons[_zcon_max + 1];               // cached is_zero_type nodes
 178   void init_con_caches();
 179 
 180   // Support both int and long caches because either might be an intptr_t,
 181   // so they show up frequently in address computations.
 182 
 183 public:
 184   PhaseTransform( PhaseNumber pnum );
 185   PhaseTransform( Arena *arena, PhaseNumber pnum );
 186   PhaseTransform( PhaseTransform *phase, PhaseNumber pnum );
 187 
 188   Arena*      arena()   { return _arena; }
 189   Type_Array& types()   { return _types; }
 190   // _nodes is used in varying ways by subclasses, which define local accessors
 191 
 192 public:
 193   virtual PhaseIterGVN *is_IterGVN() { return 0; }
 194 
 195   // Get a previously recorded type for the node n.
 196   // This type must already have been recorded.
 197   // If you want the type of a very new (untransformed) node,
 198   // you must use type_or_null, and test the result for NULL.
 199   const Type* type(const Node* n) const {
 200     assert(n != NULL, "must not be null");
 201     const Type* t = _types.fast_lookup(n->_idx);
 202     assert(t != NULL, "must set before get");
 203     return t;
 204   }
 205   // Get a previously recorded type for the node n,
 206   // or else return NULL if there is none.
 207   const Type* type_or_null(const Node* n) const {
 208     return _types.fast_lookup(n->_idx);
 209   }
 210   // Record a type for a node.
 211   void    set_type(const Node* n, const Type *t) {
 212     assert(t != NULL, "type must not be null");
 213     _types.map(n->_idx, t);
 214   }


 242   // Make an idealized constant, i.e., one of ConINode, ConPNode, ConFNode, etc.
 243   // Same as transform(ConNode::make(t)).
 244   ConNode* makecon(const Type* t);
 245   virtual ConNode* uncached_makecon(const Type* t)  // override in PhaseValues
 246   { ShouldNotCallThis(); return NULL; }
 247 
 248   // Fast int or long constant.  Same as TypeInt::make(i) or TypeLong::make(l).
 249   ConINode* intcon(jint i);
 250   ConLNode* longcon(jlong l);
 251 
 252   // Fast zero or null constant.  Same as makecon(Type::get_zero_type(bt)).
 253   ConNode* zerocon(BasicType bt);
 254 
 255   // Return a node which computes the same function as this node, but
 256   // in a faster or cheaper fashion.
 257   virtual Node *transform( Node *n ) = 0;
 258 
 259   // Return whether two Nodes are equivalent.
 260   // Must not be recursive, since the recursive version is built from this.
 261   // For pessimistic optimizations this is simply pointer equivalence.
 262   bool eqv(const Node* n1, const Node* n2) const;
 263 
 264   // For pessimistic passes, the return type must monotonically narrow.
 265   // For optimistic  passes, the return type must monotonically widen.
 266   // It is possible to get into a "death march" in either type of pass,
 267   // where the types are continually moving but it will take 2**31 or
 268   // more steps to converge.  This doesn't happen on most normal loops.
 269   //
 270   // Here is an example of a deadly loop for an optimistic pass, along
 271   // with a partial trace of inferred types:
 272   //    x = phi(0,x'); L: x' = x+1; if (x' >= 0) goto L;
 273   //    0                 1                join([0..max], 1)
 274   //    [0..1]            [1..2]           join([0..max], [1..2])
 275   //    [0..2]            [1..3]           join([0..max], [1..3])
 276   //      ... ... ...
 277   //    [0..max]          [min]u[1..max]   join([0..max], [min..max])
 278   //    [0..max] ==> fixpoint
 279   // We would have proven, the hard way, that the iteration space is all
 280   // non-negative ints, with the loop terminating due to 32-bit overflow.
 281   //
 282   // Here is the corresponding example for a pessimistic pass:


< prev index next >