author | roland |
Thu, 03 Oct 2013 10:55:07 +0200 | |
changeset 20696 | 946797ddfade |
parent 20693 | 1d94d9407c58 |
child 21099 | 46e6bbecd9e5 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13204
diff
changeset
|
2 |
* Copyright (c) 1998, 2012, 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:
4761
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4761
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:
4761
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "ci/ciMethodData.hpp" |
|
27 |
#include "classfile/systemDictionary.hpp" |
|
28 |
#include "classfile/vmSymbols.hpp" |
|
29 |
#include "compiler/compileLog.hpp" |
|
30 |
#include "interpreter/linkResolver.hpp" |
|
31 |
#include "memory/universe.inline.hpp" |
|
32 |
#include "opto/addnode.hpp" |
|
33 |
#include "opto/divnode.hpp" |
|
34 |
#include "opto/idealGraphPrinter.hpp" |
|
35 |
#include "opto/matcher.hpp" |
|
36 |
#include "opto/memnode.hpp" |
|
37 |
#include "opto/mulnode.hpp" |
|
38 |
#include "opto/parse.hpp" |
|
39 |
#include "opto/runtime.hpp" |
|
40 |
#include "runtime/deoptimization.hpp" |
|
41 |
#include "runtime/sharedRuntime.hpp" |
|
1 | 42 |
|
43 |
extern int explicit_null_checks_inserted, |
|
44 |
explicit_null_checks_elided; |
|
45 |
||
46 |
//---------------------------------array_load---------------------------------- |
|
47 |
void Parse::array_load(BasicType elem_type) { |
|
48 |
const Type* elem = Type::TOP; |
|
49 |
Node* adr = array_addressing(elem_type, 0, &elem); |
|
2131 | 50 |
if (stopped()) return; // guaranteed null or range check |
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
51 |
dec_sp(2); // Pop array and index |
1 | 52 |
const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type); |
53 |
Node* ld = make_load(control(), adr, elem, elem_type, adr_type); |
|
54 |
push(ld); |
|
55 |
} |
|
56 |
||
57 |
||
58 |
//--------------------------------array_store---------------------------------- |
|
59 |
void Parse::array_store(BasicType elem_type) { |
|
60 |
Node* adr = array_addressing(elem_type, 1); |
|
2131 | 61 |
if (stopped()) return; // guaranteed null or range check |
1 | 62 |
Node* val = pop(); |
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
63 |
dec_sp(2); // Pop array and index |
1 | 64 |
const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type); |
65 |
store_to_memory(control(), adr, val, elem_type, adr_type); |
|
66 |
} |
|
67 |
||
68 |
||
69 |
//------------------------------array_addressing------------------------------- |
|
70 |
// Pull array and index from the stack. Compute pointer-to-element. |
|
71 |
Node* Parse::array_addressing(BasicType type, int vals, const Type* *result2) { |
|
72 |
Node *idx = peek(0+vals); // Get from stack without popping |
|
73 |
Node *ary = peek(1+vals); // in case of exception |
|
74 |
||
75 |
// Null check the array base, with correct stack contents |
|
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
76 |
ary = null_check(ary, T_ARRAY); |
1 | 77 |
// Compile-time detect of null-exception? |
78 |
if (stopped()) return top(); |
|
79 |
||
80 |
const TypeAryPtr* arytype = _gvn.type(ary)->is_aryptr(); |
|
81 |
const TypeInt* sizetype = arytype->size(); |
|
82 |
const Type* elemtype = arytype->elem(); |
|
83 |
||
84 |
if (UseUniqueSubclasses && result2 != NULL) { |
|
767
64fb1fd7186d
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
376
diff
changeset
|
85 |
const Type* el = elemtype->make_ptr(); |
64fb1fd7186d
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
376
diff
changeset
|
86 |
if (el && el->isa_instptr()) { |
64fb1fd7186d
6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode
kvn
parents:
376
diff
changeset
|
87 |
const TypeInstPtr* toop = el->is_instptr(); |
1 | 88 |
if (toop->klass()->as_instance_klass()->unique_concrete_subklass()) { |
89 |
// If we load from "AbstractClass[]" we must see "ConcreteSubClass". |
|
90 |
const Type* subklass = Type::get_const_type(toop->klass()); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
210
diff
changeset
|
91 |
elemtype = subklass->join(el); |
1 | 92 |
} |
93 |
} |
|
94 |
} |
|
95 |
||
96 |
// Check for big class initializers with all constant offsets |
|
97 |
// feeding into a known-size array. |
|
98 |
const TypeInt* idxtype = _gvn.type(idx)->is_int(); |
|
99 |
// See if the highest idx value is less than the lowest array bound, |
|
100 |
// and if the idx value cannot be negative: |
|
101 |
bool need_range_check = true; |
|
102 |
if (idxtype->_hi < sizetype->_lo && idxtype->_lo >= 0) { |
|
103 |
need_range_check = false; |
|
104 |
if (C->log() != NULL) C->log()->elem("observe that='!need_range_check'"); |
|
105 |
} |
|
106 |
||
16613
58c6d72ad0ef
8009539: JVM crash when run lambda testng tests
bharadwaj
parents:
14621
diff
changeset
|
107 |
ciKlass * arytype_klass = arytype->klass(); |
58c6d72ad0ef
8009539: JVM crash when run lambda testng tests
bharadwaj
parents:
14621
diff
changeset
|
108 |
if ((arytype_klass != NULL) && (!arytype_klass->is_loaded())) { |
1 | 109 |
// Only fails for some -Xcomp runs |
110 |
// The class is unloaded. We have to run this bytecode in the interpreter. |
|
111 |
uncommon_trap(Deoptimization::Reason_unloaded, |
|
112 |
Deoptimization::Action_reinterpret, |
|
113 |
arytype->klass(), "!loaded array"); |
|
114 |
return top(); |
|
115 |
} |
|
116 |
||
117 |
// Do the range check |
|
118 |
if (GenerateRangeChecks && need_range_check) { |
|
376
7209afaaef5d
6646019: array subscript expressions become top() with -d64
rasbold
parents:
360
diff
changeset
|
119 |
Node* tst; |
7209afaaef5d
6646019: array subscript expressions become top() with -d64
rasbold
parents:
360
diff
changeset
|
120 |
if (sizetype->_hi <= 0) { |
1398
342890a5d031
6711100: 64bit fastdebug server vm crashes with assert(_base == Int,"Not an Int")
rasbold
parents:
962
diff
changeset
|
121 |
// The greatest array bound is negative, so we can conclude that we're |
376
7209afaaef5d
6646019: array subscript expressions become top() with -d64
rasbold
parents:
360
diff
changeset
|
122 |
// compiling unreachable code, but the unsigned compare trick used below |
7209afaaef5d
6646019: array subscript expressions become top() with -d64
rasbold
parents:
360
diff
changeset
|
123 |
// only works with non-negative lengths. Instead, hack "tst" to be zero so |
7209afaaef5d
6646019: array subscript expressions become top() with -d64
rasbold
parents:
360
diff
changeset
|
124 |
// the uncommon_trap path will always be taken. |
7209afaaef5d
6646019: array subscript expressions become top() with -d64
rasbold
parents:
360
diff
changeset
|
125 |
tst = _gvn.intcon(0); |
7209afaaef5d
6646019: array subscript expressions become top() with -d64
rasbold
parents:
360
diff
changeset
|
126 |
} else { |
1398
342890a5d031
6711100: 64bit fastdebug server vm crashes with assert(_base == Int,"Not an Int")
rasbold
parents:
962
diff
changeset
|
127 |
// Range is constant in array-oop, so we can use the original state of mem |
342890a5d031
6711100: 64bit fastdebug server vm crashes with assert(_base == Int,"Not an Int")
rasbold
parents:
962
diff
changeset
|
128 |
Node* len = load_array_length(ary); |
342890a5d031
6711100: 64bit fastdebug server vm crashes with assert(_base == Int,"Not an Int")
rasbold
parents:
962
diff
changeset
|
129 |
|
376
7209afaaef5d
6646019: array subscript expressions become top() with -d64
rasbold
parents:
360
diff
changeset
|
130 |
// Test length vs index (standard trick using unsigned compare) |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
131 |
Node* chk = _gvn.transform( new (C) CmpUNode(idx, len) ); |
376
7209afaaef5d
6646019: array subscript expressions become top() with -d64
rasbold
parents:
360
diff
changeset
|
132 |
BoolTest::mask btest = BoolTest::lt; |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
133 |
tst = _gvn.transform( new (C) BoolNode(chk, btest) ); |
376
7209afaaef5d
6646019: array subscript expressions become top() with -d64
rasbold
parents:
360
diff
changeset
|
134 |
} |
1 | 135 |
// Branch to failure if out of bounds |
136 |
{ BuildCutout unless(this, tst, PROB_MAX); |
|
137 |
if (C->allow_range_check_smearing()) { |
|
138 |
// Do not use builtin_throw, since range checks are sometimes |
|
139 |
// made more stringent by an optimistic transformation. |
|
140 |
// This creates "tentative" range checks at this point, |
|
141 |
// which are not guaranteed to throw exceptions. |
|
142 |
// See IfNode::Ideal, is_range_check, adjust_check. |
|
143 |
uncommon_trap(Deoptimization::Reason_range_check, |
|
144 |
Deoptimization::Action_make_not_entrant, |
|
145 |
NULL, "range_check"); |
|
146 |
} else { |
|
147 |
// If we have already recompiled with the range-check-widening |
|
148 |
// heroic optimization turned off, then we must really be throwing |
|
149 |
// range check exceptions. |
|
150 |
builtin_throw(Deoptimization::Reason_range_check, idx); |
|
151 |
} |
|
152 |
} |
|
153 |
} |
|
154 |
// Check for always knowing you are throwing a range-check exception |
|
155 |
if (stopped()) return top(); |
|
156 |
||
1398
342890a5d031
6711100: 64bit fastdebug server vm crashes with assert(_base == Int,"Not an Int")
rasbold
parents:
962
diff
changeset
|
157 |
Node* ptr = array_element_address(ary, idx, type, sizetype); |
1 | 158 |
|
159 |
if (result2 != NULL) *result2 = elemtype; |
|
1398
342890a5d031
6711100: 64bit fastdebug server vm crashes with assert(_base == Int,"Not an Int")
rasbold
parents:
962
diff
changeset
|
160 |
|
342890a5d031
6711100: 64bit fastdebug server vm crashes with assert(_base == Int,"Not an Int")
rasbold
parents:
962
diff
changeset
|
161 |
assert(ptr != top(), "top should go hand-in-hand with stopped"); |
342890a5d031
6711100: 64bit fastdebug server vm crashes with assert(_base == Int,"Not an Int")
rasbold
parents:
962
diff
changeset
|
162 |
|
1 | 163 |
return ptr; |
164 |
} |
|
165 |
||
166 |
||
167 |
// returns IfNode |
|
168 |
IfNode* Parse::jump_if_fork_int(Node* a, Node* b, BoolTest::mask mask) { |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
169 |
Node *cmp = _gvn.transform( new (C) CmpINode( a, b)); // two cases: shiftcount > 32 and shiftcount <= 32 |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
170 |
Node *tst = _gvn.transform( new (C) BoolNode( cmp, mask)); |
1 | 171 |
IfNode *iff = create_and_map_if( control(), tst, ((mask == BoolTest::eq) ? PROB_STATIC_INFREQUENT : PROB_FAIR), COUNT_UNKNOWN ); |
172 |
return iff; |
|
173 |
} |
|
174 |
||
175 |
// return Region node |
|
176 |
Node* Parse::jump_if_join(Node* iffalse, Node* iftrue) { |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
177 |
Node *region = new (C) RegionNode(3); // 2 results |
1 | 178 |
record_for_igvn(region); |
179 |
region->init_req(1, iffalse); |
|
180 |
region->init_req(2, iftrue ); |
|
181 |
_gvn.set_type(region, Type::CONTROL); |
|
182 |
region = _gvn.transform(region); |
|
183 |
set_control (region); |
|
184 |
return region; |
|
185 |
} |
|
186 |
||
187 |
||
188 |
//------------------------------helper for tableswitch------------------------- |
|
189 |
void Parse::jump_if_true_fork(IfNode *iff, int dest_bci_if_true, int prof_table_index) { |
|
190 |
// True branch, use existing map info |
|
191 |
{ PreserveJVMState pjvms(this); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
192 |
Node *iftrue = _gvn.transform( new (C) IfTrueNode (iff) ); |
1 | 193 |
set_control( iftrue ); |
194 |
profile_switch_case(prof_table_index); |
|
195 |
merge_new_path(dest_bci_if_true); |
|
196 |
} |
|
197 |
||
198 |
// False branch |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
199 |
Node *iffalse = _gvn.transform( new (C) IfFalseNode(iff) ); |
1 | 200 |
set_control( iffalse ); |
201 |
} |
|
202 |
||
203 |
void Parse::jump_if_false_fork(IfNode *iff, int dest_bci_if_true, int prof_table_index) { |
|
204 |
// True branch, use existing map info |
|
205 |
{ PreserveJVMState pjvms(this); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
206 |
Node *iffalse = _gvn.transform( new (C) IfFalseNode (iff) ); |
1 | 207 |
set_control( iffalse ); |
208 |
profile_switch_case(prof_table_index); |
|
209 |
merge_new_path(dest_bci_if_true); |
|
210 |
} |
|
211 |
||
212 |
// False branch |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
213 |
Node *iftrue = _gvn.transform( new (C) IfTrueNode(iff) ); |
1 | 214 |
set_control( iftrue ); |
215 |
} |
|
216 |
||
217 |
void Parse::jump_if_always_fork(int dest_bci, int prof_table_index) { |
|
218 |
// False branch, use existing map and control() |
|
219 |
profile_switch_case(prof_table_index); |
|
220 |
merge_new_path(dest_bci); |
|
221 |
} |
|
222 |
||
223 |
||
224 |
extern "C" { |
|
225 |
static int jint_cmp(const void *i, const void *j) { |
|
226 |
int a = *(jint *)i; |
|
227 |
int b = *(jint *)j; |
|
228 |
return a > b ? 1 : a < b ? -1 : 0; |
|
229 |
} |
|
230 |
} |
|
231 |
||
232 |
||
233 |
// Default value for methodData switch indexing. Must be a negative value to avoid |
|
234 |
// conflict with any legal switch index. |
|
235 |
#define NullTableIndex -1 |
|
236 |
||
237 |
class SwitchRange : public StackObj { |
|
238 |
// a range of integers coupled with a bci destination |
|
239 |
jint _lo; // inclusive lower limit |
|
240 |
jint _hi; // inclusive upper limit |
|
241 |
int _dest; |
|
242 |
int _table_index; // index into method data table |
|
243 |
||
244 |
public: |
|
245 |
jint lo() const { return _lo; } |
|
246 |
jint hi() const { return _hi; } |
|
247 |
int dest() const { return _dest; } |
|
248 |
int table_index() const { return _table_index; } |
|
249 |
bool is_singleton() const { return _lo == _hi; } |
|
250 |
||
251 |
void setRange(jint lo, jint hi, int dest, int table_index) { |
|
252 |
assert(lo <= hi, "must be a non-empty range"); |
|
253 |
_lo = lo, _hi = hi; _dest = dest; _table_index = table_index; |
|
254 |
} |
|
255 |
bool adjoinRange(jint lo, jint hi, int dest, int table_index) { |
|
256 |
assert(lo <= hi, "must be a non-empty range"); |
|
257 |
if (lo == _hi+1 && dest == _dest && table_index == _table_index) { |
|
258 |
_hi = hi; |
|
259 |
return true; |
|
260 |
} |
|
261 |
return false; |
|
262 |
} |
|
263 |
||
264 |
void set (jint value, int dest, int table_index) { |
|
265 |
setRange(value, value, dest, table_index); |
|
266 |
} |
|
267 |
bool adjoin(jint value, int dest, int table_index) { |
|
268 |
return adjoinRange(value, value, dest, table_index); |
|
269 |
} |
|
270 |
||
20693
1d94d9407c58
8024774: assert(_con < t->is_tuple()->cnt()) failed: ProjNode::_con must be in range
vlivanov
parents:
17383
diff
changeset
|
271 |
void print() { |
1 | 272 |
if (is_singleton()) |
273 |
tty->print(" {%d}=>%d", lo(), dest()); |
|
274 |
else if (lo() == min_jint) |
|
275 |
tty->print(" {..%d}=>%d", hi(), dest()); |
|
276 |
else if (hi() == max_jint) |
|
277 |
tty->print(" {%d..}=>%d", lo(), dest()); |
|
278 |
else |
|
279 |
tty->print(" {%d..%d}=>%d", lo(), hi(), dest()); |
|
280 |
} |
|
281 |
}; |
|
282 |
||
283 |
||
284 |
//-------------------------------do_tableswitch-------------------------------- |
|
285 |
void Parse::do_tableswitch() { |
|
286 |
Node* lookup = pop(); |
|
287 |
||
288 |
// Get information about tableswitch |
|
289 |
int default_dest = iter().get_dest_table(0); |
|
290 |
int lo_index = iter().get_int_table(1); |
|
291 |
int hi_index = iter().get_int_table(2); |
|
292 |
int len = hi_index - lo_index + 1; |
|
293 |
||
294 |
if (len < 1) { |
|
295 |
// If this is a backward branch, add safepoint |
|
296 |
maybe_add_safepoint(default_dest); |
|
297 |
merge(default_dest); |
|
298 |
return; |
|
299 |
} |
|
300 |
||
301 |
// generate decision tree, using trichotomy when possible |
|
302 |
int rnum = len+2; |
|
303 |
bool makes_backward_branch = false; |
|
304 |
SwitchRange* ranges = NEW_RESOURCE_ARRAY(SwitchRange, rnum); |
|
305 |
int rp = -1; |
|
306 |
if (lo_index != min_jint) { |
|
307 |
ranges[++rp].setRange(min_jint, lo_index-1, default_dest, NullTableIndex); |
|
308 |
} |
|
309 |
for (int j = 0; j < len; j++) { |
|
310 |
jint match_int = lo_index+j; |
|
311 |
int dest = iter().get_dest_table(j+3); |
|
312 |
makes_backward_branch |= (dest <= bci()); |
|
313 |
int table_index = method_data_update() ? j : NullTableIndex; |
|
314 |
if (rp < 0 || !ranges[rp].adjoin(match_int, dest, table_index)) { |
|
315 |
ranges[++rp].set(match_int, dest, table_index); |
|
316 |
} |
|
317 |
} |
|
318 |
jint highest = lo_index+(len-1); |
|
319 |
assert(ranges[rp].hi() == highest, ""); |
|
320 |
if (highest != max_jint |
|
321 |
&& !ranges[rp].adjoinRange(highest+1, max_jint, default_dest, NullTableIndex)) { |
|
322 |
ranges[++rp].setRange(highest+1, max_jint, default_dest, NullTableIndex); |
|
323 |
} |
|
324 |
assert(rp < len+2, "not too many ranges"); |
|
325 |
||
326 |
// Safepoint in case if backward branch observed |
|
327 |
if( makes_backward_branch && UseLoopSafepoints ) |
|
328 |
add_safepoint(); |
|
329 |
||
330 |
jump_switch_ranges(lookup, &ranges[0], &ranges[rp]); |
|
331 |
} |
|
332 |
||
333 |
||
334 |
//------------------------------do_lookupswitch-------------------------------- |
|
335 |
void Parse::do_lookupswitch() { |
|
336 |
Node *lookup = pop(); // lookup value |
|
337 |
// Get information about lookupswitch |
|
338 |
int default_dest = iter().get_dest_table(0); |
|
339 |
int len = iter().get_int_table(1); |
|
340 |
||
341 |
if (len < 1) { // If this is a backward branch, add safepoint |
|
342 |
maybe_add_safepoint(default_dest); |
|
343 |
merge(default_dest); |
|
344 |
return; |
|
345 |
} |
|
346 |
||
347 |
// generate decision tree, using trichotomy when possible |
|
348 |
jint* table = NEW_RESOURCE_ARRAY(jint, len*2); |
|
349 |
{ |
|
350 |
for( int j = 0; j < len; j++ ) { |
|
351 |
table[j+j+0] = iter().get_int_table(2+j+j); |
|
352 |
table[j+j+1] = iter().get_dest_table(2+j+j+1); |
|
353 |
} |
|
354 |
qsort( table, len, 2*sizeof(table[0]), jint_cmp ); |
|
355 |
} |
|
356 |
||
357 |
int rnum = len*2+1; |
|
358 |
bool makes_backward_branch = false; |
|
359 |
SwitchRange* ranges = NEW_RESOURCE_ARRAY(SwitchRange, rnum); |
|
360 |
int rp = -1; |
|
361 |
for( int j = 0; j < len; j++ ) { |
|
362 |
jint match_int = table[j+j+0]; |
|
363 |
int dest = table[j+j+1]; |
|
364 |
int next_lo = rp < 0 ? min_jint : ranges[rp].hi()+1; |
|
365 |
int table_index = method_data_update() ? j : NullTableIndex; |
|
366 |
makes_backward_branch |= (dest <= bci()); |
|
367 |
if( match_int != next_lo ) { |
|
368 |
ranges[++rp].setRange(next_lo, match_int-1, default_dest, NullTableIndex); |
|
369 |
} |
|
370 |
if( rp < 0 || !ranges[rp].adjoin(match_int, dest, table_index) ) { |
|
371 |
ranges[++rp].set(match_int, dest, table_index); |
|
372 |
} |
|
373 |
} |
|
374 |
jint highest = table[2*(len-1)]; |
|
375 |
assert(ranges[rp].hi() == highest, ""); |
|
376 |
if( highest != max_jint |
|
377 |
&& !ranges[rp].adjoinRange(highest+1, max_jint, default_dest, NullTableIndex) ) { |
|
378 |
ranges[++rp].setRange(highest+1, max_jint, default_dest, NullTableIndex); |
|
379 |
} |
|
380 |
assert(rp < rnum, "not too many ranges"); |
|
381 |
||
382 |
// Safepoint in case backward branch observed |
|
383 |
if( makes_backward_branch && UseLoopSafepoints ) |
|
384 |
add_safepoint(); |
|
385 |
||
386 |
jump_switch_ranges(lookup, &ranges[0], &ranges[rp]); |
|
387 |
} |
|
388 |
||
389 |
//----------------------------create_jump_tables------------------------------- |
|
390 |
bool Parse::create_jump_tables(Node* key_val, SwitchRange* lo, SwitchRange* hi) { |
|
391 |
// Are jumptables enabled |
|
392 |
if (!UseJumpTables) return false; |
|
393 |
||
394 |
// Are jumptables supported |
|
395 |
if (!Matcher::has_match_rule(Op_Jump)) return false; |
|
396 |
||
397 |
// Don't make jump table if profiling |
|
398 |
if (method_data_update()) return false; |
|
399 |
||
400 |
// Decide if a guard is needed to lop off big ranges at either (or |
|
401 |
// both) end(s) of the input set. We'll call this the default target |
|
402 |
// even though we can't be sure that it is the true "default". |
|
403 |
||
404 |
bool needs_guard = false; |
|
405 |
int default_dest; |
|
406 |
int64 total_outlier_size = 0; |
|
407 |
int64 hi_size = ((int64)hi->hi()) - ((int64)hi->lo()) + 1; |
|
408 |
int64 lo_size = ((int64)lo->hi()) - ((int64)lo->lo()) + 1; |
|
409 |
||
410 |
if (lo->dest() == hi->dest()) { |
|
411 |
total_outlier_size = hi_size + lo_size; |
|
412 |
default_dest = lo->dest(); |
|
413 |
} else if (lo_size > hi_size) { |
|
414 |
total_outlier_size = lo_size; |
|
415 |
default_dest = lo->dest(); |
|
416 |
} else { |
|
417 |
total_outlier_size = hi_size; |
|
418 |
default_dest = hi->dest(); |
|
419 |
} |
|
420 |
||
421 |
// If a guard test will eliminate very sparse end ranges, then |
|
422 |
// it is worth the cost of an extra jump. |
|
423 |
if (total_outlier_size > (MaxJumpTableSparseness * 4)) { |
|
424 |
needs_guard = true; |
|
425 |
if (default_dest == lo->dest()) lo++; |
|
426 |
if (default_dest == hi->dest()) hi--; |
|
427 |
} |
|
428 |
||
429 |
// Find the total number of cases and ranges |
|
430 |
int64 num_cases = ((int64)hi->hi()) - ((int64)lo->lo()) + 1; |
|
431 |
int num_range = hi - lo + 1; |
|
432 |
||
433 |
// Don't create table if: too large, too small, or too sparse. |
|
434 |
if (num_cases < MinJumpTableSize || num_cases > MaxJumpTableSize) |
|
435 |
return false; |
|
436 |
if (num_cases > (MaxJumpTableSparseness * num_range)) |
|
437 |
return false; |
|
438 |
||
439 |
// Normalize table lookups to zero |
|
440 |
int lowval = lo->lo(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
441 |
key_val = _gvn.transform( new (C) SubINode(key_val, _gvn.intcon(lowval)) ); |
1 | 442 |
|
443 |
// Generate a guard to protect against input keyvals that aren't |
|
444 |
// in the switch domain. |
|
445 |
if (needs_guard) { |
|
446 |
Node* size = _gvn.intcon(num_cases); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
447 |
Node* cmp = _gvn.transform( new (C) CmpUNode(key_val, size) ); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
448 |
Node* tst = _gvn.transform( new (C) BoolNode(cmp, BoolTest::ge) ); |
1 | 449 |
IfNode* iff = create_and_map_if( control(), tst, PROB_FAIR, COUNT_UNKNOWN); |
450 |
jump_if_true_fork(iff, default_dest, NullTableIndex); |
|
451 |
} |
|
452 |
||
453 |
// Create an ideal node JumpTable that has projections |
|
454 |
// of all possible ranges for a switch statement |
|
455 |
// The key_val input must be converted to a pointer offset and scaled. |
|
456 |
// Compare Parse::array_addressing above. |
|
457 |
#ifdef _LP64 |
|
458 |
// Clean the 32-bit int into a real 64-bit offset. |
|
459 |
// Otherwise, the jint value 0 might turn into an offset of 0x0800000000. |
|
460 |
const TypeLong* lkeytype = TypeLong::make(CONST64(0), num_cases-1, Type::WidenMin); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
461 |
key_val = _gvn.transform( new (C) ConvI2LNode(key_val, lkeytype) ); |
1 | 462 |
#endif |
463 |
// Shift the value by wordsize so we have an index into the table, rather |
|
464 |
// than a switch value |
|
465 |
Node *shiftWord = _gvn.MakeConX(wordSize); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
466 |
key_val = _gvn.transform( new (C) MulXNode( key_val, shiftWord)); |
1 | 467 |
|
468 |
// Create the JumpNode |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
469 |
Node* jtn = _gvn.transform( new (C) JumpNode(control(), key_val, num_cases) ); |
1 | 470 |
|
471 |
// These are the switch destinations hanging off the jumpnode |
|
472 |
int i = 0; |
|
473 |
for (SwitchRange* r = lo; r <= hi; r++) { |
|
20693
1d94d9407c58
8024774: assert(_con < t->is_tuple()->cnt()) failed: ProjNode::_con must be in range
vlivanov
parents:
17383
diff
changeset
|
474 |
for (int64 j = r->lo(); j <= r->hi(); j++, i++) { |
1d94d9407c58
8024774: assert(_con < t->is_tuple()->cnt()) failed: ProjNode::_con must be in range
vlivanov
parents:
17383
diff
changeset
|
475 |
Node* input = _gvn.transform(new (C) JumpProjNode(jtn, i, r->dest(), (int)(j - lowval))); |
1 | 476 |
{ |
477 |
PreserveJVMState pjvms(this); |
|
478 |
set_control(input); |
|
479 |
jump_if_always_fork(r->dest(), r->table_index()); |
|
480 |
} |
|
481 |
} |
|
482 |
} |
|
483 |
assert(i == num_cases, "miscount of cases"); |
|
484 |
stop_and_kill_map(); // no more uses for this JVMS |
|
485 |
return true; |
|
486 |
} |
|
487 |
||
488 |
//----------------------------jump_switch_ranges------------------------------- |
|
489 |
void Parse::jump_switch_ranges(Node* key_val, SwitchRange *lo, SwitchRange *hi, int switch_depth) { |
|
490 |
Block* switch_block = block(); |
|
491 |
||
492 |
if (switch_depth == 0) { |
|
493 |
// Do special processing for the top-level call. |
|
494 |
assert(lo->lo() == min_jint, "initial range must exhaust Type::INT"); |
|
495 |
assert(hi->hi() == max_jint, "initial range must exhaust Type::INT"); |
|
496 |
||
497 |
// Decrement pred-numbers for the unique set of nodes. |
|
498 |
#ifdef ASSERT |
|
499 |
// Ensure that the block's successors are a (duplicate-free) set. |
|
500 |
int successors_counted = 0; // block occurrences in [hi..lo] |
|
501 |
int unique_successors = switch_block->num_successors(); |
|
502 |
for (int i = 0; i < unique_successors; i++) { |
|
503 |
Block* target = switch_block->successor_at(i); |
|
504 |
||
505 |
// Check that the set of successors is the same in both places. |
|
506 |
int successors_found = 0; |
|
507 |
for (SwitchRange* p = lo; p <= hi; p++) { |
|
508 |
if (p->dest() == target->start()) successors_found++; |
|
509 |
} |
|
510 |
assert(successors_found > 0, "successor must be known"); |
|
511 |
successors_counted += successors_found; |
|
512 |
} |
|
513 |
assert(successors_counted == (hi-lo)+1, "no unexpected successors"); |
|
514 |
#endif |
|
515 |
||
516 |
// Maybe prune the inputs, based on the type of key_val. |
|
517 |
jint min_val = min_jint; |
|
518 |
jint max_val = max_jint; |
|
519 |
const TypeInt* ti = key_val->bottom_type()->isa_int(); |
|
520 |
if (ti != NULL) { |
|
521 |
min_val = ti->_lo; |
|
522 |
max_val = ti->_hi; |
|
523 |
assert(min_val <= max_val, "invalid int type"); |
|
524 |
} |
|
525 |
while (lo->hi() < min_val) lo++; |
|
526 |
if (lo->lo() < min_val) lo->setRange(min_val, lo->hi(), lo->dest(), lo->table_index()); |
|
527 |
while (hi->lo() > max_val) hi--; |
|
528 |
if (hi->hi() > max_val) hi->setRange(hi->lo(), max_val, hi->dest(), hi->table_index()); |
|
529 |
} |
|
530 |
||
531 |
#ifndef PRODUCT |
|
532 |
if (switch_depth == 0) { |
|
533 |
_max_switch_depth = 0; |
|
534 |
_est_switch_depth = log2_intptr((hi-lo+1)-1)+1; |
|
535 |
} |
|
536 |
#endif |
|
537 |
||
538 |
assert(lo <= hi, "must be a non-empty set of ranges"); |
|
539 |
if (lo == hi) { |
|
540 |
jump_if_always_fork(lo->dest(), lo->table_index()); |
|
541 |
} else { |
|
542 |
assert(lo->hi() == (lo+1)->lo()-1, "contiguous ranges"); |
|
543 |
assert(hi->lo() == (hi-1)->hi()+1, "contiguous ranges"); |
|
544 |
||
545 |
if (create_jump_tables(key_val, lo, hi)) return; |
|
546 |
||
547 |
int nr = hi - lo + 1; |
|
548 |
||
549 |
SwitchRange* mid = lo + nr/2; |
|
550 |
// if there is an easy choice, pivot at a singleton: |
|
551 |
if (nr > 3 && !mid->is_singleton() && (mid-1)->is_singleton()) mid--; |
|
552 |
||
553 |
assert(lo < mid && mid <= hi, "good pivot choice"); |
|
554 |
assert(nr != 2 || mid == hi, "should pick higher of 2"); |
|
555 |
assert(nr != 3 || mid == hi-1, "should pick middle of 3"); |
|
556 |
||
557 |
Node *test_val = _gvn.intcon(mid->lo()); |
|
558 |
||
559 |
if (mid->is_singleton()) { |
|
560 |
IfNode *iff_ne = jump_if_fork_int(key_val, test_val, BoolTest::ne); |
|
561 |
jump_if_false_fork(iff_ne, mid->dest(), mid->table_index()); |
|
562 |
||
563 |
// Special Case: If there are exactly three ranges, and the high |
|
564 |
// and low range each go to the same place, omit the "gt" test, |
|
565 |
// since it will not discriminate anything. |
|
566 |
bool eq_test_only = (hi == lo+2 && hi->dest() == lo->dest()); |
|
567 |
if (eq_test_only) { |
|
568 |
assert(mid == hi-1, ""); |
|
569 |
} |
|
570 |
||
571 |
// if there is a higher range, test for it and process it: |
|
572 |
if (mid < hi && !eq_test_only) { |
|
573 |
// two comparisons of same values--should enable 1 test for 2 branches |
|
574 |
// Use BoolTest::le instead of BoolTest::gt |
|
575 |
IfNode *iff_le = jump_if_fork_int(key_val, test_val, BoolTest::le); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
576 |
Node *iftrue = _gvn.transform( new (C) IfTrueNode(iff_le) ); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
577 |
Node *iffalse = _gvn.transform( new (C) IfFalseNode(iff_le) ); |
1 | 578 |
{ PreserveJVMState pjvms(this); |
579 |
set_control(iffalse); |
|
580 |
jump_switch_ranges(key_val, mid+1, hi, switch_depth+1); |
|
581 |
} |
|
582 |
set_control(iftrue); |
|
583 |
} |
|
584 |
||
585 |
} else { |
|
586 |
// mid is a range, not a singleton, so treat mid..hi as a unit |
|
587 |
IfNode *iff_ge = jump_if_fork_int(key_val, test_val, BoolTest::ge); |
|
588 |
||
589 |
// if there is a higher range, test for it and process it: |
|
590 |
if (mid == hi) { |
|
591 |
jump_if_true_fork(iff_ge, mid->dest(), mid->table_index()); |
|
592 |
} else { |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
593 |
Node *iftrue = _gvn.transform( new (C) IfTrueNode(iff_ge) ); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
594 |
Node *iffalse = _gvn.transform( new (C) IfFalseNode(iff_ge) ); |
1 | 595 |
{ PreserveJVMState pjvms(this); |
596 |
set_control(iftrue); |
|
597 |
jump_switch_ranges(key_val, mid, hi, switch_depth+1); |
|
598 |
} |
|
599 |
set_control(iffalse); |
|
600 |
} |
|
601 |
} |
|
602 |
||
603 |
// in any case, process the lower range |
|
604 |
jump_switch_ranges(key_val, lo, mid-1, switch_depth+1); |
|
605 |
} |
|
606 |
||
607 |
// Decrease pred_count for each successor after all is done. |
|
608 |
if (switch_depth == 0) { |
|
609 |
int unique_successors = switch_block->num_successors(); |
|
610 |
for (int i = 0; i < unique_successors; i++) { |
|
611 |
Block* target = switch_block->successor_at(i); |
|
612 |
// Throw away the pre-allocated path for each unique successor. |
|
613 |
target->next_path_num(); |
|
614 |
} |
|
615 |
} |
|
616 |
||
617 |
#ifndef PRODUCT |
|
618 |
_max_switch_depth = MAX2(switch_depth, _max_switch_depth); |
|
619 |
if (TraceOptoParse && Verbose && WizardMode && switch_depth == 0) { |
|
620 |
SwitchRange* r; |
|
621 |
int nsing = 0; |
|
622 |
for( r = lo; r <= hi; r++ ) { |
|
623 |
if( r->is_singleton() ) nsing++; |
|
624 |
} |
|
625 |
tty->print(">>> "); |
|
626 |
_method->print_short_name(); |
|
627 |
tty->print_cr(" switch decision tree"); |
|
628 |
tty->print_cr(" %d ranges (%d singletons), max_depth=%d, est_depth=%d", |
|
629 |
hi-lo+1, nsing, _max_switch_depth, _est_switch_depth); |
|
630 |
if (_max_switch_depth > _est_switch_depth) { |
|
631 |
tty->print_cr("******** BAD SWITCH DEPTH ********"); |
|
632 |
} |
|
633 |
tty->print(" "); |
|
634 |
for( r = lo; r <= hi; r++ ) { |
|
20693
1d94d9407c58
8024774: assert(_con < t->is_tuple()->cnt()) failed: ProjNode::_con must be in range
vlivanov
parents:
17383
diff
changeset
|
635 |
r->print(); |
1 | 636 |
} |
637 |
tty->print_cr(""); |
|
638 |
} |
|
639 |
#endif |
|
640 |
} |
|
641 |
||
642 |
void Parse::modf() { |
|
643 |
Node *f2 = pop(); |
|
644 |
Node *f1 = pop(); |
|
645 |
Node* c = make_runtime_call(RC_LEAF, OptoRuntime::modf_Type(), |
|
646 |
CAST_FROM_FN_PTR(address, SharedRuntime::frem), |
|
647 |
"frem", NULL, //no memory effects |
|
648 |
f1, f2); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
649 |
Node* res = _gvn.transform(new (C) ProjNode(c, TypeFunc::Parms + 0)); |
1 | 650 |
|
651 |
push(res); |
|
652 |
} |
|
653 |
||
654 |
void Parse::modd() { |
|
655 |
Node *d2 = pop_pair(); |
|
656 |
Node *d1 = pop_pair(); |
|
657 |
Node* c = make_runtime_call(RC_LEAF, OptoRuntime::Math_DD_D_Type(), |
|
658 |
CAST_FROM_FN_PTR(address, SharedRuntime::drem), |
|
659 |
"drem", NULL, //no memory effects |
|
660 |
d1, top(), d2, top()); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
661 |
Node* res_d = _gvn.transform(new (C) ProjNode(c, TypeFunc::Parms + 0)); |
1 | 662 |
|
663 |
#ifdef ASSERT |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
664 |
Node* res_top = _gvn.transform(new (C) ProjNode(c, TypeFunc::Parms + 1)); |
1 | 665 |
assert(res_top == top(), "second value must be top"); |
666 |
#endif |
|
667 |
||
668 |
push_pair(res_d); |
|
669 |
} |
|
670 |
||
671 |
void Parse::l2f() { |
|
672 |
Node* f2 = pop(); |
|
673 |
Node* f1 = pop(); |
|
674 |
Node* c = make_runtime_call(RC_LEAF, OptoRuntime::l2f_Type(), |
|
675 |
CAST_FROM_FN_PTR(address, SharedRuntime::l2f), |
|
676 |
"l2f", NULL, //no memory effects |
|
677 |
f1, f2); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
678 |
Node* res = _gvn.transform(new (C) ProjNode(c, TypeFunc::Parms + 0)); |
1 | 679 |
|
680 |
push(res); |
|
681 |
} |
|
682 |
||
683 |
void Parse::do_irem() { |
|
684 |
// Must keep both values on the expression-stack during null-check |
|
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
685 |
zero_check_int(peek()); |
1 | 686 |
// Compile-time detect of null-exception? |
687 |
if (stopped()) return; |
|
688 |
||
689 |
Node* b = pop(); |
|
690 |
Node* a = pop(); |
|
691 |
||
692 |
const Type *t = _gvn.type(b); |
|
693 |
if (t != Type::TOP) { |
|
694 |
const TypeInt *ti = t->is_int(); |
|
695 |
if (ti->is_con()) { |
|
696 |
int divisor = ti->get_con(); |
|
697 |
// check for positive power of 2 |
|
698 |
if (divisor > 0 && |
|
699 |
(divisor & ~(divisor-1)) == divisor) { |
|
700 |
// yes ! |
|
701 |
Node *mask = _gvn.intcon((divisor - 1)); |
|
702 |
// Sigh, must handle negative dividends |
|
703 |
Node *zero = _gvn.intcon(0); |
|
704 |
IfNode *ifff = jump_if_fork_int(a, zero, BoolTest::lt); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
705 |
Node *iff = _gvn.transform( new (C) IfFalseNode(ifff) ); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
706 |
Node *ift = _gvn.transform( new (C) IfTrueNode (ifff) ); |
1 | 707 |
Node *reg = jump_if_join(ift, iff); |
708 |
Node *phi = PhiNode::make(reg, NULL, TypeInt::INT); |
|
709 |
// Negative path; negate/and/negate |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
710 |
Node *neg = _gvn.transform( new (C) SubINode(zero, a) ); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
711 |
Node *andn= _gvn.transform( new (C) AndINode(neg, mask) ); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
712 |
Node *negn= _gvn.transform( new (C) SubINode(zero, andn) ); |
1 | 713 |
phi->init_req(1, negn); |
714 |
// Fast positive case |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
715 |
Node *andx = _gvn.transform( new (C) AndINode(a, mask) ); |
1 | 716 |
phi->init_req(2, andx); |
717 |
// Push the merge |
|
718 |
push( _gvn.transform(phi) ); |
|
719 |
return; |
|
720 |
} |
|
721 |
} |
|
722 |
} |
|
723 |
// Default case |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
724 |
push( _gvn.transform( new (C) ModINode(control(),a,b) ) ); |
1 | 725 |
} |
726 |
||
727 |
// Handle jsr and jsr_w bytecode |
|
728 |
void Parse::do_jsr() { |
|
729 |
assert(bc() == Bytecodes::_jsr || bc() == Bytecodes::_jsr_w, "wrong bytecode"); |
|
730 |
||
731 |
// Store information about current state, tagged with new _jsr_bci |
|
732 |
int return_bci = iter().next_bci(); |
|
733 |
int jsr_bci = (bc() == Bytecodes::_jsr) ? iter().get_dest() : iter().get_far_dest(); |
|
734 |
||
735 |
// Update method data |
|
736 |
profile_taken_branch(jsr_bci); |
|
737 |
||
738 |
// The way we do things now, there is only one successor block |
|
739 |
// for the jsr, because the target code is cloned by ciTypeFlow. |
|
740 |
Block* target = successor_for_bci(jsr_bci); |
|
741 |
||
742 |
// What got pushed? |
|
743 |
const Type* ret_addr = target->peek(); |
|
744 |
assert(ret_addr->singleton(), "must be a constant (cloned jsr body)"); |
|
745 |
||
746 |
// Effect on jsr on stack |
|
747 |
push(_gvn.makecon(ret_addr)); |
|
748 |
||
749 |
// Flow to the jsr. |
|
750 |
merge(jsr_bci); |
|
751 |
} |
|
752 |
||
753 |
// Handle ret bytecode |
|
754 |
void Parse::do_ret() { |
|
755 |
// Find to whom we return. |
|
756 |
assert(block()->num_successors() == 1, "a ret can only go one place now"); |
|
757 |
Block* target = block()->successor_at(0); |
|
758 |
assert(!target->is_ready(), "our arrival must be expected"); |
|
759 |
profile_ret(target->flow()->start()); |
|
760 |
int pnum = target->next_path_num(); |
|
761 |
merge_common(target, pnum); |
|
762 |
} |
|
763 |
||
764 |
//--------------------------dynamic_branch_prediction-------------------------- |
|
765 |
// Try to gather dynamic branch prediction behavior. Return a probability |
|
766 |
// of the branch being taken and set the "cnt" field. Returns a -1.0 |
|
767 |
// if we need to use static prediction for some reason. |
|
768 |
float Parse::dynamic_branch_prediction(float &cnt) { |
|
769 |
ResourceMark rm; |
|
770 |
||
771 |
cnt = COUNT_UNKNOWN; |
|
772 |
||
773 |
// Use MethodData information if it is available |
|
774 |
// FIXME: free the ProfileData structure |
|
775 |
ciMethodData* methodData = method()->method_data(); |
|
776 |
if (!methodData->is_mature()) return PROB_UNKNOWN; |
|
777 |
ciProfileData* data = methodData->bci_to_data(bci()); |
|
778 |
if (!data->is_JumpData()) return PROB_UNKNOWN; |
|
779 |
||
780 |
// get taken and not taken values |
|
781 |
int taken = data->as_JumpData()->taken(); |
|
782 |
int not_taken = 0; |
|
783 |
if (data->is_BranchData()) { |
|
784 |
not_taken = data->as_BranchData()->not_taken(); |
|
785 |
} |
|
786 |
||
787 |
// scale the counts to be commensurate with invocation counts: |
|
788 |
taken = method()->scale_count(taken); |
|
789 |
not_taken = method()->scale_count(not_taken); |
|
790 |
||
9137
b08b58616727
6988308: assert((cnt > 0.0f) && (prob > 0.0f)) failed: Bad frequency assignment in if
iveresov
parents:
8921
diff
changeset
|
791 |
// Give up if too few (or too many, in which case the sum will overflow) counts to be meaningful. |
b08b58616727
6988308: assert((cnt > 0.0f) && (prob > 0.0f)) failed: Bad frequency assignment in if
iveresov
parents:
8921
diff
changeset
|
792 |
// We also check that individual counters are positive first, overwise the sum can become positive. |
b08b58616727
6988308: assert((cnt > 0.0f) && (prob > 0.0f)) failed: Bad frequency assignment in if
iveresov
parents:
8921
diff
changeset
|
793 |
if (taken < 0 || not_taken < 0 || taken + not_taken < 40) { |
1 | 794 |
if (C->log() != NULL) { |
795 |
C->log()->elem("branch target_bci='%d' taken='%d' not_taken='%d'", iter().get_dest(), taken, not_taken); |
|
796 |
} |
|
797 |
return PROB_UNKNOWN; |
|
798 |
} |
|
799 |
||
800 |
// Compute frequency that we arrive here |
|
9137
b08b58616727
6988308: assert((cnt > 0.0f) && (prob > 0.0f)) failed: Bad frequency assignment in if
iveresov
parents:
8921
diff
changeset
|
801 |
float sum = taken + not_taken; |
1 | 802 |
// Adjust, if this block is a cloned private block but the |
803 |
// Jump counts are shared. Taken the private counts for |
|
804 |
// just this path instead of the shared counts. |
|
805 |
if( block()->count() > 0 ) |
|
806 |
sum = block()->count(); |
|
9137
b08b58616727
6988308: assert((cnt > 0.0f) && (prob > 0.0f)) failed: Bad frequency assignment in if
iveresov
parents:
8921
diff
changeset
|
807 |
cnt = sum / FreqCountInvocations; |
1 | 808 |
|
809 |
// Pin probability to sane limits |
|
810 |
float prob; |
|
811 |
if( !taken ) |
|
812 |
prob = (0+PROB_MIN) / 2; |
|
813 |
else if( !not_taken ) |
|
814 |
prob = (1+PROB_MAX) / 2; |
|
815 |
else { // Compute probability of true path |
|
816 |
prob = (float)taken / (float)(taken + not_taken); |
|
817 |
if (prob > PROB_MAX) prob = PROB_MAX; |
|
818 |
if (prob < PROB_MIN) prob = PROB_MIN; |
|
819 |
} |
|
820 |
||
821 |
assert((cnt > 0.0f) && (prob > 0.0f), |
|
822 |
"Bad frequency assignment in if"); |
|
823 |
||
824 |
if (C->log() != NULL) { |
|
825 |
const char* prob_str = NULL; |
|
826 |
if (prob >= PROB_MAX) prob_str = (prob == PROB_MAX) ? "max" : "always"; |
|
827 |
if (prob <= PROB_MIN) prob_str = (prob == PROB_MIN) ? "min" : "never"; |
|
828 |
char prob_str_buf[30]; |
|
829 |
if (prob_str == NULL) { |
|
830 |
sprintf(prob_str_buf, "%g", prob); |
|
831 |
prob_str = prob_str_buf; |
|
832 |
} |
|
833 |
C->log()->elem("branch target_bci='%d' taken='%d' not_taken='%d' cnt='%g' prob='%s'", |
|
834 |
iter().get_dest(), taken, not_taken, cnt, prob_str); |
|
835 |
} |
|
836 |
return prob; |
|
837 |
} |
|
838 |
||
839 |
//-----------------------------branch_prediction------------------------------- |
|
840 |
float Parse::branch_prediction(float& cnt, |
|
841 |
BoolTest::mask btest, |
|
842 |
int target_bci) { |
|
843 |
float prob = dynamic_branch_prediction(cnt); |
|
844 |
// If prob is unknown, switch to static prediction |
|
845 |
if (prob != PROB_UNKNOWN) return prob; |
|
846 |
||
847 |
prob = PROB_FAIR; // Set default value |
|
848 |
if (btest == BoolTest::eq) // Exactly equal test? |
|
849 |
prob = PROB_STATIC_INFREQUENT; // Assume its relatively infrequent |
|
850 |
else if (btest == BoolTest::ne) |
|
851 |
prob = PROB_STATIC_FREQUENT; // Assume its relatively frequent |
|
852 |
||
853 |
// If this is a conditional test guarding a backwards branch, |
|
854 |
// assume its a loop-back edge. Make it a likely taken branch. |
|
855 |
if (target_bci < bci()) { |
|
856 |
if (is_osr_parse()) { // Could be a hot OSR'd loop; force deopt |
|
857 |
// Since it's an OSR, we probably have profile data, but since |
|
858 |
// branch_prediction returned PROB_UNKNOWN, the counts are too small. |
|
859 |
// Let's make a special check here for completely zero counts. |
|
860 |
ciMethodData* methodData = method()->method_data(); |
|
861 |
if (!methodData->is_empty()) { |
|
862 |
ciProfileData* data = methodData->bci_to_data(bci()); |
|
863 |
// Only stop for truly zero counts, which mean an unknown part |
|
864 |
// of the OSR-ed method, and we want to deopt to gather more stats. |
|
865 |
// If you have ANY counts, then this loop is simply 'cold' relative |
|
866 |
// to the OSR loop. |
|
867 |
if (data->as_BranchData()->taken() + |
|
868 |
data->as_BranchData()->not_taken() == 0 ) { |
|
869 |
// This is the only way to return PROB_UNKNOWN: |
|
870 |
return PROB_UNKNOWN; |
|
871 |
} |
|
872 |
} |
|
873 |
} |
|
874 |
prob = PROB_STATIC_FREQUENT; // Likely to take backwards branch |
|
875 |
} |
|
876 |
||
877 |
assert(prob != PROB_UNKNOWN, "must have some guess at this point"); |
|
878 |
return prob; |
|
879 |
} |
|
880 |
||
881 |
// The magic constants are chosen so as to match the output of |
|
882 |
// branch_prediction() when the profile reports a zero taken count. |
|
883 |
// It is important to distinguish zero counts unambiguously, because |
|
884 |
// some branches (e.g., _213_javac.Assembler.eliminate) validly produce |
|
885 |
// very small but nonzero probabilities, which if confused with zero |
|
886 |
// counts would keep the program recompiling indefinitely. |
|
887 |
bool Parse::seems_never_taken(float prob) { |
|
888 |
return prob < PROB_MIN; |
|
889 |
} |
|
890 |
||
6416
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
891 |
// True if the comparison seems to be the kind that will not change its |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
892 |
// statistics from true to false. See comments in adjust_map_after_if. |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
893 |
// This question is only asked along paths which are already |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
894 |
// classifed as untaken (by seems_never_taken), so really, |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
895 |
// if a path is never taken, its controlling comparison is |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
896 |
// already acting in a stable fashion. If the comparison |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
897 |
// seems stable, we will put an expensive uncommon trap |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
898 |
// on the untaken path. To be conservative, and to allow |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
899 |
// partially executed counted loops to be compiled fully, |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
900 |
// we will plant uncommon traps only after pointer comparisons. |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
901 |
bool Parse::seems_stable_comparison(BoolTest::mask btest, Node* cmp) { |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
902 |
for (int depth = 4; depth > 0; depth--) { |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
903 |
// The following switch can find CmpP here over half the time for |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
904 |
// dynamic language code rich with type tests. |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
905 |
// Code using counted loops or array manipulations (typical |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
906 |
// of benchmarks) will have many (>80%) CmpI instructions. |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
907 |
switch (cmp->Opcode()) { |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
908 |
case Op_CmpP: |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
909 |
// A never-taken null check looks like CmpP/BoolTest::eq. |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
910 |
// These certainly should be closed off as uncommon traps. |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
911 |
if (btest == BoolTest::eq) |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
912 |
return true; |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
913 |
// A never-failed type check looks like CmpP/BoolTest::ne. |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
914 |
// Let's put traps on those, too, so that we don't have to compile |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
915 |
// unused paths with indeterminate dynamic type information. |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
916 |
if (ProfileDynamicTypes) |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
917 |
return true; |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
918 |
return false; |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
919 |
|
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
920 |
case Op_CmpI: |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
921 |
// A small minority (< 10%) of CmpP are masked as CmpI, |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
922 |
// as if by boolean conversion ((p == q? 1: 0) != 0). |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
923 |
// Detect that here, even if it hasn't optimized away yet. |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
924 |
// Specifically, this covers the 'instanceof' operator. |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
925 |
if (btest == BoolTest::ne || btest == BoolTest::eq) { |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
926 |
if (_gvn.type(cmp->in(2))->singleton() && |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
927 |
cmp->in(1)->is_Phi()) { |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
928 |
PhiNode* phi = cmp->in(1)->as_Phi(); |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
929 |
int true_path = phi->is_diamond_phi(); |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
930 |
if (true_path > 0 && |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
931 |
_gvn.type(phi->in(1))->singleton() && |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
932 |
_gvn.type(phi->in(2))->singleton()) { |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
933 |
// phi->region->if_proj->ifnode->bool->cmp |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
934 |
BoolNode* bol = phi->in(0)->in(1)->in(0)->in(1)->as_Bool(); |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
935 |
btest = bol->_test._test; |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
936 |
cmp = bol->in(1); |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
937 |
continue; |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
938 |
} |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
939 |
} |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
940 |
} |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
941 |
return false; |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
942 |
} |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
943 |
} |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
944 |
return false; |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
945 |
} |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
946 |
|
954
740f5b9a923e
6707044: uncommon_trap of ifnull bytecode leaves garbage on expression stack
rasbold
parents:
781
diff
changeset
|
947 |
//-------------------------------repush_if_args-------------------------------- |
740f5b9a923e
6707044: uncommon_trap of ifnull bytecode leaves garbage on expression stack
rasbold
parents:
781
diff
changeset
|
948 |
// Push arguments of an "if" bytecode back onto the stack by adjusting _sp. |
4643 | 949 |
inline int Parse::repush_if_args() { |
1 | 950 |
#ifndef PRODUCT |
951 |
if (PrintOpto && WizardMode) { |
|
952 |
tty->print("defending against excessive implicit null exceptions on %s @%d in ", |
|
953 |
Bytecodes::name(iter().cur_bc()), iter().cur_bci()); |
|
954 |
method()->print_name(); tty->cr(); |
|
955 |
} |
|
956 |
#endif |
|
957 |
int bc_depth = - Bytecodes::depth(iter().cur_bc()); |
|
958 |
assert(bc_depth == 1 || bc_depth == 2, "only two kinds of branches"); |
|
959 |
DEBUG_ONLY(sync_jvms()); // argument(n) requires a synced jvms |
|
960 |
assert(argument(0) != NULL, "must exist"); |
|
961 |
assert(bc_depth == 1 || argument(1) != NULL, "two must exist"); |
|
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
962 |
inc_sp(bc_depth); |
4643 | 963 |
return bc_depth; |
1 | 964 |
} |
965 |
||
966 |
//----------------------------------do_ifnull---------------------------------- |
|
956
f1aadc829f59
6726504: handle do_ifxxx calls in parser more uniformly
rasbold
parents:
954
diff
changeset
|
967 |
void Parse::do_ifnull(BoolTest::mask btest, Node *c) { |
1 | 968 |
int target_bci = iter().get_dest(); |
969 |
||
190
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
970 |
Block* branch_block = successor_for_bci(target_bci); |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
971 |
Block* next_block = successor_for_bci(iter().next_bci()); |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
972 |
|
1 | 973 |
float cnt; |
974 |
float prob = branch_prediction(cnt, btest, target_bci); |
|
975 |
if (prob == PROB_UNKNOWN) { |
|
976 |
// (An earlier version of do_ifnull omitted this trap for OSR methods.) |
|
977 |
#ifndef PRODUCT |
|
978 |
if (PrintOpto && Verbose) |
|
956
f1aadc829f59
6726504: handle do_ifxxx calls in parser more uniformly
rasbold
parents:
954
diff
changeset
|
979 |
tty->print_cr("Never-taken edge stops compilation at bci %d",bci()); |
1 | 980 |
#endif |
956
f1aadc829f59
6726504: handle do_ifxxx calls in parser more uniformly
rasbold
parents:
954
diff
changeset
|
981 |
repush_if_args(); // to gather stats on loop |
1 | 982 |
// We need to mark this branch as taken so that if we recompile we will |
983 |
// see that it is possible. In the tiered system the interpreter doesn't |
|
984 |
// do profiling and by the time we get to the lower tier from the interpreter |
|
985 |
// the path may be cold again. Make sure it doesn't look untaken |
|
986 |
profile_taken_branch(target_bci, !ProfileInterpreter); |
|
987 |
uncommon_trap(Deoptimization::Reason_unreached, |
|
988 |
Deoptimization::Action_reinterpret, |
|
989 |
NULL, "cold"); |
|
17383 | 990 |
if (C->eliminate_boxing()) { |
190
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
991 |
// Mark the successor blocks as parsed |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
992 |
branch_block->next_path_num(); |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
993 |
next_block->next_path_num(); |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
994 |
} |
1 | 995 |
return; |
996 |
} |
|
997 |
||
998 |
explicit_null_checks_inserted++; |
|
999 |
||
1000 |
// Generate real control flow |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1001 |
Node *tst = _gvn.transform( new (C) BoolNode( c, btest ) ); |
1 | 1002 |
|
1003 |
// Sanity check the probability value |
|
1004 |
assert(prob > 0.0f,"Bad probability in Parser"); |
|
1005 |
// Need xform to put node in hash table |
|
1006 |
IfNode *iff = create_and_xform_if( control(), tst, prob, cnt ); |
|
1007 |
assert(iff->_prob > 0.0f,"Optimizer made bad probability in parser"); |
|
1008 |
// True branch |
|
1009 |
{ PreserveJVMState pjvms(this); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1010 |
Node* iftrue = _gvn.transform( new (C) IfTrueNode (iff) ); |
1 | 1011 |
set_control(iftrue); |
1012 |
||
1013 |
if (stopped()) { // Path is dead? |
|
1014 |
explicit_null_checks_elided++; |
|
17383 | 1015 |
if (C->eliminate_boxing()) { |
190
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1016 |
// Mark the successor block as parsed |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1017 |
branch_block->next_path_num(); |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1018 |
} |
1 | 1019 |
} else { // Path is live. |
1020 |
// Update method data |
|
1021 |
profile_taken_branch(target_bci); |
|
1022 |
adjust_map_after_if(btest, c, prob, branch_block, next_block); |
|
4643 | 1023 |
if (!stopped()) { |
1 | 1024 |
merge(target_bci); |
4643 | 1025 |
} |
1 | 1026 |
} |
1027 |
} |
|
1028 |
||
1029 |
// False branch |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1030 |
Node* iffalse = _gvn.transform( new (C) IfFalseNode(iff) ); |
1 | 1031 |
set_control(iffalse); |
1032 |
||
1033 |
if (stopped()) { // Path is dead? |
|
1034 |
explicit_null_checks_elided++; |
|
17383 | 1035 |
if (C->eliminate_boxing()) { |
190
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1036 |
// Mark the successor block as parsed |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1037 |
next_block->next_path_num(); |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1038 |
} |
1 | 1039 |
} else { // Path is live. |
1040 |
// Update method data |
|
1041 |
profile_not_taken_branch(); |
|
1042 |
adjust_map_after_if(BoolTest(btest).negate(), c, 1.0-prob, |
|
1043 |
next_block, branch_block); |
|
1044 |
} |
|
1045 |
} |
|
1046 |
||
1047 |
//------------------------------------do_if------------------------------------ |
|
1048 |
void Parse::do_if(BoolTest::mask btest, Node* c) { |
|
1049 |
int target_bci = iter().get_dest(); |
|
1050 |
||
190
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1051 |
Block* branch_block = successor_for_bci(target_bci); |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1052 |
Block* next_block = successor_for_bci(iter().next_bci()); |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1053 |
|
1 | 1054 |
float cnt; |
1055 |
float prob = branch_prediction(cnt, btest, target_bci); |
|
1056 |
float untaken_prob = 1.0 - prob; |
|
1057 |
||
1058 |
if (prob == PROB_UNKNOWN) { |
|
1059 |
#ifndef PRODUCT |
|
1060 |
if (PrintOpto && Verbose) |
|
956
f1aadc829f59
6726504: handle do_ifxxx calls in parser more uniformly
rasbold
parents:
954
diff
changeset
|
1061 |
tty->print_cr("Never-taken edge stops compilation at bci %d",bci()); |
1 | 1062 |
#endif |
1063 |
repush_if_args(); // to gather stats on loop |
|
1064 |
// We need to mark this branch as taken so that if we recompile we will |
|
1065 |
// see that it is possible. In the tiered system the interpreter doesn't |
|
1066 |
// do profiling and by the time we get to the lower tier from the interpreter |
|
1067 |
// the path may be cold again. Make sure it doesn't look untaken |
|
1068 |
profile_taken_branch(target_bci, !ProfileInterpreter); |
|
1069 |
uncommon_trap(Deoptimization::Reason_unreached, |
|
1070 |
Deoptimization::Action_reinterpret, |
|
1071 |
NULL, "cold"); |
|
17383 | 1072 |
if (C->eliminate_boxing()) { |
190
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1073 |
// Mark the successor blocks as parsed |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1074 |
branch_block->next_path_num(); |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1075 |
next_block->next_path_num(); |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1076 |
} |
1 | 1077 |
return; |
1078 |
} |
|
1079 |
||
1080 |
// Sanity check the probability value |
|
1081 |
assert(0.0f < prob && prob < 1.0f,"Bad probability in Parser"); |
|
1082 |
||
1083 |
bool taken_if_true = true; |
|
1084 |
// Convert BoolTest to canonical form: |
|
1085 |
if (!BoolTest(btest).is_canonical()) { |
|
1086 |
btest = BoolTest(btest).negate(); |
|
1087 |
taken_if_true = false; |
|
1088 |
// prob is NOT updated here; it remains the probability of the taken |
|
1089 |
// path (as opposed to the prob of the path guarded by an 'IfTrueNode'). |
|
1090 |
} |
|
1091 |
assert(btest != BoolTest::eq, "!= is the only canonical exact test"); |
|
1092 |
||
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1093 |
Node* tst0 = new (C) BoolNode(c, btest); |
1 | 1094 |
Node* tst = _gvn.transform(tst0); |
1095 |
BoolTest::mask taken_btest = BoolTest::illegal; |
|
1096 |
BoolTest::mask untaken_btest = BoolTest::illegal; |
|
210
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1097 |
|
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1098 |
if (tst->is_Bool()) { |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1099 |
// Refresh c from the transformed bool node, since it may be |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1100 |
// simpler than the original c. Also re-canonicalize btest. |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1101 |
// This wins when (Bool ne (Conv2B p) 0) => (Bool ne (CmpP p NULL)). |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1102 |
// That can arise from statements like: if (x instanceof C) ... |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1103 |
if (tst != tst0) { |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1104 |
// Canonicalize one more time since transform can change it. |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1105 |
btest = tst->as_Bool()->_test._test; |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1106 |
if (!BoolTest(btest).is_canonical()) { |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1107 |
// Reverse edges one more time... |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1108 |
tst = _gvn.transform( tst->as_Bool()->negate(&_gvn) ); |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1109 |
btest = tst->as_Bool()->_test._test; |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1110 |
assert(BoolTest(btest).is_canonical(), "sanity"); |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1111 |
taken_if_true = !taken_if_true; |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1112 |
} |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1113 |
c = tst->in(1); |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1114 |
} |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1115 |
BoolTest::mask neg_btest = BoolTest(btest).negate(); |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1116 |
taken_btest = taken_if_true ? btest : neg_btest; |
6da234892f4a
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
kvn
parents:
190
diff
changeset
|
1117 |
untaken_btest = taken_if_true ? neg_btest : btest; |
1 | 1118 |
} |
1119 |
||
1120 |
// Generate real control flow |
|
1121 |
float true_prob = (taken_if_true ? prob : untaken_prob); |
|
1122 |
IfNode* iff = create_and_map_if(control(), tst, true_prob, cnt); |
|
1123 |
assert(iff->_prob > 0.0f,"Optimizer made bad probability in parser"); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1124 |
Node* taken_branch = new (C) IfTrueNode(iff); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1125 |
Node* untaken_branch = new (C) IfFalseNode(iff); |
1 | 1126 |
if (!taken_if_true) { // Finish conversion to canonical form |
1127 |
Node* tmp = taken_branch; |
|
1128 |
taken_branch = untaken_branch; |
|
1129 |
untaken_branch = tmp; |
|
1130 |
} |
|
1131 |
||
1132 |
// Branch is taken: |
|
1133 |
{ PreserveJVMState pjvms(this); |
|
1134 |
taken_branch = _gvn.transform(taken_branch); |
|
1135 |
set_control(taken_branch); |
|
1136 |
||
190
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1137 |
if (stopped()) { |
17383 | 1138 |
if (C->eliminate_boxing()) { |
190
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1139 |
// Mark the successor block as parsed |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1140 |
branch_block->next_path_num(); |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1141 |
} |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1142 |
} else { |
1 | 1143 |
// Update method data |
1144 |
profile_taken_branch(target_bci); |
|
1145 |
adjust_map_after_if(taken_btest, c, prob, branch_block, next_block); |
|
4643 | 1146 |
if (!stopped()) { |
1 | 1147 |
merge(target_bci); |
4643 | 1148 |
} |
1 | 1149 |
} |
1150 |
} |
|
1151 |
||
1152 |
untaken_branch = _gvn.transform(untaken_branch); |
|
1153 |
set_control(untaken_branch); |
|
1154 |
||
1155 |
// Branch not taken. |
|
190
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1156 |
if (stopped()) { |
17383 | 1157 |
if (C->eliminate_boxing()) { |
190
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1158 |
// Mark the successor block as parsed |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1159 |
next_block->next_path_num(); |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1160 |
} |
e9a0a9dcd4f6
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents:
1
diff
changeset
|
1161 |
} else { |
1 | 1162 |
// Update method data |
1163 |
profile_not_taken_branch(); |
|
1164 |
adjust_map_after_if(untaken_btest, c, untaken_prob, |
|
1165 |
next_block, branch_block); |
|
1166 |
} |
|
1167 |
} |
|
1168 |
||
1169 |
//----------------------------adjust_map_after_if------------------------------ |
|
1170 |
// Adjust the JVM state to reflect the result of taking this path. |
|
1171 |
// Basically, it means inspecting the CmpNode controlling this |
|
1172 |
// branch, seeing how it constrains a tested value, and then |
|
1173 |
// deciding if it's worth our while to encode this constraint |
|
1174 |
// as graph nodes in the current abstract interpretation map. |
|
1175 |
void Parse::adjust_map_after_if(BoolTest::mask btest, Node* c, float prob, |
|
1176 |
Block* path, Block* other_path) { |
|
1177 |
if (stopped() || !c->is_Cmp() || btest == BoolTest::illegal) |
|
1178 |
return; // nothing to do |
|
1179 |
||
1180 |
bool is_fallthrough = (path == successor_for_bci(iter().next_bci())); |
|
1181 |
||
6416
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
1182 |
if (seems_never_taken(prob) && seems_stable_comparison(btest, c)) { |
1 | 1183 |
// If this might possibly turn into an implicit null check, |
1184 |
// and the null has never yet been seen, we need to generate |
|
1185 |
// an uncommon trap, so as to recompile instead of suffering |
|
1186 |
// with very slow branches. (We'll get the slow branches if |
|
1187 |
// the program ever changes phase and starts seeing nulls here.) |
|
1188 |
// |
|
6416
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
1189 |
// We do not inspect for a null constant, since a node may |
1 | 1190 |
// optimize to 'null' later on. |
6416
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
1191 |
// |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
1192 |
// Null checks, and other tests which expect inequality, |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
1193 |
// show btest == BoolTest::eq along the non-taken branch. |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
1194 |
// On the other hand, type tests, must-be-null tests, |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
1195 |
// and other tests which expect pointer equality, |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
1196 |
// show btest == BoolTest::ne along the non-taken branch. |
d49b65c9425a
6912064: type profiles need to be exploited more for dynamic language support
jrose
parents:
5882
diff
changeset
|
1197 |
// We prune both types of branches if they look unused. |
1 | 1198 |
repush_if_args(); |
1199 |
// We need to mark this branch as taken so that if we recompile we will |
|
1200 |
// see that it is possible. In the tiered system the interpreter doesn't |
|
1201 |
// do profiling and by the time we get to the lower tier from the interpreter |
|
1202 |
// the path may be cold again. Make sure it doesn't look untaken |
|
1203 |
if (is_fallthrough) { |
|
1204 |
profile_not_taken_branch(!ProfileInterpreter); |
|
1205 |
} else { |
|
1206 |
profile_taken_branch(iter().get_dest(), !ProfileInterpreter); |
|
1207 |
} |
|
1208 |
uncommon_trap(Deoptimization::Reason_unreached, |
|
1209 |
Deoptimization::Action_reinterpret, |
|
1210 |
NULL, |
|
1211 |
(is_fallthrough ? "taken always" : "taken never")); |
|
1212 |
return; |
|
1213 |
} |
|
1214 |
||
1215 |
Node* val = c->in(1); |
|
1216 |
Node* con = c->in(2); |
|
1217 |
const Type* tcon = _gvn.type(con); |
|
1218 |
const Type* tval = _gvn.type(val); |
|
1219 |
bool have_con = tcon->singleton(); |
|
1220 |
if (tval->singleton()) { |
|
1221 |
if (!have_con) { |
|
1222 |
// Swap, so constant is in con. |
|
1223 |
con = val; |
|
1224 |
tcon = tval; |
|
1225 |
val = c->in(2); |
|
1226 |
tval = _gvn.type(val); |
|
1227 |
btest = BoolTest(btest).commute(); |
|
1228 |
have_con = true; |
|
1229 |
} else { |
|
1230 |
// Do we have two constants? Then leave well enough alone. |
|
1231 |
have_con = false; |
|
1232 |
} |
|
1233 |
} |
|
1234 |
if (!have_con) // remaining adjustments need a con |
|
1235 |
return; |
|
1236 |
||
12945
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1237 |
sharpen_type_after_if(btest, con, tcon, val, tval); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1238 |
} |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1239 |
|
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1240 |
|
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1241 |
static Node* extract_obj_from_klass_load(PhaseGVN* gvn, Node* n) { |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1242 |
Node* ldk; |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13895
diff
changeset
|
1243 |
if (n->is_DecodeNKlass()) { |
12945
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1244 |
if (n->in(1)->Opcode() != Op_LoadNKlass) { |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1245 |
return NULL; |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1246 |
} else { |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1247 |
ldk = n->in(1); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1248 |
} |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1249 |
} else if (n->Opcode() != Op_LoadKlass) { |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1250 |
return NULL; |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1251 |
} else { |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1252 |
ldk = n; |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1253 |
} |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1254 |
assert(ldk != NULL && ldk->is_Load(), "should have found a LoadKlass or LoadNKlass node"); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1255 |
|
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1256 |
Node* adr = ldk->in(MemNode::Address); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1257 |
intptr_t off = 0; |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1258 |
Node* obj = AddPNode::Ideal_base_and_offset(adr, gvn, off); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1259 |
if (obj == NULL || off != oopDesc::klass_offset_in_bytes()) // loading oopDesc::_klass? |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1260 |
return NULL; |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1261 |
const TypePtr* tp = gvn->type(obj)->is_ptr(); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1262 |
if (tp == NULL || !(tp->isa_instptr() || tp->isa_aryptr())) // is obj a Java object ptr? |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1263 |
return NULL; |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1264 |
|
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1265 |
return obj; |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1266 |
} |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1267 |
|
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1268 |
void Parse::sharpen_type_after_if(BoolTest::mask btest, |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1269 |
Node* con, const Type* tcon, |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1270 |
Node* val, const Type* tval) { |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1271 |
// Look for opportunities to sharpen the type of a node |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1272 |
// whose klass is compared with a constant klass. |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1273 |
if (btest == BoolTest::eq && tcon->isa_klassptr()) { |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1274 |
Node* obj = extract_obj_from_klass_load(&_gvn, val); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1275 |
const TypeOopPtr* con_type = tcon->isa_klassptr()->as_instance_type(); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1276 |
if (obj != NULL && (con_type->isa_instptr() || con_type->isa_aryptr())) { |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1277 |
// Found: |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1278 |
// Bool(CmpP(LoadKlass(obj._klass), ConP(Foo.klass)), [eq]) |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1279 |
// or the narrowOop equivalent. |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1280 |
const Type* obj_type = _gvn.type(obj); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1281 |
const TypeOopPtr* tboth = obj_type->join(con_type)->isa_oopptr(); |
13204
589e566a5ca8
7180769: assert(tboth->klass_is_exact()) failed: klass should be exact
kvn
parents:
12945
diff
changeset
|
1282 |
if (tboth != NULL && tboth->klass_is_exact() && tboth != obj_type && |
589e566a5ca8
7180769: assert(tboth->klass_is_exact()) failed: klass should be exact
kvn
parents:
12945
diff
changeset
|
1283 |
tboth->higher_equal(obj_type)) { |
12945
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1284 |
// obj has to be of the exact type Foo if the CmpP succeeds. |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1285 |
int obj_in_map = map()->find_edge(obj); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1286 |
JVMState* jvms = this->jvms(); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1287 |
if (obj_in_map >= 0 && |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1288 |
(jvms->is_loc(obj_in_map) || jvms->is_stk(obj_in_map))) { |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1289 |
TypeNode* ccast = new (C) CheckCastPPNode(control(), obj, tboth); |
12945
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1290 |
const Type* tcc = ccast->as_Type()->type(); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1291 |
assert(tcc != obj_type && tcc->higher_equal(obj_type), "must improve"); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1292 |
// Delay transform() call to allow recovery of pre-cast value |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1293 |
// at the control merge. |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1294 |
_gvn.set_type_bottom(ccast); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1295 |
record_for_igvn(ccast); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1296 |
// Here's the payoff. |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1297 |
replace_in_map(obj, ccast); |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1298 |
} |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1299 |
} |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1300 |
} |
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1301 |
} |
1 | 1302 |
|
1303 |
int val_in_map = map()->find_edge(val); |
|
1304 |
if (val_in_map < 0) return; // replace_in_map would be useless |
|
1305 |
{ |
|
1306 |
JVMState* jvms = this->jvms(); |
|
1307 |
if (!(jvms->is_loc(val_in_map) || |
|
1308 |
jvms->is_stk(val_in_map))) |
|
1309 |
return; // again, it would be useless |
|
1310 |
} |
|
1311 |
||
1312 |
// Check for a comparison to a constant, and "know" that the compared |
|
1313 |
// value is constrained on this path. |
|
1314 |
assert(tcon->singleton(), ""); |
|
1315 |
ConstraintCastNode* ccast = NULL; |
|
1316 |
Node* cast = NULL; |
|
1317 |
||
1318 |
switch (btest) { |
|
1319 |
case BoolTest::eq: // Constant test? |
|
1320 |
{ |
|
1321 |
const Type* tboth = tcon->join(tval); |
|
1322 |
if (tboth == tval) break; // Nothing to gain. |
|
1323 |
if (tcon->isa_int()) { |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1324 |
ccast = new (C) CastIINode(val, tboth); |
1 | 1325 |
} else if (tcon == TypePtr::NULL_PTR) { |
1326 |
// Cast to null, but keep the pointer identity temporarily live. |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1327 |
ccast = new (C) CastPPNode(val, tboth); |
1 | 1328 |
} else { |
1329 |
const TypeF* tf = tcon->isa_float_constant(); |
|
1330 |
const TypeD* td = tcon->isa_double_constant(); |
|
1331 |
// Exclude tests vs float/double 0 as these could be |
|
1332 |
// either +0 or -0. Just because you are equal to +0 |
|
1333 |
// doesn't mean you ARE +0! |
|
12945
e63d6176cbd1
7170463: C2 should recognize "obj.getClass() == A.class" code pattern
kvn
parents:
10508
diff
changeset
|
1334 |
// Note, following code also replaces Long and Oop values. |
1 | 1335 |
if ((!tf || tf->_f != 0.0) && |
1336 |
(!td || td->_d != 0.0)) |
|
1337 |
cast = con; // Replace non-constant val by con. |
|
1338 |
} |
|
1339 |
} |
|
1340 |
break; |
|
1341 |
||
1342 |
case BoolTest::ne: |
|
1343 |
if (tcon == TypePtr::NULL_PTR) { |
|
1344 |
cast = cast_not_null(val, false); |
|
1345 |
} |
|
1346 |
break; |
|
1347 |
||
1348 |
default: |
|
1349 |
// (At this point we could record int range types with CastII.) |
|
1350 |
break; |
|
1351 |
} |
|
1352 |
||
1353 |
if (ccast != NULL) { |
|
1354 |
const Type* tcc = ccast->as_Type()->type(); |
|
1355 |
assert(tcc != tval && tcc->higher_equal(tval), "must improve"); |
|
1356 |
// Delay transform() call to allow recovery of pre-cast value |
|
1357 |
// at the control merge. |
|
1358 |
ccast->set_req(0, control()); |
|
1359 |
_gvn.set_type_bottom(ccast); |
|
1360 |
record_for_igvn(ccast); |
|
1361 |
cast = ccast; |
|
1362 |
} |
|
1363 |
||
1364 |
if (cast != NULL) { // Here's the payoff. |
|
1365 |
replace_in_map(val, cast); |
|
1366 |
} |
|
1367 |
} |
|
1368 |
||
1369 |
||
1370 |
//------------------------------do_one_bytecode-------------------------------- |
|
1371 |
// Parse this bytecode, and alter the Parsers JVM->Node mapping |
|
1372 |
void Parse::do_one_bytecode() { |
|
1373 |
Node *a, *b, *c, *d; // Handy temps |
|
1374 |
BoolTest::mask btest; |
|
1375 |
int i; |
|
1376 |
||
1377 |
assert(!has_exceptions(), "bytecode entry state must be clear of throws"); |
|
1378 |
||
1379 |
if (C->check_node_count(NodeLimitFudgeFactor * 5, |
|
1380 |
"out of nodes parsing method")) { |
|
1381 |
return; |
|
1382 |
} |
|
1383 |
||
1384 |
#ifdef ASSERT |
|
1385 |
// for setting breakpoints |
|
1386 |
if (TraceOptoParse) { |
|
1387 |
tty->print(" @"); |
|
1388 |
dump_bci(bci()); |
|
16613
58c6d72ad0ef
8009539: JVM crash when run lambda testng tests
bharadwaj
parents:
14621
diff
changeset
|
1389 |
tty->cr(); |
1 | 1390 |
} |
1391 |
#endif |
|
1392 |
||
1393 |
switch (bc()) { |
|
1394 |
case Bytecodes::_nop: |
|
1395 |
// do nothing |
|
1396 |
break; |
|
1397 |
case Bytecodes::_lconst_0: |
|
1398 |
push_pair(longcon(0)); |
|
1399 |
break; |
|
1400 |
||
1401 |
case Bytecodes::_lconst_1: |
|
1402 |
push_pair(longcon(1)); |
|
1403 |
break; |
|
1404 |
||
1405 |
case Bytecodes::_fconst_0: |
|
1406 |
push(zerocon(T_FLOAT)); |
|
1407 |
break; |
|
1408 |
||
1409 |
case Bytecodes::_fconst_1: |
|
1410 |
push(makecon(TypeF::ONE)); |
|
1411 |
break; |
|
1412 |
||
1413 |
case Bytecodes::_fconst_2: |
|
1414 |
push(makecon(TypeF::make(2.0f))); |
|
1415 |
break; |
|
1416 |
||
1417 |
case Bytecodes::_dconst_0: |
|
1418 |
push_pair(zerocon(T_DOUBLE)); |
|
1419 |
break; |
|
1420 |
||
1421 |
case Bytecodes::_dconst_1: |
|
1422 |
push_pair(makecon(TypeD::ONE)); |
|
1423 |
break; |
|
1424 |
||
1425 |
case Bytecodes::_iconst_m1:push(intcon(-1)); break; |
|
1426 |
case Bytecodes::_iconst_0: push(intcon( 0)); break; |
|
1427 |
case Bytecodes::_iconst_1: push(intcon( 1)); break; |
|
1428 |
case Bytecodes::_iconst_2: push(intcon( 2)); break; |
|
1429 |
case Bytecodes::_iconst_3: push(intcon( 3)); break; |
|
1430 |
case Bytecodes::_iconst_4: push(intcon( 4)); break; |
|
1431 |
case Bytecodes::_iconst_5: push(intcon( 5)); break; |
|
5688 | 1432 |
case Bytecodes::_bipush: push(intcon(iter().get_constant_u1())); break; |
1433 |
case Bytecodes::_sipush: push(intcon(iter().get_constant_u2())); break; |
|
1 | 1434 |
case Bytecodes::_aconst_null: push(null()); break; |
1435 |
case Bytecodes::_ldc: |
|
1436 |
case Bytecodes::_ldc_w: |
|
1437 |
case Bytecodes::_ldc2_w: |
|
1438 |
// If the constant is unresolved, run this BC once in the interpreter. |
|
5882 | 1439 |
{ |
1 | 1440 |
ciConstant constant = iter().get_constant(); |
5882 | 1441 |
if (constant.basic_type() == T_OBJECT && |
1442 |
!constant.as_object()->is_loaded()) { |
|
1443 |
int index = iter().get_constant_pool_index(); |
|
1444 |
constantTag tag = iter().get_constant_pool_tag(index); |
|
1445 |
uncommon_trap(Deoptimization::make_trap_request |
|
1446 |
(Deoptimization::Reason_unloaded, |
|
1447 |
Deoptimization::Action_reinterpret, |
|
1448 |
index), |
|
1449 |
NULL, tag.internal_name()); |
|
1450 |
break; |
|
1 | 1451 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13204
diff
changeset
|
1452 |
assert(constant.basic_type() != T_OBJECT || constant.as_object()->is_instance(), |
5882 | 1453 |
"must be java_mirror of klass"); |
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
3261
diff
changeset
|
1454 |
bool pushed = push_constant(constant, true); |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
3261
diff
changeset
|
1455 |
guarantee(pushed, "must be possible to push this constant"); |
1 | 1456 |
} |
1457 |
||
1458 |
break; |
|
1459 |
||
1460 |
case Bytecodes::_aload_0: |
|
1461 |
push( local(0) ); |
|
1462 |
break; |
|
1463 |
case Bytecodes::_aload_1: |
|
1464 |
push( local(1) ); |
|
1465 |
break; |
|
1466 |
case Bytecodes::_aload_2: |
|
1467 |
push( local(2) ); |
|
1468 |
break; |
|
1469 |
case Bytecodes::_aload_3: |
|
1470 |
push( local(3) ); |
|
1471 |
break; |
|
1472 |
case Bytecodes::_aload: |
|
1473 |
push( local(iter().get_index()) ); |
|
1474 |
break; |
|
1475 |
||
1476 |
case Bytecodes::_fload_0: |
|
1477 |
case Bytecodes::_iload_0: |
|
1478 |
push( local(0) ); |
|
1479 |
break; |
|
1480 |
case Bytecodes::_fload_1: |
|
1481 |
case Bytecodes::_iload_1: |
|
1482 |
push( local(1) ); |
|
1483 |
break; |
|
1484 |
case Bytecodes::_fload_2: |
|
1485 |
case Bytecodes::_iload_2: |
|
1486 |
push( local(2) ); |
|
1487 |
break; |
|
1488 |
case Bytecodes::_fload_3: |
|
1489 |
case Bytecodes::_iload_3: |
|
1490 |
push( local(3) ); |
|
1491 |
break; |
|
1492 |
case Bytecodes::_fload: |
|
1493 |
case Bytecodes::_iload: |
|
1494 |
push( local(iter().get_index()) ); |
|
1495 |
break; |
|
1496 |
case Bytecodes::_lload_0: |
|
1497 |
push_pair_local( 0 ); |
|
1498 |
break; |
|
1499 |
case Bytecodes::_lload_1: |
|
1500 |
push_pair_local( 1 ); |
|
1501 |
break; |
|
1502 |
case Bytecodes::_lload_2: |
|
1503 |
push_pair_local( 2 ); |
|
1504 |
break; |
|
1505 |
case Bytecodes::_lload_3: |
|
1506 |
push_pair_local( 3 ); |
|
1507 |
break; |
|
1508 |
case Bytecodes::_lload: |
|
1509 |
push_pair_local( iter().get_index() ); |
|
1510 |
break; |
|
1511 |
||
1512 |
case Bytecodes::_dload_0: |
|
1513 |
push_pair_local(0); |
|
1514 |
break; |
|
1515 |
case Bytecodes::_dload_1: |
|
1516 |
push_pair_local(1); |
|
1517 |
break; |
|
1518 |
case Bytecodes::_dload_2: |
|
1519 |
push_pair_local(2); |
|
1520 |
break; |
|
1521 |
case Bytecodes::_dload_3: |
|
1522 |
push_pair_local(3); |
|
1523 |
break; |
|
1524 |
case Bytecodes::_dload: |
|
1525 |
push_pair_local(iter().get_index()); |
|
1526 |
break; |
|
1527 |
case Bytecodes::_fstore_0: |
|
1528 |
case Bytecodes::_istore_0: |
|
1529 |
case Bytecodes::_astore_0: |
|
1530 |
set_local( 0, pop() ); |
|
1531 |
break; |
|
1532 |
case Bytecodes::_fstore_1: |
|
1533 |
case Bytecodes::_istore_1: |
|
1534 |
case Bytecodes::_astore_1: |
|
1535 |
set_local( 1, pop() ); |
|
1536 |
break; |
|
1537 |
case Bytecodes::_fstore_2: |
|
1538 |
case Bytecodes::_istore_2: |
|
1539 |
case Bytecodes::_astore_2: |
|
1540 |
set_local( 2, pop() ); |
|
1541 |
break; |
|
1542 |
case Bytecodes::_fstore_3: |
|
1543 |
case Bytecodes::_istore_3: |
|
1544 |
case Bytecodes::_astore_3: |
|
1545 |
set_local( 3, pop() ); |
|
1546 |
break; |
|
1547 |
case Bytecodes::_fstore: |
|
1548 |
case Bytecodes::_istore: |
|
1549 |
case Bytecodes::_astore: |
|
1550 |
set_local( iter().get_index(), pop() ); |
|
1551 |
break; |
|
1552 |
// long stores |
|
1553 |
case Bytecodes::_lstore_0: |
|
1554 |
set_pair_local( 0, pop_pair() ); |
|
1555 |
break; |
|
1556 |
case Bytecodes::_lstore_1: |
|
1557 |
set_pair_local( 1, pop_pair() ); |
|
1558 |
break; |
|
1559 |
case Bytecodes::_lstore_2: |
|
1560 |
set_pair_local( 2, pop_pair() ); |
|
1561 |
break; |
|
1562 |
case Bytecodes::_lstore_3: |
|
1563 |
set_pair_local( 3, pop_pair() ); |
|
1564 |
break; |
|
1565 |
case Bytecodes::_lstore: |
|
1566 |
set_pair_local( iter().get_index(), pop_pair() ); |
|
1567 |
break; |
|
1568 |
||
1569 |
// double stores |
|
1570 |
case Bytecodes::_dstore_0: |
|
1571 |
set_pair_local( 0, dstore_rounding(pop_pair()) ); |
|
1572 |
break; |
|
1573 |
case Bytecodes::_dstore_1: |
|
1574 |
set_pair_local( 1, dstore_rounding(pop_pair()) ); |
|
1575 |
break; |
|
1576 |
case Bytecodes::_dstore_2: |
|
1577 |
set_pair_local( 2, dstore_rounding(pop_pair()) ); |
|
1578 |
break; |
|
1579 |
case Bytecodes::_dstore_3: |
|
1580 |
set_pair_local( 3, dstore_rounding(pop_pair()) ); |
|
1581 |
break; |
|
1582 |
case Bytecodes::_dstore: |
|
1583 |
set_pair_local( iter().get_index(), dstore_rounding(pop_pair()) ); |
|
1584 |
break; |
|
1585 |
||
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
1586 |
case Bytecodes::_pop: dec_sp(1); break; |
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
1587 |
case Bytecodes::_pop2: dec_sp(2); break; |
1 | 1588 |
case Bytecodes::_swap: |
1589 |
a = pop(); |
|
1590 |
b = pop(); |
|
1591 |
push(a); |
|
1592 |
push(b); |
|
1593 |
break; |
|
1594 |
case Bytecodes::_dup: |
|
1595 |
a = pop(); |
|
1596 |
push(a); |
|
1597 |
push(a); |
|
1598 |
break; |
|
1599 |
case Bytecodes::_dup_x1: |
|
1600 |
a = pop(); |
|
1601 |
b = pop(); |
|
1602 |
push( a ); |
|
1603 |
push( b ); |
|
1604 |
push( a ); |
|
1605 |
break; |
|
1606 |
case Bytecodes::_dup_x2: |
|
1607 |
a = pop(); |
|
1608 |
b = pop(); |
|
1609 |
c = pop(); |
|
1610 |
push( a ); |
|
1611 |
push( c ); |
|
1612 |
push( b ); |
|
1613 |
push( a ); |
|
1614 |
break; |
|
1615 |
case Bytecodes::_dup2: |
|
1616 |
a = pop(); |
|
1617 |
b = pop(); |
|
1618 |
push( b ); |
|
1619 |
push( a ); |
|
1620 |
push( b ); |
|
1621 |
push( a ); |
|
1622 |
break; |
|
1623 |
||
1624 |
case Bytecodes::_dup2_x1: |
|
1625 |
// before: .. c, b, a |
|
1626 |
// after: .. b, a, c, b, a |
|
1627 |
// not tested |
|
1628 |
a = pop(); |
|
1629 |
b = pop(); |
|
1630 |
c = pop(); |
|
1631 |
push( b ); |
|
1632 |
push( a ); |
|
1633 |
push( c ); |
|
1634 |
push( b ); |
|
1635 |
push( a ); |
|
1636 |
break; |
|
1637 |
case Bytecodes::_dup2_x2: |
|
1638 |
// before: .. d, c, b, a |
|
1639 |
// after: .. b, a, d, c, b, a |
|
1640 |
// not tested |
|
1641 |
a = pop(); |
|
1642 |
b = pop(); |
|
1643 |
c = pop(); |
|
1644 |
d = pop(); |
|
1645 |
push( b ); |
|
1646 |
push( a ); |
|
1647 |
push( d ); |
|
1648 |
push( c ); |
|
1649 |
push( b ); |
|
1650 |
push( a ); |
|
1651 |
break; |
|
1652 |
||
1653 |
case Bytecodes::_arraylength: { |
|
1654 |
// Must do null-check with value on expression stack |
|
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
1655 |
Node *ary = null_check(peek(), T_ARRAY); |
1 | 1656 |
// Compile-time detect of null-exception? |
1657 |
if (stopped()) return; |
|
1658 |
a = pop(); |
|
1659 |
push(load_array_length(a)); |
|
1660 |
break; |
|
1661 |
} |
|
1662 |
||
1663 |
case Bytecodes::_baload: array_load(T_BYTE); break; |
|
1664 |
case Bytecodes::_caload: array_load(T_CHAR); break; |
|
1665 |
case Bytecodes::_iaload: array_load(T_INT); break; |
|
1666 |
case Bytecodes::_saload: array_load(T_SHORT); break; |
|
1667 |
case Bytecodes::_faload: array_load(T_FLOAT); break; |
|
1668 |
case Bytecodes::_aaload: array_load(T_OBJECT); break; |
|
1669 |
case Bytecodes::_laload: { |
|
1670 |
a = array_addressing(T_LONG, 0); |
|
2131 | 1671 |
if (stopped()) return; // guaranteed null or range check |
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
1672 |
dec_sp(2); // Pop array and index |
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
1673 |
push_pair(make_load(control(), a, TypeLong::LONG, T_LONG, TypeAryPtr::LONGS)); |
1 | 1674 |
break; |
1675 |
} |
|
1676 |
case Bytecodes::_daload: { |
|
1677 |
a = array_addressing(T_DOUBLE, 0); |
|
2131 | 1678 |
if (stopped()) return; // guaranteed null or range check |
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
1679 |
dec_sp(2); // Pop array and index |
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
1680 |
push_pair(make_load(control(), a, Type::DOUBLE, T_DOUBLE, TypeAryPtr::DOUBLES)); |
1 | 1681 |
break; |
1682 |
} |
|
1683 |
case Bytecodes::_bastore: array_store(T_BYTE); break; |
|
1684 |
case Bytecodes::_castore: array_store(T_CHAR); break; |
|
1685 |
case Bytecodes::_iastore: array_store(T_INT); break; |
|
1686 |
case Bytecodes::_sastore: array_store(T_SHORT); break; |
|
1687 |
case Bytecodes::_fastore: array_store(T_FLOAT); break; |
|
1688 |
case Bytecodes::_aastore: { |
|
1689 |
d = array_addressing(T_OBJECT, 1); |
|
2131 | 1690 |
if (stopped()) return; // guaranteed null or range check |
1 | 1691 |
array_store_check(); |
1692 |
c = pop(); // Oop to store |
|
1693 |
b = pop(); // index (already used) |
|
1694 |
a = pop(); // the array itself |
|
3180
c589129153a4
6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")
never
parents:
3178
diff
changeset
|
1695 |
const TypeOopPtr* elemtype = _gvn.type(a)->is_aryptr()->elem()->make_oopptr(); |
1 | 1696 |
const TypeAryPtr* adr_type = TypeAryPtr::OOPS; |
1697 |
Node* store = store_oop_to_array(control(), a, d, adr_type, c, elemtype, T_OBJECT); |
|
1698 |
break; |
|
1699 |
} |
|
1700 |
case Bytecodes::_lastore: { |
|
1701 |
a = array_addressing(T_LONG, 2); |
|
2131 | 1702 |
if (stopped()) return; // guaranteed null or range check |
1 | 1703 |
c = pop_pair(); |
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
1704 |
dec_sp(2); // Pop array and index |
1 | 1705 |
store_to_memory(control(), a, c, T_LONG, TypeAryPtr::LONGS); |
1706 |
break; |
|
1707 |
} |
|
1708 |
case Bytecodes::_dastore: { |
|
1709 |
a = array_addressing(T_DOUBLE, 2); |
|
2131 | 1710 |
if (stopped()) return; // guaranteed null or range check |
1 | 1711 |
c = pop_pair(); |
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
1712 |
dec_sp(2); // Pop array and index |
1 | 1713 |
c = dstore_rounding(c); |
1714 |
store_to_memory(control(), a, c, T_DOUBLE, TypeAryPtr::DOUBLES); |
|
1715 |
break; |
|
1716 |
} |
|
1717 |
case Bytecodes::_getfield: |
|
1718 |
do_getfield(); |
|
1719 |
break; |
|
1720 |
||
1721 |
case Bytecodes::_getstatic: |
|
1722 |
do_getstatic(); |
|
1723 |
break; |
|
1724 |
||
1725 |
case Bytecodes::_putfield: |
|
1726 |
do_putfield(); |
|
1727 |
break; |
|
1728 |
||
1729 |
case Bytecodes::_putstatic: |
|
1730 |
do_putstatic(); |
|
1731 |
break; |
|
1732 |
||
1733 |
case Bytecodes::_irem: |
|
1734 |
do_irem(); |
|
1735 |
break; |
|
1736 |
case Bytecodes::_idiv: |
|
1737 |
// Must keep both values on the expression-stack during null-check |
|
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
1738 |
zero_check_int(peek()); |
1 | 1739 |
// Compile-time detect of null-exception? |
1740 |
if (stopped()) return; |
|
1741 |
b = pop(); |
|
1742 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1743 |
push( _gvn.transform( new (C) DivINode(control(),a,b) ) ); |
1 | 1744 |
break; |
1745 |
case Bytecodes::_imul: |
|
1746 |
b = pop(); a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1747 |
push( _gvn.transform( new (C) MulINode(a,b) ) ); |
1 | 1748 |
break; |
1749 |
case Bytecodes::_iadd: |
|
1750 |
b = pop(); a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1751 |
push( _gvn.transform( new (C) AddINode(a,b) ) ); |
1 | 1752 |
break; |
1753 |
case Bytecodes::_ineg: |
|
1754 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1755 |
push( _gvn.transform( new (C) SubINode(_gvn.intcon(0),a)) ); |
1 | 1756 |
break; |
1757 |
case Bytecodes::_isub: |
|
1758 |
b = pop(); a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1759 |
push( _gvn.transform( new (C) SubINode(a,b) ) ); |
1 | 1760 |
break; |
1761 |
case Bytecodes::_iand: |
|
1762 |
b = pop(); a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1763 |
push( _gvn.transform( new (C) AndINode(a,b) ) ); |
1 | 1764 |
break; |
1765 |
case Bytecodes::_ior: |
|
1766 |
b = pop(); a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1767 |
push( _gvn.transform( new (C) OrINode(a,b) ) ); |
1 | 1768 |
break; |
1769 |
case Bytecodes::_ixor: |
|
1770 |
b = pop(); a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1771 |
push( _gvn.transform( new (C) XorINode(a,b) ) ); |
1 | 1772 |
break; |
1773 |
case Bytecodes::_ishl: |
|
1774 |
b = pop(); a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1775 |
push( _gvn.transform( new (C) LShiftINode(a,b) ) ); |
1 | 1776 |
break; |
1777 |
case Bytecodes::_ishr: |
|
1778 |
b = pop(); a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1779 |
push( _gvn.transform( new (C) RShiftINode(a,b) ) ); |
1 | 1780 |
break; |
1781 |
case Bytecodes::_iushr: |
|
1782 |
b = pop(); a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1783 |
push( _gvn.transform( new (C) URShiftINode(a,b) ) ); |
1 | 1784 |
break; |
1785 |
||
1786 |
case Bytecodes::_fneg: |
|
1787 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1788 |
b = _gvn.transform(new (C) NegFNode (a)); |
1 | 1789 |
push(b); |
1790 |
break; |
|
1791 |
||
1792 |
case Bytecodes::_fsub: |
|
1793 |
b = pop(); |
|
1794 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1795 |
c = _gvn.transform( new (C) SubFNode(a,b) ); |
1 | 1796 |
d = precision_rounding(c); |
1797 |
push( d ); |
|
1798 |
break; |
|
1799 |
||
1800 |
case Bytecodes::_fadd: |
|
1801 |
b = pop(); |
|
1802 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1803 |
c = _gvn.transform( new (C) AddFNode(a,b) ); |
1 | 1804 |
d = precision_rounding(c); |
1805 |
push( d ); |
|
1806 |
break; |
|
1807 |
||
1808 |
case Bytecodes::_fmul: |
|
1809 |
b = pop(); |
|
1810 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1811 |
c = _gvn.transform( new (C) MulFNode(a,b) ); |
1 | 1812 |
d = precision_rounding(c); |
1813 |
push( d ); |
|
1814 |
break; |
|
1815 |
||
1816 |
case Bytecodes::_fdiv: |
|
1817 |
b = pop(); |
|
1818 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1819 |
c = _gvn.transform( new (C) DivFNode(0,a,b) ); |
1 | 1820 |
d = precision_rounding(c); |
1821 |
push( d ); |
|
1822 |
break; |
|
1823 |
||
1824 |
case Bytecodes::_frem: |
|
1825 |
if (Matcher::has_match_rule(Op_ModF)) { |
|
1826 |
// Generate a ModF node. |
|
1827 |
b = pop(); |
|
1828 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1829 |
c = _gvn.transform( new (C) ModFNode(0,a,b) ); |
1 | 1830 |
d = precision_rounding(c); |
1831 |
push( d ); |
|
1832 |
} |
|
1833 |
else { |
|
1834 |
// Generate a call. |
|
1835 |
modf(); |
|
1836 |
} |
|
1837 |
break; |
|
1838 |
||
1839 |
case Bytecodes::_fcmpl: |
|
1840 |
b = pop(); |
|
1841 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1842 |
c = _gvn.transform( new (C) CmpF3Node( a, b)); |
1 | 1843 |
push(c); |
1844 |
break; |
|
1845 |
case Bytecodes::_fcmpg: |
|
1846 |
b = pop(); |
|
1847 |
a = pop(); |
|
1848 |
||
1849 |
// Same as fcmpl but need to flip the unordered case. Swap the inputs, |
|
1850 |
// which negates the result sign except for unordered. Flip the unordered |
|
1851 |
// as well by using CmpF3 which implements unordered-lesser instead of |
|
1852 |
// unordered-greater semantics. Finally, commute the result bits. Result |
|
1853 |
// is same as using a CmpF3Greater except we did it with CmpF3 alone. |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1854 |
c = _gvn.transform( new (C) CmpF3Node( b, a)); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1855 |
c = _gvn.transform( new (C) SubINode(_gvn.intcon(0),c) ); |
1 | 1856 |
push(c); |
1857 |
break; |
|
1858 |
||
1859 |
case Bytecodes::_f2i: |
|
1860 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1861 |
push(_gvn.transform(new (C) ConvF2INode(a))); |
1 | 1862 |
break; |
1863 |
||
1864 |
case Bytecodes::_d2i: |
|
1865 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1866 |
b = _gvn.transform(new (C) ConvD2INode(a)); |
1 | 1867 |
push( b ); |
1868 |
break; |
|
1869 |
||
1870 |
case Bytecodes::_f2d: |
|
1871 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1872 |
b = _gvn.transform( new (C) ConvF2DNode(a)); |
1 | 1873 |
push_pair( b ); |
1874 |
break; |
|
1875 |
||
1876 |
case Bytecodes::_d2f: |
|
1877 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1878 |
b = _gvn.transform( new (C) ConvD2FNode(a)); |
1 | 1879 |
// This breaks _227_mtrt (speed & correctness) and _222_mpegaudio (speed) |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1880 |
//b = _gvn.transform(new (C) RoundFloatNode(0, b) ); |
1 | 1881 |
push( b ); |
1882 |
break; |
|
1883 |
||
1884 |
case Bytecodes::_l2f: |
|
1885 |
if (Matcher::convL2FSupported()) { |
|
1886 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1887 |
b = _gvn.transform( new (C) ConvL2FNode(a)); |
1 | 1888 |
// For i486.ad, FILD doesn't restrict precision to 24 or 53 bits. |
1889 |
// Rather than storing the result into an FP register then pushing |
|
1890 |
// out to memory to round, the machine instruction that implements |
|
1891 |
// ConvL2D is responsible for rounding. |
|
1892 |
// c = precision_rounding(b); |
|
1893 |
c = _gvn.transform(b); |
|
1894 |
push(c); |
|
1895 |
} else { |
|
1896 |
l2f(); |
|
1897 |
} |
|
1898 |
break; |
|
1899 |
||
1900 |
case Bytecodes::_l2d: |
|
1901 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1902 |
b = _gvn.transform( new (C) ConvL2DNode(a)); |
1 | 1903 |
// For i486.ad, rounding is always necessary (see _l2f above). |
1904 |
// c = dprecision_rounding(b); |
|
1905 |
c = _gvn.transform(b); |
|
1906 |
push_pair(c); |
|
1907 |
break; |
|
1908 |
||
1909 |
case Bytecodes::_f2l: |
|
1910 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1911 |
b = _gvn.transform( new (C) ConvF2LNode(a)); |
1 | 1912 |
push_pair(b); |
1913 |
break; |
|
1914 |
||
1915 |
case Bytecodes::_d2l: |
|
1916 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1917 |
b = _gvn.transform( new (C) ConvD2LNode(a)); |
1 | 1918 |
push_pair(b); |
1919 |
break; |
|
1920 |
||
1921 |
case Bytecodes::_dsub: |
|
1922 |
b = pop_pair(); |
|
1923 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1924 |
c = _gvn.transform( new (C) SubDNode(a,b) ); |
1 | 1925 |
d = dprecision_rounding(c); |
1926 |
push_pair( d ); |
|
1927 |
break; |
|
1928 |
||
1929 |
case Bytecodes::_dadd: |
|
1930 |
b = pop_pair(); |
|
1931 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1932 |
c = _gvn.transform( new (C) AddDNode(a,b) ); |
1 | 1933 |
d = dprecision_rounding(c); |
1934 |
push_pair( d ); |
|
1935 |
break; |
|
1936 |
||
1937 |
case Bytecodes::_dmul: |
|
1938 |
b = pop_pair(); |
|
1939 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1940 |
c = _gvn.transform( new (C) MulDNode(a,b) ); |
1 | 1941 |
d = dprecision_rounding(c); |
1942 |
push_pair( d ); |
|
1943 |
break; |
|
1944 |
||
1945 |
case Bytecodes::_ddiv: |
|
1946 |
b = pop_pair(); |
|
1947 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1948 |
c = _gvn.transform( new (C) DivDNode(0,a,b) ); |
1 | 1949 |
d = dprecision_rounding(c); |
1950 |
push_pair( d ); |
|
1951 |
break; |
|
1952 |
||
1953 |
case Bytecodes::_dneg: |
|
1954 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1955 |
b = _gvn.transform(new (C) NegDNode (a)); |
1 | 1956 |
push_pair(b); |
1957 |
break; |
|
1958 |
||
1959 |
case Bytecodes::_drem: |
|
1960 |
if (Matcher::has_match_rule(Op_ModD)) { |
|
1961 |
// Generate a ModD node. |
|
1962 |
b = pop_pair(); |
|
1963 |
a = pop_pair(); |
|
1964 |
// a % b |
|
1965 |
||
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1966 |
c = _gvn.transform( new (C) ModDNode(0,a,b) ); |
1 | 1967 |
d = dprecision_rounding(c); |
1968 |
push_pair( d ); |
|
1969 |
} |
|
1970 |
else { |
|
1971 |
// Generate a call. |
|
1972 |
modd(); |
|
1973 |
} |
|
1974 |
break; |
|
1975 |
||
1976 |
case Bytecodes::_dcmpl: |
|
1977 |
b = pop_pair(); |
|
1978 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1979 |
c = _gvn.transform( new (C) CmpD3Node( a, b)); |
1 | 1980 |
push(c); |
1981 |
break; |
|
1982 |
||
1983 |
case Bytecodes::_dcmpg: |
|
1984 |
b = pop_pair(); |
|
1985 |
a = pop_pair(); |
|
1986 |
// Same as dcmpl but need to flip the unordered case. |
|
1987 |
// Commute the inputs, which negates the result sign except for unordered. |
|
1988 |
// Flip the unordered as well by using CmpD3 which implements |
|
1989 |
// unordered-lesser instead of unordered-greater semantics. |
|
1990 |
// Finally, negate the result bits. Result is same as using a |
|
1991 |
// CmpD3Greater except we did it with CmpD3 alone. |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1992 |
c = _gvn.transform( new (C) CmpD3Node( b, a)); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
1993 |
c = _gvn.transform( new (C) SubINode(_gvn.intcon(0),c) ); |
1 | 1994 |
push(c); |
1995 |
break; |
|
1996 |
||
1997 |
||
1998 |
// Note for longs -> lo word is on TOS, hi word is on TOS - 1 |
|
1999 |
case Bytecodes::_land: |
|
2000 |
b = pop_pair(); |
|
2001 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2002 |
c = _gvn.transform( new (C) AndLNode(a,b) ); |
1 | 2003 |
push_pair(c); |
2004 |
break; |
|
2005 |
case Bytecodes::_lor: |
|
2006 |
b = pop_pair(); |
|
2007 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2008 |
c = _gvn.transform( new (C) OrLNode(a,b) ); |
1 | 2009 |
push_pair(c); |
2010 |
break; |
|
2011 |
case Bytecodes::_lxor: |
|
2012 |
b = pop_pair(); |
|
2013 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2014 |
c = _gvn.transform( new (C) XorLNode(a,b) ); |
1 | 2015 |
push_pair(c); |
2016 |
break; |
|
2017 |
||
2018 |
case Bytecodes::_lshl: |
|
2019 |
b = pop(); // the shift count |
|
2020 |
a = pop_pair(); // value to be shifted |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2021 |
c = _gvn.transform( new (C) LShiftLNode(a,b) ); |
1 | 2022 |
push_pair(c); |
2023 |
break; |
|
2024 |
case Bytecodes::_lshr: |
|
2025 |
b = pop(); // the shift count |
|
2026 |
a = pop_pair(); // value to be shifted |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2027 |
c = _gvn.transform( new (C) RShiftLNode(a,b) ); |
1 | 2028 |
push_pair(c); |
2029 |
break; |
|
2030 |
case Bytecodes::_lushr: |
|
2031 |
b = pop(); // the shift count |
|
2032 |
a = pop_pair(); // value to be shifted |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2033 |
c = _gvn.transform( new (C) URShiftLNode(a,b) ); |
1 | 2034 |
push_pair(c); |
2035 |
break; |
|
2036 |
case Bytecodes::_lmul: |
|
2037 |
b = pop_pair(); |
|
2038 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2039 |
c = _gvn.transform( new (C) MulLNode(a,b) ); |
1 | 2040 |
push_pair(c); |
2041 |
break; |
|
2042 |
||
2043 |
case Bytecodes::_lrem: |
|
2044 |
// Must keep both values on the expression-stack during null-check |
|
2045 |
assert(peek(0) == top(), "long word order"); |
|
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
2046 |
zero_check_long(peek(1)); |
1 | 2047 |
// Compile-time detect of null-exception? |
2048 |
if (stopped()) return; |
|
2049 |
b = pop_pair(); |
|
2050 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2051 |
c = _gvn.transform( new (C) ModLNode(control(),a,b) ); |
1 | 2052 |
push_pair(c); |
2053 |
break; |
|
2054 |
||
2055 |
case Bytecodes::_ldiv: |
|
2056 |
// Must keep both values on the expression-stack during null-check |
|
2057 |
assert(peek(0) == top(), "long word order"); |
|
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
2058 |
zero_check_long(peek(1)); |
1 | 2059 |
// Compile-time detect of null-exception? |
2060 |
if (stopped()) return; |
|
2061 |
b = pop_pair(); |
|
2062 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2063 |
c = _gvn.transform( new (C) DivLNode(control(),a,b) ); |
1 | 2064 |
push_pair(c); |
2065 |
break; |
|
2066 |
||
2067 |
case Bytecodes::_ladd: |
|
2068 |
b = pop_pair(); |
|
2069 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2070 |
c = _gvn.transform( new (C) AddLNode(a,b) ); |
1 | 2071 |
push_pair(c); |
2072 |
break; |
|
2073 |
case Bytecodes::_lsub: |
|
2074 |
b = pop_pair(); |
|
2075 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2076 |
c = _gvn.transform( new (C) SubLNode(a,b) ); |
1 | 2077 |
push_pair(c); |
2078 |
break; |
|
2079 |
case Bytecodes::_lcmp: |
|
2080 |
// Safepoints are now inserted _before_ branches. The long-compare |
|
2081 |
// bytecode painfully produces a 3-way value (-1,0,+1) which requires a |
|
2082 |
// slew of control flow. These are usually followed by a CmpI vs zero and |
|
2083 |
// a branch; this pattern then optimizes to the obvious long-compare and |
|
2084 |
// branch. However, if the branch is backwards there's a Safepoint |
|
2085 |
// inserted. The inserted Safepoint captures the JVM state at the |
|
2086 |
// pre-branch point, i.e. it captures the 3-way value. Thus if a |
|
2087 |
// long-compare is used to control a loop the debug info will force |
|
2088 |
// computation of the 3-way value, even though the generated code uses a |
|
2089 |
// long-compare and branch. We try to rectify the situation by inserting |
|
2090 |
// a SafePoint here and have it dominate and kill the safepoint added at a |
|
2091 |
// following backwards branch. At this point the JVM state merely holds 2 |
|
2092 |
// longs but not the 3-way value. |
|
2093 |
if( UseLoopSafepoints ) { |
|
2094 |
switch( iter().next_bc() ) { |
|
2095 |
case Bytecodes::_ifgt: |
|
2096 |
case Bytecodes::_iflt: |
|
2097 |
case Bytecodes::_ifge: |
|
2098 |
case Bytecodes::_ifle: |
|
2099 |
case Bytecodes::_ifne: |
|
2100 |
case Bytecodes::_ifeq: |
|
2101 |
// If this is a backwards branch in the bytecodes, add Safepoint |
|
2102 |
maybe_add_safepoint(iter().next_get_dest()); |
|
2103 |
} |
|
2104 |
} |
|
2105 |
b = pop_pair(); |
|
2106 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2107 |
c = _gvn.transform( new (C) CmpL3Node( a, b )); |
1 | 2108 |
push(c); |
2109 |
break; |
|
2110 |
||
2111 |
case Bytecodes::_lneg: |
|
2112 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2113 |
b = _gvn.transform( new (C) SubLNode(longcon(0),a)); |
1 | 2114 |
push_pair(b); |
2115 |
break; |
|
2116 |
case Bytecodes::_l2i: |
|
2117 |
a = pop_pair(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2118 |
push( _gvn.transform( new (C) ConvL2INode(a))); |
1 | 2119 |
break; |
2120 |
case Bytecodes::_i2l: |
|
2121 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2122 |
b = _gvn.transform( new (C) ConvI2LNode(a)); |
1 | 2123 |
push_pair(b); |
2124 |
break; |
|
2125 |
case Bytecodes::_i2b: |
|
2126 |
// Sign extend |
|
2127 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2128 |
a = _gvn.transform( new (C) LShiftINode(a,_gvn.intcon(24)) ); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2129 |
a = _gvn.transform( new (C) RShiftINode(a,_gvn.intcon(24)) ); |
1 | 2130 |
push( a ); |
2131 |
break; |
|
2132 |
case Bytecodes::_i2s: |
|
2133 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2134 |
a = _gvn.transform( new (C) LShiftINode(a,_gvn.intcon(16)) ); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2135 |
a = _gvn.transform( new (C) RShiftINode(a,_gvn.intcon(16)) ); |
1 | 2136 |
push( a ); |
2137 |
break; |
|
2138 |
case Bytecodes::_i2c: |
|
2139 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2140 |
push( _gvn.transform( new (C) AndINode(a,_gvn.intcon(0xFFFF)) ) ); |
1 | 2141 |
break; |
2142 |
||
2143 |
case Bytecodes::_i2f: |
|
2144 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2145 |
b = _gvn.transform( new (C) ConvI2FNode(a) ) ; |
1 | 2146 |
c = precision_rounding(b); |
2147 |
push (b); |
|
2148 |
break; |
|
2149 |
||
2150 |
case Bytecodes::_i2d: |
|
2151 |
a = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2152 |
b = _gvn.transform( new (C) ConvI2DNode(a)); |
1 | 2153 |
push_pair(b); |
2154 |
break; |
|
2155 |
||
2156 |
case Bytecodes::_iinc: // Increment local |
|
2157 |
i = iter().get_index(); // Get local index |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2158 |
set_local( i, _gvn.transform( new (C) AddINode( _gvn.intcon(iter().get_iinc_con()), local(i) ) ) ); |
1 | 2159 |
break; |
2160 |
||
2161 |
// Exit points of synchronized methods must have an unlock node |
|
2162 |
case Bytecodes::_return: |
|
2163 |
return_current(NULL); |
|
2164 |
break; |
|
2165 |
||
2166 |
case Bytecodes::_ireturn: |
|
2167 |
case Bytecodes::_areturn: |
|
2168 |
case Bytecodes::_freturn: |
|
2169 |
return_current(pop()); |
|
2170 |
break; |
|
2171 |
case Bytecodes::_lreturn: |
|
2172 |
return_current(pop_pair()); |
|
2173 |
break; |
|
2174 |
case Bytecodes::_dreturn: |
|
2175 |
return_current(pop_pair()); |
|
2176 |
break; |
|
2177 |
||
2178 |
case Bytecodes::_athrow: |
|
2179 |
// null exception oop throws NULL pointer exception |
|
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
13969
diff
changeset
|
2180 |
null_check(peek()); |
1 | 2181 |
if (stopped()) return; |
2182 |
// Hook the thrown exception directly to subsequent handlers. |
|
2183 |
if (BailoutToInterpreterForThrows) { |
|
2184 |
// Keep method interpreted from now on. |
|
2185 |
uncommon_trap(Deoptimization::Reason_unhandled, |
|
2186 |
Deoptimization::Action_make_not_compilable); |
|
2187 |
return; |
|
2188 |
} |
|
4761
bdb7375a1fee
6902182: 4/4 Starting with jdwp agent should not incur performance penalty
dcubed
parents:
4643
diff
changeset
|
2189 |
if (env()->jvmti_can_post_on_exceptions()) { |
bdb7375a1fee
6902182: 4/4 Starting with jdwp agent should not incur performance penalty
dcubed
parents:
4643
diff
changeset
|
2190 |
// check if we must post exception events, take uncommon trap if so (with must_throw = false) |
bdb7375a1fee
6902182: 4/4 Starting with jdwp agent should not incur performance penalty
dcubed
parents:
4643
diff
changeset
|
2191 |
uncommon_trap_if_should_post_on_exceptions(Deoptimization::Reason_unhandled, false); |
bdb7375a1fee
6902182: 4/4 Starting with jdwp agent should not incur performance penalty
dcubed
parents:
4643
diff
changeset
|
2192 |
} |
bdb7375a1fee
6902182: 4/4 Starting with jdwp agent should not incur performance penalty
dcubed
parents:
4643
diff
changeset
|
2193 |
// Here if either can_post_on_exceptions or should_post_on_exceptions is false |
1 | 2194 |
add_exception_state(make_exception_state(peek())); |
2195 |
break; |
|
2196 |
||
2197 |
case Bytecodes::_goto: // fall through |
|
2198 |
case Bytecodes::_goto_w: { |
|
2199 |
int target_bci = (bc() == Bytecodes::_goto) ? iter().get_dest() : iter().get_far_dest(); |
|
2200 |
||
2201 |
// If this is a backwards branch in the bytecodes, add Safepoint |
|
2202 |
maybe_add_safepoint(target_bci); |
|
2203 |
||
2204 |
// Update method data |
|
2205 |
profile_taken_branch(target_bci); |
|
2206 |
||
2207 |
// Merge the current control into the target basic block |
|
2208 |
merge(target_bci); |
|
2209 |
||
2210 |
// See if we can get some profile data and hand it off to the next block |
|
2211 |
Block *target_block = block()->successor_for_bci(target_bci); |
|
2212 |
if (target_block->pred_count() != 1) break; |
|
2213 |
ciMethodData* methodData = method()->method_data(); |
|
2214 |
if (!methodData->is_mature()) break; |
|
2215 |
ciProfileData* data = methodData->bci_to_data(bci()); |
|
2216 |
assert( data->is_JumpData(), "" ); |
|
2217 |
int taken = ((ciJumpData*)data)->taken(); |
|
2218 |
taken = method()->scale_count(taken); |
|
2219 |
target_block->set_count(taken); |
|
2220 |
break; |
|
2221 |
} |
|
2222 |
||
956
f1aadc829f59
6726504: handle do_ifxxx calls in parser more uniformly
rasbold
parents:
954
diff
changeset
|
2223 |
case Bytecodes::_ifnull: btest = BoolTest::eq; goto handle_if_null; |
f1aadc829f59
6726504: handle do_ifxxx calls in parser more uniformly
rasbold
parents:
954
diff
changeset
|
2224 |
case Bytecodes::_ifnonnull: btest = BoolTest::ne; goto handle_if_null; |
f1aadc829f59
6726504: handle do_ifxxx calls in parser more uniformly
rasbold
parents:
954
diff
changeset
|
2225 |
handle_if_null: |
962
463ad1f3e1eb
6730192: expression stack wrong at deoptimization point
rasbold
parents:
956
diff
changeset
|
2226 |
// If this is a backwards branch in the bytecodes, add Safepoint |
463ad1f3e1eb
6730192: expression stack wrong at deoptimization point
rasbold
parents:
956
diff
changeset
|
2227 |
maybe_add_safepoint(iter().get_dest()); |
956
f1aadc829f59
6726504: handle do_ifxxx calls in parser more uniformly
rasbold
parents:
954
diff
changeset
|
2228 |
a = null(); |
f1aadc829f59
6726504: handle do_ifxxx calls in parser more uniformly
rasbold
parents:
954
diff
changeset
|
2229 |
b = pop(); |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2230 |
c = _gvn.transform( new (C) CmpPNode(b, a) ); |
956
f1aadc829f59
6726504: handle do_ifxxx calls in parser more uniformly
rasbold
parents:
954
diff
changeset
|
2231 |
do_ifnull(btest, c); |
1 | 2232 |
break; |
2233 |
||
2234 |
case Bytecodes::_if_acmpeq: btest = BoolTest::eq; goto handle_if_acmp; |
|
2235 |
case Bytecodes::_if_acmpne: btest = BoolTest::ne; goto handle_if_acmp; |
|
2236 |
handle_if_acmp: |
|
962
463ad1f3e1eb
6730192: expression stack wrong at deoptimization point
rasbold
parents:
956
diff
changeset
|
2237 |
// If this is a backwards branch in the bytecodes, add Safepoint |
463ad1f3e1eb
6730192: expression stack wrong at deoptimization point
rasbold
parents:
956
diff
changeset
|
2238 |
maybe_add_safepoint(iter().get_dest()); |
1 | 2239 |
a = pop(); |
2240 |
b = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2241 |
c = _gvn.transform( new (C) CmpPNode(b, a) ); |
1 | 2242 |
do_if(btest, c); |
2243 |
break; |
|
2244 |
||
2245 |
case Bytecodes::_ifeq: btest = BoolTest::eq; goto handle_ifxx; |
|
2246 |
case Bytecodes::_ifne: btest = BoolTest::ne; goto handle_ifxx; |
|
2247 |
case Bytecodes::_iflt: btest = BoolTest::lt; goto handle_ifxx; |
|
2248 |
case Bytecodes::_ifle: btest = BoolTest::le; goto handle_ifxx; |
|
2249 |
case Bytecodes::_ifgt: btest = BoolTest::gt; goto handle_ifxx; |
|
2250 |
case Bytecodes::_ifge: btest = BoolTest::ge; goto handle_ifxx; |
|
2251 |
handle_ifxx: |
|
962
463ad1f3e1eb
6730192: expression stack wrong at deoptimization point
rasbold
parents:
956
diff
changeset
|
2252 |
// If this is a backwards branch in the bytecodes, add Safepoint |
463ad1f3e1eb
6730192: expression stack wrong at deoptimization point
rasbold
parents:
956
diff
changeset
|
2253 |
maybe_add_safepoint(iter().get_dest()); |
1 | 2254 |
a = _gvn.intcon(0); |
2255 |
b = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2256 |
c = _gvn.transform( new (C) CmpINode(b, a) ); |
1 | 2257 |
do_if(btest, c); |
2258 |
break; |
|
2259 |
||
2260 |
case Bytecodes::_if_icmpeq: btest = BoolTest::eq; goto handle_if_icmp; |
|
2261 |
case Bytecodes::_if_icmpne: btest = BoolTest::ne; goto handle_if_icmp; |
|
2262 |
case Bytecodes::_if_icmplt: btest = BoolTest::lt; goto handle_if_icmp; |
|
2263 |
case Bytecodes::_if_icmple: btest = BoolTest::le; goto handle_if_icmp; |
|
2264 |
case Bytecodes::_if_icmpgt: btest = BoolTest::gt; goto handle_if_icmp; |
|
2265 |
case Bytecodes::_if_icmpge: btest = BoolTest::ge; goto handle_if_icmp; |
|
2266 |
handle_if_icmp: |
|
962
463ad1f3e1eb
6730192: expression stack wrong at deoptimization point
rasbold
parents:
956
diff
changeset
|
2267 |
// If this is a backwards branch in the bytecodes, add Safepoint |
463ad1f3e1eb
6730192: expression stack wrong at deoptimization point
rasbold
parents:
956
diff
changeset
|
2268 |
maybe_add_safepoint(iter().get_dest()); |
1 | 2269 |
a = pop(); |
2270 |
b = pop(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13728
diff
changeset
|
2271 |
c = _gvn.transform( new (C) CmpINode( b, a ) ); |
1 | 2272 |
do_if(btest, c); |
2273 |
break; |
|
2274 |
||
2275 |
case Bytecodes::_tableswitch: |
|
2276 |
do_tableswitch(); |
|
2277 |
break; |
|
2278 |
||
2279 |
case Bytecodes::_lookupswitch: |
|
2280 |
do_lookupswitch(); |
|
2281 |
break; |
|
2282 |
||
2283 |
case Bytecodes::_invokestatic: |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2131
diff
changeset
|
2284 |
case Bytecodes::_invokedynamic: |
1 | 2285 |
case Bytecodes::_invokespecial: |
2286 |
case Bytecodes::_invokevirtual: |
|
2287 |
case Bytecodes::_invokeinterface: |
|
2288 |
do_call(); |
|
2289 |
break; |
|
2290 |
case Bytecodes::_checkcast: |
|
2291 |
do_checkcast(); |
|
2292 |
break; |
|
2293 |
case Bytecodes::_instanceof: |
|
2294 |
do_instanceof(); |
|
2295 |
break; |
|
2296 |
case Bytecodes::_anewarray: |
|
2297 |
do_anewarray(); |
|
2298 |
break; |
|
2299 |
case Bytecodes::_newarray: |
|
2300 |
do_newarray((BasicType)iter().get_index()); |
|
2301 |
break; |
|
2302 |
case Bytecodes::_multianewarray: |
|
2303 |
do_multianewarray(); |
|
2304 |
break; |
|
2305 |
case Bytecodes::_new: |
|
2306 |
do_new(); |
|
2307 |
break; |
|
2308 |
||
2309 |
case Bytecodes::_jsr: |
|
2310 |
case Bytecodes::_jsr_w: |
|
2311 |
do_jsr(); |
|
2312 |
break; |
|
2313 |
||
2314 |
case Bytecodes::_ret: |
|
2315 |
do_ret(); |
|
2316 |
break; |
|
2317 |
||
2318 |
||
2319 |
case Bytecodes::_monitorenter: |
|
2320 |
do_monitor_enter(); |
|
2321 |
break; |
|
2322 |
||
2323 |
case Bytecodes::_monitorexit: |
|
2324 |
do_monitor_exit(); |
|
2325 |
break; |
|
2326 |
||
2327 |
case Bytecodes::_breakpoint: |
|
2328 |
// Breakpoint set concurrently to compile |
|
2329 |
// %%% use an uncommon trap? |
|
2330 |
C->record_failure("breakpoint in method"); |
|
2331 |
return; |
|
2332 |
||
2333 |
default: |
|
2334 |
#ifndef PRODUCT |
|
2335 |
map()->dump(99); |
|
2336 |
#endif |
|
2337 |
tty->print("\nUnhandled bytecode %s\n", Bytecodes::name(bc()) ); |
|
2338 |
ShouldNotReachHere(); |
|
2339 |
} |
|
2340 |
||
2341 |
#ifndef PRODUCT |
|
2342 |
IdealGraphPrinter *printer = IdealGraphPrinter::printer(); |
|
2343 |
if(printer) { |
|
2344 |
char buffer[256]; |
|
2345 |
sprintf(buffer, "Bytecode %d: %s", bci(), Bytecodes::name(bc())); |
|
2346 |
bool old = printer->traverse_outs(); |
|
2347 |
printer->set_traverse_outs(true); |
|
768 | 2348 |
printer->print_method(C, buffer, 4); |
1 | 2349 |
printer->set_traverse_outs(old); |
2350 |
} |
|
2351 |
#endif |
|
2352 |
} |