Mercurial > hg > graal-jvmci-8
annotate src/share/vm/ci/ciMethod.cpp @ 22985:eb8b5cc64669
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
Reviewed-by: jrose, kvn
author | vlivanov |
---|---|
date | Thu, 29 Jan 2015 10:25:59 -0800 |
parents | 6a528388c7da |
children | 99edc344d77c |
rev | line source |
---|---|
0 | 1 /* |
10105
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
8866
diff
changeset
|
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1251
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1251
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1251
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "ci/ciCallProfile.hpp" | |
27 #include "ci/ciExceptionHandler.hpp" | |
28 #include "ci/ciInstanceKlass.hpp" | |
29 #include "ci/ciMethod.hpp" | |
30 #include "ci/ciMethodBlocks.hpp" | |
31 #include "ci/ciMethodData.hpp" | |
32 #include "ci/ciStreams.hpp" | |
33 #include "ci/ciSymbol.hpp" | |
6972
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
34 #include "ci/ciReplay.hpp" |
1972 | 35 #include "ci/ciUtilities.hpp" |
36 #include "classfile/systemDictionary.hpp" | |
37 #include "compiler/abstractCompiler.hpp" | |
38 #include "compiler/compilerOracle.hpp" | |
39 #include "compiler/methodLiveness.hpp" | |
40 #include "interpreter/interpreter.hpp" | |
41 #include "interpreter/linkResolver.hpp" | |
42 #include "interpreter/oopMapCache.hpp" | |
43 #include "memory/allocation.inline.hpp" | |
44 #include "memory/resourceArea.hpp" | |
45 #include "oops/generateOopMap.hpp" | |
46 #include "oops/oop.inline.hpp" | |
47 #include "prims/nativeLookup.hpp" | |
48 #include "runtime/deoptimization.hpp" | |
49 #include "utilities/bitMap.inline.hpp" | |
50 #include "utilities/xmlstream.hpp" | |
51 #ifdef COMPILER2 | |
52 #include "ci/bcEscapeAnalyzer.hpp" | |
53 #include "ci/ciTypeFlow.hpp" | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
54 #include "oops/method.hpp" |
1972 | 55 #endif |
56 #ifdef SHARK | |
57 #include "ci/ciTypeFlow.hpp" | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
58 #include "oops/method.hpp" |
1972 | 59 #endif |
0 | 60 |
61 // ciMethod | |
62 // | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
63 // This class represents a Method* in the HotSpot virtual |
0 | 64 // machine. |
65 | |
66 | |
67 // ------------------------------------------------------------------ | |
68 // ciMethod::ciMethod | |
69 // | |
70 // Loaded method. | |
20670
6a528388c7da
8060147: SIGSEGV in Metadata::mark_on_stack() while marking metadata in ciEnv
vlivanov
parents:
20430
diff
changeset
|
71 ciMethod::ciMethod(methodHandle h_m, ciInstanceKlass* holder) : |
6a528388c7da
8060147: SIGSEGV in Metadata::mark_on_stack() while marking metadata in ciEnv
vlivanov
parents:
20430
diff
changeset
|
72 ciMetadata(h_m()), |
22985
eb8b5cc64669
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
20670
diff
changeset
|
73 _holder(holder), |
eb8b5cc64669
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
20670
diff
changeset
|
74 _has_injected_profile(false) |
20670
6a528388c7da
8060147: SIGSEGV in Metadata::mark_on_stack() while marking metadata in ciEnv
vlivanov
parents:
20430
diff
changeset
|
75 { |
0 | 76 assert(h_m() != NULL, "no null method"); |
77 | |
78 // These fields are always filled in in loaded methods. | |
79 _flags = ciFlags(h_m()->access_flags()); | |
80 | |
81 // Easy to compute, so fill them in now. | |
82 _max_stack = h_m()->max_stack(); | |
83 _max_locals = h_m()->max_locals(); | |
84 _code_size = h_m()->code_size(); | |
85 _intrinsic_id = h_m()->intrinsic_id(); | |
6213
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
4001
diff
changeset
|
86 _handler_count = h_m()->exception_table_length(); |
17980
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
17721
diff
changeset
|
87 _size_of_parameters = h_m()->size_of_parameters(); |
0 | 88 _uses_monitors = h_m()->access_flags().has_monitor_bytecodes(); |
89 _balanced_monitors = !_uses_monitors || h_m()->access_flags().is_monitor_matching(); | |
1783 | 90 _is_c1_compilable = !h_m()->is_not_c1_compilable(); |
91 _is_c2_compilable = !h_m()->is_not_c2_compilable(); | |
0 | 92 // Lazy fields, filled in on demand. Require allocation. |
93 _code = NULL; | |
94 _exception_handlers = NULL; | |
95 _liveness = NULL; | |
96 _method_blocks = NULL; | |
1692 | 97 #if defined(COMPILER2) || defined(SHARK) |
0 | 98 _flow = NULL; |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1579
diff
changeset
|
99 _bcea = NULL; |
1692 | 100 #endif // COMPILER2 || SHARK |
0 | 101 |
780
c96bf21b756f
6788527: Server vm intermittently fails with assertion "live value must not be garbage" with fastdebug bits
kvn
parents:
710
diff
changeset
|
102 ciEnv *env = CURRENT_ENV; |
1783 | 103 if (env->jvmti_can_hotswap_or_post_breakpoint() && can_be_compiled()) { |
0 | 104 // 6328518 check hotswap conditions under the right lock. |
105 MutexLocker locker(Compile_lock); | |
106 if (Dependencies::check_evol_method(h_m()) != NULL) { | |
1783 | 107 _is_c1_compilable = false; |
108 _is_c2_compilable = false; | |
0 | 109 } |
110 } else { | |
111 CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); | |
112 } | |
113 | |
6940
18fb7da42534
8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass
coleenp
parents:
6725
diff
changeset
|
114 if (h_m()->method_holder()->is_linked()) { |
0 | 115 _can_be_statically_bound = h_m()->can_be_statically_bound(); |
116 } else { | |
117 // Have to use a conservative value in this case. | |
118 _can_be_statically_bound = false; | |
119 } | |
120 | |
121 // Adjust the definition of this condition to be more useful: | |
122 // %%% take these conditions into account in vtable generation | |
123 if (!_can_be_statically_bound && h_m()->is_private()) | |
124 _can_be_statically_bound = true; | |
125 if (_can_be_statically_bound && h_m()->is_abstract()) | |
126 _can_be_statically_bound = false; | |
127 | |
128 // generating _signature may allow GC and therefore move m. | |
129 // These fields are always filled in. | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2007
diff
changeset
|
130 _name = env->get_symbol(h_m()->name()); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2007
diff
changeset
|
131 ciSymbol* sig_symbol = env->get_symbol(h_m()->signature()); |
3785
ddd894528dbc
7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents:
2357
diff
changeset
|
132 constantPoolHandle cpool = h_m()->constants(); |
ddd894528dbc
7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents:
2357
diff
changeset
|
133 _signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol); |
0 | 134 _method_data = NULL; |
135 // Take a snapshot of these values, so they will be commensurate with the MDO. | |
1783 | 136 if (ProfileInterpreter || TieredCompilation) { |
0 | 137 int invcnt = h_m()->interpreter_invocation_count(); |
138 // if the value overflowed report it as max int | |
139 _interpreter_invocation_count = invcnt < 0 ? max_jint : invcnt ; | |
140 _interpreter_throwout_count = h_m()->interpreter_throwout_count(); | |
141 } else { | |
142 _interpreter_invocation_count = 0; | |
143 _interpreter_throwout_count = 0; | |
144 } | |
145 if (_interpreter_invocation_count == 0) | |
146 _interpreter_invocation_count = 1; | |
6972
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
147 _instructions_size = -1; |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
148 #ifdef ASSERT |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
149 if (ReplayCompiles) { |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
150 ciReplay::initialize(this); |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
151 } |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
152 #endif |
0 | 153 } |
154 | |
155 | |
156 // ------------------------------------------------------------------ | |
157 // ciMethod::ciMethod | |
158 // | |
159 // Unloaded method. | |
160 ciMethod::ciMethod(ciInstanceKlass* holder, | |
4001
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
161 ciSymbol* name, |
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
162 ciSymbol* signature, |
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
163 ciInstanceKlass* accessor) : |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
164 ciMetadata((Metadata*)NULL), |
4001
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
165 _name( name), |
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
166 _holder( holder), |
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
167 _intrinsic_id( vmIntrinsics::_none), |
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
168 _liveness( NULL), |
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
169 _can_be_statically_bound(false), |
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
170 _method_blocks( NULL), |
22985
eb8b5cc64669
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
20670
diff
changeset
|
171 _method_data( NULL), |
eb8b5cc64669
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
20670
diff
changeset
|
172 _has_injected_profile( false) |
1692 | 173 #if defined(COMPILER2) || defined(SHARK) |
4001
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
174 , |
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
175 _flow( NULL), |
6972
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
176 _bcea( NULL), |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
177 _instructions_size(-1) |
1692 | 178 #endif // COMPILER2 || SHARK |
4001
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
179 { |
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
180 // Usually holder and accessor are the same type but in some cases |
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
181 // the holder has the wrong class loader (e.g. invokedynamic call |
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
182 // sites) so we pass the accessor. |
5eb9169b1a14
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
3897
diff
changeset
|
183 _signature = new (CURRENT_ENV->arena()) ciSignature(accessor, constantPoolHandle(), signature); |
0 | 184 } |
185 | |
186 | |
187 // ------------------------------------------------------------------ | |
188 // ciMethod::load_code | |
189 // | |
190 // Load the bytecodes and exception handler table for this method. | |
191 void ciMethod::load_code() { | |
192 VM_ENTRY_MARK; | |
193 assert(is_loaded(), "only loaded methods have code"); | |
194 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
195 Method* me = get_Method(); |
0 | 196 Arena* arena = CURRENT_THREAD_ENV->arena(); |
197 | |
198 // Load the bytecodes. | |
199 _code = (address)arena->Amalloc(code_size()); | |
200 memcpy(_code, me->code_base(), code_size()); | |
201 | |
202 // Revert any breakpoint bytecodes in ci's copy | |
27
1f530c629c7d
6498878: client compiler crashes on windows when dealing with breakpoint instructions
kvn
parents:
0
diff
changeset
|
203 if (me->number_of_breakpoints() > 0) { |
6940
18fb7da42534
8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass
coleenp
parents:
6725
diff
changeset
|
204 BreakpointInfo* bp = me->method_holder()->breakpoints(); |
0 | 205 for (; bp != NULL; bp = bp->next()) { |
206 if (bp->match(me)) { | |
207 code_at_put(bp->bci(), bp->orig_bytecode()); | |
208 } | |
209 } | |
210 } | |
211 | |
212 // And load the exception table. | |
6213
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
4001
diff
changeset
|
213 ExceptionTable exc_table(me); |
0 | 214 |
215 // Allocate one extra spot in our list of exceptions. This | |
216 // last entry will be used to represent the possibility that | |
217 // an exception escapes the method. See ciExceptionHandlerStream | |
218 // for details. | |
219 _exception_handlers = | |
220 (ciExceptionHandler**)arena->Amalloc(sizeof(ciExceptionHandler*) | |
221 * (_handler_count + 1)); | |
222 if (_handler_count > 0) { | |
223 for (int i=0; i<_handler_count; i++) { | |
224 _exception_handlers[i] = new (arena) ciExceptionHandler( | |
225 holder(), | |
6213
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
4001
diff
changeset
|
226 /* start */ exc_table.start_pc(i), |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
4001
diff
changeset
|
227 /* limit */ exc_table.end_pc(i), |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
4001
diff
changeset
|
228 /* goto pc */ exc_table.handler_pc(i), |
8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
jiangli
parents:
4001
diff
changeset
|
229 /* cp index */ exc_table.catch_type_index(i)); |
0 | 230 } |
231 } | |
232 | |
233 // Put an entry at the end of our list to represent the possibility | |
234 // of exceptional exit. | |
235 _exception_handlers[_handler_count] = | |
236 new (arena) ciExceptionHandler(holder(), 0, code_size(), -1, 0); | |
237 | |
238 if (CIPrintMethodCodes) { | |
239 print_codes(); | |
240 } | |
241 } | |
242 | |
243 | |
244 // ------------------------------------------------------------------ | |
245 // ciMethod::has_linenumber_table | |
246 // | |
247 // length unknown until decompression | |
248 bool ciMethod::has_linenumber_table() const { | |
249 check_is_loaded(); | |
250 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
251 return get_Method()->has_linenumber_table(); |
0 | 252 } |
253 | |
254 | |
255 // ------------------------------------------------------------------ | |
256 // ciMethod::compressed_linenumber_table | |
257 u_char* ciMethod::compressed_linenumber_table() const { | |
258 check_is_loaded(); | |
259 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
260 return get_Method()->compressed_linenumber_table(); |
0 | 261 } |
262 | |
263 | |
264 // ------------------------------------------------------------------ | |
265 // ciMethod::line_number_from_bci | |
266 int ciMethod::line_number_from_bci(int bci) const { | |
267 check_is_loaded(); | |
268 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
269 return get_Method()->line_number_from_bci(bci); |
0 | 270 } |
271 | |
272 | |
273 // ------------------------------------------------------------------ | |
274 // ciMethod::vtable_index | |
275 // | |
276 // Get the position of this method's entry in the vtable, if any. | |
277 int ciMethod::vtable_index() { | |
278 check_is_loaded(); | |
279 assert(holder()->is_linked(), "must be linked"); | |
280 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
281 return get_Method()->vtable_index(); |
0 | 282 } |
283 | |
284 | |
1692 | 285 #ifdef SHARK |
286 // ------------------------------------------------------------------ | |
287 // ciMethod::itable_index | |
288 // | |
289 // Get the position of this method's entry in the itable, if any. | |
290 int ciMethod::itable_index() { | |
291 check_is_loaded(); | |
292 assert(holder()->is_linked(), "must be linked"); | |
293 VM_ENTRY_MARK; | |
12264
b2e698d2276c
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
10278
diff
changeset
|
294 Method* m = get_Method(); |
b2e698d2276c
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
10278
diff
changeset
|
295 if (!m->has_itable_index()) |
b2e698d2276c
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
10278
diff
changeset
|
296 return Method::nonvirtual_vtable_index; |
b2e698d2276c
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
10278
diff
changeset
|
297 return m->itable_index(); |
1692 | 298 } |
299 #endif // SHARK | |
300 | |
301 | |
0 | 302 // ------------------------------------------------------------------ |
303 // ciMethod::native_entry | |
304 // | |
305 // Get the address of this method's native code, if any. | |
306 address ciMethod::native_entry() { | |
307 check_is_loaded(); | |
308 assert(flags().is_native(), "must be native method"); | |
309 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
310 Method* method = get_Method(); |
0 | 311 address entry = method->native_function(); |
312 assert(entry != NULL, "must be valid entry point"); | |
313 return entry; | |
314 } | |
315 | |
316 | |
317 // ------------------------------------------------------------------ | |
318 // ciMethod::interpreter_entry | |
319 // | |
320 // Get the entry point for running this method in the interpreter. | |
321 address ciMethod::interpreter_entry() { | |
322 check_is_loaded(); | |
323 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
324 methodHandle mh(THREAD, get_Method()); |
0 | 325 return Interpreter::entry_for_method(mh); |
326 } | |
327 | |
328 | |
329 // ------------------------------------------------------------------ | |
330 // ciMethod::uses_balanced_monitors | |
331 // | |
332 // Does this method use monitors in a strict stack-disciplined manner? | |
333 bool ciMethod::has_balanced_monitors() { | |
334 check_is_loaded(); | |
335 if (_balanced_monitors) return true; | |
336 | |
337 // Analyze the method to see if monitors are used properly. | |
338 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
339 methodHandle method(THREAD, get_Method()); |
0 | 340 assert(method->has_monitor_bytecodes(), "should have checked this"); |
341 | |
342 // Check to see if a previous compilation computed the | |
343 // monitor-matching analysis. | |
344 if (method->guaranteed_monitor_matching()) { | |
345 _balanced_monitors = true; | |
346 return true; | |
347 } | |
348 | |
349 { | |
350 EXCEPTION_MARK; | |
351 ResourceMark rm(THREAD); | |
352 GeneratePairingInfo gpi(method); | |
353 gpi.compute_map(CATCH); | |
354 if (!gpi.monitor_safe()) { | |
355 return false; | |
356 } | |
357 method->set_guaranteed_monitor_matching(); | |
358 _balanced_monitors = true; | |
359 } | |
360 return true; | |
361 } | |
362 | |
363 | |
364 // ------------------------------------------------------------------ | |
365 // ciMethod::get_flow_analysis | |
366 ciTypeFlow* ciMethod::get_flow_analysis() { | |
1692 | 367 #if defined(COMPILER2) || defined(SHARK) |
0 | 368 if (_flow == NULL) { |
369 ciEnv* env = CURRENT_ENV; | |
370 _flow = new (env->arena()) ciTypeFlow(env, this); | |
371 _flow->do_flow(); | |
372 } | |
373 return _flow; | |
1692 | 374 #else // COMPILER2 || SHARK |
0 | 375 ShouldNotReachHere(); |
376 return NULL; | |
1692 | 377 #endif // COMPILER2 || SHARK |
0 | 378 } |
379 | |
380 | |
381 // ------------------------------------------------------------------ | |
382 // ciMethod::get_osr_flow_analysis | |
383 ciTypeFlow* ciMethod::get_osr_flow_analysis(int osr_bci) { | |
1692 | 384 #if defined(COMPILER2) || defined(SHARK) |
0 | 385 // OSR entry points are always place after a call bytecode of some sort |
386 assert(osr_bci >= 0, "must supply valid OSR entry point"); | |
387 ciEnv* env = CURRENT_ENV; | |
388 ciTypeFlow* flow = new (env->arena()) ciTypeFlow(env, this, osr_bci); | |
389 flow->do_flow(); | |
390 return flow; | |
1692 | 391 #else // COMPILER2 || SHARK |
0 | 392 ShouldNotReachHere(); |
393 return NULL; | |
1692 | 394 #endif // COMPILER2 || SHARK |
0 | 395 } |
396 | |
397 // ------------------------------------------------------------------ | |
991 | 398 // ciMethod::raw_liveness_at_bci |
0 | 399 // |
400 // Which local variables are live at a specific bci? | |
991 | 401 MethodLivenessResult ciMethod::raw_liveness_at_bci(int bci) { |
0 | 402 check_is_loaded(); |
403 if (_liveness == NULL) { | |
404 // Create the liveness analyzer. | |
405 Arena* arena = CURRENT_ENV->arena(); | |
406 _liveness = new (arena) MethodLiveness(arena, this); | |
407 _liveness->compute_liveness(); | |
408 } | |
991 | 409 return _liveness->get_liveness_at(bci); |
410 } | |
411 | |
412 // ------------------------------------------------------------------ | |
413 // ciMethod::liveness_at_bci | |
414 // | |
415 // Which local variables are live at a specific bci? When debugging | |
416 // will return true for all locals in some cases to improve debug | |
417 // information. | |
418 MethodLivenessResult ciMethod::liveness_at_bci(int bci) { | |
419 MethodLivenessResult result = raw_liveness_at_bci(bci); | |
780
c96bf21b756f
6788527: Server vm intermittently fails with assertion "live value must not be garbage" with fastdebug bits
kvn
parents:
710
diff
changeset
|
420 if (CURRENT_ENV->jvmti_can_access_local_variables() || DeoptimizeALot || CompileTheWorld) { |
0 | 421 // Keep all locals live for the user's edification and amusement. |
422 result.at_put_range(0, result.size(), true); | |
423 } | |
424 return result; | |
425 } | |
426 | |
427 // ciMethod::live_local_oops_at_bci | |
428 // | |
429 // find all the live oops in the locals array for a particular bci | |
430 // Compute what the interpreter believes by using the interpreter | |
431 // oopmap generator. This is used as a double check during osr to | |
432 // guard against conservative result from MethodLiveness making us | |
433 // think a dead oop is live. MethodLiveness is conservative in the | |
434 // sense that it may consider locals to be live which cannot be live, | |
435 // like in the case where a local could contain an oop or a primitive | |
436 // along different paths. In that case the local must be dead when | |
437 // those paths merge. Since the interpreter's viewpoint is used when | |
438 // gc'ing an interpreter frame we need to use its viewpoint during | |
439 // OSR when loading the locals. | |
440 | |
441 BitMap ciMethod::live_local_oops_at_bci(int bci) { | |
442 VM_ENTRY_MARK; | |
443 InterpreterOopMap mask; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
444 OopMapCache::compute_one_oop_map(get_Method(), bci, &mask); |
0 | 445 int mask_size = max_locals(); |
446 BitMap result(mask_size); | |
447 result.clear(); | |
448 int i; | |
449 for (i = 0; i < mask_size ; i++ ) { | |
450 if (mask.is_oop(i)) result.set_bit(i); | |
451 } | |
452 return result; | |
453 } | |
454 | |
455 | |
456 #ifdef COMPILER1 | |
457 // ------------------------------------------------------------------ | |
458 // ciMethod::bci_block_start | |
459 // | |
460 // Marks all bcis where a new basic block starts | |
461 const BitMap ciMethod::bci_block_start() { | |
462 check_is_loaded(); | |
463 if (_liveness == NULL) { | |
464 // Create the liveness analyzer. | |
465 Arena* arena = CURRENT_ENV->arena(); | |
466 _liveness = new (arena) MethodLiveness(arena, this); | |
467 _liveness->compute_liveness(); | |
468 } | |
469 | |
470 return _liveness->get_bci_block_start(); | |
471 } | |
472 #endif // COMPILER1 | |
473 | |
474 | |
475 // ------------------------------------------------------------------ | |
476 // ciMethod::call_profile_at_bci | |
477 // | |
478 // Get the ciCallProfile for the invocation of this method. | |
479 // Also reports receiver types for non-call type checks (if TypeProfileCasts). | |
480 ciCallProfile ciMethod::call_profile_at_bci(int bci) { | |
481 ResourceMark rm; | |
482 ciCallProfile result; | |
483 if (method_data() != NULL && method_data()->is_mature()) { | |
484 ciProfileData* data = method_data()->bci_to_data(bci); | |
485 if (data != NULL && data->is_CounterData()) { | |
486 // Every profiled call site has a counter. | |
487 int count = data->as_CounterData()->count(); | |
488 | |
489 if (!data->is_ReceiverTypeData()) { | |
490 result._receiver_count[0] = 0; // that's a definite zero | |
491 } else { // ReceiverTypeData is a subclass of CounterData | |
492 ciReceiverTypeData* call = (ciReceiverTypeData*)data->as_ReceiverTypeData(); | |
493 // In addition, virtual call sites have receiver type information | |
494 int receivers_count_total = 0; | |
495 int morphism = 0; | |
1783 | 496 // Precompute morphism for the possible fixup |
0 | 497 for (uint i = 0; i < call->row_limit(); i++) { |
498 ciKlass* receiver = call->receiver(i); | |
499 if (receiver == NULL) continue; | |
1783 | 500 morphism++; |
501 } | |
502 int epsilon = 0; | |
503 if (TieredCompilation && ProfileInterpreter) { | |
504 // Interpreter and C1 treat final and special invokes differently. | |
505 // C1 will record a type, whereas the interpreter will just | |
506 // increment the count. Detect this case. | |
507 if (morphism == 1 && count > 0) { | |
508 epsilon = count; | |
509 count = 0; | |
510 } | |
511 } | |
512 for (uint i = 0; i < call->row_limit(); i++) { | |
513 ciKlass* receiver = call->receiver(i); | |
514 if (receiver == NULL) continue; | |
515 int rcount = call->receiver_count(i) + epsilon; | |
0 | 516 if (rcount == 0) rcount = 1; // Should be valid value |
517 receivers_count_total += rcount; | |
518 // Add the receiver to result data. | |
519 result.add_receiver(receiver, rcount); | |
520 // If we extend profiling to record methods, | |
521 // we will set result._method also. | |
522 } | |
523 // Determine call site's morphism. | |
1206
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
1152
diff
changeset
|
524 // The call site count is 0 with known morphism (onlt 1 or 2 receivers) |
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
1152
diff
changeset
|
525 // or < 0 in the case of a type check failured for checkcast, aastore, instanceof. |
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
1152
diff
changeset
|
526 // The call site count is > 0 in the case of a polymorphic virtual call. |
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
1152
diff
changeset
|
527 if (morphism > 0 && morphism == result._limit) { |
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
1152
diff
changeset
|
528 // The morphism <= MorphismLimit. |
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
1152
diff
changeset
|
529 if ((morphism < ciCallProfile::MorphismLimit) || |
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
1152
diff
changeset
|
530 (morphism == ciCallProfile::MorphismLimit && count == 0)) { |
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
1152
diff
changeset
|
531 #ifdef ASSERT |
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
1152
diff
changeset
|
532 if (count > 0) { |
1251
576e77447e3c
6923002: assert(false,"this call site should not be polymorphic")
kvn
parents:
1206
diff
changeset
|
533 this->print_short_name(tty); |
576e77447e3c
6923002: assert(false,"this call site should not be polymorphic")
kvn
parents:
1206
diff
changeset
|
534 tty->print_cr(" @ bci:%d", bci); |
1206
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
1152
diff
changeset
|
535 this->print_codes(); |
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
1152
diff
changeset
|
536 assert(false, "this call site should not be polymorphic"); |
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
1152
diff
changeset
|
537 } |
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
1152
diff
changeset
|
538 #endif |
0 | 539 result._morphism = morphism; |
540 } | |
541 } | |
542 // Make the count consistent if this is a call profile. If count is | |
543 // zero or less, presume that this is a typecheck profile and | |
544 // do nothing. Otherwise, increase count to be the sum of all | |
545 // receiver's counts. | |
1206
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
1152
diff
changeset
|
546 if (count >= 0) { |
87684f1a88b5
6614597: Performance variability in jvm2008 xml.validation
kvn
parents:
1152
diff
changeset
|
547 count += receivers_count_total; |
0 | 548 } |
549 } | |
550 result._count = count; | |
551 } | |
552 } | |
553 return result; | |
554 } | |
555 | |
556 // ------------------------------------------------------------------ | |
557 // Add new receiver and sort data by receiver's profile count. | |
558 void ciCallProfile::add_receiver(ciKlass* receiver, int receiver_count) { | |
559 // Add new receiver and sort data by receiver's counts when we have space | |
560 // for it otherwise replace the less called receiver (less called receiver | |
561 // is placed to the last array element which is not used). | |
562 // First array's element contains most called receiver. | |
563 int i = _limit; | |
564 for (; i > 0 && receiver_count > _receiver_count[i-1]; i--) { | |
565 _receiver[i] = _receiver[i-1]; | |
566 _receiver_count[i] = _receiver_count[i-1]; | |
567 } | |
568 _receiver[i] = receiver; | |
569 _receiver_count[i] = receiver_count; | |
570 if (_limit < MorphismLimit) _limit++; | |
571 } | |
572 | |
12966 | 573 |
574 void ciMethod::assert_virtual_call_type_ok(int bci) { | |
575 assert(java_code_at_bci(bci) == Bytecodes::_invokevirtual || | |
576 java_code_at_bci(bci) == Bytecodes::_invokeinterface, err_msg("unexpected bytecode %s", Bytecodes::name(java_code_at_bci(bci)))); | |
577 } | |
578 | |
579 void ciMethod::assert_call_type_ok(int bci) { | |
580 assert(java_code_at_bci(bci) == Bytecodes::_invokestatic || | |
581 java_code_at_bci(bci) == Bytecodes::_invokespecial || | |
582 java_code_at_bci(bci) == Bytecodes::_invokedynamic, err_msg("unexpected bytecode %s", Bytecodes::name(java_code_at_bci(bci)))); | |
583 } | |
584 | |
585 /** | |
586 * Check whether profiling provides a type for the argument i to the | |
587 * call at bci bci | |
588 * | |
589 * @param bci bci of the call | |
590 * @param i argument number | |
591 * @return profiled type | |
592 * | |
593 * If the profile reports that the argument may be null, return false | |
594 * at least for now. | |
595 */ | |
596 ciKlass* ciMethod::argument_profiled_type(int bci, int i) { | |
597 if (MethodData::profile_parameters() && method_data() != NULL && method_data()->is_mature()) { | |
598 ciProfileData* data = method_data()->bci_to_data(bci); | |
599 if (data != NULL) { | |
600 if (data->is_VirtualCallTypeData()) { | |
601 assert_virtual_call_type_ok(bci); | |
602 ciVirtualCallTypeData* call = (ciVirtualCallTypeData*)data->as_VirtualCallTypeData(); | |
603 if (i >= call->number_of_arguments()) { | |
604 return NULL; | |
605 } | |
606 ciKlass* type = call->valid_argument_type(i); | |
607 if (type != NULL && !call->argument_maybe_null(i)) { | |
608 return type; | |
609 } | |
610 } else if (data->is_CallTypeData()) { | |
611 assert_call_type_ok(bci); | |
612 ciCallTypeData* call = (ciCallTypeData*)data->as_CallTypeData(); | |
613 if (i >= call->number_of_arguments()) { | |
614 return NULL; | |
615 } | |
616 ciKlass* type = call->valid_argument_type(i); | |
617 if (type != NULL && !call->argument_maybe_null(i)) { | |
618 return type; | |
619 } | |
620 } | |
621 } | |
622 } | |
623 return NULL; | |
624 } | |
625 | |
626 /** | |
627 * Check whether profiling provides a type for the return value from | |
628 * the call at bci bci | |
629 * | |
630 * @param bci bci of the call | |
631 * @return profiled type | |
632 * | |
633 * If the profile reports that the argument may be null, return false | |
634 * at least for now. | |
635 */ | |
636 ciKlass* ciMethod::return_profiled_type(int bci) { | |
637 if (MethodData::profile_return() && method_data() != NULL && method_data()->is_mature()) { | |
638 ciProfileData* data = method_data()->bci_to_data(bci); | |
639 if (data != NULL) { | |
640 if (data->is_VirtualCallTypeData()) { | |
641 assert_virtual_call_type_ok(bci); | |
642 ciVirtualCallTypeData* call = (ciVirtualCallTypeData*)data->as_VirtualCallTypeData(); | |
643 ciKlass* type = call->valid_return_type(); | |
644 if (type != NULL && !call->return_maybe_null()) { | |
645 return type; | |
646 } | |
647 } else if (data->is_CallTypeData()) { | |
648 assert_call_type_ok(bci); | |
649 ciCallTypeData* call = (ciCallTypeData*)data->as_CallTypeData(); | |
650 ciKlass* type = call->valid_return_type(); | |
651 if (type != NULL && !call->return_maybe_null()) { | |
652 return type; | |
653 } | |
654 } | |
655 } | |
656 } | |
657 return NULL; | |
658 } | |
659 | |
660 /** | |
661 * Check whether profiling provides a type for the parameter i | |
662 * | |
663 * @param i parameter number | |
664 * @return profiled type | |
665 * | |
666 * If the profile reports that the argument may be null, return false | |
667 * at least for now. | |
668 */ | |
669 ciKlass* ciMethod::parameter_profiled_type(int i) { | |
670 if (MethodData::profile_parameters() && method_data() != NULL && method_data()->is_mature()) { | |
671 ciParametersTypeData* parameters = method_data()->parameters_type_data(); | |
672 if (parameters != NULL && i < parameters->number_of_parameters()) { | |
673 ciKlass* type = parameters->valid_parameter_type(i); | |
674 if (type != NULL && !parameters->parameter_maybe_null(i)) { | |
675 return type; | |
676 } | |
677 } | |
678 } | |
679 return NULL; | |
680 } | |
681 | |
682 | |
0 | 683 // ------------------------------------------------------------------ |
684 // ciMethod::find_monomorphic_target | |
685 // | |
686 // Given a certain calling environment, find the monomorphic target | |
687 // for the call. Return NULL if the call is not monomorphic in | |
688 // its calling environment, or if there are only abstract methods. | |
689 // The returned method is never abstract. | |
690 // Note: If caller uses a non-null result, it must inform dependencies | |
691 // via assert_unique_concrete_method or assert_leaf_type. | |
692 ciMethod* ciMethod::find_monomorphic_target(ciInstanceKlass* caller, | |
693 ciInstanceKlass* callee_holder, | |
694 ciInstanceKlass* actual_recv) { | |
695 check_is_loaded(); | |
696 | |
697 if (actual_recv->is_interface()) { | |
698 // %%% We cannot trust interface types, yet. See bug 6312651. | |
699 return NULL; | |
700 } | |
701 | |
702 ciMethod* root_m = resolve_invoke(caller, actual_recv); | |
703 if (root_m == NULL) { | |
704 // Something went wrong looking up the actual receiver method. | |
705 return NULL; | |
706 } | |
707 assert(!root_m->is_abstract(), "resolve_invoke promise"); | |
708 | |
709 // Make certain quick checks even if UseCHA is false. | |
710 | |
711 // Is it private or final? | |
712 if (root_m->can_be_statically_bound()) { | |
713 return root_m; | |
714 } | |
715 | |
716 if (actual_recv->is_leaf_type() && actual_recv == root_m->holder()) { | |
717 // Easy case. There is no other place to put a method, so don't bother | |
718 // to go through the VM_ENTRY_MARK and all the rest. | |
719 return root_m; | |
720 } | |
721 | |
722 // Array methods (clone, hashCode, etc.) are always statically bound. | |
723 // If we were to see an array type here, we'd return root_m. | |
724 // However, this method processes only ciInstanceKlasses. (See 4962591.) | |
725 // The inline_native_clone intrinsic narrows Object to T[] properly, | |
726 // so there is no need to do the same job here. | |
727 | |
728 if (!UseCHA) return NULL; | |
729 | |
730 VM_ENTRY_MARK; | |
731 | |
17521
e46f2ee62e78
8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
12966
diff
changeset
|
732 // Disable CHA for default methods for now |
e46f2ee62e78
8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
12966
diff
changeset
|
733 if (root_m->get_Method()->is_default_method()) { |
e46f2ee62e78
8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
12966
diff
changeset
|
734 return NULL; |
e46f2ee62e78
8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
12966
diff
changeset
|
735 } |
e46f2ee62e78
8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
12966
diff
changeset
|
736 |
0 | 737 methodHandle target; |
738 { | |
739 MutexLocker locker(Compile_lock); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
740 Klass* context = actual_recv->get_Klass(); |
0 | 741 target = Dependencies::find_unique_concrete_method(context, |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
742 root_m->get_Method()); |
0 | 743 // %%% Should upgrade this ciMethod API to look for 1 or 2 concrete methods. |
744 } | |
745 | |
746 #ifndef PRODUCT | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
747 if (TraceDependencies && target() != NULL && target() != root_m->get_Method()) { |
0 | 748 tty->print("found a non-root unique target method"); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
749 tty->print_cr(" context = %s", InstanceKlass::cast(actual_recv->get_Klass())->external_name()); |
0 | 750 tty->print(" method = "); |
751 target->print_short_name(tty); | |
752 tty->cr(); | |
753 } | |
754 #endif //PRODUCT | |
755 | |
756 if (target() == NULL) { | |
757 return NULL; | |
758 } | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
759 if (target() == root_m->get_Method()) { |
0 | 760 return root_m; |
761 } | |
762 if (!root_m->is_public() && | |
763 !root_m->is_protected()) { | |
764 // If we are going to reason about inheritance, it's easiest | |
765 // if the method in question is public, protected, or private. | |
766 // If the answer is not root_m, it is conservatively correct | |
767 // to return NULL, even if the CHA encountered irrelevant | |
768 // methods in other packages. | |
769 // %%% TO DO: Work out logic for package-private methods | |
770 // with the same name but different vtable indexes. | |
771 return NULL; | |
772 } | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
773 return CURRENT_THREAD_ENV->get_method(target()); |
0 | 774 } |
775 | |
776 // ------------------------------------------------------------------ | |
777 // ciMethod::resolve_invoke | |
778 // | |
779 // Given a known receiver klass, find the target for the call. | |
780 // Return NULL if the call has no target or the target is abstract. | |
781 ciMethod* ciMethod::resolve_invoke(ciKlass* caller, ciKlass* exact_receiver) { | |
782 check_is_loaded(); | |
783 VM_ENTRY_MARK; | |
784 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
785 KlassHandle caller_klass (THREAD, caller->get_Klass()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
786 KlassHandle h_recv (THREAD, exact_receiver->get_Klass()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
787 KlassHandle h_resolved (THREAD, holder()->get_Klass()); |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2007
diff
changeset
|
788 Symbol* h_name = name()->get_symbol(); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2007
diff
changeset
|
789 Symbol* h_signature = signature()->get_symbol(); |
0 | 790 |
791 methodHandle m; | |
792 // Only do exact lookup if receiver klass has been linked. Otherwise, | |
793 // the vtable has not been setup, and the LinkResolver will fail. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
794 if (h_recv->oop_is_array() |
0 | 795 || |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
796 InstanceKlass::cast(h_recv())->is_linked() && !exact_receiver->is_interface()) { |
0 | 797 if (holder()->is_interface()) { |
798 m = LinkResolver::resolve_interface_call_or_null(h_recv, h_resolved, h_name, h_signature, caller_klass); | |
799 } else { | |
800 m = LinkResolver::resolve_virtual_call_or_null(h_recv, h_resolved, h_name, h_signature, caller_klass); | |
801 } | |
802 } | |
803 | |
804 if (m.is_null()) { | |
805 // Return NULL only if there was a problem with lookup (uninitialized class, etc.) | |
806 return NULL; | |
807 } | |
808 | |
809 ciMethod* result = this; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
810 if (m() != get_Method()) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
811 result = CURRENT_THREAD_ENV->get_method(m()); |
0 | 812 } |
813 | |
814 // Don't return abstract methods because they aren't | |
815 // optimizable or interesting. | |
816 if (result->is_abstract()) { | |
817 return NULL; | |
818 } else { | |
819 return result; | |
820 } | |
821 } | |
822 | |
823 // ------------------------------------------------------------------ | |
824 // ciMethod::resolve_vtable_index | |
825 // | |
826 // Given a known receiver klass, find the vtable index for the call. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
827 // Return Method::invalid_vtable_index if the vtable_index is unknown. |
0 | 828 int ciMethod::resolve_vtable_index(ciKlass* caller, ciKlass* receiver) { |
829 check_is_loaded(); | |
830 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
831 int vtable_index = Method::invalid_vtable_index; |
0 | 832 // Only do lookup if receiver klass has been linked. Otherwise, |
833 // the vtable has not been setup, and the LinkResolver will fail. | |
834 if (!receiver->is_interface() | |
835 && (!receiver->is_instance_klass() || | |
836 receiver->as_instance_klass()->is_linked())) { | |
837 VM_ENTRY_MARK; | |
838 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
839 KlassHandle caller_klass (THREAD, caller->get_Klass()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
840 KlassHandle h_recv (THREAD, receiver->get_Klass()); |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2007
diff
changeset
|
841 Symbol* h_name = name()->get_symbol(); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
2007
diff
changeset
|
842 Symbol* h_signature = signature()->get_symbol(); |
0 | 843 |
844 vtable_index = LinkResolver::resolve_virtual_vtable_index(h_recv, h_recv, h_name, h_signature, caller_klass); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
845 if (vtable_index == Method::nonvirtual_vtable_index) { |
0 | 846 // A statically bound method. Return "no such index". |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
847 vtable_index = Method::invalid_vtable_index; |
0 | 848 } |
849 } | |
850 | |
851 return vtable_index; | |
852 } | |
853 | |
854 // ------------------------------------------------------------------ | |
855 // ciMethod::interpreter_call_site_count | |
856 int ciMethod::interpreter_call_site_count(int bci) { | |
857 if (method_data() != NULL) { | |
858 ResourceMark rm; | |
859 ciProfileData* data = method_data()->bci_to_data(bci); | |
860 if (data != NULL && data->is_CounterData()) { | |
861 return scale_count(data->as_CounterData()->count()); | |
862 } | |
863 } | |
864 return -1; // unknown | |
865 } | |
866 | |
867 // ------------------------------------------------------------------ | |
7194
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
868 // ciMethod::get_field_at_bci |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
869 ciField* ciMethod::get_field_at_bci(int bci, bool &will_link) { |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
870 ciBytecodeStream iter(this); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
871 iter.reset_to_bci(bci); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
872 iter.next(); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
873 return iter.get_field(will_link); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
874 } |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
875 |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
876 // ------------------------------------------------------------------ |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
877 // ciMethod::get_method_at_bci |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
878 ciMethod* ciMethod::get_method_at_bci(int bci, bool &will_link, ciSignature* *declared_signature) { |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
879 ciBytecodeStream iter(this); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
880 iter.reset_to_bci(bci); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
881 iter.next(); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
882 return iter.get_method(will_link, declared_signature); |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
883 } |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
884 |
beebba0acc11
7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
twisti
parents:
6973
diff
changeset
|
885 // ------------------------------------------------------------------ |
0 | 886 // Adjust a CounterData count to be commensurate with |
887 // interpreter_invocation_count. If the MDO exists for | |
888 // only 25% of the time the method exists, then the | |
889 // counts in the MDO should be scaled by 4X, so that | |
890 // they can be usefully and stably compared against the | |
891 // invocation counts in methods. | |
892 int ciMethod::scale_count(int count, float prof_factor) { | |
893 if (count > 0 && method_data() != NULL) { | |
1783 | 894 int counter_life; |
0 | 895 int method_life = interpreter_invocation_count(); |
1783 | 896 if (TieredCompilation) { |
897 // In tiered the MDO's life is measured directly, so just use the snapshotted counters | |
898 counter_life = MAX2(method_data()->invocation_count(), method_data()->backedge_count()); | |
899 } else { | |
900 int current_mileage = method_data()->current_mileage(); | |
901 int creation_mileage = method_data()->creation_mileage(); | |
902 counter_life = current_mileage - creation_mileage; | |
903 } | |
904 | |
0 | 905 // counter_life due to backedge_counter could be > method_life |
906 if (counter_life > method_life) | |
907 counter_life = method_life; | |
908 if (0 < counter_life && counter_life <= method_life) { | |
909 count = (int)((double)count * prof_factor * method_life / counter_life + 0.5); | |
910 count = (count > 0) ? count : 1; | |
911 } | |
912 } | |
913 return count; | |
914 } | |
915 | |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
7998
diff
changeset
|
916 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
7998
diff
changeset
|
917 // ------------------------------------------------------------------ |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
7998
diff
changeset
|
918 // ciMethod::is_special_get_caller_class_method |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
7998
diff
changeset
|
919 // |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
7998
diff
changeset
|
920 bool ciMethod::is_ignored_by_security_stack_walk() const { |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
7998
diff
changeset
|
921 check_is_loaded(); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
7998
diff
changeset
|
922 VM_ENTRY_MARK; |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
7998
diff
changeset
|
923 return get_Method()->is_ignored_by_security_stack_walk(); |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
7998
diff
changeset
|
924 } |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
7998
diff
changeset
|
925 |
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
7998
diff
changeset
|
926 |
0 | 927 // ------------------------------------------------------------------ |
710 | 928 // invokedynamic support |
1564 | 929 |
930 // ------------------------------------------------------------------ | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
931 // ciMethod::is_method_handle_intrinsic |
710 | 932 // |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
933 // Return true if the method is an instance of the JVM-generated |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
934 // signature-polymorphic MethodHandle methods, _invokeBasic, _linkToVirtual, etc. |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
935 bool ciMethod::is_method_handle_intrinsic() const { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
936 vmIntrinsics::ID iid = _intrinsic_id; // do not check if loaded |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
937 return (MethodHandles::is_signature_polymorphic(iid) && |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
938 MethodHandles::is_signature_polymorphic_intrinsic(iid)); |
710 | 939 } |
940 | |
1564 | 941 // ------------------------------------------------------------------ |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
942 // ciMethod::is_compiled_lambda_form |
1564 | 943 // |
944 // Return true if the method is a generated MethodHandle adapter. | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
945 // These are built by Java code. |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
946 bool ciMethod::is_compiled_lambda_form() const { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
947 vmIntrinsics::ID iid = _intrinsic_id; // do not check if loaded |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
948 return iid == vmIntrinsics::_compiledLambdaForm; |
1152
cd37471eaecc
6914206: change way of permission checking for generated MethodHandle adapters
twisti
parents:
1137
diff
changeset
|
949 } |
cd37471eaecc
6914206: change way of permission checking for generated MethodHandle adapters
twisti
parents:
1137
diff
changeset
|
950 |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
951 // ------------------------------------------------------------------ |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
952 // ciMethod::has_member_arg |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
953 // |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
954 // Return true if the method is a linker intrinsic like _linkToVirtual. |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
955 // These are built by the JVM. |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
956 bool ciMethod::has_member_arg() const { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
957 vmIntrinsics::ID iid = _intrinsic_id; // do not check if loaded |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
958 return (MethodHandles::is_signature_polymorphic(iid) && |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
959 MethodHandles::has_member_arg(iid)); |
710 | 960 } |
961 | |
962 // ------------------------------------------------------------------ | |
2007
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
963 // ciMethod::ensure_method_data |
0 | 964 // |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
965 // Generate new MethodData* objects at compile time. |
2007
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
966 // Return true if allocation was successful or no MDO is required. |
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
967 bool ciMethod::ensure_method_data(methodHandle h_m) { |
0 | 968 EXCEPTION_CONTEXT; |
12868
c775af091fe9
8025566: EXCEPTION_ACCESS_VIOLATION in compiled by C1 String.valueOf method
twisti
parents:
12865
diff
changeset
|
969 if (is_native() || is_abstract() || h_m()->is_accessor()) { |
c775af091fe9
8025566: EXCEPTION_ACCESS_VIOLATION in compiled by C1 String.valueOf method
twisti
parents:
12865
diff
changeset
|
970 return true; |
c775af091fe9
8025566: EXCEPTION_ACCESS_VIOLATION in compiled by C1 String.valueOf method
twisti
parents:
12865
diff
changeset
|
971 } |
0 | 972 if (h_m()->method_data() == NULL) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
973 Method::build_interpreter_method_data(h_m, THREAD); |
0 | 974 if (HAS_PENDING_EXCEPTION) { |
975 CLEAR_PENDING_EXCEPTION; | |
976 } | |
977 } | |
978 if (h_m()->method_data() != NULL) { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
979 _method_data = CURRENT_ENV->get_method_data(h_m()->method_data()); |
0 | 980 _method_data->load_data(); |
2007
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
981 return true; |
0 | 982 } else { |
983 _method_data = CURRENT_ENV->get_empty_methodData(); | |
2007
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
984 return false; |
0 | 985 } |
986 } | |
987 | |
988 // public, retroactive version | |
2007
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
989 bool ciMethod::ensure_method_data() { |
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
990 bool result = true; |
0 | 991 if (_method_data == NULL || _method_data->is_empty()) { |
992 GUARDED_VM_ENTRY({ | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
993 result = ensure_method_data(get_Method()); |
0 | 994 }); |
995 } | |
2007
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
996 return result; |
0 | 997 } |
998 | |
999 | |
1000 // ------------------------------------------------------------------ | |
1001 // ciMethod::method_data | |
1002 // | |
1003 ciMethodData* ciMethod::method_data() { | |
1004 if (_method_data != NULL) { | |
1005 return _method_data; | |
1006 } | |
1007 VM_ENTRY_MARK; | |
1008 ciEnv* env = CURRENT_ENV; | |
1009 Thread* my_thread = JavaThread::current(); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1010 methodHandle h_m(my_thread, get_Method()); |
0 | 1011 |
1012 if (h_m()->method_data() != NULL) { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1013 _method_data = CURRENT_ENV->get_method_data(h_m()->method_data()); |
0 | 1014 _method_data->load_data(); |
1015 } else { | |
1016 _method_data = CURRENT_ENV->get_empty_methodData(); | |
1017 } | |
1018 return _method_data; | |
1019 | |
1020 } | |
1021 | |
2007
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
1022 // ------------------------------------------------------------------ |
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
1023 // ciMethod::method_data_or_null |
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
1024 // Returns a pointer to ciMethodData if MDO exists on the VM side, |
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
1025 // NULL otherwise. |
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
1026 ciMethodData* ciMethod::method_data_or_null() { |
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
1027 ciMethodData *md = method_data(); |
12868
c775af091fe9
8025566: EXCEPTION_ACCESS_VIOLATION in compiled by C1 String.valueOf method
twisti
parents:
12865
diff
changeset
|
1028 if (md->is_empty()) { |
c775af091fe9
8025566: EXCEPTION_ACCESS_VIOLATION in compiled by C1 String.valueOf method
twisti
parents:
12865
diff
changeset
|
1029 return NULL; |
c775af091fe9
8025566: EXCEPTION_ACCESS_VIOLATION in compiled by C1 String.valueOf method
twisti
parents:
12865
diff
changeset
|
1030 } |
2007
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
1031 return md; |
5ddfcf4b079e
7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer
iveresov
parents:
1972
diff
changeset
|
1032 } |
0 | 1033 |
1034 // ------------------------------------------------------------------ | |
10105
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
8866
diff
changeset
|
1035 // ciMethod::ensure_method_counters |
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
8866
diff
changeset
|
1036 // |
12868
c775af091fe9
8025566: EXCEPTION_ACCESS_VIOLATION in compiled by C1 String.valueOf method
twisti
parents:
12865
diff
changeset
|
1037 MethodCounters* ciMethod::ensure_method_counters() { |
10105
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
8866
diff
changeset
|
1038 check_is_loaded(); |
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
8866
diff
changeset
|
1039 VM_ENTRY_MARK; |
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
8866
diff
changeset
|
1040 methodHandle mh(THREAD, get_Method()); |
12868
c775af091fe9
8025566: EXCEPTION_ACCESS_VIOLATION in compiled by C1 String.valueOf method
twisti
parents:
12865
diff
changeset
|
1041 MethodCounters* method_counters = mh->get_method_counters(CHECK_NULL); |
c775af091fe9
8025566: EXCEPTION_ACCESS_VIOLATION in compiled by C1 String.valueOf method
twisti
parents:
12865
diff
changeset
|
1042 return method_counters; |
10105
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
8866
diff
changeset
|
1043 } |
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
8866
diff
changeset
|
1044 |
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
8866
diff
changeset
|
1045 // ------------------------------------------------------------------ |
0 | 1046 // ciMethod::should_exclude |
1047 // | |
1048 // Should this method be excluded from compilation? | |
1049 bool ciMethod::should_exclude() { | |
1050 check_is_loaded(); | |
1051 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1052 methodHandle mh(THREAD, get_Method()); |
0 | 1053 bool ignore; |
1054 return CompilerOracle::should_exclude(mh, ignore); | |
1055 } | |
1056 | |
1057 // ------------------------------------------------------------------ | |
1058 // ciMethod::should_inline | |
1059 // | |
1060 // Should this method be inlined during compilation? | |
1061 bool ciMethod::should_inline() { | |
1062 check_is_loaded(); | |
1063 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1064 methodHandle mh(THREAD, get_Method()); |
0 | 1065 return CompilerOracle::should_inline(mh); |
1066 } | |
1067 | |
1068 // ------------------------------------------------------------------ | |
1069 // ciMethod::should_not_inline | |
1070 // | |
1071 // Should this method be disallowed from inlining during compilation? | |
1072 bool ciMethod::should_not_inline() { | |
1073 check_is_loaded(); | |
1074 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1075 methodHandle mh(THREAD, get_Method()); |
0 | 1076 return CompilerOracle::should_not_inline(mh); |
1077 } | |
1078 | |
1079 // ------------------------------------------------------------------ | |
1080 // ciMethod::should_print_assembly | |
1081 // | |
1082 // Should the compiler print the generated code for this method? | |
1083 bool ciMethod::should_print_assembly() { | |
1084 check_is_loaded(); | |
1085 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1086 methodHandle mh(THREAD, get_Method()); |
0 | 1087 return CompilerOracle::should_print(mh); |
1088 } | |
1089 | |
1090 // ------------------------------------------------------------------ | |
1091 // ciMethod::break_at_execute | |
1092 // | |
1093 // Should the compiler insert a breakpoint into the generated code | |
1094 // method? | |
1095 bool ciMethod::break_at_execute() { | |
1096 check_is_loaded(); | |
1097 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1098 methodHandle mh(THREAD, get_Method()); |
0 | 1099 return CompilerOracle::should_break_at(mh); |
1100 } | |
1101 | |
1102 // ------------------------------------------------------------------ | |
1103 // ciMethod::has_option | |
1104 // | |
1105 bool ciMethod::has_option(const char* option) { | |
1106 check_is_loaded(); | |
1107 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1108 methodHandle mh(THREAD, get_Method()); |
0 | 1109 return CompilerOracle::has_option_string(mh, option); |
1110 } | |
1111 | |
1112 // ------------------------------------------------------------------ | |
20430 | 1113 // ciMethod::has_option_value |
1114 // | |
1115 template<typename T> | |
1116 bool ciMethod::has_option_value(const char* option, T& value) { | |
1117 check_is_loaded(); | |
1118 VM_ENTRY_MARK; | |
1119 methodHandle mh(THREAD, get_Method()); | |
1120 return CompilerOracle::has_option_value(mh, option, value); | |
1121 } | |
1122 // Explicit instantiation for all OptionTypes supported. | |
1123 template bool ciMethod::has_option_value<intx>(const char* option, intx& value); | |
1124 template bool ciMethod::has_option_value<uintx>(const char* option, uintx& value); | |
1125 template bool ciMethod::has_option_value<bool>(const char* option, bool& value); | |
1126 template bool ciMethod::has_option_value<ccstr>(const char* option, ccstr& value); | |
1127 | |
1128 // ------------------------------------------------------------------ | |
0 | 1129 // ciMethod::can_be_compiled |
1130 // | |
1131 // Have previous compilations of this method succeeded? | |
1132 bool ciMethod::can_be_compiled() { | |
1133 check_is_loaded(); | |
1783 | 1134 ciEnv* env = CURRENT_ENV; |
1135 if (is_c1_compile(env->comp_level())) { | |
1136 return _is_c1_compilable; | |
1137 } | |
1138 return _is_c2_compilable; | |
0 | 1139 } |
1140 | |
1141 // ------------------------------------------------------------------ | |
1142 // ciMethod::set_not_compilable | |
1143 // | |
1144 // Tell the VM that this method cannot be compiled at all. | |
7998 | 1145 void ciMethod::set_not_compilable(const char* reason) { |
0 | 1146 check_is_loaded(); |
1147 VM_ENTRY_MARK; | |
1783 | 1148 ciEnv* env = CURRENT_ENV; |
1149 if (is_c1_compile(env->comp_level())) { | |
1150 _is_c1_compilable = false; | |
1151 } else { | |
1152 _is_c2_compilable = false; | |
1153 } | |
7998 | 1154 get_Method()->set_not_compilable(env->comp_level(), true, reason); |
0 | 1155 } |
1156 | |
1157 // ------------------------------------------------------------------ | |
1158 // ciMethod::can_be_osr_compiled | |
1159 // | |
1160 // Have previous compilations of this method succeeded? | |
1161 // | |
1162 // Implementation note: the VM does not currently keep track | |
1163 // of failed OSR compilations per bci. The entry_bci parameter | |
1164 // is currently unused. | |
1165 bool ciMethod::can_be_osr_compiled(int entry_bci) { | |
1166 check_is_loaded(); | |
1167 VM_ENTRY_MARK; | |
1783 | 1168 ciEnv* env = CURRENT_ENV; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1169 return !get_Method()->is_not_osr_compilable(env->comp_level()); |
0 | 1170 } |
1171 | |
1172 // ------------------------------------------------------------------ | |
1173 // ciMethod::has_compiled_code | |
1174 bool ciMethod::has_compiled_code() { | |
6972
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1175 return instructions_size() > 0; |
0 | 1176 } |
1177 | |
1783 | 1178 int ciMethod::comp_level() { |
1179 check_is_loaded(); | |
1180 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1181 nmethod* nm = get_Method()->code(); |
1783 | 1182 if (nm != NULL) return nm->comp_level(); |
1183 return 0; | |
1184 } | |
1185 | |
3791
2c359f27615c
7057120: Tiered: Allow C1 to inline methods with loops
iveresov
parents:
3785
diff
changeset
|
1186 int ciMethod::highest_osr_comp_level() { |
2c359f27615c
7057120: Tiered: Allow C1 to inline methods with loops
iveresov
parents:
3785
diff
changeset
|
1187 check_is_loaded(); |
2c359f27615c
7057120: Tiered: Allow C1 to inline methods with loops
iveresov
parents:
3785
diff
changeset
|
1188 VM_ENTRY_MARK; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1189 return get_Method()->highest_osr_comp_level(); |
3791
2c359f27615c
7057120: Tiered: Allow C1 to inline methods with loops
iveresov
parents:
3785
diff
changeset
|
1190 } |
2c359f27615c
7057120: Tiered: Allow C1 to inline methods with loops
iveresov
parents:
3785
diff
changeset
|
1191 |
0 | 1192 // ------------------------------------------------------------------ |
3897
de847cac9235
7078382: JSR 292: don't count method handle adapters against inlining budgets
twisti
parents:
3791
diff
changeset
|
1193 // ciMethod::code_size_for_inlining |
de847cac9235
7078382: JSR 292: don't count method handle adapters against inlining budgets
twisti
parents:
3791
diff
changeset
|
1194 // |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
1195 // Code size for inlining decisions. This method returns a code |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
1196 // size of 1 for methods which has the ForceInline annotation. |
3897
de847cac9235
7078382: JSR 292: don't count method handle adapters against inlining budgets
twisti
parents:
3791
diff
changeset
|
1197 int ciMethod::code_size_for_inlining() { |
de847cac9235
7078382: JSR 292: don't count method handle adapters against inlining budgets
twisti
parents:
3791
diff
changeset
|
1198 check_is_loaded(); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1199 if (get_Method()->force_inline()) { |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
1200 return 1; |
3897
de847cac9235
7078382: JSR 292: don't count method handle adapters against inlining budgets
twisti
parents:
3791
diff
changeset
|
1201 } |
de847cac9235
7078382: JSR 292: don't count method handle adapters against inlining budgets
twisti
parents:
3791
diff
changeset
|
1202 return code_size(); |
de847cac9235
7078382: JSR 292: don't count method handle adapters against inlining budgets
twisti
parents:
3791
diff
changeset
|
1203 } |
de847cac9235
7078382: JSR 292: don't count method handle adapters against inlining budgets
twisti
parents:
3791
diff
changeset
|
1204 |
de847cac9235
7078382: JSR 292: don't count method handle adapters against inlining budgets
twisti
parents:
3791
diff
changeset
|
1205 // ------------------------------------------------------------------ |
0 | 1206 // ciMethod::instructions_size |
1748 | 1207 // |
1208 // This is a rough metric for "fat" methods, compared before inlining | |
1209 // with InlineSmallCode. The CodeBlob::code_size accessor includes | |
1210 // junk like exception handler, stubs, and constant table, which are | |
1211 // not highly relevant to an inlined method. So we use the more | |
1212 // specific accessor nmethod::insts_size. | |
6972
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1213 int ciMethod::instructions_size() { |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1214 if (_instructions_size == -1) { |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1215 GUARDED_VM_ENTRY( |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1216 nmethod* code = get_Method()->code(); |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1217 if (code != NULL && (code->comp_level() == CompLevel_full_optimization)) { |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1218 _instructions_size = code->insts_end() - code->verified_entry_point(); |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1219 } else { |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1220 _instructions_size = 0; |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1221 } |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1222 ); |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1223 } |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1224 return _instructions_size; |
0 | 1225 } |
1226 | |
1227 // ------------------------------------------------------------------ | |
1228 // ciMethod::log_nmethod_identity | |
1229 void ciMethod::log_nmethod_identity(xmlStream* log) { | |
1230 GUARDED_VM_ENTRY( | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1231 nmethod* code = get_Method()->code(); |
0 | 1232 if (code != NULL) { |
1233 code->log_identity(log); | |
1234 } | |
1235 ) | |
1236 } | |
1237 | |
1238 // ------------------------------------------------------------------ | |
1239 // ciMethod::is_not_reached | |
1240 bool ciMethod::is_not_reached(int bci) { | |
1241 check_is_loaded(); | |
1242 VM_ENTRY_MARK; | |
1243 return Interpreter::is_not_reached( | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1244 methodHandle(THREAD, get_Method()), bci); |
0 | 1245 } |
1246 | |
1247 // ------------------------------------------------------------------ | |
1248 // ciMethod::was_never_executed | |
1249 bool ciMethod::was_executed_more_than(int times) { | |
1250 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1251 return get_Method()->was_executed_more_than(times); |
0 | 1252 } |
1253 | |
1254 // ------------------------------------------------------------------ | |
1255 // ciMethod::has_unloaded_classes_in_signature | |
1256 bool ciMethod::has_unloaded_classes_in_signature() { | |
1257 VM_ENTRY_MARK; | |
1258 { | |
1259 EXCEPTION_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1260 methodHandle m(THREAD, get_Method()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1261 bool has_unloaded = Method::has_unloaded_classes_in_signature(m, (JavaThread *)THREAD); |
0 | 1262 if( HAS_PENDING_EXCEPTION ) { |
1263 CLEAR_PENDING_EXCEPTION; | |
1264 return true; // Declare that we may have unloaded classes | |
1265 } | |
1266 return has_unloaded; | |
1267 } | |
1268 } | |
1269 | |
1270 // ------------------------------------------------------------------ | |
1271 // ciMethod::is_klass_loaded | |
1272 bool ciMethod::is_klass_loaded(int refinfo_index, bool must_be_resolved) const { | |
1273 VM_ENTRY_MARK; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1274 return get_Method()->is_klass_loaded(refinfo_index, must_be_resolved); |
0 | 1275 } |
1276 | |
1277 // ------------------------------------------------------------------ | |
1278 // ciMethod::check_call | |
1279 bool ciMethod::check_call(int refinfo_index, bool is_static) const { | |
12264
b2e698d2276c
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
10278
diff
changeset
|
1280 // This method is used only in C2 from InlineTree::ok_to_inline, |
b2e698d2276c
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
10278
diff
changeset
|
1281 // and is only used under -Xcomp or -XX:CompileTheWorld. |
b2e698d2276c
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
10278
diff
changeset
|
1282 // It appears to fail when applied to an invokeinterface call site. |
b2e698d2276c
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
10278
diff
changeset
|
1283 // FIXME: Remove this method and resolve_method_statically; refactor to use the other LinkResolver entry points. |
0 | 1284 VM_ENTRY_MARK; |
1285 { | |
1286 EXCEPTION_MARK; | |
1287 HandleMark hm(THREAD); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1288 constantPoolHandle pool (THREAD, get_Method()->constants()); |
0 | 1289 methodHandle spec_method; |
1290 KlassHandle spec_klass; | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
1291 Bytecodes::Code code = (is_static ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
1292 LinkResolver::resolve_method_statically(spec_method, spec_klass, code, pool, refinfo_index, THREAD); |
0 | 1293 if (HAS_PENDING_EXCEPTION) { |
1294 CLEAR_PENDING_EXCEPTION; | |
1295 return false; | |
1296 } else { | |
1297 return (spec_method->is_static() == is_static); | |
1298 } | |
1299 } | |
1300 return false; | |
1301 } | |
1302 | |
1303 // ------------------------------------------------------------------ | |
1304 // ciMethod::print_codes | |
1305 // | |
1306 // Print the bytecodes for this method. | |
1307 void ciMethod::print_codes_on(outputStream* st) { | |
1308 check_is_loaded(); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1309 GUARDED_VM_ENTRY(get_Method()->print_codes_on(st);) |
0 | 1310 } |
1311 | |
1312 | |
1313 #define FETCH_FLAG_FROM_VM(flag_accessor) { \ | |
1314 check_is_loaded(); \ | |
1315 VM_ENTRY_MARK; \ | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1316 return get_Method()->flag_accessor(); \ |
0 | 1317 } |
1318 | |
1319 bool ciMethod::is_empty_method() const { FETCH_FLAG_FROM_VM(is_empty_method); } | |
1320 bool ciMethod::is_vanilla_constructor() const { FETCH_FLAG_FROM_VM(is_vanilla_constructor); } | |
1321 bool ciMethod::has_loops () const { FETCH_FLAG_FROM_VM(has_loops); } | |
1322 bool ciMethod::has_jsrs () const { FETCH_FLAG_FROM_VM(has_jsrs); } | |
1323 bool ciMethod::is_accessor () const { FETCH_FLAG_FROM_VM(is_accessor); } | |
1324 bool ciMethod::is_initializer () const { FETCH_FLAG_FROM_VM(is_initializer); } | |
1325 | |
10278 | 1326 bool ciMethod::is_boxing_method() const { |
1327 if (holder()->is_box_klass()) { | |
1328 switch (intrinsic_id()) { | |
1329 case vmIntrinsics::_Boolean_valueOf: | |
1330 case vmIntrinsics::_Byte_valueOf: | |
1331 case vmIntrinsics::_Character_valueOf: | |
1332 case vmIntrinsics::_Short_valueOf: | |
1333 case vmIntrinsics::_Integer_valueOf: | |
1334 case vmIntrinsics::_Long_valueOf: | |
1335 case vmIntrinsics::_Float_valueOf: | |
1336 case vmIntrinsics::_Double_valueOf: | |
1337 return true; | |
1338 default: | |
1339 return false; | |
1340 } | |
1341 } | |
1342 return false; | |
1343 } | |
1344 | |
1345 bool ciMethod::is_unboxing_method() const { | |
1346 if (holder()->is_box_klass()) { | |
1347 switch (intrinsic_id()) { | |
1348 case vmIntrinsics::_booleanValue: | |
1349 case vmIntrinsics::_byteValue: | |
1350 case vmIntrinsics::_charValue: | |
1351 case vmIntrinsics::_shortValue: | |
1352 case vmIntrinsics::_intValue: | |
1353 case vmIntrinsics::_longValue: | |
1354 case vmIntrinsics::_floatValue: | |
1355 case vmIntrinsics::_doubleValue: | |
1356 return true; | |
1357 default: | |
1358 return false; | |
1359 } | |
1360 } | |
1361 return false; | |
1362 } | |
1363 | |
0 | 1364 BCEscapeAnalyzer *ciMethod::get_bcea() { |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1579
diff
changeset
|
1365 #ifdef COMPILER2 |
0 | 1366 if (_bcea == NULL) { |
1367 _bcea = new (CURRENT_ENV->arena()) BCEscapeAnalyzer(this, NULL); | |
1368 } | |
1369 return _bcea; | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1579
diff
changeset
|
1370 #else // COMPILER2 |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1579
diff
changeset
|
1371 ShouldNotReachHere(); |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1579
diff
changeset
|
1372 return NULL; |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1579
diff
changeset
|
1373 #endif // COMPILER2 |
0 | 1374 } |
1375 | |
1376 ciMethodBlocks *ciMethod::get_method_blocks() { | |
1377 Arena *arena = CURRENT_ENV->arena(); | |
1378 if (_method_blocks == NULL) { | |
1379 _method_blocks = new (arena) ciMethodBlocks(arena, this); | |
1380 } | |
1381 return _method_blocks; | |
1382 } | |
1383 | |
1384 #undef FETCH_FLAG_FROM_VM | |
1385 | |
17622 | 1386 void ciMethod::dump_name_as_ascii(outputStream* st) { |
1387 Method* method = get_Method(); | |
1388 st->print("%s %s %s", | |
1389 method->klass_name()->as_quoted_ascii(), | |
1390 method->name()->as_quoted_ascii(), | |
1391 method->signature()->as_quoted_ascii()); | |
1392 } | |
1393 | |
6972
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1394 void ciMethod::dump_replay_data(outputStream* st) { |
7990
fcc9e7681d63
8006410: allocating without ResourceMark when CompileCommand was specified
vlivanov
parents:
7194
diff
changeset
|
1395 ResourceMark rm; |
6972
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1396 Method* method = get_Method(); |
10105
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
8866
diff
changeset
|
1397 MethodCounters* mcs = method->method_counters(); |
17622 | 1398 st->print("ciMethod "); |
1399 dump_name_as_ascii(st); | |
1400 st->print_cr(" %d %d %d %d %d", | |
10105
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
8866
diff
changeset
|
1401 mcs == NULL ? 0 : mcs->invocation_counter()->raw_counter(), |
aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
8866
diff
changeset
|
1402 mcs == NULL ? 0 : mcs->backedge_counter()->raw_counter(), |
6972
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1403 interpreter_invocation_count(), |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1404 interpreter_throwout_count(), |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1405 _instructions_size); |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6940
diff
changeset
|
1406 } |
0 | 1407 |
1408 // ------------------------------------------------------------------ | |
1409 // ciMethod::print_codes | |
1410 // | |
1411 // Print a range of the bytecodes for this method. | |
1412 void ciMethod::print_codes_on(int from, int to, outputStream* st) { | |
1413 check_is_loaded(); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1414 GUARDED_VM_ENTRY(get_Method()->print_codes_on(from, to, st);) |
0 | 1415 } |
1416 | |
1417 // ------------------------------------------------------------------ | |
1418 // ciMethod::print_name | |
1419 // | |
1420 // Print the name of this method, including signature and some flags. | |
1421 void ciMethod::print_name(outputStream* st) { | |
1422 check_is_loaded(); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1423 GUARDED_VM_ENTRY(get_Method()->print_name(st);) |
0 | 1424 } |
1425 | |
1426 // ------------------------------------------------------------------ | |
1427 // ciMethod::print_short_name | |
1428 // | |
1429 // Print the name of this method, without signature. | |
1430 void ciMethod::print_short_name(outputStream* st) { | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
1431 if (is_loaded()) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1432 GUARDED_VM_ENTRY(get_Method()->print_short_name(st);); |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
1433 } else { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
1434 // Fall back if method is not loaded. |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
1435 holder()->print_name_on(st); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
1436 st->print("::"); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
1437 name()->print_symbol_on(st); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
1438 if (WizardMode) |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
1439 signature()->as_symbol()->print_symbol_on(st); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6213
diff
changeset
|
1440 } |
0 | 1441 } |
1442 | |
1443 // ------------------------------------------------------------------ | |
1444 // ciMethod::print_impl | |
1445 // | |
1446 // Implementation of the print method. | |
1447 void ciMethod::print_impl(outputStream* st) { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6634
diff
changeset
|
1448 ciMetadata::print_impl(st); |
0 | 1449 st->print(" name="); |
1450 name()->print_symbol_on(st); | |
1451 st->print(" holder="); | |
1452 holder()->print_name_on(st); | |
1453 st->print(" signature="); | |
1454 signature()->as_symbol()->print_symbol_on(st); | |
1455 if (is_loaded()) { | |
6634
7f813940ac35
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
6266
diff
changeset
|
1456 st->print(" loaded=true"); |
7f813940ac35
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
6266
diff
changeset
|
1457 st->print(" arg_size=%d", arg_size()); |
7f813940ac35
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
twisti
parents:
6266
diff
changeset
|
1458 st->print(" flags="); |
0 | 1459 flags().print_member_flags(st); |
1460 } else { | |
1461 st->print(" loaded=false"); | |
1462 } | |
1463 } |