-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use inline assembly in full_fence #71
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, but I'll let @RalfJung, the human UB detector, make the final call
// It is common to use `lock or` here, but when using a local variable, `lock not`, which | ||
// does not change the flag, should be slightly more efficient. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Note on potential future optimization: I have not benchmarked, but using xchg
(lock
prefix is implied) here may potentially be faster than lock not
. The number of registers used will increase, but the value at a
and the value to be written can be uninit. Making the value at a
uninit with lock not
is fine from a hardware standpoint, but Valgrind will probably be angry about it.)
Sorry, when it comes to inline assembly I'm out.^^ I can't even read assembly. ;) However the compiler certainly has to assume that an inline assembly block (without |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Fixes #70
cc @RalfJung