hotspot/src/share/vm/code/nmethod.cpp
changeset 4750 71fd601907dc
parent 4749 f26b30116e3a
child 4752 67a506670cd0
equal deleted inserted replaced
4749:f26b30116e3a 4750:71fd601907dc
   585     _method                  = method;
   585     _method                  = method;
   586     _entry_bci               = InvocationEntryBci;
   586     _entry_bci               = InvocationEntryBci;
   587     _osr_link                = NULL;
   587     _osr_link                = NULL;
   588     _scavenge_root_link      = NULL;
   588     _scavenge_root_link      = NULL;
   589     _scavenge_root_state     = 0;
   589     _scavenge_root_state     = 0;
       
   590     _saved_nmethod_link      = NULL;
   590     _compiler                = NULL;
   591     _compiler                = NULL;
   591     // We have no exception handler or deopt handler make the
   592     // We have no exception handler or deopt handler make the
   592     // values something that will never match a pc like the nmethod vtable entry
   593     // values something that will never match a pc like the nmethod vtable entry
   593     _exception_offset        = 0;
   594     _exception_offset        = 0;
   594     _deoptimize_offset       = 0;
   595     _deoptimize_offset       = 0;
  1031         // Ok, to lookup references to zombies here
  1032         // Ok, to lookup references to zombies here
  1032         CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination());
  1033         CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination());
  1033         if( cb != NULL && cb->is_nmethod() ) {
  1034         if( cb != NULL && cb->is_nmethod() ) {
  1034           nmethod* nm = (nmethod*)cb;
  1035           nmethod* nm = (nmethod*)cb;
  1035           // Clean inline caches pointing to both zombie and not_entrant methods
  1036           // Clean inline caches pointing to both zombie and not_entrant methods
  1036           if (!nm->is_in_use()) ic->set_to_clean();
  1037           if (!nm->is_in_use() || (nm->method()->code() != nm)) ic->set_to_clean();
  1037         }
  1038         }
  1038         break;
  1039         break;
  1039       }
  1040       }
  1040       case relocInfo::static_call_type: {
  1041       case relocInfo::static_call_type: {
  1041         CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc());
  1042         CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc());
  1042         CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination());
  1043         CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination());
  1043         if( cb != NULL && cb->is_nmethod() ) {
  1044         if( cb != NULL && cb->is_nmethod() ) {
  1044           nmethod* nm = (nmethod*)cb;
  1045           nmethod* nm = (nmethod*)cb;
  1045           // Clean inline caches pointing to both zombie and not_entrant methods
  1046           // Clean inline caches pointing to both zombie and not_entrant methods
  1046           if (!nm->is_in_use()) csc->set_to_clean();
  1047           if (!nm->is_in_use() || (nm->method()->code() != nm)) csc->set_to_clean();
  1047         }
  1048         }
  1048         break;
  1049         break;
  1049       }
  1050       }
  1050     }
  1051     }
  1051   }
  1052   }
  1310   check_safepoint();
  1311   check_safepoint();
  1311 
  1312 
  1312   // completely deallocate this method
  1313   // completely deallocate this method
  1313   EventMark m("flushing nmethod " INTPTR_FORMAT " %s", this, "");
  1314   EventMark m("flushing nmethod " INTPTR_FORMAT " %s", this, "");
  1314   if (PrintMethodFlushing) {
  1315   if (PrintMethodFlushing) {
  1315     tty->print_cr("*flushing nmethod " INTPTR_FORMAT ". Live blobs: %d", this, CodeCache::nof_blobs());
  1316     tty->print_cr("*flushing nmethod %3d/" INTPTR_FORMAT ". Live blobs:" UINT32_FORMAT "/Free CodeCache:" SIZE_FORMAT "Kb",
       
  1317         _compile_id, this, CodeCache::nof_blobs(), CodeCache::unallocated_capacity()/1024);
  1316   }
  1318   }
  1317 
  1319 
  1318   // We need to deallocate any ExceptionCache data.
  1320   // We need to deallocate any ExceptionCache data.
  1319   // Note that we do not need to grab the nmethod lock for this, it
  1321   // Note that we do not need to grab the nmethod lock for this, it
  1320   // better be thread safe if we're disposing of it!
  1322   // better be thread safe if we're disposing of it!
  1326     ec = next;
  1328     ec = next;
  1327   }
  1329   }
  1328 
  1330 
  1329   if (on_scavenge_root_list()) {
  1331   if (on_scavenge_root_list()) {
  1330     CodeCache::drop_scavenge_root_nmethod(this);
  1332     CodeCache::drop_scavenge_root_nmethod(this);
       
  1333   }
       
  1334 
       
  1335   if (is_speculatively_disconnected()) {
       
  1336     CodeCache::remove_saved_code(this);
  1331   }
  1337   }
  1332 
  1338 
  1333   ((CodeBlob*)(this))->flush();
  1339   ((CodeBlob*)(this))->flush();
  1334 
  1340 
  1335   CodeCache::free(this);
  1341   CodeCache::free(this);