8225770: ZGC: C2: Generates on_weak instead of on_strong barriers
Reviewed-by: neliasso, eosterlund
--- 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;