Skip to content

Commit 3192ef3

Browse files
committedJun 22, 2020
8247736: Shenandoah: assert(_nm->is_alive()) failed: only alive nmethods here
Reviewed-by: rkennke, shade
1 parent 732d886 commit 3192ef3

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed
 

‎src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,7 @@ void ShenandoahNMethod::heal_nmethod(nmethod* nm) {
207207
}
208208

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

492491
#ifdef ASSERT
493-
void ShenandoahNMethodTable::assert_nmethods_alive_and_correct() {
492+
void ShenandoahNMethodTable::assert_nmethods_correct() {
494493
assert_locked_or_safepoint(CodeCache_lock);
495494

496495
for (int index = 0; index < length(); index ++) {
497496
ShenandoahNMethod* m = _list->at(index);
498497
// Concurrent unloading may have dead nmethods to be cleaned by sweeper
499498
if (m->is_unregistered()) continue;
500-
m->assert_alive_and_correct();
499+
m->assert_correct();
501500
}
502501
}
503502
#endif
@@ -563,8 +562,11 @@ void ShenandoahNMethodTableSnapshot::parallel_blobs_do(CodeBlobClosure *f) {
563562
continue;
564563
}
565564

566-
nmr->assert_alive_and_correct();
567-
f->do_code_blob(nmr->nm());
565+
// A nmethod can become a zombie before it is unregistered.
566+
if (nmr->nm()->is_alive()) {
567+
nmr->assert_correct();
568+
f->do_code_blob(nmr->nm());
569+
}
568570
}
569571
}
570572
}

‎src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class ShenandoahNMethod : public CHeapObj<mtGC> {
7373
static inline ShenandoahNMethod* gc_data(nmethod* nm);
7474
static inline void attach_gc_data(nmethod* nm, ShenandoahNMethod* gc_data);
7575

76-
void assert_alive_and_correct() NOT_DEBUG_RETURN;
76+
void assert_correct() NOT_DEBUG_RETURN;
7777
void assert_same_oops(bool allow_dead = false) NOT_DEBUG_RETURN;
7878
static void assert_no_oops(nmethod* nm, bool allow_dea = false) NOT_DEBUG_RETURN;
7979

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

163-
void assert_nmethods_alive_and_correct() NOT_DEBUG_RETURN;
163+
void assert_nmethods_correct() NOT_DEBUG_RETURN;
164164
private:
165165
// Rebuild table and replace current one
166166
void rebuild(int size);

0 commit comments

Comments
 (0)
Please sign in to comment.