aoqi@0: /* aoqi@0: * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: * aoqi@0: */ aoqi@0: aoqi@0: #ifndef SHARE_VM_OPTO_CFGNODE_HPP aoqi@0: #define SHARE_VM_OPTO_CFGNODE_HPP aoqi@0: aoqi@0: #include "opto/multnode.hpp" aoqi@0: #include "opto/node.hpp" aoqi@0: #include "opto/opcodes.hpp" aoqi@0: #include "opto/type.hpp" aoqi@0: aoqi@0: // Portions of code courtesy of Clifford Click aoqi@0: aoqi@0: // Optimization - Graph Style aoqi@0: aoqi@0: class Matcher; aoqi@0: class Node; aoqi@0: class RegionNode; aoqi@0: class TypeNode; aoqi@0: class PhiNode; aoqi@0: class GotoNode; aoqi@0: class MultiNode; aoqi@0: class MultiBranchNode; aoqi@0: class IfNode; aoqi@0: class PCTableNode; aoqi@0: class JumpNode; aoqi@0: class CatchNode; aoqi@0: class NeverBranchNode; aoqi@0: class ProjNode; aoqi@0: class CProjNode; aoqi@0: class IfTrueNode; aoqi@0: class IfFalseNode; aoqi@0: class CatchProjNode; aoqi@0: class JProjNode; aoqi@0: class JumpProjNode; aoqi@0: class SCMemProjNode; aoqi@0: class PhaseIdealLoop; aoqi@0: aoqi@0: //------------------------------RegionNode------------------------------------- aoqi@0: // The class of RegionNodes, which can be mapped to basic blocks in the aoqi@0: // program. Their inputs point to Control sources. PhiNodes (described aoqi@0: // below) have an input point to a RegionNode. Merged data inputs to PhiNodes aoqi@0: // correspond 1-to-1 with RegionNode inputs. The zero input of a PhiNode is aoqi@0: // the RegionNode, and the zero input of the RegionNode is itself. aoqi@0: class RegionNode : public Node { aoqi@0: public: aoqi@0: // Node layout (parallels PhiNode): aoqi@0: enum { Region, // Generally points to self. aoqi@0: Control // Control arcs are [1..len) aoqi@0: }; aoqi@0: aoqi@0: RegionNode( uint required ) : Node(required) { aoqi@0: init_class_id(Class_Region); aoqi@0: init_req(0,this); aoqi@0: } aoqi@0: aoqi@0: Node* is_copy() const { aoqi@0: const Node* r = _in[Region]; aoqi@0: if (r == NULL) aoqi@0: return nonnull_req(); aoqi@0: return NULL; // not a copy! aoqi@0: } aoqi@0: PhiNode* has_phi() const; // returns an arbitrary phi user, or NULL aoqi@0: PhiNode* has_unique_phi() const; // returns the unique phi user, or NULL aoqi@0: // Is this region node unreachable from root? aoqi@0: bool is_unreachable_region(PhaseGVN *phase) const; aoqi@0: virtual int Opcode() const; aoqi@0: virtual bool pinned() const { return (const Node *)in(0) == this; } aoqi@0: virtual bool is_CFG () const { return true; } aoqi@0: virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash aoqi@0: virtual bool depends_only_on_test() const { return false; } aoqi@0: virtual const Type *bottom_type() const { return Type::CONTROL; } aoqi@0: virtual const Type *Value( PhaseTransform *phase ) const; aoqi@0: virtual Node *Identity( PhaseTransform *phase ); aoqi@0: virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); aoqi@0: virtual const RegMask &out_RegMask() const; aoqi@0: bool try_clean_mem_phi(PhaseGVN *phase); aoqi@0: }; aoqi@0: aoqi@0: //------------------------------JProjNode-------------------------------------- aoqi@0: // jump projection for node that produces multiple control-flow paths aoqi@0: class JProjNode : public ProjNode { aoqi@0: public: aoqi@0: JProjNode( Node* ctrl, uint idx ) : ProjNode(ctrl,idx) {} aoqi@0: virtual int Opcode() const; aoqi@0: virtual bool is_CFG() const { return true; } aoqi@0: virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash aoqi@0: virtual const Node* is_block_proj() const { return in(0); } aoqi@0: virtual const RegMask& out_RegMask() const; aoqi@0: virtual uint ideal_reg() const { return 0; } aoqi@0: }; aoqi@0: aoqi@0: //------------------------------PhiNode---------------------------------------- aoqi@0: // PhiNodes merge values from different Control paths. Slot 0 points to the aoqi@0: // controlling RegionNode. Other slots map 1-for-1 with incoming control flow aoqi@0: // paths to the RegionNode. For speed reasons (to avoid another pass) we aoqi@0: // can turn PhiNodes into copys in-place by NULL'ing out their RegionNode aoqi@0: // input in slot 0. aoqi@0: class PhiNode : public TypeNode { aoqi@0: const TypePtr* const _adr_type; // non-null only for Type::MEMORY nodes. aoqi@0: const int _inst_id; // Instance id of the memory slice. aoqi@0: const int _inst_index; // Alias index of the instance memory slice. aoqi@0: // Array elements references have the same alias_idx but different offset. aoqi@0: const int _inst_offset; // Offset of the instance memory slice. aoqi@0: // Size is bigger to hold the _adr_type field. aoqi@0: virtual uint hash() const; // Check the type aoqi@0: virtual uint cmp( const Node &n ) const; aoqi@0: virtual uint size_of() const { return sizeof(*this); } aoqi@0: aoqi@0: // Determine if CMoveNode::is_cmove_id can be used at this join point. aoqi@0: Node* is_cmove_id(PhaseTransform* phase, int true_path); aoqi@0: aoqi@0: public: aoqi@0: // Node layout (parallels RegionNode): aoqi@0: enum { Region, // Control input is the Phi's region. aoqi@0: Input // Input values are [1..len) aoqi@0: }; aoqi@0: aoqi@0: PhiNode( Node *r, const Type *t, const TypePtr* at = NULL, aoqi@0: const int iid = TypeOopPtr::InstanceTop, aoqi@0: const int iidx = Compile::AliasIdxTop, aoqi@0: const int ioffs = Type::OffsetTop ) aoqi@0: : TypeNode(t,r->req()), aoqi@0: _adr_type(at), aoqi@0: _inst_id(iid), aoqi@0: _inst_index(iidx), aoqi@0: _inst_offset(ioffs) aoqi@0: { aoqi@0: init_class_id(Class_Phi); aoqi@0: init_req(0, r); aoqi@0: verify_adr_type(); aoqi@0: } aoqi@0: // create a new phi with in edges matching r and set (initially) to x aoqi@0: static PhiNode* make( Node* r, Node* x ); aoqi@0: // extra type arguments override the new phi's bottom_type and adr_type aoqi@0: static PhiNode* make( Node* r, Node* x, const Type *t, const TypePtr* at = NULL ); aoqi@0: // create a new phi with narrowed memory type aoqi@0: PhiNode* slice_memory(const TypePtr* adr_type) const; aoqi@0: PhiNode* split_out_instance(const TypePtr* at, PhaseIterGVN *igvn) const; aoqi@0: // like make(r, x), but does not initialize the in edges to x aoqi@0: static PhiNode* make_blank( Node* r, Node* x ); aoqi@0: aoqi@0: // Accessors aoqi@0: RegionNode* region() const { Node* r = in(Region); assert(!r || r->is_Region(), ""); return (RegionNode*)r; } aoqi@0: aoqi@0: Node* is_copy() const { aoqi@0: // The node is a real phi if _in[0] is a Region node. aoqi@0: DEBUG_ONLY(const Node* r = _in[Region];) aoqi@0: assert(r != NULL && r->is_Region(), "Not valid control"); aoqi@0: return NULL; // not a copy! aoqi@0: } aoqi@0: aoqi@0: bool is_tripcount() const; aoqi@0: aoqi@0: // Determine a unique non-trivial input, if any. aoqi@0: // Ignore casts if it helps. Return NULL on failure. aoqi@0: Node* unique_input(PhaseTransform *phase); aoqi@0: aoqi@0: // Check for a simple dead loop. aoqi@0: enum LoopSafety { Safe = 0, Unsafe, UnsafeLoop }; aoqi@0: LoopSafety simple_data_loop_check(Node *in) const; aoqi@0: // Is it unsafe data loop? It becomes a dead loop if this phi node removed. aoqi@0: bool is_unsafe_data_reference(Node *in) const; aoqi@0: int is_diamond_phi(bool check_control_only = false) const; aoqi@0: virtual int Opcode() const; aoqi@0: virtual bool pinned() const { return in(0) != 0; } aoqi@0: virtual const TypePtr *adr_type() const { verify_adr_type(true); return _adr_type; } aoqi@0: aoqi@0: const int inst_id() const { return _inst_id; } aoqi@0: const int inst_index() const { return _inst_index; } aoqi@0: const int inst_offset() const { return _inst_offset; } aoqi@0: bool is_same_inst_field(const Type* tp, int id, int index, int offset) { aoqi@0: return type()->basic_type() == tp->basic_type() && aoqi@0: inst_id() == id && aoqi@0: inst_index() == index && aoqi@0: inst_offset() == offset && aoqi@0: type()->higher_equal(tp); aoqi@0: } aoqi@0: aoqi@0: virtual const Type *Value( PhaseTransform *phase ) const; aoqi@0: virtual Node *Identity( PhaseTransform *phase ); aoqi@0: virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); aoqi@0: virtual const RegMask &out_RegMask() const; aoqi@0: virtual const RegMask &in_RegMask(uint) const; aoqi@0: #ifndef PRODUCT aoqi@0: virtual void dump_spec(outputStream *st) const; aoqi@0: #endif aoqi@0: #ifdef ASSERT aoqi@0: void verify_adr_type(VectorSet& visited, const TypePtr* at) const; aoqi@0: void verify_adr_type(bool recursive = false) const; aoqi@0: #else //ASSERT aoqi@0: void verify_adr_type(bool recursive = false) const {} aoqi@0: #endif //ASSERT aoqi@0: }; aoqi@0: aoqi@0: //------------------------------GotoNode--------------------------------------- aoqi@0: // GotoNodes perform direct branches. aoqi@0: class GotoNode : public Node { aoqi@0: public: aoqi@0: GotoNode( Node *control ) : Node(control) {} aoqi@0: virtual int Opcode() const; aoqi@0: virtual bool pinned() const { return true; } aoqi@0: virtual bool is_CFG() const { return true; } aoqi@0: virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash aoqi@0: virtual const Node *is_block_proj() const { return this; } aoqi@0: virtual bool depends_only_on_test() const { return false; } aoqi@0: virtual const Type *bottom_type() const { return Type::CONTROL; } aoqi@0: virtual const Type *Value( PhaseTransform *phase ) const; aoqi@0: virtual Node *Identity( PhaseTransform *phase ); aoqi@0: virtual const RegMask &out_RegMask() const; aoqi@0: }; aoqi@0: aoqi@0: //------------------------------CProjNode-------------------------------------- aoqi@0: // control projection for node that produces multiple control-flow paths aoqi@0: class CProjNode : public ProjNode { aoqi@0: public: aoqi@0: CProjNode( Node *ctrl, uint idx ) : ProjNode(ctrl,idx) {} aoqi@0: virtual int Opcode() const; aoqi@0: virtual bool is_CFG() const { return true; } aoqi@0: virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash aoqi@0: virtual const Node *is_block_proj() const { return in(0); } aoqi@0: virtual const RegMask &out_RegMask() const; aoqi@0: virtual uint ideal_reg() const { return 0; } aoqi@0: }; aoqi@0: aoqi@0: //---------------------------MultiBranchNode----------------------------------- aoqi@0: // This class defines a MultiBranchNode, a MultiNode which yields multiple aoqi@0: // control values. These are distinguished from other types of MultiNodes aoqi@0: // which yield multiple values, but control is always and only projection #0. aoqi@0: class MultiBranchNode : public MultiNode { aoqi@0: public: aoqi@0: MultiBranchNode( uint required ) : MultiNode(required) { aoqi@0: init_class_id(Class_MultiBranch); aoqi@0: } aoqi@0: // returns required number of users to be well formed. aoqi@0: virtual int required_outcnt() const = 0; aoqi@0: }; aoqi@0: aoqi@0: //------------------------------IfNode----------------------------------------- aoqi@0: // Output selected Control, based on a boolean test aoqi@0: class IfNode : public MultiBranchNode { aoqi@0: // Size is bigger to hold the probability field. However, _prob does not aoqi@0: // change the semantics so it does not appear in the hash & cmp functions. aoqi@0: virtual uint size_of() const { return sizeof(*this); } aoqi@0: public: aoqi@0: aoqi@0: // Degrees of branch prediction probability by order of magnitude: aoqi@0: // PROB_UNLIKELY_1e(N) is a 1 in 1eN chance. aoqi@0: // PROB_LIKELY_1e(N) is a 1 - PROB_UNLIKELY_1e(N) aoqi@0: #define PROB_UNLIKELY_MAG(N) (1e- ## N ## f) aoqi@0: #define PROB_LIKELY_MAG(N) (1.0f-PROB_UNLIKELY_MAG(N)) aoqi@0: aoqi@0: // Maximum and minimum branch prediction probabilties aoqi@0: // 1 in 1,000,000 (magnitude 6) aoqi@0: // aoqi@0: // Although PROB_NEVER == PROB_MIN and PROB_ALWAYS == PROB_MAX aoqi@0: // they are used to distinguish different situations: aoqi@0: // aoqi@0: // The name PROB_MAX (PROB_MIN) is for probabilities which correspond to aoqi@0: // very likely (unlikely) but with a concrete possibility of a rare aoqi@0: // contrary case. These constants would be used for pinning aoqi@0: // measurements, and as measures for assertions that have high aoqi@0: // confidence, but some evidence of occasional failure. aoqi@0: // aoqi@0: // The name PROB_ALWAYS (PROB_NEVER) is to stand for situations for which aoqi@0: // there is no evidence at all that the contrary case has ever occurred. aoqi@0: aoqi@0: #define PROB_NEVER PROB_UNLIKELY_MAG(6) aoqi@0: #define PROB_ALWAYS PROB_LIKELY_MAG(6) aoqi@0: aoqi@0: #define PROB_MIN PROB_UNLIKELY_MAG(6) aoqi@0: #define PROB_MAX PROB_LIKELY_MAG(6) aoqi@0: aoqi@0: // Static branch prediction probabilities aoqi@0: // 1 in 10 (magnitude 1) aoqi@0: #define PROB_STATIC_INFREQUENT PROB_UNLIKELY_MAG(1) aoqi@0: #define PROB_STATIC_FREQUENT PROB_LIKELY_MAG(1) aoqi@0: aoqi@0: // Fair probability 50/50 aoqi@0: #define PROB_FAIR (0.5f) aoqi@0: aoqi@0: // Unknown probability sentinel aoqi@0: #define PROB_UNKNOWN (-1.0f) aoqi@0: aoqi@0: // Probability "constructors", to distinguish as a probability any manifest aoqi@0: // constant without a names aoqi@0: #define PROB_LIKELY(x) ((float) (x)) aoqi@0: #define PROB_UNLIKELY(x) (1.0f - (float)(x)) aoqi@0: aoqi@0: // Other probabilities in use, but without a unique name, are documented aoqi@0: // here for lack of a better place: aoqi@0: // aoqi@0: // 1 in 1000 probabilities (magnitude 3): aoqi@0: // threshold for converting to conditional move aoqi@0: // likelihood of null check failure if a null HAS been seen before aoqi@0: // likelihood of slow path taken in library calls aoqi@0: // aoqi@0: // 1 in 10,000 probabilities (magnitude 4): aoqi@0: // threshold for making an uncommon trap probability more extreme aoqi@0: // threshold for for making a null check implicit aoqi@0: // likelihood of needing a gc if eden top moves during an allocation aoqi@0: // likelihood of a predicted call failure aoqi@0: // aoqi@0: // 1 in 100,000 probabilities (magnitude 5): aoqi@0: // threshold for ignoring counts when estimating path frequency aoqi@0: // likelihood of FP clipping failure aoqi@0: // likelihood of catching an exception from a try block aoqi@0: // likelihood of null check failure if a null has NOT been seen before aoqi@0: // aoqi@0: // Magic manifest probabilities such as 0.83, 0.7, ... can be found in aoqi@0: // gen_subtype_check() and catch_inline_exceptions(). aoqi@0: aoqi@0: float _prob; // Probability of true path being taken. aoqi@0: float _fcnt; // Frequency counter aoqi@0: IfNode( Node *control, Node *b, float p, float fcnt ) aoqi@0: : MultiBranchNode(2), _prob(p), _fcnt(fcnt) { aoqi@0: init_class_id(Class_If); aoqi@0: init_req(0,control); aoqi@0: init_req(1,b); aoqi@0: } aoqi@0: virtual int Opcode() const; aoqi@0: virtual bool pinned() const { return true; } aoqi@0: virtual const Type *bottom_type() const { return TypeTuple::IFBOTH; } aoqi@0: virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); aoqi@0: virtual const Type *Value( PhaseTransform *phase ) const; aoqi@0: virtual int required_outcnt() const { return 2; } aoqi@0: virtual const RegMask &out_RegMask() const; aoqi@0: void dominated_by(Node* prev_dom, PhaseIterGVN* igvn); aoqi@0: int is_range_check(Node* &range, Node* &index, jint &offset); aoqi@0: Node* fold_compares(PhaseGVN* phase); aoqi@0: static Node* up_one_dom(Node* curr, bool linear_only = false); aoqi@0: aoqi@0: // Takes the type of val and filters it through the test represented aoqi@0: // by if_proj and returns a more refined type if one is produced. aoqi@0: // Returns NULL is it couldn't improve the type. aoqi@0: static const TypeInt* filtered_int_type(PhaseGVN* phase, Node* val, Node* if_proj); aoqi@0: aoqi@0: #ifndef PRODUCT aoqi@0: virtual void dump_spec(outputStream *st) const; aoqi@0: #endif aoqi@0: }; aoqi@0: aoqi@0: class IfTrueNode : public CProjNode { aoqi@0: public: aoqi@0: IfTrueNode( IfNode *ifnode ) : CProjNode(ifnode,1) { aoqi@0: init_class_id(Class_IfTrue); aoqi@0: } aoqi@0: virtual int Opcode() const; aoqi@0: virtual Node *Identity( PhaseTransform *phase ); aoqi@0: }; aoqi@0: aoqi@0: class IfFalseNode : public CProjNode { aoqi@0: public: aoqi@0: IfFalseNode( IfNode *ifnode ) : CProjNode(ifnode,0) { aoqi@0: init_class_id(Class_IfFalse); aoqi@0: } aoqi@0: virtual int Opcode() const; aoqi@0: virtual Node *Identity( PhaseTransform *phase ); aoqi@0: }; aoqi@0: aoqi@0: aoqi@0: //------------------------------PCTableNode------------------------------------ aoqi@0: // Build an indirect branch table. Given a control and a table index, aoqi@0: // control is passed to the Projection matching the table index. Used to aoqi@0: // implement switch statements and exception-handling capabilities. aoqi@0: // Undefined behavior if passed-in index is not inside the table. aoqi@0: class PCTableNode : public MultiBranchNode { aoqi@0: virtual uint hash() const; // Target count; table size aoqi@0: virtual uint cmp( const Node &n ) const; aoqi@0: virtual uint size_of() const { return sizeof(*this); } aoqi@0: aoqi@0: public: aoqi@0: const uint _size; // Number of targets aoqi@0: aoqi@0: PCTableNode( Node *ctrl, Node *idx, uint size ) : MultiBranchNode(2), _size(size) { aoqi@0: init_class_id(Class_PCTable); aoqi@0: init_req(0, ctrl); aoqi@0: init_req(1, idx); aoqi@0: } aoqi@0: virtual int Opcode() const; aoqi@0: virtual const Type *Value( PhaseTransform *phase ) const; aoqi@0: virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); aoqi@0: virtual const Type *bottom_type() const; aoqi@0: virtual bool pinned() const { return true; } aoqi@0: virtual int required_outcnt() const { return _size; } aoqi@0: }; aoqi@0: aoqi@0: //------------------------------JumpNode--------------------------------------- aoqi@0: // Indirect branch. Uses PCTable above to implement a switch statement. aoqi@0: // It emits as a table load and local branch. aoqi@0: class JumpNode : public PCTableNode { aoqi@0: public: aoqi@0: JumpNode( Node* control, Node* switch_val, uint size) : PCTableNode(control, switch_val, size) { aoqi@0: init_class_id(Class_Jump); aoqi@0: } aoqi@0: virtual int Opcode() const; aoqi@0: virtual const RegMask& out_RegMask() const; aoqi@0: virtual const Node* is_block_proj() const { return this; } aoqi@0: }; aoqi@0: aoqi@0: class JumpProjNode : public JProjNode { aoqi@0: virtual uint hash() const; aoqi@0: virtual uint cmp( const Node &n ) const; aoqi@0: virtual uint size_of() const { return sizeof(*this); } aoqi@0: aoqi@0: private: aoqi@0: const int _dest_bci; aoqi@0: const uint _proj_no; aoqi@0: const int _switch_val; aoqi@0: public: aoqi@0: JumpProjNode(Node* jumpnode, uint proj_no, int dest_bci, int switch_val) aoqi@0: : JProjNode(jumpnode, proj_no), _dest_bci(dest_bci), _proj_no(proj_no), _switch_val(switch_val) { aoqi@0: init_class_id(Class_JumpProj); aoqi@0: } aoqi@0: aoqi@0: virtual int Opcode() const; aoqi@0: virtual const Type* bottom_type() const { return Type::CONTROL; } aoqi@0: int dest_bci() const { return _dest_bci; } aoqi@0: int switch_val() const { return _switch_val; } aoqi@0: uint proj_no() const { return _proj_no; } aoqi@0: #ifndef PRODUCT aoqi@0: virtual void dump_spec(outputStream *st) const; aoqi@0: #endif aoqi@0: }; aoqi@0: aoqi@0: //------------------------------CatchNode-------------------------------------- aoqi@0: // Helper node to fork exceptions. "Catch" catches any exceptions thrown by aoqi@0: // a just-prior call. Looks like a PCTableNode but emits no code - just the aoqi@0: // table. The table lookup and branch is implemented by RethrowNode. aoqi@0: class CatchNode : public PCTableNode { aoqi@0: public: aoqi@0: CatchNode( Node *ctrl, Node *idx, uint size ) : PCTableNode(ctrl,idx,size){ aoqi@0: init_class_id(Class_Catch); aoqi@0: } aoqi@0: virtual int Opcode() const; aoqi@0: virtual const Type *Value( PhaseTransform *phase ) const; aoqi@0: }; aoqi@0: aoqi@0: // CatchProjNode controls which exception handler is targetted after a call. aoqi@0: // It is passed in the bci of the target handler, or no_handler_bci in case aoqi@0: // the projection doesn't lead to an exception handler. aoqi@0: class CatchProjNode : public CProjNode { aoqi@0: virtual uint hash() const; aoqi@0: virtual uint cmp( const Node &n ) const; aoqi@0: virtual uint size_of() const { return sizeof(*this); } aoqi@0: aoqi@0: private: aoqi@0: const int _handler_bci; aoqi@0: aoqi@0: public: aoqi@0: enum { aoqi@0: fall_through_index = 0, // the fall through projection index aoqi@0: catch_all_index = 1, // the projection index for catch-alls aoqi@0: no_handler_bci = -1 // the bci for fall through or catch-all projs aoqi@0: }; aoqi@0: aoqi@0: CatchProjNode(Node* catchnode, uint proj_no, int handler_bci) aoqi@0: : CProjNode(catchnode, proj_no), _handler_bci(handler_bci) { aoqi@0: init_class_id(Class_CatchProj); aoqi@0: assert(proj_no != fall_through_index || handler_bci < 0, "fall through case must have bci < 0"); aoqi@0: } aoqi@0: aoqi@0: virtual int Opcode() const; aoqi@0: virtual Node *Identity( PhaseTransform *phase ); aoqi@0: virtual const Type *bottom_type() const { return Type::CONTROL; } aoqi@0: int handler_bci() const { return _handler_bci; } aoqi@0: bool is_handler_proj() const { return _handler_bci >= 0; } aoqi@0: #ifndef PRODUCT aoqi@0: virtual void dump_spec(outputStream *st) const; aoqi@0: #endif aoqi@0: }; aoqi@0: aoqi@0: aoqi@0: //---------------------------------CreateExNode-------------------------------- aoqi@0: // Helper node to create the exception coming back from a call aoqi@0: class CreateExNode : public TypeNode { aoqi@0: public: aoqi@0: CreateExNode(const Type* t, Node* control, Node* i_o) : TypeNode(t, 2) { aoqi@0: init_req(0, control); aoqi@0: init_req(1, i_o); aoqi@0: } aoqi@0: virtual int Opcode() const; aoqi@0: virtual Node *Identity( PhaseTransform *phase ); aoqi@0: virtual bool pinned() const { return true; } aoqi@0: uint match_edge(uint idx) const { return 0; } aoqi@0: virtual uint ideal_reg() const { return Op_RegP; } aoqi@0: }; aoqi@0: aoqi@0: //------------------------------NeverBranchNode------------------------------- aoqi@0: // The never-taken branch. Used to give the appearance of exiting infinite aoqi@0: // loops to those algorithms that like all paths to be reachable. Encodes aoqi@0: // empty. aoqi@0: class NeverBranchNode : public MultiBranchNode { aoqi@0: public: aoqi@0: NeverBranchNode( Node *ctrl ) : MultiBranchNode(1) { init_req(0,ctrl); } aoqi@0: virtual int Opcode() const; aoqi@0: virtual bool pinned() const { return true; }; aoqi@0: virtual const Type *bottom_type() const { return TypeTuple::IFBOTH; } aoqi@0: virtual const Type *Value( PhaseTransform *phase ) const; aoqi@0: virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); aoqi@0: virtual int required_outcnt() const { return 2; } aoqi@0: virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { } aoqi@0: virtual uint size(PhaseRegAlloc *ra_) const { return 0; } aoqi@0: #ifndef PRODUCT aoqi@0: virtual void format( PhaseRegAlloc *, outputStream *st ) const; aoqi@0: #endif aoqi@0: }; aoqi@0: aoqi@0: #endif // SHARE_VM_OPTO_CFGNODE_HPP