2142 // Verify IC only when nmethod installation is finished.
2143 bool is_installed = (method()->code() == this) // nmethod is in state 'in_use' and installed
2144 || !this->is_in_use(); // nmethod is installed, but not in 'in_use' state
2145 if (is_installed) {
2146 Thread *cur = Thread::current();
2147 if (CompiledIC_lock->owner() == cur ||
2148 ((cur->is_VM_thread() || cur->is_ConcurrentGC_thread()) &&
2149 SafepointSynchronize::is_at_safepoint())) {
2150 CompiledIC_at(this, call_site);
2151 CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
2152 } else {
2153 MutexLocker ml_verify (CompiledIC_lock);
2154 CompiledIC_at(this, call_site);
2155 }
2156 }
2157
2158 PcDesc* pd = pc_desc_at(nativeCall_at(call_site)->return_address());
2159 assert(pd != NULL, "PcDesc must exist");
2160 for (ScopeDesc* sd = new ScopeDesc(this, pd->scope_decode_offset(),
2161 pd->obj_decode_offset(), pd->should_reexecute(), pd->rethrow_exception(),
2162 pd->return_oop());
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(false);
2182 verify_interrupt_point(iter.addr());
2502 return st.as_string();
2503 }
2504 case relocInfo::static_stub_type: return "static_stub";
2505 case relocInfo::external_word_type: return "external_word";
2506 case relocInfo::internal_word_type: return "internal_word";
2507 case relocInfo::section_word_type: return "section_word";
2508 case relocInfo::poll_type: return "poll";
2509 case relocInfo::poll_return_type: return "poll_return";
2510 case relocInfo::type_mask: return "type_bit_mask";
2511 }
2512 }
2513 return have_one ? "other" : NULL;
2514 }
2515
2516 // Return a the last scope in (begin..end]
2517 ScopeDesc* nmethod::scope_desc_in(address begin, address end) {
2518 PcDesc* p = pc_desc_near(begin+1);
2519 if (p != NULL && p->real_pc(this) <= end) {
2520 return new ScopeDesc(this, p->scope_decode_offset(),
2521 p->obj_decode_offset(), p->should_reexecute(), p->rethrow_exception(),
2522 p->return_oop());
2523 }
2524 return NULL;
2525 }
2526
2527 void nmethod::print_nmethod_labels(outputStream* stream, address block_begin) const {
2528 if (block_begin == entry_point()) stream->print_cr("[Entry Point]");
2529 if (block_begin == verified_entry_point()) stream->print_cr("[Verified Entry Point]");
2530 if (JVMCI_ONLY(_exception_offset >= 0 &&) block_begin == exception_begin()) stream->print_cr("[Exception Handler]");
2531 if (block_begin == stub_begin()) stream->print_cr("[Stub Code]");
2532 if (JVMCI_ONLY(_deopt_handler_begin != NULL &&) block_begin == deopt_handler_begin()) stream->print_cr("[Deopt Handler Code]");
2533
2534 if (has_method_handle_invokes())
2535 if (block_begin == deopt_mh_handler_begin()) stream->print_cr("[Deopt MH Handler Code]");
2536
2537 if (block_begin == consts_begin()) stream->print_cr("[Constants]");
2538
2539 if (block_begin == entry_point()) {
2540 methodHandle m = method();
2541 if (m.not_null()) {
2542 stream->print(" # ");
2678 if (invoke.name() != NULL)
2679 invoke.name()->print_symbol_on(st);
2680 else
2681 st->print("<UNKNOWN>");
2682 break;
2683 }
2684 case Bytecodes::_getfield:
2685 case Bytecodes::_putfield:
2686 case Bytecodes::_getstatic:
2687 case Bytecodes::_putstatic:
2688 {
2689 Bytecode_field field(sd->method(), sd->bci());
2690 st->print(" ");
2691 if (field.name() != NULL)
2692 field.name()->print_symbol_on(st);
2693 else
2694 st->print("<UNKNOWN>");
2695 }
2696 }
2697 }
2698 st->print(" {reexecute=%d rethrow=%d return_oop=%d}", sd->should_reexecute(), sd->rethrow_exception(), sd->return_oop());
2699 }
2700
2701 // Print all scopes
2702 for (;sd != NULL; sd = sd->sender()) {
2703 st->move_to(column);
2704 st->print("; -");
2705 if (sd->method() == NULL) {
2706 st->print("method is NULL");
2707 } else {
2708 sd->method()->print_short_name(st);
2709 }
2710 int lineno = sd->method()->line_number_from_bci(sd->bci());
2711 if (lineno != -1) {
2712 st->print("@%d (line %d)", sd->bci(), lineno);
2713 } else {
2714 st->print("@%d", sd->bci());
2715 }
2716 st->cr();
2717 }
2718 }
|
2142 // Verify IC only when nmethod installation is finished.
2143 bool is_installed = (method()->code() == this) // nmethod is in state 'in_use' and installed
2144 || !this->is_in_use(); // nmethod is installed, but not in 'in_use' state
2145 if (is_installed) {
2146 Thread *cur = Thread::current();
2147 if (CompiledIC_lock->owner() == cur ||
2148 ((cur->is_VM_thread() || cur->is_ConcurrentGC_thread()) &&
2149 SafepointSynchronize::is_at_safepoint())) {
2150 CompiledIC_at(this, call_site);
2151 CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
2152 } else {
2153 MutexLocker ml_verify (CompiledIC_lock);
2154 CompiledIC_at(this, call_site);
2155 }
2156 }
2157
2158 PcDesc* pd = pc_desc_at(nativeCall_at(call_site)->return_address());
2159 assert(pd != NULL, "PcDesc must exist");
2160 for (ScopeDesc* sd = new ScopeDesc(this, pd->scope_decode_offset(),
2161 pd->obj_decode_offset(), pd->should_reexecute(), pd->rethrow_exception(),
2162 pd->return_oop(), pd->return_vt());
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(false);
2182 verify_interrupt_point(iter.addr());
2502 return st.as_string();
2503 }
2504 case relocInfo::static_stub_type: return "static_stub";
2505 case relocInfo::external_word_type: return "external_word";
2506 case relocInfo::internal_word_type: return "internal_word";
2507 case relocInfo::section_word_type: return "section_word";
2508 case relocInfo::poll_type: return "poll";
2509 case relocInfo::poll_return_type: return "poll_return";
2510 case relocInfo::type_mask: return "type_bit_mask";
2511 }
2512 }
2513 return have_one ? "other" : NULL;
2514 }
2515
2516 // Return a the last scope in (begin..end]
2517 ScopeDesc* nmethod::scope_desc_in(address begin, address end) {
2518 PcDesc* p = pc_desc_near(begin+1);
2519 if (p != NULL && p->real_pc(this) <= end) {
2520 return new ScopeDesc(this, p->scope_decode_offset(),
2521 p->obj_decode_offset(), p->should_reexecute(), p->rethrow_exception(),
2522 p->return_oop(), p->return_vt());
2523 }
2524 return NULL;
2525 }
2526
2527 void nmethod::print_nmethod_labels(outputStream* stream, address block_begin) const {
2528 if (block_begin == entry_point()) stream->print_cr("[Entry Point]");
2529 if (block_begin == verified_entry_point()) stream->print_cr("[Verified Entry Point]");
2530 if (JVMCI_ONLY(_exception_offset >= 0 &&) block_begin == exception_begin()) stream->print_cr("[Exception Handler]");
2531 if (block_begin == stub_begin()) stream->print_cr("[Stub Code]");
2532 if (JVMCI_ONLY(_deopt_handler_begin != NULL &&) block_begin == deopt_handler_begin()) stream->print_cr("[Deopt Handler Code]");
2533
2534 if (has_method_handle_invokes())
2535 if (block_begin == deopt_mh_handler_begin()) stream->print_cr("[Deopt MH Handler Code]");
2536
2537 if (block_begin == consts_begin()) stream->print_cr("[Constants]");
2538
2539 if (block_begin == entry_point()) {
2540 methodHandle m = method();
2541 if (m.not_null()) {
2542 stream->print(" # ");
2678 if (invoke.name() != NULL)
2679 invoke.name()->print_symbol_on(st);
2680 else
2681 st->print("<UNKNOWN>");
2682 break;
2683 }
2684 case Bytecodes::_getfield:
2685 case Bytecodes::_putfield:
2686 case Bytecodes::_getstatic:
2687 case Bytecodes::_putstatic:
2688 {
2689 Bytecode_field field(sd->method(), sd->bci());
2690 st->print(" ");
2691 if (field.name() != NULL)
2692 field.name()->print_symbol_on(st);
2693 else
2694 st->print("<UNKNOWN>");
2695 }
2696 }
2697 }
2698 st->print(" {reexecute=%d rethrow=%d return_oop=%d return_vt=%d}", sd->should_reexecute(), sd->rethrow_exception(), sd->return_oop(), sd->return_vt());
2699 }
2700
2701 // Print all scopes
2702 for (;sd != NULL; sd = sd->sender()) {
2703 st->move_to(column);
2704 st->print("; -");
2705 if (sd->method() == NULL) {
2706 st->print("method is NULL");
2707 } else {
2708 sd->method()->print_short_name(st);
2709 }
2710 int lineno = sd->method()->line_number_from_bci(sd->bci());
2711 if (lineno != -1) {
2712 st->print("@%d (line %d)", sd->bci(), lineno);
2713 } else {
2714 st->print("@%d", sd->bci());
2715 }
2716 st->cr();
2717 }
2718 }
|