Mercurial > hg > truffle
annotate src/share/vm/opto/addnode.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 |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1541
diff
changeset
|
2 * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1541
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1541
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:
1541
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 // Portions of code courtesy of Clifford Click | |
26 | |
27 class PhaseTransform; | |
28 | |
29 //------------------------------AddNode---------------------------------------- | |
30 // Classic Add functionality. This covers all the usual 'add' behaviors for | |
31 // an algebraic ring. Add-integer, add-float, add-double, and binary-or are | |
32 // all inherited from this class. The various identity values are supplied | |
33 // by virtual functions. | |
34 class AddNode : public Node { | |
35 virtual uint hash() const; | |
36 public: | |
37 AddNode( Node *in1, Node *in2 ) : Node(0,in1,in2) { | |
38 init_class_id(Class_Add); | |
39 } | |
40 | |
41 // Handle algebraic identities here. If we have an identity, return the Node | |
42 // we are equivalent to. We look for "add of zero" as an identity. | |
43 virtual Node *Identity( PhaseTransform *phase ); | |
44 | |
45 // We also canonicalize the Node, moving constants to the right input, | |
46 // and flatten expressions (so that 1+x+2 becomes x+3). | |
47 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
48 | |
49 // Compute a new Type for this node. Basically we just do the pre-check, | |
50 // then call the virtual add() to set the type. | |
51 virtual const Type *Value( PhaseTransform *phase ) const; | |
52 | |
53 // Check if this addition involves the additive identity | |
54 virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const; | |
55 | |
56 // Supplied function returns the sum of the inputs. | |
57 // This also type-checks the inputs for sanity. Guaranteed never to | |
58 // be passed a TOP or BOTTOM type, these are filtered out by a pre-check. | |
59 virtual const Type *add_ring( const Type *, const Type * ) const = 0; | |
60 | |
61 // Supplied function to return the additive identity type | |
62 virtual const Type *add_id() const = 0; | |
63 | |
64 }; | |
65 | |
66 //------------------------------AddINode--------------------------------------- | |
67 // Add 2 integers | |
68 class AddINode : public AddNode { | |
69 public: | |
70 AddINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {} | |
71 virtual int Opcode() const; | |
72 virtual const Type *add_ring( const Type *, const Type * ) const; | |
73 virtual const Type *add_id() const { return TypeInt::ZERO; } | |
74 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
75 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
76 virtual Node *Identity( PhaseTransform *phase ); | |
77 virtual uint ideal_reg() const { return Op_RegI; } | |
78 }; | |
79 | |
80 //------------------------------AddLNode--------------------------------------- | |
81 // Add 2 longs | |
82 class AddLNode : public AddNode { | |
83 public: | |
84 AddLNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {} | |
85 virtual int Opcode() const; | |
86 virtual const Type *add_ring( const Type *, const Type * ) const; | |
87 virtual const Type *add_id() const { return TypeLong::ZERO; } | |
88 virtual const Type *bottom_type() const { return TypeLong::LONG; } | |
89 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
90 virtual Node *Identity( PhaseTransform *phase ); | |
91 virtual uint ideal_reg() const { return Op_RegL; } | |
92 }; | |
93 | |
94 //------------------------------AddFNode--------------------------------------- | |
95 // Add 2 floats | |
96 class AddFNode : public AddNode { | |
97 public: | |
98 AddFNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {} | |
99 virtual int Opcode() const; | |
100 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
101 virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const; | |
102 virtual const Type *add_ring( const Type *, const Type * ) const; | |
103 virtual const Type *add_id() const { return TypeF::ZERO; } | |
104 virtual const Type *bottom_type() const { return Type::FLOAT; } | |
105 virtual Node *Identity( PhaseTransform *phase ) { return this; } | |
106 virtual uint ideal_reg() const { return Op_RegF; } | |
107 }; | |
108 | |
109 //------------------------------AddDNode--------------------------------------- | |
110 // Add 2 doubles | |
111 class AddDNode : public AddNode { | |
112 public: | |
113 AddDNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {} | |
114 virtual int Opcode() const; | |
115 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
116 virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const; | |
117 virtual const Type *add_ring( const Type *, const Type * ) const; | |
118 virtual const Type *add_id() const { return TypeD::ZERO; } | |
119 virtual const Type *bottom_type() const { return Type::DOUBLE; } | |
120 virtual Node *Identity( PhaseTransform *phase ) { return this; } | |
121 virtual uint ideal_reg() const { return Op_RegD; } | |
122 }; | |
123 | |
124 //------------------------------AddPNode--------------------------------------- | |
125 // Add pointer plus integer to get pointer. NOT commutative, really. | |
126 // So not really an AddNode. Lives here, because people associate it with | |
127 // an add. | |
128 class AddPNode : public Node { | |
129 public: | |
130 enum { Control, // When is it safe to do this add? | |
131 Base, // Base oop, for GC purposes | |
132 Address, // Actually address, derived from base | |
133 Offset } ; // Offset added to address | |
134 AddPNode( Node *base, Node *ptr, Node *off ) : Node(0,base,ptr,off) { | |
135 init_class_id(Class_AddP); | |
136 } | |
137 virtual int Opcode() const; | |
138 virtual Node *Identity( PhaseTransform *phase ); | |
139 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
140 virtual const Type *Value( PhaseTransform *phase ) const; | |
141 virtual const Type *bottom_type() const; | |
142 virtual uint ideal_reg() const { return Op_RegP; } | |
143 Node *base_node() { assert( req() > Base, "Missing base"); return in(Base); } | |
144 static Node* Ideal_base_and_offset(Node* ptr, PhaseTransform* phase, | |
145 // second return value: | |
146 intptr_t& offset); | |
17
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
147 |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
148 // Collect the AddP offset values into the elements array, giving up |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
149 // if there are more than length. |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
150 int unpack_offsets(Node* elements[], int length); |
ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
0
diff
changeset
|
151 |
0 | 152 // Do not match base-ptr edge |
153 virtual uint match_edge(uint idx) const; | |
154 }; | |
155 | |
156 //------------------------------OrINode---------------------------------------- | |
157 // Logically OR 2 integers. Included with the ADD nodes because it inherits | |
158 // all the behavior of addition on a ring. | |
159 class OrINode : public AddNode { | |
160 public: | |
161 OrINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {} | |
162 virtual int Opcode() const; | |
163 virtual const Type *add_ring( const Type *, const Type * ) const; | |
164 virtual const Type *add_id() const { return TypeInt::ZERO; } | |
165 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
166 virtual Node *Identity( PhaseTransform *phase ); | |
167 virtual uint ideal_reg() const { return Op_RegI; } | |
168 }; | |
169 | |
170 //------------------------------OrLNode---------------------------------------- | |
171 // Logically OR 2 longs. Included with the ADD nodes because it inherits | |
172 // all the behavior of addition on a ring. | |
173 class OrLNode : public AddNode { | |
174 public: | |
175 OrLNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {} | |
176 virtual int Opcode() const; | |
177 virtual const Type *add_ring( const Type *, const Type * ) const; | |
178 virtual const Type *add_id() const { return TypeLong::ZERO; } | |
179 virtual const Type *bottom_type() const { return TypeLong::LONG; } | |
180 virtual Node *Identity( PhaseTransform *phase ); | |
181 virtual uint ideal_reg() const { return Op_RegL; } | |
182 }; | |
183 | |
184 //------------------------------XorINode--------------------------------------- | |
185 // XOR'ing 2 integers | |
186 class XorINode : public AddNode { | |
187 public: | |
188 XorINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {} | |
189 virtual int Opcode() const; | |
190 virtual const Type *add_ring( const Type *, const Type * ) const; | |
191 virtual const Type *add_id() const { return TypeInt::ZERO; } | |
192 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
193 virtual uint ideal_reg() const { return Op_RegI; } | |
194 }; | |
195 | |
196 //------------------------------XorINode--------------------------------------- | |
197 // XOR'ing 2 longs | |
198 class XorLNode : public AddNode { | |
199 public: | |
200 XorLNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {} | |
201 virtual int Opcode() const; | |
202 virtual const Type *add_ring( const Type *, const Type * ) const; | |
203 virtual const Type *add_id() const { return TypeLong::ZERO; } | |
204 virtual const Type *bottom_type() const { return TypeLong::LONG; } | |
205 virtual uint ideal_reg() const { return Op_RegL; } | |
206 }; | |
207 | |
208 //------------------------------MaxNode---------------------------------------- | |
209 // Max (or min) of 2 values. Included with the ADD nodes because it inherits | |
210 // all the behavior of addition on a ring. Only new thing is that we allow | |
211 // 2 equal inputs to be equal. | |
212 class MaxNode : public AddNode { | |
213 public: | |
214 MaxNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {} | |
215 virtual int Opcode() const = 0; | |
216 }; | |
217 | |
218 //------------------------------MaxINode--------------------------------------- | |
219 // Maximum of 2 integers. Included with the ADD nodes because it inherits | |
220 // all the behavior of addition on a ring. | |
221 class MaxINode : public MaxNode { | |
222 public: | |
223 MaxINode( Node *in1, Node *in2 ) : MaxNode(in1,in2) {} | |
224 virtual int Opcode() const; | |
225 virtual const Type *add_ring( const Type *, const Type * ) const; | |
226 virtual const Type *add_id() const { return TypeInt::make(min_jint); } | |
227 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
228 virtual uint ideal_reg() const { return Op_RegI; } | |
229 }; | |
230 | |
231 //------------------------------MinINode--------------------------------------- | |
232 // MINimum of 2 integers. Included with the ADD nodes because it inherits | |
233 // all the behavior of addition on a ring. | |
234 class MinINode : public MaxNode { | |
235 public: | |
236 MinINode( Node *in1, Node *in2 ) : MaxNode(in1,in2) {} | |
237 virtual int Opcode() const; | |
238 virtual const Type *add_ring( const Type *, const Type * ) const; | |
239 virtual const Type *add_id() const { return TypeInt::make(max_jint); } | |
240 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
241 virtual uint ideal_reg() const { return Op_RegI; } | |
242 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
243 }; |