8046809: vm/mlvm/meth/stress/compiler/deoptimize CodeCache is full

Use separate sweeper thread; enables more aggressive sweeping.

Reviewed-by: kvn, jrose
This commit is contained in:
Albert Noll 2014-10-24 14:25:46 +02:00
parent 2597d484c6
commit 6520320d1a
30 changed files with 319 additions and 334 deletions

View file

@ -66,6 +66,7 @@
#include "runtime/sharedRuntime.hpp"
#include "runtime/statSampler.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/sweeper.hpp"
#include "runtime/task.hpp"
#include "runtime/thread.inline.hpp"
#include "runtime/threadCritical.hpp"
@ -1551,6 +1552,7 @@ void JavaThread::block_if_vm_exited() {
// Remove this ifdef when C1 is ported to the compiler interface.
static void compiler_thread_entry(JavaThread* thread, TRAPS);
static void sweeper_thread_entry(JavaThread* thread, TRAPS);
JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) :
Thread()
@ -3170,6 +3172,10 @@ static void compiler_thread_entry(JavaThread* thread, TRAPS) {
CompileBroker::compiler_thread_loop();
}
static void sweeper_thread_entry(JavaThread* thread, TRAPS) {
NMethodSweeper::sweeper_loop();
}
// Create a CompilerThread
CompilerThread::CompilerThread(CompileQueue* queue,
CompilerCounters* counters)
@ -3180,7 +3186,6 @@ CompilerThread::CompilerThread(CompileQueue* queue,
_queue = queue;
_counters = counters;
_buffer_blob = NULL;
_scanned_nmethod = NULL;
_compiler = NULL;
#ifndef PRODUCT
@ -3188,7 +3193,12 @@ CompilerThread::CompilerThread(CompileQueue* queue,
#endif
}
void CompilerThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) {
// Create sweeper thread
CodeCacheSweeperThread::CodeCacheSweeperThread()
: JavaThread(&sweeper_thread_entry) {
_scanned_nmethod = NULL;
}
void CodeCacheSweeperThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) {
JavaThread::oops_do(f, cld_f, cf);
if (_scanned_nmethod != NULL && cf != NULL) {
// Safepoints can occur when the sweeper is scanning an nmethod so