971 }
972 if (PrintExceptionHandlers) {
973 print_handler_table();
974 print_nul_chk_table();
975 }
976 if (xtty != NULL) {
977 xtty->tail("print_nmethod");
978 }
979 }
980
981
982 void nmethod::set_version(int v) {
983 flags.version = v;
984 }
985
986
987 ScopeDesc* nmethod::scope_desc_at(address pc) {
988 PcDesc* pd = pc_desc_at(pc);
989 guarantee(pd != NULL, "scope must be present");
990 return new ScopeDesc(this, pd->scope_decode_offset(),
991 pd->obj_decode_offset(), pd->should_reexecute());
992 }
993
994
995 void nmethod::clear_inline_caches() {
996 assert(SafepointSynchronize::is_at_safepoint(), "cleaning of IC's only allowed at safepoint");
997 if (is_zombie()) {
998 return;
999 }
1000
1001 RelocIterator iter(this);
1002 while (iter.next()) {
1003 iter.reloc()->clear_inline_cache();
1004 }
1005 }
1006
1007
1008 void nmethod::cleanup_inline_caches() {
1009
1010 assert(SafepointSynchronize::is_at_safepoint() &&
1011 !CompiledIC_lock->is_locked() &&
2142 }
2143
2144
2145 void nmethod::verify_interrupt_point(address call_site) {
2146 // This code does not work in release mode since
2147 // owns_lock only is available in debug mode.
2148 CompiledIC* ic = NULL;
2149 Thread *cur = Thread::current();
2150 if (CompiledIC_lock->owner() == cur ||
2151 ((cur->is_VM_thread() || cur->is_ConcurrentGC_thread()) &&
2152 SafepointSynchronize::is_at_safepoint())) {
2153 ic = CompiledIC_at(call_site);
2154 CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
2155 } else {
2156 MutexLocker ml_verify (CompiledIC_lock);
2157 ic = CompiledIC_at(call_site);
2158 }
2159 PcDesc* pd = pc_desc_at(ic->end_of_call());
2160 assert(pd != NULL, "PcDesc must exist");
2161 for (ScopeDesc* sd = new ScopeDesc(this, pd->scope_decode_offset(),
2162 pd->obj_decode_offset(), pd->should_reexecute());
2163 !sd->is_top(); sd = sd->sender()) {
2164 sd->verify();
2165 }
2166 }
2167
2168 void nmethod::verify_scopes() {
2169 if( !method() ) return; // Runtime stubs have no scope
2170 if (method()->is_native()) return; // Ignore stub methods.
2171 // iterate through all interrupt point
2172 // and verify the debug information is valid.
2173 RelocIterator iter((nmethod*)this);
2174 while (iter.next()) {
2175 address stub = NULL;
2176 switch (iter.type()) {
2177 case relocInfo::virtual_call_type:
2178 verify_interrupt_point(iter.addr());
2179 break;
2180 case relocInfo::opt_virtual_call_type:
2181 stub = iter.opt_virtual_call_reloc()->static_stub();
2182 verify_interrupt_point(iter.addr());
2407 case relocInfo::opt_virtual_call_type: return "optimized virtual_call";
2408 case relocInfo::static_call_type: return "static_call";
2409 case relocInfo::static_stub_type: return "static_stub";
2410 case relocInfo::runtime_call_type: return "runtime_call";
2411 case relocInfo::external_word_type: return "external_word";
2412 case relocInfo::internal_word_type: return "internal_word";
2413 case relocInfo::section_word_type: return "section_word";
2414 case relocInfo::poll_type: return "poll";
2415 case relocInfo::poll_return_type: return "poll_return";
2416 case relocInfo::type_mask: return "type_bit_mask";
2417 }
2418 }
2419 return have_one ? "other" : NULL;
2420 }
2421
2422 // Return a the last scope in (begin..end]
2423 ScopeDesc* nmethod::scope_desc_in(address begin, address end) {
2424 PcDesc* p = pc_desc_near(begin+1);
2425 if (p != NULL && p->real_pc(this) <= end) {
2426 return new ScopeDesc(this, p->scope_decode_offset(),
2427 p->obj_decode_offset(), p->should_reexecute());
2428 }
2429 return NULL;
2430 }
2431
2432 void nmethod::print_nmethod_labels(outputStream* stream, address block_begin) {
2433 if (block_begin == entry_point()) stream->print_cr("[Entry Point]");
2434 if (block_begin == verified_entry_point()) stream->print_cr("[Verified Entry Point]");
2435 if (block_begin == exception_begin()) stream->print_cr("[Exception Handler]");
2436 if (block_begin == stub_begin()) stream->print_cr("[Stub Code]");
2437 if (block_begin == deopt_handler_begin()) stream->print_cr("[Deopt Handler Code]");
2438 if (block_begin == deopt_mh_handler_begin()) stream->print_cr("[Deopt MH Handler Code]");
2439 if (block_begin == consts_begin()) stream->print_cr("[Constants]");
2440 if (block_begin == entry_point()) {
2441 methodHandle m = method();
2442 if (m.not_null()) {
2443 stream->print(" # ");
2444 m->print_value_on(stream);
2445 stream->cr();
2446 }
2447 if (m.not_null() && !is_osr_method()) {
|
971 }
972 if (PrintExceptionHandlers) {
973 print_handler_table();
974 print_nul_chk_table();
975 }
976 if (xtty != NULL) {
977 xtty->tail("print_nmethod");
978 }
979 }
980
981
982 void nmethod::set_version(int v) {
983 flags.version = v;
984 }
985
986
987 ScopeDesc* nmethod::scope_desc_at(address pc) {
988 PcDesc* pd = pc_desc_at(pc);
989 guarantee(pd != NULL, "scope must be present");
990 return new ScopeDesc(this, pd->scope_decode_offset(),
991 pd->obj_decode_offset(), pd->should_reexecute(),
992 pd->return_oop());
993 }
994
995
996 void nmethod::clear_inline_caches() {
997 assert(SafepointSynchronize::is_at_safepoint(), "cleaning of IC's only allowed at safepoint");
998 if (is_zombie()) {
999 return;
1000 }
1001
1002 RelocIterator iter(this);
1003 while (iter.next()) {
1004 iter.reloc()->clear_inline_cache();
1005 }
1006 }
1007
1008
1009 void nmethod::cleanup_inline_caches() {
1010
1011 assert(SafepointSynchronize::is_at_safepoint() &&
1012 !CompiledIC_lock->is_locked() &&
2143 }
2144
2145
2146 void nmethod::verify_interrupt_point(address call_site) {
2147 // This code does not work in release mode since
2148 // owns_lock only is available in debug mode.
2149 CompiledIC* ic = NULL;
2150 Thread *cur = Thread::current();
2151 if (CompiledIC_lock->owner() == cur ||
2152 ((cur->is_VM_thread() || cur->is_ConcurrentGC_thread()) &&
2153 SafepointSynchronize::is_at_safepoint())) {
2154 ic = CompiledIC_at(call_site);
2155 CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
2156 } else {
2157 MutexLocker ml_verify (CompiledIC_lock);
2158 ic = CompiledIC_at(call_site);
2159 }
2160 PcDesc* pd = pc_desc_at(ic->end_of_call());
2161 assert(pd != NULL, "PcDesc must exist");
2162 for (ScopeDesc* sd = new ScopeDesc(this, pd->scope_decode_offset(),
2163 pd->obj_decode_offset(), pd->should_reexecute(),
2164 pd->return_oop());
2165 !sd->is_top(); sd = sd->sender()) {
2166 sd->verify();
2167 }
2168 }
2169
2170 void nmethod::verify_scopes() {
2171 if( !method() ) return; // Runtime stubs have no scope
2172 if (method()->is_native()) return; // Ignore stub methods.
2173 // iterate through all interrupt point
2174 // and verify the debug information is valid.
2175 RelocIterator iter((nmethod*)this);
2176 while (iter.next()) {
2177 address stub = NULL;
2178 switch (iter.type()) {
2179 case relocInfo::virtual_call_type:
2180 verify_interrupt_point(iter.addr());
2181 break;
2182 case relocInfo::opt_virtual_call_type:
2183 stub = iter.opt_virtual_call_reloc()->static_stub();
2184 verify_interrupt_point(iter.addr());
2409 case relocInfo::opt_virtual_call_type: return "optimized virtual_call";
2410 case relocInfo::static_call_type: return "static_call";
2411 case relocInfo::static_stub_type: return "static_stub";
2412 case relocInfo::runtime_call_type: return "runtime_call";
2413 case relocInfo::external_word_type: return "external_word";
2414 case relocInfo::internal_word_type: return "internal_word";
2415 case relocInfo::section_word_type: return "section_word";
2416 case relocInfo::poll_type: return "poll";
2417 case relocInfo::poll_return_type: return "poll_return";
2418 case relocInfo::type_mask: return "type_bit_mask";
2419 }
2420 }
2421 return have_one ? "other" : NULL;
2422 }
2423
2424 // Return a the last scope in (begin..end]
2425 ScopeDesc* nmethod::scope_desc_in(address begin, address end) {
2426 PcDesc* p = pc_desc_near(begin+1);
2427 if (p != NULL && p->real_pc(this) <= end) {
2428 return new ScopeDesc(this, p->scope_decode_offset(),
2429 p->obj_decode_offset(), p->should_reexecute(),
2430 p->return_oop());
2431 }
2432 return NULL;
2433 }
2434
2435 void nmethod::print_nmethod_labels(outputStream* stream, address block_begin) {
2436 if (block_begin == entry_point()) stream->print_cr("[Entry Point]");
2437 if (block_begin == verified_entry_point()) stream->print_cr("[Verified Entry Point]");
2438 if (block_begin == exception_begin()) stream->print_cr("[Exception Handler]");
2439 if (block_begin == stub_begin()) stream->print_cr("[Stub Code]");
2440 if (block_begin == deopt_handler_begin()) stream->print_cr("[Deopt Handler Code]");
2441 if (block_begin == deopt_mh_handler_begin()) stream->print_cr("[Deopt MH Handler Code]");
2442 if (block_begin == consts_begin()) stream->print_cr("[Constants]");
2443 if (block_begin == entry_point()) {
2444 methodHandle m = method();
2445 if (m.not_null()) {
2446 stream->print(" # ");
2447 m->print_value_on(stream);
2448 stream->cr();
2449 }
2450 if (m.not_null() && !is_osr_method()) {
|