1.1 --- a/src/share/vm/code/nmethod.cpp Thu Oct 08 09:37:23 2015 +0200 1.2 +++ b/src/share/vm/code/nmethod.cpp Thu Oct 08 09:37:51 2015 +0200 1.3 @@ -1162,7 +1162,6 @@ 1.4 1.5 1.6 void nmethod::cleanup_inline_caches() { 1.7 - 1.8 assert_locked_or_safepoint(CompiledIC_lock); 1.9 1.10 // If the method is not entrant or zombie then a JMP is plastered over the 1.11 @@ -1178,7 +1177,8 @@ 1.12 // In fact, why are we bothering to look at oops in a non-entrant method?? 1.13 } 1.14 1.15 - // Find all calls in an nmethod, and clear the ones that points to zombie methods 1.16 + // Find all calls in an nmethod and clear the ones that point to non-entrant, 1.17 + // zombie and unloaded nmethods. 1.18 ResourceMark rm; 1.19 RelocIterator iter(this, low_boundary); 1.20 while(iter.next()) { 1.21 @@ -1190,7 +1190,7 @@ 1.22 CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination()); 1.23 if( cb != NULL && cb->is_nmethod() ) { 1.24 nmethod* nm = (nmethod*)cb; 1.25 - // Clean inline caches pointing to both zombie and not_entrant methods 1.26 + // Clean inline caches pointing to zombie, non-entrant and unloaded methods 1.27 if (!nm->is_in_use() || (nm->method()->code() != nm)) ic->set_to_clean(); 1.28 } 1.29 break; 1.30 @@ -1200,7 +1200,7 @@ 1.31 CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination()); 1.32 if( cb != NULL && cb->is_nmethod() ) { 1.33 nmethod* nm = (nmethod*)cb; 1.34 - // Clean inline caches pointing to both zombie and not_entrant methods 1.35 + // Clean inline caches pointing to zombie, non-entrant and unloaded methods 1.36 if (!nm->is_in_use() || (nm->method()->code() != nm)) csc->set_to_clean(); 1.37 } 1.38 break; 1.39 @@ -2707,7 +2707,7 @@ 1.40 // Hmm. OSR methods can be deopted but not marked as zombie or not_entrant 1.41 // seems odd. 1.42 1.43 - if( is_zombie() || is_not_entrant() ) 1.44 + if (is_zombie() || is_not_entrant() || is_unloaded()) 1.45 return; 1.46 1.47 // Make sure all the entry points are correctly aligned for patching.