mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-25 22:04:51 +02:00
8061256: com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java timed out
Must not be at safepoint when taking CompileQueue_lock Reviewed-by: kvn, anoll
This commit is contained in:
parent
f81bd8ff29
commit
bc52e8443e
3 changed files with 16 additions and 18 deletions
|
@ -594,7 +594,7 @@ void CompileTask::log_task_done(CompileLog* log) {
|
||||||
* Add a CompileTask to a CompileQueue.
|
* Add a CompileTask to a CompileQueue.
|
||||||
*/
|
*/
|
||||||
void CompileQueue::add(CompileTask* task) {
|
void CompileQueue::add(CompileTask* task) {
|
||||||
assert(lock()->owned_by_self(), "must own lock");
|
assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
|
||||||
|
|
||||||
task->set_next(NULL);
|
task->set_next(NULL);
|
||||||
task->set_prev(NULL);
|
task->set_prev(NULL);
|
||||||
|
@ -625,7 +625,7 @@ void CompileQueue::add(CompileTask* task) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify CompilerThreads that a task is available.
|
// Notify CompilerThreads that a task is available.
|
||||||
lock()->notify_all();
|
MethodCompileQueue_lock->notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -635,7 +635,7 @@ void CompileQueue::add(CompileTask* task) {
|
||||||
* compilation is disabled.
|
* compilation is disabled.
|
||||||
*/
|
*/
|
||||||
void CompileQueue::free_all() {
|
void CompileQueue::free_all() {
|
||||||
MutexLocker mu(lock());
|
MutexLocker mu(MethodCompileQueue_lock);
|
||||||
CompileTask* next = _first;
|
CompileTask* next = _first;
|
||||||
|
|
||||||
// Iterate over all tasks in the compile queue
|
// Iterate over all tasks in the compile queue
|
||||||
|
@ -653,14 +653,14 @@ void CompileQueue::free_all() {
|
||||||
_first = NULL;
|
_first = NULL;
|
||||||
|
|
||||||
// Wake up all threads that block on the queue.
|
// Wake up all threads that block on the queue.
|
||||||
lock()->notify_all();
|
MethodCompileQueue_lock->notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next CompileTask from a CompileQueue
|
* Get the next CompileTask from a CompileQueue
|
||||||
*/
|
*/
|
||||||
CompileTask* CompileQueue::get() {
|
CompileTask* CompileQueue::get() {
|
||||||
MutexLocker locker(lock());
|
MutexLocker locker(MethodCompileQueue_lock);
|
||||||
// If _first is NULL we have no more compile jobs. There are two reasons for
|
// If _first is NULL we have no more compile jobs. There are two reasons for
|
||||||
// having no compile jobs: First, we compiled everything we wanted. Second,
|
// having no compile jobs: First, we compiled everything we wanted. Second,
|
||||||
// we ran out of code cache so compilation has been disabled. In the latter
|
// we ran out of code cache so compilation has been disabled. In the latter
|
||||||
|
@ -681,7 +681,7 @@ CompileTask* CompileQueue::get() {
|
||||||
// We need a timed wait here, since compiler threads can exit if compilation
|
// We need a timed wait here, since compiler threads can exit if compilation
|
||||||
// is disabled forever. We use 5 seconds wait time; the exiting of compiler threads
|
// is disabled forever. We use 5 seconds wait time; the exiting of compiler threads
|
||||||
// is not critical and we do not want idle compiler threads to wake up too often.
|
// is not critical and we do not want idle compiler threads to wake up too often.
|
||||||
lock()->wait(!Mutex::_no_safepoint_check_flag, 5*1000);
|
MethodCompileQueue_lock->wait(!Mutex::_no_safepoint_check_flag, 5*1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CompileBroker::is_compilation_disabled_forever()) {
|
if (CompileBroker::is_compilation_disabled_forever()) {
|
||||||
|
@ -701,7 +701,7 @@ CompileTask* CompileQueue::get() {
|
||||||
// Clean & deallocate stale compile tasks.
|
// Clean & deallocate stale compile tasks.
|
||||||
// Temporarily releases MethodCompileQueue lock.
|
// Temporarily releases MethodCompileQueue lock.
|
||||||
void CompileQueue::purge_stale_tasks() {
|
void CompileQueue::purge_stale_tasks() {
|
||||||
assert(lock()->owned_by_self(), "must own lock");
|
assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
|
||||||
if (_first_stale != NULL) {
|
if (_first_stale != NULL) {
|
||||||
// Stale tasks are purged when MCQ lock is released,
|
// Stale tasks are purged when MCQ lock is released,
|
||||||
// but _first_stale updates are protected by MCQ lock.
|
// but _first_stale updates are protected by MCQ lock.
|
||||||
|
@ -710,7 +710,7 @@ void CompileQueue::purge_stale_tasks() {
|
||||||
CompileTask* head = _first_stale;
|
CompileTask* head = _first_stale;
|
||||||
_first_stale = NULL;
|
_first_stale = NULL;
|
||||||
{
|
{
|
||||||
MutexUnlocker ul(lock());
|
MutexUnlocker ul(MethodCompileQueue_lock);
|
||||||
for (CompileTask* task = head; task != NULL; ) {
|
for (CompileTask* task = head; task != NULL; ) {
|
||||||
CompileTask* next_task = task->next();
|
CompileTask* next_task = task->next();
|
||||||
CompileTaskWrapper ctw(task); // Frees the task
|
CompileTaskWrapper ctw(task); // Frees the task
|
||||||
|
@ -722,7 +722,7 @@ void CompileQueue::purge_stale_tasks() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompileQueue::remove(CompileTask* task) {
|
void CompileQueue::remove(CompileTask* task) {
|
||||||
assert(lock()->owned_by_self(), "must own lock");
|
assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
|
||||||
if (task->prev() != NULL) {
|
if (task->prev() != NULL) {
|
||||||
task->prev()->set_next(task->next());
|
task->prev()->set_next(task->next());
|
||||||
} else {
|
} else {
|
||||||
|
@ -742,7 +742,7 @@ void CompileQueue::remove(CompileTask* task) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompileQueue::remove_and_mark_stale(CompileTask* task) {
|
void CompileQueue::remove_and_mark_stale(CompileTask* task) {
|
||||||
assert(lock()->owned_by_self(), "must own lock");
|
assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
|
||||||
remove(task);
|
remove(task);
|
||||||
|
|
||||||
// Enqueue the task for reclamation (should be done outside MCQ lock)
|
// Enqueue the task for reclamation (should be done outside MCQ lock)
|
||||||
|
@ -780,7 +780,7 @@ void CompileBroker::print_compile_queues(outputStream* st) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompileQueue::print(outputStream* st) {
|
void CompileQueue::print(outputStream* st) {
|
||||||
assert(lock()->owned_by_self(), "must own lock");
|
assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
|
||||||
st->print_cr("Contents of %s", name());
|
st->print_cr("Contents of %s", name());
|
||||||
st->print_cr("----------------------------");
|
st->print_cr("----------------------------");
|
||||||
CompileTask* task = _first;
|
CompileTask* task = _first;
|
||||||
|
@ -1066,11 +1066,11 @@ void CompileBroker::init_compiler_sweeper_threads(int c1_compiler_count, int c2_
|
||||||
#endif // !ZERO && !SHARK
|
#endif // !ZERO && !SHARK
|
||||||
// Initialize the compilation queue
|
// Initialize the compilation queue
|
||||||
if (c2_compiler_count > 0) {
|
if (c2_compiler_count > 0) {
|
||||||
_c2_compile_queue = new CompileQueue("C2 compile queue", MethodCompileQueue_lock);
|
_c2_compile_queue = new CompileQueue("C2 compile queue");
|
||||||
_compilers[1]->set_num_compiler_threads(c2_compiler_count);
|
_compilers[1]->set_num_compiler_threads(c2_compiler_count);
|
||||||
}
|
}
|
||||||
if (c1_compiler_count > 0) {
|
if (c1_compiler_count > 0) {
|
||||||
_c1_compile_queue = new CompileQueue("C1 compile queue", MethodCompileQueue_lock);
|
_c1_compile_queue = new CompileQueue("C1 compile queue");
|
||||||
_compilers[0]->set_num_compiler_threads(c1_compiler_count);
|
_compilers[0]->set_num_compiler_threads(c1_compiler_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1214,7 +1214,7 @@ void CompileBroker::compile_method_base(methodHandle method,
|
||||||
|
|
||||||
// Acquire our lock.
|
// Acquire our lock.
|
||||||
{
|
{
|
||||||
MutexLocker locker(queue->lock(), thread);
|
MutexLocker locker(MethodCompileQueue_lock, thread);
|
||||||
|
|
||||||
// Make sure the method has not slipped into the queues since
|
// Make sure the method has not slipped into the queues since
|
||||||
// last we checked; note that those checks were "fast bail-outs".
|
// last we checked; note that those checks were "fast bail-outs".
|
||||||
|
|
|
@ -195,7 +195,6 @@ class CompilerCounters : public CHeapObj<mtCompiler> {
|
||||||
class CompileQueue : public CHeapObj<mtCompiler> {
|
class CompileQueue : public CHeapObj<mtCompiler> {
|
||||||
private:
|
private:
|
||||||
const char* _name;
|
const char* _name;
|
||||||
Monitor* _lock;
|
|
||||||
|
|
||||||
CompileTask* _first;
|
CompileTask* _first;
|
||||||
CompileTask* _last;
|
CompileTask* _last;
|
||||||
|
@ -206,9 +205,8 @@ class CompileQueue : public CHeapObj<mtCompiler> {
|
||||||
|
|
||||||
void purge_stale_tasks();
|
void purge_stale_tasks();
|
||||||
public:
|
public:
|
||||||
CompileQueue(const char* name, Monitor* lock) {
|
CompileQueue(const char* name) {
|
||||||
_name = name;
|
_name = name;
|
||||||
_lock = lock;
|
|
||||||
_first = NULL;
|
_first = NULL;
|
||||||
_last = NULL;
|
_last = NULL;
|
||||||
_size = 0;
|
_size = 0;
|
||||||
|
@ -216,7 +214,6 @@ class CompileQueue : public CHeapObj<mtCompiler> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* name() const { return _name; }
|
const char* name() const { return _name; }
|
||||||
Monitor* lock() const { return _lock; }
|
|
||||||
|
|
||||||
void add(CompileTask* task);
|
void add(CompileTask* task);
|
||||||
void remove(CompileTask* task);
|
void remove(CompileTask* task);
|
||||||
|
|
|
@ -432,6 +432,7 @@ class VM_PrintCompileQueue: public VM_Operation {
|
||||||
public:
|
public:
|
||||||
VM_PrintCompileQueue(outputStream* st) : _out(st) {}
|
VM_PrintCompileQueue(outputStream* st) : _out(st) {}
|
||||||
VMOp_Type type() const { return VMOp_PrintCompileQueue; }
|
VMOp_Type type() const { return VMOp_PrintCompileQueue; }
|
||||||
|
Mode evaluation_mode() const { return _no_safepoint; }
|
||||||
void doit();
|
void doit();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue