Skip to content
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

Merged
merged 1 commit into from
Sep 6, 2018

Conversation

alexcrichton
Copy link
Member

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.

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.
Copy link
Contributor

@gnzlbg gnzlbg left a 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")]
Copy link
Contributor

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.

Copy link
Contributor

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.) ?

Copy link
Member Author

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)

Copy link
Contributor

@gnzlbg gnzlbg Sep 6, 2018

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_... ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing, done! - #562

@alexcrichton alexcrichton merged commit 60f46da into rust-lang:master Sep 6, 2018
@alexcrichton alexcrichton deleted the add-wasm-atomics branch September 6, 2018 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants