1.1 --- a/src/share/vm/code/nmethod.cpp Fri Jan 29 08:33:24 2010 -0800 1.2 +++ b/src/share/vm/code/nmethod.cpp Fri Jan 29 09:27:22 2010 -0800 1.3 @@ -587,6 +587,7 @@ 1.4 _osr_link = NULL; 1.5 _scavenge_root_link = NULL; 1.6 _scavenge_root_state = 0; 1.7 + _saved_nmethod_link = NULL; 1.8 _compiler = NULL; 1.9 // We have no exception handler or deopt handler make the 1.10 // values something that will never match a pc like the nmethod vtable entry 1.11 @@ -1033,7 +1034,7 @@ 1.12 if( cb != NULL && cb->is_nmethod() ) { 1.13 nmethod* nm = (nmethod*)cb; 1.14 // Clean inline caches pointing to both zombie and not_entrant methods 1.15 - if (!nm->is_in_use()) ic->set_to_clean(); 1.16 + if (!nm->is_in_use() || (nm->method()->code() != nm)) ic->set_to_clean(); 1.17 } 1.18 break; 1.19 } 1.20 @@ -1043,7 +1044,7 @@ 1.21 if( cb != NULL && cb->is_nmethod() ) { 1.22 nmethod* nm = (nmethod*)cb; 1.23 // Clean inline caches pointing to both zombie and not_entrant methods 1.24 - if (!nm->is_in_use()) csc->set_to_clean(); 1.25 + if (!nm->is_in_use() || (nm->method()->code() != nm)) csc->set_to_clean(); 1.26 } 1.27 break; 1.28 } 1.29 @@ -1312,7 +1313,8 @@ 1.30 // completely deallocate this method 1.31 EventMark m("flushing nmethod " INTPTR_FORMAT " %s", this, ""); 1.32 if (PrintMethodFlushing) { 1.33 - tty->print_cr("*flushing nmethod " INTPTR_FORMAT ". Live blobs: %d", this, CodeCache::nof_blobs()); 1.34 + tty->print_cr("*flushing nmethod %3d/" INTPTR_FORMAT ". Live blobs:" UINT32_FORMAT "/Free CodeCache:" SIZE_FORMAT "Kb", 1.35 + _compile_id, this, CodeCache::nof_blobs(), CodeCache::unallocated_capacity()/1024); 1.36 } 1.37 1.38 // We need to deallocate any ExceptionCache data. 1.39 @@ -1330,6 +1332,10 @@ 1.40 CodeCache::drop_scavenge_root_nmethod(this); 1.41 } 1.42 1.43 + if (is_speculatively_disconnected()) { 1.44 + CodeCache::remove_saved_code(this); 1.45 + } 1.46 + 1.47 ((CodeBlob*)(this))->flush(); 1.48 1.49 CodeCache::free(this);