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,
2819 class DebugScavengeRoot: public OopClosure {
2820 nmethod* _nm;
2821 bool _ok;
2822 public:
2823 DebugScavengeRoot(nmethod* nm) : _nm(nm), _ok(true) { }
2824 bool ok() { return _ok; }
2825 virtual void do_oop(oop* p) {
2826 if ((*p) == NULL || !(*p)->is_scavengable()) return;
2827 if (_ok) {
2828 _nm->print_nmethod(true);
2829 _ok = false;
2830 }
2831 tty->print_cr("*** scavengable oop " PTR_FORMAT " found at " PTR_FORMAT " (offset %d)",
2832 (void *)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm));
2833 (*p)->print();
2834 }
2835 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
2836 };
2837
2838 void nmethod::verify_scavenge_root_oops() {
2839 if (UseG1GC) {
2840 return;
2841 }
2842
2843 if (!on_scavenge_root_list()) {
2844 // Actually look inside, to verify the claim that it's clean.
2845 DebugScavengeRoot debug_scavenge_root(this);
2846 oops_do(&debug_scavenge_root);
2847 if (!debug_scavenge_root.ok())
2848 fatal("found an unadvertised bad scavengable oop in the code cache");
2849 }
2850 assert(scavenge_root_not_marked(), "");
2851 }
2852
2853 #endif // PRODUCT
2854
2855 // Printing operations
2856
2857 void nmethod::print() const {
2858 ResourceMark rm;
2859 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,
2819 class DebugScavengeRoot: public OopClosure {
2820 nmethod* _nm;
2821 bool _ok;
2822 public:
2823 DebugScavengeRoot(nmethod* nm) : _nm(nm), _ok(true) { }
2824 bool ok() { return _ok; }
2825 virtual void do_oop(oop* p) {
2826 if ((*p) == NULL || !(*p)->is_scavengable()) return;
2827 if (_ok) {
2828 _nm->print_nmethod(true);
2829 _ok = false;
2830 }
2831 tty->print_cr("*** scavengable oop " PTR_FORMAT " found at " PTR_FORMAT " (offset %d)",
2832 (void *)(*p), (intptr_t)p, (int)((intptr_t)p - (intptr_t)_nm));
2833 (*p)->print();
2834 }
2835 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
2836 };
2837
2838 void nmethod::verify_scavenge_root_oops() {
2839 if (UseG1GC || UseShenandoahGC) {
2840 return;
2841 }
2842
2843 if (!on_scavenge_root_list()) {
2844 // Actually look inside, to verify the claim that it's clean.
2845 DebugScavengeRoot debug_scavenge_root(this);
2846 oops_do(&debug_scavenge_root);
2847 if (!debug_scavenge_root.ok())
2848 fatal("found an unadvertised bad scavengable oop in the code cache");
2849 }
2850 assert(scavenge_root_not_marked(), "");
2851 }
2852
2853 #endif // PRODUCT
2854
2855 // Printing operations
2856
2857 void nmethod::print() const {
2858 ResourceMark rm;
2859 ttyLocker ttyl; // keep the following output all in one block
|