Skip to content

Commit

Permalink
8247736: Shenandoah: assert(_nm->is_alive()) failed: only alive nmeth…
Browse files Browse the repository at this point in the history
…ods here

Reviewed-by: rkennke, shade
  • Loading branch information
zhengyu123 committed Jun 22, 2020
1 parent 732d886 commit 3192ef3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ void ShenandoahNMethod::heal_nmethod(nmethod* nm) {
}

#ifdef ASSERT
void ShenandoahNMethod::assert_alive_and_correct() {
assert(_nm->is_alive(), "only alive nmethods here");
void ShenandoahNMethod::assert_correct() {
ShenandoahHeap* heap = ShenandoahHeap::heap();
for (int c = 0; c < _oops_count; c++) {
oop *loc = _oops[c];
Expand Down Expand Up @@ -490,14 +489,14 @@ void ShenandoahNMethodTable::log_flush_nmethod(nmethod* nm) {
}

#ifdef ASSERT
void ShenandoahNMethodTable::assert_nmethods_alive_and_correct() {
void ShenandoahNMethodTable::assert_nmethods_correct() {
assert_locked_or_safepoint(CodeCache_lock);

for (int index = 0; index < length(); index ++) {
ShenandoahNMethod* m = _list->at(index);
// Concurrent unloading may have dead nmethods to be cleaned by sweeper
if (m->is_unregistered()) continue;
m->assert_alive_and_correct();
m->assert_correct();
}
}
#endif
Expand Down Expand Up @@ -563,8 +562,11 @@ void ShenandoahNMethodTableSnapshot::parallel_blobs_do(CodeBlobClosure *f) {
continue;
}

nmr->assert_alive_and_correct();
f->do_code_blob(nmr->nm());
// A nmethod can become a zombie before it is unregistered.
if (nmr->nm()->is_alive()) {
nmr->assert_correct();
f->do_code_blob(nmr->nm());
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class ShenandoahNMethod : public CHeapObj<mtGC> {
static inline ShenandoahNMethod* gc_data(nmethod* nm);
static inline void attach_gc_data(nmethod* nm, ShenandoahNMethod* gc_data);

void assert_alive_and_correct() NOT_DEBUG_RETURN;
void assert_correct() NOT_DEBUG_RETURN;
void assert_same_oops(bool allow_dead = false) NOT_DEBUG_RETURN;
static void assert_no_oops(nmethod* nm, bool allow_dea = false) NOT_DEBUG_RETURN;

Expand Down Expand Up @@ -160,7 +160,7 @@ class ShenandoahNMethodTable : public CHeapObj<mtGC> {
ShenandoahNMethodTableSnapshot* snapshot_for_iteration();
void finish_iteration(ShenandoahNMethodTableSnapshot* snapshot);

void assert_nmethods_alive_and_correct() NOT_DEBUG_RETURN;
void assert_nmethods_correct() NOT_DEBUG_RETURN;
private:
// Rebuild table and replace current one
void rebuild(int size);
Expand Down

0 comments on commit 3192ef3

Please sign in to comment.