comparison src/share/vm/opto/parse3.cpp @ 14662:3c3953fb3f2a

8033380: Experimental VM flag to enforce access atomicity Summary: -XX:+AlwaysAtomicAccesses to unconditionally enforce the access atomicity. Reviewed-by: roland, kvn, iveresov
author shade
date Mon, 03 Mar 2014 15:54:45 +0400
parents 45467c53f178
children 3edd4a71588b
comparison
equal deleted inserted replaced
14661:bbfe3ac1471d 14662:3c3953fb3f2a
231 insert_mem_bar(Op_MemBarVolatile); // StoreLoad barrier 231 insert_mem_bar(Op_MemBarVolatile); // StoreLoad barrier
232 } 232 }
233 // Build the load. 233 // Build the load.
234 // 234 //
235 MemNode::MemOrd mo = is_vol ? MemNode::acquire : MemNode::unordered; 235 MemNode::MemOrd mo = is_vol ? MemNode::acquire : MemNode::unordered;
236 Node* ld = make_load(NULL, adr, type, bt, adr_type, mo, is_vol); 236 bool needs_atomic_access = is_vol || AlwaysAtomicAccesses;
237 Node* ld = make_load(NULL, adr, type, bt, adr_type, mo, needs_atomic_access);
237 238
238 // Adjust Java stack 239 // Adjust Java stack
239 if (type2size[bt] == 1) 240 if (type2size[bt] == 1)
240 push(ld); 241 push(ld);
241 else 242 else
312 } else { 313 } else {
313 field_type = TypeOopPtr::make_from_klass(field->type()->as_klass()); 314 field_type = TypeOopPtr::make_from_klass(field->type()->as_klass());
314 } 315 }
315 store = store_oop_to_object(control(), obj, adr, adr_type, val, field_type, bt, mo); 316 store = store_oop_to_object(control(), obj, adr, adr_type, val, field_type, bt, mo);
316 } else { 317 } else {
317 store = store_to_memory(control(), adr, val, bt, adr_type, mo, is_vol); 318 bool needs_atomic_access = is_vol || AlwaysAtomicAccesses;
319 store = store_to_memory(control(), adr, val, bt, adr_type, mo, needs_atomic_access);
318 } 320 }
319 321
320 // If reference is volatile, prevent following volatiles ops from 322 // If reference is volatile, prevent following volatiles ops from
321 // floating up before the volatile write. 323 // floating up before the volatile write.
322 if (is_vol) { 324 if (is_vol) {