Mercurial > hg > graal-jvmci-8
diff src/share/vm/compiler/compileBroker.cpp @ 1538:bfe29ec02863
6950075: nmethod sweeper should operate concurrently
Reviewed-by: never, kvn
Contributed-by: eric.caspole@amd.com
author | never |
---|---|
date | Mon, 17 May 2010 16:50:07 -0700 |
parents | a2ea687fdc7c |
children | c18cbe5936b8 ca3dceda776c |
line wrap: on
line diff
--- a/src/share/vm/compiler/compileBroker.cpp Mon May 17 11:32:56 2010 -0700 +++ b/src/share/vm/compiler/compileBroker.cpp Mon May 17 16:50:07 2010 -0700 @@ -461,12 +461,25 @@ // // Get the next CompileTask from a CompileQueue CompileTask* CompileQueue::get() { + NMethodSweeper::possibly_sweep(); + MutexLocker locker(lock()); // Wait for an available CompileTask. while (_first == NULL) { // There is no work to be done right now. Wait. - lock()->wait(); + if (UseCodeCacheFlushing && (!CompileBroker::should_compile_new_jobs() || CodeCache::needs_flushing())) { + // During the emergency sweeping periods, wake up and sweep occasionally + bool timedout = lock()->wait(!Mutex::_no_safepoint_check_flag, NmethodSweepCheckInterval*1000); + if (timedout) { + MutexUnlocker ul(lock()); + // When otherwise not busy, run nmethod sweeping + NMethodSweeper::possibly_sweep(); + } + } else { + // During normal operation no need to wake up on timer + lock()->wait(); + } } CompileTask* task = _first;