970 if( nm != NULL ) {
971 // Verify that inline caches pointing to both zombie and not_entrant methods are clean
972 if (!nm->is_in_use() || (nm->method()->code() != nm)) {
973 assert(ic->is_clean(), "IC should be clean");
974 }
975 }
976 break;
977 }
978 case relocInfo::static_call_type: {
979 CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc());
980 CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination());
981 nmethod* nm = cb->as_nmethod_or_null();
982 if( nm != NULL ) {
983 // Verify that inline caches pointing to both zombie and not_entrant methods are clean
984 if (!nm->is_in_use() || (nm->method()->code() != nm)) {
985 assert(csc->is_clean(), "IC should be clean");
986 }
987 }
988 break;
989 }
990 }
991 }
992 }
993
994 // This is a private interface with the sweeper.
995 void nmethod::mark_as_seen_on_stack() {
996 assert(is_alive(), "Must be an alive method");
997 // Set the traversal mark to ensure that the sweeper does 2
998 // cleaning passes before moving to zombie.
999 set_stack_traversal_mark(NMethodSweeper::traversal_count());
1000 }
1001
1002 // Tell if a non-entrant method can be converted to a zombie (i.e.,
1003 // there are no activations on the stack, not in use by the VM,
1004 // and not in use by the ServiceThread)
1005 bool nmethod::can_convert_to_zombie() {
1006 assert(is_not_entrant(), "must be a non-entrant method");
1007
1008 // Since the nmethod sweeper only does partial sweep the sweeper's traversal
1009 // count can be greater than the stack traversal count before it hits the
2170 if( !method() ) return; // Runtime stubs have no scope
2171 if (method()->is_native()) return; // Ignore stub methods.
2172 // iterate through all interrupt point
2173 // and verify the debug information is valid.
2174 RelocIterator iter((nmethod*)this);
2175 while (iter.next()) {
2176 address stub = NULL;
2177 switch (iter.type()) {
2178 case relocInfo::virtual_call_type:
2179 verify_interrupt_point(iter.addr());
2180 break;
2181 case relocInfo::opt_virtual_call_type:
2182 stub = iter.opt_virtual_call_reloc()->static_stub(false);
2183 verify_interrupt_point(iter.addr());
2184 break;
2185 case relocInfo::static_call_type:
2186 stub = iter.static_call_reloc()->static_stub(false);
2187 //verify_interrupt_point(iter.addr());
2188 break;
2189 case relocInfo::runtime_call_type:
2190 case relocInfo::runtime_call_w_cp_type:
2191 address destination = iter.reloc()->value();
2192 // Right now there is no way to find out which entries support
2193 // an interrupt point. It would be nice if we had this
2194 // information in a table.
2195 break;
2196 }
2197 assert(stub == NULL || stub_contains(stub), "static call stub outside stub section");
2198 }
2199 }
2200
2201
2202 // -----------------------------------------------------------------------------
2203 // Non-product code
2204 #ifndef PRODUCT
2205
2206 class DebugScavengeRoot: public OopClosure {
2207 nmethod* _nm;
2208 bool _ok;
2209 public:
2210 DebugScavengeRoot(nmethod* nm) : _nm(nm), _ok(true) { }
2211 bool ok() { return _ok; }
2212 virtual void do_oop(oop* p) {
2213 if ((*p) == NULL || !(*p)->is_scavengable()) return;
2214 if (_ok) {
2215 _nm->print_nmethod(true);
2216 _ok = false;
2472 return st.as_string();
2473 }
2474 case relocInfo::static_call_type: {
2475 stringStream st;
2476 st.print_raw("static_call");
2477 static_call_Relocation* r = iter.static_call_reloc();
2478 Method* m = r->method_value();
2479 if (m != NULL) {
2480 assert(m->is_method(), "");
2481 m->print_short_name(&st);
2482 }
2483 return st.as_string();
2484 }
2485 case relocInfo::static_stub_type: return "static_stub";
2486 case relocInfo::external_word_type: return "external_word";
2487 case relocInfo::internal_word_type: return "internal_word";
2488 case relocInfo::section_word_type: return "section_word";
2489 case relocInfo::poll_type: return "poll";
2490 case relocInfo::poll_return_type: return "poll_return";
2491 case relocInfo::type_mask: return "type_bit_mask";
2492 }
2493 }
2494 return have_one ? "other" : NULL;
2495 }
2496
2497 // Return a the last scope in (begin..end]
2498 ScopeDesc* nmethod::scope_desc_in(address begin, address end) {
2499 PcDesc* p = pc_desc_near(begin+1);
2500 if (p != NULL && p->real_pc(this) <= end) {
2501 return new ScopeDesc(this, p->scope_decode_offset(),
2502 p->obj_decode_offset(), p->should_reexecute(), p->rethrow_exception(),
2503 p->return_oop());
2504 }
2505 return NULL;
2506 }
2507
2508 void nmethod::print_nmethod_labels(outputStream* stream, address block_begin) const {
2509 if (block_begin == entry_point()) stream->print_cr("[Entry Point]");
2510 if (block_begin == verified_entry_point()) stream->print_cr("[Verified Entry Point]");
2511 if (JVMCI_ONLY(_exception_offset >= 0 &&) block_begin == exception_begin()) stream->print_cr("[Exception Handler]");
2657 Bytecode_invoke invoke(sd->method(), sd->bci());
2658 st->print(" ");
2659 if (invoke.name() != NULL)
2660 invoke.name()->print_symbol_on(st);
2661 else
2662 st->print("<UNKNOWN>");
2663 break;
2664 }
2665 case Bytecodes::_getfield:
2666 case Bytecodes::_putfield:
2667 case Bytecodes::_getstatic:
2668 case Bytecodes::_putstatic:
2669 {
2670 Bytecode_field field(sd->method(), sd->bci());
2671 st->print(" ");
2672 if (field.name() != NULL)
2673 field.name()->print_symbol_on(st);
2674 else
2675 st->print("<UNKNOWN>");
2676 }
2677 }
2678 }
2679 st->print(" {reexecute=%d rethrow=%d return_oop=%d}", sd->should_reexecute(), sd->rethrow_exception(), sd->return_oop());
2680 }
2681
2682 // Print all scopes
2683 for (;sd != NULL; sd = sd->sender()) {
2684 st->move_to(column);
2685 st->print("; -");
2686 if (sd->method() == NULL) {
2687 st->print("method is NULL");
2688 } else {
2689 sd->method()->print_short_name(st);
2690 }
2691 int lineno = sd->method()->line_number_from_bci(sd->bci());
2692 if (lineno != -1) {
2693 st->print("@%d (line %d)", sd->bci(), lineno);
2694 } else {
2695 st->print("@%d", sd->bci());
2696 }
2964 if (!this->is_compiled_by_jvmci()) {
2965 return NULL;
2966 }
2967 oop installedCode = this->jvmci_installed_code();
2968 if (installedCode != NULL) {
2969 oop installedCodeName = NULL;
2970 if (installedCode->is_a(InstalledCode::klass())) {
2971 installedCodeName = InstalledCode::name(installedCode);
2972 }
2973 if (installedCodeName != NULL) {
2974 return java_lang_String::as_utf8_string(installedCodeName, buf, (int)buflen);
2975 } else {
2976 jio_snprintf(buf, buflen, "null");
2977 return buf;
2978 }
2979 }
2980 jio_snprintf(buf, buflen, "noInstalledCode");
2981 return buf;
2982 }
2983 #endif
2984
|
970 if( nm != NULL ) {
971 // Verify that inline caches pointing to both zombie and not_entrant methods are clean
972 if (!nm->is_in_use() || (nm->method()->code() != nm)) {
973 assert(ic->is_clean(), "IC should be clean");
974 }
975 }
976 break;
977 }
978 case relocInfo::static_call_type: {
979 CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc());
980 CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination());
981 nmethod* nm = cb->as_nmethod_or_null();
982 if( nm != NULL ) {
983 // Verify that inline caches pointing to both zombie and not_entrant methods are clean
984 if (!nm->is_in_use() || (nm->method()->code() != nm)) {
985 assert(csc->is_clean(), "IC should be clean");
986 }
987 }
988 break;
989 }
990 default:
991 break;
992 }
993 }
994 }
995
996 // This is a private interface with the sweeper.
997 void nmethod::mark_as_seen_on_stack() {
998 assert(is_alive(), "Must be an alive method");
999 // Set the traversal mark to ensure that the sweeper does 2
1000 // cleaning passes before moving to zombie.
1001 set_stack_traversal_mark(NMethodSweeper::traversal_count());
1002 }
1003
1004 // Tell if a non-entrant method can be converted to a zombie (i.e.,
1005 // there are no activations on the stack, not in use by the VM,
1006 // and not in use by the ServiceThread)
1007 bool nmethod::can_convert_to_zombie() {
1008 assert(is_not_entrant(), "must be a non-entrant method");
1009
1010 // Since the nmethod sweeper only does partial sweep the sweeper's traversal
1011 // count can be greater than the stack traversal count before it hits the
2172 if( !method() ) return; // Runtime stubs have no scope
2173 if (method()->is_native()) return; // Ignore stub methods.
2174 // iterate through all interrupt point
2175 // and verify the debug information is valid.
2176 RelocIterator iter((nmethod*)this);
2177 while (iter.next()) {
2178 address stub = NULL;
2179 switch (iter.type()) {
2180 case relocInfo::virtual_call_type:
2181 verify_interrupt_point(iter.addr());
2182 break;
2183 case relocInfo::opt_virtual_call_type:
2184 stub = iter.opt_virtual_call_reloc()->static_stub(false);
2185 verify_interrupt_point(iter.addr());
2186 break;
2187 case relocInfo::static_call_type:
2188 stub = iter.static_call_reloc()->static_stub(false);
2189 //verify_interrupt_point(iter.addr());
2190 break;
2191 case relocInfo::runtime_call_type:
2192 case relocInfo::runtime_call_w_cp_type: {
2193 address destination = iter.reloc()->value();
2194 // Right now there is no way to find out which entries support
2195 // an interrupt point. It would be nice if we had this
2196 // information in a table.
2197 break;
2198 }
2199 default:
2200 break;
2201 }
2202 assert(stub == NULL || stub_contains(stub), "static call stub outside stub section");
2203 }
2204 }
2205
2206
2207 // -----------------------------------------------------------------------------
2208 // Non-product code
2209 #ifndef PRODUCT
2210
2211 class DebugScavengeRoot: public OopClosure {
2212 nmethod* _nm;
2213 bool _ok;
2214 public:
2215 DebugScavengeRoot(nmethod* nm) : _nm(nm), _ok(true) { }
2216 bool ok() { return _ok; }
2217 virtual void do_oop(oop* p) {
2218 if ((*p) == NULL || !(*p)->is_scavengable()) return;
2219 if (_ok) {
2220 _nm->print_nmethod(true);
2221 _ok = false;
2477 return st.as_string();
2478 }
2479 case relocInfo::static_call_type: {
2480 stringStream st;
2481 st.print_raw("static_call");
2482 static_call_Relocation* r = iter.static_call_reloc();
2483 Method* m = r->method_value();
2484 if (m != NULL) {
2485 assert(m->is_method(), "");
2486 m->print_short_name(&st);
2487 }
2488 return st.as_string();
2489 }
2490 case relocInfo::static_stub_type: return "static_stub";
2491 case relocInfo::external_word_type: return "external_word";
2492 case relocInfo::internal_word_type: return "internal_word";
2493 case relocInfo::section_word_type: return "section_word";
2494 case relocInfo::poll_type: return "poll";
2495 case relocInfo::poll_return_type: return "poll_return";
2496 case relocInfo::type_mask: return "type_bit_mask";
2497
2498 default:
2499 break;
2500 }
2501 }
2502 return have_one ? "other" : NULL;
2503 }
2504
2505 // Return a the last scope in (begin..end]
2506 ScopeDesc* nmethod::scope_desc_in(address begin, address end) {
2507 PcDesc* p = pc_desc_near(begin+1);
2508 if (p != NULL && p->real_pc(this) <= end) {
2509 return new ScopeDesc(this, p->scope_decode_offset(),
2510 p->obj_decode_offset(), p->should_reexecute(), p->rethrow_exception(),
2511 p->return_oop());
2512 }
2513 return NULL;
2514 }
2515
2516 void nmethod::print_nmethod_labels(outputStream* stream, address block_begin) const {
2517 if (block_begin == entry_point()) stream->print_cr("[Entry Point]");
2518 if (block_begin == verified_entry_point()) stream->print_cr("[Verified Entry Point]");
2519 if (JVMCI_ONLY(_exception_offset >= 0 &&) block_begin == exception_begin()) stream->print_cr("[Exception Handler]");
2665 Bytecode_invoke invoke(sd->method(), sd->bci());
2666 st->print(" ");
2667 if (invoke.name() != NULL)
2668 invoke.name()->print_symbol_on(st);
2669 else
2670 st->print("<UNKNOWN>");
2671 break;
2672 }
2673 case Bytecodes::_getfield:
2674 case Bytecodes::_putfield:
2675 case Bytecodes::_getstatic:
2676 case Bytecodes::_putstatic:
2677 {
2678 Bytecode_field field(sd->method(), sd->bci());
2679 st->print(" ");
2680 if (field.name() != NULL)
2681 field.name()->print_symbol_on(st);
2682 else
2683 st->print("<UNKNOWN>");
2684 }
2685 default:
2686 break;
2687 }
2688 }
2689 st->print(" {reexecute=%d rethrow=%d return_oop=%d}", sd->should_reexecute(), sd->rethrow_exception(), sd->return_oop());
2690 }
2691
2692 // Print all scopes
2693 for (;sd != NULL; sd = sd->sender()) {
2694 st->move_to(column);
2695 st->print("; -");
2696 if (sd->method() == NULL) {
2697 st->print("method is NULL");
2698 } else {
2699 sd->method()->print_short_name(st);
2700 }
2701 int lineno = sd->method()->line_number_from_bci(sd->bci());
2702 if (lineno != -1) {
2703 st->print("@%d (line %d)", sd->bci(), lineno);
2704 } else {
2705 st->print("@%d", sd->bci());
2706 }
2974 if (!this->is_compiled_by_jvmci()) {
2975 return NULL;
2976 }
2977 oop installedCode = this->jvmci_installed_code();
2978 if (installedCode != NULL) {
2979 oop installedCodeName = NULL;
2980 if (installedCode->is_a(InstalledCode::klass())) {
2981 installedCodeName = InstalledCode::name(installedCode);
2982 }
2983 if (installedCodeName != NULL) {
2984 return java_lang_String::as_utf8_string(installedCodeName, buf, (int)buflen);
2985 } else {
2986 jio_snprintf(buf, buflen, "null");
2987 return buf;
2988 }
2989 }
2990 jio_snprintf(buf, buflen, "noInstalledCode");
2991 return buf;
2992 }
2993 #endif
|