Mercurial > hg > graal-jvmci-8
annotate src/share/vm/opto/machnode.hpp @ 24170:0b85ccd62409 jdk8u131-b01
8168699: Validate special case invocations
Reviewed-by: kevinw, vlivanov
author | coleenp |
---|---|
date | Tue, 13 Dec 2016 14:37:04 -0500 |
parents | 9df0d8f65fea |
children | dd9cc155639c |
rev | line source |
---|---|
0 | 1 /* |
20447
fc2c88ea11a9
8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents:
17877
diff
changeset
|
2 * Copyright (c) 1997, 2014, 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:
1203
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1203
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:
1203
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_OPTO_MACHNODE_HPP |
26 #define SHARE_VM_OPTO_MACHNODE_HPP | |
27 | |
28 #include "opto/callnode.hpp" | |
29 #include "opto/matcher.hpp" | |
30 #include "opto/multnode.hpp" | |
31 #include "opto/node.hpp" | |
32 #include "opto/regmask.hpp" | |
33 | |
14437
15120a36272d
8028767: PPC64: (part 121): smaller shared changes needed to build C2
goetz
parents:
14434
diff
changeset
|
34 class BiasedLockingCounters; |
0 | 35 class BufferBlob; |
36 class CodeBuffer; | |
37 class JVMState; | |
38 class MachCallDynamicJavaNode; | |
39 class MachCallJavaNode; | |
40 class MachCallLeafNode; | |
41 class MachCallNode; | |
42 class MachCallRuntimeNode; | |
43 class MachCallStaticJavaNode; | |
44 class MachEpilogNode; | |
45 class MachIfNode; | |
46 class MachNullCheckNode; | |
47 class MachOper; | |
48 class MachProjNode; | |
49 class MachPrologNode; | |
50 class MachReturnNode; | |
51 class MachSafePointNode; | |
52 class MachSpillCopyNode; | |
53 class Matcher; | |
54 class PhaseRegAlloc; | |
55 class RegMask; | |
17780 | 56 class RTMLockingCounters; |
0 | 57 class State; |
58 | |
59 //---------------------------MachOper------------------------------------------ | |
60 class MachOper : public ResourceObj { | |
61 public: | |
62 // Allocate right next to the MachNodes in the same arena | |
12146
9758d9f36299
8021954: VM SIGSEGV during classloading on MacOS; hs_err_pid file produced
coleenp
parents:
6725
diff
changeset
|
63 void *operator new( size_t x, Compile* C ) throw() { return C->node_arena()->Amalloc_D(x); } |
0 | 64 |
65 // Opcode | |
66 virtual uint opcode() const = 0; | |
67 | |
68 // Number of input edges. | |
69 // Generally at least 1 | |
70 virtual uint num_edges() const { return 1; } | |
71 // Array of Register masks | |
72 virtual const RegMask *in_RegMask(int index) const; | |
73 | |
74 // Methods to output the encoding of the operand | |
75 | |
76 // Negate conditional branches. Error for non-branch Nodes | |
77 virtual void negate(); | |
78 | |
79 // Return the value requested | |
80 // result register lookup, corresponding to int_format | |
81 virtual int reg(PhaseRegAlloc *ra_, const Node *node) const; | |
82 // input register lookup, corresponding to ext_format | |
83 virtual int reg(PhaseRegAlloc *ra_, const Node *node, int idx) const; | |
84 | |
85 // helpers for MacroAssembler generation from ADLC | |
86 Register as_Register(PhaseRegAlloc *ra_, const Node *node) const { | |
87 return ::as_Register(reg(ra_, node)); | |
88 } | |
89 Register as_Register(PhaseRegAlloc *ra_, const Node *node, int idx) const { | |
90 return ::as_Register(reg(ra_, node, idx)); | |
91 } | |
92 FloatRegister as_FloatRegister(PhaseRegAlloc *ra_, const Node *node) const { | |
93 return ::as_FloatRegister(reg(ra_, node)); | |
94 } | |
95 FloatRegister as_FloatRegister(PhaseRegAlloc *ra_, const Node *node, int idx) const { | |
96 return ::as_FloatRegister(reg(ra_, node, idx)); | |
97 } | |
98 | |
99 #if defined(IA32) || defined(AMD64) | |
100 XMMRegister as_XMMRegister(PhaseRegAlloc *ra_, const Node *node) const { | |
101 return ::as_XMMRegister(reg(ra_, node)); | |
102 } | |
103 XMMRegister as_XMMRegister(PhaseRegAlloc *ra_, const Node *node, int idx) const { | |
104 return ::as_XMMRegister(reg(ra_, node, idx)); | |
105 } | |
106 #endif | |
14444
492e67693373
8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents:
14440
diff
changeset
|
107 // CondRegister reg converter |
492e67693373
8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents:
14440
diff
changeset
|
108 #if defined(PPC64) |
492e67693373
8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents:
14440
diff
changeset
|
109 ConditionRegister as_ConditionRegister(PhaseRegAlloc *ra_, const Node *node) const { |
492e67693373
8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents:
14440
diff
changeset
|
110 return ::as_ConditionRegister(reg(ra_, node)); |
492e67693373
8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents:
14440
diff
changeset
|
111 } |
492e67693373
8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents:
14440
diff
changeset
|
112 ConditionRegister as_ConditionRegister(PhaseRegAlloc *ra_, const Node *node, int idx) const { |
492e67693373
8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents:
14440
diff
changeset
|
113 return ::as_ConditionRegister(reg(ra_, node, idx)); |
492e67693373
8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents:
14440
diff
changeset
|
114 } |
492e67693373
8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents:
14440
diff
changeset
|
115 #endif |
0 | 116 |
117 virtual intptr_t constant() const; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
118 virtual relocInfo::relocType constant_reloc() const; |
0 | 119 virtual jdouble constantD() const; |
120 virtual jfloat constantF() const; | |
121 virtual jlong constantL() const; | |
122 virtual TypeOopPtr *oop() const; | |
123 virtual int ccode() const; | |
124 // A zero, default, indicates this value is not needed. | |
125 // May need to lookup the base register, as done in int_ and ext_format | |
126 virtual int base (PhaseRegAlloc *ra_, const Node *node, int idx) const; | |
127 virtual int index(PhaseRegAlloc *ra_, const Node *node, int idx) const; | |
128 virtual int scale() const; | |
129 // Parameters needed to support MEMORY_INTERFACE access to stackSlot | |
130 virtual int disp (PhaseRegAlloc *ra_, const Node *node, int idx) const; | |
131 // Check for PC-Relative displacement | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
132 virtual relocInfo::relocType disp_reloc() const; |
0 | 133 virtual int constant_disp() const; // usu. 0, may return Type::OffsetBot |
134 virtual int base_position() const; // base edge position, or -1 | |
135 virtual int index_position() const; // index edge position, or -1 | |
136 | |
137 // Access the TypeKlassPtr of operands with a base==RegI and disp==RegP | |
138 // Only returns non-null value for i486.ad's indOffset32X | |
139 virtual const TypePtr *disp_as_type() const { return NULL; } | |
140 | |
141 // Return the label | |
142 virtual Label *label() const; | |
143 | |
144 // Return the method's address | |
145 virtual intptr_t method() const; | |
146 | |
147 // Hash and compare over operands are currently identical | |
148 virtual uint hash() const; | |
149 virtual uint cmp( const MachOper &oper ) const; | |
150 | |
151 // Virtual clone, since I do not know how big the MachOper is. | |
152 virtual MachOper *clone(Compile* C) const = 0; | |
153 | |
154 // Return ideal Type from simple operands. Fail for complex operands. | |
155 virtual const Type *type() const; | |
156 | |
157 // Set an integer offset if we have one, or error otherwise | |
158 virtual void set_con( jint c0 ) { ShouldNotReachHere(); } | |
159 | |
160 #ifndef PRODUCT | |
161 // Return name of operand | |
162 virtual const char *Name() const { return "???";} | |
163 | |
164 // Methods to output the text version of the operand | |
165 virtual void int_format(PhaseRegAlloc *,const MachNode *node, outputStream *st) const = 0; | |
166 virtual void ext_format(PhaseRegAlloc *,const MachNode *node,int idx, outputStream *st) const=0; | |
167 | |
168 virtual void dump_spec(outputStream *st) const; // Print per-operand info | |
14428
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
169 |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
170 // Check whether o is a valid oper. |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
171 static bool notAnOper(const MachOper *o) { |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
172 if (o == NULL) return true; |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
173 if (((intptr_t)o & 1) != 0) return true; |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
174 if (*(address*)o == badAddress) return true; // kill by Node::destruct |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
175 return false; |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
176 } |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
177 #endif // !PRODUCT |
0 | 178 }; |
179 | |
180 //------------------------------MachNode--------------------------------------- | |
181 // Base type for all machine specific nodes. All node classes generated by the | |
182 // ADLC inherit from this class. | |
183 class MachNode : public Node { | |
184 public: | |
185 MachNode() : Node((uint)0), _num_opnds(0), _opnds(NULL) { | |
186 init_class_id(Class_Mach); | |
187 } | |
188 // Required boilerplate | |
189 virtual uint size_of() const { return sizeof(MachNode); } | |
190 virtual int Opcode() const; // Always equal to MachNode | |
191 virtual uint rule() const = 0; // Machine-specific opcode | |
192 // Number of inputs which come before the first operand. | |
193 // Generally at least 1, to skip the Control input | |
194 virtual uint oper_input_base() const { return 1; } | |
14434
318d0622a6d7
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
14431
diff
changeset
|
195 // Position of constant base node in node's inputs. -1 if |
318d0622a6d7
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
14431
diff
changeset
|
196 // no constant base node input. |
318d0622a6d7
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
14431
diff
changeset
|
197 virtual uint mach_constant_base_node_input() const { return (uint)-1; } |
0 | 198 |
199 // Copy inputs and operands to new node of instruction. | |
200 // Called from cisc_version() and short_branch_version(). | |
201 // !!!! The method's body is defined in ad_<arch>.cpp file. | |
202 void fill_new_machnode(MachNode *n, Compile* C) const; | |
203 | |
204 // Return an equivalent instruction using memory for cisc_operand position | |
205 virtual MachNode *cisc_version(int offset, Compile* C); | |
206 // Modify this instruction's register mask to use stack version for cisc_operand | |
207 virtual void use_cisc_RegMask(); | |
208 | |
209 // Support for short branches | |
210 bool may_be_short_branch() const { return (flags() & Flag_may_be_short_branch) != 0; } | |
211 | |
3851 | 212 // Avoid back to back some instructions on some CPUs. |
17877
17b2fbdb6637
8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents:
17810
diff
changeset
|
213 enum AvoidBackToBackFlag { AVOID_NONE = 0, |
17b2fbdb6637
8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents:
17810
diff
changeset
|
214 AVOID_BEFORE = Flag_avoid_back_to_back_before, |
17b2fbdb6637
8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents:
17810
diff
changeset
|
215 AVOID_AFTER = Flag_avoid_back_to_back_after, |
17b2fbdb6637
8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents:
17810
diff
changeset
|
216 AVOID_BEFORE_AND_AFTER = AVOID_BEFORE | AVOID_AFTER }; |
17b2fbdb6637
8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents:
17810
diff
changeset
|
217 |
17b2fbdb6637
8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents:
17810
diff
changeset
|
218 bool avoid_back_to_back(AvoidBackToBackFlag flag_value) const { |
17b2fbdb6637
8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents:
17810
diff
changeset
|
219 return (flags() & flag_value) == flag_value; |
17b2fbdb6637
8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents:
17810
diff
changeset
|
220 } |
3851 | 221 |
4120
f03a3c8bd5e5
7077312: Provide a CALL effect for instruct declaration in the ad file
roland
parents:
3853
diff
changeset
|
222 // instruction implemented with a call |
f03a3c8bd5e5
7077312: Provide a CALL effect for instruct declaration in the ad file
roland
parents:
3853
diff
changeset
|
223 bool has_call() const { return (flags() & Flag_has_call) != 0; } |
f03a3c8bd5e5
7077312: Provide a CALL effect for instruct declaration in the ad file
roland
parents:
3853
diff
changeset
|
224 |
0 | 225 // First index in _in[] corresponding to operand, or -1 if there is none |
226 int operand_index(uint operand) const; | |
14437
15120a36272d
8028767: PPC64: (part 121): smaller shared changes needed to build C2
goetz
parents:
14434
diff
changeset
|
227 int operand_index(const MachOper *oper) const; |
0 | 228 |
229 // Register class input is expected in | |
230 virtual const RegMask &in_RegMask(uint) const; | |
231 | |
232 // cisc-spillable instructions redefine for use by in_RegMask | |
233 virtual const RegMask *cisc_RegMask() const { return NULL; } | |
234 | |
235 // If this instruction is a 2-address instruction, then return the | |
236 // index of the input which must match the output. Not nessecary | |
237 // for instructions which bind the input and output register to the | |
238 // same singleton regiser (e.g., Intel IDIV which binds AX to be | |
239 // both an input and an output). It is nessecary when the input and | |
240 // output have choices - but they must use the same choice. | |
241 virtual uint two_adr( ) const { return 0; } | |
242 | |
243 // Array of complex operand pointers. Each corresponds to zero or | |
244 // more leafs. Must be set by MachNode constructor to point to an | |
245 // internal array of MachOpers. The MachOper array is sized by | |
246 // specific MachNodes described in the ADL. | |
247 uint _num_opnds; | |
248 MachOper **_opnds; | |
249 uint num_opnds() const { return _num_opnds; } | |
250 | |
251 // Emit bytes into cbuf | |
252 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const; | |
14428
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
253 // Expand node after register allocation. |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
254 // Node is replaced by several nodes in the postalloc expand phase. |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
255 // Corresponding methods are generated for nodes if they specify |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
256 // postalloc_expand. See block.cpp for more documentation. |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
257 virtual bool requires_postalloc_expand() const { return false; } |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
258 virtual void postalloc_expand(GrowableArray <Node *> *nodes, PhaseRegAlloc *ra_); |
0 | 259 // Size of instruction in bytes |
260 virtual uint size(PhaseRegAlloc *ra_) const; | |
261 // Helper function that computes size by emitting code | |
262 virtual uint emit_size(PhaseRegAlloc *ra_) const; | |
263 | |
264 // Return the alignment required (in units of relocInfo::addr_unit()) | |
265 // for this instruction (must be a power of 2) | |
266 virtual int alignment_required() const { return 1; } | |
267 | |
268 // Return the padding (in bytes) to be emitted before this | |
269 // instruction to properly align it. | |
270 virtual int compute_padding(int current_offset) const { return 0; } | |
271 | |
272 // Return number of relocatable values contained in this instruction | |
273 virtual int reloc() const { return 0; } | |
274 | |
14434
318d0622a6d7
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
14431
diff
changeset
|
275 // Return number of words used for double constants in this instruction |
318d0622a6d7
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
14431
diff
changeset
|
276 virtual int ins_num_consts() const { return 0; } |
318d0622a6d7
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
14431
diff
changeset
|
277 |
0 | 278 // Hash and compare over operands. Used to do GVN on machine Nodes. |
279 virtual uint hash() const; | |
280 virtual uint cmp( const Node &n ) const; | |
281 | |
282 // Expand method for MachNode, replaces nodes representing pseudo | |
283 // instructions with a set of nodes which represent real machine | |
284 // instructions and compute the same value. | |
1203 | 285 virtual MachNode *Expand( State *, Node_List &proj_list, Node* mem ) { return this; } |
0 | 286 |
287 // Bottom_type call; value comes from operand0 | |
288 virtual const class Type *bottom_type() const { return _opnds[0]->type(); } | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
289 virtual uint ideal_reg() const { const Type *t = _opnds[0]->type(); return t == TypeInt::CC ? Op_RegFlags : t->ideal_reg(); } |
0 | 290 |
291 // If this is a memory op, return the base pointer and fixed offset. | |
292 // If there are no such, return NULL. If there are multiple addresses | |
293 // or the address is indeterminate (rare cases) then return (Node*)-1, | |
294 // which serves as node bottom. | |
295 // If the offset is not statically determined, set it to Type::OffsetBot. | |
296 // This method is free to ignore stack slots if that helps. | |
297 #define TYPE_PTR_SENTINAL ((const TypePtr*)-1) | |
298 // Passing TYPE_PTR_SENTINAL as adr_type asks for computation of the adr_type if possible | |
299 const Node* get_base_and_disp(intptr_t &offset, const TypePtr* &adr_type) const; | |
300 | |
301 // Helper for get_base_and_disp: find the base and index input nodes. | |
302 // Returns the MachOper as determined by memory_operand(), for use, if | |
303 // needed by the caller. If (MachOper *)-1 is returned, base and index | |
304 // are set to NodeSentinel. If (MachOper *) NULL is returned, base and | |
305 // index are set to NULL. | |
306 const MachOper* memory_inputs(Node* &base, Node* &index) const; | |
307 | |
308 // Helper for memory_inputs: Which operand carries the necessary info? | |
309 // By default, returns NULL, which means there is no such operand. | |
310 // If it returns (MachOper*)-1, this means there are multiple memories. | |
311 virtual const MachOper* memory_operand() const { return NULL; } | |
312 | |
313 // Call "get_base_and_disp" to decide which category of memory is used here. | |
314 virtual const class TypePtr *adr_type() const; | |
315 | |
316 // Apply peephole rule(s) to this instruction | |
317 virtual MachNode *peephole( Block *block, int block_index, PhaseRegAlloc *ra_, int &deleted, Compile* C ); | |
318 | |
319 // Top-level ideal Opcode matched | |
320 virtual int ideal_Opcode() const { return Op_Node; } | |
321 | |
322 // Adds the label for the case | |
323 virtual void add_case_label( int switch_val, Label* blockLabel); | |
324 | |
325 // Set the absolute address for methods | |
326 virtual void method_set( intptr_t addr ); | |
327 | |
328 // Should we clone rather than spill this instruction? | |
329 bool rematerialize() const; | |
330 | |
331 // Get the pipeline info | |
332 static const Pipeline *pipeline_class(); | |
333 virtual const Pipeline *pipeline() const; | |
334 | |
14440
41b780b43b74
8029015: PPC64 (part 216): opto: trap based null and range checks
goetz
parents:
14437
diff
changeset
|
335 // Returns true if this node is a check that can be implemented with a trap. |
41b780b43b74
8029015: PPC64 (part 216): opto: trap based null and range checks
goetz
parents:
14437
diff
changeset
|
336 virtual bool is_TrapBasedCheckNode() const { return false; } |
41b780b43b74
8029015: PPC64 (part 216): opto: trap based null and range checks
goetz
parents:
14437
diff
changeset
|
337 |
0 | 338 #ifndef PRODUCT |
339 virtual const char *Name() const = 0; // Machine-specific name | |
340 virtual void dump_spec(outputStream *st) const; // Print per-node info | |
341 void dump_format(PhaseRegAlloc *ra, outputStream *st) const; // access to virtual | |
342 #endif | |
343 }; | |
344 | |
345 //------------------------------MachIdealNode---------------------------- | |
346 // Machine specific versions of nodes that must be defined by user. | |
347 // These are not converted by matcher from ideal nodes to machine nodes | |
348 // but are inserted into the code by the compiler. | |
349 class MachIdealNode : public MachNode { | |
350 public: | |
351 MachIdealNode( ) {} | |
352 | |
353 // Define the following defaults for non-matched machine nodes | |
354 virtual uint oper_input_base() const { return 0; } | |
355 virtual uint rule() const { return 9999999; } | |
356 virtual const class Type *bottom_type() const { return _opnds == NULL ? Type::CONTROL : MachNode::bottom_type(); } | |
357 }; | |
358 | |
359 //------------------------------MachTypeNode---------------------------- | |
360 // Machine Nodes that need to retain a known Type. | |
361 class MachTypeNode : public MachNode { | |
362 virtual uint size_of() const { return sizeof(*this); } // Size is bigger | |
363 public: | |
6179
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
4120
diff
changeset
|
364 MachTypeNode( ) {} |
0 | 365 const Type *_bottom_type; |
366 | |
367 virtual const class Type *bottom_type() const { return _bottom_type; } | |
368 #ifndef PRODUCT | |
369 virtual void dump_spec(outputStream *st) const; | |
370 #endif | |
371 }; | |
372 | |
373 //------------------------------MachBreakpointNode---------------------------- | |
374 // Machine breakpoint or interrupt Node | |
375 class MachBreakpointNode : public MachIdealNode { | |
376 public: | |
377 MachBreakpointNode( ) {} | |
378 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const; | |
379 virtual uint size(PhaseRegAlloc *ra_) const; | |
380 | |
381 #ifndef PRODUCT | |
382 virtual const char *Name() const { return "Breakpoint"; } | |
383 virtual void format( PhaseRegAlloc *, outputStream *st ) const; | |
384 #endif | |
385 }; | |
386 | |
2008 | 387 //------------------------------MachConstantBaseNode-------------------------- |
388 // Machine node that represents the base address of the constant table. | |
389 class MachConstantBaseNode : public MachIdealNode { | |
390 public: | |
391 static const RegMask& _out_RegMask; // We need the out_RegMask statically in MachConstantNode::in_RegMask(). | |
392 | |
393 public: | |
394 MachConstantBaseNode() : MachIdealNode() { | |
395 init_class_id(Class_MachConstantBase); | |
396 } | |
397 virtual const class Type* bottom_type() const { return TypeRawPtr::NOTNULL; } | |
398 virtual uint ideal_reg() const { return Op_RegP; } | |
399 virtual uint oper_input_base() const { return 1; } | |
400 | |
14428
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
401 virtual bool requires_postalloc_expand() const; |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
402 virtual void postalloc_expand(GrowableArray <Node *> *nodes, PhaseRegAlloc *ra_); |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12146
diff
changeset
|
403 |
2008 | 404 virtual void emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const; |
405 virtual uint size(PhaseRegAlloc* ra_) const; | |
406 virtual bool pinned() const { return UseRDPCForConstantTableBase; } | |
407 | |
408 static const RegMask& static_out_RegMask() { return _out_RegMask; } | |
409 virtual const RegMask& out_RegMask() const { return static_out_RegMask(); } | |
410 | |
411 #ifndef PRODUCT | |
412 virtual const char* Name() const { return "MachConstantBaseNode"; } | |
413 virtual void format(PhaseRegAlloc*, outputStream* st) const; | |
414 #endif | |
415 }; | |
416 | |
417 //------------------------------MachConstantNode------------------------------- | |
418 // Machine node that holds a constant which is stored in the constant table. | |
6179
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
4120
diff
changeset
|
419 class MachConstantNode : public MachTypeNode { |
2008 | 420 protected: |
421 Compile::Constant _constant; // This node's constant. | |
422 | |
423 public: | |
6179
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
4120
diff
changeset
|
424 MachConstantNode() : MachTypeNode() { |
2008 | 425 init_class_id(Class_MachConstant); |
426 } | |
427 | |
428 virtual void eval_constant(Compile* C) { | |
429 #ifdef ASSERT | |
430 tty->print("missing MachConstantNode eval_constant function: "); | |
431 dump(); | |
432 #endif | |
433 ShouldNotCallThis(); | |
434 } | |
435 | |
436 virtual const RegMask &in_RegMask(uint idx) const { | |
437 if (idx == mach_constant_base_node_input()) | |
438 return MachConstantBaseNode::static_out_RegMask(); | |
439 return MachNode::in_RegMask(idx); | |
440 } | |
441 | |
442 // Input edge of MachConstantBaseNode. | |
14434
318d0622a6d7
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
14431
diff
changeset
|
443 virtual uint mach_constant_base_node_input() const { return req() - 1; } |
2008 | 444 |
445 int constant_offset(); | |
446 int constant_offset() const { return ((MachConstantNode*) this)->constant_offset(); } | |
14431
1410ad6b05f1
8028401: PPC (part 117): Improve usability of adlc and format() functionality.
goetz
parents:
14428
diff
changeset
|
447 // Unchecked version to avoid assertions in debug output. |
1410ad6b05f1
8028401: PPC (part 117): Improve usability of adlc and format() functionality.
goetz
parents:
14428
diff
changeset
|
448 int constant_offset_unchecked() const; |
2008 | 449 }; |
450 | |
0 | 451 //------------------------------MachUEPNode----------------------------------- |
452 // Machine Unvalidated Entry Point Node | |
453 class MachUEPNode : public MachIdealNode { | |
454 public: | |
455 MachUEPNode( ) {} | |
456 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const; | |
457 virtual uint size(PhaseRegAlloc *ra_) const; | |
458 | |
459 #ifndef PRODUCT | |
460 virtual const char *Name() const { return "Unvalidated-Entry-Point"; } | |
461 virtual void format( PhaseRegAlloc *, outputStream *st ) const; | |
462 #endif | |
463 }; | |
464 | |
465 //------------------------------MachPrologNode-------------------------------- | |
466 // Machine function Prolog Node | |
467 class MachPrologNode : public MachIdealNode { | |
468 public: | |
469 MachPrologNode( ) {} | |
470 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const; | |
471 virtual uint size(PhaseRegAlloc *ra_) const; | |
472 virtual int reloc() const; | |
473 | |
474 #ifndef PRODUCT | |
475 virtual const char *Name() const { return "Prolog"; } | |
476 virtual void format( PhaseRegAlloc *, outputStream *st ) const; | |
477 #endif | |
478 }; | |
479 | |
480 //------------------------------MachEpilogNode-------------------------------- | |
481 // Machine function Epilog Node | |
482 class MachEpilogNode : public MachIdealNode { | |
483 public: | |
484 MachEpilogNode(bool do_poll = false) : _do_polling(do_poll) {} | |
485 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const; | |
486 virtual uint size(PhaseRegAlloc *ra_) const; | |
487 virtual int reloc() const; | |
488 virtual const Pipeline *pipeline() const; | |
489 | |
490 private: | |
491 bool _do_polling; | |
492 | |
493 public: | |
494 bool do_polling() const { return _do_polling; } | |
495 | |
496 // Offset of safepoint from the beginning of the node | |
497 int safepoint_offset() const; | |
498 | |
499 #ifndef PRODUCT | |
500 virtual const char *Name() const { return "Epilog"; } | |
501 virtual void format( PhaseRegAlloc *, outputStream *st ) const; | |
502 #endif | |
503 }; | |
504 | |
505 //------------------------------MachNopNode----------------------------------- | |
506 // Machine function Nop Node | |
507 class MachNopNode : public MachIdealNode { | |
508 private: | |
509 int _count; | |
510 public: | |
511 MachNopNode( ) : _count(1) {} | |
512 MachNopNode( int count ) : _count(count) {} | |
513 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const; | |
514 virtual uint size(PhaseRegAlloc *ra_) const; | |
515 | |
516 virtual const class Type *bottom_type() const { return Type::CONTROL; } | |
517 | |
518 virtual int ideal_Opcode() const { return Op_Con; } // bogus; see output.cpp | |
519 virtual const Pipeline *pipeline() const; | |
520 #ifndef PRODUCT | |
521 virtual const char *Name() const { return "Nop"; } | |
522 virtual void format( PhaseRegAlloc *, outputStream *st ) const; | |
523 virtual void dump_spec(outputStream *st) const { } // No per-operand info | |
524 #endif | |
525 }; | |
526 | |
527 //------------------------------MachSpillCopyNode------------------------------ | |
528 // Machine SpillCopy Node. Copies 1 or 2 words from any location to any | |
529 // location (stack or register). | |
530 class MachSpillCopyNode : public MachIdealNode { | |
531 const RegMask *_in; // RegMask for input | |
532 const RegMask *_out; // RegMask for output | |
533 const Type *_type; | |
534 public: | |
535 MachSpillCopyNode( Node *n, const RegMask &in, const RegMask &out ) : | |
536 MachIdealNode(), _in(&in), _out(&out), _type(n->bottom_type()) { | |
537 init_class_id(Class_MachSpillCopy); | |
538 init_flags(Flag_is_Copy); | |
539 add_req(NULL); | |
540 add_req(n); | |
541 } | |
542 virtual uint size_of() const { return sizeof(*this); } | |
543 void set_out_RegMask(const RegMask &out) { _out = &out; } | |
544 void set_in_RegMask(const RegMask &in) { _in = ∈ } | |
545 virtual const RegMask &out_RegMask() const { return *_out; } | |
546 virtual const RegMask &in_RegMask(uint) const { return *_in; } | |
547 virtual const class Type *bottom_type() const { return _type; } | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6179
diff
changeset
|
548 virtual uint ideal_reg() const { return _type->ideal_reg(); } |
0 | 549 virtual uint oper_input_base() const { return 1; } |
550 uint implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bool do_size, outputStream* st ) const; | |
551 | |
552 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const; | |
553 virtual uint size(PhaseRegAlloc *ra_) const; | |
554 | |
555 #ifndef PRODUCT | |
556 virtual const char *Name() const { return "MachSpillCopy"; } | |
557 virtual void format( PhaseRegAlloc *, outputStream *st ) const; | |
558 #endif | |
559 }; | |
560 | |
22815
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
561 // MachMergeNode is similar to a PhiNode in a sense it merges multiple values, |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
562 // however it doesn't have a control input and is more like a MergeMem. |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
563 // It is inserted after the register allocation is done to ensure that nodes use single |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
564 // definition of a multidef lrg in a block. |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
565 class MachMergeNode : public MachIdealNode { |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
566 public: |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
567 MachMergeNode(Node *n1) { |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
568 init_class_id(Class_MachMerge); |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
569 add_req(NULL); |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
570 add_req(n1); |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
571 } |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
572 virtual const RegMask &out_RegMask() const { return in(1)->out_RegMask(); } |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
573 virtual const RegMask &in_RegMask(uint idx) const { return in(1)->in_RegMask(idx); } |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
574 virtual const class Type *bottom_type() const { return in(1)->bottom_type(); } |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
575 virtual uint ideal_reg() const { return bottom_type()->ideal_reg(); } |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
576 virtual uint oper_input_base() const { return 1; } |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
577 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { } |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
578 virtual uint size(PhaseRegAlloc *ra_) const { return 0; } |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
579 #ifndef PRODUCT |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
580 virtual const char *Name() const { return "MachMerge"; } |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
581 #endif |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
582 }; |
9df0d8f65fea
8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents:
20447
diff
changeset
|
583 |
3853
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
584 //------------------------------MachBranchNode-------------------------------- |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
585 // Abstract machine branch Node |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
586 class MachBranchNode : public MachIdealNode { |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
587 public: |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
588 MachBranchNode() : MachIdealNode() { |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
589 init_class_id(Class_MachBranch); |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
590 } |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
591 virtual void label_set(Label* label, uint block_num) = 0; |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
592 virtual void save_label(Label** label, uint* block_num) = 0; |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
593 |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
594 // Support for short branches |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
595 virtual MachNode *short_branch_version(Compile* C) { return NULL; } |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
596 |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
597 virtual bool pinned() const { return true; }; |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
598 }; |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
599 |
0 | 600 //------------------------------MachNullChkNode-------------------------------- |
601 // Machine-dependent null-pointer-check Node. Points a real MachNode that is | |
602 // also some kind of memory op. Turns the indicated MachNode into a | |
603 // conditional branch with good latency on the ptr-not-null path and awful | |
604 // latency on the pointer-is-null path. | |
605 | |
3853
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
606 class MachNullCheckNode : public MachBranchNode { |
0 | 607 public: |
608 const uint _vidx; // Index of memop being tested | |
3853
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
609 MachNullCheckNode( Node *ctrl, Node *memop, uint vidx ) : MachBranchNode(), _vidx(vidx) { |
0 | 610 init_class_id(Class_MachNullCheck); |
611 add_req(ctrl); | |
612 add_req(memop); | |
613 } | |
3853
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
614 virtual uint size_of() const { return sizeof(*this); } |
0 | 615 |
616 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const; | |
3839 | 617 virtual void label_set(Label* label, uint block_num); |
3853
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
618 virtual void save_label(Label** label, uint* block_num); |
0 | 619 virtual void negate() { } |
620 virtual const class Type *bottom_type() const { return TypeTuple::IFBOTH; } | |
621 virtual uint ideal_reg() const { return NotAMachineReg; } | |
622 virtual const RegMask &in_RegMask(uint) const; | |
623 virtual const RegMask &out_RegMask() const { return RegMask::Empty; } | |
624 #ifndef PRODUCT | |
625 virtual const char *Name() const { return "NullCheck"; } | |
626 virtual void format( PhaseRegAlloc *, outputStream *st ) const; | |
627 #endif | |
628 }; | |
629 | |
630 //------------------------------MachProjNode---------------------------------- | |
631 // Machine-dependent Ideal projections (how is that for an oxymoron). Really | |
632 // just MachNodes made by the Ideal world that replicate simple projections | |
633 // but with machine-dependent input & output register masks. Generally | |
634 // produced as part of calling conventions. Normally I make MachNodes as part | |
635 // of the Matcher process, but the Matcher is ill suited to issues involving | |
636 // frame handling, so frame handling is all done in the Ideal world with | |
637 // occasional callbacks to the machine model for important info. | |
638 class MachProjNode : public ProjNode { | |
639 public: | |
3842 | 640 MachProjNode( Node *multi, uint con, const RegMask &out, uint ideal_reg ) : ProjNode(multi,con), _rout(out), _ideal_reg(ideal_reg) { |
641 init_class_id(Class_MachProj); | |
642 } | |
0 | 643 RegMask _rout; |
644 const uint _ideal_reg; | |
645 enum projType { | |
646 unmatched_proj = 0, // Projs for Control, I/O, memory not matched | |
647 fat_proj = 999 // Projs killing many regs, defined by _rout | |
648 }; | |
649 virtual int Opcode() const; | |
650 virtual const Type *bottom_type() const; | |
651 virtual const TypePtr *adr_type() const; | |
652 virtual const RegMask &in_RegMask(uint) const { return RegMask::Empty; } | |
653 virtual const RegMask &out_RegMask() const { return _rout; } | |
654 virtual uint ideal_reg() const { return _ideal_reg; } | |
655 // Need size_of() for virtual ProjNode::clone() | |
656 virtual uint size_of() const { return sizeof(MachProjNode); } | |
657 #ifndef PRODUCT | |
658 virtual void dump_spec(outputStream *st) const; | |
659 #endif | |
660 }; | |
661 | |
662 //------------------------------MachIfNode------------------------------------- | |
663 // Machine-specific versions of IfNodes | |
3853
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
664 class MachIfNode : public MachBranchNode { |
0 | 665 virtual uint size_of() const { return sizeof(*this); } // Size is bigger |
666 public: | |
667 float _prob; // Probability branch goes either way | |
668 float _fcnt; // Frequency counter | |
3853
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
669 MachIfNode() : MachBranchNode() { |
0 | 670 init_class_id(Class_MachIf); |
671 } | |
3853
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
672 // Negate conditional branches. |
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
673 virtual void negate() = 0; |
0 | 674 #ifndef PRODUCT |
675 virtual void dump_spec(outputStream *st) const; | |
676 #endif | |
677 }; | |
678 | |
3842 | 679 //------------------------------MachGotoNode----------------------------------- |
680 // Machine-specific versions of GotoNodes | |
3853
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
681 class MachGotoNode : public MachBranchNode { |
3842 | 682 public: |
3853
11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
3851
diff
changeset
|
683 MachGotoNode() : MachBranchNode() { |
3842 | 684 init_class_id(Class_MachGoto); |
685 } | |
686 }; | |
687 | |
0 | 688 //------------------------------MachFastLockNode------------------------------------- |
689 // Machine-specific versions of FastLockNodes | |
690 class MachFastLockNode : public MachNode { | |
691 virtual uint size_of() const { return sizeof(*this); } // Size is bigger | |
692 public: | |
17780 | 693 BiasedLockingCounters* _counters; |
694 RTMLockingCounters* _rtm_counters; // RTM lock counters for inflated locks | |
695 RTMLockingCounters* _stack_rtm_counters; // RTM lock counters for stack locks | |
0 | 696 MachFastLockNode() : MachNode() {} |
697 }; | |
698 | |
699 //------------------------------MachReturnNode-------------------------------- | |
700 // Machine-specific versions of subroutine returns | |
701 class MachReturnNode : public MachNode { | |
702 virtual uint size_of() const; // Size is bigger | |
703 public: | |
704 RegMask *_in_rms; // Input register masks, set during allocation | |
705 ReallocMark _nesting; // assertion check for reallocations | |
706 const TypePtr* _adr_type; // memory effects of call or return | |
707 MachReturnNode() : MachNode() { | |
708 init_class_id(Class_MachReturn); | |
709 _adr_type = TypePtr::BOTTOM; // the default: all of memory | |
710 } | |
711 | |
712 void set_adr_type(const TypePtr* atp) { _adr_type = atp; } | |
713 | |
714 virtual const RegMask &in_RegMask(uint) const; | |
715 virtual bool pinned() const { return true; }; | |
716 virtual const TypePtr *adr_type() const; | |
717 }; | |
718 | |
719 //------------------------------MachSafePointNode----------------------------- | |
720 // Machine-specific versions of safepoints | |
721 class MachSafePointNode : public MachReturnNode { | |
722 public: | |
723 OopMap* _oop_map; // Array of OopMap info (8-bit char) for GC | |
724 JVMState* _jvms; // Pointer to list of JVM State Objects | |
725 uint _jvmadj; // Extra delta to jvms indexes (mach. args) | |
726 OopMap* oop_map() const { return _oop_map; } | |
727 void set_oop_map(OopMap* om) { _oop_map = om; } | |
728 | |
729 MachSafePointNode() : MachReturnNode(), _oop_map(NULL), _jvms(NULL), _jvmadj(0) { | |
730 init_class_id(Class_MachSafePoint); | |
731 } | |
732 | |
733 virtual JVMState* jvms() const { return _jvms; } | |
734 void set_jvms(JVMState* s) { | |
735 _jvms = s; | |
736 } | |
737 virtual const Type *bottom_type() const; | |
738 | |
739 virtual const RegMask &in_RegMask(uint) const; | |
740 | |
741 // Functionality from old debug nodes | |
742 Node *returnadr() const { return in(TypeFunc::ReturnAdr); } | |
743 Node *frameptr () const { return in(TypeFunc::FramePtr); } | |
744 | |
745 Node *local(const JVMState* jvms, uint idx) const { | |
746 assert(verify_jvms(jvms), "jvms must match"); | |
747 return in(_jvmadj + jvms->locoff() + idx); | |
748 } | |
749 Node *stack(const JVMState* jvms, uint idx) const { | |
750 assert(verify_jvms(jvms), "jvms must match"); | |
751 return in(_jvmadj + jvms->stkoff() + idx); | |
752 } | |
753 Node *monitor_obj(const JVMState* jvms, uint idx) const { | |
754 assert(verify_jvms(jvms), "jvms must match"); | |
755 return in(_jvmadj + jvms->monitor_obj_offset(idx)); | |
756 } | |
757 Node *monitor_box(const JVMState* jvms, uint idx) const { | |
758 assert(verify_jvms(jvms), "jvms must match"); | |
759 return in(_jvmadj + jvms->monitor_box_offset(idx)); | |
760 } | |
761 void set_local(const JVMState* jvms, uint idx, Node *c) { | |
762 assert(verify_jvms(jvms), "jvms must match"); | |
763 set_req(_jvmadj + jvms->locoff() + idx, c); | |
764 } | |
765 void set_stack(const JVMState* jvms, uint idx, Node *c) { | |
766 assert(verify_jvms(jvms), "jvms must match"); | |
767 set_req(_jvmadj + jvms->stkoff() + idx, c); | |
768 } | |
769 void set_monitor(const JVMState* jvms, uint idx, Node *c) { | |
770 assert(verify_jvms(jvms), "jvms must match"); | |
771 set_req(_jvmadj + jvms->monoff() + idx, c); | |
772 } | |
773 }; | |
774 | |
775 //------------------------------MachCallNode---------------------------------- | |
776 // Machine-specific versions of subroutine calls | |
777 class MachCallNode : public MachSafePointNode { | |
778 protected: | |
779 virtual uint hash() const { return NO_HASH; } // CFG nodes do not hash | |
780 virtual uint cmp( const Node &n ) const; | |
781 virtual uint size_of() const = 0; // Size is bigger | |
782 public: | |
783 const TypeFunc *_tf; // Function type | |
784 address _entry_point; // Address of the method being called | |
785 float _cnt; // Estimate of number of times called | |
786 uint _argsize; // Size of argument block on stack | |
787 | |
788 const TypeFunc* tf() const { return _tf; } | |
789 const address entry_point() const { return _entry_point; } | |
790 const float cnt() const { return _cnt; } | |
791 uint argsize() const { return _argsize; } | |
792 | |
793 void set_tf(const TypeFunc* tf) { _tf = tf; } | |
794 void set_entry_point(address p) { _entry_point = p; } | |
795 void set_cnt(float c) { _cnt = c; } | |
796 void set_argsize(int s) { _argsize = s; } | |
797 | |
798 MachCallNode() : MachSafePointNode() { | |
799 init_class_id(Class_MachCall); | |
800 } | |
801 | |
802 virtual const Type *bottom_type() const; | |
803 virtual bool pinned() const { return false; } | |
804 virtual const Type *Value( PhaseTransform *phase ) const; | |
805 virtual const RegMask &in_RegMask(uint) const; | |
806 virtual int ret_addr_offset() { return 0; } | |
807 | |
808 bool returns_long() const { return tf()->return_type() == T_LONG; } | |
809 bool return_value_is_used() const; | |
20447
fc2c88ea11a9
8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents:
17877
diff
changeset
|
810 |
fc2c88ea11a9
8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents:
17877
diff
changeset
|
811 // Similar to cousin class CallNode::returns_pointer |
fc2c88ea11a9
8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents:
17877
diff
changeset
|
812 bool returns_pointer() const; |
fc2c88ea11a9
8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents:
17877
diff
changeset
|
813 |
0 | 814 #ifndef PRODUCT |
815 virtual void dump_spec(outputStream *st) const; | |
816 #endif | |
817 }; | |
818 | |
819 //------------------------------MachCallJavaNode------------------------------ | |
820 // "Base" class for machine-specific versions of subroutine calls | |
821 class MachCallJavaNode : public MachCallNode { | |
822 protected: | |
823 virtual uint cmp( const Node &n ) const; | |
824 virtual uint size_of() const; // Size is bigger | |
825 public: | |
826 ciMethod* _method; // Method being direct called | |
827 int _bci; // Byte Code index of call byte code | |
828 bool _optimized_virtual; // Tells if node is a static call or an optimized virtual | |
1137 | 829 bool _method_handle_invoke; // Tells if the call has to preserve SP |
0 | 830 MachCallJavaNode() : MachCallNode() { |
831 init_class_id(Class_MachCallJava); | |
832 } | |
1137 | 833 |
834 virtual const RegMask &in_RegMask(uint) const; | |
835 | |
0 | 836 #ifndef PRODUCT |
837 virtual void dump_spec(outputStream *st) const; | |
838 #endif | |
839 }; | |
840 | |
841 //------------------------------MachCallStaticJavaNode------------------------ | |
842 // Machine-specific versions of monomorphic subroutine calls | |
843 class MachCallStaticJavaNode : public MachCallJavaNode { | |
844 virtual uint cmp( const Node &n ) const; | |
845 virtual uint size_of() const; // Size is bigger | |
846 public: | |
847 const char *_name; // Runtime wrapper name | |
848 MachCallStaticJavaNode() : MachCallJavaNode() { | |
849 init_class_id(Class_MachCallStaticJava); | |
850 } | |
851 | |
852 // If this is an uncommon trap, return the request code, else zero. | |
853 int uncommon_trap_request() const; | |
854 | |
855 virtual int ret_addr_offset(); | |
856 #ifndef PRODUCT | |
857 virtual void dump_spec(outputStream *st) const; | |
858 void dump_trap_args(outputStream *st) const; | |
859 #endif | |
860 }; | |
861 | |
862 //------------------------------MachCallDynamicJavaNode------------------------ | |
863 // Machine-specific versions of possibly megamorphic subroutine calls | |
864 class MachCallDynamicJavaNode : public MachCallJavaNode { | |
865 public: | |
866 int _vtable_index; | |
867 MachCallDynamicJavaNode() : MachCallJavaNode() { | |
868 init_class_id(Class_MachCallDynamicJava); | |
869 DEBUG_ONLY(_vtable_index = -99); // throw an assert if uninitialized | |
870 } | |
871 virtual int ret_addr_offset(); | |
872 #ifndef PRODUCT | |
873 virtual void dump_spec(outputStream *st) const; | |
874 #endif | |
875 }; | |
876 | |
877 //------------------------------MachCallRuntimeNode---------------------------- | |
878 // Machine-specific versions of subroutine calls | |
879 class MachCallRuntimeNode : public MachCallNode { | |
880 virtual uint cmp( const Node &n ) const; | |
881 virtual uint size_of() const; // Size is bigger | |
882 public: | |
883 const char *_name; // Printable name, if _method is NULL | |
884 MachCallRuntimeNode() : MachCallNode() { | |
885 init_class_id(Class_MachCallRuntime); | |
886 } | |
887 virtual int ret_addr_offset(); | |
888 #ifndef PRODUCT | |
889 virtual void dump_spec(outputStream *st) const; | |
890 #endif | |
891 }; | |
892 | |
893 class MachCallLeafNode: public MachCallRuntimeNode { | |
894 public: | |
895 MachCallLeafNode() : MachCallRuntimeNode() { | |
896 init_class_id(Class_MachCallLeaf); | |
897 } | |
898 }; | |
899 | |
900 //------------------------------MachHaltNode----------------------------------- | |
901 // Machine-specific versions of halt nodes | |
902 class MachHaltNode : public MachReturnNode { | |
903 public: | |
904 virtual JVMState* jvms() const; | |
905 }; | |
906 | |
907 | |
908 //------------------------------MachTempNode----------------------------------- | |
909 // Node used by the adlc to construct inputs to represent temporary registers | |
910 class MachTempNode : public MachNode { | |
911 private: | |
912 MachOper *_opnd_array[1]; | |
913 | |
914 public: | |
915 virtual const RegMask &out_RegMask() const { return *_opnds[0]->in_RegMask(0); } | |
916 virtual uint rule() const { return 9999999; } | |
917 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {} | |
918 | |
919 MachTempNode(MachOper* oper) { | |
920 init_class_id(Class_MachTemp); | |
921 _num_opnds = 1; | |
922 _opnds = _opnd_array; | |
923 add_req(NULL); | |
924 _opnds[0] = oper; | |
925 } | |
926 virtual uint size_of() const { return sizeof(MachTempNode); } | |
927 | |
928 #ifndef PRODUCT | |
929 virtual void format(PhaseRegAlloc *, outputStream *st ) const {} | |
930 virtual const char *Name() const { return "MachTemp";} | |
931 #endif | |
932 }; | |
933 | |
934 | |
935 | |
936 //------------------------------labelOper-------------------------------------- | |
937 // Machine-independent version of label operand | |
938 class labelOper : public MachOper { | |
939 private: | |
940 virtual uint num_edges() const { return 0; } | |
941 public: | |
942 // Supported for fixed size branches | |
943 Label* _label; // Label for branch(es) | |
944 | |
945 uint _block_num; | |
946 | |
947 labelOper() : _block_num(0), _label(0) {} | |
948 | |
949 labelOper(Label* label, uint block_num) : _label(label), _block_num(block_num) {} | |
950 | |
951 labelOper(labelOper* l) : _label(l->_label) , _block_num(l->_block_num) {} | |
952 | |
953 virtual MachOper *clone(Compile* C) const; | |
954 | |
3839 | 955 virtual Label *label() const { assert(_label != NULL, "need Label"); return _label; } |
0 | 956 |
957 virtual uint opcode() const; | |
958 | |
959 virtual uint hash() const; | |
960 virtual uint cmp( const MachOper &oper ) const; | |
961 #ifndef PRODUCT | |
962 virtual const char *Name() const { return "Label";} | |
963 | |
964 virtual void int_format(PhaseRegAlloc *ra, const MachNode *node, outputStream *st) const; | |
965 virtual void ext_format(PhaseRegAlloc *ra, const MachNode *node, int idx, outputStream *st) const { int_format( ra, node, st ); } | |
966 #endif | |
967 }; | |
968 | |
969 | |
970 //------------------------------methodOper-------------------------------------- | |
971 // Machine-independent version of method operand | |
972 class methodOper : public MachOper { | |
973 private: | |
974 virtual uint num_edges() const { return 0; } | |
975 public: | |
976 intptr_t _method; // Address of method | |
977 methodOper() : _method(0) {} | |
978 methodOper(intptr_t method) : _method(method) {} | |
979 | |
980 virtual MachOper *clone(Compile* C) const; | |
981 | |
982 virtual intptr_t method() const { return _method; } | |
983 | |
984 virtual uint opcode() const; | |
985 | |
986 virtual uint hash() const; | |
987 virtual uint cmp( const MachOper &oper ) const; | |
988 #ifndef PRODUCT | |
989 virtual const char *Name() const { return "Method";} | |
990 | |
991 virtual void int_format(PhaseRegAlloc *ra, const MachNode *node, outputStream *st) const; | |
992 virtual void ext_format(PhaseRegAlloc *ra, const MachNode *node, int idx, outputStream *st) const { int_format( ra, node, st ); } | |
993 #endif | |
994 }; | |
1972 | 995 |
996 #endif // SHARE_VM_OPTO_MACHNODE_HPP |