Mercurial > hg > truffle
comparison src/share/vm/oops/method.hpp @ 20804:7848fc12602b
Merge with jdk8u40-b25
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Tue, 07 Apr 2015 14:58:49 +0200 |
parents | 52b4284cb496 600c44255e5f |
children |
comparison
equal
deleted
inserted
replaced
20184:84105dcdb05b | 20804:7848fc12602b |
---|---|
235 void clear_breakpoint(int bci); | 235 void clear_breakpoint(int bci); |
236 void clear_all_breakpoints(); | 236 void clear_all_breakpoints(); |
237 // Tracking number of breakpoints, for fullspeed debugging. | 237 // Tracking number of breakpoints, for fullspeed debugging. |
238 // Only mutated by VM thread. | 238 // Only mutated by VM thread. |
239 u2 number_of_breakpoints() const { | 239 u2 number_of_breakpoints() const { |
240 if (method_counters() == NULL) { | 240 MethodCounters* mcs = method_counters(); |
241 if (mcs == NULL) { | |
241 return 0; | 242 return 0; |
242 } else { | 243 } else { |
243 return method_counters()->number_of_breakpoints(); | 244 return mcs->number_of_breakpoints(); |
244 } | 245 } |
245 } | 246 } |
246 void incr_number_of_breakpoints(TRAPS) { | 247 void incr_number_of_breakpoints(TRAPS) { |
247 MethodCounters* mcs = get_method_counters(CHECK); | 248 MethodCounters* mcs = get_method_counters(CHECK); |
248 if (mcs != NULL) { | 249 if (mcs != NULL) { |
255 mcs->decr_number_of_breakpoints(); | 256 mcs->decr_number_of_breakpoints(); |
256 } | 257 } |
257 } | 258 } |
258 // Initialization only | 259 // Initialization only |
259 void clear_number_of_breakpoints() { | 260 void clear_number_of_breakpoints() { |
260 if (method_counters() != NULL) { | 261 MethodCounters* mcs = method_counters(); |
261 method_counters()->clear_number_of_breakpoints(); | 262 if (mcs != NULL) { |
263 mcs->clear_number_of_breakpoints(); | |
262 } | 264 } |
263 } | 265 } |
264 | 266 |
265 // index into InstanceKlass methods() array | 267 // index into InstanceKlass methods() array |
266 // note: also used by jfr | 268 // note: also used by jfr |
303 mcs->interpreter_throwout_increment(); | 305 mcs->interpreter_throwout_increment(); |
304 } | 306 } |
305 } | 307 } |
306 | 308 |
307 int interpreter_throwout_count() const { | 309 int interpreter_throwout_count() const { |
308 if (method_counters() == NULL) { | 310 MethodCounters* mcs = method_counters(); |
311 if (mcs == NULL) { | |
309 return 0; | 312 return 0; |
310 } else { | 313 } else { |
311 return method_counters()->interpreter_throwout_count(); | 314 return mcs->interpreter_throwout_count(); |
312 } | 315 } |
313 } | 316 } |
314 | 317 |
315 // size of parameters | 318 // size of parameters |
316 int size_of_parameters() const { return constMethod()->size_of_parameters(); } | 319 int size_of_parameters() const { return constMethod()->size_of_parameters(); } |
364 | 367 |
365 MethodCounters* method_counters() const { | 368 MethodCounters* method_counters() const { |
366 return _method_counters; | 369 return _method_counters; |
367 } | 370 } |
368 | 371 |
369 void set_method_counters(MethodCounters* counters) { | 372 void clear_method_counters() { |
370 // The store into method must be released. On platforms without | 373 _method_counters = NULL; |
371 // total store order (TSO) the reference may become visible before | 374 } |
372 // the initialization of data otherwise. | 375 |
373 OrderAccess::release_store_ptr((volatile void *)&_method_counters, counters); | 376 bool init_method_counters(MethodCounters* counters) { |
377 // Try to install a pointer to MethodCounters, return true on success. | |
378 return Atomic::cmpxchg_ptr(counters, (volatile void*)&_method_counters, NULL) == NULL; | |
374 } | 379 } |
375 | 380 |
376 #ifdef TIERED | 381 #ifdef TIERED |
377 // We are reusing interpreter_invocation_count as a holder for the previous event count! | 382 // We are reusing interpreter_invocation_count as a holder for the previous event count! |
378 // We can do that since interpreter_invocation_count is not used in tiered. | 383 // We can do that since interpreter_invocation_count is not used in tiered. |
381 return 0; | 386 return 0; |
382 } else { | 387 } else { |
383 return method_counters()->interpreter_invocation_count(); | 388 return method_counters()->interpreter_invocation_count(); |
384 } | 389 } |
385 } | 390 } |
386 void set_prev_event_count(int count, TRAPS) { | 391 void set_prev_event_count(int count) { |
387 MethodCounters* mcs = get_method_counters(CHECK); | 392 MethodCounters* mcs = method_counters(); |
388 if (mcs != NULL) { | 393 if (mcs != NULL) { |
389 mcs->set_interpreter_invocation_count(count); | 394 mcs->set_interpreter_invocation_count(count); |
390 } | 395 } |
391 } | 396 } |
392 jlong prev_time() const { | 397 jlong prev_time() const { |
393 return method_counters() == NULL ? 0 : method_counters()->prev_time(); | 398 MethodCounters* mcs = method_counters(); |
394 } | 399 return mcs == NULL ? 0 : mcs->prev_time(); |
395 void set_prev_time(jlong time, TRAPS) { | 400 } |
396 MethodCounters* mcs = get_method_counters(CHECK); | 401 void set_prev_time(jlong time) { |
402 MethodCounters* mcs = method_counters(); | |
397 if (mcs != NULL) { | 403 if (mcs != NULL) { |
398 mcs->set_prev_time(time); | 404 mcs->set_prev_time(time); |
399 } | 405 } |
400 } | 406 } |
401 float rate() const { | 407 float rate() const { |
402 return method_counters() == NULL ? 0 : method_counters()->rate(); | 408 MethodCounters* mcs = method_counters(); |
403 } | 409 return mcs == NULL ? 0 : mcs->rate(); |
404 void set_rate(float rate, TRAPS) { | 410 } |
405 MethodCounters* mcs = get_method_counters(CHECK); | 411 void set_rate(float rate) { |
412 MethodCounters* mcs = method_counters(); | |
406 if (mcs != NULL) { | 413 if (mcs != NULL) { |
407 mcs->set_rate(rate); | 414 mcs->set_rate(rate); |
408 } | 415 } |
409 } | 416 } |
410 #endif | 417 #endif |
418 static void build_interpreter_method_data(methodHandle method, TRAPS); | 425 static void build_interpreter_method_data(methodHandle method, TRAPS); |
419 | 426 |
420 static MethodCounters* build_method_counters(Method* m, TRAPS); | 427 static MethodCounters* build_method_counters(Method* m, TRAPS); |
421 | 428 |
422 int interpreter_invocation_count() { | 429 int interpreter_invocation_count() { |
423 if (TieredCompilation) return invocation_count(); | 430 if (TieredCompilation) { |
424 else return (method_counters() == NULL) ? 0 : | 431 return invocation_count(); |
425 method_counters()->interpreter_invocation_count(); | 432 } else { |
433 MethodCounters* mcs = method_counters(); | |
434 return (mcs == NULL) ? 0 : mcs->interpreter_invocation_count(); | |
435 } | |
426 } | 436 } |
427 int increment_interpreter_invocation_count(TRAPS) { | 437 int increment_interpreter_invocation_count(TRAPS) { |
428 if (TieredCompilation) ShouldNotReachHere(); | 438 if (TieredCompilation) ShouldNotReachHere(); |
429 MethodCounters* mcs = get_method_counters(CHECK_0); | 439 MethodCounters* mcs = get_method_counters(CHECK_0); |
430 return (mcs == NULL) ? 0 : mcs->increment_interpreter_invocation_count(); | 440 return (mcs == NULL) ? 0 : mcs->increment_interpreter_invocation_count(); |
611 void set_guaranteed_monitor_matching() { _access_flags.set_monitor_matching(); } | 621 void set_guaranteed_monitor_matching() { _access_flags.set_monitor_matching(); } |
612 | 622 |
613 // returns true if the method is an accessor function (setter/getter). | 623 // returns true if the method is an accessor function (setter/getter). |
614 bool is_accessor() const; | 624 bool is_accessor() const; |
615 | 625 |
626 // returns true if the method does nothing but return a constant of primitive type | |
627 bool is_constant_getter() const; | |
628 | |
616 // returns true if the method is an initializer (<init> or <clinit>). | 629 // returns true if the method is an initializer (<init> or <clinit>). |
617 bool is_initializer() const; | 630 bool is_initializer() const; |
618 | 631 |
619 // returns true if the method is static OR if the classfile version < 51 | 632 // returns true if the method is static OR if the classfile version < 51 |
620 bool has_valid_initializer_flags() const; | 633 bool has_valid_initializer_flags() const; |
808 bool is_overpass() const { return method_type() == ConstMethod::OVERPASS; } | 821 bool is_overpass() const { return method_type() == ConstMethod::OVERPASS; } |
809 | 822 |
810 // On-stack replacement support | 823 // On-stack replacement support |
811 bool has_osr_nmethod(int level, bool match_level) { | 824 bool has_osr_nmethod(int level, bool match_level) { |
812 return method_holder()->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL; | 825 return method_holder()->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL; |
826 } | |
827 | |
828 int mark_osr_nmethods() { | |
829 return method_holder()->mark_osr_nmethods(this); | |
813 } | 830 } |
814 | 831 |
815 nmethod* lookup_osr_nmethod_for(int bci, int level, bool match_level) { | 832 nmethod* lookup_osr_nmethod_for(int bci, int level, bool match_level) { |
816 return method_holder()->lookup_osr_nmethod(this, bci, level, match_level); | 833 return method_holder()->lookup_osr_nmethod(this, bci, level, match_level); |
817 } | 834 } |