help understanding lock instruction in OrderAccess::fence()
恶灵骑士
1072213404 at qq.com
Tue Nov 8 08:48:44 UTC 2016
hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp
inline void OrderAccess::fence() {
if (os::is_MP()) {
// always use locked addl since mfence is sometimes expensive
#ifdef AMD64
__asm__ volatile ("lock; addl $0,0(%%rsp)" : : : "cc", "memory");
#else
__asm__ volatile ("lock; addl $0,0(%%esp)" : : : "cc", "memory");
#endif
}
}
my classmates think that code “addl $0,0(%%esp)” having some specific effect,
because esp points to the top of stack .
it that true ?
or the code “addl $0,0(%%esp)” just equals no op,
needing one operation after lock at least, otherwise lock instruction will produce an error .
Thank you !
Arron
More information about the hotspot-dev
mailing list