8225770: ZGC: C2: Generates on_weak instead of on_strong barriers
authorstefank
Tue, 02 Jul 2019 12:10:18 +0200
changeset 55553 b9171be3cf2a
parent 55552 9bd13d6dea77
child 55554 46579c68f7f4
8225770: ZGC: C2: Generates on_weak instead of on_strong barriers Reviewed-by: neliasso, eosterlund
src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp
src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp
--- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp	Tue Jul 02 13:20:27 2019 -0400
+++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp	Tue Jul 02 12:10:18 2019 +0200
@@ -128,14 +128,19 @@
   }
 }
 
-static bool load_require_barrier(LoadNode* load)      { return ((load->barrier_data() & RequireBarrier) != 0); }
-static bool load_has_weak_barrier(LoadNode* load)     { return ((load->barrier_data() & WeakBarrier) != 0); }
-static bool load_has_expanded_barrier(LoadNode* load) { return ((load->barrier_data() & ExpandedBarrier) != 0); }
+const uint NoBarrier       = 0;
+const uint RequireBarrier  = 1;
+const uint WeakBarrier     = 2;
+const uint ExpandedBarrier = 4;
+
+static bool load_require_barrier(LoadNode* load)      { return (load->barrier_data() & RequireBarrier)  == RequireBarrier; }
+static bool load_has_weak_barrier(LoadNode* load)     { return (load->barrier_data() & WeakBarrier)     == WeakBarrier; }
+static bool load_has_expanded_barrier(LoadNode* load) { return (load->barrier_data() & ExpandedBarrier) == ExpandedBarrier; }
 static void load_set_expanded_barrier(LoadNode* load) { return load->set_barrier_data(ExpandedBarrier); }
 
-static void load_set_barrier(LoadNode* load, bool weak)    {
+static void load_set_barrier(LoadNode* load, bool weak) {
   if (weak) {
-    load->set_barrier_data(WeakBarrier);
+    load->set_barrier_data(RequireBarrier | WeakBarrier);
   } else {
     load->set_barrier_data(RequireBarrier);
   }
--- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp	Tue Jul 02 13:20:27 2019 -0400
+++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp	Tue Jul 02 12:10:18 2019 +0200
@@ -146,13 +146,6 @@
   LoadBarrierNode* load_barrier_node(int idx) const;
 };
 
-enum BarrierInfo {
-    NoBarrier       = 0,
-    RequireBarrier  = 1,
-    WeakBarrier     = 3,  // Inclusive with RequireBarrier
-    ExpandedBarrier = 4
-};
-
 class ZBarrierSetC2 : public BarrierSetC2 {
 private:
   ZBarrierSetC2State* state() const;