8225770: ZGC: C2: Generates on_weak instead of on_strong barriers
authorstefank
Tue, 02 Jul 2019 12:10:18 +0200
changeset 55601 cba615623d09
parent 55600 3dcc40f328ea
child 55602 73395f9cad54
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	Wed Jul 03 23:34:20 2019 +0000
+++ 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	Wed Jul 03 23:34:20 2019 +0000
+++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp	Tue Jul 02 12:10:18 2019 +0200
@@ -149,13 +149,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;