# HG changeset patch # User zgu # Date 1569263951 14400 # Node ID e27564cd10e3fe6ef8e423158f7e0ed1c95acbf4 # Parent 2921ee5e9881c0f2fe5fd8b5831ec9602ed1448c 8231250: Shenandoah: Traversal GC should keep alive weak load from heap Reviewed-by: rkennke diff -r 2921ee5e9881 -r e27564cd10e3 src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp --- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp Mon Sep 23 08:52:05 2019 -0700 +++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp Mon Sep 23 14:39:11 2019 -0400 @@ -466,17 +466,13 @@ bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0; bool not_in_heap = (decorators & IN_NATIVE) != 0; bool on_reference = on_weak || on_phantom; - bool keep_alive = (decorators & AS_NO_KEEPALIVE) == 0; + bool is_traversal_mode = ShenandoahHeap::heap()->is_traversal_mode(); + bool keep_alive = ((decorators & AS_NO_KEEPALIVE) == 0) || is_traversal_mode; BarrierSetAssembler::load_at(masm, decorators, type, dst, src, tmp1, tmp_thread); if (on_oop) { - if (not_in_heap) { - if (ShenandoahHeap::heap()->is_traversal_mode()) { - load_reference_barrier(masm, dst); - keep_alive = true; - } else { - load_reference_barrier_native(masm, dst); - } + if (not_in_heap && !is_traversal_mode) { + load_reference_barrier_native(masm, dst); } else { load_reference_barrier(masm, dst); }