Support threads with wasm64 / memory64
Hi team!
It would be great to support wasm-bindgen threading when targeting wasm64 / memory64.
Summary
Currently the threads transform explicitly rejects memory64:
// TODO: support memory64. This transform currently emits i32 addresses for
// thread counters, locks, stacks, and allocator calls.
if mem.memory64 {
bail!("threading does not currently support memory64");
}This prevents using WebAssembly threads together with memory64.
Motivation
We're experimenting with wasm64 for applications that can exceed the addressing limitations of wasm32, while still needing WebAssembly threads / shared memory.
Being able to combine:
memory64- shared WebAssembly memory
- atomics / threads
wasm-bindgen
would make wasm64 considerably more useful for larger Rust/WebAssembly applications.
Expected behavior
The threads transform should support a memory64 memory and emit the appropriate 64-bit addresses for things such as:
- thread counters
- locks
- thread stacks
- allocator-related calls
- other addresses currently emitted as
i32
Current behavior
Attempting to use threading with a memory64 module fails with:
threading does not currently support memory64Question
Is memory64 support for the threads transform already planned or being tracked somewhere?
If not, would the maintainers be open to adding support for it? Any guidance on the expected scope or implementation approach would also be appreciated.
Source: wasm-bindgen/wasm-bindgen