8075805: Crash while trying to release CompiledICHolder

Removed nmethod transition to zombie outside of sweeper. Added cleaning of ICs of unloaded nmethods.

Reviewed-by: kvn, iveresov
This commit is contained in:
Tobias Hartmann 2015-08-25 07:49:55 +02:00
parent a9e232a8ef
commit 72e8f28d56
8 changed files with 29 additions and 55 deletions

View file

@ -746,14 +746,17 @@ void CodeCache::gc_prologue() {
void CodeCache::gc_epilogue() {
assert_locked_or_safepoint(CodeCache_lock);
NMethodIterator iter;
while(iter.next_alive()) {
while(iter.next()) {
nmethod* nm = iter.method();
assert(!nm->is_unloaded(), "Tautology");
if (needs_cache_clean()) {
nm->cleanup_inline_caches();
if (!nm->is_zombie()) {
if (needs_cache_clean()) {
// Clean ICs of unloaded nmethods as well because they may reference other
// unloaded nmethods that may be flushed earlier in the sweeper cycle.
nm->cleanup_inline_caches();
}
DEBUG_ONLY(nm->verify());
DEBUG_ONLY(nm->verify_oop_relocations());
}
DEBUG_ONLY(nm->verify());
DEBUG_ONLY(nm->verify_oop_relocations());
}
set_needs_cache_clean(false);
prune_scavenge_root_nmethods();
@ -993,29 +996,6 @@ int CodeCache::mark_for_deoptimization(Method* dependee) {
return number_of_marked_CodeBlobs;
}
void CodeCache::make_marked_nmethods_zombies() {
assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
NMethodIterator iter;
while(iter.next_alive()) {
nmethod* nm = iter.method();
if (nm->is_marked_for_deoptimization()) {
// If the nmethod has already been made non-entrant and it can be converted
// then zombie it now. Otherwise make it non-entrant and it will eventually
// be zombied when it is no longer seen on the stack. Note that the nmethod
// might be "entrant" and not on the stack and so could be zombied immediately
// but we can't tell because we don't track it on stack until it becomes
// non-entrant.
if (nm->is_not_entrant() && nm->can_not_entrant_be_converted()) {
nm->make_zombie();
} else {
nm->make_not_entrant();
}
}
}
}
void CodeCache::make_marked_nmethods_not_entrant() {
assert_locked_or_safepoint(CodeCache_lock);
NMethodIterator iter;
@ -1072,7 +1052,7 @@ void CodeCache::flush_evol_dependents_on(instanceKlassHandle ev_k_h) {
// Deoptimize all activations depending on marked nmethods
Deoptimization::deoptimize_dependents();
// Make the dependent methods not entrant (in VM_Deoptimize they are made zombies)
// Make the dependent methods not entrant
make_marked_nmethods_not_entrant();
}
}
@ -1102,7 +1082,7 @@ void CodeCache::flush_dependents_on_method(methodHandle m_h) {
// Deoptimize all activations depending on marked nmethods
Deoptimization::deoptimize_dependents();
// Make the dependent methods not entrant (in VM_Deoptimize they are made zombies)
// Make the dependent methods not entrant
make_marked_nmethods_not_entrant();
}
}