Stream: git-wasmtime

Topic: wasmtime / issue #11747 Consider integrating `ecmascript_...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 26 2025 at 19:42):

alexcrichton added the wasm-proposal:threads label to Issue #11747.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 26 2025 at 19:42):

alexcrichton opened issue #11747:

Awhile back I started a discussion on the Rust Zulip about implementing the wasm threads proposal in Pulley. The conclusion at the time was that (a) this isn't possible in safe Rust, (b) it should be possible with inline assembly, and (c) we weren't going to pursue it for Pulley due to the portability goal of Pulley in the meantime. The consequence of this in Wasmtime is this line of code and a notable lack of anything atomic in Pulley's interpreter.

In the meantime the discussion on the Zulip issue continued on and resulted in publishing a crate named ecmascript_atomics which is targeted at this exact use case. This crate looks to be drawn from SpiderMonkey's implementation of the same. There are two reasons I think we'll want to integrate this crate:

The main barrier to adopting this crate is portability at this time. As of the time of this writing it has support for x86, x86_64, aarch64, and arm. This notably does not include platforms Cranelift supports such as s390x and riscv64 and does not include "theoretically all platforms Rust compiles to" for Pulley. Nevertheless I think this would be worthwhile to integrate into Wasmtime as so:

With all that in place we could still benefit from this crate, despite the lack of portability. While it probably isn't too hard to add s390x/riscv64 the lack of portability in this approach is pretty fundamental. I don't think that should block us from integrating it at all, however, but conditionally disabling threads in Pulley would be a reasonable consequence that reflects an accurate depiction of support.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 07 2025 at 19:00):

aapoalas commented on issue #11747:

I'm also very open to add (or implement myself when I find the time and enthusiasm) an AtomicUsize/AtomicU64 based generic implementation into ecmascript_atomics that would work within the Rust memory model using usize or u64 CAS operations to "polyfill" the atomic operations. This would be pretty nice to have especially since it would mean its possible to run the library under Miri. (This isn't helpful for verifying the library itself, but any users could benefit.)


Last updated: Dec 06 2025 at 06:05 UTC