mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-25 05:45:11 +02:00
4360113: Evict nmethods when code cache gets full
Speculatively unload the oldest nmethods when code cache gets full. Reviewed-by: never, kvn
This commit is contained in:
parent
9aa675b7e6
commit
a57d68e35b
19 changed files with 452 additions and 76 deletions
|
@ -587,6 +587,7 @@ nmethod::nmethod(
|
|||
_osr_link = NULL;
|
||||
_scavenge_root_link = NULL;
|
||||
_scavenge_root_state = 0;
|
||||
_saved_nmethod_link = NULL;
|
||||
_compiler = NULL;
|
||||
// We have no exception handler or deopt handler make the
|
||||
// values something that will never match a pc like the nmethod vtable entry
|
||||
|
@ -1033,7 +1034,7 @@ void nmethod::cleanup_inline_caches() {
|
|||
if( cb != NULL && cb->is_nmethod() ) {
|
||||
nmethod* nm = (nmethod*)cb;
|
||||
// Clean inline caches pointing to both zombie and not_entrant methods
|
||||
if (!nm->is_in_use()) ic->set_to_clean();
|
||||
if (!nm->is_in_use() || (nm->method()->code() != nm)) ic->set_to_clean();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1043,7 +1044,7 @@ void nmethod::cleanup_inline_caches() {
|
|||
if( cb != NULL && cb->is_nmethod() ) {
|
||||
nmethod* nm = (nmethod*)cb;
|
||||
// Clean inline caches pointing to both zombie and not_entrant methods
|
||||
if (!nm->is_in_use()) csc->set_to_clean();
|
||||
if (!nm->is_in_use() || (nm->method()->code() != nm)) csc->set_to_clean();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1312,7 +1313,8 @@ void nmethod::flush() {
|
|||
// completely deallocate this method
|
||||
EventMark m("flushing nmethod " INTPTR_FORMAT " %s", this, "");
|
||||
if (PrintMethodFlushing) {
|
||||
tty->print_cr("*flushing nmethod " INTPTR_FORMAT ". Live blobs: %d", this, CodeCache::nof_blobs());
|
||||
tty->print_cr("*flushing nmethod %3d/" INTPTR_FORMAT ". Live blobs:" UINT32_FORMAT "/Free CodeCache:" SIZE_FORMAT "Kb",
|
||||
_compile_id, this, CodeCache::nof_blobs(), CodeCache::unallocated_capacity()/1024);
|
||||
}
|
||||
|
||||
// We need to deallocate any ExceptionCache data.
|
||||
|
@ -1330,6 +1332,10 @@ void nmethod::flush() {
|
|||
CodeCache::drop_scavenge_root_nmethod(this);
|
||||
}
|
||||
|
||||
if (is_speculatively_disconnected()) {
|
||||
CodeCache::remove_saved_code(this);
|
||||
}
|
||||
|
||||
((CodeBlob*)(this))->flush();
|
||||
|
||||
CodeCache::free(this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue