MemNode::unordered/release/acquire use in relation to volatile stores and loads

David Holmes david.holmes at oracle.com
Sun Aug 3 23:51:15 UTC 2014


In ./share/vm/opto/library_call.cpp

Why is it that for volatile stores we have special checks for which 
MemNode to use:

   MemNode::MemOrd mo = is_volatile ? MemNode::release : MemNode::unordered;
     if (type != T_OBJECT ) {
       (void) store_to_memory(control(), adr, val, type, adr_type, mo, 
is_volatile);
     } else {

but for loads it is always unordered eg:

   Node* p = make_load(control(), adr, value_type, type, adr_type, 
MemNode::unordered, is_volatile);

?? I would have expected MemNode::acquire as in opto/parse3.cpp

   // Build the load.
   //
   MemNode::MemOrd mo = is_vol ? MemNode::acquire : MemNode::unordered;
   bool needs_atomic_access = is_vol || AlwaysAtomicAccesses;
   Node* ld = make_load(NULL, adr, type, bt, adr_type, mo, 
needs_atomic_access);



Thanks,
David



More information about the hotspot-dev mailing list