author | iveresov |
Thu, 22 Jan 2015 11:25:23 -0800 | |
changeset 28723 | 0a36120cb225 |
parent 27697 | ae60f551e5c8 |
child 30183 | a6588c0a3259 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
23217
35c6db6d3575
8028037: [parfait] warnings from b114 for hotspot.src.share.vm
drchase
parents:
22911
diff
changeset
|
2 |
* Copyright (c) 1997, 2014, 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:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
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:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
17383 | 26 |
#include "opto/callnode.hpp" |
21089
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
27 |
#include "opto/cfgnode.hpp" |
7397 | 28 |
#include "opto/matcher.hpp" |
20289 | 29 |
#include "opto/mathexactnode.hpp" |
7397 | 30 |
#include "opto/multnode.hpp" |
31 |
#include "opto/opcodes.hpp" |
|
32 |
#include "opto/phaseX.hpp" |
|
33 |
#include "opto/regmask.hpp" |
|
34 |
#include "opto/type.hpp" |
|
1 | 35 |
|
36 |
//============================================================================= |
|
37 |
//------------------------------MultiNode-------------------------------------- |
|
38 |
const RegMask &MultiNode::out_RegMask() const { |
|
39 |
return RegMask::Empty; |
|
40 |
} |
|
41 |
||
42 |
Node *MultiNode::match( const ProjNode *proj, const Matcher *m ) { return proj->clone(); } |
|
43 |
||
44 |
//------------------------------proj_out--------------------------------------- |
|
45 |
// Get a named projection |
|
46 |
ProjNode* MultiNode::proj_out(uint which_proj) const { |
|
47 |
assert(Opcode() != Op_If || which_proj == (uint)true || which_proj == (uint)false, "must be 1 or 0"); |
|
48 |
assert(Opcode() != Op_If || outcnt() == 2, "bad if #1"); |
|
49 |
for( DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++ ) { |
|
50 |
Node *p = fast_out(i); |
|
20289 | 51 |
if (p->is_Proj()) { |
52 |
ProjNode *proj = p->as_Proj(); |
|
53 |
if (proj->_con == which_proj) { |
|
54 |
assert(Opcode() != Op_If || proj->Opcode() == (which_proj?Op_IfTrue:Op_IfFalse), "bad if #2"); |
|
55 |
return proj; |
|
56 |
} |
|
57 |
} else { |
|
1 | 58 |
assert(p == this && this->is_Start(), "else must be proj"); |
59 |
continue; |
|
60 |
} |
|
61 |
} |
|
62 |
return NULL; |
|
63 |
} |
|
64 |
||
65 |
//============================================================================= |
|
66 |
//------------------------------ProjNode--------------------------------------- |
|
67 |
uint ProjNode::hash() const { |
|
68 |
// only one input |
|
69 |
return (uintptr_t)in(TypeFunc::Control) + (_con << 1) + (_is_io_use ? 1 : 0); |
|
70 |
} |
|
71 |
uint ProjNode::cmp( const Node &n ) const { return _con == ((ProjNode&)n)._con && ((ProjNode&)n)._is_io_use == _is_io_use; } |
|
72 |
uint ProjNode::size_of() const { return sizeof(ProjNode); } |
|
73 |
||
74 |
// Test if we propagate interesting control along this projection |
|
75 |
bool ProjNode::is_CFG() const { |
|
76 |
Node *def = in(0); |
|
77 |
return (_con == TypeFunc::Control && def->is_CFG()); |
|
78 |
} |
|
79 |
||
17383 | 80 |
const Type* ProjNode::proj_type(const Type* t) const { |
81 |
if (t == Type::TOP) { |
|
82 |
return Type::TOP; |
|
83 |
} |
|
84 |
if (t == Type::BOTTOM) { |
|
85 |
return Type::BOTTOM; |
|
86 |
} |
|
87 |
t = t->is_tuple()->field_at(_con); |
|
88 |
Node* n = in(0); |
|
89 |
if ((_con == TypeFunc::Parms) && |
|
90 |
n->is_CallStaticJava() && n->as_CallStaticJava()->is_boxing_method()) { |
|
91 |
// The result of autoboxing is always non-null on normal path. |
|
22799
83e58bac7980
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
roland
parents:
22234
diff
changeset
|
92 |
t = t->join_speculative(TypePtr::NOTNULL); |
17383 | 93 |
} |
94 |
return t; |
|
95 |
} |
|
96 |
||
1 | 97 |
const Type *ProjNode::bottom_type() const { |
17383 | 98 |
if (in(0) == NULL) return Type::TOP; |
99 |
return proj_type(in(0)->bottom_type()); |
|
1 | 100 |
} |
101 |
||
102 |
const TypePtr *ProjNode::adr_type() const { |
|
103 |
if (bottom_type() == Type::MEMORY) { |
|
104 |
// 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:
23217
diff
changeset
|
105 |
Node* ctrl = in(0); |
ae60f551e5c8
8062258: compiler/debug/TraceIterativeGVN.java segfaults in trace_PhaseIterGVN
vlivanov
parents:
23217
diff
changeset
|
106 |
if (ctrl == NULL) return NULL; // node is dead |
ae60f551e5c8
8062258: compiler/debug/TraceIterativeGVN.java segfaults in trace_PhaseIterGVN
vlivanov
parents:
23217
diff
changeset
|
107 |
const TypePtr* adr_type = ctrl->adr_type(); |
1 | 108 |
#ifdef ASSERT |
109 |
if (!is_error_reported() && !Node::in_dump()) |
|
110 |
assert(adr_type != NULL, "source must have adr_type"); |
|
111 |
#endif |
|
112 |
return adr_type; |
|
113 |
} |
|
114 |
assert(bottom_type()->base() != Type::Memory, "no other memories?"); |
|
115 |
return NULL; |
|
116 |
} |
|
117 |
||
118 |
bool ProjNode::pinned() const { return in(0)->pinned(); } |
|
119 |
#ifndef PRODUCT |
|
120 |
void ProjNode::dump_spec(outputStream *st) const { st->print("#%d",_con); if(_is_io_use) st->print(" (i_o_use)");} |
|
121 |
#endif |
|
122 |
||
123 |
//----------------------------check_con---------------------------------------- |
|
124 |
void ProjNode::check_con() const { |
|
125 |
Node* n = in(0); |
|
126 |
if (n == NULL) return; // should be assert, but NodeHash makes bogons |
|
127 |
if (n->is_Mach()) return; // mach. projs. are not type-safe |
|
128 |
if (n->is_Start()) return; // alas, starts can have mach. projs. also |
|
129 |
if (_con == SCMemProjNode::SCMEMPROJCON ) return; |
|
130 |
const Type* t = n->bottom_type(); |
|
131 |
if (t == Type::TOP) return; // multi is dead |
|
132 |
assert(_con < t->is_tuple()->cnt(), "ProjNode::_con must be in range"); |
|
133 |
} |
|
134 |
||
135 |
//------------------------------Value------------------------------------------ |
|
136 |
const Type *ProjNode::Value( PhaseTransform *phase ) const { |
|
17383 | 137 |
if (in(0) == NULL) return Type::TOP; |
138 |
return proj_type(phase->type(in(0))); |
|
1 | 139 |
} |
140 |
||
141 |
//------------------------------out_RegMask------------------------------------ |
|
142 |
// Pass the buck uphill |
|
143 |
const RegMask &ProjNode::out_RegMask() const { |
|
144 |
return RegMask::Empty; |
|
145 |
} |
|
146 |
||
147 |
//------------------------------ideal_reg-------------------------------------- |
|
148 |
uint ProjNode::ideal_reg() const { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
7397
diff
changeset
|
149 |
return bottom_type()->ideal_reg(); |
1 | 150 |
} |
21089
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
151 |
|
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
152 |
//-------------------------------is_uncommon_trap_proj---------------------------- |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
153 |
// Return true if proj is the form of "proj->[region->..]call_uct" |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
154 |
bool ProjNode::is_uncommon_trap_proj(Deoptimization::DeoptReason reason) { |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
155 |
int path_limit = 10; |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
156 |
Node* out = this; |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
157 |
for (int ct = 0; ct < path_limit; ct++) { |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
158 |
out = out->unique_ctrl_out(); |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
159 |
if (out == NULL) |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
160 |
return false; |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
161 |
if (out->is_CallStaticJava()) { |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
162 |
int req = out->as_CallStaticJava()->uncommon_trap_request(); |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
163 |
if (req != 0) { |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
164 |
Deoptimization::DeoptReason trap_reason = Deoptimization::trap_request_reason(req); |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
165 |
if (trap_reason == reason || reason == Deoptimization::Reason_none) { |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
166 |
return true; |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
167 |
} |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
168 |
} |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
169 |
return false; // don't do further after call |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
170 |
} |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
171 |
if (out->Opcode() != Op_Region) |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
172 |
return false; |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
173 |
} |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
174 |
return false; |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
175 |
} |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
176 |
|
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
177 |
//-------------------------------is_uncommon_trap_if_pattern------------------------- |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
178 |
// Return true for "if(test)-> proj -> ... |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
179 |
// | |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
180 |
// V |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
181 |
// other_proj->[region->..]call_uct" |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
182 |
// |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
183 |
// "must_reason_predicate" means the uct reason must be Reason_predicate |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
184 |
bool ProjNode::is_uncommon_trap_if_pattern(Deoptimization::DeoptReason reason) { |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
185 |
Node *in0 = in(0); |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
186 |
if (!in0->is_If()) return false; |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
187 |
// Variation of a dead If node. |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
188 |
if (in0->outcnt() < 2) return false; |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
189 |
IfNode* iff = in0->as_If(); |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
190 |
|
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
191 |
// we need "If(Conv2B(Opaque1(...)))" pattern for reason_predicate |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
192 |
if (reason != Deoptimization::Reason_none) { |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
193 |
if (iff->in(1)->Opcode() != Op_Conv2B || |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
194 |
iff->in(1)->in(1)->Opcode() != Op_Opaque1) { |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
195 |
return false; |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
196 |
} |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
197 |
} |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
198 |
|
23217
35c6db6d3575
8028037: [parfait] warnings from b114 for hotspot.src.share.vm
drchase
parents:
22911
diff
changeset
|
199 |
ProjNode* other_proj = iff->proj_out(1-_con); |
35c6db6d3575
8028037: [parfait] warnings from b114 for hotspot.src.share.vm
drchase
parents:
22911
diff
changeset
|
200 |
if (other_proj == NULL) // Should never happen, but make Parfait happy. |
35c6db6d3575
8028037: [parfait] warnings from b114 for hotspot.src.share.vm
drchase
parents:
22911
diff
changeset
|
201 |
return false; |
21089
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
202 |
if (other_proj->is_uncommon_trap_proj(reason)) { |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
203 |
assert(reason == Deoptimization::Reason_none || |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
204 |
Compile::current()->is_predicate_opaq(iff->in(1)->in(1)), "should be on the list"); |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
205 |
return true; |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
206 |
} |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
207 |
return false; |
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20289
diff
changeset
|
208 |
} |