< prev index next >

src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp

Print this page
rev 58543 : 8241605: Shenandoah: More aggressive reference discovery

@@ -587,13 +587,18 @@
     bool in_native = (decorators & IN_NATIVE) != 0;
     bool need_cpu_mem_bar = !is_unordered || mismatched || in_native;
 
     if (on_weak_ref) {
       // Use the pre-barrier to record the value in the referent field
+      if (ShenandoahAggressiveReferenceDiscovery) {
+        load = shenandoah_enqueue_barrier(kit, load);
+      } else {
       satb_write_barrier_pre(kit, false /* do_load */,
-                             NULL /* obj */, NULL /* adr */, max_juint /* alias_idx */, NULL /* val */, NULL /* val_type */,
+                               NULL /* obj */, NULL /* adr */, max_juint /* alias_idx */, NULL /* val */,
+                               NULL /* val_type */,
                              load /* pre_val */, T_OBJECT);
+      }
       // Add memory barrier to prevent commoning reads from this field
       // across safepoint since GC can change its value.
       kit->insert_mem_bar(Op_MemBarCPUOrder);
     } else if (unknown) {
       // We do not require a mem bar inside pre_barrier if need_mem_bar
< prev index next >