Mercurial > hg > graal-jvmci-8
diff src/share/vm/oops/methodOop.cpp @ 1202:5f24d0319e54
4360113: Evict nmethods when code cache gets full
Summary: Speculatively unload the oldest nmethods when code cache gets full.
Reviewed-by: never, kvn
Contributed-by: eric.caspole@amd.com
author | kvn |
---|---|
date | Fri, 29 Jan 2010 09:27:22 -0800 |
parents | cf0685d550f1 |
children | 87684f1a88b5 |
line wrap: on
line diff
--- a/src/share/vm/oops/methodOop.cpp Fri Jan 29 08:33:24 2010 -0800 +++ b/src/share/vm/oops/methodOop.cpp Fri Jan 29 09:27:22 2010 -0800 @@ -705,6 +705,16 @@ // This function must not hit a safepoint! address methodOopDesc::verified_code_entry() { debug_only(No_Safepoint_Verifier nsv;) + nmethod *code = (nmethod *)OrderAccess::load_ptr_acquire(&_code); + if (code == NULL && UseCodeCacheFlushing) { + nmethod *saved_code = CodeCache::find_and_remove_saved_code(this); + if (saved_code != NULL) { + methodHandle method(this); + assert( ! saved_code->is_osr_method(), "should not get here for osr" ); + set_code( method, saved_code ); + } + } + assert(_from_compiled_entry != NULL, "must be set"); return _from_compiled_entry; } @@ -733,8 +743,8 @@ int comp_level = code->comp_level(); // In theory there could be a race here. In practice it is unlikely // and not worth worrying about. - if (comp_level > highest_tier_compile()) { - set_highest_tier_compile(comp_level); + if (comp_level > mh->highest_tier_compile()) { + mh->set_highest_tier_compile(comp_level); } OrderAccess::storestore();