183 // Static routine in the situations we don't have a Method*
184 static char* name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol* signature);
185 static char* name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol* signature, char* buf, int size);
186
187 Bytecodes::Code java_code_at(int bci) const {
188 return Bytecodes::java_code_at(this, bcp_from(bci));
189 }
190 Bytecodes::Code code_at(int bci) const {
191 return Bytecodes::code_at(this, bcp_from(bci));
192 }
193
194 // JVMTI breakpoints
195 Bytecodes::Code orig_bytecode_at(int bci) const;
196 void set_orig_bytecode_at(int bci, Bytecodes::Code code);
197 void set_breakpoint(int bci);
198 void clear_breakpoint(int bci);
199 void clear_all_breakpoints();
200 // Tracking number of breakpoints, for fullspeed debugging.
201 // Only mutated by VM thread.
202 u2 number_of_breakpoints() const {
203 if (method_counters() == NULL) {
204 return 0;
205 } else {
206 return method_counters()->number_of_breakpoints();
207 }
208 }
209 void incr_number_of_breakpoints(TRAPS) {
210 MethodCounters* mcs = get_method_counters(CHECK);
211 if (mcs != NULL) {
212 mcs->incr_number_of_breakpoints();
213 }
214 }
215 void decr_number_of_breakpoints(TRAPS) {
216 MethodCounters* mcs = get_method_counters(CHECK);
217 if (mcs != NULL) {
218 mcs->decr_number_of_breakpoints();
219 }
220 }
221 // Initialization only
222 void clear_number_of_breakpoints() {
223 if (method_counters() != NULL) {
224 method_counters()->clear_number_of_breakpoints();
225 }
226 }
227
228 // index into InstanceKlass methods() array
229 // note: also used by jfr
230 u2 method_idnum() const { return constMethod()->method_idnum(); }
231 void set_method_idnum(u2 idnum) { constMethod()->set_method_idnum(idnum); }
232
233 // code size
234 int code_size() const { return constMethod()->code_size(); }
235
236 // method size
237 int method_size() const { return _method_size; }
238 void set_method_size(int size) {
239 assert(0 <= size && size < (1 << 16), "invalid method size");
240 _method_size = size;
241 }
242
243 // constant pool for Klass* holding this method
244 ConstantPool* constants() const { return constMethod()->constants(); }
251 void set_max_stack(int size) { constMethod()->set_max_stack(size); }
252
253 // max locals
254 int max_locals() const { return constMethod()->max_locals(); }
255 void set_max_locals(int size) { constMethod()->set_max_locals(size); }
256
257 int highest_comp_level() const;
258 void set_highest_comp_level(int level);
259 int highest_osr_comp_level() const;
260 void set_highest_osr_comp_level(int level);
261
262 // Count of times method was exited via exception while interpreting
263 void interpreter_throwout_increment(TRAPS) {
264 MethodCounters* mcs = get_method_counters(CHECK);
265 if (mcs != NULL) {
266 mcs->interpreter_throwout_increment();
267 }
268 }
269
270 int interpreter_throwout_count() const {
271 if (method_counters() == NULL) {
272 return 0;
273 } else {
274 return method_counters()->interpreter_throwout_count();
275 }
276 }
277
278 // size of parameters
279 int size_of_parameters() const { return constMethod()->size_of_parameters(); }
280 void set_size_of_parameters(int size) { constMethod()->set_size_of_parameters(size); }
281
282 bool has_stackmap_table() const {
283 return constMethod()->has_stackmap_table();
284 }
285
286 Array<u1>* stackmap_data() const {
287 return constMethod()->stackmap_data();
288 }
289
290 void set_stackmap_data(Array<u1>* sd) {
291 constMethod()->set_stackmap_data(sd);
292 }
293
294 // exception handler table
329 return _method_counters;
330 }
331
332 void set_method_counters(MethodCounters* counters) {
333 // The store into method must be released. On platforms without
334 // total store order (TSO) the reference may become visible before
335 // the initialization of data otherwise.
336 OrderAccess::release_store_ptr((volatile void *)&_method_counters, counters);
337 }
338
339 #ifdef TIERED
340 // We are reusing interpreter_invocation_count as a holder for the previous event count!
341 // We can do that since interpreter_invocation_count is not used in tiered.
342 int prev_event_count() const {
343 if (method_counters() == NULL) {
344 return 0;
345 } else {
346 return method_counters()->interpreter_invocation_count();
347 }
348 }
349 void set_prev_event_count(int count, TRAPS) {
350 MethodCounters* mcs = get_method_counters(CHECK);
351 if (mcs != NULL) {
352 mcs->set_interpreter_invocation_count(count);
353 }
354 }
355 jlong prev_time() const {
356 return method_counters() == NULL ? 0 : method_counters()->prev_time();
357 }
358 void set_prev_time(jlong time, TRAPS) {
359 MethodCounters* mcs = get_method_counters(CHECK);
360 if (mcs != NULL) {
361 mcs->set_prev_time(time);
362 }
363 }
364 float rate() const {
365 return method_counters() == NULL ? 0 : method_counters()->rate();
366 }
367 void set_rate(float rate, TRAPS) {
368 MethodCounters* mcs = get_method_counters(CHECK);
369 if (mcs != NULL) {
370 mcs->set_rate(rate);
371 }
372 }
373 #endif
374
375 int invocation_count();
376 int backedge_count();
377
378 bool was_executed_more_than(int n);
379 bool was_never_executed() { return !was_executed_more_than(0); }
380
381 static void build_interpreter_method_data(methodHandle method, TRAPS);
382
383 static MethodCounters* build_method_counters(Method* m, TRAPS);
384
385 int interpreter_invocation_count() {
386 if (TieredCompilation) return invocation_count();
387 else return (method_counters() == NULL) ? 0 :
388 method_counters()->interpreter_invocation_count();
389 }
390 int increment_interpreter_invocation_count(TRAPS) {
391 if (TieredCompilation) ShouldNotReachHere();
392 MethodCounters* mcs = get_method_counters(CHECK_0);
393 return (mcs == NULL) ? 0 : mcs->increment_interpreter_invocation_count();
394 }
395
396 #ifndef PRODUCT
397 int compiled_invocation_count() const { return _compiled_invocation_count; }
398 void set_compiled_invocation_count(int count) { _compiled_invocation_count = count; }
399 #else
400 // for PrintMethodData in a product build
401 int compiled_invocation_count() const { return 0; }
402 #endif // not PRODUCT
403
404 // Clear (non-shared space) pointers which could not be relevant
405 // if this (shared) method were mapped into another JVM.
406 void remove_unshareable_info();
407
408 // nmethod/verified compiler entry
|
183 // Static routine in the situations we don't have a Method*
184 static char* name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol* signature);
185 static char* name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol* signature, char* buf, int size);
186
187 Bytecodes::Code java_code_at(int bci) const {
188 return Bytecodes::java_code_at(this, bcp_from(bci));
189 }
190 Bytecodes::Code code_at(int bci) const {
191 return Bytecodes::code_at(this, bcp_from(bci));
192 }
193
194 // JVMTI breakpoints
195 Bytecodes::Code orig_bytecode_at(int bci) const;
196 void set_orig_bytecode_at(int bci, Bytecodes::Code code);
197 void set_breakpoint(int bci);
198 void clear_breakpoint(int bci);
199 void clear_all_breakpoints();
200 // Tracking number of breakpoints, for fullspeed debugging.
201 // Only mutated by VM thread.
202 u2 number_of_breakpoints() const {
203 MethodCounters* mcs = method_counters();
204 if (mcs == NULL) {
205 return 0;
206 } else {
207 return mcs->number_of_breakpoints();
208 }
209 }
210 void incr_number_of_breakpoints(TRAPS) {
211 MethodCounters* mcs = get_method_counters(CHECK);
212 if (mcs != NULL) {
213 mcs->incr_number_of_breakpoints();
214 }
215 }
216 void decr_number_of_breakpoints(TRAPS) {
217 MethodCounters* mcs = get_method_counters(CHECK);
218 if (mcs != NULL) {
219 mcs->decr_number_of_breakpoints();
220 }
221 }
222 // Initialization only
223 void clear_number_of_breakpoints() {
224 MethodCounters* mcs = method_counters();
225 if (mcs != NULL) {
226 mcs->clear_number_of_breakpoints();
227 }
228 }
229
230 // index into InstanceKlass methods() array
231 // note: also used by jfr
232 u2 method_idnum() const { return constMethod()->method_idnum(); }
233 void set_method_idnum(u2 idnum) { constMethod()->set_method_idnum(idnum); }
234
235 // code size
236 int code_size() const { return constMethod()->code_size(); }
237
238 // method size
239 int method_size() const { return _method_size; }
240 void set_method_size(int size) {
241 assert(0 <= size && size < (1 << 16), "invalid method size");
242 _method_size = size;
243 }
244
245 // constant pool for Klass* holding this method
246 ConstantPool* constants() const { return constMethod()->constants(); }
253 void set_max_stack(int size) { constMethod()->set_max_stack(size); }
254
255 // max locals
256 int max_locals() const { return constMethod()->max_locals(); }
257 void set_max_locals(int size) { constMethod()->set_max_locals(size); }
258
259 int highest_comp_level() const;
260 void set_highest_comp_level(int level);
261 int highest_osr_comp_level() const;
262 void set_highest_osr_comp_level(int level);
263
264 // Count of times method was exited via exception while interpreting
265 void interpreter_throwout_increment(TRAPS) {
266 MethodCounters* mcs = get_method_counters(CHECK);
267 if (mcs != NULL) {
268 mcs->interpreter_throwout_increment();
269 }
270 }
271
272 int interpreter_throwout_count() const {
273 MethodCounters* mcs = method_counters();
274 if (mcs == NULL) {
275 return 0;
276 } else {
277 return mcs->interpreter_throwout_count();
278 }
279 }
280
281 // size of parameters
282 int size_of_parameters() const { return constMethod()->size_of_parameters(); }
283 void set_size_of_parameters(int size) { constMethod()->set_size_of_parameters(size); }
284
285 bool has_stackmap_table() const {
286 return constMethod()->has_stackmap_table();
287 }
288
289 Array<u1>* stackmap_data() const {
290 return constMethod()->stackmap_data();
291 }
292
293 void set_stackmap_data(Array<u1>* sd) {
294 constMethod()->set_stackmap_data(sd);
295 }
296
297 // exception handler table
332 return _method_counters;
333 }
334
335 void set_method_counters(MethodCounters* counters) {
336 // The store into method must be released. On platforms without
337 // total store order (TSO) the reference may become visible before
338 // the initialization of data otherwise.
339 OrderAccess::release_store_ptr((volatile void *)&_method_counters, counters);
340 }
341
342 #ifdef TIERED
343 // We are reusing interpreter_invocation_count as a holder for the previous event count!
344 // We can do that since interpreter_invocation_count is not used in tiered.
345 int prev_event_count() const {
346 if (method_counters() == NULL) {
347 return 0;
348 } else {
349 return method_counters()->interpreter_invocation_count();
350 }
351 }
352 void set_prev_event_count(int count) {
353 MethodCounters* mcs = method_counters();
354 if (mcs != NULL) {
355 mcs->set_interpreter_invocation_count(count);
356 }
357 }
358 jlong prev_time() const {
359 MethodCounters* mcs = method_counters();
360 return mcs == NULL ? 0 : mcs->prev_time();
361 }
362 void set_prev_time(jlong time) {
363 MethodCounters* mcs = method_counters();
364 if (mcs != NULL) {
365 mcs->set_prev_time(time);
366 }
367 }
368 float rate() const {
369 MethodCounters* mcs = method_counters();
370 return mcs == NULL ? 0 : mcs->rate();
371 }
372 void set_rate(float rate) {
373 MethodCounters* mcs = method_counters();
374 if (mcs != NULL) {
375 mcs->set_rate(rate);
376 }
377 }
378 #endif
379
380 int invocation_count();
381 int backedge_count();
382
383 bool was_executed_more_than(int n);
384 bool was_never_executed() { return !was_executed_more_than(0); }
385
386 static void build_interpreter_method_data(methodHandle method, TRAPS);
387
388 static MethodCounters* build_method_counters(Method* m, TRAPS);
389
390 int interpreter_invocation_count() {
391 if (TieredCompilation) {
392 return invocation_count();
393 } else {
394 MethodCounters* mcs = method_counters();
395 return (mcs == NULL) ? 0 : mcs->interpreter_invocation_count();
396 }
397 }
398 int increment_interpreter_invocation_count(TRAPS) {
399 if (TieredCompilation) ShouldNotReachHere();
400 MethodCounters* mcs = get_method_counters(CHECK_0);
401 return (mcs == NULL) ? 0 : mcs->increment_interpreter_invocation_count();
402 }
403
404 #ifndef PRODUCT
405 int compiled_invocation_count() const { return _compiled_invocation_count; }
406 void set_compiled_invocation_count(int count) { _compiled_invocation_count = count; }
407 #else
408 // for PrintMethodData in a product build
409 int compiled_invocation_count() const { return 0; }
410 #endif // not PRODUCT
411
412 // Clear (non-shared space) pointers which could not be relevant
413 // if this (shared) method were mapped into another JVM.
414 void remove_unshareable_info();
415
416 // nmethod/verified compiler entry
|