691 {
692 assert(debug_info->oop_recorder() == code_buffer->oop_recorder(), "shared OR");
693 {
694 debug_only(NoSafepointVerifier nsv;)
695 assert_locked_or_safepoint(CodeCache_lock);
696
697 _deopt_handler_begin = (address) this;
698 _deopt_mh_handler_begin = (address) this;
699
700 init_defaults();
701 _entry_bci = entry_bci;
702 _compile_id = compile_id;
703 _comp_level = comp_level;
704 _compiler = compiler;
705 _orig_pc_offset = orig_pc_offset;
706 _hotness_counter = NMethodSweeper::hotness_counter_reset_val();
707
708 // Section offsets
709 _consts_offset = content_offset() + code_buffer->total_offset_of(code_buffer->consts());
710 _stub_offset = content_offset() + code_buffer->total_offset_of(code_buffer->stubs());
711
712 #if INCLUDE_JVMCI
713 _jvmci_installed_code = installed_code();
714 _speculation_log = (instanceOop)speculation_log();
715
716 if (compiler->is_jvmci()) {
717 // JVMCI might not produce any stub sections
718 if (offsets->value(CodeOffsets::Exceptions) != -1) {
719 _exception_offset = code_offset() + offsets->value(CodeOffsets::Exceptions);
720 } else {
721 _exception_offset = -1;
722 }
723 if (offsets->value(CodeOffsets::Deopt) != -1) {
724 _deopt_handler_begin = (address) this + code_offset() + offsets->value(CodeOffsets::Deopt);
725 } else {
726 _deopt_handler_begin = NULL;
727 }
728 if (offsets->value(CodeOffsets::DeoptMH) != -1) {
729 _deopt_mh_handler_begin = (address) this + code_offset() + offsets->value(CodeOffsets::DeoptMH);
730 } else {
2188 if( !method() ) return; // Runtime stubs have no scope
2189 if (method()->is_native()) return; // Ignore stub methods.
2190 // iterate through all interrupt point
2191 // and verify the debug information is valid.
2192 RelocIterator iter((nmethod*)this);
2193 while (iter.next()) {
2194 address stub = NULL;
2195 switch (iter.type()) {
2196 case relocInfo::virtual_call_type:
2197 verify_interrupt_point(iter.addr());
2198 break;
2199 case relocInfo::opt_virtual_call_type:
2200 stub = iter.opt_virtual_call_reloc()->static_stub();
2201 verify_interrupt_point(iter.addr());
2202 break;
2203 case relocInfo::static_call_type:
2204 stub = iter.static_call_reloc()->static_stub();
2205 //verify_interrupt_point(iter.addr());
2206 break;
2207 case relocInfo::runtime_call_type:
2208 address destination = iter.reloc()->value();
2209 // Right now there is no way to find out which entries support
2210 // an interrupt point. It would be nice if we had this
2211 // information in a table.
2212 break;
2213 }
2214 assert(stub == NULL || stub_contains(stub), "static call stub outside stub section");
2215 }
2216 }
2217
2218
2219 // -----------------------------------------------------------------------------
2220 // Non-product code
2221 #ifndef PRODUCT
2222
2223 class DebugScavengeRoot: public OopClosure {
2224 nmethod* _nm;
2225 bool _ok;
2226 public:
2227 DebugScavengeRoot(nmethod* nm) : _nm(nm), _ok(true) { }
2446 case relocInfo::oop_type: {
2447 stringStream st;
2448 oop_Relocation* r = iter.oop_reloc();
2449 oop obj = r->oop_value();
2450 st.print("oop(");
2451 if (obj == NULL) st.print("NULL");
2452 else obj->print_value_on(&st);
2453 st.print(")");
2454 return st.as_string();
2455 }
2456 case relocInfo::metadata_type: {
2457 stringStream st;
2458 metadata_Relocation* r = iter.metadata_reloc();
2459 Metadata* obj = r->metadata_value();
2460 st.print("metadata(");
2461 if (obj == NULL) st.print("NULL");
2462 else obj->print_value_on(&st);
2463 st.print(")");
2464 return st.as_string();
2465 }
2466 case relocInfo::runtime_call_type: {
2467 stringStream st;
2468 st.print("runtime_call");
2469 runtime_call_Relocation* r = iter.runtime_call_reloc();
2470 address dest = r->destination();
2471 CodeBlob* cb = CodeCache::find_blob(dest);
2472 if (cb != NULL) {
2473 st.print(" %s", cb->name());
2474 } else {
2475 ResourceMark rm;
2476 const int buflen = 1024;
2477 char* buf = NEW_RESOURCE_ARRAY(char, buflen);
2478 int offset;
2479 if (os::dll_address_to_function_name(dest, buf, buflen, &offset)) {
2480 st.print(" %s", buf);
2481 if (offset != 0) {
2482 st.print("+%d", offset);
2483 }
2484 }
2485 }
2486 return st.as_string();
2487 }
2488 case relocInfo::virtual_call_type: {
2489 stringStream st;
|
691 {
692 assert(debug_info->oop_recorder() == code_buffer->oop_recorder(), "shared OR");
693 {
694 debug_only(NoSafepointVerifier nsv;)
695 assert_locked_or_safepoint(CodeCache_lock);
696
697 _deopt_handler_begin = (address) this;
698 _deopt_mh_handler_begin = (address) this;
699
700 init_defaults();
701 _entry_bci = entry_bci;
702 _compile_id = compile_id;
703 _comp_level = comp_level;
704 _compiler = compiler;
705 _orig_pc_offset = orig_pc_offset;
706 _hotness_counter = NMethodSweeper::hotness_counter_reset_val();
707
708 // Section offsets
709 _consts_offset = content_offset() + code_buffer->total_offset_of(code_buffer->consts());
710 _stub_offset = content_offset() + code_buffer->total_offset_of(code_buffer->stubs());
711 set_ctable_begin(header_begin() + _consts_offset);
712
713 #if INCLUDE_JVMCI
714 _jvmci_installed_code = installed_code();
715 _speculation_log = (instanceOop)speculation_log();
716
717 if (compiler->is_jvmci()) {
718 // JVMCI might not produce any stub sections
719 if (offsets->value(CodeOffsets::Exceptions) != -1) {
720 _exception_offset = code_offset() + offsets->value(CodeOffsets::Exceptions);
721 } else {
722 _exception_offset = -1;
723 }
724 if (offsets->value(CodeOffsets::Deopt) != -1) {
725 _deopt_handler_begin = (address) this + code_offset() + offsets->value(CodeOffsets::Deopt);
726 } else {
727 _deopt_handler_begin = NULL;
728 }
729 if (offsets->value(CodeOffsets::DeoptMH) != -1) {
730 _deopt_mh_handler_begin = (address) this + code_offset() + offsets->value(CodeOffsets::DeoptMH);
731 } else {
2189 if( !method() ) return; // Runtime stubs have no scope
2190 if (method()->is_native()) return; // Ignore stub methods.
2191 // iterate through all interrupt point
2192 // and verify the debug information is valid.
2193 RelocIterator iter((nmethod*)this);
2194 while (iter.next()) {
2195 address stub = NULL;
2196 switch (iter.type()) {
2197 case relocInfo::virtual_call_type:
2198 verify_interrupt_point(iter.addr());
2199 break;
2200 case relocInfo::opt_virtual_call_type:
2201 stub = iter.opt_virtual_call_reloc()->static_stub();
2202 verify_interrupt_point(iter.addr());
2203 break;
2204 case relocInfo::static_call_type:
2205 stub = iter.static_call_reloc()->static_stub();
2206 //verify_interrupt_point(iter.addr());
2207 break;
2208 case relocInfo::runtime_call_type:
2209 case relocInfo::runtime_call_w_cp_type:
2210 address destination = iter.reloc()->value();
2211 // Right now there is no way to find out which entries support
2212 // an interrupt point. It would be nice if we had this
2213 // information in a table.
2214 break;
2215 }
2216 assert(stub == NULL || stub_contains(stub), "static call stub outside stub section");
2217 }
2218 }
2219
2220
2221 // -----------------------------------------------------------------------------
2222 // Non-product code
2223 #ifndef PRODUCT
2224
2225 class DebugScavengeRoot: public OopClosure {
2226 nmethod* _nm;
2227 bool _ok;
2228 public:
2229 DebugScavengeRoot(nmethod* nm) : _nm(nm), _ok(true) { }
2448 case relocInfo::oop_type: {
2449 stringStream st;
2450 oop_Relocation* r = iter.oop_reloc();
2451 oop obj = r->oop_value();
2452 st.print("oop(");
2453 if (obj == NULL) st.print("NULL");
2454 else obj->print_value_on(&st);
2455 st.print(")");
2456 return st.as_string();
2457 }
2458 case relocInfo::metadata_type: {
2459 stringStream st;
2460 metadata_Relocation* r = iter.metadata_reloc();
2461 Metadata* obj = r->metadata_value();
2462 st.print("metadata(");
2463 if (obj == NULL) st.print("NULL");
2464 else obj->print_value_on(&st);
2465 st.print(")");
2466 return st.as_string();
2467 }
2468 case relocInfo::runtime_call_type:
2469 case relocInfo::runtime_call_w_cp_type: {
2470 stringStream st;
2471 st.print("runtime_call");
2472 CallRelocation* r = (CallRelocation*)iter.reloc();
2473 address dest = r->destination();
2474 CodeBlob* cb = CodeCache::find_blob(dest);
2475 if (cb != NULL) {
2476 st.print(" %s", cb->name());
2477 } else {
2478 ResourceMark rm;
2479 const int buflen = 1024;
2480 char* buf = NEW_RESOURCE_ARRAY(char, buflen);
2481 int offset;
2482 if (os::dll_address_to_function_name(dest, buf, buflen, &offset)) {
2483 st.print(" %s", buf);
2484 if (offset != 0) {
2485 st.print("+%d", offset);
2486 }
2487 }
2488 }
2489 return st.as_string();
2490 }
2491 case relocInfo::virtual_call_type: {
2492 stringStream st;
|