807 } |
805 } |
808 } |
806 } |
809 |
807 |
810 |
808 |
811 #define LOG_OFFSET(log, name) \ |
809 #define LOG_OFFSET(log, name) \ |
812 if ((intptr_t)name##_end() - (intptr_t)name##_begin()) \ |
810 if (p2i(name##_end()) - p2i(name##_begin())) \ |
813 log->print(" " XSTR(name) "_offset='%d'" , \ |
811 log->print(" " XSTR(name) "_offset='" INTX_FORMAT "'" , \ |
814 (intptr_t)name##_begin() - (intptr_t)this) |
812 p2i(name##_begin()) - p2i(this)) |
815 |
813 |
816 |
814 |
817 void nmethod::log_new_nmethod() const { |
815 void nmethod::log_new_nmethod() const { |
818 if (LogCompilation && xtty != NULL) { |
816 if (LogCompilation && xtty != NULL) { |
819 ttyLocker ttyl; |
817 ttyLocker ttyl; |
820 HandleMark hm; |
818 HandleMark hm; |
821 xtty->begin_elem("nmethod"); |
819 xtty->begin_elem("nmethod"); |
822 log_identity(xtty); |
820 log_identity(xtty); |
823 xtty->print(" entry='" INTPTR_FORMAT "' size='%d'", code_begin(), size()); |
821 xtty->print(" entry='" INTPTR_FORMAT "' size='%d'", p2i(code_begin()), size()); |
824 xtty->print(" address='" INTPTR_FORMAT "'", (intptr_t) this); |
822 xtty->print(" address='" INTPTR_FORMAT "'", p2i(this)); |
825 |
823 |
826 LOG_OFFSET(xtty, relocation); |
824 LOG_OFFSET(xtty, relocation); |
827 LOG_OFFSET(xtty, consts); |
825 LOG_OFFSET(xtty, consts); |
828 LOG_OFFSET(xtty, insts); |
826 LOG_OFFSET(xtty, insts); |
829 LOG_OFFSET(xtty, stub); |
827 LOG_OFFSET(xtty, stub); |
1203 // Break cycle between nmethod & method |
1201 // Break cycle between nmethod & method |
1204 if (TraceClassUnloading && WizardMode) { |
1202 if (TraceClassUnloading && WizardMode) { |
1205 tty->print_cr("[Class unloading: Making nmethod " INTPTR_FORMAT |
1203 tty->print_cr("[Class unloading: Making nmethod " INTPTR_FORMAT |
1206 " unloadable], Method*(" INTPTR_FORMAT |
1204 " unloadable], Method*(" INTPTR_FORMAT |
1207 "), cause(" INTPTR_FORMAT ")", |
1205 "), cause(" INTPTR_FORMAT ")", |
1208 this, (address)_method, (address)cause); |
1206 p2i(this), p2i(_method), p2i(cause)); |
1209 if (!Universe::heap()->is_gc_active()) |
1207 if (!Universe::heap()->is_gc_active()) |
1210 cause->klass()->print(); |
1208 cause->klass()->print(); |
1211 } |
1209 } |
1212 // Unlink the osr method, so we do not look this up again |
1210 // Unlink the osr method, so we do not look this up again |
1213 if (is_osr_method()) { |
1211 if (is_osr_method()) { |
1416 |
1415 |
1417 assert (!is_locked_by_vm(), "locked methods shouldn't be flushed"); |
1416 assert (!is_locked_by_vm(), "locked methods shouldn't be flushed"); |
1418 assert_locked_or_safepoint(CodeCache_lock); |
1417 assert_locked_or_safepoint(CodeCache_lock); |
1419 |
1418 |
1420 // completely deallocate this method |
1419 // completely deallocate this method |
1421 Events::log(JavaThread::current(), "flushing nmethod " INTPTR_FORMAT, this); |
1420 Events::log(JavaThread::current(), "flushing nmethod " INTPTR_FORMAT, p2i(this)); |
1422 if (PrintMethodFlushing) { |
1421 if (PrintMethodFlushing) { |
1423 tty->print_cr("*flushing nmethod %3d/" INTPTR_FORMAT ". Live blobs:" UINT32_FORMAT "/Free CodeCache:" SIZE_FORMAT "Kb", |
1422 tty->print_cr("*flushing nmethod %3d/" INTPTR_FORMAT ". Live blobs:" UINT32_FORMAT |
1424 _compile_id, this, CodeCache::nof_blobs(), CodeCache::unallocated_capacity(CodeCache::get_code_blob_type(this))/1024); |
1423 "/Free CodeCache:" SIZE_FORMAT "Kb", |
|
1424 _compile_id, p2i(this), CodeCache::nof_blobs(), |
|
1425 CodeCache::unallocated_capacity(CodeCache::get_code_blob_type(this))/1024); |
1425 } |
1426 } |
1426 |
1427 |
1427 // We need to deallocate any ExceptionCache data. |
1428 // We need to deallocate any ExceptionCache data. |
1428 // Note that we do not need to grab the nmethod lock for this, it |
1429 // Note that we do not need to grab the nmethod lock for this, it |
1429 // better be thread safe if we're disposing of it! |
1430 // better be thread safe if we're disposing of it! |
2538 // assert(method()->is_oop(), "must be valid"); |
2539 // assert(method()->is_oop(), "must be valid"); |
2539 |
2540 |
2540 ResourceMark rm; |
2541 ResourceMark rm; |
2541 |
2542 |
2542 if (!CodeCache::contains(this)) { |
2543 if (!CodeCache::contains(this)) { |
2543 fatal("nmethod at " INTPTR_FORMAT " not in zone", this); |
2544 fatal("nmethod at " INTPTR_FORMAT " not in zone", p2i(this)); |
2544 } |
2545 } |
2545 |
2546 |
2546 if(is_native_method() ) |
2547 if(is_native_method() ) |
2547 return; |
2548 return; |
2548 |
2549 |
2549 nmethod* nm = CodeCache::find_nmethod(verified_entry_point()); |
2550 nmethod* nm = CodeCache::find_nmethod(verified_entry_point()); |
2550 if (nm != this) { |
2551 if (nm != this) { |
2551 fatal("findNMethod did not find this nmethod (" INTPTR_FORMAT ")", this); |
2552 fatal("findNMethod did not find this nmethod (" INTPTR_FORMAT ")", p2i(this)); |
2552 } |
2553 } |
2553 |
2554 |
2554 for (PcDesc* p = scopes_pcs_begin(); p < scopes_pcs_end(); p++) { |
2555 for (PcDesc* p = scopes_pcs_begin(); p < scopes_pcs_end(); p++) { |
2555 if (! p->verify(this)) { |
2556 if (! p->verify(this)) { |
2556 tty->print_cr("\t\tin nmethod at " INTPTR_FORMAT " (pcs)", this); |
2557 tty->print_cr("\t\tin nmethod at " INTPTR_FORMAT " (pcs)", p2i(this)); |
2557 } |
2558 } |
2558 } |
2559 } |
2559 |
2560 |
2560 VerifyOopsClosure voc(this); |
2561 VerifyOopsClosure voc(this); |
2561 oops_do(&voc); |
2562 oops_do(&voc); |
2684 } |
2685 } |
2685 |
2686 |
2686 print_on(tty, NULL); |
2687 print_on(tty, NULL); |
2687 |
2688 |
2688 if (WizardMode) { |
2689 if (WizardMode) { |
2689 tty->print("((nmethod*) " INTPTR_FORMAT ") ", this); |
2690 tty->print("((nmethod*) " INTPTR_FORMAT ") ", p2i(this)); |
2690 tty->print(" for method " INTPTR_FORMAT , (address)method()); |
2691 tty->print(" for method " INTPTR_FORMAT , p2i(method())); |
2691 tty->print(" { "); |
2692 tty->print(" { "); |
2692 if (is_in_use()) tty->print("in_use "); |
2693 if (is_in_use()) tty->print("in_use "); |
2693 if (is_not_entrant()) tty->print("not_entrant "); |
2694 if (is_not_entrant()) tty->print("not_entrant "); |
2694 if (is_zombie()) tty->print("zombie "); |
2695 if (is_zombie()) tty->print("zombie "); |
2695 if (is_unloaded()) tty->print("unloaded "); |
2696 if (is_unloaded()) tty->print("unloaded "); |
2696 if (on_scavenge_root_list()) tty->print("scavenge_root "); |
2697 if (on_scavenge_root_list()) tty->print("scavenge_root "); |
2697 tty->print_cr("}:"); |
2698 tty->print_cr("}:"); |
2698 } |
2699 } |
2699 if (size () > 0) tty->print_cr(" total in heap [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2700 if (size () > 0) tty->print_cr(" total in heap [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2700 (address)this, |
2701 p2i(this), |
2701 (address)this + size(), |
2702 p2i(this) + size(), |
2702 size()); |
2703 size()); |
2703 if (relocation_size () > 0) tty->print_cr(" relocation [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2704 if (relocation_size () > 0) tty->print_cr(" relocation [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2704 relocation_begin(), |
2705 p2i(relocation_begin()), |
2705 relocation_end(), |
2706 p2i(relocation_end()), |
2706 relocation_size()); |
2707 relocation_size()); |
2707 if (consts_size () > 0) tty->print_cr(" constants [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2708 if (consts_size () > 0) tty->print_cr(" constants [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2708 consts_begin(), |
2709 p2i(consts_begin()), |
2709 consts_end(), |
2710 p2i(consts_end()), |
2710 consts_size()); |
2711 consts_size()); |
2711 if (insts_size () > 0) tty->print_cr(" main code [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2712 if (insts_size () > 0) tty->print_cr(" main code [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2712 insts_begin(), |
2713 p2i(insts_begin()), |
2713 insts_end(), |
2714 p2i(insts_end()), |
2714 insts_size()); |
2715 insts_size()); |
2715 if (stub_size () > 0) tty->print_cr(" stub code [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2716 if (stub_size () > 0) tty->print_cr(" stub code [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2716 stub_begin(), |
2717 p2i(stub_begin()), |
2717 stub_end(), |
2718 p2i(stub_end()), |
2718 stub_size()); |
2719 stub_size()); |
2719 if (oops_size () > 0) tty->print_cr(" oops [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2720 if (oops_size () > 0) tty->print_cr(" oops [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2720 oops_begin(), |
2721 p2i(oops_begin()), |
2721 oops_end(), |
2722 p2i(oops_end()), |
2722 oops_size()); |
2723 oops_size()); |
2723 if (metadata_size () > 0) tty->print_cr(" metadata [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2724 if (metadata_size () > 0) tty->print_cr(" metadata [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2724 metadata_begin(), |
2725 p2i(metadata_begin()), |
2725 metadata_end(), |
2726 p2i(metadata_end()), |
2726 metadata_size()); |
2727 metadata_size()); |
2727 if (scopes_data_size () > 0) tty->print_cr(" scopes data [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2728 if (scopes_data_size () > 0) tty->print_cr(" scopes data [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2728 scopes_data_begin(), |
2729 p2i(scopes_data_begin()), |
2729 scopes_data_end(), |
2730 p2i(scopes_data_end()), |
2730 scopes_data_size()); |
2731 scopes_data_size()); |
2731 if (scopes_pcs_size () > 0) tty->print_cr(" scopes pcs [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2732 if (scopes_pcs_size () > 0) tty->print_cr(" scopes pcs [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2732 scopes_pcs_begin(), |
2733 p2i(scopes_pcs_begin()), |
2733 scopes_pcs_end(), |
2734 p2i(scopes_pcs_end()), |
2734 scopes_pcs_size()); |
2735 scopes_pcs_size()); |
2735 if (dependencies_size () > 0) tty->print_cr(" dependencies [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2736 if (dependencies_size () > 0) tty->print_cr(" dependencies [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2736 dependencies_begin(), |
2737 p2i(dependencies_begin()), |
2737 dependencies_end(), |
2738 p2i(dependencies_end()), |
2738 dependencies_size()); |
2739 dependencies_size()); |
2739 if (handler_table_size() > 0) tty->print_cr(" handler table [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2740 if (handler_table_size() > 0) tty->print_cr(" handler table [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2740 handler_table_begin(), |
2741 p2i(handler_table_begin()), |
2741 handler_table_end(), |
2742 p2i(handler_table_end()), |
2742 handler_table_size()); |
2743 handler_table_size()); |
2743 if (nul_chk_table_size() > 0) tty->print_cr(" nul chk table [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2744 if (nul_chk_table_size() > 0) tty->print_cr(" nul chk table [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", |
2744 nul_chk_table_begin(), |
2745 p2i(nul_chk_table_begin()), |
2745 nul_chk_table_end(), |
2746 p2i(nul_chk_table_end()), |
2746 nul_chk_table_size()); |
2747 nul_chk_table_size()); |
2747 } |
2748 } |
2748 |
2749 |
2749 void nmethod::print_code() { |
2750 void nmethod::print_code() { |
2750 HandleMark hm; |
2751 HandleMark hm; |
2791 iter.print(); |
2792 iter.print(); |
2792 if (UseRelocIndex) { |
2793 if (UseRelocIndex) { |
2793 jint* index_end = (jint*)relocation_end() - 1; |
2794 jint* index_end = (jint*)relocation_end() - 1; |
2794 jint index_size = *index_end; |
2795 jint index_size = *index_end; |
2795 jint* index_start = (jint*)( (address)index_end - index_size ); |
2796 jint* index_start = (jint*)( (address)index_end - index_size ); |
2796 tty->print_cr(" index @" INTPTR_FORMAT ": index_size=%d", index_start, index_size); |
2797 tty->print_cr(" index @" INTPTR_FORMAT ": index_size=%d", p2i(index_start), index_size); |
2797 if (index_size > 0) { |
2798 if (index_size > 0) { |
2798 jint* ip; |
2799 jint* ip; |
2799 for (ip = index_start; ip+2 <= index_end; ip += 2) |
2800 for (ip = index_start; ip+2 <= index_end; ip += 2) |
2800 tty->print_cr(" (%d %d) addr=" INTPTR_FORMAT " @" INTPTR_FORMAT, |
2801 tty->print_cr(" (%d %d) addr=" INTPTR_FORMAT " @" INTPTR_FORMAT, |
2801 ip[0], |
2802 ip[0], |
2802 ip[1], |
2803 ip[1], |
2803 header_end()+ip[0], |
2804 p2i(header_end()+ip[0]), |
2804 relocation_begin()-1+ip[1]); |
2805 p2i(relocation_begin()-1+ip[1])); |
2805 for (; ip < index_end; ip++) |
2806 for (; ip < index_end; ip++) |
2806 tty->print_cr(" (%d ?)", ip[0]); |
2807 tty->print_cr(" (%d ?)", ip[0]); |
2807 tty->print_cr(" @" INTPTR_FORMAT ": index_size=%d", ip, *ip); |
2808 tty->print_cr(" @" INTPTR_FORMAT ": index_size=%d", p2i(ip), *ip); |
2808 ip++; |
2809 ip++; |
2809 tty->print_cr("reloc_end @" INTPTR_FORMAT ":", ip); |
2810 tty->print_cr("reloc_end @" INTPTR_FORMAT ":", p2i(ip)); |
2810 } |
2811 } |
2811 } |
2812 } |
2812 } |
2813 } |
2813 |
2814 |
2814 |
2815 |