author | rraghavan |
Tue, 28 May 2019 12:01:52 +0530 | |
changeset 55050 | feba48c5dfb4 |
parent 54786 | ebf733a324d4 |
child 58015 | dd84de796f2c |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46589 | 2 |
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4566
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4566
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4566
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
30764 | 26 |
#include "gc/shared/collectedHeap.hpp" |
54786 | 27 |
#include "memory/universe.hpp" |
54780
f8d182aedc92
8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
54327
diff
changeset
|
28 |
#include "oops/compressedOops.hpp" |
7397 | 29 |
#include "opto/machnode.hpp" |
30 |
#include "opto/regalloc.hpp" |
|
46589 | 31 |
#include "utilities/vmError.hpp" |
1 | 32 |
|
33 |
//============================================================================= |
|
34 |
// Return the value requested |
|
35 |
// result register lookup, corresponding to int_format |
|
36 |
int MachOper::reg(PhaseRegAlloc *ra_, const Node *node) const { |
|
37 |
return (int)ra_->get_encode(node); |
|
38 |
} |
|
39 |
// input register lookup, corresponding to ext_format |
|
40 |
int MachOper::reg(PhaseRegAlloc *ra_, const Node *node, int idx) const { |
|
41 |
return (int)(ra_->get_encode(node->in(idx))); |
|
42 |
} |
|
43 |
intptr_t MachOper::constant() const { return 0x00; } |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13104
diff
changeset
|
44 |
relocInfo::relocType MachOper::constant_reloc() const { return relocInfo::none; } |
1 | 45 |
jdouble MachOper::constantD() const { ShouldNotReachHere(); return 0.0; } |
46 |
jfloat MachOper::constantF() const { ShouldNotReachHere(); return 0.0; } |
|
47 |
jlong MachOper::constantL() const { ShouldNotReachHere(); return CONST64(0) ; } |
|
48 |
TypeOopPtr *MachOper::oop() const { return NULL; } |
|
49 |
int MachOper::ccode() const { return 0x00; } |
|
50 |
// A zero, default, indicates this value is not needed. |
|
51 |
// May need to lookup the base register, as done in int_ and ext_format |
|
52 |
int MachOper::base (PhaseRegAlloc *ra_, const Node *node, int idx) const { return 0x00; } |
|
53 |
int MachOper::index(PhaseRegAlloc *ra_, const Node *node, int idx) const { return 0x00; } |
|
54 |
int MachOper::scale() const { return 0x00; } |
|
55 |
int MachOper::disp (PhaseRegAlloc *ra_, const Node *node, int idx) const { return 0x00; } |
|
56 |
int MachOper::constant_disp() const { return 0; } |
|
57 |
int MachOper::base_position() const { return -1; } // no base input |
|
58 |
int MachOper::index_position() const { return -1; } // no index input |
|
59 |
// Check for PC-Relative displacement |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13104
diff
changeset
|
60 |
relocInfo::relocType MachOper::disp_reloc() const { return relocInfo::none; } |
1 | 61 |
// Return the label |
62 |
Label* MachOper::label() const { ShouldNotReachHere(); return 0; } |
|
63 |
intptr_t MachOper::method() const { ShouldNotReachHere(); return 0; } |
|
64 |
||
65 |
||
66 |
//------------------------------negate----------------------------------------- |
|
67 |
// Negate conditional branches. Error for non-branch operands |
|
68 |
void MachOper::negate() { |
|
69 |
ShouldNotCallThis(); |
|
70 |
} |
|
71 |
||
72 |
//-----------------------------type-------------------------------------------- |
|
73 |
const Type *MachOper::type() const { |
|
74 |
return Type::BOTTOM; |
|
75 |
} |
|
76 |
||
77 |
//------------------------------in_RegMask------------------------------------- |
|
78 |
const RegMask *MachOper::in_RegMask(int index) const { |
|
79 |
ShouldNotReachHere(); |
|
80 |
return NULL; |
|
81 |
} |
|
82 |
||
83 |
//------------------------------dump_spec-------------------------------------- |
|
84 |
// Print any per-operand special info |
|
85 |
#ifndef PRODUCT |
|
86 |
void MachOper::dump_spec(outputStream *st) const { } |
|
87 |
#endif |
|
88 |
||
89 |
//------------------------------hash------------------------------------------- |
|
90 |
// Print any per-operand special info |
|
91 |
uint MachOper::hash() const { |
|
92 |
ShouldNotCallThis(); |
|
93 |
return 5; |
|
94 |
} |
|
95 |
||
96 |
//------------------------------cmp-------------------------------------------- |
|
97 |
// Print any per-operand special info |
|
54327 | 98 |
bool MachOper::cmp( const MachOper &oper ) const { |
1 | 99 |
ShouldNotCallThis(); |
100 |
return opcode() == oper.opcode(); |
|
101 |
} |
|
102 |
||
103 |
//------------------------------hash------------------------------------------- |
|
104 |
// Print any per-operand special info |
|
105 |
uint labelOper::hash() const { |
|
106 |
return _block_num; |
|
107 |
} |
|
108 |
||
109 |
//------------------------------cmp-------------------------------------------- |
|
110 |
// Print any per-operand special info |
|
54327 | 111 |
bool labelOper::cmp( const MachOper &oper ) const { |
1 | 112 |
return (opcode() == oper.opcode()) && (_label == oper.label()); |
113 |
} |
|
114 |
||
115 |
//------------------------------hash------------------------------------------- |
|
116 |
// Print any per-operand special info |
|
117 |
uint methodOper::hash() const { |
|
118 |
return (uint)_method; |
|
119 |
} |
|
120 |
||
121 |
//------------------------------cmp-------------------------------------------- |
|
122 |
// Print any per-operand special info |
|
54327 | 123 |
bool methodOper::cmp( const MachOper &oper ) const { |
1 | 124 |
return (opcode() == oper.opcode()) && (_method == oper.method()); |
125 |
} |
|
126 |
||
127 |
||
128 |
//============================================================================= |
|
129 |
//------------------------------MachNode--------------------------------------- |
|
130 |
||
131 |
//------------------------------emit------------------------------------------- |
|
132 |
void MachNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { |
|
133 |
#ifdef ASSERT |
|
134 |
tty->print("missing MachNode emit function: "); |
|
135 |
dump(); |
|
136 |
#endif |
|
137 |
ShouldNotCallThis(); |
|
138 |
} |
|
139 |
||
22844
90f76a40ed8a
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
20282
diff
changeset
|
140 |
//---------------------------postalloc_expand---------------------------------- |
90f76a40ed8a
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
20282
diff
changeset
|
141 |
// Expand node after register allocation. |
90f76a40ed8a
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
20282
diff
changeset
|
142 |
void MachNode::postalloc_expand(GrowableArray <Node *> *nodes, PhaseRegAlloc *ra_) {} |
90f76a40ed8a
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
20282
diff
changeset
|
143 |
|
1 | 144 |
//------------------------------size------------------------------------------- |
145 |
// Size of instruction in bytes |
|
146 |
uint MachNode::size(PhaseRegAlloc *ra_) const { |
|
147 |
// If a virtual was not defined for this specific instruction, |
|
2131 | 148 |
// Call the helper which finds the size by emitting the bits. |
1 | 149 |
return MachNode::emit_size(ra_); |
150 |
} |
|
151 |
||
152 |
//------------------------------size------------------------------------------- |
|
153 |
// Helper function that computes size by emitting code |
|
154 |
uint MachNode::emit_size(PhaseRegAlloc *ra_) const { |
|
155 |
// Emit into a trash buffer and count bytes emitted. |
|
156 |
assert(ra_ == ra_->C->regalloc(), "sanity"); |
|
157 |
return ra_->C->scratch_emit_size(this); |
|
158 |
} |
|
159 |
||
160 |
||
161 |
||
162 |
//------------------------------hash------------------------------------------- |
|
163 |
uint MachNode::hash() const { |
|
164 |
uint no = num_opnds(); |
|
165 |
uint sum = rule(); |
|
166 |
for( uint i=0; i<no; i++ ) |
|
167 |
sum += _opnds[i]->hash(); |
|
168 |
return sum+Node::hash(); |
|
169 |
} |
|
170 |
||
171 |
//-----------------------------cmp--------------------------------------------- |
|
54327 | 172 |
bool MachNode::cmp( const Node &node ) const { |
1 | 173 |
MachNode& n = *((Node&)node).as_Mach(); |
174 |
uint no = num_opnds(); |
|
54327 | 175 |
if( no != n.num_opnds() ) return false; |
176 |
if( rule() != n.rule() ) return false; |
|
1 | 177 |
for( uint i=0; i<no; i++ ) // All operands must match |
178 |
if( !_opnds[i]->cmp( *n._opnds[i] ) ) |
|
54327 | 179 |
return false; // mis-matched operands |
180 |
return true; // match |
|
1 | 181 |
} |
182 |
||
183 |
// Return an equivalent instruction using memory for cisc_operand position |
|
25930 | 184 |
MachNode *MachNode::cisc_version(int offset) { |
1 | 185 |
ShouldNotCallThis(); |
186 |
return NULL; |
|
187 |
} |
|
188 |
||
189 |
void MachNode::use_cisc_RegMask() { |
|
190 |
ShouldNotReachHere(); |
|
191 |
} |
|
192 |
||
193 |
||
194 |
//-----------------------------in_RegMask-------------------------------------- |
|
195 |
const RegMask &MachNode::in_RegMask( uint idx ) const { |
|
196 |
uint numopnds = num_opnds(); // Virtual call for number of operands |
|
197 |
uint skipped = oper_input_base(); // Sum of leaves skipped so far |
|
198 |
if( idx < skipped ) { |
|
199 |
assert( ideal_Opcode() == Op_AddP, "expected base ptr here" ); |
|
200 |
assert( idx == 1, "expected base ptr here" ); |
|
201 |
// debug info can be anywhere |
|
202 |
return *Compile::current()->matcher()->idealreg2spillmask[Op_RegP]; |
|
203 |
} |
|
204 |
uint opcnt = 1; // First operand |
|
205 |
uint num_edges = _opnds[1]->num_edges(); // leaves for first operand |
|
206 |
while( idx >= skipped+num_edges ) { |
|
207 |
skipped += num_edges; |
|
208 |
opcnt++; // Bump operand count |
|
209 |
assert( opcnt < numopnds, "Accessing non-existent operand" ); |
|
210 |
num_edges = _opnds[opcnt]->num_edges(); // leaves for next operand |
|
211 |
} |
|
212 |
||
213 |
const RegMask *rm = cisc_RegMask(); |
|
214 |
if( rm == NULL || (int)opcnt != cisc_operand() ) { |
|
215 |
rm = _opnds[opcnt]->in_RegMask(idx-skipped); |
|
216 |
} |
|
217 |
return *rm; |
|
218 |
} |
|
219 |
||
220 |
//-----------------------------memory_inputs-------------------------------- |
|
221 |
const MachOper* MachNode::memory_inputs(Node* &base, Node* &index) const { |
|
222 |
const MachOper* oper = memory_operand(); |
|
223 |
||
224 |
if (oper == (MachOper*)-1) { |
|
225 |
base = NodeSentinel; |
|
226 |
index = NodeSentinel; |
|
227 |
} else { |
|
228 |
base = NULL; |
|
229 |
index = NULL; |
|
230 |
if (oper != NULL) { |
|
231 |
// It has a unique memory operand. Find its index. |
|
232 |
int oper_idx = num_opnds(); |
|
233 |
while (--oper_idx >= 0) { |
|
234 |
if (_opnds[oper_idx] == oper) break; |
|
235 |
} |
|
236 |
int oper_pos = operand_index(oper_idx); |
|
237 |
int base_pos = oper->base_position(); |
|
238 |
if (base_pos >= 0) { |
|
239 |
base = _in[oper_pos+base_pos]; |
|
240 |
} |
|
241 |
int index_pos = oper->index_position(); |
|
242 |
if (index_pos >= 0) { |
|
243 |
index = _in[oper_pos+index_pos]; |
|
244 |
} |
|
245 |
} |
|
246 |
} |
|
247 |
||
248 |
return oper; |
|
249 |
} |
|
250 |
||
251 |
//-----------------------------get_base_and_disp---------------------------- |
|
252 |
const Node* MachNode::get_base_and_disp(intptr_t &offset, const TypePtr* &adr_type) const { |
|
253 |
||
254 |
// Find the memory inputs using our helper function |
|
255 |
Node* base; |
|
256 |
Node* index; |
|
257 |
const MachOper* oper = memory_inputs(base, index); |
|
258 |
||
259 |
if (oper == NULL) { |
|
260 |
// Base has been set to NULL |
|
261 |
offset = 0; |
|
262 |
} else if (oper == (MachOper*)-1) { |
|
263 |
// Base has been set to NodeSentinel |
|
264 |
// There is not a unique memory use here. We will fall to AliasIdxBot. |
|
265 |
offset = Type::OffsetBot; |
|
266 |
} else { |
|
267 |
// Base may be NULL, even if offset turns out to be != 0 |
|
268 |
||
269 |
intptr_t disp = oper->constant_disp(); |
|
270 |
int scale = oper->scale(); |
|
271 |
// Now we have collected every part of the ADLC MEMORY_INTER. |
|
272 |
// See if it adds up to a base + offset. |
|
273 |
if (index != NULL) { |
|
767
64fb1fd7186d
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
762
diff
changeset
|
274 |
const Type* t_index = index->bottom_type(); |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13728
diff
changeset
|
275 |
if (t_index->isa_narrowoop() || t_index->isa_narrowklass()) { // EncodeN, LoadN, LoadConN, LoadNKlass, |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13728
diff
changeset
|
276 |
// EncodeNKlass, LoadConNklass. |
762
1b26adb5fea1
6715633: when matching a memory node the adr_type should not change
kvn
parents:
360
diff
changeset
|
277 |
// Memory references through narrow oops have a |
1b26adb5fea1
6715633: when matching a memory node the adr_type should not change
kvn
parents:
360
diff
changeset
|
278 |
// funny base so grab the type from the index: |
1b26adb5fea1
6715633: when matching a memory node the adr_type should not change
kvn
parents:
360
diff
changeset
|
279 |
// [R12 + narrow_oop_reg<<3 + offset] |
1b26adb5fea1
6715633: when matching a memory node the adr_type should not change
kvn
parents:
360
diff
changeset
|
280 |
assert(base == NULL, "Memory references through narrow oops have no base"); |
1b26adb5fea1
6715633: when matching a memory node the adr_type should not change
kvn
parents:
360
diff
changeset
|
281 |
offset = disp; |
767
64fb1fd7186d
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
762
diff
changeset
|
282 |
adr_type = t_index->make_ptr()->add_offset(offset); |
762
1b26adb5fea1
6715633: when matching a memory node the adr_type should not change
kvn
parents:
360
diff
changeset
|
283 |
return NULL; |
1b26adb5fea1
6715633: when matching a memory node the adr_type should not change
kvn
parents:
360
diff
changeset
|
284 |
} else if (!index->is_Con()) { |
1 | 285 |
disp = Type::OffsetBot; |
286 |
} else if (disp != Type::OffsetBot) { |
|
767
64fb1fd7186d
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
762
diff
changeset
|
287 |
const TypeX* ti = t_index->isa_intptr_t(); |
1 | 288 |
if (ti == NULL) { |
289 |
disp = Type::OffsetBot; // a random constant?? |
|
290 |
} else { |
|
291 |
disp += ti->get_con() << scale; |
|
292 |
} |
|
293 |
} |
|
294 |
} |
|
295 |
offset = disp; |
|
296 |
||
297 |
// In i486.ad, indOffset32X uses base==RegI and disp==RegP, |
|
298 |
// this will prevent alias analysis without the following support: |
|
299 |
// Lookup the TypePtr used by indOffset32X, a compile-time constant oop, |
|
300 |
// Add the offset determined by the "base", or use Type::OffsetBot. |
|
301 |
if( adr_type == TYPE_PTR_SENTINAL ) { |
|
302 |
const TypePtr *t_disp = oper->disp_as_type(); // only !NULL for indOffset32X |
|
303 |
if (t_disp != NULL) { |
|
304 |
offset = Type::OffsetBot; |
|
305 |
const Type* t_base = base->bottom_type(); |
|
306 |
if (t_base->isa_intptr_t()) { |
|
307 |
const TypeX *t_offset = t_base->is_intptr_t(); |
|
308 |
if( t_offset->is_con() ) { |
|
309 |
offset = t_offset->get_con(); |
|
310 |
} |
|
311 |
} |
|
312 |
adr_type = t_disp->add_offset(offset); |
|
3268
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2340
diff
changeset
|
313 |
} else if( base == NULL && offset != 0 && offset != Type::OffsetBot ) { |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2340
diff
changeset
|
314 |
// Use ideal type if it is oop ptr. |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2340
diff
changeset
|
315 |
const TypePtr *tp = oper->type()->isa_ptr(); |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2340
diff
changeset
|
316 |
if( tp != NULL) { |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2340
diff
changeset
|
317 |
adr_type = tp; |
f034e0c86895
6851742: (EA) allocation elimination doesn't work with UseG1GC
kvn
parents:
2340
diff
changeset
|
318 |
} |
1 | 319 |
} |
320 |
} |
|
321 |
||
322 |
} |
|
323 |
return base; |
|
324 |
} |
|
325 |
||
326 |
||
327 |
//---------------------------------adr_type--------------------------------- |
|
328 |
const class TypePtr *MachNode::adr_type() const { |
|
329 |
intptr_t offset = 0; |
|
330 |
const TypePtr *adr_type = TYPE_PTR_SENTINAL; // attempt computing adr_type |
|
331 |
const Node *base = get_base_and_disp(offset, adr_type); |
|
332 |
if( adr_type != TYPE_PTR_SENTINAL ) { |
|
333 |
return adr_type; // get_base_and_disp has the answer |
|
334 |
} |
|
335 |
||
336 |
// Direct addressing modes have no base node, simply an indirect |
|
337 |
// offset, which is always to raw memory. |
|
338 |
// %%%%% Someday we'd like to allow constant oop offsets which |
|
339 |
// would let Intel load from static globals in 1 instruction. |
|
340 |
// Currently Intel requires 2 instructions and a register temp. |
|
341 |
if (base == NULL) { |
|
342 |
// NULL base, zero offset means no memory at all (a null pointer!) |
|
343 |
if (offset == 0) { |
|
344 |
return NULL; |
|
345 |
} |
|
346 |
// NULL base, any offset means any pointer whatever |
|
347 |
if (offset == Type::OffsetBot) { |
|
348 |
return TypePtr::BOTTOM; |
|
349 |
} |
|
350 |
// %%% make offset be intptr_t |
|
20282
7f9cbdf89af2
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
17384
diff
changeset
|
351 |
assert(!Universe::heap()->is_in_reserved(cast_to_oop(offset)), "must be a raw ptr"); |
1 | 352 |
return TypeRawPtr::BOTTOM; |
353 |
} |
|
354 |
||
355 |
// base of -1 with no particular offset means all of memory |
|
356 |
if (base == NodeSentinel) return TypePtr::BOTTOM; |
|
357 |
||
358 |
const Type* t = base->bottom_type(); |
|
54780
f8d182aedc92
8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
54327
diff
changeset
|
359 |
if (t->isa_narrowoop() && CompressedOops::shift() == 0) { |
2340 | 360 |
// 32-bit unscaled narrow oop can be the base of any address expression |
361 |
t = t->make_ptr(); |
|
362 |
} |
|
54780
f8d182aedc92
8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
54327
diff
changeset
|
363 |
if (t->isa_narrowklass() && CompressedKlassPointers::shift() == 0) { |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13728
diff
changeset
|
364 |
// 32-bit unscaled narrow oop can be the base of any address expression |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13728
diff
changeset
|
365 |
t = t->make_ptr(); |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13728
diff
changeset
|
366 |
} |
1 | 367 |
if (t->isa_intptr_t() && offset != 0 && offset != Type::OffsetBot) { |
368 |
// We cannot assert that the offset does not look oop-ish here. |
|
369 |
// Depending on the heap layout the cardmark base could land |
|
370 |
// inside some oopish region. It definitely does for Win2K. |
|
371 |
// The sum of cardmark-base plus shift-by-9-oop lands outside |
|
372 |
// the oop-ish area but we can't assert for that statically. |
|
373 |
return TypeRawPtr::BOTTOM; |
|
374 |
} |
|
375 |
||
376 |
const TypePtr *tp = t->isa_ptr(); |
|
377 |
||
378 |
// be conservative if we do not recognize the type |
|
379 |
if (tp == NULL) { |
|
2340 | 380 |
assert(false, "this path may produce not optimal code"); |
1 | 381 |
return TypePtr::BOTTOM; |
382 |
} |
|
383 |
assert(tp->base() != Type::AnyPtr, "not a bare pointer"); |
|
384 |
||
385 |
return tp->add_offset(offset); |
|
386 |
} |
|
387 |
||
388 |
||
389 |
//-----------------------------operand_index--------------------------------- |
|
390 |
int MachNode::operand_index( uint operand ) const { |
|
391 |
if( operand < 1 ) return -1; |
|
392 |
assert(operand < num_opnds(), "oob"); |
|
393 |
if( _opnds[operand]->num_edges() == 0 ) return -1; |
|
394 |
||
395 |
uint skipped = oper_input_base(); // Sum of leaves skipped so far |
|
396 |
for (uint opcnt = 1; opcnt < operand; opcnt++) { |
|
397 |
uint num_edges = _opnds[opcnt]->num_edges(); // leaves for operand |
|
398 |
skipped += num_edges; |
|
399 |
} |
|
400 |
return skipped; |
|
401 |
} |
|
402 |
||
22853
308672304981
8028767: PPC64: (part 121): smaller shared changes needed to build C2
goetz
parents:
22850
diff
changeset
|
403 |
int MachNode::operand_index(const MachOper *oper) const { |
308672304981
8028767: PPC64: (part 121): smaller shared changes needed to build C2
goetz
parents:
22850
diff
changeset
|
404 |
uint skipped = oper_input_base(); // Sum of leaves skipped so far |
308672304981
8028767: PPC64: (part 121): smaller shared changes needed to build C2
goetz
parents:
22850
diff
changeset
|
405 |
uint opcnt; |
308672304981
8028767: PPC64: (part 121): smaller shared changes needed to build C2
goetz
parents:
22850
diff
changeset
|
406 |
for (opcnt = 1; opcnt < num_opnds(); opcnt++) { |
308672304981
8028767: PPC64: (part 121): smaller shared changes needed to build C2
goetz
parents:
22850
diff
changeset
|
407 |
if (_opnds[opcnt] == oper) break; |
308672304981
8028767: PPC64: (part 121): smaller shared changes needed to build C2
goetz
parents:
22850
diff
changeset
|
408 |
uint num_edges = _opnds[opcnt]->num_edges(); // leaves for operand |
308672304981
8028767: PPC64: (part 121): smaller shared changes needed to build C2
goetz
parents:
22850
diff
changeset
|
409 |
skipped += num_edges; |
308672304981
8028767: PPC64: (part 121): smaller shared changes needed to build C2
goetz
parents:
22850
diff
changeset
|
410 |
} |
308672304981
8028767: PPC64: (part 121): smaller shared changes needed to build C2
goetz
parents:
22850
diff
changeset
|
411 |
if (_opnds[opcnt] != oper) return -1; |
308672304981
8028767: PPC64: (part 121): smaller shared changes needed to build C2
goetz
parents:
22850
diff
changeset
|
412 |
return skipped; |
308672304981
8028767: PPC64: (part 121): smaller shared changes needed to build C2
goetz
parents:
22850
diff
changeset
|
413 |
} |
1 | 414 |
|
415 |
//------------------------------peephole--------------------------------------- |
|
416 |
// Apply peephole rule(s) to this instruction |
|
25930 | 417 |
MachNode *MachNode::peephole(Block *block, int block_index, PhaseRegAlloc *ra_, int &deleted) { |
1 | 418 |
return NULL; |
419 |
} |
|
420 |
||
421 |
//------------------------------add_case_label--------------------------------- |
|
422 |
// Adds the label for the case |
|
423 |
void MachNode::add_case_label( int index_num, Label* blockLabel) { |
|
424 |
ShouldNotCallThis(); |
|
425 |
} |
|
426 |
||
427 |
//------------------------------method_set------------------------------------- |
|
428 |
// Set the absolute address of a method |
|
429 |
void MachNode::method_set( intptr_t addr ) { |
|
430 |
ShouldNotCallThis(); |
|
431 |
} |
|
432 |
||
433 |
//------------------------------rematerialize---------------------------------- |
|
434 |
bool MachNode::rematerialize() const { |
|
435 |
// Temps are always rematerializable |
|
436 |
if (is_MachTemp()) return true; |
|
437 |
||
438 |
uint r = rule(); // Match rule |
|
34194
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
439 |
if (r < Matcher::_begin_rematerialize || |
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
440 |
r >= Matcher::_end_rematerialize) { |
1 | 441 |
return false; |
34194
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
442 |
} |
1 | 443 |
|
444 |
// For 2-address instructions, the input live range is also the output |
|
34194
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
445 |
// live range. Remateralizing does not make progress on the that live range. |
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
446 |
if (two_adr()) return false; |
1 | 447 |
|
448 |
// Check for rematerializing float constants, or not |
|
34194
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
449 |
if (!Matcher::rematerialize_float_constants) { |
1 | 450 |
int op = ideal_Opcode(); |
34194
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
451 |
if (op == Op_ConF || op == Op_ConD) { |
1 | 452 |
return false; |
34194
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
453 |
} |
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
454 |
} |
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
455 |
|
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
456 |
// Defining flags - can't spill these! Must remateralize. |
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
457 |
if (ideal_reg() == Op_RegFlags) { |
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
458 |
return true; |
1 | 459 |
} |
460 |
||
34194
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
461 |
// Stretching lots of inputs - don't do it. |
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
462 |
if (req() > 2) { |
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
463 |
return false; |
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
464 |
} |
1 | 465 |
|
34194
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
466 |
if (req() == 2 && in(1) && in(1)->ideal_reg() == Op_RegFlags) { |
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
467 |
// In(1) will be rematerialized, too. |
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
468 |
// Stretching lots of inputs - don't do it. |
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
469 |
if (in(1)->req() > 2) { |
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
470 |
return false; |
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
471 |
} |
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
472 |
} |
1 | 473 |
|
474 |
// Don't remateralize somebody with bound inputs - it stretches a |
|
475 |
// fixed register lifetime. |
|
476 |
uint idx = oper_input_base(); |
|
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
11190
diff
changeset
|
477 |
if (req() > idx) { |
1 | 478 |
const RegMask &rm = in_RegMask(idx); |
34194
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
479 |
if (rm.is_bound(ideal_reg())) { |
1 | 480 |
return false; |
34194
213af0859e7e
8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents:
30764
diff
changeset
|
481 |
} |
1 | 482 |
} |
483 |
||
484 |
return true; |
|
485 |
} |
|
486 |
||
487 |
#ifndef PRODUCT |
|
488 |
//------------------------------dump_spec-------------------------------------- |
|
489 |
// Print any per-operand special info |
|
490 |
void MachNode::dump_spec(outputStream *st) const { |
|
491 |
uint cnt = num_opnds(); |
|
28202
3518158ff5d0
8067338: compiler/debug/TraceIterativeGVN.java segfaults
vlivanov
parents:
27697
diff
changeset
|
492 |
for( uint i=0; i<cnt; i++ ) { |
3518158ff5d0
8067338: compiler/debug/TraceIterativeGVN.java segfaults
vlivanov
parents:
27697
diff
changeset
|
493 |
if (_opnds[i] != NULL) { |
3518158ff5d0
8067338: compiler/debug/TraceIterativeGVN.java segfaults
vlivanov
parents:
27697
diff
changeset
|
494 |
_opnds[i]->dump_spec(st); |
3518158ff5d0
8067338: compiler/debug/TraceIterativeGVN.java segfaults
vlivanov
parents:
27697
diff
changeset
|
495 |
} else { |
3518158ff5d0
8067338: compiler/debug/TraceIterativeGVN.java segfaults
vlivanov
parents:
27697
diff
changeset
|
496 |
st->print(" _"); |
3518158ff5d0
8067338: compiler/debug/TraceIterativeGVN.java segfaults
vlivanov
parents:
27697
diff
changeset
|
497 |
} |
3518158ff5d0
8067338: compiler/debug/TraceIterativeGVN.java segfaults
vlivanov
parents:
27697
diff
changeset
|
498 |
} |
1 | 499 |
const TypePtr *t = adr_type(); |
500 |
if( t ) { |
|
501 |
Compile* C = Compile::current(); |
|
502 |
if( C->alias_type(t)->is_volatile() ) |
|
503 |
st->print(" Volatile!"); |
|
504 |
} |
|
505 |
} |
|
506 |
||
507 |
//------------------------------dump_format------------------------------------ |
|
508 |
// access to virtual |
|
509 |
void MachNode::dump_format(PhaseRegAlloc *ra, outputStream *st) const { |
|
510 |
format(ra, st); // access to virtual |
|
511 |
} |
|
512 |
#endif |
|
513 |
||
514 |
//============================================================================= |
|
515 |
#ifndef PRODUCT |
|
516 |
void MachTypeNode::dump_spec(outputStream *st) const { |
|
28202
3518158ff5d0
8067338: compiler/debug/TraceIterativeGVN.java segfaults
vlivanov
parents:
27697
diff
changeset
|
517 |
if (_bottom_type != NULL) { |
3518158ff5d0
8067338: compiler/debug/TraceIterativeGVN.java segfaults
vlivanov
parents:
27697
diff
changeset
|
518 |
_bottom_type->dump_on(st); |
3518158ff5d0
8067338: compiler/debug/TraceIterativeGVN.java segfaults
vlivanov
parents:
27697
diff
changeset
|
519 |
} else { |
3518158ff5d0
8067338: compiler/debug/TraceIterativeGVN.java segfaults
vlivanov
parents:
27697
diff
changeset
|
520 |
st->print(" NULL"); |
3518158ff5d0
8067338: compiler/debug/TraceIterativeGVN.java segfaults
vlivanov
parents:
27697
diff
changeset
|
521 |
} |
1 | 522 |
} |
523 |
#endif |
|
524 |
||
7433 | 525 |
|
526 |
//============================================================================= |
|
527 |
int MachConstantNode::constant_offset() { |
|
528 |
// Bind the offset lazily. |
|
11190
d561d41f241a
7003454: order constants in constant table by number of references in code
twisti
parents:
10977
diff
changeset
|
529 |
if (_constant.offset() == -1) { |
7433 | 530 |
Compile::ConstantTable& constant_table = Compile::current()->constant_table(); |
11190
d561d41f241a
7003454: order constants in constant table by number of references in code
twisti
parents:
10977
diff
changeset
|
531 |
int offset = constant_table.find_offset(_constant); |
d561d41f241a
7003454: order constants in constant table by number of references in code
twisti
parents:
10977
diff
changeset
|
532 |
// If called from Compile::scratch_emit_size return the |
d561d41f241a
7003454: order constants in constant table by number of references in code
twisti
parents:
10977
diff
changeset
|
533 |
// pre-calculated offset. |
d561d41f241a
7003454: order constants in constant table by number of references in code
twisti
parents:
10977
diff
changeset
|
534 |
// NOTE: If the AD file does some table base offset optimizations |
d561d41f241a
7003454: order constants in constant table by number of references in code
twisti
parents:
10977
diff
changeset
|
535 |
// later the AD file needs to take care of this fact. |
d561d41f241a
7003454: order constants in constant table by number of references in code
twisti
parents:
10977
diff
changeset
|
536 |
if (Compile::current()->in_scratch_emit_size()) { |
d561d41f241a
7003454: order constants in constant table by number of references in code
twisti
parents:
10977
diff
changeset
|
537 |
return constant_table.calculate_table_base_offset() + offset; |
d561d41f241a
7003454: order constants in constant table by number of references in code
twisti
parents:
10977
diff
changeset
|
538 |
} |
d561d41f241a
7003454: order constants in constant table by number of references in code
twisti
parents:
10977
diff
changeset
|
539 |
_constant.set_offset(constant_table.table_base_offset() + offset); |
7433 | 540 |
} |
11190
d561d41f241a
7003454: order constants in constant table by number of references in code
twisti
parents:
10977
diff
changeset
|
541 |
return _constant.offset(); |
7433 | 542 |
} |
543 |
||
22847
603ad1f10e16
8028401: PPC (part 117): Improve usability of adlc and format() functionality.
goetz
parents:
22844
diff
changeset
|
544 |
int MachConstantNode::constant_offset_unchecked() const { |
603ad1f10e16
8028401: PPC (part 117): Improve usability of adlc and format() functionality.
goetz
parents:
22844
diff
changeset
|
545 |
return _constant.offset(); |
603ad1f10e16
8028401: PPC (part 117): Improve usability of adlc and format() functionality.
goetz
parents:
22844
diff
changeset
|
546 |
} |
7433 | 547 |
|
1 | 548 |
//============================================================================= |
549 |
#ifndef PRODUCT |
|
550 |
void MachNullCheckNode::format( PhaseRegAlloc *ra_, outputStream *st ) const { |
|
551 |
int reg = ra_->get_reg_first(in(1)->in(_vidx)); |
|
15241
87d217c2d183
8005055: pass outputStream to more opto debug routines
kvn
parents:
13969
diff
changeset
|
552 |
st->print("%s %s", Name(), Matcher::regName[reg]); |
1 | 553 |
} |
554 |
#endif |
|
555 |
||
556 |
void MachNullCheckNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { |
|
557 |
// only emits entries in the null-pointer exception handler table |
|
558 |
} |
|
10252 | 559 |
void MachNullCheckNode::label_set(Label* label, uint block_num) { |
560 |
// Nothing to emit |
|
561 |
} |
|
10266
2ea344c79e33
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
10252
diff
changeset
|
562 |
void MachNullCheckNode::save_label( Label** label, uint* block_num ) { |
2ea344c79e33
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
10252
diff
changeset
|
563 |
// Nothing to emit |
2ea344c79e33
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents:
10252
diff
changeset
|
564 |
} |
1 | 565 |
|
566 |
const RegMask &MachNullCheckNode::in_RegMask( uint idx ) const { |
|
567 |
if( idx == 0 ) return RegMask::Empty; |
|
568 |
else return in(1)->as_Mach()->out_RegMask(); |
|
569 |
} |
|
570 |
||
571 |
//============================================================================= |
|
572 |
const Type *MachProjNode::bottom_type() const { |
|
573 |
if( _ideal_reg == fat_proj ) return Type::BOTTOM; |
|
574 |
// Try the normal mechanism first |
|
575 |
const Type *t = in(0)->bottom_type(); |
|
576 |
if( t->base() == Type::Tuple ) { |
|
577 |
const TypeTuple *tt = t->is_tuple(); |
|
578 |
if (_con < tt->cnt()) |
|
579 |
return tt->field_at(_con); |
|
580 |
} |
|
581 |
// Else use generic type from ideal register set |
|
582 |
assert((uint)_ideal_reg < (uint)_last_machine_leaf && Type::mreg2type[_ideal_reg], "in bounds"); |
|
583 |
return Type::mreg2type[_ideal_reg]; |
|
584 |
} |
|
585 |
||
586 |
const TypePtr *MachProjNode::adr_type() const { |
|
587 |
if (bottom_type() == Type::MEMORY) { |
|
588 |
// in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM |
|
27697
ae60f551e5c8
8062258: compiler/debug/TraceIterativeGVN.java segfaults in trace_PhaseIterGVN
vlivanov
parents:
25930
diff
changeset
|
589 |
Node* ctrl = in(0); |
ae60f551e5c8
8062258: compiler/debug/TraceIterativeGVN.java segfaults in trace_PhaseIterGVN
vlivanov
parents:
25930
diff
changeset
|
590 |
if (ctrl == NULL) return NULL; // node is dead |
ae60f551e5c8
8062258: compiler/debug/TraceIterativeGVN.java segfaults in trace_PhaseIterGVN
vlivanov
parents:
25930
diff
changeset
|
591 |
const TypePtr* adr_type = ctrl->adr_type(); |
1 | 592 |
#ifdef ASSERT |
46589 | 593 |
if (!VMError::is_error_reported() && !Node::in_dump()) |
1 | 594 |
assert(adr_type != NULL, "source must have adr_type"); |
595 |
#endif |
|
596 |
return adr_type; |
|
597 |
} |
|
598 |
assert(bottom_type()->base() != Type::Memory, "no other memories?"); |
|
599 |
return NULL; |
|
600 |
} |
|
601 |
||
602 |
#ifndef PRODUCT |
|
603 |
void MachProjNode::dump_spec(outputStream *st) const { |
|
604 |
ProjNode::dump_spec(st); |
|
605 |
switch (_ideal_reg) { |
|
38244
63cd9f129814
8156131: C2: MachProj dumps data on tty w/ -XX:+WizardMode
jcm
parents:
35551
diff
changeset
|
606 |
case unmatched_proj: st->print("/unmatched"); break; |
63cd9f129814
8156131: C2: MachProj dumps data on tty w/ -XX:+WizardMode
jcm
parents:
35551
diff
changeset
|
607 |
case fat_proj: st->print("/fat"); if (WizardMode) _rout.dump(st); break; |
1 | 608 |
} |
609 |
} |
|
610 |
#endif |
|
611 |
||
612 |
//============================================================================= |
|
613 |
#ifndef PRODUCT |
|
614 |
void MachIfNode::dump_spec(outputStream *st) const { |
|
615 |
st->print("P=%f, C=%f",_prob, _fcnt); |
|
616 |
} |
|
617 |
#endif |
|
618 |
||
619 |
//============================================================================= |
|
620 |
uint MachReturnNode::size_of() const { return sizeof(*this); } |
|
621 |
||
622 |
//------------------------------Registers-------------------------------------- |
|
623 |
const RegMask &MachReturnNode::in_RegMask( uint idx ) const { |
|
624 |
return _in_rms[idx]; |
|
625 |
} |
|
626 |
||
627 |
const TypePtr *MachReturnNode::adr_type() const { |
|
628 |
// most returns and calls are assumed to consume & modify all of memory |
|
629 |
// the matcher will copy non-wide adr_types from ideal originals |
|
630 |
return _adr_type; |
|
631 |
} |
|
632 |
||
633 |
//============================================================================= |
|
634 |
const Type *MachSafePointNode::bottom_type() const { return TypeTuple::MEMBAR; } |
|
635 |
||
636 |
//------------------------------Registers-------------------------------------- |
|
637 |
const RegMask &MachSafePointNode::in_RegMask( uint idx ) const { |
|
638 |
// Values in the domain use the users calling convention, embodied in the |
|
639 |
// _in_rms array of RegMasks. |
|
640 |
if( idx < TypeFunc::Parms ) return _in_rms[idx]; |
|
641 |
||
642 |
if (SafePointNode::needs_polling_address_input() && |
|
643 |
idx == TypeFunc::Parms && |
|
644 |
ideal_Opcode() == Op_SafePoint) { |
|
645 |
return MachNode::in_RegMask(idx); |
|
646 |
} |
|
647 |
||
648 |
// Values outside the domain represent debug info |
|
43482
7417485c50f9
8172850: Anti-dependency on membar causes crash in register allocator due to invalid instruction scheduling
thartmann
parents:
38244
diff
changeset
|
649 |
assert(in(idx)->ideal_reg() != Op_RegFlags, "flags register is not spillable"); |
1 | 650 |
return *Compile::current()->matcher()->idealreg2spillmask[in(idx)->ideal_reg()]; |
651 |
} |
|
652 |
||
653 |
||
654 |
//============================================================================= |
|
655 |
||
54327 | 656 |
bool MachCallNode::cmp( const Node &n ) const |
1 | 657 |
{ return _tf == ((MachCallNode&)n)._tf; } |
658 |
const Type *MachCallNode::bottom_type() const { return tf()->range(); } |
|
35551
36ef3841fb34
8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents:
35086
diff
changeset
|
659 |
const Type* MachCallNode::Value(PhaseGVN* phase) const { return tf()->range(); } |
1 | 660 |
|
661 |
#ifndef PRODUCT |
|
662 |
void MachCallNode::dump_spec(outputStream *st) const { |
|
663 |
st->print("# "); |
|
28202
3518158ff5d0
8067338: compiler/debug/TraceIterativeGVN.java segfaults
vlivanov
parents:
27697
diff
changeset
|
664 |
if (tf() != NULL) tf()->dump_on(st); |
1 | 665 |
if (_cnt != COUNT_UNKNOWN) st->print(" C=%f",_cnt); |
666 |
if (jvms() != NULL) jvms()->dump_spec(st); |
|
667 |
} |
|
668 |
#endif |
|
669 |
||
670 |
bool MachCallNode::return_value_is_used() const { |
|
671 |
if (tf()->range()->cnt() == TypeFunc::Parms) { |
|
672 |
// void return |
|
673 |
return false; |
|
674 |
} |
|
675 |
||
676 |
// find the projection corresponding to the return value |
|
677 |
for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) { |
|
678 |
Node *use = fast_out(i); |
|
679 |
if (!use->is_Proj()) continue; |
|
680 |
if (use->as_Proj()->_con == TypeFunc::Parms) { |
|
681 |
return true; |
|
682 |
} |
|
683 |
} |
|
684 |
return false; |
|
685 |
} |
|
686 |
||
25637
369f62cdfaba
8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents:
22853
diff
changeset
|
687 |
// Similar to cousin class CallNode::returns_pointer |
369f62cdfaba
8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents:
22853
diff
changeset
|
688 |
// Because this is used in deoptimization, we want the type info, not the data |
369f62cdfaba
8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents:
22853
diff
changeset
|
689 |
// flow info; the interpreter will "use" things that are dead to the optimizer. |
369f62cdfaba
8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents:
22853
diff
changeset
|
690 |
bool MachCallNode::returns_pointer() const { |
369f62cdfaba
8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents:
22853
diff
changeset
|
691 |
const TypeTuple *r = tf()->range(); |
369f62cdfaba
8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents:
22853
diff
changeset
|
692 |
return (r->cnt() > TypeFunc::Parms && |
369f62cdfaba
8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents:
22853
diff
changeset
|
693 |
r->field_at(TypeFunc::Parms)->isa_ptr()); |
369f62cdfaba
8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents:
22853
diff
changeset
|
694 |
} |
1 | 695 |
|
696 |
//------------------------------Registers-------------------------------------- |
|
22850
4e69ce7e1101
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
22847
diff
changeset
|
697 |
const RegMask &MachCallNode::in_RegMask(uint idx) const { |
1 | 698 |
// Values in the domain use the users calling convention, embodied in the |
699 |
// _in_rms array of RegMasks. |
|
22850
4e69ce7e1101
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
22847
diff
changeset
|
700 |
if (idx < tf()->domain()->cnt()) { |
4e69ce7e1101
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
22847
diff
changeset
|
701 |
return _in_rms[idx]; |
4e69ce7e1101
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
22847
diff
changeset
|
702 |
} |
4e69ce7e1101
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
22847
diff
changeset
|
703 |
if (idx == mach_constant_base_node_input()) { |
4e69ce7e1101
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
22847
diff
changeset
|
704 |
return MachConstantBaseNode::static_out_RegMask(); |
4e69ce7e1101
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
22847
diff
changeset
|
705 |
} |
1 | 706 |
// Values outside the domain represent debug info |
707 |
return *Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()]; |
|
708 |
} |
|
709 |
||
710 |
//============================================================================= |
|
711 |
uint MachCallJavaNode::size_of() const { return sizeof(*this); } |
|
54327 | 712 |
bool MachCallJavaNode::cmp( const Node &n ) const { |
1 | 713 |
MachCallJavaNode &call = (MachCallJavaNode&)n; |
35086
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34194
diff
changeset
|
714 |
return MachCallNode::cmp(call) && _method->equals(call._method) && |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34194
diff
changeset
|
715 |
_override_symbolic_info == call._override_symbolic_info; |
1 | 716 |
} |
717 |
#ifndef PRODUCT |
|
718 |
void MachCallJavaNode::dump_spec(outputStream *st) const { |
|
4566
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
719 |
if (_method_handle_invoke) |
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
720 |
st->print("MethodHandle "); |
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
721 |
if (_method) { |
1 | 722 |
_method->print_short_name(st); |
723 |
st->print(" "); |
|
724 |
} |
|
725 |
MachCallNode::dump_spec(st); |
|
726 |
} |
|
727 |
#endif |
|
728 |
||
4566
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
729 |
//------------------------------Registers-------------------------------------- |
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
730 |
const RegMask &MachCallJavaNode::in_RegMask(uint idx) const { |
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
731 |
// Values in the domain use the users calling convention, embodied in the |
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
732 |
// _in_rms array of RegMasks. |
22850
4e69ce7e1101
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
22847
diff
changeset
|
733 |
if (idx < tf()->domain()->cnt()) { |
4e69ce7e1101
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
22847
diff
changeset
|
734 |
return _in_rms[idx]; |
4e69ce7e1101
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
22847
diff
changeset
|
735 |
} |
4e69ce7e1101
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
22847
diff
changeset
|
736 |
if (idx == mach_constant_base_node_input()) { |
4e69ce7e1101
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
22847
diff
changeset
|
737 |
return MachConstantBaseNode::static_out_RegMask(); |
4e69ce7e1101
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
22847
diff
changeset
|
738 |
} |
4566
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
739 |
// Values outside the domain represent debug info |
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
740 |
Matcher* m = Compile::current()->matcher(); |
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
741 |
// If this call is a MethodHandle invoke we have to use a different |
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
742 |
// debugmask which does not include the register we use to save the |
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
743 |
// SP over MH invokes. |
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
744 |
RegMask** debugmask = _method_handle_invoke ? m->idealreg2mhdebugmask : m->idealreg2debugmask; |
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
745 |
return *debugmask[in(idx)->ideal_reg()]; |
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
746 |
} |
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
3283
diff
changeset
|
747 |
|
1 | 748 |
//============================================================================= |
749 |
uint MachCallStaticJavaNode::size_of() const { return sizeof(*this); } |
|
54327 | 750 |
bool MachCallStaticJavaNode::cmp( const Node &n ) const { |
1 | 751 |
MachCallStaticJavaNode &call = (MachCallStaticJavaNode&)n; |
752 |
return MachCallJavaNode::cmp(call) && _name == call._name; |
|
753 |
} |
|
754 |
||
755 |
//----------------------------uncommon_trap_request---------------------------- |
|
756 |
// If this is an uncommon trap, return the request code, else zero. |
|
757 |
int MachCallStaticJavaNode::uncommon_trap_request() const { |
|
758 |
if (_name != NULL && !strcmp(_name, "uncommon_trap")) { |
|
759 |
return CallStaticJavaNode::extract_uncommon_trap_request(this); |
|
760 |
} |
|
761 |
return 0; |
|
762 |
} |
|
763 |
||
764 |
#ifndef PRODUCT |
|
765 |
// Helper for summarizing uncommon_trap arguments. |
|
766 |
void MachCallStaticJavaNode::dump_trap_args(outputStream *st) const { |
|
767 |
int trap_req = uncommon_trap_request(); |
|
768 |
if (trap_req != 0) { |
|
769 |
char buf[100]; |
|
770 |
st->print("(%s)", |
|
771 |
Deoptimization::format_trap_request(buf, sizeof(buf), |
|
772 |
trap_req)); |
|
773 |
} |
|
774 |
} |
|
775 |
||
776 |
void MachCallStaticJavaNode::dump_spec(outputStream *st) const { |
|
777 |
st->print("Static "); |
|
778 |
if (_name != NULL) { |
|
779 |
st->print("wrapper for: %s", _name ); |
|
780 |
dump_trap_args(st); |
|
781 |
st->print(" "); |
|
782 |
} |
|
783 |
MachCallJavaNode::dump_spec(st); |
|
784 |
} |
|
785 |
#endif |
|
786 |
||
787 |
//============================================================================= |
|
788 |
#ifndef PRODUCT |
|
789 |
void MachCallDynamicJavaNode::dump_spec(outputStream *st) const { |
|
790 |
st->print("Dynamic "); |
|
791 |
MachCallJavaNode::dump_spec(st); |
|
792 |
} |
|
793 |
#endif |
|
794 |
//============================================================================= |
|
795 |
uint MachCallRuntimeNode::size_of() const { return sizeof(*this); } |
|
54327 | 796 |
bool MachCallRuntimeNode::cmp( const Node &n ) const { |
1 | 797 |
MachCallRuntimeNode &call = (MachCallRuntimeNode&)n; |
798 |
return MachCallNode::cmp(call) && !strcmp(_name,call._name); |
|
799 |
} |
|
800 |
#ifndef PRODUCT |
|
801 |
void MachCallRuntimeNode::dump_spec(outputStream *st) const { |
|
802 |
st->print("%s ",_name); |
|
803 |
MachCallNode::dump_spec(st); |
|
804 |
} |
|
805 |
#endif |
|
806 |
//============================================================================= |
|
807 |
// A shared JVMState for all HaltNodes. Indicates the start of debug info |
|
808 |
// is at TypeFunc::Parms. Only required for SOE register spill handling - |
|
809 |
// to indicate where the stack-slot-only debug info inputs begin. |
|
810 |
// There is no other JVM state needed here. |
|
811 |
JVMState jvms_for_throw(0); |
|
812 |
JVMState *MachHaltNode::jvms() const { |
|
813 |
return &jvms_for_throw; |
|
814 |
} |
|
815 |
||
51566 | 816 |
uint MachMemBarNode::size_of() const { return sizeof(*this); } |
817 |
||
818 |
const TypePtr *MachMemBarNode::adr_type() const { |
|
819 |
return _adr_type; |
|
820 |
} |
|
821 |
||
822 |
||
1 | 823 |
//============================================================================= |
824 |
#ifndef PRODUCT |
|
825 |
void labelOper::int_format(PhaseRegAlloc *ra, const MachNode *node, outputStream *st) const { |
|
826 |
st->print("B%d", _block_num); |
|
827 |
} |
|
828 |
#endif // PRODUCT |
|
829 |
||
830 |
//============================================================================= |
|
831 |
#ifndef PRODUCT |
|
832 |
void methodOper::int_format(PhaseRegAlloc *ra, const MachNode *node, outputStream *st) const { |
|
833 |
st->print(INTPTR_FORMAT, _method); |
|
834 |
} |
|
835 |
#endif // PRODUCT |