8023191: OSR nmethods should be flushed to free space in CodeCache

Treat OSR nmethods like normal nmethods and flush them if they are cold/unused.

Reviewed-by: kvn
This commit is contained in:
Tobias Hartmann 2016-03-18 09:32:29 +01:00
parent 2b48dbfd93
commit ba7e4da495
6 changed files with 90 additions and 50 deletions

View file

@ -2523,8 +2523,8 @@ void InstanceKlass::add_osr_nmethod(nmethod* n) {
}
}
void InstanceKlass::remove_osr_nmethod(nmethod* n) {
// Remove osr nmethod from the list. Return true if found and removed.
bool InstanceKlass::remove_osr_nmethod(nmethod* n) {
// This is a short non-blocking critical region, so the no safepoint check is ok.
MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
assert(n->is_osr_method(), "wrong kind of nmethod");
@ -2533,6 +2533,7 @@ void InstanceKlass::remove_osr_nmethod(nmethod* n) {
int max_level = CompLevel_none; // Find the max comp level excluding n
Method* m = n->method();
// Search for match
bool found = false;
while(cur != NULL && cur != n) {
if (TieredCompilation && m == cur->method()) {
// Find max level before n
@ -2543,6 +2544,7 @@ void InstanceKlass::remove_osr_nmethod(nmethod* n) {
}
nmethod* next = NULL;
if (cur == n) {
found = true;
next = cur->osr_link();
if (last == NULL) {
// Remove first element
@ -2563,6 +2565,7 @@ void InstanceKlass::remove_osr_nmethod(nmethod* n) {
}
m->set_highest_osr_comp_level(max_level);
}
return found;
}
int InstanceKlass::mark_osr_nmethods(const Method* m) {