Mercurial > hg > truffle
annotate src/share/vm/opto/connode.hpp @ 163:885ed790ecf0
6695810: null oop passed to encode_heap_oop_not_null
Summary: fix several problems in C2 related to Escape Analysis and Compressed Oops.
Reviewed-by: never, jrose
author | kvn |
---|---|
date | Wed, 21 May 2008 10:45:07 -0700 |
parents | 72f4a668df19 |
children | c436414a719e |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 class PhaseTransform; | |
26 class MachNode; | |
27 | |
28 //------------------------------ConNode---------------------------------------- | |
29 // Simple constants | |
30 class ConNode : public TypeNode { | |
31 public: | |
32 ConNode( const Type *t ) : TypeNode(t,1) { | |
33 init_req(0, (Node*)Compile::current()->root()); | |
34 init_flags(Flag_is_Con); | |
35 } | |
36 virtual int Opcode() const; | |
37 virtual uint hash() const; | |
38 virtual const RegMask &out_RegMask() const { return RegMask::Empty; } | |
39 virtual const RegMask &in_RegMask(uint) const { return RegMask::Empty; } | |
40 | |
41 // Polymorphic factory method: | |
42 static ConNode* make( Compile* C, const Type *t ); | |
43 }; | |
44 | |
45 //------------------------------ConINode--------------------------------------- | |
46 // Simple integer constants | |
47 class ConINode : public ConNode { | |
48 public: | |
49 ConINode( const TypeInt *t ) : ConNode(t) {} | |
50 virtual int Opcode() const; | |
51 | |
52 // Factory method: | |
53 static ConINode* make( Compile* C, int con ) { | |
54 return new (C, 1) ConINode( TypeInt::make(con) ); | |
55 } | |
56 | |
57 }; | |
58 | |
59 //------------------------------ConPNode--------------------------------------- | |
60 // Simple pointer constants | |
61 class ConPNode : public ConNode { | |
62 public: | |
63 ConPNode( const TypePtr *t ) : ConNode(t) {} | |
64 virtual int Opcode() const; | |
65 | |
66 // Factory methods: | |
67 static ConPNode* make( Compile *C ,address con ) { | |
68 if (con == NULL) | |
69 return new (C, 1) ConPNode( TypePtr::NULL_PTR ) ; | |
70 else | |
71 return new (C, 1) ConPNode( TypeRawPtr::make(con) ); | |
72 } | |
73 | |
74 static ConPNode* make( Compile *C, ciObject* con ) { | |
75 return new (C, 1) ConPNode( TypeOopPtr::make_from_constant(con) ); | |
76 } | |
77 | |
78 }; | |
79 | |
80 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
81 //------------------------------ConNNode-------------------------------------- |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
82 // Simple narrow oop constants |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
83 class ConNNode : public ConNode { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
84 public: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
85 ConNNode( const TypeNarrowOop *t ) : ConNode(t) {} |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
86 virtual int Opcode() const; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
87 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
88 static ConNNode* make( Compile *C, ciObject* con ) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
89 return new (C, 1) ConNNode( TypeNarrowOop::make_from_constant(con) ); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
90 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
91 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
92 }; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
93 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
94 |
0 | 95 //------------------------------ConLNode--------------------------------------- |
96 // Simple long constants | |
97 class ConLNode : public ConNode { | |
98 public: | |
99 ConLNode( const TypeLong *t ) : ConNode(t) {} | |
100 virtual int Opcode() const; | |
101 | |
102 // Factory method: | |
103 static ConLNode* make( Compile *C ,jlong con ) { | |
104 return new (C, 1) ConLNode( TypeLong::make(con) ); | |
105 } | |
106 | |
107 }; | |
108 | |
109 //------------------------------ConFNode--------------------------------------- | |
110 // Simple float constants | |
111 class ConFNode : public ConNode { | |
112 public: | |
113 ConFNode( const TypeF *t ) : ConNode(t) {} | |
114 virtual int Opcode() const; | |
115 | |
116 // Factory method: | |
117 static ConFNode* make( Compile *C, float con ) { | |
118 return new (C, 1) ConFNode( TypeF::make(con) ); | |
119 } | |
120 | |
121 }; | |
122 | |
123 //------------------------------ConDNode--------------------------------------- | |
124 // Simple double constants | |
125 class ConDNode : public ConNode { | |
126 public: | |
127 ConDNode( const TypeD *t ) : ConNode(t) {} | |
128 virtual int Opcode() const; | |
129 | |
130 // Factory method: | |
131 static ConDNode* make( Compile *C, double con ) { | |
132 return new (C, 1) ConDNode( TypeD::make(con) ); | |
133 } | |
134 | |
135 }; | |
136 | |
137 //------------------------------BinaryNode------------------------------------- | |
138 // Place holder for the 2 conditional inputs to a CMove. CMove needs 4 | |
139 // inputs: the Bool (for the lt/gt/eq/ne bits), the flags (result of some | |
140 // compare), and the 2 values to select between. The Matcher requires a | |
141 // binary tree so we break it down like this: | |
142 // (CMove (Binary bol cmp) (Binary src1 src2)) | |
143 class BinaryNode : public Node { | |
144 public: | |
145 BinaryNode( Node *n1, Node *n2 ) : Node(0,n1,n2) { } | |
146 virtual int Opcode() const; | |
147 virtual uint ideal_reg() const { return 0; } | |
148 }; | |
149 | |
150 //------------------------------CMoveNode-------------------------------------- | |
151 // Conditional move | |
152 class CMoveNode : public TypeNode { | |
153 public: | |
154 enum { Control, // When is it safe to do this cmove? | |
155 Condition, // Condition controlling the cmove | |
156 IfFalse, // Value if condition is false | |
157 IfTrue }; // Value if condition is true | |
158 CMoveNode( Node *bol, Node *left, Node *right, const Type *t ) : TypeNode(t,4) | |
159 { | |
160 init_class_id(Class_CMove); | |
161 // all inputs are nullified in Node::Node(int) | |
162 // init_req(Control,NULL); | |
163 init_req(Condition,bol); | |
164 init_req(IfFalse,left); | |
165 init_req(IfTrue,right); | |
166 } | |
167 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
168 virtual const Type *Value( PhaseTransform *phase ) const; | |
169 virtual Node *Identity( PhaseTransform *phase ); | |
170 static CMoveNode *make( Compile *C, Node *c, Node *bol, Node *left, Node *right, const Type *t ); | |
171 // Helper function to spot cmove graph shapes | |
172 static Node *is_cmove_id( PhaseTransform *phase, Node *cmp, Node *t, Node *f, BoolNode *b ); | |
173 }; | |
174 | |
175 //------------------------------CMoveDNode------------------------------------- | |
176 class CMoveDNode : public CMoveNode { | |
177 public: | |
178 CMoveDNode( Node *bol, Node *left, Node *right, const Type* t) : CMoveNode(bol,left,right,t){} | |
179 virtual int Opcode() const; | |
180 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
181 }; | |
182 | |
183 //------------------------------CMoveFNode------------------------------------- | |
184 class CMoveFNode : public CMoveNode { | |
185 public: | |
186 CMoveFNode( Node *bol, Node *left, Node *right, const Type* t ) : CMoveNode(bol,left,right,t) {} | |
187 virtual int Opcode() const; | |
188 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
189 }; | |
190 | |
191 //------------------------------CMoveINode------------------------------------- | |
192 class CMoveINode : public CMoveNode { | |
193 public: | |
194 CMoveINode( Node *bol, Node *left, Node *right, const TypeInt *ti ) : CMoveNode(bol,left,right,ti){} | |
195 virtual int Opcode() const; | |
196 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
197 }; | |
198 | |
199 //------------------------------CMoveLNode------------------------------------- | |
200 class CMoveLNode : public CMoveNode { | |
201 public: | |
202 CMoveLNode(Node *bol, Node *left, Node *right, const TypeLong *tl ) : CMoveNode(bol,left,right,tl){} | |
203 virtual int Opcode() const; | |
204 }; | |
205 | |
206 //------------------------------CMovePNode------------------------------------- | |
207 class CMovePNode : public CMoveNode { | |
208 public: | |
209 CMovePNode( Node *c, Node *bol, Node *left, Node *right, const TypePtr* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); } | |
210 virtual int Opcode() const; | |
211 }; | |
212 | |
213 //------------------------------ConstraintCastNode------------------------------------- | |
214 // cast to a different range | |
215 class ConstraintCastNode: public TypeNode { | |
216 public: | |
217 ConstraintCastNode (Node *n, const Type *t ): TypeNode(t,2) { | |
218 init_class_id(Class_ConstraintCast); | |
219 init_req(1, n); | |
220 } | |
221 virtual Node *Identity( PhaseTransform *phase ); | |
222 virtual const Type *Value( PhaseTransform *phase ) const; | |
223 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
224 virtual int Opcode() const; | |
225 virtual uint ideal_reg() const = 0; | |
226 virtual Node *Ideal_DU_postCCP( PhaseCCP * ); | |
227 }; | |
228 | |
229 //------------------------------CastIINode------------------------------------- | |
230 // cast integer to integer (different range) | |
231 class CastIINode: public ConstraintCastNode { | |
232 public: | |
233 CastIINode (Node *n, const Type *t ): ConstraintCastNode(n,t) {} | |
234 virtual int Opcode() const; | |
235 virtual uint ideal_reg() const { return Op_RegI; } | |
236 }; | |
237 | |
238 //------------------------------CastPPNode------------------------------------- | |
239 // cast pointer to pointer (different type) | |
240 class CastPPNode: public ConstraintCastNode { | |
241 public: | |
126
72f4a668df19
6625997: CastPP, CheckCastPP and Proj nodes are not dead loop safe
kvn
parents:
124
diff
changeset
|
242 CastPPNode (Node *n, const Type *t ): ConstraintCastNode(n, t) {} |
0 | 243 virtual int Opcode() const; |
244 virtual uint ideal_reg() const { return Op_RegP; } | |
245 virtual Node *Ideal_DU_postCCP( PhaseCCP * ); | |
246 }; | |
247 | |
248 //------------------------------CheckCastPPNode-------------------------------- | |
249 // for _checkcast, cast pointer to pointer (different type), without JOIN, | |
250 class CheckCastPPNode: public TypeNode { | |
251 public: | |
252 CheckCastPPNode( Node *c, Node *n, const Type *t ) : TypeNode(t,2) { | |
253 init_class_id(Class_CheckCastPP); | |
254 init_req(0, c); | |
255 init_req(1, n); | |
256 } | |
126
72f4a668df19
6625997: CastPP, CheckCastPP and Proj nodes are not dead loop safe
kvn
parents:
124
diff
changeset
|
257 |
0 | 258 virtual Node *Identity( PhaseTransform *phase ); |
259 virtual const Type *Value( PhaseTransform *phase ) const; | |
260 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
261 virtual int Opcode() const; | |
262 virtual uint ideal_reg() const { return Op_RegP; } | |
263 // No longer remove CheckCast after CCP as it gives me a place to hang | |
264 // the proper address type - which is required to compute anti-deps. | |
265 //virtual Node *Ideal_DU_postCCP( PhaseCCP * ); | |
266 }; | |
267 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
268 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
269 //------------------------------EncodeP-------------------------------- |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
270 // Encodes an oop pointers into its compressed form |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
271 // Takes an extra argument which is the real heap base as a long which |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
272 // may be useful for code generation in the backend. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
273 class EncodePNode : public TypeNode { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
274 public: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
275 EncodePNode(Node* value, const Type* type): |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
276 TypeNode(type, 2) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
277 init_req(0, NULL); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
278 init_req(1, value); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
279 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
280 virtual int Opcode() const; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
281 virtual Node *Identity( PhaseTransform *phase ); |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
282 virtual const Type *Value( PhaseTransform *phase ) const; |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
283 virtual uint ideal_reg() const { return Op_RegN; } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
284 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
285 static Node* encode(PhaseGVN* phase, Node* value); |
163 | 286 virtual Node *Ideal_DU_postCCP( PhaseCCP *ccp ); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
287 }; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
288 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
289 //------------------------------DecodeN-------------------------------- |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
290 // Converts a narrow oop into a real oop ptr. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
291 // Takes an extra argument which is the real heap base as a long which |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
292 // may be useful for code generation in the backend. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
293 class DecodeNNode : public TypeNode { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
294 public: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
295 DecodeNNode(Node* value, const Type* type): |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
296 TypeNode(type, 2) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
297 init_req(0, NULL); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
298 init_req(1, value); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
299 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
300 virtual int Opcode() const; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
301 virtual Node *Identity( PhaseTransform *phase ); |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
302 virtual const Type *Value( PhaseTransform *phase ) const; |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
303 virtual uint ideal_reg() const { return Op_RegP; } |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
304 |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
305 static Node* decode(PhaseGVN* phase, Node* value); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
306 }; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
307 |
0 | 308 //------------------------------Conv2BNode------------------------------------- |
309 // Convert int/pointer to a Boolean. Map zero to zero, all else to 1. | |
310 class Conv2BNode : public Node { | |
311 public: | |
312 Conv2BNode( Node *i ) : Node(0,i) {} | |
313 virtual int Opcode() const; | |
314 virtual const Type *bottom_type() const { return TypeInt::BOOL; } | |
315 virtual Node *Identity( PhaseTransform *phase ); | |
316 virtual const Type *Value( PhaseTransform *phase ) const; | |
317 virtual uint ideal_reg() const { return Op_RegI; } | |
318 }; | |
319 | |
320 // The conversions operations are all Alpha sorted. Please keep it that way! | |
321 //------------------------------ConvD2FNode------------------------------------ | |
322 // Convert double to float | |
323 class ConvD2FNode : public Node { | |
324 public: | |
325 ConvD2FNode( Node *in1 ) : Node(0,in1) {} | |
326 virtual int Opcode() const; | |
327 virtual const Type *bottom_type() const { return Type::FLOAT; } | |
328 virtual const Type *Value( PhaseTransform *phase ) const; | |
329 virtual Node *Identity( PhaseTransform *phase ); | |
330 virtual uint ideal_reg() const { return Op_RegF; } | |
331 }; | |
332 | |
333 //------------------------------ConvD2INode------------------------------------ | |
334 // Convert Double to Integer | |
335 class ConvD2INode : public Node { | |
336 public: | |
337 ConvD2INode( Node *in1 ) : Node(0,in1) {} | |
338 virtual int Opcode() const; | |
339 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
340 virtual const Type *Value( PhaseTransform *phase ) const; | |
341 virtual Node *Identity( PhaseTransform *phase ); | |
342 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
343 virtual uint ideal_reg() const { return Op_RegI; } | |
344 }; | |
345 | |
346 //------------------------------ConvD2LNode------------------------------------ | |
347 // Convert Double to Long | |
348 class ConvD2LNode : public Node { | |
349 public: | |
350 ConvD2LNode( Node *dbl ) : Node(0,dbl) {} | |
351 virtual int Opcode() const; | |
352 virtual const Type *bottom_type() const { return TypeLong::LONG; } | |
353 virtual const Type *Value( PhaseTransform *phase ) const; | |
354 virtual Node *Identity( PhaseTransform *phase ); | |
355 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
356 virtual uint ideal_reg() const { return Op_RegL; } | |
357 }; | |
358 | |
359 //------------------------------ConvF2DNode------------------------------------ | |
360 // Convert Float to a Double. | |
361 class ConvF2DNode : public Node { | |
362 public: | |
363 ConvF2DNode( Node *in1 ) : Node(0,in1) {} | |
364 virtual int Opcode() const; | |
365 virtual const Type *bottom_type() const { return Type::DOUBLE; } | |
366 virtual const Type *Value( PhaseTransform *phase ) const; | |
367 virtual uint ideal_reg() const { return Op_RegD; } | |
368 }; | |
369 | |
370 //------------------------------ConvF2INode------------------------------------ | |
371 // Convert float to integer | |
372 class ConvF2INode : public Node { | |
373 public: | |
374 ConvF2INode( Node *in1 ) : Node(0,in1) {} | |
375 virtual int Opcode() const; | |
376 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
377 virtual const Type *Value( PhaseTransform *phase ) const; | |
378 virtual Node *Identity( PhaseTransform *phase ); | |
379 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
380 virtual uint ideal_reg() const { return Op_RegI; } | |
381 }; | |
382 | |
383 //------------------------------ConvF2LNode------------------------------------ | |
384 // Convert float to long | |
385 class ConvF2LNode : public Node { | |
386 public: | |
387 ConvF2LNode( Node *in1 ) : Node(0,in1) {} | |
388 virtual int Opcode() const; | |
389 virtual const Type *bottom_type() const { return TypeLong::LONG; } | |
390 virtual const Type *Value( PhaseTransform *phase ) const; | |
391 virtual Node *Identity( PhaseTransform *phase ); | |
392 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
393 virtual uint ideal_reg() const { return Op_RegL; } | |
394 }; | |
395 | |
396 //------------------------------ConvI2DNode------------------------------------ | |
397 // Convert Integer to Double | |
398 class ConvI2DNode : public Node { | |
399 public: | |
400 ConvI2DNode( Node *in1 ) : Node(0,in1) {} | |
401 virtual int Opcode() const; | |
402 virtual const Type *bottom_type() const { return Type::DOUBLE; } | |
403 virtual const Type *Value( PhaseTransform *phase ) const; | |
404 virtual uint ideal_reg() const { return Op_RegD; } | |
405 }; | |
406 | |
407 //------------------------------ConvI2FNode------------------------------------ | |
408 // Convert Integer to Float | |
409 class ConvI2FNode : public Node { | |
410 public: | |
411 ConvI2FNode( Node *in1 ) : Node(0,in1) {} | |
412 virtual int Opcode() const; | |
413 virtual const Type *bottom_type() const { return Type::FLOAT; } | |
414 virtual const Type *Value( PhaseTransform *phase ) const; | |
415 virtual Node *Identity( PhaseTransform *phase ); | |
416 virtual uint ideal_reg() const { return Op_RegF; } | |
417 }; | |
418 | |
419 //------------------------------ConvI2LNode------------------------------------ | |
420 // Convert integer to long | |
421 class ConvI2LNode : public TypeNode { | |
422 public: | |
423 ConvI2LNode(Node *in1, const TypeLong* t = TypeLong::INT) | |
424 : TypeNode(t, 2) | |
425 { init_req(1, in1); } | |
426 virtual int Opcode() const; | |
427 virtual const Type *Value( PhaseTransform *phase ) const; | |
428 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
429 virtual uint ideal_reg() const { return Op_RegL; } | |
430 }; | |
431 | |
432 //------------------------------ConvL2DNode------------------------------------ | |
433 // Convert Long to Double | |
434 class ConvL2DNode : public Node { | |
435 public: | |
436 ConvL2DNode( Node *in1 ) : Node(0,in1) {} | |
437 virtual int Opcode() const; | |
438 virtual const Type *bottom_type() const { return Type::DOUBLE; } | |
439 virtual const Type *Value( PhaseTransform *phase ) const; | |
440 virtual uint ideal_reg() const { return Op_RegD; } | |
441 }; | |
442 | |
443 //------------------------------ConvL2FNode------------------------------------ | |
444 // Convert Long to Float | |
445 class ConvL2FNode : public Node { | |
446 public: | |
447 ConvL2FNode( Node *in1 ) : Node(0,in1) {} | |
448 virtual int Opcode() const; | |
449 virtual const Type *bottom_type() const { return Type::FLOAT; } | |
450 virtual const Type *Value( PhaseTransform *phase ) const; | |
451 virtual uint ideal_reg() const { return Op_RegF; } | |
452 }; | |
453 | |
454 //------------------------------ConvL2INode------------------------------------ | |
455 // Convert long to integer | |
456 class ConvL2INode : public Node { | |
457 public: | |
458 ConvL2INode( Node *in1 ) : Node(0,in1) {} | |
459 virtual int Opcode() const; | |
460 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
461 virtual Node *Identity( PhaseTransform *phase ); | |
462 virtual const Type *Value( PhaseTransform *phase ) const; | |
463 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
464 virtual uint ideal_reg() const { return Op_RegI; } | |
465 }; | |
466 | |
467 //------------------------------CastX2PNode------------------------------------- | |
468 // convert a machine-pointer-sized integer to a raw pointer | |
469 class CastX2PNode : public Node { | |
470 public: | |
471 CastX2PNode( Node *n ) : Node(NULL, n) {} | |
472 virtual int Opcode() const; | |
473 virtual const Type *Value( PhaseTransform *phase ) const; | |
474 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
475 virtual Node *Identity( PhaseTransform *phase ); | |
476 virtual uint ideal_reg() const { return Op_RegP; } | |
477 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; } | |
478 }; | |
479 | |
480 //------------------------------CastP2XNode------------------------------------- | |
481 // Used in both 32-bit and 64-bit land. | |
482 // Used for card-marks and unsafe pointer math. | |
483 class CastP2XNode : public Node { | |
484 public: | |
485 CastP2XNode( Node *ctrl, Node *n ) : Node(ctrl, n) {} | |
486 virtual int Opcode() const; | |
487 virtual const Type *Value( PhaseTransform *phase ) const; | |
488 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
489 virtual Node *Identity( PhaseTransform *phase ); | |
490 virtual uint ideal_reg() const { return Op_RegX; } | |
491 virtual const Type *bottom_type() const { return TypeX_X; } | |
492 // Return false to keep node from moving away from an associated card mark. | |
493 virtual bool depends_only_on_test() const { return false; } | |
494 }; | |
495 | |
496 //------------------------------MemMoveNode------------------------------------ | |
497 // Memory to memory move. Inserted very late, after allocation. | |
498 class MemMoveNode : public Node { | |
499 public: | |
500 MemMoveNode( Node *dst, Node *src ) : Node(0,dst,src) {} | |
501 virtual int Opcode() const; | |
502 }; | |
503 | |
504 //------------------------------ThreadLocalNode-------------------------------- | |
505 // Ideal Node which returns the base of ThreadLocalStorage. | |
506 class ThreadLocalNode : public Node { | |
507 public: | |
508 ThreadLocalNode( ) : Node((Node*)Compile::current()->root()) {} | |
509 virtual int Opcode() const; | |
510 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM;} | |
511 virtual uint ideal_reg() const { return Op_RegP; } | |
512 }; | |
513 | |
514 //------------------------------LoadReturnPCNode------------------------------- | |
515 class LoadReturnPCNode: public Node { | |
516 public: | |
517 LoadReturnPCNode(Node *c) : Node(c) { } | |
518 virtual int Opcode() const; | |
519 virtual uint ideal_reg() const { return Op_RegP; } | |
520 }; | |
521 | |
522 | |
523 //-----------------------------RoundFloatNode---------------------------------- | |
524 class RoundFloatNode: public Node { | |
525 public: | |
526 RoundFloatNode(Node* c, Node *in1): Node(c, in1) {} | |
527 virtual int Opcode() const; | |
528 virtual const Type *bottom_type() const { return Type::FLOAT; } | |
529 virtual uint ideal_reg() const { return Op_RegF; } | |
530 virtual Node *Identity( PhaseTransform *phase ); | |
531 virtual const Type *Value( PhaseTransform *phase ) const; | |
532 }; | |
533 | |
534 | |
535 //-----------------------------RoundDoubleNode--------------------------------- | |
536 class RoundDoubleNode: public Node { | |
537 public: | |
538 RoundDoubleNode(Node* c, Node *in1): Node(c, in1) {} | |
539 virtual int Opcode() const; | |
540 virtual const Type *bottom_type() const { return Type::DOUBLE; } | |
541 virtual uint ideal_reg() const { return Op_RegD; } | |
542 virtual Node *Identity( PhaseTransform *phase ); | |
543 virtual const Type *Value( PhaseTransform *phase ) const; | |
544 }; | |
545 | |
546 //------------------------------Opaque1Node------------------------------------ | |
547 // A node to prevent unwanted optimizations. Allows constant folding. | |
548 // Stops value-numbering, Ideal calls or Identity functions. | |
549 class Opaque1Node : public Node { | |
550 virtual uint hash() const ; // { return NO_HASH; } | |
551 virtual uint cmp( const Node &n ) const; | |
552 public: | |
553 Opaque1Node( Node *n ) : Node(0,n) {} | |
554 // Special version for the pre-loop to hold the original loop limit | |
555 // which is consumed by range check elimination. | |
556 Opaque1Node( Node *n, Node* orig_limit ) : Node(0,n,orig_limit) {} | |
557 Node* original_loop_limit() { return req()==3 ? in(2) : NULL; } | |
558 virtual int Opcode() const; | |
559 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
560 virtual Node *Identity( PhaseTransform *phase ); | |
561 }; | |
562 | |
563 //------------------------------Opaque2Node------------------------------------ | |
564 // A node to prevent unwanted optimizations. Allows constant folding. Stops | |
565 // value-numbering, most Ideal calls or Identity functions. This Node is | |
566 // specifically designed to prevent the pre-increment value of a loop trip | |
567 // counter from being live out of the bottom of the loop (hence causing the | |
568 // pre- and post-increment values both being live and thus requiring an extra | |
569 // temp register and an extra move). If we "accidentally" optimize through | |
570 // this kind of a Node, we'll get slightly pessimal, but correct, code. Thus | |
571 // it's OK to be slightly sloppy on optimizations here. | |
572 class Opaque2Node : public Node { | |
573 virtual uint hash() const ; // { return NO_HASH; } | |
574 virtual uint cmp( const Node &n ) const; | |
575 public: | |
576 Opaque2Node( Node *n ) : Node(0,n) {} | |
577 virtual int Opcode() const; | |
578 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
579 }; | |
580 | |
581 //----------------------PartialSubtypeCheckNode-------------------------------- | |
582 // The 2nd slow-half of a subtype check. Scan the subklass's 2ndary superklass | |
583 // array for an instance of the superklass. Set a hidden internal cache on a | |
584 // hit (cache is checked with exposed code in gen_subtype_check()). Return | |
585 // not zero for a miss or zero for a hit. | |
586 class PartialSubtypeCheckNode : public Node { | |
587 public: | |
588 PartialSubtypeCheckNode(Node* c, Node* sub, Node* super) : Node(c,sub,super) {} | |
589 virtual int Opcode() const; | |
590 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; } | |
591 virtual uint ideal_reg() const { return Op_RegP; } | |
592 }; | |
593 | |
594 // | |
595 class MoveI2FNode : public Node { | |
596 public: | |
597 MoveI2FNode( Node *value ) : Node(0,value) {} | |
598 virtual int Opcode() const; | |
599 virtual const Type *bottom_type() const { return Type::FLOAT; } | |
600 virtual uint ideal_reg() const { return Op_RegF; } | |
601 virtual const Type* Value( PhaseTransform *phase ) const; | |
602 }; | |
603 | |
604 class MoveL2DNode : public Node { | |
605 public: | |
606 MoveL2DNode( Node *value ) : Node(0,value) {} | |
607 virtual int Opcode() const; | |
608 virtual const Type *bottom_type() const { return Type::DOUBLE; } | |
609 virtual uint ideal_reg() const { return Op_RegD; } | |
610 virtual const Type* Value( PhaseTransform *phase ) const; | |
611 }; | |
612 | |
613 class MoveF2INode : public Node { | |
614 public: | |
615 MoveF2INode( Node *value ) : Node(0,value) {} | |
616 virtual int Opcode() const; | |
617 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
618 virtual uint ideal_reg() const { return Op_RegI; } | |
619 virtual const Type* Value( PhaseTransform *phase ) const; | |
620 }; | |
621 | |
622 class MoveD2LNode : public Node { | |
623 public: | |
624 MoveD2LNode( Node *value ) : Node(0,value) {} | |
625 virtual int Opcode() const; | |
626 virtual const Type *bottom_type() const { return TypeLong::LONG; } | |
627 virtual uint ideal_reg() const { return Op_RegL; } | |
628 virtual const Type* Value( PhaseTransform *phase ) const; | |
629 }; |