474 _state = in_use;
475 _unloading_clock = 0;
476 _marked_for_reclamation = 0;
477 _has_flushed_dependencies = 0;
478 _has_unsafe_access = 0;
479 _has_method_handle_invokes = 0;
480 _lazy_critical_native = 0;
481 _has_wide_vectors = 0;
482 _marked_for_deoptimization = 0;
483 _lock_count = 0;
484 _stack_traversal_mark = 0;
485 _unload_reported = false; // jvmti state
486
487 #ifdef ASSERT
488 _oops_are_stale = false;
489 #endif
490
491 _oops_do_mark_link = NULL;
492 _jmethod_id = NULL;
493 _osr_link = NULL;
494 if (UseG1GC) {
495 _unloading_next = NULL;
496 } else {
497 _scavenge_root_link = NULL;
498 }
499 _scavenge_root_state = 0;
500 _compiler = NULL;
501 #if INCLUDE_RTM_OPT
502 _rtm_state = NoRTM;
503 #endif
504 #ifdef HAVE_DTRACE_H
505 _trap_offset = 0;
506 #endif // def HAVE_DTRACE_H
507 }
508
509 nmethod* nmethod::new_native_nmethod(methodHandle method,
510 int compile_id,
511 CodeBuffer *code_buffer,
512 int vep_offset,
513 int frame_complete,
514 int frame_size,
2820 class DebugScavengeRoot: public OopClosure {
2821 nmethod* _nm;
2822 bool _ok;
2823 public:
2824 DebugScavengeRoot(nmethod* nm) : _nm(nm), _ok(true) { }
2825 bool ok() { return _ok; }
2826 virtual void do_oop(oop* p) {
2827 if ((*p) == NULL || !(*p)->is_scavengable()) return;
2828 if (_ok) {
2829 _nm->print_nmethod(true);
2830 _ok = false;
2831 }
2832 tty->print_cr("*** scavengable oop " PTR_FORMAT " found at " PTR_FORMAT " (offset %d)",
2833 (void *)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm));
2834 (*p)->print();
2835 }
2836 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
2837 };
2838
2839 void nmethod::verify_scavenge_root_oops() {
2840 if (UseG1GC) {
2841 return;
2842 }
2843
2844 if (!on_scavenge_root_list()) {
2845 // Actually look inside, to verify the claim that it's clean.
2846 DebugScavengeRoot debug_scavenge_root(this);
2847 oops_do(&debug_scavenge_root);
2848 if (!debug_scavenge_root.ok())
2849 fatal("found an unadvertised bad scavengable oop in the code cache");
2850 }
2851 assert(scavenge_root_not_marked(), "");
2852 }
2853
2854 #endif // PRODUCT
2855
2856 // Printing operations
2857
2858 void nmethod::print() const {
2859 ResourceMark rm;
2860 ttyLocker ttyl; // keep the following output all in one block
|
474 _state = in_use;
475 _unloading_clock = 0;
476 _marked_for_reclamation = 0;
477 _has_flushed_dependencies = 0;
478 _has_unsafe_access = 0;
479 _has_method_handle_invokes = 0;
480 _lazy_critical_native = 0;
481 _has_wide_vectors = 0;
482 _marked_for_deoptimization = 0;
483 _lock_count = 0;
484 _stack_traversal_mark = 0;
485 _unload_reported = false; // jvmti state
486
487 #ifdef ASSERT
488 _oops_are_stale = false;
489 #endif
490
491 _oops_do_mark_link = NULL;
492 _jmethod_id = NULL;
493 _osr_link = NULL;
494 if (UseG1GC || UseShenandoahGC) {
495 _unloading_next = NULL;
496 } else {
497 _scavenge_root_link = NULL;
498 }
499 _scavenge_root_state = 0;
500 _compiler = NULL;
501 #if INCLUDE_RTM_OPT
502 _rtm_state = NoRTM;
503 #endif
504 #ifdef HAVE_DTRACE_H
505 _trap_offset = 0;
506 #endif // def HAVE_DTRACE_H
507 }
508
509 nmethod* nmethod::new_native_nmethod(methodHandle method,
510 int compile_id,
511 CodeBuffer *code_buffer,
512 int vep_offset,
513 int frame_complete,
514 int frame_size,
2820 class DebugScavengeRoot: public OopClosure {
2821 nmethod* _nm;
2822 bool _ok;
2823 public:
2824 DebugScavengeRoot(nmethod* nm) : _nm(nm), _ok(true) { }
2825 bool ok() { return _ok; }
2826 virtual void do_oop(oop* p) {
2827 if ((*p) == NULL || !(*p)->is_scavengable()) return;
2828 if (_ok) {
2829 _nm->print_nmethod(true);
2830 _ok = false;
2831 }
2832 tty->print_cr("*** scavengable oop " PTR_FORMAT " found at " PTR_FORMAT " (offset %d)",
2833 (void *)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm));
2834 (*p)->print();
2835 }
2836 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
2837 };
2838
2839 void nmethod::verify_scavenge_root_oops() {
2840 if (UseG1GC || UseShenandoahGC) {
2841 return;
2842 }
2843
2844 if (!on_scavenge_root_list()) {
2845 // Actually look inside, to verify the claim that it's clean.
2846 DebugScavengeRoot debug_scavenge_root(this);
2847 oops_do(&debug_scavenge_root);
2848 if (!debug_scavenge_root.ok())
2849 fatal("found an unadvertised bad scavengable oop in the code cache");
2850 }
2851 assert(scavenge_root_not_marked(), "");
2852 }
2853
2854 #endif // PRODUCT
2855
2856 // Printing operations
2857
2858 void nmethod::print() const {
2859 ResourceMark rm;
2860 ttyLocker ttyl; // keep the following output all in one block
|