--- a/src/hotspot/share/opto/memnode.hpp Thu Sep 20 21:47:13 2018 +0200
+++ b/src/hotspot/share/opto/memnode.hpp Thu Sep 20 22:01:12 2018 +0200
@@ -190,7 +190,7 @@
public:
LoadNode(Node *c, Node *mem, Node *adr, const TypePtr* at, const Type *rt, MemOrd mo, ControlDependency control_dependency)
- : MemNode(c,mem,adr,at), _type(rt), _mo(mo), _control_dependency(control_dependency) {
+ : MemNode(c,mem,adr,at), _control_dependency(control_dependency), _mo(mo), _type(rt) {
init_class_id(Class_Load);
}
inline bool is_unordered() const { return !is_acquire(); }
@@ -607,6 +607,8 @@
// have all possible loads of the value stored been optimized away?
bool value_never_loaded(PhaseTransform *phase) const;
+
+ MemBarNode* trailing_membar() const;
};
//------------------------------StoreBNode-------------------------------------
@@ -816,6 +818,7 @@
virtual const class TypePtr *adr_type() const { return _adr_type; } // returns bottom_type of address
bool result_not_used() const;
+ MemBarNode* trailing_membar() const;
};
class LoadStoreConditionalNode : public LoadStoreNode {
@@ -1142,6 +1145,20 @@
// Memory type this node is serializing. Usually either rawptr or bottom.
const TypePtr* _adr_type;
+ // How is this membar related to a nearby memory access?
+ enum {
+ Standalone,
+ TrailingLoad,
+ TrailingStore,
+ LeadingStore,
+ TrailingLoadStore,
+ LeadingLoadStore
+ } _kind;
+
+#ifdef ASSERT
+ uint _pair_idx;
+#endif
+
public:
enum {
Precedent = TypeFunc::Parms // optional edge to force precedence
@@ -1159,6 +1176,24 @@
static MemBarNode* make(Compile* C, int opcode,
int alias_idx = Compile::AliasIdxBot,
Node* precedent = NULL);
+
+ MemBarNode* trailing_membar() const;
+ MemBarNode* leading_membar() const;
+
+ void set_trailing_load() { _kind = TrailingLoad; }
+ bool trailing_load() const { return _kind == TrailingLoad; }
+ bool trailing_store() const { return _kind == TrailingStore; }
+ bool leading_store() const { return _kind == LeadingStore; }
+ bool trailing_load_store() const { return _kind == TrailingLoadStore; }
+ bool leading_load_store() const { return _kind == LeadingLoadStore; }
+ bool trailing() const { return _kind == TrailingLoad || _kind == TrailingStore || _kind == TrailingLoadStore; }
+ bool leading() const { return _kind == LeadingStore || _kind == LeadingLoadStore; }
+ bool standalone() const { return _kind == Standalone; }
+
+ static void set_store_pair(MemBarNode* leading, MemBarNode* trailing);
+ static void set_load_store_pair(MemBarNode* leading, MemBarNode* trailing);
+
+ void remove(PhaseIterGVN *igvn);
};
// "Acquire" - no following ref can move before (but earlier refs can