src/hotspot/share/code/nmethod.cpp
changeset 59056 15936b142f86
parent 58777 18c246ad2ff9
child 59248 e92153ed8bdc
equal deleted inserted replaced
59055:57ad70bcf06c 59056:15936b142f86
   962     print(); // print the header part only.
   962     print(); // print the header part only.
   963   }
   963   }
   964 
   964 
   965 #if defined(SUPPORT_DATA_STRUCTS)
   965 #if defined(SUPPORT_DATA_STRUCTS)
   966   if (AbstractDisassembler::show_structs()) {
   966   if (AbstractDisassembler::show_structs()) {
   967     if (printmethod || PrintDebugInfo || CompilerOracle::has_option_string(_method, "PrintDebugInfo")) {
   967     methodHandle mh(Thread::current(), _method);
       
   968     if (printmethod || PrintDebugInfo || CompilerOracle::has_option_string(mh, "PrintDebugInfo")) {
   968       print_scopes();
   969       print_scopes();
   969       tty->print_cr("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ");
   970       tty->print_cr("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ");
   970     }
   971     }
   971     if (printmethod || PrintRelocations || CompilerOracle::has_option_string(_method, "PrintRelocations")) {
   972     if (printmethod || PrintRelocations || CompilerOracle::has_option_string(mh, "PrintRelocations")) {
   972       print_relocations();
   973       print_relocations();
   973       tty->print_cr("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ");
   974       tty->print_cr("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ");
   974     }
   975     }
   975     if (printmethod || PrintDependencies || CompilerOracle::has_option_string(_method, "PrintDependencies")) {
   976     if (printmethod || PrintDependencies || CompilerOracle::has_option_string(mh, "PrintDependencies")) {
   976       print_dependencies();
   977       print_dependencies();
   977       tty->print_cr("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ");
   978       tty->print_cr("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ");
   978     }
   979     }
   979     if (printmethod || PrintExceptionHandlers) {
   980     if (printmethod || PrintExceptionHandlers) {
   980       print_handler_table();
   981       print_handler_table();
  1300     // which the nmethod cannot back out of once entered.
  1301     // which the nmethod cannot back out of once entered.
  1301     // No need for fencing either.
  1302     // No need for fencing either.
  1302     return false;
  1303     return false;
  1303   }
  1304   }
  1304 
  1305 
  1305   // Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below.
  1306   // Make sure the nmethod is not flushed.
  1306   nmethodLocker nml(this);
  1307   nmethodLocker nml(this);
  1307   methodHandle the_method(method());
       
  1308   // This can be called while the system is already at a safepoint which is ok
  1308   // This can be called while the system is already at a safepoint which is ok
  1309   NoSafepointVerifier nsv;
  1309   NoSafepointVerifier nsv;
  1310 
  1310 
  1311   // during patching, depending on the nmethod state we must notify the GC that
  1311   // during patching, depending on the nmethod state we must notify the GC that
  1312   // code has been unloaded, unregistering it. We cannot do this right while
  1312   // code has been unloaded, unregistering it. We cannot do this right while
  3077       stream->print_cr("%s", label);
  3077       stream->print_cr("%s", label);
  3078     }
  3078     }
  3079   }
  3079   }
  3080 
  3080 
  3081   if (block_begin == entry_point()) {
  3081   if (block_begin == entry_point()) {
  3082     methodHandle m = method();
  3082     Method* m = method();
  3083     if (m.not_null()) {
  3083     if (m != NULL) {
  3084       stream->print("  # ");
  3084       stream->print("  # ");
  3085       m->print_value_on(stream);
  3085       m->print_value_on(stream);
  3086       stream->cr();
  3086       stream->cr();
  3087     }
  3087     }
  3088     if (m.not_null() && !is_osr_method()) {
  3088     if (m != NULL && !is_osr_method()) {
  3089       ResourceMark rm;
  3089       ResourceMark rm;
  3090       int sizeargs = m->size_of_parameters();
  3090       int sizeargs = m->size_of_parameters();
  3091       BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, sizeargs);
  3091       BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, sizeargs);
  3092       VMRegPair* regs   = NEW_RESOURCE_ARRAY(VMRegPair, sizeargs);
  3092       VMRegPair* regs   = NEW_RESOURCE_ARRAY(VMRegPair, sizeargs);
  3093       {
  3093       {
  3235       }
  3235       }
  3236     }
  3236     }
  3237   }
  3237   }
  3238   assert(!oop_map_required, "missed oopmap");
  3238   assert(!oop_map_required, "missed oopmap");
  3239 
  3239 
       
  3240   Thread* thread = Thread::current();
       
  3241 
  3240   // Print any debug info present at this pc.
  3242   // Print any debug info present at this pc.
  3241   ScopeDesc* sd  = scope_desc_in(begin, end);
  3243   ScopeDesc* sd  = scope_desc_in(begin, end);
  3242   if (sd != NULL) {
  3244   if (sd != NULL) {
  3243     st->move_to(column, 6, 0);
  3245     st->move_to(column, 6, 0);
  3244     if (sd->bci() == SynchronizationEntryBCI) {
  3246     if (sd->bci() == SynchronizationEntryBCI) {
  3265         case Bytecodes::_invokevirtual:
  3267         case Bytecodes::_invokevirtual:
  3266         case Bytecodes::_invokespecial:
  3268         case Bytecodes::_invokespecial:
  3267         case Bytecodes::_invokestatic:
  3269         case Bytecodes::_invokestatic:
  3268         case Bytecodes::_invokeinterface:
  3270         case Bytecodes::_invokeinterface:
  3269           {
  3271           {
  3270             Bytecode_invoke invoke(sd->method(), sd->bci());
  3272             Bytecode_invoke invoke(methodHandle(thread, sd->method()), sd->bci());
  3271             st->print(" ");
  3273             st->print(" ");
  3272             if (invoke.name() != NULL)
  3274             if (invoke.name() != NULL)
  3273               invoke.name()->print_symbol_on(st);
  3275               invoke.name()->print_symbol_on(st);
  3274             else
  3276             else
  3275               st->print("<UNKNOWN>");
  3277               st->print("<UNKNOWN>");
  3278         case Bytecodes::_getfield:
  3280         case Bytecodes::_getfield:
  3279         case Bytecodes::_putfield:
  3281         case Bytecodes::_putfield:
  3280         case Bytecodes::_getstatic:
  3282         case Bytecodes::_getstatic:
  3281         case Bytecodes::_putstatic:
  3283         case Bytecodes::_putstatic:
  3282           {
  3284           {
  3283             Bytecode_field field(sd->method(), sd->bci());
  3285             Bytecode_field field(methodHandle(thread, sd->method()), sd->bci());
  3284             st->print(" ");
  3286             st->print(" ");
  3285             if (field.name() != NULL)
  3287             if (field.name() != NULL)
  3286               field.name()->print_symbol_on(st);
  3288               field.name()->print_symbol_on(st);
  3287             else
  3289             else
  3288               st->print("<UNKNOWN>");
  3290               st->print("<UNKNOWN>");
  3354       CodeBlob* callee = CodeCache::find_blob(dest);
  3356       CodeBlob* callee = CodeCache::find_blob(dest);
  3355       CompiledMethod* cm = callee->as_compiled_method_or_null();
  3357       CompiledMethod* cm = callee->as_compiled_method_or_null();
  3356       if (cm != NULL && cm->is_far_code()) {
  3358       if (cm != NULL && cm->is_far_code()) {
  3357         // Temporary fix, see JDK-8143106
  3359         // Temporary fix, see JDK-8143106
  3358         CompiledDirectStaticCall* csc = CompiledDirectStaticCall::at(instruction_address());
  3360         CompiledDirectStaticCall* csc = CompiledDirectStaticCall::at(instruction_address());
  3359         csc->set_to_far(methodHandle(cm->method()), dest);
  3361         csc->set_to_far(methodHandle(Thread::current(), cm->method()), dest);
  3360         return;
  3362         return;
  3361       }
  3363       }
  3362     }
  3364     }
  3363 #endif
  3365 #endif
  3364     _call->set_destination_mt_safe(dest);
  3366     _call->set_destination_mt_safe(dest);