8231250: Shenandoah: Traversal GC should keep alive weak load from heap
authorzgu
Mon, 23 Sep 2019 14:39:11 -0400
changeset 58272 e27564cd10e3
parent 58270 2921ee5e9881
child 58273 08a5148e7c4e
8231250: Shenandoah: Traversal GC should keep alive weak load from heap Reviewed-by: rkennke
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);
     }