< prev index next > src/hotspot/share/code/codeCache.cpp
}
}
void CodeCache::nmethods_do(void f(nmethod* nm)) {
assert_locked_or_safepoint(CodeCache_lock);
- NMethodIterator iter;
+ NMethodIterator iter(NMethodIterator::all_blobs);
while(iter.next()) {
f(iter.method());
}
}
void CodeCache::metadata_do(void f(Metadata* m)) {
assert_locked_or_safepoint(CodeCache_lock);
- NMethodIterator iter;
- while(iter.next_alive()) {
+ NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
iter.method()->metadata_do(f);
}
AOTLoader::metadata_do(f);
}
// Mark nmethods for unloading if they contain otherwise unreachable oops.
void CodeCache::do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred) {
assert_locked_or_safepoint(CodeCache_lock);
UnloadingScope scope(is_alive);
- CompiledMethodIterator iter;
- while(iter.next_alive()) {
+ CompiledMethodIterator iter(CompiledMethodIterator::only_alive);
+ while(iter.next()) {
iter.method()->do_unloading(unloading_occurred);
}
}
void CodeCache::blobs_do(CodeBlobClosure* f) {
verify_perm_nmethods(f);
}
// Temporarily mark nmethods that are claimed to be on the scavenge list.
void CodeCache::mark_scavenge_root_nmethods() {
- NMethodIterator iter;
- while(iter.next_alive()) {
+ NMethodIterator iter(NMethodIterator::only_alive);
+ while(iter.next()) {
nmethod* nm = iter.method();
assert(nm->scavenge_root_not_marked(), "clean state");
if (nm->on_scavenge_root_list())
nm->set_scavenge_root_marked();
}
}
// If the closure is given, run it on the unlisted nmethods.
// Also make sure that the effects of mark_scavenge_root_nmethods is gone.
void CodeCache::verify_perm_nmethods(CodeBlobClosure* f_or_null) {
- NMethodIterator iter;
- while(iter.next_alive()) {
+ NMethodIterator iter(NMethodIterator::only_alive);
+ while(iter.next()) {
nmethod* nm = iter.method();
bool call_f = (f_or_null != NULL);
assert(nm->scavenge_root_not_marked(), "must be already processed");
if (nm->on_scavenge_root_list())
call_f = false; // don't show this one to the client
}
#endif //PRODUCT
void CodeCache::verify_clean_inline_caches() {
#ifdef ASSERT
- NMethodIterator iter;
- while(iter.next_alive()) {
+ NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
nmethod* nm = iter.method();
assert(!nm->is_unloaded(), "Tautology");
nm->verify_clean_inline_caches();
nm->verify();
}
}
void CodeCache::verify_oops() {
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
VerifyOopClosure voc;
- NMethodIterator iter;
- while(iter.next_alive()) {
+ NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
nmethod* nm = iter.method();
nm->oops_do(&voc);
nm->verify_oop_relocations();
}
}
return _number_of_nmethods_with_dependencies;
}
void CodeCache::clear_inline_caches() {
assert_locked_or_safepoint(CodeCache_lock);
- CompiledMethodIterator iter;
- while(iter.next_alive()) {
+ CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
iter.method()->clear_inline_caches();
}
}
void CodeCache::cleanup_inline_caches() {
assert_locked_or_safepoint(CodeCache_lock);
- NMethodIterator iter;
- while(iter.next_alive()) {
+ NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
iter.method()->cleanup_inline_caches(/*clean_all=*/true);
}
}
// Keeps track of time spent for checking dependencies
nm->mark_for_deoptimization();
number_of_marked_CodeBlobs++;
}
}
- CompiledMethodIterator iter;
- while(iter.next_alive()) {
+ CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
CompiledMethod* nm = iter.method();
if (nm->is_marked_for_deoptimization()) {
// ...Already marked in the previous pass; don't count it again.
} else if (nm->is_evol_dependent_on(dependee)) {
ResourceMark rm;
// Deoptimize all methods
void CodeCache::mark_all_nmethods_for_deoptimization() {
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
- CompiledMethodIterator iter;
- while(iter.next_alive()) {
+ CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
CompiledMethod* nm = iter.method();
if (!nm->method()->is_method_handle_intrinsic()) {
nm->mark_for_deoptimization();
}
}
int CodeCache::mark_for_deoptimization(Method* dependee) {
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
int number_of_marked_CodeBlobs = 0;
- CompiledMethodIterator iter;
- while(iter.next_alive()) {
+ CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
CompiledMethod* nm = iter.method();
if (nm->is_dependent_on_method(dependee)) {
ResourceMark rm;
nm->mark_for_deoptimization();
number_of_marked_CodeBlobs++;
return number_of_marked_CodeBlobs;
}
void CodeCache::make_marked_nmethods_not_entrant() {
assert_locked_or_safepoint(CodeCache_lock);
- CompiledMethodIterator iter;
- while(iter.next_alive()) {
+ CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
+ while(iter.next()) {
CompiledMethod* nm = iter.method();
if (nm->is_marked_for_deoptimization() && !nm->is_not_entrant()) {
nm->make_not_entrant();
}
}
int bucketSize = 512;
int bucketLimit = max_nm_size / bucketSize + 1;
int *buckets = NEW_C_HEAP_ARRAY(int, bucketLimit, mtCode);
memset(buckets, 0, sizeof(int) * bucketLimit);
- NMethodIterator iter;
+ NMethodIterator iter(NMethodIterator::all_blobs);
while(iter.next()) {
nmethod* nm = iter.method();
if(nm->method() != NULL && nm->is_java_method()) {
buckets[nm->size() / bucketSize]++;
}
}
void CodeCache::print_codelist(outputStream* st) {
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
- CompiledMethodIterator iter;
- while (iter.next_alive()) {
+ CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
+ while (iter.next()) {
CompiledMethod* cm = iter.method();
ResourceMark rm;
char* method_name = cm->method()->name_and_sig_as_C_string();
st->print_cr("%d %d %d %s [" INTPTR_FORMAT ", " INTPTR_FORMAT " - " INTPTR_FORMAT "]",
cm->compile_id(), cm->comp_level(), cm->get_state(),
< prev index next >