src/share/vm/code/nmethod.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6951083 Sdiff src/share/vm/code

src/share/vm/code/nmethod.cpp

Print this page




  82   int nmethod_count;
  83   int total_size;
  84   int relocation_size;
  85   int code_size;
  86   int stub_size;
  87   int consts_size;
  88   int scopes_data_size;
  89   int scopes_pcs_size;
  90   int dependencies_size;
  91   int handler_table_size;
  92   int nul_chk_table_size;
  93   int oops_size;
  94 
  95   void note_nmethod(nmethod* nm) {
  96     nmethod_count += 1;
  97     total_size          += nm->size();
  98     relocation_size     += nm->relocation_size();
  99     code_size           += nm->code_size();
 100     stub_size           += nm->stub_size();
 101     consts_size         += nm->consts_size();

 102     scopes_data_size    += nm->scopes_data_size();
 103     scopes_pcs_size     += nm->scopes_pcs_size();
 104     dependencies_size   += nm->dependencies_size();
 105     handler_table_size  += nm->handler_table_size();
 106     nul_chk_table_size  += nm->nul_chk_table_size();
 107     oops_size += nm->oops_size();
 108   }
 109   void print_nmethod_stats() {
 110     if (nmethod_count == 0)  return;
 111     tty->print_cr("Statistics for %d bytecoded nmethods:", nmethod_count);
 112     if (total_size != 0)          tty->print_cr(" total in heap  = %d", total_size);
 113     if (relocation_size != 0)     tty->print_cr(" relocation     = %d", relocation_size);
 114     if (code_size != 0)           tty->print_cr(" main code      = %d", code_size);
 115     if (stub_size != 0)           tty->print_cr(" stub code      = %d", stub_size);
 116     if (consts_size != 0)         tty->print_cr(" constants      = %d", consts_size);

 117     if (scopes_data_size != 0)    tty->print_cr(" scopes data    = %d", scopes_data_size);
 118     if (scopes_pcs_size != 0)     tty->print_cr(" scopes pcs     = %d", scopes_pcs_size);
 119     if (dependencies_size != 0)   tty->print_cr(" dependencies   = %d", dependencies_size);
 120     if (handler_table_size != 0)  tty->print_cr(" handler table  = %d", handler_table_size);
 121     if (nul_chk_table_size != 0)  tty->print_cr(" nul chk table  = %d", nul_chk_table_size);
 122     if (oops_size != 0)           tty->print_cr(" oops           = %d", oops_size);
 123   }
 124 
 125   int native_nmethod_count;
 126   int native_total_size;
 127   int native_relocation_size;
 128   int native_code_size;
 129   int native_oops_size;
 130   void note_native_nmethod(nmethod* nm) {
 131     native_nmethod_count += 1;
 132     native_total_size       += nm->size();
 133     native_relocation_size  += nm->relocation_size();
 134     native_code_size        += nm->code_size();
 135     native_oops_size        += nm->oops_size();
 136   }
 137   void print_native_nmethod_stats() {
 138     if (native_nmethod_count == 0)  return;
 139     tty->print_cr("Statistics for %d native nmethods:", native_nmethod_count);
 140     if (native_total_size != 0)       tty->print_cr(" N. total size  = %d", native_total_size);
 141     if (native_relocation_size != 0)  tty->print_cr(" N. relocation  = %d", native_relocation_size);
 142     if (native_code_size != 0)        tty->print_cr(" N. main code   = %d", native_code_size);


 583     NOT_PRODUCT(_has_debug_info = false);
 584     _oops_do_mark_link       = NULL;
 585     _method                  = method;
 586     _entry_bci               = InvocationEntryBci;
 587     _osr_link                = NULL;
 588     _scavenge_root_link      = NULL;
 589     _scavenge_root_state     = 0;
 590     _saved_nmethod_link      = NULL;
 591     _compiler                = NULL;
 592     // We have no exception handler or deopt handler make the
 593     // values something that will never match a pc like the nmethod vtable entry
 594     _exception_offset        = 0;
 595     _deoptimize_offset       = 0;
 596     _deoptimize_mh_offset    = 0;
 597     _orig_pc_offset          = 0;
 598 #ifdef HAVE_DTRACE_H
 599     _trap_offset             = 0;
 600 #endif // def HAVE_DTRACE_H
 601     _stub_offset             = data_offset();
 602     _consts_offset           = data_offset();
 603     _scopes_data_offset      = data_offset();

 604     _scopes_pcs_offset       = _scopes_data_offset;
 605     _dependencies_offset     = _scopes_pcs_offset;
 606     _handler_table_offset    = _dependencies_offset;
 607     _nul_chk_table_offset    = _handler_table_offset;
 608     _nmethod_end_offset      = _nul_chk_table_offset;
 609     _compile_id              = 0;  // default
 610     _comp_level              = CompLevel_none;
 611     _entry_point             = instructions_begin();
 612     _verified_entry_point    = instructions_begin() + offsets->value(CodeOffsets::Verified_Entry);
 613     _osr_entry_point         = NULL;
 614     _exception_cache         = NULL;
 615     _pc_desc_cache.reset_to(NULL);
 616 
 617     flags.clear();
 618     flags.state              = alive;
 619     _markedForDeoptimization = 0;
 620 
 621     _lock_count = 0;
 622     _stack_traversal_mark    = 0;
 623 


 673     assert_locked_or_safepoint(CodeCache_lock);
 674 
 675     NOT_PRODUCT(_has_debug_info = false);
 676     _oops_do_mark_link       = NULL;
 677     _method                  = method;
 678     _entry_bci               = InvocationEntryBci;
 679     _osr_link                = NULL;
 680     _scavenge_root_link      = NULL;
 681     _scavenge_root_state     = 0;
 682     _compiler                = NULL;
 683     // We have no exception handler or deopt handler make the
 684     // values something that will never match a pc like the nmethod vtable entry
 685     _exception_offset        = 0;
 686     _deoptimize_offset       = 0;
 687     _deoptimize_mh_offset    = 0;
 688     _unwind_handler_offset   = -1;
 689     _trap_offset             = offsets->value(CodeOffsets::Dtrace_trap);
 690     _orig_pc_offset          = 0;
 691     _stub_offset             = data_offset();
 692     _consts_offset           = data_offset();
 693     _scopes_data_offset      = data_offset();

 694     _scopes_pcs_offset       = _scopes_data_offset;
 695     _dependencies_offset     = _scopes_pcs_offset;
 696     _handler_table_offset    = _dependencies_offset;
 697     _nul_chk_table_offset    = _handler_table_offset;
 698     _nmethod_end_offset      = _nul_chk_table_offset;
 699     _compile_id              = 0;  // default
 700     _comp_level              = CompLevel_none;
 701     _entry_point             = instructions_begin();
 702     _verified_entry_point    = instructions_begin() + offsets->value(CodeOffsets::Verified_Entry);
 703     _osr_entry_point         = NULL;
 704     _exception_cache         = NULL;
 705     _pc_desc_cache.reset_to(NULL);
 706 
 707     flags.clear();
 708     flags.state              = alive;
 709     _markedForDeoptimization = 0;
 710 
 711     _lock_count = 0;
 712     _stack_traversal_mark    = 0;
 713 


 788     _osr_link                = NULL;
 789     _scavenge_root_link      = NULL;
 790     _scavenge_root_state     = 0;
 791     _compiler                = compiler;
 792     _orig_pc_offset          = orig_pc_offset;
 793 #ifdef HAVE_DTRACE_H
 794     _trap_offset             = 0;
 795 #endif // def HAVE_DTRACE_H
 796     _stub_offset             = instructions_offset() + code_buffer->total_offset_of(code_buffer->stubs()->start());
 797 
 798     // Exception handler and deopt handler are in the stub section
 799     _exception_offset        = _stub_offset + offsets->value(CodeOffsets::Exceptions);
 800     _deoptimize_offset       = _stub_offset + offsets->value(CodeOffsets::Deopt);
 801     _deoptimize_mh_offset    = _stub_offset + offsets->value(CodeOffsets::DeoptMH);
 802     if (offsets->value(CodeOffsets::UnwindHandler) != -1) {
 803       _unwind_handler_offset   = instructions_offset() + offsets->value(CodeOffsets::UnwindHandler);
 804     } else {
 805       _unwind_handler_offset   = -1;
 806     }
 807     _consts_offset           = instructions_offset() + code_buffer->total_offset_of(code_buffer->consts()->start());
 808     _scopes_data_offset      = data_offset();

 809     _scopes_pcs_offset       = _scopes_data_offset   + round_to(debug_info->data_size         (), oopSize);
 810     _dependencies_offset     = _scopes_pcs_offset    + adjust_pcs_size(debug_info->pcs_size());
 811     _handler_table_offset    = _dependencies_offset  + round_to(dependencies->size_in_bytes (), oopSize);
 812     _nul_chk_table_offset    = _handler_table_offset + round_to(handler_table->size_in_bytes(), oopSize);
 813     _nmethod_end_offset      = _nul_chk_table_offset + round_to(nul_chk_table->size_in_bytes(), oopSize);
 814 
 815     _entry_point             = instructions_begin();
 816     _verified_entry_point    = instructions_begin() + offsets->value(CodeOffsets::Verified_Entry);
 817     _osr_entry_point         = instructions_begin() + offsets->value(CodeOffsets::OSR_Entry);
 818     _exception_cache         = NULL;
 819     _pc_desc_cache.reset_to(scopes_pcs_begin());
 820 
 821     flags.clear();
 822     flags.state              = alive;
 823     _markedForDeoptimization = 0;
 824 
 825     _unload_reported         = false;           // jvmti state
 826 
 827     _lock_count = 0;
 828     _stack_traversal_mark    = 0;


 973     print_relocations();
 974   }
 975   if (PrintDependencies) {
 976     print_dependencies();
 977   }
 978   if (PrintExceptionHandlers) {
 979     print_handler_table();
 980     print_nul_chk_table();
 981   }
 982   if (xtty != NULL) {
 983     xtty->tail("print_nmethod");
 984   }
 985 }
 986 
 987 
 988 void nmethod::set_version(int v) {
 989   flags.version = v;
 990 }
 991 
 992 









































































 993 ScopeDesc* nmethod::scope_desc_at(address pc) {
 994   PcDesc* pd = pc_desc_at(pc);
 995   guarantee(pd != NULL, "scope must be present");
 996   return new ScopeDesc(this, pd->scope_decode_offset(),
 997                        pd->obj_decode_offset(), pd->should_reexecute(),
 998                        pd->return_oop());
 999 }
1000 
1001 
1002 void nmethod::clear_inline_caches() {
1003   assert(SafepointSynchronize::is_at_safepoint(), "cleaning of IC's only allowed at safepoint");
1004   if (is_zombie()) {
1005     return;
1006   }
1007 
1008   RelocIterator iter(this);
1009   while (iter.next()) {
1010     iter.reloc()->clear_inline_cache();
1011   }
1012 }


2265   if (size              () > 0) tty->print_cr(" total in heap  [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2266                                               (address)this,
2267                                               (address)this + size(),
2268                                               size());
2269   if (relocation_size   () > 0) tty->print_cr(" relocation     [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2270                                               relocation_begin(),
2271                                               relocation_end(),
2272                                               relocation_size());
2273   if (code_size         () > 0) tty->print_cr(" main code      [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2274                                               code_begin(),
2275                                               code_end(),
2276                                               code_size());
2277   if (stub_size         () > 0) tty->print_cr(" stub code      [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2278                                               stub_begin(),
2279                                               stub_end(),
2280                                               stub_size());
2281   if (consts_size       () > 0) tty->print_cr(" constants      [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2282                                               consts_begin(),
2283                                               consts_end(),
2284                                               consts_size());




2285   if (scopes_data_size  () > 0) tty->print_cr(" scopes data    [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2286                                               scopes_data_begin(),
2287                                               scopes_data_end(),
2288                                               scopes_data_size());
2289   if (scopes_pcs_size   () > 0) tty->print_cr(" scopes pcs     [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2290                                               scopes_pcs_begin(),
2291                                               scopes_pcs_end(),
2292                                               scopes_pcs_size());
2293   if (dependencies_size () > 0) tty->print_cr(" dependencies   [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2294                                               dependencies_begin(),
2295                                               dependencies_end(),
2296                                               dependencies_size());
2297   if (handler_table_size() > 0) tty->print_cr(" handler table  [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2298                                               handler_table_begin(),
2299                                               handler_table_end(),
2300                                               handler_table_size());
2301   if (nul_chk_table_size() > 0) tty->print_cr(" nul chk table  [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2302                                               nul_chk_table_begin(),
2303                                               nul_chk_table_end(),
2304                                               nul_chk_table_size());




  82   int nmethod_count;
  83   int total_size;
  84   int relocation_size;
  85   int code_size;
  86   int stub_size;
  87   int consts_size;
  88   int scopes_data_size;
  89   int scopes_pcs_size;
  90   int dependencies_size;
  91   int handler_table_size;
  92   int nul_chk_table_size;
  93   int oops_size;
  94 
  95   void note_nmethod(nmethod* nm) {
  96     nmethod_count += 1;
  97     total_size          += nm->size();
  98     relocation_size     += nm->relocation_size();
  99     code_size           += nm->code_size();
 100     stub_size           += nm->stub_size();
 101     consts_size         += nm->consts_size();
 102     oops_size           += nm->oops_size();
 103     scopes_data_size    += nm->scopes_data_size();
 104     scopes_pcs_size     += nm->scopes_pcs_size();
 105     dependencies_size   += nm->dependencies_size();
 106     handler_table_size  += nm->handler_table_size();
 107     nul_chk_table_size  += nm->nul_chk_table_size();

 108   }
 109   void print_nmethod_stats() {
 110     if (nmethod_count == 0)  return;
 111     tty->print_cr("Statistics for %d bytecoded nmethods:", nmethod_count);
 112     if (total_size != 0)          tty->print_cr(" total in heap  = %d", total_size);
 113     if (relocation_size != 0)     tty->print_cr(" relocation     = %d", relocation_size);
 114     if (code_size != 0)           tty->print_cr(" main code      = %d", code_size);
 115     if (stub_size != 0)           tty->print_cr(" stub code      = %d", stub_size);
 116     if (consts_size != 0)         tty->print_cr(" constants      = %d", consts_size);
 117     if (oops_size != 0)           tty->print_cr(" oops           = %d", oops_size);
 118     if (scopes_data_size != 0)    tty->print_cr(" scopes data    = %d", scopes_data_size);
 119     if (scopes_pcs_size != 0)     tty->print_cr(" scopes pcs     = %d", scopes_pcs_size);
 120     if (dependencies_size != 0)   tty->print_cr(" dependencies   = %d", dependencies_size);
 121     if (handler_table_size != 0)  tty->print_cr(" handler table  = %d", handler_table_size);
 122     if (nul_chk_table_size != 0)  tty->print_cr(" nul chk table  = %d", nul_chk_table_size);

 123   }
 124 
 125   int native_nmethod_count;
 126   int native_total_size;
 127   int native_relocation_size;
 128   int native_code_size;
 129   int native_oops_size;
 130   void note_native_nmethod(nmethod* nm) {
 131     native_nmethod_count += 1;
 132     native_total_size       += nm->size();
 133     native_relocation_size  += nm->relocation_size();
 134     native_code_size        += nm->code_size();
 135     native_oops_size        += nm->oops_size();
 136   }
 137   void print_native_nmethod_stats() {
 138     if (native_nmethod_count == 0)  return;
 139     tty->print_cr("Statistics for %d native nmethods:", native_nmethod_count);
 140     if (native_total_size != 0)       tty->print_cr(" N. total size  = %d", native_total_size);
 141     if (native_relocation_size != 0)  tty->print_cr(" N. relocation  = %d", native_relocation_size);
 142     if (native_code_size != 0)        tty->print_cr(" N. main code   = %d", native_code_size);


 583     NOT_PRODUCT(_has_debug_info = false);
 584     _oops_do_mark_link       = NULL;
 585     _method                  = method;
 586     _entry_bci               = InvocationEntryBci;
 587     _osr_link                = NULL;
 588     _scavenge_root_link      = NULL;
 589     _scavenge_root_state     = 0;
 590     _saved_nmethod_link      = NULL;
 591     _compiler                = NULL;
 592     // We have no exception handler or deopt handler make the
 593     // values something that will never match a pc like the nmethod vtable entry
 594     _exception_offset        = 0;
 595     _deoptimize_offset       = 0;
 596     _deoptimize_mh_offset    = 0;
 597     _orig_pc_offset          = 0;
 598 #ifdef HAVE_DTRACE_H
 599     _trap_offset             = 0;
 600 #endif // def HAVE_DTRACE_H
 601     _stub_offset             = data_offset();
 602     _consts_offset           = data_offset();
 603     _oops_offset             = data_offset();
 604     _scopes_data_offset      = _oops_offset          + round_to(code_buffer->total_oop_size(), oopSize);
 605     _scopes_pcs_offset       = _scopes_data_offset;
 606     _dependencies_offset     = _scopes_pcs_offset;
 607     _handler_table_offset    = _dependencies_offset;
 608     _nul_chk_table_offset    = _handler_table_offset;
 609     _nmethod_end_offset      = _nul_chk_table_offset;
 610     _compile_id              = 0;  // default
 611     _comp_level              = CompLevel_none;
 612     _entry_point             = instructions_begin();
 613     _verified_entry_point    = instructions_begin() + offsets->value(CodeOffsets::Verified_Entry);
 614     _osr_entry_point         = NULL;
 615     _exception_cache         = NULL;
 616     _pc_desc_cache.reset_to(NULL);
 617 
 618     flags.clear();
 619     flags.state              = alive;
 620     _markedForDeoptimization = 0;
 621 
 622     _lock_count = 0;
 623     _stack_traversal_mark    = 0;
 624 


 674     assert_locked_or_safepoint(CodeCache_lock);
 675 
 676     NOT_PRODUCT(_has_debug_info = false);
 677     _oops_do_mark_link       = NULL;
 678     _method                  = method;
 679     _entry_bci               = InvocationEntryBci;
 680     _osr_link                = NULL;
 681     _scavenge_root_link      = NULL;
 682     _scavenge_root_state     = 0;
 683     _compiler                = NULL;
 684     // We have no exception handler or deopt handler make the
 685     // values something that will never match a pc like the nmethod vtable entry
 686     _exception_offset        = 0;
 687     _deoptimize_offset       = 0;
 688     _deoptimize_mh_offset    = 0;
 689     _unwind_handler_offset   = -1;
 690     _trap_offset             = offsets->value(CodeOffsets::Dtrace_trap);
 691     _orig_pc_offset          = 0;
 692     _stub_offset             = data_offset();
 693     _consts_offset           = data_offset();
 694     _oops_offset             = data_offset();
 695     _scopes_data_offset      = _oops_offset          + round_to(code_buffer->total_oop_size(), oopSize);
 696     _scopes_pcs_offset       = _scopes_data_offset;
 697     _dependencies_offset     = _scopes_pcs_offset;
 698     _handler_table_offset    = _dependencies_offset;
 699     _nul_chk_table_offset    = _handler_table_offset;
 700     _nmethod_end_offset      = _nul_chk_table_offset;
 701     _compile_id              = 0;  // default
 702     _comp_level              = CompLevel_none;
 703     _entry_point             = instructions_begin();
 704     _verified_entry_point    = instructions_begin() + offsets->value(CodeOffsets::Verified_Entry);
 705     _osr_entry_point         = NULL;
 706     _exception_cache         = NULL;
 707     _pc_desc_cache.reset_to(NULL);
 708 
 709     flags.clear();
 710     flags.state              = alive;
 711     _markedForDeoptimization = 0;
 712 
 713     _lock_count = 0;
 714     _stack_traversal_mark    = 0;
 715 


 790     _osr_link                = NULL;
 791     _scavenge_root_link      = NULL;
 792     _scavenge_root_state     = 0;
 793     _compiler                = compiler;
 794     _orig_pc_offset          = orig_pc_offset;
 795 #ifdef HAVE_DTRACE_H
 796     _trap_offset             = 0;
 797 #endif // def HAVE_DTRACE_H
 798     _stub_offset             = instructions_offset() + code_buffer->total_offset_of(code_buffer->stubs()->start());
 799 
 800     // Exception handler and deopt handler are in the stub section
 801     _exception_offset        = _stub_offset + offsets->value(CodeOffsets::Exceptions);
 802     _deoptimize_offset       = _stub_offset + offsets->value(CodeOffsets::Deopt);
 803     _deoptimize_mh_offset    = _stub_offset + offsets->value(CodeOffsets::DeoptMH);
 804     if (offsets->value(CodeOffsets::UnwindHandler) != -1) {
 805       _unwind_handler_offset   = instructions_offset() + offsets->value(CodeOffsets::UnwindHandler);
 806     } else {
 807       _unwind_handler_offset   = -1;
 808     }
 809     _consts_offset           = instructions_offset() + code_buffer->total_offset_of(code_buffer->consts()->start());
 810     _oops_offset             = data_offset();
 811     _scopes_data_offset      = _oops_offset          + round_to(code_buffer->total_oop_size (), oopSize);
 812     _scopes_pcs_offset       = _scopes_data_offset   + round_to(debug_info->data_size       (), oopSize);
 813     _dependencies_offset     = _scopes_pcs_offset    + adjust_pcs_size(debug_info->pcs_size());
 814     _handler_table_offset    = _dependencies_offset  + round_to(dependencies->size_in_bytes (), oopSize);
 815     _nul_chk_table_offset    = _handler_table_offset + round_to(handler_table->size_in_bytes(), oopSize);
 816     _nmethod_end_offset      = _nul_chk_table_offset + round_to(nul_chk_table->size_in_bytes(), oopSize);
 817 
 818     _entry_point             = instructions_begin();
 819     _verified_entry_point    = instructions_begin() + offsets->value(CodeOffsets::Verified_Entry);
 820     _osr_entry_point         = instructions_begin() + offsets->value(CodeOffsets::OSR_Entry);
 821     _exception_cache         = NULL;
 822     _pc_desc_cache.reset_to(scopes_pcs_begin());
 823 
 824     flags.clear();
 825     flags.state              = alive;
 826     _markedForDeoptimization = 0;
 827 
 828     _unload_reported         = false;           // jvmti state
 829 
 830     _lock_count = 0;
 831     _stack_traversal_mark    = 0;


 976     print_relocations();
 977   }
 978   if (PrintDependencies) {
 979     print_dependencies();
 980   }
 981   if (PrintExceptionHandlers) {
 982     print_handler_table();
 983     print_nul_chk_table();
 984   }
 985   if (xtty != NULL) {
 986     xtty->tail("print_nmethod");
 987   }
 988 }
 989 
 990 
 991 void nmethod::set_version(int v) {
 992   flags.version = v;
 993 }
 994 
 995 
 996 // Promote one word from an assembly-time handle to a live embedded oop.
 997 inline void nmethod::initialize_immediate_oop(oop* dest, jobject handle) {
 998   if (handle == NULL ||
 999       // As a special case, IC oops are initialized to 1 or -1.
1000       handle == (jobject) Universe::non_oop_word()) {
1001     (*dest) = (oop) handle;
1002   } else {
1003     (*dest) = JNIHandles::resolve_non_null(handle);
1004   }
1005 }
1006 
1007 
1008 void nmethod::copy_oops(GrowableArray<jobject>* array) {
1009   //assert(oops_size() == 0, "do this handshake just once, please");
1010   int length = array->length();
1011   assert((address)(oops_begin() + length) <= data_end(), "oops big enough");
1012   oop* dest = oops_begin();
1013   for (int index = 0 ; index < length; index++) {
1014     initialize_immediate_oop(&dest[index], array->at(index));
1015   }
1016 
1017   // Now we can fix up all the oops in the code.  We need to do this
1018   // in the code because the assembler uses jobjects as placeholders.
1019   // The code and relocations have already been initialized by the
1020   // CodeBlob constructor, so it is valid even at this early point to
1021   // iterate over relocations and patch the code.
1022   fix_oop_relocations(NULL, NULL, /*initialize_immediates=*/ true);
1023 }
1024 
1025 
1026 bool nmethod::is_at_poll_return(address pc) {
1027   RelocIterator iter(this, pc, pc+1);
1028   while (iter.next()) {
1029     if (iter.type() == relocInfo::poll_return_type)
1030       return true;
1031   }
1032   return false;
1033 }
1034 
1035 
1036 bool nmethod::is_at_poll_or_poll_return(address pc) {
1037   RelocIterator iter(this, pc, pc+1);
1038   while (iter.next()) {
1039     relocInfo::relocType t = iter.type();
1040     if (t == relocInfo::poll_return_type || t == relocInfo::poll_type)
1041       return true;
1042   }
1043   return false;
1044 }
1045 
1046 
1047 void nmethod::fix_oop_relocations(address begin, address end, bool initialize_immediates) {
1048   // re-patch all oop-bearing instructions, just in case some oops moved
1049   RelocIterator iter(this, begin, end);
1050   while (iter.next()) {
1051     if (iter.type() == relocInfo::oop_type) {
1052       oop_Relocation* reloc = iter.oop_reloc();
1053       if (initialize_immediates && reloc->oop_is_immediate()) {
1054         oop* dest = reloc->oop_addr();
1055         initialize_immediate_oop(dest, (jobject) *dest);
1056       }
1057       // Refresh the oop-related bits of this instruction.
1058       reloc->fix_oop_relocation();
1059     }
1060 
1061     // There must not be any interfering patches or breakpoints.
1062     assert(!(iter.type() == relocInfo::breakpoint_type
1063              && iter.breakpoint_reloc()->active()),
1064            "no active breakpoint");
1065   }
1066 }
1067 
1068 
1069 ScopeDesc* nmethod::scope_desc_at(address pc) {
1070   PcDesc* pd = pc_desc_at(pc);
1071   guarantee(pd != NULL, "scope must be present");
1072   return new ScopeDesc(this, pd->scope_decode_offset(),
1073                        pd->obj_decode_offset(), pd->should_reexecute(),
1074                        pd->return_oop());
1075 }
1076 
1077 
1078 void nmethod::clear_inline_caches() {
1079   assert(SafepointSynchronize::is_at_safepoint(), "cleaning of IC's only allowed at safepoint");
1080   if (is_zombie()) {
1081     return;
1082   }
1083 
1084   RelocIterator iter(this);
1085   while (iter.next()) {
1086     iter.reloc()->clear_inline_cache();
1087   }
1088 }


2341   if (size              () > 0) tty->print_cr(" total in heap  [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2342                                               (address)this,
2343                                               (address)this + size(),
2344                                               size());
2345   if (relocation_size   () > 0) tty->print_cr(" relocation     [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2346                                               relocation_begin(),
2347                                               relocation_end(),
2348                                               relocation_size());
2349   if (code_size         () > 0) tty->print_cr(" main code      [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2350                                               code_begin(),
2351                                               code_end(),
2352                                               code_size());
2353   if (stub_size         () > 0) tty->print_cr(" stub code      [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2354                                               stub_begin(),
2355                                               stub_end(),
2356                                               stub_size());
2357   if (consts_size       () > 0) tty->print_cr(" constants      [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2358                                               consts_begin(),
2359                                               consts_end(),
2360                                               consts_size());
2361   if (oops_size         () > 0) tty->print_cr(" oops           [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2362                                               oops_begin(),
2363                                               oops_end(),
2364                                               oops_size());
2365   if (scopes_data_size  () > 0) tty->print_cr(" scopes data    [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2366                                               scopes_data_begin(),
2367                                               scopes_data_end(),
2368                                               scopes_data_size());
2369   if (scopes_pcs_size   () > 0) tty->print_cr(" scopes pcs     [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2370                                               scopes_pcs_begin(),
2371                                               scopes_pcs_end(),
2372                                               scopes_pcs_size());
2373   if (dependencies_size () > 0) tty->print_cr(" dependencies   [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2374                                               dependencies_begin(),
2375                                               dependencies_end(),
2376                                               dependencies_size());
2377   if (handler_table_size() > 0) tty->print_cr(" handler table  [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2378                                               handler_table_begin(),
2379                                               handler_table_end(),
2380                                               handler_table_size());
2381   if (nul_chk_table_size() > 0) tty->print_cr(" nul chk table  [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2382                                               nul_chk_table_begin(),
2383                                               nul_chk_table_end(),
2384                                               nul_chk_table_size());


src/share/vm/code/nmethod.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File