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

Cleanup wasm32-wasi target #306

Merged
merged 2 commits into from
Oct 23, 2022
Merged

Cleanup wasm32-wasi target #306

merged 2 commits into from
Oct 23, 2022

Conversation

josephlr
Copy link
Member

This change ensures that we only compile our WASI implementation for 32-bit targets. The interaction between the WASI proposal and the memory64 proposal is not yet clear, wasmtime does not yet support using WASI with memory64, and many of the interfaces use 32-bit values for pointers.

This change also reduces the use of unsafe from the wasi implementation. As noted in #253, changes to Errno mean that we can't get the error message from the raw error code, but we can avoid using unsafe when converting this code to a NonZeroU32. This handling also makes WASI behave more like our other targets, which also manually check that errno is non-zero.

Signed-off-by: Joe Richey joerichey@google.com

This change ensures that we only compile our WASI implementation for
32-bit targets. The interaction between the WASI proposal and the
memory64 proposal is not yet clear, [wasmtime does not yet support](
bytecodealliance/wasmtime#3594 (comment))
using WASI with memory64, and many of the interfaces use 32-bit values
for pointers.

This change also reduces the use of `unsafe` from the wasi
implementation. As noted in #253, changes to `Errno` mean that we can't
get the error message from the raw error code, but we can avoid using
unsafe when converting this code to a NonZeroU32. This handling also
makes WASI behave more like our other targets, which also manually check
that errno is non-zero.

Signed-off-by: Joe Richey <joerichey@google.com>
Similar to this crate, the `wasi` crate just uses a `std` feature to
implement `std::error::Errno`, which we don't use.

Signed-off-by: Joe Richey <joerichey@google.com>
Copy link
Contributor

@briansmith briansmith left a comment

Choose a reason for hiding this comment

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

LGTM.

src/wasi.rs Show resolved Hide resolved
@josephlr josephlr merged commit ad08dd9 into master Oct 23, 2022
@josephlr josephlr deleted the wasi branch October 23, 2022 20:29
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.

3 participants