-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Support Atomic(T)#compare_and_set
when T
is a reference union
#13565
Support Atomic(T)#compare_and_set
when T
is a reference union
#13565
Conversation
end | ||
|
||
# Performs `atomic_value &+= value`. Returns the old value. | ||
# | ||
# `T` cannot contain any reference types. |
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.
I'd suggest adding a NOTE
admonition.
ditto elsewhere
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.
Can you elaborate why? This seems like a very basic part of the description, rather than a callout.
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.
It's a hard requirement, thus IMO deserves visibility.
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.
But that's not exactly what NOTE
admonitions are for.
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.
It's hard to use admonitions or agree on what they should mean. I think NOTE: should be the same as a footnote, but it's hard to stick to this definition because the reality is that the current look increases visibility rather than decrease it.
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.
@straight-shoota Oh, I didn't know they're defined (not in the docs they aren't at least) ;)
It turns out LLVM doesn't support pointers in |
Would it be sensible to still add support for it for LLVM >= 15? |
We just need to bring back the existing |
This reverts commit 35f7048.
Atomic(T)#compare_and_set
was not working whenT
is a union of reference types, because it wrongly used the code path for nilable reference unions. This PR fixes that by removing legacy code that is only relevant before LLVM 3.9.It also adds checks against
T
in the arithmetic methods to make sureT
is an arithmetic type rather than a pointer. LLVM would produce module validation errors otherwise ifAtomic
doesn't catch those errors.