Skip to content
Permalink
Browse files

8240693: Sweeper should not examine dying metadata in is_unloading() …

…nmethod during static call stub cleaning

Reviewed-by: kvn, coleenp, pliden
  • Loading branch information
fisk committed Apr 8, 2020
1 parent 76a8557 commit a5b81d97f9a28b91fd2768e68ce0f71e9005472c
Showing with 7 additions and 2 deletions.
  1. +2 −2 src/hotspot/share/code/codeCache.cpp
  2. +5 −0 src/hotspot/share/code/compiledMethod.cpp
@@ -1073,8 +1073,8 @@ void CodeCache::old_nmethods_do(MetadataClosure* f) {
length = old_compiled_method_table->length();
for (int i = 0; i < length; i++) {
CompiledMethod* cm = old_compiled_method_table->at(i);
// Only walk alive nmethods, the dead ones will get removed by the sweeper.
if (cm->is_alive()) {
// Only walk alive nmethods, the dead ones will get removed by the sweeper or GC.
if (cm->is_alive() && !cm->is_unloading()) {
old_compiled_method_table->at(i)->metadata_do(f);
}
}
@@ -642,6 +642,11 @@ bool CompiledMethod::cleanup_inline_caches_impl(bool unloading_occurred, bool cl
continue;
}
is_in_static_stub = false;
if (is_unloading()) {
// If the nmethod itself is dying, then it may point at dead metadata.
// Nobody should follow that metadata; it is strictly unsafe.
continue;
}
metadata_Relocation* r = iter.metadata_reloc();
Metadata* md = r->metadata_value();
if (md != NULL && md->is_method()) {

0 comments on commit a5b81d9

Please sign in to comment.