Skip to content

Commit

Permalink
Update to the next version of the witx crate
Browse files Browse the repository at this point in the history
This commit updates to the 0.9 version of the witx crate implemented in
WebAssembly/WASI#395. This new version drastically changes code
generation and how we interface with the crate. The intention is to
abstract the code generation aspects and allow code generators to
implement much more low-level instructions to enable more flexible APIs
in the future. Additionally a bunch of `*.witx` files were updated in
the WASI repository.

It's worth pointing out, however, that `wasi-common` does not change as
a result of this change. The shape of the APIs that we need to implement
are effectively the same and the only difference is that the shim
functions generated by wiggle are a bit different.
  • Loading branch information
alexcrichton authored and abrown committed Feb 18, 2021
1 parent aed6de3 commit df9c725
Show file tree
Hide file tree
Showing 24 changed files with 504 additions and 800 deletions.
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
url = https://github.com/WebAssembly/wasm-c-api
[submodule "WASI"]
path = crates/wasi-common/WASI
url = https://github.com/WebAssembly/WASI
url = https://github.com/alexcrichton/WASI
branch = abis
[submodule "crates/wasi-nn/spec"]
path = crates/wasi-nn/spec
url = https://github.com/WebAssembly/wasi-nn
Expand Down
13 changes: 7 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/wasi-common/WASI
Submodule WASI updated 68 files
+2 −2 docs/DesignPrinciples.md
+8 −5 docs/Proposals.md
+1 −1 meetings/2019/WASI-05-02.md
+1 −1 meetings/2019/WASI-05-16.md
+1 −1 meetings/2019/WASI-05-30.md
+1 −1 meetings/2019/WASI-06-27.md
+1 −1 meetings/2019/WASI-07-18.md
+2 −2 meetings/2019/WASI-10-15.md
+42 −1 meetings/2021/WASI-01-14.md
+174 −3 meetings/2021/WASI-01-28.md
+118 −0 meetings/2021/WASI-02-11.md
+33 −0 meetings/2021/WASI-02-25.md
+1 −1 phases/README.md
+775 −285 phases/ephemeral/docs.md
+45 −47 phases/ephemeral/witx/typenames.witx
+6 −8 phases/ephemeral/witx/wasi_ephemeral_args.witx
+2 −4 phases/ephemeral/witx/wasi_ephemeral_clock.witx
+6 −8 phases/ephemeral/witx/wasi_ephemeral_environ.witx
+23 −33 phases/ephemeral/witx/wasi_ephemeral_fd.witx
+12 −15 phases/ephemeral/witx/wasi_ephemeral_path.witx
+1 −2 phases/ephemeral/witx/wasi_ephemeral_poll.witx
+1 −1 phases/ephemeral/witx/wasi_ephemeral_random.witx
+1 −1 phases/ephemeral/witx/wasi_ephemeral_sched.witx
+4 −8 phases/ephemeral/witx/wasi_ephemeral_sock.witx
+731 −260 phases/old/snapshot_0/docs.md
+38 −38 phases/old/snapshot_0/witx/typenames.witx
+51 −76 phases/old/snapshot_0/witx/wasi_unstable.witx
+730 −259 phases/snapshot/docs.md
+38 −37 phases/snapshot/witx/typenames.witx
+50 −75 phases/snapshot/witx/wasi_snapshot_preview1.witx
+4 −0 proposal-template/README.md
+8 −0 proposals/README.md
+5 −0 snapshots/README.md
+159 −0 snapshots/make-snapshot.sh
+12 −0 standard/README.md
+7 −2 tools/witx/Cargo.toml
+919 −0 tools/witx/src/abi.rs
+221 −62 tools/witx/src/ast.rs
+0 −171 tools/witx/src/coretypes.rs
+121 −176 tools/witx/src/docs/ast.rs
+8 −51 tools/witx/src/docs/md.rs
+77 −99 tools/witx/src/layout.rs
+7 −14 tools/witx/src/lib.rs
+182 −81 tools/witx/src/parser.rs
+1 −1 tools/witx/src/polyfill.rs
+86 −96 tools/witx/src/render.rs
+46 −197 tools/witx/src/representation.rs
+14 −7 tools/witx/src/toplevel.rs
+313 −173 tools/witx/src/validate.rs
+0 −45 tools/witx/tests/anonymous.rs
+0 −53 tools/witx/tests/multimodule.rs
+0 −2 tools/witx/tests/multimodule/type_b.witx
+0 −2 tools/witx/tests/multimodule/type_c.witx
+0 −183 tools/witx/tests/union.rs
+0 −64 tools/witx/tests/wasi-docs.rs
+656 −0 tools/witx/tests/witxt.rs
+488 −0 tools/witx/tests/witxt/abi.witxt
+56 −0 tools/witx/tests/witxt/anonymous.witxt
+22 −0 tools/witx/tests/witxt/multimodule.witxt
+0 −0 tools/witx/tests/witxt/multimodule/redefine_a.witx
+0 −0 tools/witx/tests/witxt/multimodule/type_a.witx
+2 −0 tools/witx/tests/witxt/multimodule/type_b.witx
+2 −0 tools/witx/tests/witxt/multimodule/type_c.witx
+60 −0 tools/witx/tests/witxt/representation.witxt
+59 −0 tools/witx/tests/witxt/shorthand.witxt
+12 −0 tools/witx/tests/witxt/simple.witxt
+97 −0 tools/witx/tests/witxt/union.witxt
+26 −0 tools/witx/tests/witxt/wasi.witxt
2 changes: 1 addition & 1 deletion crates/wiggle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include = ["src/**/*", "LICENSE"]

[dependencies]
thiserror = "1"
witx = { path = "../wasi-common/WASI/tools/witx", version = "0.8.7", optional = true }
witx = { path = "../wasi-common/WASI/tools/witx", version = "0.9", optional = true }
wiggle-macro = { path = "macro", version = "0.23.0" }
tracing = "0.1.15"
bitflags = "1.2"
Expand Down
2 changes: 1 addition & 1 deletion crates/wiggle/generate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ include = ["src/**/*", "LICENSE"]
[lib]

[dependencies]
witx = { version = "0.8.7", path = "../../wasi-common/WASI/tools/witx" }
witx = { version = "0.9", path = "../../wasi-common/WASI/tools/witx" }
quote = "1.0"
proc-macro2 = "1.0"
heck = "0.3"
Expand Down
6 changes: 5 additions & 1 deletion crates/wiggle/generate/src/error_transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,14 @@ impl ErrorTransform {

pub fn for_abi_error(&self, tref: &TypeRef) -> Option<&UserErrorType> {
match tref {
TypeRef::Name(nt) => self.m.iter().find(|u| u.abi_type.name == nt.name),
TypeRef::Name(nt) => self.for_name(nt),
TypeRef::Value { .. } => None,
}
}

pub fn for_name(&self, nt: &NamedType) -> Option<&UserErrorType> {
self.m.iter().find(|u| u.abi_type.name == nt.name)
}
}

pub struct UserErrorType {
Expand Down
Loading

0 comments on commit df9c725

Please sign in to comment.