hotspot/src/share/vm/code/nmethod.cpp
changeset 32401 cc58aeaec340
parent 31592 43f48e165466
child 32466 915d0c3d25aa
equal deleted inserted replaced
32400:ed1a43020a93 32401:cc58aeaec340
  1019   }
  1019   }
  1020 }
  1020 }
  1021 
  1021 
  1022 
  1022 
  1023 void nmethod::cleanup_inline_caches() {
  1023 void nmethod::cleanup_inline_caches() {
  1024 
       
  1025   assert_locked_or_safepoint(CompiledIC_lock);
  1024   assert_locked_or_safepoint(CompiledIC_lock);
  1026 
  1025 
  1027   // If the method is not entrant or zombie then a JMP is plastered over the
  1026   // If the method is not entrant or zombie then a JMP is plastered over the
  1028   // first few bytes.  If an oop in the old code was there, that oop
  1027   // first few bytes.  If an oop in the old code was there, that oop
  1029   // should not get GC'd.  Skip the first few bytes of oops on
  1028   // should not get GC'd.  Skip the first few bytes of oops on
  1035     // This means that the low_boundary is going to be a little too high.
  1034     // This means that the low_boundary is going to be a little too high.
  1036     // This shouldn't matter, since oops of non-entrant methods are never used.
  1035     // This shouldn't matter, since oops of non-entrant methods are never used.
  1037     // In fact, why are we bothering to look at oops in a non-entrant method??
  1036     // In fact, why are we bothering to look at oops in a non-entrant method??
  1038   }
  1037   }
  1039 
  1038 
  1040   // Find all calls in an nmethod, and clear the ones that points to zombie methods
  1039   // Find all calls in an nmethod and clear the ones that point to non-entrant,
       
  1040   // zombie and unloaded nmethods.
  1041   ResourceMark rm;
  1041   ResourceMark rm;
  1042   RelocIterator iter(this, low_boundary);
  1042   RelocIterator iter(this, low_boundary);
  1043   while(iter.next()) {
  1043   while(iter.next()) {
  1044     switch(iter.type()) {
  1044     switch(iter.type()) {
  1045       case relocInfo::virtual_call_type:
  1045       case relocInfo::virtual_call_type:
  1047         CompiledIC *ic = CompiledIC_at(&iter);
  1047         CompiledIC *ic = CompiledIC_at(&iter);
  1048         // Ok, to lookup references to zombies here
  1048         // Ok, to lookup references to zombies here
  1049         CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination());
  1049         CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination());
  1050         if( cb != NULL && cb->is_nmethod() ) {
  1050         if( cb != NULL && cb->is_nmethod() ) {
  1051           nmethod* nm = (nmethod*)cb;
  1051           nmethod* nm = (nmethod*)cb;
  1052           // Clean inline caches pointing to both zombie and not_entrant methods
  1052           // Clean inline caches pointing to zombie, non-entrant and unloaded methods
  1053           if (!nm->is_in_use() || (nm->method()->code() != nm)) ic->set_to_clean();
  1053           if (!nm->is_in_use() || (nm->method()->code() != nm)) ic->set_to_clean();
  1054         }
  1054         }
  1055         break;
  1055         break;
  1056       }
  1056       }
  1057       case relocInfo::static_call_type: {
  1057       case relocInfo::static_call_type: {
  1058         CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc());
  1058         CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc());
  1059         CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination());
  1059         CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination());
  1060         if( cb != NULL && cb->is_nmethod() ) {
  1060         if( cb != NULL && cb->is_nmethod() ) {
  1061           nmethod* nm = (nmethod*)cb;
  1061           nmethod* nm = (nmethod*)cb;
  1062           // Clean inline caches pointing to both zombie and not_entrant methods
  1062           // Clean inline caches pointing to zombie, non-entrant and unloaded methods
  1063           if (!nm->is_in_use() || (nm->method()->code() != nm)) csc->set_to_clean();
  1063           if (!nm->is_in_use() || (nm->method()->code() != nm)) csc->set_to_clean();
  1064         }
  1064         }
  1065         break;
  1065         break;
  1066       }
  1066       }
  1067     }
  1067     }
  2527 void nmethod::verify() {
  2527 void nmethod::verify() {
  2528 
  2528 
  2529   // Hmm. OSR methods can be deopted but not marked as zombie or not_entrant
  2529   // Hmm. OSR methods can be deopted but not marked as zombie or not_entrant
  2530   // seems odd.
  2530   // seems odd.
  2531 
  2531 
  2532   if( is_zombie() || is_not_entrant() )
  2532   if (is_zombie() || is_not_entrant() || is_unloaded())
  2533     return;
  2533     return;
  2534 
  2534 
  2535   // Make sure all the entry points are correctly aligned for patching.
  2535   // Make sure all the entry points are correctly aligned for patching.
  2536   NativeJump::check_verified_entry_alignment(entry_point(), verified_entry_point());
  2536   NativeJump::check_verified_entry_alignment(entry_point(), verified_entry_point());
  2537 
  2537