Mercurial > hg > truffle
diff src/share/vm/compiler/compileBroker.hpp @ 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 | a61af66fc99e |
children | 7cf1952ec5fb cff162798819 |
line wrap: on
line diff
--- a/src/share/vm/compiler/compileBroker.hpp Fri Jan 29 08:33:24 2010 -0800 +++ b/src/share/vm/compiler/compileBroker.hpp Fri Jan 29 09:27:22 2010 -0800 @@ -193,6 +193,9 @@ 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 @@ static void compiler_thread_loop(); + static uint get_compilation_id() { return _compilation_id; } static bool is_idle(); // Set _should_block. @@ -328,6 +332,20 @@ // 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;