1194 int number_of_marked_CodeBlobs = 0;
1195
1196 CompiledMethodIterator iter;
1197 while(iter.next_alive()) {
1198 CompiledMethod* nm = iter.method();
1199 if (nm->is_dependent_on_method(dependee)) {
1200 ResourceMark rm;
1201 nm->mark_for_deoptimization();
1202 number_of_marked_CodeBlobs++;
1203 }
1204 }
1205
1206 return number_of_marked_CodeBlobs;
1207 }
1208
1209 void CodeCache::make_marked_nmethods_not_entrant() {
1210 assert_locked_or_safepoint(CodeCache_lock);
1211 CompiledMethodIterator iter;
1212 while(iter.next_alive()) {
1213 CompiledMethod* nm = iter.method();
1214 if (nm->is_marked_for_deoptimization()) {
1215 nm->make_not_entrant();
1216 }
1217 }
1218 }
1219
1220 // Flushes compiled methods dependent on dependee.
1221 void CodeCache::flush_dependents_on(instanceKlassHandle dependee) {
1222 assert_lock_strong(Compile_lock);
1223
1224 if (number_of_nmethods_with_dependencies() == 0) return;
1225
1226 // CodeCache can only be updated by a thread_in_VM and they will all be
1227 // stopped during the safepoint so CodeCache will be safe to update without
1228 // holding the CodeCache_lock.
1229
1230 KlassDepChange changes(dependee);
1231
1232 // Compute the dependent nmethods
1233 if (mark_for_deoptimization(changes) > 0) {
1234 // At least one nmethod has been marked for deoptimization
|
1194 int number_of_marked_CodeBlobs = 0;
1195
1196 CompiledMethodIterator iter;
1197 while(iter.next_alive()) {
1198 CompiledMethod* nm = iter.method();
1199 if (nm->is_dependent_on_method(dependee)) {
1200 ResourceMark rm;
1201 nm->mark_for_deoptimization();
1202 number_of_marked_CodeBlobs++;
1203 }
1204 }
1205
1206 return number_of_marked_CodeBlobs;
1207 }
1208
1209 void CodeCache::make_marked_nmethods_not_entrant() {
1210 assert_locked_or_safepoint(CodeCache_lock);
1211 CompiledMethodIterator iter;
1212 while(iter.next_alive()) {
1213 CompiledMethod* nm = iter.method();
1214 if (nm->is_marked_for_deoptimization() && !nm->is_not_entrant()) {
1215 nm->make_not_entrant();
1216 }
1217 }
1218 }
1219
1220 // Flushes compiled methods dependent on dependee.
1221 void CodeCache::flush_dependents_on(instanceKlassHandle dependee) {
1222 assert_lock_strong(Compile_lock);
1223
1224 if (number_of_nmethods_with_dependencies() == 0) return;
1225
1226 // CodeCache can only be updated by a thread_in_VM and they will all be
1227 // stopped during the safepoint so CodeCache will be safe to update without
1228 // holding the CodeCache_lock.
1229
1230 KlassDepChange changes(dependee);
1231
1232 // Compute the dependent nmethods
1233 if (mark_for_deoptimization(changes) > 0) {
1234 // At least one nmethod has been marked for deoptimization
|