This adds support for [[ https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md#wait | atomic.wait ]] / [[ https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md#wake | atomic.wake ]] instructions in the wasm thread proposal.
Details
Diff Detail
- Repository
- rL LLVM
- Build Status
Buildable 20461 Build 20461: arc lint + arc unit
Event Timeline
Does atomic.wake possibly load the given address? It is marked as such for now to be safe. Would it have any problems, or would it be unnecessary?
I guess there's no sane way to make MachineMemOperand of wait and wake instructions return true on isAtomic() anyway. First, LLVM currently does not seem to provide atomic memory intrinsic other than few predefined target-independent intrinsics, and there's no code that depends on MachineMemOperand::isAtomic() in the backend passes anyway.
Note that in JS, atomics.wake is now atomics.notify (https://github.com/tc39/ecma262/pull/1220). So we should use the new terminology for new and internal stuff. Since there's no legacy yet (except maybe in Binaryen's and WABT's text parser) hopefully LLVM can just use "notify" everywhere.
I think wake does not load the given address. the list of waiters is outside of the memory and invisible to LLVM, it just happens to share the same index space. So I think hasSideEffects is the right way to model that.
include/llvm/IR/IntrinsicsWebAssembly.td | ||
---|---|---|
75 | Same signature adjustments as suggested in the clang CL. |
Do you think we should also suggest to change wake to notify in the thread proposal?
include/llvm/IR/IntrinsicsWebAssembly.td | ||
---|---|---|
75 | I added some comments in that CL, PTAL. |
I would imagine that's already on Ben's plate to do sometime, but yes it should be changed to match JS.
include/llvm/IR/IntrinsicsWebAssembly.td | ||
---|---|---|
75 | Yeah, so this signature would be unchanged then, since there's no signed/unsigned distinction in the IR either. |
Same signature adjustments as suggested in the clang CL.