Stream: git-wasmtime

Topic: wasmtime / PR #5225 wiggle: add initial support for share...


view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2022 at 16:50):

abrown opened PR #5225 from shmem-in-wiggle-read-write to main:

This change is the first in a series of changes to support shared memory in Wiggle. Since Wiggle was written under the assumption of single-threaded guest-side access, this change introduces a shared field to guest memories in order to flag when this assumption will not be the case. This change always sets shared to false; once a few more pieces are in place, shared will be set dynamically when a shared memory is detected, e.g., in a change like #5054.

Using the shared field, we can now decide to load Wiggle values differently under the new assumptions. This change makes the guest T::read and T::write calls into Relaxed atomic loads and stores in order to maintain WebAssembly's expected memory consistency guarantees. We choose Rust's Relaxed here to match the Unordered memory consistency described in the [memory model] section of the ECMA spec.

[memory model]: https://tc39.es/ecma262/multipage/memory-model.html#sec-memory-model

Since 128-bit scalar types do not have Atomic* equivalents, we remove their T::read and T::write implementations here. They are unused by any WASI implementations in the project.

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2022 at 16:59):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2022 at 16:59):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2022 at 16:59):

alexcrichton created PR review comment:

Similar to above, a conversion to little endian wil lneed to happen here

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2022 at 16:59):

alexcrichton created PR review comment:

I think that this'll need the same *_le_* treatment as below, although I realize that'll get funky with the macro here.

For converting between f32 and i32 could f32::from_bits and to_bits be used instead of transmute as well?

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2022 at 17:59):

abrown updated PR #5225 from shmem-in-wiggle-read-write to main.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2022 at 18:01):

abrown has marked PR #5225 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2022 at 18:31):

abrown requested alexcrichton for a review on PR #5225.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2022 at 18:52):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2022 at 18:52):

alexcrichton created PR review comment:

Could this use host_ptr.cast::<$ty_atomic>() to avoid the as?

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2022 at 18:52):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2022 at 19:23):

abrown updated PR #5225 from shmem-in-wiggle-read-write to main.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 08 2022 at 21:25):

abrown merged PR #5225.


Last updated: Dec 23 2024 at 12:05 UTC