comparison 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
comparison
equal deleted inserted replaced
1201:24128c2ffa87 1202:5f24d0319e54
191 191
192 private: 192 private:
193 static bool _initialized; 193 static bool _initialized;
194 static volatile bool _should_block; 194 static volatile bool _should_block;
195 195
196 // This flag can be used to stop compilation or turn it back on
197 static volatile jint _should_compile_new_jobs;
198
196 // The installed compiler(s) 199 // The installed compiler(s)
197 static AbstractCompiler* _compilers[2]; 200 static AbstractCompiler* _compilers[2];
198 201
199 // These counters are used for assigning id's to each compilation 202 // These counters are used for assigning id's to each compilation
200 static uint _compilation_id; 203 static uint _compilation_id;
317 methodHandle hot_method, int hot_count, 320 methodHandle hot_method, int hot_count,
318 const char* comment, TRAPS); 321 const char* comment, TRAPS);
319 322
320 static void compiler_thread_loop(); 323 static void compiler_thread_loop();
321 324
325 static uint get_compilation_id() { return _compilation_id; }
322 static bool is_idle(); 326 static bool is_idle();
323 327
324 // Set _should_block. 328 // Set _should_block.
325 // Call this from the VM, with Threads_lock held and a safepoint requested. 329 // Call this from the VM, with Threads_lock held and a safepoint requested.
326 static void set_should_block(); 330 static void set_should_block();
327 331
328 // Call this from the compiler at convenient points, to poll for _should_block. 332 // Call this from the compiler at convenient points, to poll for _should_block.
329 static void maybe_block(); 333 static void maybe_block();
330 334
335 enum {
336 // Flags for toggling compiler activity
337 stop_compilation = 0,
338 run_compilation = 1
339 };
340
341 static bool should_compile_new_jobs() { return UseCompiler && (_should_compile_new_jobs == run_compilation); }
342 static bool set_should_compile_new_jobs(jint new_state) {
343 // Return success if the current caller set it
344 jint old = Atomic::cmpxchg(new_state, &_should_compile_new_jobs, 1-new_state);
345 return (old == (1-new_state));
346 }
347 static void handle_full_code_cache();
348
331 // Return total compilation ticks 349 // Return total compilation ticks
332 static jlong total_compilation_ticks() { 350 static jlong total_compilation_ticks() {
333 return _perf_total_compilation != NULL ? _perf_total_compilation->get_value() : 0; 351 return _perf_total_compilation != NULL ? _perf_total_compilation->get_value() : 0;
334 } 352 }
335 353