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:
Eric Caspole 2010-01-29 09:27:22 -08:00 committed by Vladimir Kozlov
parent 9aa675b7e6
commit a57d68e35b
19 changed files with 452 additions and 76 deletions

View file

@ -193,6 +193,9 @@ class CompileBroker: AllStatic {
static bool _initialized;
static volatile bool _should_block;
// This flag can be used to stop compilation or turn it back on
static volatile jint _should_compile_new_jobs;
// The installed compiler(s)
static AbstractCompiler* _compilers[2];
@ -319,6 +322,7 @@ class CompileBroker: AllStatic {
static void compiler_thread_loop();
static uint get_compilation_id() { return _compilation_id; }
static bool is_idle();
// Set _should_block.
@ -328,6 +332,20 @@ class CompileBroker: AllStatic {
// Call this from the compiler at convenient points, to poll for _should_block.
static void maybe_block();
enum {
// Flags for toggling compiler activity
stop_compilation = 0,
run_compilation = 1
};
static bool should_compile_new_jobs() { return UseCompiler && (_should_compile_new_jobs == run_compilation); }
static bool set_should_compile_new_jobs(jint new_state) {
// Return success if the current caller set it
jint old = Atomic::cmpxchg(new_state, &_should_compile_new_jobs, 1-new_state);
return (old == (1-new_state));
}
static void handle_full_code_cache();
// Return total compilation ticks
static jlong total_compilation_ticks() {
return _perf_total_compilation != NULL ? _perf_total_compilation->get_value() : 0;