annotate src/share/vm/opto/cfgnode.hpp @ 1721:413ad0331a0c

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