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

Merge with upstream #74

Merged
merged 7 commits into from
Mar 22, 2024
Merged

Merge with upstream #74

merged 7 commits into from
Mar 22, 2024

Conversation

dhil
Copy link
Member

@dhil dhil commented Mar 22, 2024

No description provided.

dicej and others added 7 commits March 19, 2024 18:01
Previously, it was not possible to supply an adapter which implements
e.g. `wasi:cli/[email protected]` such that `wit-component` would replace the
main (or library) module's import with the adapter's version.  This commit makes
that possible by prefering the adapter version over the import whenever there's
a match (i.e. an adapter with a name matching the WIT interface name and version).

This enables a form of lightweight virtualization in cases where we want to
replace imported functions with e.g. trapping stubs or a few lines of WAT --
without adding component composition to the mix.  This approach also works with
e.g. `wasmtime-py`, which as of this writing does not support composed
components.

Signed-off-by: Joel Dice <[email protected]>
* Implement a `wast2json` subcommand

This commit is an implementation of bytecodealliance#1395 which brings wabt's
`wast2json` functionality to `wasm-tools`. This is implemented entirely
in the CLI since if using the crate it's already got all the
functionality necessary for this. Additionally this PR attempts to be
pretty close to `wast2json` from wabt in terms of structure and syntax.
The main difference is that wabt fills out the expected return types of
an operation when the operation isn't supposed to return (e.g.
`assert_trap`), but `wasm-tools` won't do that as we don't have that
information so easily available.

This is tested by adding `*.json` files to the `snapshots` directory
with example outputs from all known `*.wast` tests. Everything should be
included except for the `component-model` tests at this time which don't
have support in printing the args/results.

Closes bytecodealliance#1395

* Fix tests on wasm

* Fix building just wast2json

* Generate the same test output on Windows

* Rename to `json-from-wast`

* Fix typo
As discussed [here], and following up on bytecodealliance#1364 which added `f32`
and `f64` parsing support, this PR renames the types `float32`
and `float64` to `f32` and `f64`.

The old names are still accepted by the parser for compatibility.

[here]: WebAssembly/component-model#277
…1467)

The `discriminant_type` function in the [Canonical ABI] returns
`u8` for a variant with 256 cases. Fix wit-parser's `tag()` function
to match it.

[Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md
@dhil dhil merged commit 16e91e5 into wasmfx:main Mar 22, 2024
16 checks passed
@dhil dhil deleted the wasmfx-merge branch March 22, 2024 09:35
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.

4 participants