-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
no_std support for wasmparser #3495
Comments
This is an outsider's perspective, so take it with a grain of salt.
I think that's one of the main issues with supporting While I can understand the reasoning behind why I think it's more than fair for the maintainers to be cautious about limiting the project to a |
There is no reason why a compiler backend or wasmparser should ever want to print to stdout. If they ever start doing this I would immediately open an issue for it. During development you can use one of the macros from the log crate.
Cranelift can easily get
I can't imagine what kind of feature for a parser would need an OS to function. In addition having a parser directly interact with the OS seems like a recipe for a security issue to me. In any case it is possible to provide an |
Okay. From a beginner's perspective, the document on no_std support claims that the JIT compiler won't work as well due to its dependency on " But the point about it being as simple as "flipping the switch" on https://docs.wasmtime.dev/stability-platform-support.html#what-about-no_std summarizes the situation better than I can. |
Wasmtime and cranelift-jit don't work, but cranelift-jit is small enough that you can easily write your own replacement that uses a different interface as necessary.
I partially agree. Wrt to wasmtime I fully agree, but wrt cranelift-codegen the cost is pretty small IMHO. Not that I think I can convince others except maybe (and only maybe) by forking cranelift with |
As I said in the opening comment of this issue, why would wasmparser ever need anything within libstd that isn't in liballoc or libcore? Why would wasmparser need |
i don't see that impl changed in the i think it would help everyone to understand your use case for a |
|
Any update on this? |
I realize it's been years since this was originally opened, but in case anyone cc'd on this issue is still interested I've opened #8341 with a proposal to add no_std support for wasmtime which would address this issue as-stated. |
This is done now in bytecodealliance/wasm-tools#1493, so I'm going to close this. |
So, I opened this pull request for wasmparser, making it function in no-std environments (since if someone wants to use (say) cranelift-wasm in a no-std environment it wouldn't build at the moment because wasmparser is not no-std and it requires it). I was politely informed that I would need to open a discussion about merging it here, or else my PR would not be merged (even though this PR does not in fact touch wasmtime in any way and is completely unrelated to it). So, this issue is for the discussion for merging that PR. The PR does not modify any behavior of wasmparser or wasmtime, nor does it alter the development flow of (any) new developers (although they will simply have to avoid certain dependencies). However, that shouldn't be a problem, since wasmtime is an incremental wasm parser, and is media-agnostic as to where the wasm comes from.
The PR alters the dependency tree of wasmparser by adding the no-std-compat and an
extern crate
declaration above all use declarations in lib.rs. Additionally, I added a feature calledstd
to facilitate the importation oflibstd
, and enabled it by default. Other than that, the code for the library is identical. This nullifies any reasons not to add no-std support to wasmparser, at minimum. CD/CI builds can be satisfied by adding another task to bench/test the wasmparser crate without any default features and with only the deterministic feature but notdefault
/std
.Crates that should be avoided in wasmparsers development are typically any crates that depend on modules within
libstd
that aren't also inliballoc
orlibcore
. (This is mitigated a bit by emulating mutexes/locks with spin and hashmaps with hashbrown, but things that touch the filesystem, networking, threads, processes, etc., should be avoided.) However, as I said previously I don't foresee any reason why wasmparser would ever need any of this functionality.The text was updated successfully, but these errors were encountered: