--- old/src/hotspot/share/gc/g1/g1BarrierSet.inline.hpp 2018-06-11 16:16:18.022227015 -0400 +++ new/src/hotspot/share/gc/g1/g1BarrierSet.inline.hpp 2018-06-11 16:16:17.710210790 -0400 @@ -54,15 +54,14 @@ } } -inline void G1BarrierSet::enqueue_if_weak_or_archive(DecoratorSet decorators, oop value) { +inline void G1BarrierSet::enqueue_if_weak(DecoratorSet decorators, oop value) { assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known"); - // Archive roots need to be enqueued since they add subgraphs to the - // Java heap that were not there at the snapshot when marking started. - // Weak and phantom references also need enqueueing for similar reasons. - const bool in_archive_root = (decorators & IN_ARCHIVE_ROOT) != 0; + // Loading from a weak or phantom reference needs enqueueing, as + // the object may not have been reachable (part of the snapshot) + // when marking started. const bool on_strong_oop_ref = (decorators & ON_STRONG_OOP_REF) != 0; const bool peek = (decorators & AS_NO_KEEPALIVE) != 0; - const bool needs_enqueue = in_archive_root || (!peek && !on_strong_oop_ref); + const bool needs_enqueue = (!peek && !on_strong_oop_ref); if (needs_enqueue && value != NULL) { enqueue(value); @@ -74,7 +73,7 @@ inline oop G1BarrierSet::AccessBarrier:: oop_load_not_in_heap(T* addr) { oop value = ModRef::oop_load_not_in_heap(addr); - enqueue_if_weak_or_archive(decorators, value); + enqueue_if_weak(decorators, value); return value; } @@ -83,7 +82,7 @@ inline oop G1BarrierSet::AccessBarrier:: oop_load_in_heap(T* addr) { oop value = ModRef::oop_load_in_heap(addr); - enqueue_if_weak_or_archive(decorators, value); + enqueue_if_weak(decorators, value); return value; } @@ -91,7 +90,7 @@ inline oop G1BarrierSet::AccessBarrier:: oop_load_in_heap_at(oop base, ptrdiff_t offset) { oop value = ModRef::oop_load_in_heap_at(base, offset); - enqueue_if_weak_or_archive(AccessBarrierSupport::resolve_possibly_unknown_oop_ref_strength(base, offset), value); + enqueue_if_weak(AccessBarrierSupport::resolve_possibly_unknown_oop_ref_strength(base, offset), value); return value; }