Skip to content

Commit 3c3469b

Browse files
committed
8256020: Shenandoah: Don't resurrect objects during evacuation on AS_NO_KEEPALIVE
Reviewed-by: shade
1 parent 2e19026 commit 3c3469b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,15 @@ inline oop ShenandoahBarrierSet::load_reference_barrier(oop obj, T* load_addr) {
106106
if (!HasDecorator<decorators, ON_STRONG_OOP_REF>::value && obj != NULL &&
107107
_heap->is_concurrent_weak_root_in_progress() &&
108108
!_heap->marking_context()->is_marked(obj)) {
109-
Thread* thr = Thread::current();
110-
if (thr->is_Java_thread()) {
111-
return NULL;
112-
} else {
113-
// This path is sometimes (rarely) taken by GC threads.
114-
// See e.g.: https://bugs.openjdk.java.net/browse/JDK-8237874
115-
return obj;
116-
}
109+
return NULL;
110+
}
111+
112+
// Prevent resurrection of unreachable objects that are visited during
113+
// concurrent class-unloading.
114+
if (HasDecorator<decorators, AS_NO_KEEPALIVE>::value && obj != NULL &&
115+
_heap->is_evacuation_in_progress() &&
116+
!_heap->marking_context()->is_marked(obj)) {
117+
return obj;
117118
}
118119

119120
oop fwd = load_reference_barrier(obj);

0 commit comments

Comments
 (0)