2259 assert(voc.ok(), "embedded oops must be OK");
2260 Universe::heap()->verify_nmethod(this);
2261
2262 verify_scopes();
2263 }
2264
2265
2266 void nmethod::verify_interrupt_point(address call_site) {
2267 // Verify IC only when nmethod installation is finished.
2268 if (!is_not_installed()) {
2269 if (CompiledICLocker::is_safe(this)) {
2270 CompiledIC_at(this, call_site);
2271 } else {
2272 CompiledICLocker ml_verify(this);
2273 CompiledIC_at(this, call_site);
2274 }
2275 }
2276
2277 PcDesc* pd = pc_desc_at(nativeCall_at(call_site)->return_address());
2278 assert(pd != NULL, "PcDesc must exist");
2279 for (ScopeDesc* sd = new ScopeDesc(this, pd->scope_decode_offset(),
2280 pd->obj_decode_offset(), pd->should_reexecute(), pd->rethrow_exception(),
2281 pd->return_oop());
2282 !sd->is_top(); sd = sd->sender()) {
2283 sd->verify();
2284 }
2285 }
2286
2287 void nmethod::verify_scopes() {
2288 if( !method() ) return; // Runtime stubs have no scope
2289 if (method()->is_native()) return; // Ignore stub methods.
2290 // iterate through all interrupt point
2291 // and verify the debug information is valid.
2292 RelocIterator iter((nmethod*)this);
2293 while (iter.next()) {
2294 address stub = NULL;
2295 switch (iter.type()) {
2296 case relocInfo::virtual_call_type:
2297 verify_interrupt_point(iter.addr());
2298 break;
2299 case relocInfo::opt_virtual_call_type:
2300 stub = iter.opt_virtual_call_reloc()->static_stub(false);
2301 verify_interrupt_point(iter.addr());
2899 case relocInfo::static_stub_type: return "static_stub";
2900 case relocInfo::external_word_type: return "external_word";
2901 case relocInfo::internal_word_type: return "internal_word";
2902 case relocInfo::section_word_type: return "section_word";
2903 case relocInfo::poll_type: return "poll";
2904 case relocInfo::poll_return_type: return "poll_return";
2905 case relocInfo::trampoline_stub_type: return "trampoline_stub";
2906 case relocInfo::type_mask: return "type_bit_mask";
2907
2908 default:
2909 break;
2910 }
2911 }
2912 return have_one ? "other" : NULL;
2913 }
2914
2915 // Return a the last scope in (begin..end]
2916 ScopeDesc* nmethod::scope_desc_in(address begin, address end) {
2917 PcDesc* p = pc_desc_near(begin+1);
2918 if (p != NULL && p->real_pc(this) <= end) {
2919 return new ScopeDesc(this, p->scope_decode_offset(),
2920 p->obj_decode_offset(), p->should_reexecute(), p->rethrow_exception(),
2921 p->return_oop());
2922 }
2923 return NULL;
2924 }
2925
2926 const char* nmethod::nmethod_section_label(address pos) const {
2927 const char* label = NULL;
2928 if (pos == code_begin()) label = "[Instructions begin]";
2929 if (pos == entry_point()) label = "[Entry Point]";
2930 if (pos == verified_entry_point()) label = "[Verified Entry Point]";
2931 if (has_method_handle_invokes() && (pos == deopt_mh_handler_begin())) label = "[Deopt MH Handler Code]";
2932 if (pos == consts_begin() && pos != insts_begin()) label = "[Constants]";
2933 // Check stub_code before checking exception_handler or deopt_handler.
2934 if (pos == this->stub_begin()) label = "[Stub Code]";
2935 if (JVMCI_ONLY(_exception_offset >= 0 &&) pos == exception_begin()) label = "[Exception Handler]";
2936 if (JVMCI_ONLY(_deopt_handler_begin != NULL &&) pos == deopt_handler_begin()) label = "[Deopt Handler Code]";
2937 return label;
2938 }
2939
2940 void nmethod::print_nmethod_labels(outputStream* stream, address block_begin, bool print_section_labels) const {
2941 if (print_section_labels) {
|
2259 assert(voc.ok(), "embedded oops must be OK");
2260 Universe::heap()->verify_nmethod(this);
2261
2262 verify_scopes();
2263 }
2264
2265
2266 void nmethod::verify_interrupt_point(address call_site) {
2267 // Verify IC only when nmethod installation is finished.
2268 if (!is_not_installed()) {
2269 if (CompiledICLocker::is_safe(this)) {
2270 CompiledIC_at(this, call_site);
2271 } else {
2272 CompiledICLocker ml_verify(this);
2273 CompiledIC_at(this, call_site);
2274 }
2275 }
2276
2277 PcDesc* pd = pc_desc_at(nativeCall_at(call_site)->return_address());
2278 assert(pd != NULL, "PcDesc must exist");
2279 for (ScopeDesc* sd = new ScopeDesc(this, pd);
2280 !sd->is_top(); sd = sd->sender()) {
2281 sd->verify();
2282 }
2283 }
2284
2285 void nmethod::verify_scopes() {
2286 if( !method() ) return; // Runtime stubs have no scope
2287 if (method()->is_native()) return; // Ignore stub methods.
2288 // iterate through all interrupt point
2289 // and verify the debug information is valid.
2290 RelocIterator iter((nmethod*)this);
2291 while (iter.next()) {
2292 address stub = NULL;
2293 switch (iter.type()) {
2294 case relocInfo::virtual_call_type:
2295 verify_interrupt_point(iter.addr());
2296 break;
2297 case relocInfo::opt_virtual_call_type:
2298 stub = iter.opt_virtual_call_reloc()->static_stub(false);
2299 verify_interrupt_point(iter.addr());
2897 case relocInfo::static_stub_type: return "static_stub";
2898 case relocInfo::external_word_type: return "external_word";
2899 case relocInfo::internal_word_type: return "internal_word";
2900 case relocInfo::section_word_type: return "section_word";
2901 case relocInfo::poll_type: return "poll";
2902 case relocInfo::poll_return_type: return "poll_return";
2903 case relocInfo::trampoline_stub_type: return "trampoline_stub";
2904 case relocInfo::type_mask: return "type_bit_mask";
2905
2906 default:
2907 break;
2908 }
2909 }
2910 return have_one ? "other" : NULL;
2911 }
2912
2913 // Return a the last scope in (begin..end]
2914 ScopeDesc* nmethod::scope_desc_in(address begin, address end) {
2915 PcDesc* p = pc_desc_near(begin+1);
2916 if (p != NULL && p->real_pc(this) <= end) {
2917 return new ScopeDesc(this, p);
2918 }
2919 return NULL;
2920 }
2921
2922 const char* nmethod::nmethod_section_label(address pos) const {
2923 const char* label = NULL;
2924 if (pos == code_begin()) label = "[Instructions begin]";
2925 if (pos == entry_point()) label = "[Entry Point]";
2926 if (pos == verified_entry_point()) label = "[Verified Entry Point]";
2927 if (has_method_handle_invokes() && (pos == deopt_mh_handler_begin())) label = "[Deopt MH Handler Code]";
2928 if (pos == consts_begin() && pos != insts_begin()) label = "[Constants]";
2929 // Check stub_code before checking exception_handler or deopt_handler.
2930 if (pos == this->stub_begin()) label = "[Stub Code]";
2931 if (JVMCI_ONLY(_exception_offset >= 0 &&) pos == exception_begin()) label = "[Exception Handler]";
2932 if (JVMCI_ONLY(_deopt_handler_begin != NULL &&) pos == deopt_handler_begin()) label = "[Deopt Handler Code]";
2933 return label;
2934 }
2935
2936 void nmethod::print_nmethod_labels(outputStream* stream, address block_begin, bool print_section_labels) const {
2937 if (print_section_labels) {
|