comparison 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
comparison
equal deleted inserted replaced
1537:79bf863697eb 1538:bfe29ec02863
459 // ------------------------------------------------------------------ 459 // ------------------------------------------------------------------
460 // CompileQueue::get 460 // CompileQueue::get
461 // 461 //
462 // Get the next CompileTask from a CompileQueue 462 // Get the next CompileTask from a CompileQueue
463 CompileTask* CompileQueue::get() { 463 CompileTask* CompileQueue::get() {
464 NMethodSweeper::possibly_sweep();
465
464 MutexLocker locker(lock()); 466 MutexLocker locker(lock());
465 467
466 // Wait for an available CompileTask. 468 // Wait for an available CompileTask.
467 while (_first == NULL) { 469 while (_first == NULL) {
468 // There is no work to be done right now. Wait. 470 // There is no work to be done right now. Wait.
469 lock()->wait(); 471 if (UseCodeCacheFlushing && (!CompileBroker::should_compile_new_jobs() || CodeCache::needs_flushing())) {
472 // During the emergency sweeping periods, wake up and sweep occasionally
473 bool timedout = lock()->wait(!Mutex::_no_safepoint_check_flag, NmethodSweepCheckInterval*1000);
474 if (timedout) {
475 MutexUnlocker ul(lock());
476 // When otherwise not busy, run nmethod sweeping
477 NMethodSweeper::possibly_sweep();
478 }
479 } else {
480 // During normal operation no need to wake up on timer
481 lock()->wait();
482 }
470 } 483 }
471 484
472 CompileTask* task = _first; 485 CompileTask* task = _first;
473 486
474 // Update queue first and last 487 // Update queue first and last