On Thu, Aug 11, 2016 at 2:12 PM, Aleksey Shipilev < aleksey.shipi...@gmail.com> wrote:
> On 08/11/2016 11:56 PM, Martin Buchholz wrote: > > I can imagine a machine that has a native cas instruction, but no native > > exchange instruction, but no one ever got fired for optimizing for x86. > > ...which would be less of an issue once we switch to proper-boolean > VarHandles, not the int-simulation. This way, implementations may choose > how to implement boolean getAndSet. Probably in Unsafe, but that would > still be lower and more reusable than in AtomicBoolean alone. > I like the current int simulation, at least for AtomicBoolean. You'll never save space by switching to boolean, because of alignment, and you don't have to worry about machines without byte-sized instructions. But like I always say, "no one ever got fired for optimizing for x86"!