< prev index next >

src/hotspot/share/code/nmethod.cpp

Print this page
rev 60703 : 8227745, 8233915: Enable Escape Analysis for Better Performance in the Presence of JVMTI Agents
Reviewed-by: mdoerr, goetz


2401   metadata_do(&vmc);
2402 }
2403 
2404 
2405 void nmethod::verify_interrupt_point(address call_site) {
2406 
2407   // Verify IC only when nmethod installation is finished.
2408   if (!is_not_installed()) {
2409     if (CompiledICLocker::is_safe(this)) {
2410       CompiledIC_at(this, call_site);
2411     } else {
2412       CompiledICLocker ml_verify(this);
2413       CompiledIC_at(this, call_site);
2414     }
2415   }
2416 
2417   HandleMark hm(Thread::current());
2418 
2419   PcDesc* pd = pc_desc_at(nativeCall_at(call_site)->return_address());
2420   assert(pd != NULL, "PcDesc must exist");
2421   for (ScopeDesc* sd = new ScopeDesc(this, pd->scope_decode_offset(),
2422                                      pd->obj_decode_offset(), pd->should_reexecute(), pd->rethrow_exception(),
2423                                      pd->return_oop());
2424        !sd->is_top(); sd = sd->sender()) {
2425     sd->verify();
2426   }
2427 }
2428 
2429 void nmethod::verify_scopes() {
2430   if( !method() ) return;       // Runtime stubs have no scope
2431   if (method()->is_native()) return; // Ignore stub methods.
2432   // iterate through all interrupt point
2433   // and verify the debug information is valid.
2434   RelocIterator iter((nmethod*)this);
2435   while (iter.next()) {
2436     address stub = NULL;
2437     switch (iter.type()) {
2438       case relocInfo::virtual_call_type:
2439         verify_interrupt_point(iter.addr());
2440         break;
2441       case relocInfo::opt_virtual_call_type:
2442         stub = iter.opt_virtual_call_reloc()->static_stub(false);
2443         verify_interrupt_point(iter.addr());


3038         case relocInfo::static_stub_type:      return "static_stub";
3039         case relocInfo::external_word_type:    return "external_word";
3040         case relocInfo::internal_word_type:    return "internal_word";
3041         case relocInfo::section_word_type:     return "section_word";
3042         case relocInfo::poll_type:             return "poll";
3043         case relocInfo::poll_return_type:      return "poll_return";
3044         case relocInfo::trampoline_stub_type:  return "trampoline_stub";
3045         case relocInfo::type_mask:             return "type_bit_mask";
3046 
3047         default:
3048           break;
3049     }
3050   }
3051   return have_one ? "other" : NULL;
3052 }
3053 
3054 // Return a the last scope in (begin..end]
3055 ScopeDesc* nmethod::scope_desc_in(address begin, address end) {
3056   PcDesc* p = pc_desc_near(begin+1);
3057   if (p != NULL && p->real_pc(this) <= end) {
3058     return new ScopeDesc(this, p->scope_decode_offset(),
3059                          p->obj_decode_offset(), p->should_reexecute(), p->rethrow_exception(),
3060                          p->return_oop());
3061   }
3062   return NULL;
3063 }
3064 
3065 const char* nmethod::nmethod_section_label(address pos) const {
3066   const char* label = NULL;
3067   if (pos == code_begin())                                              label = "[Instructions begin]";
3068   if (pos == entry_point())                                             label = "[Entry Point]";
3069   if (pos == verified_entry_point())                                    label = "[Verified Entry Point]";
3070   if (has_method_handle_invokes() && (pos == deopt_mh_handler_begin())) label = "[Deopt MH Handler Code]";
3071   if (pos == consts_begin() && pos != insts_begin())                    label = "[Constants]";
3072   // Check stub_code before checking exception_handler or deopt_handler.
3073   if (pos == this->stub_begin())                                        label = "[Stub Code]";
3074   if (JVMCI_ONLY(_exception_offset >= 0 &&) pos == exception_begin())           label = "[Exception Handler]";
3075   if (JVMCI_ONLY(_deopt_handler_begin != NULL &&) pos == deopt_handler_begin()) label = "[Deopt Handler Code]";
3076   return label;
3077 }
3078 
3079 void nmethod::print_nmethod_labels(outputStream* stream, address block_begin, bool print_section_labels) const {
3080   if (print_section_labels) {




2401   metadata_do(&vmc);
2402 }
2403 
2404 
2405 void nmethod::verify_interrupt_point(address call_site) {
2406 
2407   // Verify IC only when nmethod installation is finished.
2408   if (!is_not_installed()) {
2409     if (CompiledICLocker::is_safe(this)) {
2410       CompiledIC_at(this, call_site);
2411     } else {
2412       CompiledICLocker ml_verify(this);
2413       CompiledIC_at(this, call_site);
2414     }
2415   }
2416 
2417   HandleMark hm(Thread::current());
2418 
2419   PcDesc* pd = pc_desc_at(nativeCall_at(call_site)->return_address());
2420   assert(pd != NULL, "PcDesc must exist");
2421   for (ScopeDesc* sd = new ScopeDesc(this, pd);


2422        !sd->is_top(); sd = sd->sender()) {
2423     sd->verify();
2424   }
2425 }
2426 
2427 void nmethod::verify_scopes() {
2428   if( !method() ) return;       // Runtime stubs have no scope
2429   if (method()->is_native()) return; // Ignore stub methods.
2430   // iterate through all interrupt point
2431   // and verify the debug information is valid.
2432   RelocIterator iter((nmethod*)this);
2433   while (iter.next()) {
2434     address stub = NULL;
2435     switch (iter.type()) {
2436       case relocInfo::virtual_call_type:
2437         verify_interrupt_point(iter.addr());
2438         break;
2439       case relocInfo::opt_virtual_call_type:
2440         stub = iter.opt_virtual_call_reloc()->static_stub(false);
2441         verify_interrupt_point(iter.addr());


3036         case relocInfo::static_stub_type:      return "static_stub";
3037         case relocInfo::external_word_type:    return "external_word";
3038         case relocInfo::internal_word_type:    return "internal_word";
3039         case relocInfo::section_word_type:     return "section_word";
3040         case relocInfo::poll_type:             return "poll";
3041         case relocInfo::poll_return_type:      return "poll_return";
3042         case relocInfo::trampoline_stub_type:  return "trampoline_stub";
3043         case relocInfo::type_mask:             return "type_bit_mask";
3044 
3045         default:
3046           break;
3047     }
3048   }
3049   return have_one ? "other" : NULL;
3050 }
3051 
3052 // Return a the last scope in (begin..end]
3053 ScopeDesc* nmethod::scope_desc_in(address begin, address end) {
3054   PcDesc* p = pc_desc_near(begin+1);
3055   if (p != NULL && p->real_pc(this) <= end) {
3056     return new ScopeDesc(this, p);


3057   }
3058   return NULL;
3059 }
3060 
3061 const char* nmethod::nmethod_section_label(address pos) const {
3062   const char* label = NULL;
3063   if (pos == code_begin())                                              label = "[Instructions begin]";
3064   if (pos == entry_point())                                             label = "[Entry Point]";
3065   if (pos == verified_entry_point())                                    label = "[Verified Entry Point]";
3066   if (has_method_handle_invokes() && (pos == deopt_mh_handler_begin())) label = "[Deopt MH Handler Code]";
3067   if (pos == consts_begin() && pos != insts_begin())                    label = "[Constants]";
3068   // Check stub_code before checking exception_handler or deopt_handler.
3069   if (pos == this->stub_begin())                                        label = "[Stub Code]";
3070   if (JVMCI_ONLY(_exception_offset >= 0 &&) pos == exception_begin())           label = "[Exception Handler]";
3071   if (JVMCI_ONLY(_deopt_handler_begin != NULL &&) pos == deopt_handler_begin()) label = "[Deopt Handler Code]";
3072   return label;
3073 }
3074 
3075 void nmethod::print_nmethod_labels(outputStream* stream, address block_begin, bool print_section_labels) const {
3076   if (print_section_labels) {


< prev index next >