-
Notifications
You must be signed in to change notification settings - Fork 275
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
Add wasm32 atomic intrinsics #561
Conversation
Currently these are gated by the `atomics` feature unconditionally, but that may be tweaked in the future! Otherwise this should enable building out some primitives in the standard library using these intrinsics.
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.
LGTM minor one nitpick.
//! | ||
//! [spec]: https://github.com/WebAssembly/threads | ||
|
||
#![cfg(target_feature = "atomics")] |
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 think this should be in the parent hiding the module, and the re-export of these.
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.
Ah wait, I see you did the same in the memory module, do we want to export the modules themselves (atomic
, memory
, simd128
, etc.) ?
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.
Sure yeah, do you mean just the attribute or the functions too?
On a possibly random tangent about function names...
I'm starting to get a little torn on the naming of the functions here. Technically the function name should be wasm32::i32::atomic::wait
but that's a lot of ::
. Currently wasm32::atomic::i32_wait
is sort of weirdly inconsistent. What do you think of wasm32::i32_atomic_wait
? Basically translating all .
to _
and we have toplevel functions for all the operations? (this'd affect the SIMD proposal slightly)
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'm starting to get a little torn on the naming of the functions here.
Me too, in the simd module we also had problems with this. Maybe we should just open an issue to discuss this, e.g., show examples of the wasm names, and how could we make them consistent in Rust.
In the mean time I think we can do "whatever". The other PR puts the intrinsics behind a memory::
so I don't mind them here being behind atomic::
and the simd module puts them behind e.g. i32x4::
IIRC and the other vector type names, so at least it remains consistent for now.
About the best way to do this, I am not a super huge fan of i32_atomic_wait
, but I don't really like the many ::
either :/ What does clang do? __builtin_...
?
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.
Sure thing, done! - #562
Currently these are gated by the
atomics
feature unconditionally, but that maybe tweaked in the future! Otherwise this should enable building out some
primitives in the standard library using these intrinsics.