Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8299074: nmethod marked for deoptimization is not deoptimized #12012

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions src/hotspot/share/code/dependencyContext.cpp
Original file line number Diff line number Diff line change
@@ -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->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++;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

A minor suggestion is to move the found++ from the individual branches to here, so there is only one.
Looks good!

Copy link
Member Author

Choose a reason for hiding this comment

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

But that would increment found also in the cases where no method was marked for deoptimization, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, sorry, please ignore :)

changes.mark_for_deoptimization(nm);
found++;
}
}
return found;
@@ -190,6 +196,8 @@ int DependencyContext::remove_and_mark_for_deoptimization_all_dependents() {
while (b != NULL) {
nmethod* nm = b->get_nmethod();
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++;
}