mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8163511: Allocation of compile task fails with assert: "Leaking compilation tasks?"
Use weak handles for compile tasks to allow unloading of referenced methods. Reviewed-by: kvn, coleenp, eosterlund
This commit is contained in:
parent
e28fea2d7c
commit
ac17b61a59
9 changed files with 195 additions and 56 deletions
|
@ -295,28 +295,24 @@ CompileTask* TieredThresholdPolicy::select_task(CompileQueue* compile_queue) {
|
|||
for (CompileTask* task = compile_queue->first(); task != NULL;) {
|
||||
CompileTask* next_task = task->next();
|
||||
Method* method = task->method();
|
||||
// If a method was unloaded or has been stale for some time, remove it from the queue.
|
||||
// Blocking tasks and tasks submitted from whitebox API don't become stale
|
||||
if (task->is_unloaded() || (task->can_become_stale() && is_stale(t, TieredCompileTaskTimeout, method) && !is_old(method))) {
|
||||
if (!task->is_unloaded()) {
|
||||
if (PrintTieredEvents) {
|
||||
print_event(REMOVE_FROM_QUEUE, method, method, task->osr_bci(), (CompLevel) task->comp_level());
|
||||
}
|
||||
method->clear_queued_for_compilation();
|
||||
}
|
||||
compile_queue->remove_and_mark_stale(task);
|
||||
task = next_task;
|
||||
continue;
|
||||
}
|
||||
update_rate(t, method);
|
||||
if (max_task == NULL) {
|
||||
if (max_task == NULL || compare_methods(method, max_method)) {
|
||||
// Select a method with the highest rate
|
||||
max_task = task;
|
||||
max_method = method;
|
||||
} else {
|
||||
// If a method has been stale for some time, remove it from the queue.
|
||||
// Blocking tasks and tasks submitted from whitebox API don't become stale
|
||||
if (task->can_become_stale() && 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;
|
||||
}
|
||||
|
||||
// Select a method with a higher rate
|
||||
if (compare_methods(method, max_method)) {
|
||||
max_task = task;
|
||||
max_method = method;
|
||||
}
|
||||
}
|
||||
|
||||
if (task->is_blocking()) {
|
||||
|
@ -501,7 +497,7 @@ void TieredThresholdPolicy::update_rate(jlong t, Method* m) {
|
|||
}
|
||||
}
|
||||
|
||||
// Check if this method has been stale from a given number of milliseconds.
|
||||
// Check if this method has been stale for a given number of milliseconds.
|
||||
// See select_task().
|
||||
bool TieredThresholdPolicy::is_stale(jlong t, jlong timeout, Method* m) {
|
||||
jlong delta_s = t - SafepointTracing::end_of_last_safepoint_epoch_ms();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue