File tree Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -68,16 +68,22 @@ int DependencyContext::mark_dependent_nmethods(DepChange& changes) {
68
68
int found = 0 ;
69
69
for (nmethodBucket* b = dependencies_not_unloading (); b != NULL ; b = b->next_not_unloading ()) {
70
70
nmethod* nm = b->get_nmethod ();
71
- if (b->count () > 0 && !nm->is_marked_for_deoptimization () && nm->check_dependency_on (changes)) {
72
- if (TraceDependencies) {
73
- ResourceMark rm;
74
- tty->print_cr (" Marked for deoptimization" );
75
- changes.print ();
76
- nm->print ();
77
- nm->print_dependencies ();
71
+ if (b->count () > 0 ) {
72
+ if (nm->is_marked_for_deoptimization ()) {
73
+ // Also count already (concurrently) marked nmethods to make sure
74
+ // deoptimization is triggered before execution in this thread continues.
75
+ found++;
76
+ } else if (nm->check_dependency_on (changes)) {
77
+ if (TraceDependencies) {
78
+ ResourceMark rm;
79
+ tty->print_cr (" Marked for deoptimization" );
80
+ changes.print ();
81
+ nm->print ();
82
+ nm->print_dependencies ();
83
+ }
84
+ changes.mark_for_deoptimization (nm);
85
+ found++;
78
86
}
79
- changes.mark_for_deoptimization (nm);
80
- found++;
81
87
}
82
88
}
83
89
return found;
@@ -189,7 +195,9 @@ int DependencyContext::remove_and_mark_for_deoptimization_all_dependents() {
189
195
int marked = 0 ;
190
196
while (b != NULL ) {
191
197
nmethod* nm = b->get_nmethod ();
192
- if (b->count () > 0 && !nm->is_marked_for_deoptimization ()) {
198
+ if (b->count () > 0 ) {
199
+ // Also count already (concurrently) marked nmethods to make sure
200
+ // deoptimization is triggered before execution in this thread continues.
193
201
nm->mark_for_deoptimization ();
194
202
marked++;
195
203
}
You can’t perform that action at this time.
0 commit comments