annotate src/share/vm/opto/cfgnode.hpp @ 196:d1605aabd0a1

6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
author xdono
date Wed, 02 Jul 2008 12:55:16 -0700
parents e0bd2e08e3d0
children 9c2ecc2ffb12
rev   line source
duke@0 1 /*
xdono@196 2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
duke@0 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 21 * have any questions.
duke@0 22 *
duke@0 23 */
duke@0 24
duke@0 25 // Portions of code courtesy of Clifford Click
duke@0 26
duke@0 27 // Optimization - Graph Style
duke@0 28
duke@0 29 class Matcher;
duke@0 30 class Node;
duke@0 31 class RegionNode;
duke@0 32 class TypeNode;
duke@0 33 class PhiNode;
duke@0 34 class GotoNode;
duke@0 35 class MultiNode;
duke@0 36 class MultiBranchNode;
duke@0 37 class IfNode;
duke@0 38 class PCTableNode;
duke@0 39 class JumpNode;
duke@0 40 class CatchNode;
duke@0 41 class NeverBranchNode;
duke@0 42 class ProjNode;
duke@0 43 class CProjNode;
duke@0 44 class IfTrueNode;
duke@0 45 class IfFalseNode;
duke@0 46 class CatchProjNode;
duke@0 47 class JProjNode;
duke@0 48 class JumpProjNode;
duke@0 49 class SCMemProjNode;
duke@0 50 class PhaseIdealLoop;
duke@0 51
duke@0 52 //------------------------------RegionNode-------------------------------------
duke@0 53 // The class of RegionNodes, which can be mapped to basic blocks in the
duke@0 54 // program. Their inputs point to Control sources. PhiNodes (described
duke@0 55 // below) have an input point to a RegionNode. Merged data inputs to PhiNodes
duke@0 56 // correspond 1-to-1 with RegionNode inputs. The zero input of a PhiNode is
duke@0 57 // the RegionNode, and the zero input of the RegionNode is itself.
duke@0 58 class RegionNode : public Node {
duke@0 59 public:
duke@0 60 // Node layout (parallels PhiNode):
duke@0 61 enum { Region, // Generally points to self.
duke@0 62 Control // Control arcs are [1..len)
duke@0 63 };
duke@0 64
duke@0 65 RegionNode( uint required ) : Node(required) {
duke@0 66 init_class_id(Class_Region);
duke@0 67 init_req(0,this);
duke@0 68 }
duke@0 69
duke@0 70 Node* is_copy() const {
duke@0 71 const Node* r = _in[Region];
duke@0 72 if (r == NULL)
duke@0 73 return nonnull_req();
duke@0 74 return NULL; // not a copy!
duke@0 75 }
duke@0 76 PhiNode* has_phi() const; // returns an arbitrary phi user, or NULL
duke@0 77 PhiNode* has_unique_phi() const; // returns the unique phi user, or NULL
duke@0 78 // Is this region node unreachable from root?
duke@0 79 bool is_unreachable_region(PhaseGVN *phase) const;
duke@0 80 virtual int Opcode() const;
duke@0 81 virtual bool pinned() const { return (const Node *)in(0) == this; }
duke@0 82 virtual bool is_CFG () const { return true; }
duke@0 83 virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash
duke@0 84 virtual bool depends_only_on_test() const { return false; }
duke@0 85 virtual const Type *bottom_type() const { return Type::CONTROL; }
duke@0 86 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 87 virtual Node *Identity( PhaseTransform *phase );
duke@0 88 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 89 virtual const RegMask &out_RegMask() const;
duke@0 90 };
duke@0 91
duke@0 92 //------------------------------JProjNode--------------------------------------
duke@0 93 // jump projection for node that produces multiple control-flow paths
duke@0 94 class JProjNode : public ProjNode {
duke@0 95 public:
duke@0 96 JProjNode( Node* ctrl, uint idx ) : ProjNode(ctrl,idx) {}
duke@0 97 virtual int Opcode() const;
duke@0 98 virtual bool is_CFG() const { return true; }
duke@0 99 virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash
duke@0 100 virtual const Node* is_block_proj() const { return in(0); }
duke@0 101 virtual const RegMask& out_RegMask() const;
duke@0 102 virtual uint ideal_reg() const { return 0; }
duke@0 103 };
duke@0 104
duke@0 105 //------------------------------PhiNode----------------------------------------
duke@0 106 // PhiNodes merge values from different Control paths. Slot 0 points to the
duke@0 107 // controlling RegionNode. Other slots map 1-for-1 with incoming control flow
duke@0 108 // paths to the RegionNode. For speed reasons (to avoid another pass) we
duke@0 109 // can turn PhiNodes into copys in-place by NULL'ing out their RegionNode
duke@0 110 // input in slot 0.
duke@0 111 class PhiNode : public TypeNode {
duke@0 112 const TypePtr* const _adr_type; // non-null only for Type::MEMORY nodes.
kvn@64 113 const int _inst_id; // Instance id of the memory slice.
kvn@64 114 const int _inst_index; // Alias index of the instance memory slice.
kvn@64 115 // Array elements references have the same alias_idx but different offset.
kvn@64 116 const int _inst_offset; // Offset of the instance memory slice.
duke@0 117 // Size is bigger to hold the _adr_type field.
duke@0 118 virtual uint hash() const; // Check the type
duke@0 119 virtual uint cmp( const Node &n ) const;
duke@0 120 virtual uint size_of() const { return sizeof(*this); }
duke@0 121
duke@0 122 // Determine if CMoveNode::is_cmove_id can be used at this join point.
duke@0 123 Node* is_cmove_id(PhaseTransform* phase, int true_path);
duke@0 124
duke@0 125 public:
duke@0 126 // Node layout (parallels RegionNode):
duke@0 127 enum { Region, // Control input is the Phi's region.
duke@0 128 Input // Input values are [1..len)
duke@0 129 };
duke@0 130
kvn@64 131 PhiNode( Node *r, const Type *t, const TypePtr* at = NULL,
kvn@64 132 const int iid = TypeOopPtr::UNKNOWN_INSTANCE,
kvn@64 133 const int iidx = Compile::AliasIdxTop,
kvn@64 134 const int ioffs = Type::OffsetTop )
kvn@64 135 : TypeNode(t,r->req()),
kvn@64 136 _adr_type(at),
kvn@64 137 _inst_id(iid),
kvn@64 138 _inst_index(iidx),
kvn@64 139 _inst_offset(ioffs)
kvn@64 140 {
duke@0 141 init_class_id(Class_Phi);
duke@0 142 init_req(0, r);
duke@0 143 verify_adr_type();
duke@0 144 }
duke@0 145 // create a new phi with in edges matching r and set (initially) to x
duke@0 146 static PhiNode* make( Node* r, Node* x );
duke@0 147 // extra type arguments override the new phi's bottom_type and adr_type
duke@0 148 static PhiNode* make( Node* r, Node* x, const Type *t, const TypePtr* at = NULL );
duke@0 149 // create a new phi with narrowed memory type
duke@0 150 PhiNode* slice_memory(const TypePtr* adr_type) const;
kvn@74 151 PhiNode* split_out_instance(const TypePtr* at, PhaseIterGVN *igvn) const;
duke@0 152 // like make(r, x), but does not initialize the in edges to x
duke@0 153 static PhiNode* make_blank( Node* r, Node* x );
duke@0 154
duke@0 155 // Accessors
duke@0 156 RegionNode* region() const { Node* r = in(Region); assert(!r || r->is_Region(), ""); return (RegionNode*)r; }
duke@0 157
duke@0 158 Node* is_copy() const {
duke@0 159 // The node is a real phi if _in[0] is a Region node.
duke@0 160 DEBUG_ONLY(const Node* r = _in[Region];)
duke@0 161 assert(r != NULL && r->is_Region(), "Not valid control");
duke@0 162 return NULL; // not a copy!
duke@0 163 }
duke@0 164
kvn@64 165 // Determine a unique non-trivial input, if any.
kvn@64 166 // Ignore casts if it helps. Return NULL on failure.
kvn@64 167 Node* unique_input(PhaseTransform *phase);
kvn@64 168
duke@0 169 // Check for a simple dead loop.
duke@0 170 enum LoopSafety { Safe = 0, Unsafe, UnsafeLoop };
duke@0 171 LoopSafety simple_data_loop_check(Node *in) const;
duke@0 172 // Is it unsafe data loop? It becomes a dead loop if this phi node removed.
duke@0 173 bool is_unsafe_data_reference(Node *in) const;
duke@0 174 int is_diamond_phi() const;
duke@0 175 virtual int Opcode() const;
duke@0 176 virtual bool pinned() const { return in(0) != 0; }
duke@0 177 virtual const TypePtr *adr_type() const { verify_adr_type(true); return _adr_type; }
kvn@64 178
kvn@64 179 const int inst_id() const { return _inst_id; }
kvn@64 180 const int inst_index() const { return _inst_index; }
kvn@64 181 const int inst_offset() const { return _inst_offset; }
kvn@64 182 bool is_same_inst_field(const Type* tp, int id, int index, int offset) {
kvn@64 183 return type()->basic_type() == tp->basic_type() &&
kvn@64 184 inst_id() == id &&
kvn@64 185 inst_index() == index &&
kvn@64 186 inst_offset() == offset &&
kvn@64 187 type()->higher_equal(tp);
kvn@64 188 }
kvn@64 189
duke@0 190 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 191 virtual Node *Identity( PhaseTransform *phase );
duke@0 192 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 193 virtual const RegMask &out_RegMask() const;
duke@0 194 virtual const RegMask &in_RegMask(uint) const;
duke@0 195 #ifndef PRODUCT
duke@0 196 virtual void dump_spec(outputStream *st) const;
duke@0 197 #endif
duke@0 198 #ifdef ASSERT
duke@0 199 void verify_adr_type(VectorSet& visited, const TypePtr* at) const;
duke@0 200 void verify_adr_type(bool recursive = false) const;
duke@0 201 #else //ASSERT
duke@0 202 void verify_adr_type(bool recursive = false) const {}
duke@0 203 #endif //ASSERT
duke@0 204 };
duke@0 205
duke@0 206 //------------------------------GotoNode---------------------------------------
duke@0 207 // GotoNodes perform direct branches.
duke@0 208 class GotoNode : public Node {
duke@0 209 public:
duke@0 210 GotoNode( Node *control ) : Node(control) {
duke@0 211 init_flags(Flag_is_Goto);
duke@0 212 }
duke@0 213 virtual int Opcode() const;
duke@0 214 virtual bool pinned() const { return true; }
duke@0 215 virtual bool is_CFG() const { return true; }
duke@0 216 virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash
duke@0 217 virtual const Node *is_block_proj() const { return this; }
duke@0 218 virtual bool depends_only_on_test() const { return false; }
duke@0 219 virtual const Type *bottom_type() const { return Type::CONTROL; }
duke@0 220 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 221 virtual Node *Identity( PhaseTransform *phase );
duke@0 222 virtual const RegMask &out_RegMask() const;
duke@0 223 };
duke@0 224
duke@0 225 //------------------------------CProjNode--------------------------------------
duke@0 226 // control projection for node that produces multiple control-flow paths
duke@0 227 class CProjNode : public ProjNode {
duke@0 228 public:
duke@0 229 CProjNode( Node *ctrl, uint idx ) : ProjNode(ctrl,idx) {}
duke@0 230 virtual int Opcode() const;
duke@0 231 virtual bool is_CFG() const { return true; }
duke@0 232 virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash
duke@0 233 virtual const Node *is_block_proj() const { return in(0); }
duke@0 234 virtual const RegMask &out_RegMask() const;
duke@0 235 virtual uint ideal_reg() const { return 0; }
duke@0 236 };
duke@0 237
duke@0 238 //---------------------------MultiBranchNode-----------------------------------
duke@0 239 // This class defines a MultiBranchNode, a MultiNode which yields multiple
duke@0 240 // control values. These are distinguished from other types of MultiNodes
duke@0 241 // which yield multiple values, but control is always and only projection #0.
duke@0 242 class MultiBranchNode : public MultiNode {
duke@0 243 public:
duke@0 244 MultiBranchNode( uint required ) : MultiNode(required) {
duke@0 245 init_class_id(Class_MultiBranch);
duke@0 246 }
never@127 247 // returns required number of users to be well formed.
never@127 248 virtual int required_outcnt() const = 0;
duke@0 249 };
duke@0 250
duke@0 251 //------------------------------IfNode-----------------------------------------
duke@0 252 // Output selected Control, based on a boolean test
duke@0 253 class IfNode : public MultiBranchNode {
duke@0 254 // Size is bigger to hold the probability field. However, _prob does not
duke@0 255 // change the semantics so it does not appear in the hash & cmp functions.
duke@0 256 virtual uint size_of() const { return sizeof(*this); }
duke@0 257 public:
duke@0 258
duke@0 259 // Degrees of branch prediction probability by order of magnitude:
duke@0 260 // PROB_UNLIKELY_1e(N) is a 1 in 1eN chance.
duke@0 261 // PROB_LIKELY_1e(N) is a 1 - PROB_UNLIKELY_1e(N)
duke@0 262 #define PROB_UNLIKELY_MAG(N) (1e- ## N ## f)
duke@0 263 #define PROB_LIKELY_MAG(N) (1.0f-PROB_UNLIKELY_MAG(N))
duke@0 264
duke@0 265 // Maximum and minimum branch prediction probabilties
duke@0 266 // 1 in 1,000,000 (magnitude 6)
duke@0 267 //
duke@0 268 // Although PROB_NEVER == PROB_MIN and PROB_ALWAYS == PROB_MAX
duke@0 269 // they are used to distinguish different situations:
duke@0 270 //
duke@0 271 // The name PROB_MAX (PROB_MIN) is for probabilities which correspond to
duke@0 272 // very likely (unlikely) but with a concrete possibility of a rare
duke@0 273 // contrary case. These constants would be used for pinning
duke@0 274 // measurements, and as measures for assertions that have high
duke@0 275 // confidence, but some evidence of occasional failure.
duke@0 276 //
duke@0 277 // The name PROB_ALWAYS (PROB_NEVER) is to stand for situations for which
duke@0 278 // there is no evidence at all that the contrary case has ever occurred.
duke@0 279
duke@0 280 #define PROB_NEVER PROB_UNLIKELY_MAG(6)
duke@0 281 #define PROB_ALWAYS PROB_LIKELY_MAG(6)
duke@0 282
duke@0 283 #define PROB_MIN PROB_UNLIKELY_MAG(6)
duke@0 284 #define PROB_MAX PROB_LIKELY_MAG(6)
duke@0 285
duke@0 286 // Static branch prediction probabilities
duke@0 287 // 1 in 10 (magnitude 1)
duke@0 288 #define PROB_STATIC_INFREQUENT PROB_UNLIKELY_MAG(1)
duke@0 289 #define PROB_STATIC_FREQUENT PROB_LIKELY_MAG(1)
duke@0 290
duke@0 291 // Fair probability 50/50
duke@0 292 #define PROB_FAIR (0.5f)
duke@0 293
duke@0 294 // Unknown probability sentinel
duke@0 295 #define PROB_UNKNOWN (-1.0f)
duke@0 296
duke@0 297 // Probability "constructors", to distinguish as a probability any manifest
duke@0 298 // constant without a names
duke@0 299 #define PROB_LIKELY(x) ((float) (x))
duke@0 300 #define PROB_UNLIKELY(x) (1.0f - (float)(x))
duke@0 301
duke@0 302 // Other probabilities in use, but without a unique name, are documented
duke@0 303 // here for lack of a better place:
duke@0 304 //
duke@0 305 // 1 in 1000 probabilities (magnitude 3):
duke@0 306 // threshold for converting to conditional move
duke@0 307 // likelihood of null check failure if a null HAS been seen before
duke@0 308 // likelihood of slow path taken in library calls
duke@0 309 //
duke@0 310 // 1 in 10,000 probabilities (magnitude 4):
duke@0 311 // threshold for making an uncommon trap probability more extreme
duke@0 312 // threshold for for making a null check implicit
duke@0 313 // likelihood of needing a gc if eden top moves during an allocation
duke@0 314 // likelihood of a predicted call failure
duke@0 315 //
duke@0 316 // 1 in 100,000 probabilities (magnitude 5):
duke@0 317 // threshold for ignoring counts when estimating path frequency
duke@0 318 // likelihood of FP clipping failure
duke@0 319 // likelihood of catching an exception from a try block
duke@0 320 // likelihood of null check failure if a null has NOT been seen before
duke@0 321 //
duke@0 322 // Magic manifest probabilities such as 0.83, 0.7, ... can be found in
duke@0 323 // gen_subtype_check() and catch_inline_exceptions().
duke@0 324
duke@0 325 float _prob; // Probability of true path being taken.
duke@0 326 float _fcnt; // Frequency counter
duke@0 327 IfNode( Node *control, Node *b, float p, float fcnt )
duke@0 328 : MultiBranchNode(2), _prob(p), _fcnt(fcnt) {
duke@0 329 init_class_id(Class_If);
duke@0 330 init_req(0,control);
duke@0 331 init_req(1,b);
duke@0 332 }
duke@0 333 virtual int Opcode() const;
duke@0 334 virtual bool pinned() const { return true; }
duke@0 335 virtual const Type *bottom_type() const { return TypeTuple::IFBOTH; }
duke@0 336 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 337 virtual const Type *Value( PhaseTransform *phase ) const;
never@127 338 virtual int required_outcnt() const { return 2; }
duke@0 339 virtual const RegMask &out_RegMask() const;
duke@0 340 void dominated_by(Node* prev_dom, PhaseIterGVN* igvn);
duke@0 341 int is_range_check(Node* &range, Node* &index, jint &offset);
never@17 342 Node* fold_compares(PhaseGVN* phase);
duke@0 343 static Node* up_one_dom(Node* curr, bool linear_only = false);
duke@0 344
never@17 345 // Takes the type of val and filters it through the test represented
never@17 346 // by if_proj and returns a more refined type if one is produced.
never@17 347 // Returns NULL is it couldn't improve the type.
never@17 348 static const TypeInt* filtered_int_type(PhaseGVN* phase, Node* val, Node* if_proj);
never@17 349
duke@0 350 #ifndef PRODUCT
duke@0 351 virtual void dump_spec(outputStream *st) const;
duke@0 352 #endif
duke@0 353 };
duke@0 354
duke@0 355 class IfTrueNode : public CProjNode {
duke@0 356 public:
duke@0 357 IfTrueNode( IfNode *ifnode ) : CProjNode(ifnode,1) {
duke@0 358 init_class_id(Class_IfTrue);
duke@0 359 }
duke@0 360 virtual int Opcode() const;
duke@0 361 virtual Node *Identity( PhaseTransform *phase );
duke@0 362 };
duke@0 363
duke@0 364 class IfFalseNode : public CProjNode {
duke@0 365 public:
duke@0 366 IfFalseNode( IfNode *ifnode ) : CProjNode(ifnode,0) {
duke@0 367 init_class_id(Class_IfFalse);
duke@0 368 }
duke@0 369 virtual int Opcode() const;
duke@0 370 virtual Node *Identity( PhaseTransform *phase );
duke@0 371 };
duke@0 372
duke@0 373
duke@0 374 //------------------------------PCTableNode------------------------------------
duke@0 375 // Build an indirect branch table. Given a control and a table index,
duke@0 376 // control is passed to the Projection matching the table index. Used to
duke@0 377 // implement switch statements and exception-handling capabilities.
duke@0 378 // Undefined behavior if passed-in index is not inside the table.
duke@0 379 class PCTableNode : public MultiBranchNode {
duke@0 380 virtual uint hash() const; // Target count; table size
duke@0 381 virtual uint cmp( const Node &n ) const;
duke@0 382 virtual uint size_of() const { return sizeof(*this); }
duke@0 383
duke@0 384 public:
duke@0 385 const uint _size; // Number of targets
duke@0 386
duke@0 387 PCTableNode( Node *ctrl, Node *idx, uint size ) : MultiBranchNode(2), _size(size) {
duke@0 388 init_class_id(Class_PCTable);
duke@0 389 init_req(0, ctrl);
duke@0 390 init_req(1, idx);
duke@0 391 }
duke@0 392 virtual int Opcode() const;
duke@0 393 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 394 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
duke@0 395 virtual const Type *bottom_type() const;
duke@0 396 virtual bool pinned() const { return true; }
never@127 397 virtual int required_outcnt() const { return _size; }
duke@0 398 };
duke@0 399
duke@0 400 //------------------------------JumpNode---------------------------------------
duke@0 401 // Indirect branch. Uses PCTable above to implement a switch statement.
duke@0 402 // It emits as a table load and local branch.
duke@0 403 class JumpNode : public PCTableNode {
duke@0 404 public:
duke@0 405 JumpNode( Node* control, Node* switch_val, uint size) : PCTableNode(control, switch_val, size) {
duke@0 406 init_class_id(Class_Jump);
duke@0 407 }
duke@0 408 virtual int Opcode() const;
duke@0 409 virtual const RegMask& out_RegMask() const;
duke@0 410 virtual const Node* is_block_proj() const { return this; }
duke@0 411 };
duke@0 412
duke@0 413 class JumpProjNode : public JProjNode {
duke@0 414 virtual uint hash() const;
duke@0 415 virtual uint cmp( const Node &n ) const;
duke@0 416 virtual uint size_of() const { return sizeof(*this); }
duke@0 417
duke@0 418 private:
duke@0 419 const int _dest_bci;
duke@0 420 const uint _proj_no;
duke@0 421 const int _switch_val;
duke@0 422 public:
duke@0 423 JumpProjNode(Node* jumpnode, uint proj_no, int dest_bci, int switch_val)
duke@0 424 : JProjNode(jumpnode, proj_no), _dest_bci(dest_bci), _proj_no(proj_no), _switch_val(switch_val) {
duke@0 425 init_class_id(Class_JumpProj);
duke@0 426 }
duke@0 427
duke@0 428 virtual int Opcode() const;
duke@0 429 virtual const Type* bottom_type() const { return Type::CONTROL; }
duke@0 430 int dest_bci() const { return _dest_bci; }
duke@0 431 int switch_val() const { return _switch_val; }
duke@0 432 uint proj_no() const { return _proj_no; }
duke@0 433 #ifndef PRODUCT
duke@0 434 virtual void dump_spec(outputStream *st) const;
duke@0 435 #endif
duke@0 436 };
duke@0 437
duke@0 438 //------------------------------CatchNode--------------------------------------
duke@0 439 // Helper node to fork exceptions. "Catch" catches any exceptions thrown by
duke@0 440 // a just-prior call. Looks like a PCTableNode but emits no code - just the
duke@0 441 // table. The table lookup and branch is implemented by RethrowNode.
duke@0 442 class CatchNode : public PCTableNode {
duke@0 443 public:
duke@0 444 CatchNode( Node *ctrl, Node *idx, uint size ) : PCTableNode(ctrl,idx,size){
duke@0 445 init_class_id(Class_Catch);
duke@0 446 }
duke@0 447 virtual int Opcode() const;
duke@0 448 virtual const Type *Value( PhaseTransform *phase ) const;
duke@0 449 };
duke@0 450
duke@0 451 // CatchProjNode controls which exception handler is targetted after a call.
duke@0 452 // It is passed in the bci of the target handler, or no_handler_bci in case
duke@0 453 // the projection doesn't lead to an exception handler.
duke@0 454 class CatchProjNode : public CProjNode {
duke@0 455 virtual uint hash() const;
duke@0 456 virtual uint cmp( const Node &n ) const;
duke@0 457 virtual uint size_of() const { return sizeof(*this); }
duke@0 458
duke@0 459 private:
duke@0 460 const int _handler_bci;
duke@0 461
duke@0 462 public:
duke@0 463 enum {
duke@0 464 fall_through_index = 0, // the fall through projection index
duke@0 465 catch_all_index = 1, // the projection index for catch-alls
duke@0 466 no_handler_bci = -1 // the bci for fall through or catch-all projs
duke@0 467 };
duke@0 468
duke@0 469 CatchProjNode(Node* catchnode, uint proj_no, int handler_bci)
duke@0 470 : CProjNode(catchnode, proj_no), _handler_bci(handler_bci) {
duke@0 471 init_class_id(Class_CatchProj);
duke@0 472 assert(proj_no != fall_through_index || handler_bci < 0, "fall through case must have bci < 0");
duke@0 473 }
duke@0 474
duke@0 475 virtual int Opcode() const;
duke@0 476 virtual Node *Identity( PhaseTransform *phase );
duke@0 477 virtual const Type *bottom_type() const { return Type::CONTROL; }
duke@0 478 int handler_bci() const { return _handler_bci; }
duke@0 479 bool is_handler_proj() const { return _handler_bci >= 0; }
duke@0 480 #ifndef PRODUCT
duke@0 481 virtual void dump_spec(outputStream *st) const;
duke@0 482 #endif
duke@0 483 };
duke@0 484
duke@0 485
duke@0 486 //---------------------------------CreateExNode--------------------------------
duke@0 487 // Helper node to create the exception coming back from a call
duke@0 488 class CreateExNode : public TypeNode {
duke@0 489 public:
duke@0 490 CreateExNode(const Type* t, Node* control, Node* i_o) : TypeNode(t, 2) {
duke@0 491 init_req(0, control);
duke@0 492 init_req(1, i_o);
duke@0 493 }
duke@0 494 virtual int Opcode() const;
duke@0 495 virtual Node *Identity( PhaseTransform *phase );
duke@0 496 virtual bool pinned() const { return true; }
duke@0 497 uint match_edge(uint idx) const { return 0; }
duke@0 498 virtual uint ideal_reg() const { return Op_RegP; }
duke@0 499 };
duke@0 500
duke@0 501 //------------------------------NeverBranchNode-------------------------------
duke@0 502 // The never-taken branch. Used to give the appearance of exiting infinite
duke@0 503 // loops to those algorithms that like all paths to be reachable. Encodes
duke@0 504 // empty.
duke@0 505 class NeverBranchNode : public MultiBranchNode {
duke@0 506 public:
duke@0 507 NeverBranchNode( Node *ctrl ) : MultiBranchNode(1) { init_req(0,ctrl); }
duke@0 508 virtual int Opcode() const;
duke@0 509 virtual bool pinned() const { return true; };
duke@0 510 virtual const Type *bottom_type() const { return TypeTuple::IFBOTH; }
never@127 511 virtual const Type *Value( PhaseTransform *phase ) const;
never@127 512 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
never@127 513 virtual int required_outcnt() const { return 2; }
duke@0 514 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { }
duke@0 515 virtual uint size(PhaseRegAlloc *ra_) const { return 0; }
duke@0 516 #ifndef PRODUCT
duke@0 517 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
duke@0 518 #endif
duke@0 519 };