[concurrency-interest] VarHandle.setVolatile vs classical volatile write
akarnokd at gmail.com
Fri Aug 18 14:49:10 EDT 2017
in an older blog post (
about write barriers, it is mentioned the JIT uses a stack local address
and XADD to flush the write buffer when a volatile field is written on x86
and also mentions the option to use XCHG instead, targeting the actual
My question is, does a compiled VarHandle.setVolatile do the same XADD
trick or is it using XCHG? Has there been a newer performance evaluation
with XCHG since the blog post? In other terms, is there a performance
penalty/benefit in changing VarHandle.setVolatile() into
VarHandle.getAndSet() when considering a modern x86 ?
My particular use case is for running code designed for concurrency in
non-concurrent fashion and perhaps saving the cost of a MOVE + XADD pair
when an XCHG has the very same effect.
Thank you for your time.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest