Skip to content

Commit

Permalink
8299074: nmethod marked for deoptimization is not deoptimized
Browse files Browse the repository at this point in the history
Reviewed-by: eosterlund, rehn, kvn
  • Loading branch information
TobiHartmann committed Jan 18, 2023
1 parent 1f438a8 commit 66f7387
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/hotspot/share/code/dependencyContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,22 @@ int DependencyContext::mark_dependent_nmethods(DepChange& changes) {
int found = 0;
for (nmethodBucket* b = dependencies_not_unloading(); b != NULL; b = b->next_not_unloading()) {
nmethod* nm = b->get_nmethod();
if (b->count() > 0 && !nm->is_marked_for_deoptimization() && nm->check_dependency_on(changes)) {
if (TraceDependencies) {
ResourceMark rm;
tty->print_cr("Marked for deoptimization");
changes.print();
nm->print();
nm->print_dependencies();
if (b->count() > 0) {
if (nm->is_marked_for_deoptimization()) {
// Also count already (concurrently) marked nmethods to make sure
// deoptimization is triggered before execution in this thread continues.
found++;
} else if (nm->check_dependency_on(changes)) {
if (TraceDependencies) {
ResourceMark rm;
tty->print_cr("Marked for deoptimization");
changes.print();
nm->print();
nm->print_dependencies();
}
changes.mark_for_deoptimization(nm);
found++;
}
changes.mark_for_deoptimization(nm);
found++;
}
}
return found;
Expand Down Expand Up @@ -189,7 +195,9 @@ int DependencyContext::remove_and_mark_for_deoptimization_all_dependents() {
int marked = 0;
while (b != NULL) {
nmethod* nm = b->get_nmethod();
if (b->count() > 0 && !nm->is_marked_for_deoptimization()) {
if (b->count() > 0) {
// Also count already (concurrently) marked nmethods to make sure
// deoptimization is triggered before execution in this thread continues.
nm->mark_for_deoptimization();
marked++;
}
Expand Down

1 comment on commit 66f7387

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.