提交 2fc5e409 编写于 作者: K kvn

8054927: Missing MemNode::acquire ordering in some volatile Load nodes

Summary: Fixed memory ordering parameter and added missing barriers for volatile loads.
Reviewed-by: roland, iveresov
上级 fa413814
......@@ -2650,7 +2650,8 @@ bool LibraryCallKit::inline_unsafe_access(bool is_native_ptr, bool is_store, Bas
if (need_mem_bar) insert_mem_bar(Op_MemBarCPUOrder);
if (!is_store) {
Node* p = make_load(control(), adr, value_type, type, adr_type, MemNode::unordered, is_volatile);
MemNode::MemOrd mo = is_volatile ? MemNode::acquire : MemNode::unordered;
Node* p = make_load(control(), adr, value_type, type, adr_type, mo, is_volatile);
// load value
switch (type) {
case T_BOOLEAN:
......@@ -5912,8 +5913,19 @@ Node * LibraryCallKit::load_field_from_object(Node * fromObj, const char * field
type = Type::get_const_basic_type(bt);
}
if (support_IRIW_for_not_multiple_copy_atomic_cpu && is_vol) {
insert_mem_bar(Op_MemBarVolatile); // StoreLoad barrier
}
// Build the load.
Node* loadedField = make_load(NULL, adr, type, bt, adr_type, MemNode::unordered, is_vol);
MemNode::MemOrd mo = is_vol ? MemNode::acquire : MemNode::unordered;
Node* loadedField = make_load(NULL, adr, type, bt, adr_type, mo, is_vol);
// If reference is volatile, prevent following memory ops from
// floating up past the volatile read. Also prevents commoning
// another volatile read.
if (is_vol) {
// Memory barrier includes bogus read of value to force load BEFORE membar
insert_mem_bar(Op_MemBarAcquire, loadedField);
}
return loadedField;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册