Fix asm constraints in folly::MicroSpinLock::cas
authorbsimmers <bsimmers@fb.com>
Wed, 4 Dec 2013 21:58:07 +0000 (13:58 -0800)
committerJordan DeLong <jdelong@fb.com>
Fri, 20 Dec 2013 21:04:27 +0000 (13:04 -0800)
commitdb56587b0b4cbc33001732589bc79ab9271658bf
tree26d3045152678b86e6f26df7dedfad62a5eec989
parentab4ee5fa6242d9686a93e2ef5e813c0fce65d2b2
Fix asm constraints in folly::MicroSpinLock::cas

Summary:
If the compare part of cmpxchg fails, it writes the unexpected value
to %rax. At certain optimization levels this was causing me to hit an
incorrectly failed assertion in some thrift code. I also cleaned up the asm
statement to use named operands.

Test Plan: Added new test that fails before this diff.

Reviewed By: delong.j@fb.com

FB internal diff: D1083222
@override-unit-failures
folly/SmallLocks.h
folly/test/SmallLocksTest.cpp