author | roland |
Mon, 31 Mar 2014 09:08:53 +0200 | |
changeset 23525 | e3eb08ead679 |
parent 22916 | 582da2ed4dfa |
child 23528 | 8f1a7f5e8066 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
22234
da823d78ad65
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
21099
diff
changeset
|
2 |
* Copyright (c) 1998, 2013, 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:
5228
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5228
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:
5228
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "ci/ciCallSite.hpp" |
|
27 |
#include "ci/ciMethodHandle.hpp" |
|
28 |
#include "classfile/vmSymbols.hpp" |
|
8872
36680c58660e
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
7397
diff
changeset
|
29 |
#include "compiler/compileBroker.hpp" |
7397 | 30 |
#include "compiler/compileLog.hpp" |
31 |
#include "interpreter/linkResolver.hpp" |
|
32 |
#include "opto/addnode.hpp" |
|
33 |
#include "opto/callGenerator.hpp" |
|
34 |
#include "opto/cfgnode.hpp" |
|
35 |
#include "opto/mulnode.hpp" |
|
36 |
#include "opto/parse.hpp" |
|
37 |
#include "opto/rootnode.hpp" |
|
38 |
#include "opto/runtime.hpp" |
|
39 |
#include "opto/subnode.hpp" |
|
40 |
#include "prims/nativeLookup.hpp" |
|
41 |
#include "runtime/sharedRuntime.hpp" |
|
1 | 42 |
|
14828
bb9dffedf46c
8005031: Some cleanup in c2 to prepare for incremental inlining support
roland
parents:
14621
diff
changeset
|
43 |
void trace_type_profile(Compile* C, ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) { |
20073 | 44 |
if (TraceTypeProfile || C->print_inlining()) { |
14828
bb9dffedf46c
8005031: Some cleanup in c2 to prepare for incremental inlining support
roland
parents:
14621
diff
changeset
|
45 |
outputStream* out = tty; |
20073 | 46 |
if (!C->print_inlining()) { |
13884 | 47 |
if (NOT_PRODUCT(!PrintOpto &&) !PrintCompilation) { |
8872
36680c58660e
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
7397
diff
changeset
|
48 |
method->print_short_name(); |
36680c58660e
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
7397
diff
changeset
|
49 |
tty->cr(); |
36680c58660e
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
7397
diff
changeset
|
50 |
} |
36680c58660e
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
7397
diff
changeset
|
51 |
CompileTask::print_inlining(prof_method, depth, bci); |
14828
bb9dffedf46c
8005031: Some cleanup in c2 to prepare for incremental inlining support
roland
parents:
14621
diff
changeset
|
52 |
} else { |
bb9dffedf46c
8005031: Some cleanup in c2 to prepare for incremental inlining support
roland
parents:
14621
diff
changeset
|
53 |
out = C->print_inlining_stream(); |
1 | 54 |
} |
14828
bb9dffedf46c
8005031: Some cleanup in c2 to prepare for incremental inlining support
roland
parents:
14621
diff
changeset
|
55 |
CompileTask::print_inline_indent(depth, out); |
bb9dffedf46c
8005031: Some cleanup in c2 to prepare for incremental inlining support
roland
parents:
14621
diff
changeset
|
56 |
out->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count); |
bb9dffedf46c
8005031: Some cleanup in c2 to prepare for incremental inlining support
roland
parents:
14621
diff
changeset
|
57 |
stringStream ss; |
bb9dffedf46c
8005031: Some cleanup in c2 to prepare for incremental inlining support
roland
parents:
14621
diff
changeset
|
58 |
prof_klass->name()->print_symbol_on(&ss); |
bb9dffedf46c
8005031: Some cleanup in c2 to prepare for incremental inlining support
roland
parents:
14621
diff
changeset
|
59 |
out->print(ss.as_string()); |
bb9dffedf46c
8005031: Some cleanup in c2 to prepare for incremental inlining support
roland
parents:
14621
diff
changeset
|
60 |
out->cr(); |
1 | 61 |
} |
62 |
} |
|
63 |
||
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
64 |
CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool call_does_dispatch, |
4586
f1c484fca023
6912063: inlining parameters need to be adjusted for some uses of the JVM
jrose
parents:
4567
diff
changeset
|
65 |
JVMState* jvms, bool allow_inline, |
21099 | 66 |
float prof_factor, ciKlass* speculative_receiver_type, |
67 |
bool allow_intrinsics, bool delayed_forbidden) { |
|
9638
a9e79f5cd83b
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
9633
diff
changeset
|
68 |
ciMethod* caller = jvms->method(); |
a9e79f5cd83b
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
9633
diff
changeset
|
69 |
int bci = jvms->bci(); |
a9e79f5cd83b
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
9633
diff
changeset
|
70 |
Bytecodes::Code bytecode = caller->java_code_at_bci(bci); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
71 |
guarantee(callee != NULL, "failed method resolution"); |
1 | 72 |
|
73 |
// Dtrace currently doesn't work unless all calls are vanilla |
|
2867
69187054225f
6788527: Server vm intermittently fails with assertion "live value must not be garbage" with fastdebug bits
kvn
parents:
2570
diff
changeset
|
74 |
if (env()->dtrace_method_probes()) { |
1 | 75 |
allow_inline = false; |
76 |
} |
|
77 |
||
78 |
// Note: When we get profiling during stage-1 compiles, we want to pull |
|
79 |
// from more specific profile data which pertains to this inlining. |
|
80 |
// Right now, ignore the information in jvms->caller(), and do method[bci]. |
|
9638
a9e79f5cd83b
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
9633
diff
changeset
|
81 |
ciCallProfile profile = caller->call_profile_at_bci(bci); |
1 | 82 |
|
83 |
// See how many times this site has been invoked. |
|
84 |
int site_count = profile.count(); |
|
85 |
int receiver_count = -1; |
|
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
86 |
if (call_does_dispatch && UseTypeProfile && profile.has_receiver(0)) { |
1 | 87 |
// Receivers in the profile structure are ordered by call counts |
88 |
// so that the most called (major) receiver is profile.receiver(0). |
|
89 |
receiver_count = profile.receiver_count(0); |
|
90 |
} |
|
91 |
||
92 |
CompileLog* log = this->log(); |
|
93 |
if (log != NULL) { |
|
94 |
int rid = (receiver_count >= 0)? log->identify(profile.receiver(0)): -1; |
|
4892
e977b527544a
6923002: assert(false,"this call site should not be polymorphic")
kvn
parents:
4754
diff
changeset
|
95 |
int r2id = (rid != -1 && profile.has_receiver(1))? log->identify(profile.receiver(1)):-1; |
1 | 96 |
log->begin_elem("call method='%d' count='%d' prof_factor='%g'", |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
97 |
log->identify(callee), site_count, prof_factor); |
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
98 |
if (call_does_dispatch) log->print(" virtual='1'"); |
1 | 99 |
if (allow_inline) log->print(" inline='1'"); |
100 |
if (receiver_count >= 0) { |
|
101 |
log->print(" receiver='%d' receiver_count='%d'", rid, receiver_count); |
|
102 |
if (profile.has_receiver(1)) { |
|
103 |
log->print(" receiver2='%d' receiver2_count='%d'", r2id, profile.receiver_count(1)); |
|
104 |
} |
|
105 |
} |
|
106 |
log->end_elem(); |
|
107 |
} |
|
108 |
||
109 |
// Special case the handling of certain common, profitable library |
|
110 |
// methods. If these methods are replaced with specialized code, |
|
111 |
// then we return it as the inlined version of the call. |
|
112 |
// We do this before the strict f.p. check below because the |
|
113 |
// intrinsics handle strict f.p. correctly. |
|
20296
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
114 |
CallGenerator* cg_intrinsic = NULL; |
12107
0d67c9f2abf2
6658428: C2 doesn't inline java method if corresponding intrinsic failed to inline.
never
parents:
11193
diff
changeset
|
115 |
if (allow_inline && allow_intrinsics) { |
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
116 |
CallGenerator* cg = find_intrinsic(callee, call_does_dispatch); |
14132 | 117 |
if (cg != NULL) { |
118 |
if (cg->is_predicted()) { |
|
119 |
// Code without intrinsic but, hopefully, inlined. |
|
120 |
CallGenerator* inline_cg = this->call_generator(callee, |
|
21099 | 121 |
vtable_index, call_does_dispatch, jvms, allow_inline, prof_factor, speculative_receiver_type, false); |
14132 | 122 |
if (inline_cg != NULL) { |
123 |
cg = CallGenerator::for_predicted_intrinsic(cg, inline_cg); |
|
124 |
} |
|
125 |
} |
|
20296
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
126 |
|
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
127 |
// If intrinsic does the virtual dispatch, we try to use the type profile |
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
128 |
// first, and hopefully inline it as the regular virtual call below. |
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
129 |
// We will retry the intrinsic if nothing had claimed it afterwards. |
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
130 |
if (cg->does_virtual_dispatch()) { |
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
131 |
cg_intrinsic = cg; |
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
132 |
cg = NULL; |
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
133 |
} else { |
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
134 |
return cg; |
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
135 |
} |
14132 | 136 |
} |
1 | 137 |
} |
138 |
||
10265
4c869854aebd
7071653: JSR 292: call site change notification should be pushed not pulled
twisti
parents:
10007
diff
changeset
|
139 |
// Do method handle calls. |
6749
c3a1c2375584
6987634: JSR 292 assert(start_bci() >= 0 && start_bci() < code_size()) failed: correct osr_bci argument
twisti
parents:
5925
diff
changeset
|
140 |
// NOTE: This must happen before normal inlining logic below since |
c3a1c2375584
6987634: JSR 292 assert(start_bci() >= 0 && start_bci() < code_size()) failed: correct osr_bci argument
twisti
parents:
5925
diff
changeset
|
141 |
// MethodHandle.invoke* are native methods which obviously don't |
c3a1c2375584
6987634: JSR 292 assert(start_bci() >= 0 && start_bci() < code_size()) failed: correct osr_bci argument
twisti
parents:
5925
diff
changeset
|
142 |
// have bytecodes and so normal inlining fails. |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
143 |
if (callee->is_method_handle_intrinsic()) { |
15113 | 144 |
CallGenerator* cg = CallGenerator::for_method_handle_call(jvms, caller, callee, delayed_forbidden); |
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
145 |
assert(cg == NULL || !delayed_forbidden || !cg->is_late_inline() || cg->is_mh_late_inline(), "unexpected CallGenerator"); |
15113 | 146 |
return cg; |
6749
c3a1c2375584
6987634: JSR 292 assert(start_bci() >= 0 && start_bci() < code_size()) failed: correct osr_bci argument
twisti
parents:
5925
diff
changeset
|
147 |
} |
c3a1c2375584
6987634: JSR 292 assert(start_bci() >= 0 && start_bci() < code_size()) failed: correct osr_bci argument
twisti
parents:
5925
diff
changeset
|
148 |
|
1 | 149 |
// Do not inline strict fp into non-strict code, or the reverse |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
150 |
if (caller->is_strict() ^ callee->is_strict()) { |
1 | 151 |
allow_inline = false; |
152 |
} |
|
153 |
||
154 |
// Attempt to inline... |
|
155 |
if (allow_inline) { |
|
156 |
// The profile data is only partly attributable to this caller, |
|
157 |
// scale back the call site information. |
|
158 |
float past_uses = jvms->method()->scale_count(site_count, prof_factor); |
|
159 |
// This is the number of times we expect the call code to be used. |
|
160 |
float expected_uses = past_uses; |
|
161 |
||
162 |
// Try inlining a bytecoded method: |
|
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
163 |
if (!call_does_dispatch) { |
22800 | 164 |
InlineTree* ilt = InlineTree::find_subtree_from_root(this->ilt(), jvms->caller(), jvms->method()); |
1 | 165 |
WarmCallInfo scratch_ci; |
15113 | 166 |
bool should_delay = false; |
167 |
WarmCallInfo* ci = ilt->ok_to_inline(callee, jvms, profile, &scratch_ci, should_delay); |
|
1 | 168 |
assert(ci != &scratch_ci, "do not let this pointer escape"); |
169 |
bool allow_inline = (ci != NULL && !ci->is_cold()); |
|
170 |
bool require_inline = (allow_inline && ci->is_hot()); |
|
171 |
||
172 |
if (allow_inline) { |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
173 |
CallGenerator* cg = CallGenerator::for_inline(callee, expected_uses); |
15113 | 174 |
|
175 |
if (require_inline && cg != NULL) { |
|
4450
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
176 |
// Delay the inlining of this method to give us the |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
177 |
// opportunity to perform some high level optimizations |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
178 |
// first. |
17383 | 179 |
if (should_delay_string_inlining(callee, jvms)) { |
15113 | 180 |
assert(!delayed_forbidden, "strange"); |
181 |
return CallGenerator::for_string_late_inline(callee, cg); |
|
17383 | 182 |
} else if (should_delay_boxing_inlining(callee, jvms)) { |
183 |
assert(!delayed_forbidden, "strange"); |
|
184 |
return CallGenerator::for_boxing_late_inline(callee, cg); |
|
15113 | 185 |
} else if ((should_delay || AlwaysIncrementalInline) && !delayed_forbidden) { |
186 |
return CallGenerator::for_late_inline(callee, cg); |
|
187 |
} |
|
4450
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
188 |
} |
15113 | 189 |
if (cg == NULL || should_delay) { |
1 | 190 |
// Fall through. |
191 |
} else if (require_inline || !InlineWarmCalls) { |
|
192 |
return cg; |
|
193 |
} else { |
|
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
194 |
CallGenerator* cold_cg = call_generator(callee, vtable_index, call_does_dispatch, jvms, false, prof_factor); |
1 | 195 |
return CallGenerator::for_warm_call(ci, cold_cg, cg); |
196 |
} |
|
197 |
} |
|
198 |
} |
|
199 |
||
200 |
// Try using the type profile. |
|
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
201 |
if (call_does_dispatch && site_count > 0 && receiver_count > 0) { |
1 | 202 |
// The major receiver's count >= TypeProfileMajorReceiverPercent of site_count. |
203 |
bool have_major_receiver = (100.*profile.receiver_prob(0) >= (float)TypeProfileMajorReceiverPercent); |
|
204 |
ciMethod* receiver_method = NULL; |
|
21099 | 205 |
|
206 |
int morphism = profile.morphism(); |
|
207 |
if (speculative_receiver_type != NULL) { |
|
208 |
// We have a speculative type, we should be able to resolve |
|
209 |
// the call. We do that before looking at the profiling at |
|
210 |
// this invoke because it may lead to bimorphic inlining which |
|
211 |
// a speculative type should help us avoid. |
|
212 |
receiver_method = callee->resolve_invoke(jvms->method()->holder(), |
|
213 |
speculative_receiver_type); |
|
214 |
if (receiver_method == NULL) { |
|
215 |
speculative_receiver_type = NULL; |
|
216 |
} else { |
|
217 |
morphism = 1; |
|
218 |
} |
|
219 |
} |
|
220 |
if (receiver_method == NULL && |
|
221 |
(have_major_receiver || morphism == 1 || |
|
222 |
(morphism == 2 && UseBimorphicInlining))) { |
|
1 | 223 |
// receiver_method = profile.method(); |
224 |
// Profiles do not suggest methods now. Look it up in the major receiver. |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
225 |
receiver_method = callee->resolve_invoke(jvms->method()->holder(), |
1 | 226 |
profile.receiver(0)); |
227 |
} |
|
228 |
if (receiver_method != NULL) { |
|
229 |
// The single majority receiver sufficiently outweighs the minority. |
|
230 |
CallGenerator* hit_cg = this->call_generator(receiver_method, |
|
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
231 |
vtable_index, !call_does_dispatch, jvms, allow_inline, prof_factor); |
1 | 232 |
if (hit_cg != NULL) { |
233 |
// Look up second receiver. |
|
234 |
CallGenerator* next_hit_cg = NULL; |
|
235 |
ciMethod* next_receiver_method = NULL; |
|
21099 | 236 |
if (morphism == 2 && UseBimorphicInlining) { |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
237 |
next_receiver_method = callee->resolve_invoke(jvms->method()->holder(), |
1 | 238 |
profile.receiver(1)); |
239 |
if (next_receiver_method != NULL) { |
|
240 |
next_hit_cg = this->call_generator(next_receiver_method, |
|
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
241 |
vtable_index, !call_does_dispatch, jvms, |
1 | 242 |
allow_inline, prof_factor); |
243 |
if (next_hit_cg != NULL && !next_hit_cg->is_inline() && |
|
244 |
have_major_receiver && UseOnlyInlinedBimorphic) { |
|
245 |
// Skip if we can't inline second receiver's method |
|
246 |
next_hit_cg = NULL; |
|
247 |
} |
|
248 |
} |
|
249 |
} |
|
250 |
CallGenerator* miss_cg; |
|
21099 | 251 |
Deoptimization::DeoptReason reason = morphism == 2 ? |
23525
e3eb08ead679
8031755: Type speculation should be used to optimize explicit null checks
roland
parents:
22916
diff
changeset
|
252 |
Deoptimization::Reason_bimorphic : Deoptimization::reason_class_check(speculative_receiver_type != NULL); |
21099 | 253 |
if ((morphism == 1 || (morphism == 2 && next_hit_cg != NULL)) && |
4754
8aef16f24e16
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
4586
diff
changeset
|
254 |
!too_many_traps(jvms->method(), jvms->bci(), reason) |
1 | 255 |
) { |
256 |
// Generate uncommon trap for class check failure path |
|
257 |
// in case of monomorphic or bimorphic virtual call site. |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
258 |
miss_cg = CallGenerator::for_uncommon_trap(callee, reason, |
1 | 259 |
Deoptimization::Action_maybe_recompile); |
260 |
} else { |
|
261 |
// Generate virtual call for class check failure path |
|
262 |
// in case of polymorphic virtual call site. |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
263 |
miss_cg = CallGenerator::for_virtual_call(callee, vtable_index); |
1 | 264 |
} |
265 |
if (miss_cg != NULL) { |
|
266 |
if (next_hit_cg != NULL) { |
|
21099 | 267 |
assert(speculative_receiver_type == NULL, "shouldn't end up here if we used speculation"); |
14828
bb9dffedf46c
8005031: Some cleanup in c2 to prepare for incremental inlining support
roland
parents:
14621
diff
changeset
|
268 |
trace_type_profile(C, jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)); |
1 | 269 |
// We don't need to record dependency on a receiver here and below. |
270 |
// Whenever we inline, the dependency is added by Parse::Parse(). |
|
271 |
miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX); |
|
272 |
} |
|
273 |
if (miss_cg != NULL) { |
|
14828
bb9dffedf46c
8005031: Some cleanup in c2 to prepare for incremental inlining support
roland
parents:
14621
diff
changeset
|
274 |
trace_type_profile(C, jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count); |
21099 | 275 |
ciKlass* k = speculative_receiver_type != NULL ? speculative_receiver_type : profile.receiver(0); |
276 |
float hit_prob = speculative_receiver_type != NULL ? 1.0 : profile.receiver_prob(0); |
|
277 |
CallGenerator* cg = CallGenerator::for_predicted_call(k, miss_cg, hit_cg, hit_prob); |
|
1 | 278 |
if (cg != NULL) return cg; |
279 |
} |
|
280 |
} |
|
281 |
} |
|
282 |
} |
|
283 |
} |
|
284 |
} |
|
285 |
||
20296
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
286 |
// Nothing claimed the intrinsic, we go with straight-forward inlining |
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
287 |
// for already discovered intrinsic. |
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
288 |
if (allow_inline && allow_intrinsics && cg_intrinsic != NULL) { |
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
289 |
assert(cg_intrinsic->does_virtual_dispatch(), "sanity"); |
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
290 |
return cg_intrinsic; |
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
291 |
} |
bc70e1c29125
8014447: Object.hashCode intrinsic breaks inline caches
shade
parents:
20073
diff
changeset
|
292 |
|
1 | 293 |
// There was no special inlining tactic, or it bailed out. |
294 |
// Use a more generic tactic, like a simple call. |
|
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
295 |
if (call_does_dispatch) { |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
296 |
return CallGenerator::for_virtual_call(callee, vtable_index); |
1 | 297 |
} else { |
298 |
// Class Hierarchy Analysis or Type Profile reveals a unique target, |
|
299 |
// or it is a static or special call. |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
300 |
return CallGenerator::for_direct_call(callee, should_delay_inlining(callee, jvms)); |
1 | 301 |
} |
302 |
} |
|
303 |
||
4450
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
304 |
// Return true for methods that shouldn't be inlined early so that |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
305 |
// they are easier to analyze and optimize as intrinsics. |
17383 | 306 |
bool Compile::should_delay_string_inlining(ciMethod* call_method, JVMState* jvms) { |
4450
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
307 |
if (has_stringbuilder()) { |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
308 |
|
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
309 |
if ((call_method->holder() == C->env()->StringBuilder_klass() || |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
310 |
call_method->holder() == C->env()->StringBuffer_klass()) && |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
311 |
(jvms->method()->holder() == C->env()->StringBuilder_klass() || |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
312 |
jvms->method()->holder() == C->env()->StringBuffer_klass())) { |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
313 |
// Delay SB calls only when called from non-SB code |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
314 |
return false; |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
315 |
} |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
316 |
|
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
317 |
switch (call_method->intrinsic_id()) { |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
318 |
case vmIntrinsics::_StringBuilder_void: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
319 |
case vmIntrinsics::_StringBuilder_int: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
320 |
case vmIntrinsics::_StringBuilder_String: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
321 |
case vmIntrinsics::_StringBuilder_append_char: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
322 |
case vmIntrinsics::_StringBuilder_append_int: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
323 |
case vmIntrinsics::_StringBuilder_append_String: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
324 |
case vmIntrinsics::_StringBuilder_toString: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
325 |
case vmIntrinsics::_StringBuffer_void: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
326 |
case vmIntrinsics::_StringBuffer_int: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
327 |
case vmIntrinsics::_StringBuffer_String: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
328 |
case vmIntrinsics::_StringBuffer_append_char: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
329 |
case vmIntrinsics::_StringBuffer_append_int: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
330 |
case vmIntrinsics::_StringBuffer_append_String: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
331 |
case vmIntrinsics::_StringBuffer_toString: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
332 |
case vmIntrinsics::_Integer_toString: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
333 |
return true; |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
334 |
|
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
335 |
case vmIntrinsics::_String_String: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
336 |
{ |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
337 |
Node* receiver = jvms->map()->in(jvms->argoff() + 1); |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
338 |
if (receiver->is_Proj() && receiver->in(0)->is_CallStaticJava()) { |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
339 |
CallStaticJavaNode* csj = receiver->in(0)->as_CallStaticJava(); |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
340 |
ciMethod* m = csj->method(); |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
341 |
if (m != NULL && |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
342 |
(m->intrinsic_id() == vmIntrinsics::_StringBuffer_toString || |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
343 |
m->intrinsic_id() == vmIntrinsics::_StringBuilder_toString)) |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
344 |
// Delay String.<init>(new SB()) |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
345 |
return true; |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
346 |
} |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
347 |
return false; |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
348 |
} |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
349 |
|
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
350 |
default: |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
351 |
return false; |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
352 |
} |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
353 |
} |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
354 |
return false; |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
355 |
} |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
3261
diff
changeset
|
356 |
|
17383 | 357 |
bool Compile::should_delay_boxing_inlining(ciMethod* call_method, JVMState* jvms) { |
358 |
if (eliminate_boxing() && call_method->is_boxing_method()) { |
|
359 |
set_has_boxed_value(true); |
|
360 |
return true; |
|
361 |
} |
|
362 |
return false; |
|
363 |
} |
|
1 | 364 |
|
365 |
// uncommon-trap call-sites where callee is unloaded, uninitialized or will not link |
|
366 |
bool Parse::can_not_compile_call_site(ciMethod *dest_method, ciInstanceKlass* klass) { |
|
367 |
// Additional inputs to consider... |
|
368 |
// bc = bc() |
|
369 |
// caller = method() |
|
370 |
// iter().get_method_holder_index() |
|
371 |
assert( dest_method->is_loaded(), "ciTypeFlow should not let us get here" ); |
|
372 |
// Interface classes can be loaded & linked and never get around to |
|
373 |
// being initialized. Uncommon-trap for not-initialized static or |
|
374 |
// v-calls. Let interface calls happen. |
|
4566
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
4564
diff
changeset
|
375 |
ciInstanceKlass* holder_klass = dest_method->holder(); |
5925
a30fef61d0b7
6958668: repeated uncommon trapping for new of klass which is being initialized
never
parents:
5547
diff
changeset
|
376 |
if (!holder_klass->is_being_initialized() && |
a30fef61d0b7
6958668: repeated uncommon trapping for new of klass which is being initialized
never
parents:
5547
diff
changeset
|
377 |
!holder_klass->is_initialized() && |
1 | 378 |
!holder_klass->is_interface()) { |
379 |
uncommon_trap(Deoptimization::Reason_uninitialized, |
|
380 |
Deoptimization::Action_reinterpret, |
|
381 |
holder_klass); |
|
382 |
return true; |
|
383 |
} |
|
384 |
||
14478 | 385 |
assert(dest_method->is_loaded(), "dest_method: typeflow responsibility"); |
1 | 386 |
return false; |
387 |
} |
|
388 |
||
389 |
||
390 |
//------------------------------do_call---------------------------------------- |
|
391 |
// Handle your basic call. Inline if we can & want to, else just setup call. |
|
392 |
void Parse::do_call() { |
|
393 |
// It's likely we are going to add debug info soon. |
|
394 |
// Also, if we inline a guy who eventually needs debug info for this JVMS, |
|
395 |
// our contribution to it is cleaned up right here. |
|
396 |
kill_dead_locals(); |
|
397 |
||
398 |
// Set frequently used booleans |
|
13522
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
399 |
const bool is_virtual = bc() == Bytecodes::_invokevirtual; |
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
400 |
const bool is_virtual_or_interface = is_virtual || bc() == Bytecodes::_invokeinterface; |
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
14478
diff
changeset
|
401 |
const bool has_receiver = Bytecodes::has_receiver(bc()); |
1 | 402 |
|
403 |
// Find target being called |
|
404 |
bool will_link; |
|
13522
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
405 |
ciSignature* declared_signature = NULL; |
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
406 |
ciMethod* orig_callee = iter().get_method(will_link, &declared_signature); // callee in the bytecode |
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
407 |
ciInstanceKlass* holder_klass = orig_callee->holder(); |
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
408 |
ciKlass* holder = iter().get_declared_method_holder(); |
1 | 409 |
ciInstanceKlass* klass = ciEnv::get_instance_klass_for_declared_method_holder(holder); |
13522
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
410 |
assert(declared_signature != NULL, "cannot be null"); |
1 | 411 |
|
412 |
// uncommon-trap when callee is unloaded, uninitialized or will not link |
|
413 |
// bailout when too many arguments for register representation |
|
13522
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
414 |
if (!will_link || can_not_compile_call_site(orig_callee, klass)) { |
1 | 415 |
#ifndef PRODUCT |
416 |
if (PrintOpto && (Verbose || WizardMode)) { |
|
417 |
method()->print_name(); tty->print_cr(" can not compile call at bci %d to:", bci()); |
|
13522
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
418 |
orig_callee->print_name(); tty->cr(); |
1 | 419 |
} |
420 |
#endif |
|
421 |
return; |
|
422 |
} |
|
423 |
assert(holder_klass->is_loaded(), ""); |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
424 |
//assert((bc_callee->is_static() || is_invokedynamic) == !has_receiver , "must match bc"); // XXX invokehandle (cur_bc_raw) |
1 | 425 |
// Note: this takes into account invokeinterface of methods declared in java/lang/Object, |
426 |
// which should be invokevirtuals but according to the VM spec may be invokeinterfaces |
|
427 |
assert(holder_klass->is_interface() || holder_klass->super() == NULL || (bc() != Bytecodes::_invokeinterface), "must match bc"); |
|
428 |
// Note: In the absence of miranda methods, an abstract class K can perform |
|
429 |
// an invokevirtual directly on an interface method I.m if K implements I. |
|
430 |
||
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
14478
diff
changeset
|
431 |
// orig_callee is the resolved callee which's signature includes the |
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
14478
diff
changeset
|
432 |
// appendix argument. |
13522
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
433 |
const int nargs = orig_callee->arg_size(); |
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
434 |
const bool is_signature_polymorphic = MethodHandles::is_signature_polymorphic(orig_callee->intrinsic_id()); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
435 |
|
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
436 |
// Push appendix argument (MethodType, CallSite, etc.), if one. |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
437 |
if (iter().has_appendix()) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
438 |
ciObject* appendix_arg = iter().get_appendix(); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
439 |
const TypeOopPtr* appendix_arg_type = TypeOopPtr::make_from_constant(appendix_arg); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
440 |
Node* appendix_arg_node = _gvn.makecon(appendix_arg_type); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
441 |
push(appendix_arg_node); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
442 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
443 |
|
1 | 444 |
// --------------------- |
445 |
// Does Class Hierarchy Analysis reveal only a single target of a v-call? |
|
446 |
// Then we may inline or make a static call, but become dependent on there being only 1 target. |
|
447 |
// Does the call-site type profile reveal only one receiver? |
|
448 |
// Then we may introduce a run-time check and inline on the path where it succeeds. |
|
449 |
// The other path may uncommon_trap, check for another receiver, or do a v-call. |
|
450 |
||
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
451 |
// Try to get the most accurate receiver type |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
452 |
ciMethod* callee = orig_callee; |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
453 |
int vtable_index = Method::invalid_vtable_index; |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
454 |
bool call_does_dispatch = false; |
1 | 455 |
|
21099 | 456 |
// Speculative type of the receiver if any |
457 |
ciKlass* speculative_receiver_type = NULL; |
|
1 | 458 |
if (is_virtual_or_interface) { |
21099 | 459 |
Node* receiver_node = stack(sp() - nargs); |
1 | 460 |
const TypeOopPtr* receiver_type = _gvn.type(receiver_node)->isa_oopptr(); |
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
461 |
// call_does_dispatch and vtable_index are out-parameters. They might be changed. |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
462 |
callee = C->optimize_virtual_call(method(), bci(), klass, orig_callee, receiver_type, |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
463 |
is_virtual, |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
464 |
call_does_dispatch, vtable_index); // out-parameters |
21099 | 465 |
speculative_receiver_type = receiver_type != NULL ? receiver_type->speculative_type() : NULL; |
1 | 466 |
} |
467 |
||
468 |
// Note: It's OK to try to inline a virtual call. |
|
469 |
// The call generator will not attempt to inline a polymorphic call |
|
470 |
// unless it knows how to optimize the receiver dispatch. |
|
471 |
bool try_inline = (C->do_inlining() || InlineAccessors); |
|
472 |
||
473 |
// --------------------- |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
474 |
dec_sp(nargs); // Temporarily pop args for JVM state of call |
1 | 475 |
JVMState* jvms = sync_jvms(); |
476 |
||
477 |
// --------------------- |
|
478 |
// Decide call tactic. |
|
479 |
// This call checks with CHA, the interpreter profile, intrinsics table, etc. |
|
480 |
// It decides whether inlining is desirable or not. |
|
21099 | 481 |
CallGenerator* cg = C->call_generator(callee, vtable_index, call_does_dispatch, jvms, try_inline, prof_factor(), speculative_receiver_type); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
482 |
|
13522
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
483 |
// NOTE: Don't use orig_callee and callee after this point! Use cg->method() instead. |
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
484 |
orig_callee = callee = NULL; |
1 | 485 |
|
486 |
// --------------------- |
|
487 |
// Round double arguments before call |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
488 |
round_double_arguments(cg->method()); |
1 | 489 |
|
21099 | 490 |
// Feed profiling data for arguments to the type system so it can |
491 |
// propagate it as speculative types |
|
492 |
record_profiled_arguments_for_speculation(cg->method(), bc()); |
|
493 |
||
1 | 494 |
#ifndef PRODUCT |
495 |
// bump global counters for calls |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
496 |
count_compiled_calls(/*at_method_entry*/ false, cg->is_inline()); |
1 | 497 |
|
498 |
// Record first part of parsing work for this call |
|
499 |
parse_histogram()->record_change(); |
|
500 |
#endif // not PRODUCT |
|
501 |
||
502 |
assert(jvms == this->jvms(), "still operating on the right JVMS"); |
|
503 |
assert(jvms_in_sync(), "jvms must carry full info into CG"); |
|
504 |
||
505 |
// save across call, for a subsequent cast_not_null. |
|
506 |
Node* receiver = has_receiver ? argument(0) : NULL; |
|
507 |
||
21099 | 508 |
// The extra CheckCastPP for speculative types mess with PhaseStringOpts |
509 |
if (receiver != NULL && !call_does_dispatch && !cg->is_string_late_inline()) { |
|
510 |
// Feed profiling data for a single receiver to the type system so |
|
511 |
// it can propagate it as a speculative type |
|
512 |
receiver = record_profiled_receiver_for_speculation(receiver); |
|
513 |
} |
|
514 |
||
1 | 515 |
// Bump method data counters (We profile *before* the call is made |
516 |
// because exceptions don't return to the call site.) |
|
517 |
profile_call(receiver); |
|
518 |
||
21089
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20296
diff
changeset
|
519 |
JVMState* new_jvms = cg->generate(jvms, this); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
520 |
if (new_jvms == NULL) { |
1 | 521 |
// When inlining attempt fails (e.g., too many arguments), |
522 |
// it may contaminate the current compile state, making it |
|
523 |
// impossible to pull back and try again. Once we call |
|
524 |
// cg->generate(), we are committed. If it fails, the whole |
|
525 |
// compilation task is compromised. |
|
526 |
if (failing()) return; |
|
12107
0d67c9f2abf2
6658428: C2 doesn't inline java method if corresponding intrinsic failed to inline.
never
parents:
11193
diff
changeset
|
527 |
|
1 | 528 |
// This can happen if a library intrinsic is available, but refuses |
529 |
// the call site, perhaps because it did not match a pattern the |
|
12107
0d67c9f2abf2
6658428: C2 doesn't inline java method if corresponding intrinsic failed to inline.
never
parents:
11193
diff
changeset
|
530 |
// intrinsic was expecting to optimize. Should always be possible to |
0d67c9f2abf2
6658428: C2 doesn't inline java method if corresponding intrinsic failed to inline.
never
parents:
11193
diff
changeset
|
531 |
// get a normal java call that may inline in that case |
21099 | 532 |
cg = C->call_generator(cg->method(), vtable_index, call_does_dispatch, jvms, try_inline, prof_factor(), speculative_receiver_type, /* allow_intrinsics= */ false); |
21089
e1986ff6fe2e
8024069: replace_in_map() should operate on parent maps
roland
parents:
20296
diff
changeset
|
533 |
if ((new_jvms = cg->generate(jvms, this)) == NULL) { |
1 | 534 |
guarantee(failing(), "call failed to generate: calls should work"); |
535 |
return; |
|
536 |
} |
|
537 |
} |
|
538 |
||
539 |
if (cg->is_inline()) { |
|
240 | 540 |
// Accumulate has_loops estimate |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
541 |
C->set_has_loops(C->has_loops() || cg->method()->has_loops()); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
542 |
C->env()->notice_inlined_method(cg->method()); |
1 | 543 |
} |
544 |
||
545 |
// Reset parser state from [new_]jvms, which now carries results of the call. |
|
546 |
// Return value (if any) is already pushed on the stack by the cg. |
|
547 |
add_exception_states_from(new_jvms); |
|
548 |
if (new_jvms->map()->control() == top()) { |
|
549 |
stop_and_kill_map(); |
|
550 |
} else { |
|
551 |
assert(new_jvms->same_calls_as(jvms), "method/bci left unchanged"); |
|
552 |
set_jvms(new_jvms); |
|
553 |
} |
|
554 |
||
555 |
if (!stopped()) { |
|
556 |
// This was some sort of virtual call, which did a null check for us. |
|
557 |
// Now we can assert receiver-not-null, on the normal return path. |
|
558 |
if (receiver != NULL && cg->is_virtual()) { |
|
559 |
Node* cast = cast_not_null(receiver); |
|
560 |
// %%% assert(receiver == cast, "should already have cast the receiver"); |
|
561 |
} |
|
562 |
||
563 |
// Round double result after a call from strict to non-strict code |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
564 |
round_double_result(cg->method()); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
565 |
|
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
566 |
ciType* rtype = cg->method()->return_type(); |
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
567 |
ciType* ctype = declared_signature->return_type(); |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
568 |
|
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
569 |
if (Bytecodes::has_optional_appendix(iter().cur_bc_raw()) || is_signature_polymorphic) { |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
570 |
// Be careful here with return types. |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
571 |
if (ctype != rtype) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
572 |
BasicType rt = rtype->basic_type(); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
573 |
BasicType ct = ctype->basic_type(); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
574 |
if (ct == T_VOID) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
575 |
// It's OK for a method to return a value that is discarded. |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
576 |
// The discarding does not require any special action from the caller. |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
577 |
// The Java code knows this, at VerifyType.isNullConversion. |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
578 |
pop_node(rt); // whatever it was, pop it |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
579 |
} else if (rt == T_INT || is_subword_type(rt)) { |
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
580 |
// Nothing. These cases are handled in lambda form bytecode. |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
581 |
assert(ct == T_INT || is_subword_type(ct), err_msg_res("must match: rt=%s, ct=%s", type2name(rt), type2name(ct))); |
13395
edf37d840190
7188276: JSR 292: assert(ct == T_OBJECT) failed: rt=T_OBJECT, ct=13
twisti
parents:
13393
diff
changeset
|
582 |
} else if (rt == T_OBJECT || rt == T_ARRAY) { |
edf37d840190
7188276: JSR 292: assert(ct == T_OBJECT) failed: rt=T_OBJECT, ct=13
twisti
parents:
13393
diff
changeset
|
583 |
assert(ct == T_OBJECT || ct == T_ARRAY, err_msg_res("rt=%s, ct=%s", type2name(rt), type2name(ct))); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
584 |
if (ctype->is_loaded()) { |
13522
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
585 |
const TypeOopPtr* arg_type = TypeOopPtr::make_from_klass(rtype->as_klass()); |
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
586 |
const Type* sig_type = TypeOopPtr::make_from_klass(ctype->as_klass()); |
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
587 |
if (arg_type != NULL && !arg_type->higher_equal(sig_type)) { |
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
588 |
Node* retnode = pop(); |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13884
diff
changeset
|
589 |
Node* cast_obj = _gvn.transform(new (C) CheckCastPPNode(control(), retnode, sig_type)); |
13522
5ad4627e792a
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
13395
diff
changeset
|
590 |
push(cast_obj); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
591 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
592 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
593 |
} else { |
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
594 |
assert(rt == ct, err_msg_res("unexpected mismatch: rt=%s, ct=%s", type2name(rt), type2name(ct))); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
595 |
// push a zero; it's better than getting an oop/int mismatch |
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
596 |
pop_node(rt); |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
597 |
Node* retnode = zerocon(ct); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
598 |
push_node(ct, retnode); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
599 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
600 |
// Now that the value is well-behaved, continue with the call-site type. |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
601 |
rtype = ctype; |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
602 |
} |
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
603 |
} else { |
15210
eb42543a7050
8006109: test/java/util/AbstractSequentialList/AddAll.java fails: assert(rtype == ctype) failed: mismatched return types
twisti
parents:
15118
diff
changeset
|
604 |
// Symbolic resolution enforces the types to be the same. |
eb42543a7050
8006109: test/java/util/AbstractSequentialList/AddAll.java fails: assert(rtype == ctype) failed: mismatched return types
twisti
parents:
15118
diff
changeset
|
605 |
// NOTE: We must relax the assert for unloaded types because two |
eb42543a7050
8006109: test/java/util/AbstractSequentialList/AddAll.java fails: assert(rtype == ctype) failed: mismatched return types
twisti
parents:
15118
diff
changeset
|
606 |
// different ciType instances of the same unloaded class type |
eb42543a7050
8006109: test/java/util/AbstractSequentialList/AddAll.java fails: assert(rtype == ctype) failed: mismatched return types
twisti
parents:
15118
diff
changeset
|
607 |
// can appear to be "loaded" by different loaders (depending on |
eb42543a7050
8006109: test/java/util/AbstractSequentialList/AddAll.java fails: assert(rtype == ctype) failed: mismatched return types
twisti
parents:
15118
diff
changeset
|
608 |
// the accessing class). |
eb42543a7050
8006109: test/java/util/AbstractSequentialList/AddAll.java fails: assert(rtype == ctype) failed: mismatched return types
twisti
parents:
15118
diff
changeset
|
609 |
assert(!rtype->is_loaded() || !ctype->is_loaded() || rtype == ctype, |
eb42543a7050
8006109: test/java/util/AbstractSequentialList/AddAll.java fails: assert(rtype == ctype) failed: mismatched return types
twisti
parents:
15118
diff
changeset
|
610 |
err_msg_res("mismatched return types: rtype=%s, ctype=%s", rtype->name(), ctype->name())); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
611 |
} |
1 | 612 |
|
613 |
// If the return type of the method is not loaded, assert that the |
|
614 |
// value we got is a null. Otherwise, we need to recompile. |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
615 |
if (!rtype->is_loaded()) { |
1 | 616 |
#ifndef PRODUCT |
617 |
if (PrintOpto && (Verbose || WizardMode)) { |
|
618 |
method()->print_name(); tty->print_cr(" asserting nullness of result at bci: %d", bci()); |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
619 |
cg->method()->print_name(); tty->cr(); |
1 | 620 |
} |
621 |
#endif |
|
622 |
if (C->log() != NULL) { |
|
623 |
C->log()->elem("assert_null reason='return' klass='%d'", |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
12741
diff
changeset
|
624 |
C->log()->identify(rtype)); |
1 | 625 |
} |
626 |
// If there is going to be a trap, put it at the next bytecode: |
|
627 |
set_bci(iter().next_bci()); |
|
14621
fd9265ab0f67
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
14478
diff
changeset
|
628 |
null_assert(peek()); |
1 | 629 |
set_bci(iter().cur_bci()); // put it back |
630 |
} |
|
21099 | 631 |
BasicType ct = ctype->basic_type(); |
632 |
if (ct == T_OBJECT || ct == T_ARRAY) { |
|
23525
e3eb08ead679
8031755: Type speculation should be used to optimize explicit null checks
roland
parents:
22916
diff
changeset
|
633 |
record_profiled_return_for_speculation(); |
21099 | 634 |
} |
1 | 635 |
} |
636 |
||
637 |
// Restart record of parsing work after possible inlining of call |
|
638 |
#ifndef PRODUCT |
|
639 |
parse_histogram()->set_initial_state(bc()); |
|
640 |
#endif |
|
641 |
} |
|
642 |
||
643 |
//---------------------------catch_call_exceptions----------------------------- |
|
644 |
// Put a Catch and CatchProj nodes behind a just-created call. |
|
645 |
// Send their caught exceptions to the proper handler. |
|
646 |
// This may be used after a call to the rethrow VM stub, |
|
647 |
// when it is needed to process unloaded exception classes. |
|
648 |
void Parse::catch_call_exceptions(ciExceptionHandlerStream& handlers) { |
|
649 |
// Exceptions are delivered through this channel: |
|
650 |
Node* i_o = this->i_o(); |
|
651 |
||
652 |
// Add a CatchNode. |
|
653 |
GrowableArray<int>* bcis = new (C->node_arena()) GrowableArray<int>(C->node_arena(), 8, 0, -1); |
|
654 |
GrowableArray<const Type*>* extypes = new (C->node_arena()) GrowableArray<const Type*>(C->node_arena(), 8, 0, NULL); |
|
655 |
GrowableArray<int>* saw_unloaded = new (C->node_arena()) GrowableArray<int>(C->node_arena(), 8, 0, 0); |
|
656 |
||
657 |
for (; !handlers.is_done(); handlers.next()) { |
|
658 |
ciExceptionHandler* h = handlers.handler(); |
|
659 |
int h_bci = h->handler_bci(); |
|
660 |
ciInstanceKlass* h_klass = h->is_catch_all() ? env()->Throwable_klass() : h->catch_klass(); |
|
661 |
// Do not introduce unloaded exception types into the graph: |
|
662 |
if (!h_klass->is_loaded()) { |
|
663 |
if (saw_unloaded->contains(h_bci)) { |
|
664 |
/* We've already seen an unloaded exception with h_bci, |
|
665 |
so don't duplicate. Duplication will cause the CatchNode to be |
|
666 |
unnecessarily large. See 4713716. */ |
|
667 |
continue; |
|
668 |
} else { |
|
669 |
saw_unloaded->append(h_bci); |
|
670 |
} |
|
671 |
} |
|
672 |
const Type* h_extype = TypeOopPtr::make_from_klass(h_klass); |
|
673 |
// (We use make_from_klass because it respects UseUniqueSubclasses.) |
|
674 |
h_extype = h_extype->join(TypeInstPtr::NOTNULL); |
|
675 |
assert(!h_extype->empty(), "sanity"); |
|
676 |
// Note: It's OK if the BCIs repeat themselves. |
|
677 |
bcis->append(h_bci); |
|
678 |
extypes->append(h_extype); |
|
679 |
} |
|
680 |
||
681 |
int len = bcis->length(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13884
diff
changeset
|
682 |
CatchNode *cn = new (C) CatchNode(control(), i_o, len+1); |
1 | 683 |
Node *catch_ = _gvn.transform(cn); |
684 |
||
685 |
// now branch with the exception state to each of the (potential) |
|
686 |
// handlers |
|
687 |
for(int i=0; i < len; i++) { |
|
688 |
// Setup JVM state to enter the handler. |
|
689 |
PreserveJVMState pjvms(this); |
|
690 |
// Locals are just copied from before the call. |
|
691 |
// Get control from the CatchNode. |
|
692 |
int handler_bci = bcis->at(i); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13884
diff
changeset
|
693 |
Node* ctrl = _gvn.transform( new (C) CatchProjNode(catch_, i+1,handler_bci)); |
1 | 694 |
// This handler cannot happen? |
695 |
if (ctrl == top()) continue; |
|
696 |
set_control(ctrl); |
|
697 |
||
698 |
// Create exception oop |
|
699 |
const TypeInstPtr* extype = extypes->at(i)->is_instptr(); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13884
diff
changeset
|
700 |
Node *ex_oop = _gvn.transform(new (C) CreateExNode(extypes->at(i), ctrl, i_o)); |
1 | 701 |
|
702 |
// Handle unloaded exception classes. |
|
703 |
if (saw_unloaded->contains(handler_bci)) { |
|
704 |
// An unloaded exception type is coming here. Do an uncommon trap. |
|
705 |
#ifndef PRODUCT |
|
706 |
// We do not expect the same handler bci to take both cold unloaded |
|
707 |
// and hot loaded exceptions. But, watch for it. |
|
13392
1ef07ae0723d
7187290: nightly failures after JSR 292 lazy method handle update
twisti
parents:
13391
diff
changeset
|
708 |
if ((Verbose || WizardMode) && extype->is_loaded()) { |
1ef07ae0723d
7187290: nightly failures after JSR 292 lazy method handle update
twisti
parents:
13391
diff
changeset
|
709 |
tty->print("Warning: Handler @%d takes mixed loaded/unloaded exceptions in ", bci()); |
1 | 710 |
method()->print_name(); tty->cr(); |
711 |
} else if (PrintOpto && (Verbose || WizardMode)) { |
|
712 |
tty->print("Bailing out on unloaded exception type "); |
|
713 |
extype->klass()->print_name(); |
|
714 |
tty->print(" at bci:%d in ", bci()); |
|
715 |
method()->print_name(); tty->cr(); |
|
716 |
} |
|
717 |
#endif |
|
718 |
// Emit an uncommon trap instead of processing the block. |
|
719 |
set_bci(handler_bci); |
|
720 |
push_ex_oop(ex_oop); |
|
721 |
uncommon_trap(Deoptimization::Reason_unloaded, |
|
722 |
Deoptimization::Action_reinterpret, |
|
723 |
extype->klass(), "!loaded exception"); |
|
724 |
set_bci(iter().cur_bci()); // put it back |
|
725 |
continue; |
|
726 |
} |
|
727 |
||
728 |
// go to the exception handler |
|
729 |
if (handler_bci < 0) { // merge with corresponding rethrow node |
|
730 |
throw_to_exit(make_exception_state(ex_oop)); |
|
731 |
} else { // Else jump to corresponding handle |
|
732 |
push_ex_oop(ex_oop); // Clear stack and push just the oop. |
|
733 |
merge_exception(handler_bci); |
|
734 |
} |
|
735 |
} |
|
736 |
||
737 |
// The first CatchProj is for the normal return. |
|
738 |
// (Note: If this is a call to rethrow_Java, this node goes dead.) |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13884
diff
changeset
|
739 |
set_control(_gvn.transform( new (C) CatchProjNode(catch_, CatchProjNode::fall_through_index, CatchProjNode::no_handler_bci))); |
1 | 740 |
} |
741 |
||
742 |
||
743 |
//----------------------------catch_inline_exceptions-------------------------- |
|
744 |
// Handle all exceptions thrown by an inlined method or individual bytecode. |
|
745 |
// Common case 1: we have no handler, so all exceptions merge right into |
|
746 |
// the rethrow case. |
|
747 |
// Case 2: we have some handlers, with loaded exception klasses that have |
|
748 |
// no subklasses. We do a Deutsch-Shiffman style type-check on the incoming |
|
749 |
// exception oop and branch to the handler directly. |
|
750 |
// Case 3: We have some handlers with subklasses or are not loaded at |
|
751 |
// compile-time. We have to call the runtime to resolve the exception. |
|
752 |
// So we insert a RethrowCall and all the logic that goes with it. |
|
753 |
void Parse::catch_inline_exceptions(SafePointNode* ex_map) { |
|
754 |
// Caller is responsible for saving away the map for normal control flow! |
|
755 |
assert(stopped(), "call set_map(NULL) first"); |
|
756 |
assert(method()->has_exception_handlers(), "don't come here w/o work to do"); |
|
757 |
||
758 |
Node* ex_node = saved_ex_oop(ex_map); |
|
759 |
if (ex_node == top()) { |
|
760 |
// No action needed. |
|
761 |
return; |
|
762 |
} |
|
763 |
const TypeInstPtr* ex_type = _gvn.type(ex_node)->isa_instptr(); |
|
764 |
NOT_PRODUCT(if (ex_type==NULL) tty->print_cr("*** Exception not InstPtr")); |
|
765 |
if (ex_type == NULL) |
|
766 |
ex_type = TypeOopPtr::make_from_klass(env()->Throwable_klass())->is_instptr(); |
|
767 |
||
768 |
// determine potential exception handlers |
|
769 |
ciExceptionHandlerStream handlers(method(), bci(), |
|
770 |
ex_type->klass()->as_instance_klass(), |
|
771 |
ex_type->klass_is_exact()); |
|
772 |
||
773 |
// Start executing from the given throw state. (Keep its stack, for now.) |
|
774 |
// Get the exception oop as known at compile time. |
|
775 |
ex_node = use_exception_state(ex_map); |
|
776 |
||
777 |
// Get the exception oop klass from its header |
|
778 |
Node* ex_klass_node = NULL; |
|
779 |
if (has_ex_handler() && !ex_type->klass_is_exact()) { |
|
780 |
Node* p = basic_plus_adr( ex_node, ex_node, oopDesc::klass_offset_in_bytes()); |
|
590
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
240
diff
changeset
|
781 |
ex_klass_node = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) ); |
1 | 782 |
|
783 |
// Compute the exception klass a little more cleverly. |
|
784 |
// Obvious solution is to simple do a LoadKlass from the 'ex_node'. |
|
785 |
// However, if the ex_node is a PhiNode, I'm going to do a LoadKlass for |
|
786 |
// each arm of the Phi. If I know something clever about the exceptions |
|
787 |
// I'm loading the class from, I can replace the LoadKlass with the |
|
788 |
// klass constant for the exception oop. |
|
789 |
if( ex_node->is_Phi() ) { |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13884
diff
changeset
|
790 |
ex_klass_node = new (C) PhiNode( ex_node->in(0), TypeKlassPtr::OBJECT ); |
1 | 791 |
for( uint i = 1; i < ex_node->req(); i++ ) { |
792 |
Node* p = basic_plus_adr( ex_node->in(i), ex_node->in(i), oopDesc::klass_offset_in_bytes() ); |
|
590
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
240
diff
changeset
|
793 |
Node* k = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) ); |
1 | 794 |
ex_klass_node->init_req( i, k ); |
795 |
} |
|
796 |
_gvn.set_type(ex_klass_node, TypeKlassPtr::OBJECT); |
|
797 |
||
798 |
} |
|
799 |
} |
|
800 |
||
801 |
// Scan the exception table for applicable handlers. |
|
802 |
// If none, we can call rethrow() and be done! |
|
803 |
// If precise (loaded with no subklasses), insert a D.S. style |
|
804 |
// pointer compare to the correct handler and loop back. |
|
805 |
// If imprecise, switch to the Rethrow VM-call style handling. |
|
806 |
||
807 |
int remaining = handlers.count_remaining(); |
|
808 |
||
809 |
// iterate through all entries sequentially |
|
810 |
for (;!handlers.is_done(); handlers.next()) { |
|
811 |
ciExceptionHandler* handler = handlers.handler(); |
|
812 |
||
813 |
if (handler->is_rethrow()) { |
|
814 |
// If we fell off the end of the table without finding an imprecise |
|
815 |
// exception klass (and without finding a generic handler) then we |
|
816 |
// know this exception is not handled in this method. We just rethrow |
|
817 |
// the exception into the caller. |
|
818 |
throw_to_exit(make_exception_state(ex_node)); |
|
819 |
return; |
|
820 |
} |
|
821 |
||
822 |
// exception handler bci range covers throw_bci => investigate further |
|
823 |
int handler_bci = handler->handler_bci(); |
|
824 |
||
825 |
if (remaining == 1) { |
|
826 |
push_ex_oop(ex_node); // Push exception oop for handler |
|
827 |
#ifndef PRODUCT |
|
828 |
if (PrintOpto && WizardMode) { |
|
829 |
tty->print_cr(" Catching every inline exception bci:%d -> handler_bci:%d", bci(), handler_bci); |
|
830 |
} |
|
831 |
#endif |
|
832 |
merge_exception(handler_bci); // jump to handler |
|
833 |
return; // No more handling to be done here! |
|
834 |
} |
|
835 |
||
5228 | 836 |
// Get the handler's klass |
1 | 837 |
ciInstanceKlass* klass = handler->catch_klass(); |
5228 | 838 |
|
839 |
if (!klass->is_loaded()) { // klass is not loaded? |
|
840 |
// fall through into catch_call_exceptions which will emit a |
|
841 |
// handler with an uncommon trap. |
|
842 |
break; |
|
1 | 843 |
} |
844 |
||
845 |
if (klass->is_interface()) // should not happen, but... |
|
846 |
break; // bail out |
|
847 |
||
5228 | 848 |
// Check the type of the exception against the catch type |
1 | 849 |
const TypeKlassPtr *tk = TypeKlassPtr::make(klass); |
850 |
Node* con = _gvn.makecon(tk); |
|
5228 | 851 |
Node* not_subtype_ctrl = gen_subtype_check(ex_klass_node, con); |
852 |
if (!stopped()) { |
|
853 |
PreserveJVMState pjvms(this); |
|
854 |
const TypeInstPtr* tinst = TypeOopPtr::make_from_klass_unique(klass)->cast_to_ptr_type(TypePtr::NotNull)->is_instptr(); |
|
855 |
assert(klass->has_subklass() || tinst->klass_is_exact(), "lost exactness"); |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13884
diff
changeset
|
856 |
Node* ex_oop = _gvn.transform(new (C) CheckCastPPNode(control(), ex_node, tinst)); |
1 | 857 |
push_ex_oop(ex_oop); // Push exception oop for handler |
858 |
#ifndef PRODUCT |
|
859 |
if (PrintOpto && WizardMode) { |
|
860 |
tty->print(" Catching inline exception bci:%d -> handler_bci:%d -- ", bci(), handler_bci); |
|
861 |
klass->print_name(); |
|
862 |
tty->cr(); |
|
863 |
} |
|
864 |
#endif |
|
865 |
merge_exception(handler_bci); |
|
866 |
} |
|
5228 | 867 |
set_control(not_subtype_ctrl); |
1 | 868 |
|
869 |
// Come here if exception does not match handler. |
|
870 |
// Carry on with more handler checks. |
|
871 |
--remaining; |
|
872 |
} |
|
873 |
||
874 |
assert(!stopped(), "you should return if you finish the chain"); |
|
875 |
||
876 |
// Oops, need to call into the VM to resolve the klasses at runtime. |
|
877 |
// Note: This call must not deoptimize, since it is not a real at this bci! |
|
878 |
kill_dead_locals(); |
|
879 |
||
880 |
make_runtime_call(RC_NO_LEAF | RC_MUST_THROW, |
|
881 |
OptoRuntime::rethrow_Type(), |
|
882 |
OptoRuntime::rethrow_stub(), |
|
883 |
NULL, NULL, |
|
884 |
ex_node); |
|
885 |
||
886 |
// Rethrow is a pure call, no side effects, only a result. |
|
887 |
// The result cannot be allocated, so we use I_O |
|
888 |
||
889 |
// Catch exceptions from the rethrow |
|
890 |
catch_call_exceptions(handlers); |
|
891 |
} |
|
892 |
||
893 |
||
894 |
// (Note: Moved add_debug_info into GraphKit::add_safepoint_edges.) |
|
895 |
||
896 |
||
897 |
#ifndef PRODUCT |
|
898 |
void Parse::count_compiled_calls(bool at_method_entry, bool is_inline) { |
|
899 |
if( CountCompiledCalls ) { |
|
900 |
if( at_method_entry ) { |
|
901 |
// bump invocation counter if top method (for statistics) |
|
902 |
if (CountCompiledCalls && depth() == 1) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
903 |
const TypePtr* addr_type = TypeMetadataPtr::make(method()); |
1 | 904 |
Node* adr1 = makecon(addr_type); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13522
diff
changeset
|
905 |
Node* adr2 = basic_plus_adr(adr1, adr1, in_bytes(Method::compiled_invocation_counter_offset())); |
1 | 906 |
increment_counter(adr2); |
907 |
} |
|
908 |
} else if (is_inline) { |
|
909 |
switch (bc()) { |
|
910 |
case Bytecodes::_invokevirtual: increment_counter(SharedRuntime::nof_inlined_calls_addr()); break; |
|
911 |
case Bytecodes::_invokeinterface: increment_counter(SharedRuntime::nof_inlined_interface_calls_addr()); break; |
|
912 |
case Bytecodes::_invokestatic: |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1399
diff
changeset
|
913 |
case Bytecodes::_invokedynamic: |
1 | 914 |
case Bytecodes::_invokespecial: increment_counter(SharedRuntime::nof_inlined_static_calls_addr()); break; |
915 |
default: fatal("unexpected call bytecode"); |
|
916 |
} |
|
917 |
} else { |
|
918 |
switch (bc()) { |
|
919 |
case Bytecodes::_invokevirtual: increment_counter(SharedRuntime::nof_normal_calls_addr()); break; |
|
920 |
case Bytecodes::_invokeinterface: increment_counter(SharedRuntime::nof_interface_calls_addr()); break; |
|
921 |
case Bytecodes::_invokestatic: |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1399
diff
changeset
|
922 |
case Bytecodes::_invokedynamic: |
1 | 923 |
case Bytecodes::_invokespecial: increment_counter(SharedRuntime::nof_static_calls_addr()); break; |
924 |
default: fatal("unexpected call bytecode"); |
|
925 |
} |
|
926 |
} |
|
927 |
} |
|
928 |
} |
|
929 |
#endif //PRODUCT |
|
930 |
||
931 |
||
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
932 |
ciMethod* Compile::optimize_virtual_call(ciMethod* caller, int bci, ciInstanceKlass* klass, |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
933 |
ciMethod* callee, const TypeOopPtr* receiver_type, |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
934 |
bool is_virtual, |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
935 |
bool& call_does_dispatch, int& vtable_index) { |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
936 |
// Set default values for out-parameters. |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
937 |
call_does_dispatch = true; |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
938 |
vtable_index = Method::invalid_vtable_index; |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
939 |
|
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
940 |
// Choose call strategy. |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
941 |
ciMethod* optimized_virtual_method = optimize_inlining(caller, bci, klass, callee, receiver_type); |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
942 |
|
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
943 |
// Have the call been sufficiently improved such that it is no longer a virtual? |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
944 |
if (optimized_virtual_method != NULL) { |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
945 |
callee = optimized_virtual_method; |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
946 |
call_does_dispatch = false; |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
947 |
} else if (!UseInlineCaches && is_virtual && callee->is_loaded()) { |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
948 |
// We can make a vtable call at this site |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
949 |
vtable_index = callee->resolve_vtable_index(caller->holder(), klass); |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
950 |
} |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
951 |
return callee; |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
952 |
} |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
953 |
|
1 | 954 |
// Identify possible target method and inlining style |
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
955 |
ciMethod* Compile::optimize_inlining(ciMethod* caller, int bci, ciInstanceKlass* klass, |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
956 |
ciMethod* callee, const TypeOopPtr* receiver_type) { |
1 | 957 |
// only use for virtual or interface calls |
958 |
||
959 |
// If it is obviously final, do not bother to call find_monomorphic_target, |
|
960 |
// because the class hierarchy checks are not needed, and may fail due to |
|
961 |
// incompletely loaded classes. Since we do our own class loading checks |
|
962 |
// in this module, we may confidently bind to any method. |
|
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
963 |
if (callee->can_be_statically_bound()) { |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
964 |
return callee; |
1 | 965 |
} |
966 |
||
967 |
// Attempt to improve the receiver |
|
968 |
bool actual_receiver_is_exact = false; |
|
969 |
ciInstanceKlass* actual_receiver = klass; |
|
970 |
if (receiver_type != NULL) { |
|
971 |
// Array methods are all inherited from Object, and are monomorphic. |
|
972 |
if (receiver_type->isa_aryptr() && |
|
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
973 |
callee->holder() == env()->Object_klass()) { |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
974 |
return callee; |
1 | 975 |
} |
976 |
||
977 |
// All other interesting cases are instance klasses. |
|
978 |
if (!receiver_type->isa_instptr()) { |
|
979 |
return NULL; |
|
980 |
} |
|
981 |
||
982 |
ciInstanceKlass *ikl = receiver_type->klass()->as_instance_klass(); |
|
983 |
if (ikl->is_loaded() && ikl->is_initialized() && !ikl->is_interface() && |
|
1399
9648dfd4ce09
6384206: Phis which are later unneeded are impairing our ability to inline based on static types
never
parents:
670
diff
changeset
|
984 |
(ikl == actual_receiver || ikl->is_subtype_of(actual_receiver))) { |
1 | 985 |
// ikl is a same or better type than the original actual_receiver, |
986 |
// e.g. static receiver from bytecodes. |
|
987 |
actual_receiver = ikl; |
|
988 |
// Is the actual_receiver exact? |
|
989 |
actual_receiver_is_exact = receiver_type->klass_is_exact(); |
|
990 |
} |
|
991 |
} |
|
992 |
||
993 |
ciInstanceKlass* calling_klass = caller->holder(); |
|
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
994 |
ciMethod* cha_monomorphic_target = callee->find_monomorphic_target(calling_klass, klass, actual_receiver); |
1 | 995 |
if (cha_monomorphic_target != NULL) { |
996 |
assert(!cha_monomorphic_target->is_abstract(), ""); |
|
997 |
// Look at the method-receiver type. Does it add "too much information"? |
|
998 |
ciKlass* mr_klass = cha_monomorphic_target->holder(); |
|
999 |
const Type* mr_type = TypeInstPtr::make(TypePtr::BotPTR, mr_klass); |
|
1000 |
if (receiver_type == NULL || !receiver_type->higher_equal(mr_type)) { |
|
1001 |
// Calling this method would include an implicit cast to its holder. |
|
1002 |
// %%% Not yet implemented. Would throw minor asserts at present. |
|
1003 |
// %%% The most common wins are already gained by +UseUniqueSubclasses. |
|
1004 |
// To fix, put the higher_equal check at the call of this routine, |
|
1005 |
// and add a CheckCastPP to the receiver. |
|
1006 |
if (TraceDependencies) { |
|
1007 |
tty->print_cr("found unique CHA method, but could not cast up"); |
|
1008 |
tty->print(" method = "); |
|
1009 |
cha_monomorphic_target->print(); |
|
1010 |
tty->cr(); |
|
1011 |
} |
|
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
1012 |
if (log() != NULL) { |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
1013 |
log()->elem("missed_CHA_opportunity klass='%d' method='%d'", |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
1014 |
log()->identify(klass), |
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
1015 |
log()->identify(cha_monomorphic_target)); |
1 | 1016 |
} |
1017 |
cha_monomorphic_target = NULL; |
|
1018 |
} |
|
1019 |
} |
|
1020 |
if (cha_monomorphic_target != NULL) { |
|
1021 |
// Hardwiring a virtual. |
|
1022 |
// If we inlined because CHA revealed only a single target method, |
|
1023 |
// then we are dependent on that target method not getting overridden |
|
1024 |
// by dynamic class loading. Be sure to test the "static" receiver |
|
1025 |
// dest_method here, as opposed to the actual receiver, which may |
|
1026 |
// falsely lead us to believe that the receiver is final or private. |
|
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
1027 |
dependencies()->assert_unique_concrete_method(actual_receiver, cha_monomorphic_target); |
1 | 1028 |
return cha_monomorphic_target; |
1029 |
} |
|
1030 |
||
1031 |
// If the type is exact, we can still bind the method w/o a vcall. |
|
1032 |
// (This case comes after CHA so we can see how much extra work it does.) |
|
1033 |
if (actual_receiver_is_exact) { |
|
1034 |
// In case of evolution, there is a dependence on every inlined method, since each |
|
1035 |
// such method can be changed when its class is redefined. |
|
15118
1a1a6d1dfaab
8005418: JSR 292: virtual dispatch bug in 292 impl
twisti
parents:
15113
diff
changeset
|
1036 |
ciMethod* exact_method = callee->resolve_invoke(calling_klass, actual_receiver); |
1 | 1037 |
if (exact_method != NULL) { |
1038 |
#ifndef PRODUCT |
|
1039 |
if (PrintOpto) { |
|
1040 |
tty->print(" Calling method via exact type @%d --- ", bci); |
|
1041 |
exact_method->print_name(); |
|
1042 |
tty->cr(); |
|
1043 |
} |
|
1044 |
#endif |
|
1045 |
return exact_method; |
|
1046 |
} |
|
1047 |
} |
|
1048 |
||
1049 |
return NULL; |
|
1050 |
} |