hotspot/src/cpu/x86/vm/assembler_x86.hpp
// Serializes memory and blows flags
void membar(Membar_mask_bits order_constraint) {
{- -------------------------------------------
(1) MP 環境でなければ, メモリバリアは必要ないので何もしない.
---------------------------------------- -}
if (os::is_MP()) {
{- -------------------------------------------
(1) 要求されているのが StoreLoad でなければ, バリアは不要なので何もしない.
---------------------------------------- -}
// We only have to handle StoreLoad
if (order_constraint & StoreLoad) {
{- -------------------------------------------
(1) lock 付きの nop (より正確には addl [rsp],0) を出すことでメモリバリアコードとする.
---------------------------------------- -}
// All usable chips support "locked" instructions which suffice
// as barriers, and are much faster than the alternative of
// using cpuid instruction. We use here a locked add [esp],0.
// This is conveniently otherwise a no-op except for blowing
// flags.
// Any change to this code may need to revisit other places in
// the code where this idiom is used, in particular the
// orderAccess code.
lock();
addl(Address(rsp, 0), 0);// Assert the lock# signal here
}
}
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.