src/share/vm/runtime/advancedThresholdPolicy.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
hotspot Cdiff src/share/vm/runtime/advancedThresholdPolicy.cpp
src/share/vm/runtime/advancedThresholdPolicy.cpp
Print this page
rev 6404 : 8023461: Thread holding lock at safepoint that vm can block on: MethodCompileQueue_lock
Reviewed-by: kvn, iveresov
rev 6405 : imported patch stale_task
rev 6406 : [mq]: stale_task.1
*** 73,87 ****
set_start_time(os::javaTimeMillis());
}
// update_rate() is called from select_task() while holding a compile queue lock.
void AdvancedThresholdPolicy::update_rate(jlong t, Method* m) {
! JavaThread* THREAD = JavaThread::current();
if (is_old(m)) {
// We don't remove old methods from the queue,
// so we can just zero the rate.
! m->set_rate(0, THREAD);
return;
}
// We don't update the rate if we've just came out of a safepoint.
// delta_s is the time since last safepoint in milliseconds.
--- 73,90 ----
set_start_time(os::javaTimeMillis());
}
// update_rate() is called from select_task() while holding a compile queue lock.
void AdvancedThresholdPolicy::update_rate(jlong t, Method* m) {
! // Skip update if counters are absent.
! // Can't allocate them since we are holding compile queue lock.
! if (m->method_counters() == NULL) return;
!
if (is_old(m)) {
// We don't remove old methods from the queue,
// so we can just zero the rate.
! m->set_rate(0);
return;
}
// We don't update the rate if we've just came out of a safepoint.
// delta_s is the time since last safepoint in milliseconds.
*** 93,109 ****
// We should be running for at least 1ms.
if (delta_s >= TieredRateUpdateMinTime) {
// And we must've taken the previous point at least 1ms before.
if (delta_t >= TieredRateUpdateMinTime && delta_e > 0) {
! m->set_prev_time(t, THREAD);
! m->set_prev_event_count(event_count, THREAD);
! m->set_rate((float)delta_e / (float)delta_t, THREAD); // Rate is events per millisecond
! } else
if (delta_t > TieredRateUpdateMaxTime && delta_e == 0) {
// If nothing happened for 25ms, zero the rate. Don't modify prev values.
! m->set_rate(0, THREAD);
}
}
}
// Check if this method has been stale from a given number of milliseconds.
--- 96,113 ----
// We should be running for at least 1ms.
if (delta_s >= TieredRateUpdateMinTime) {
// And we must've taken the previous point at least 1ms before.
if (delta_t >= TieredRateUpdateMinTime && delta_e > 0) {
! m->set_prev_time(t);
! m->set_prev_event_count(event_count);
! m->set_rate((float)delta_e / (float)delta_t); // Rate is events per millisecond
! } else {
if (delta_t > TieredRateUpdateMaxTime && delta_e == 0) {
// If nothing happened for 25ms, zero the rate. Don't modify prev values.
! m->set_rate(0);
! }
}
}
}
// Check if this method has been stale from a given number of milliseconds.
*** 162,184 ****
jlong t = os::javaTimeMillis();
// Iterate through the queue and find a method with a maximum rate.
for (CompileTask* task = compile_queue->first(); task != NULL;) {
CompileTask* next_task = task->next();
Method* method = task->method();
- MethodData* mdo = method->method_data();
update_rate(t, method);
if (max_task == NULL) {
max_task = task;
max_method = method;
} else {
// If a method has been stale for some time, remove it from the queue.
if (is_stale(t, TieredCompileTaskTimeout, method) && !is_old(method)) {
if (PrintTieredEvents) {
print_event(REMOVE_FROM_QUEUE, method, method, task->osr_bci(), (CompLevel)task->comp_level());
}
! CompileTaskWrapper ctw(task); // Frees the task
! compile_queue->remove(task);
method->clear_queued_for_compilation();
task = next_task;
continue;
}
--- 166,186 ----
jlong t = os::javaTimeMillis();
// Iterate through the queue and find a method with a maximum rate.
for (CompileTask* task = compile_queue->first(); task != NULL;) {
CompileTask* next_task = task->next();
Method* method = task->method();
update_rate(t, method);
if (max_task == NULL) {
max_task = task;
max_method = method;
} else {
// If a method has been stale for some time, remove it from the queue.
if (is_stale(t, TieredCompileTaskTimeout, method) && !is_old(method)) {
if (PrintTieredEvents) {
print_event(REMOVE_FROM_QUEUE, method, method, task->osr_bci(), (CompLevel)task->comp_level());
}
! compile_queue->remove_and_mark_stale(task);
method->clear_queued_for_compilation();
task = next_task;
continue;
}
src/share/vm/runtime/advancedThresholdPolicy.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File