diff --git a/Cargo.lock b/Cargo.lock index 590fc454..c7594f00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1982,27 +1982,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" -[[package]] -name = "flaky_test" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046caa1f23d7f751fc4ead3d6669a77fa5fc6cf6074960ddeb6a0b0a5b83c8da" -dependencies = [ - "flaky_test_impl", - "futures-util", -] - -[[package]] -name = "flaky_test_impl" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85e35909c2f0552fdae5b40f1e95a7da12afb58c1f2f455a12c216c58d869abe" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "flate2" version = "1.0.28" @@ -2509,7 +2488,7 @@ dependencies = [ name = "homestar-functions-add" version = "0.1.0" dependencies = [ - "wit-bindgen", + "wit-bindgen-rt", ] [[package]] @@ -2518,7 +2497,7 @@ version = "0.1.0" dependencies = [ "base64 0.21.7", "image", - "wit-bindgen", + "wit-bindgen-rt", ] [[package]] @@ -2577,7 +2556,6 @@ dependencies = [ "dyn-clone", "enum-assoc", "faststr", - "flaky_test", "flume", "fnv", "futures", @@ -2690,6 +2668,7 @@ dependencies = [ "heck", "homestar-invocation", "homestar-workspace-hack", + "indexmap 2.2.3", "itertools 0.12.1", "libipld", "rust_decimal", @@ -8432,13 +8411,10 @@ dependencies = [ ] [[package]] -name = "wit-bindgen" -version = "0.18.0" +name = "wit-bindgen-rt" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5408d742fcdf418b766f23b2393f0f4d9b10b72b7cd96d9525626943593e8cc0" -dependencies = [ - "bitflags 2.4.2", -] +checksum = "781989c70b3300b1be7ffbc7095e3b56c4f208f0c109cb5d1d943b297918dd8a" [[package]] name = "wit-component" diff --git a/examples/websocket-relay/example_test.wasm b/examples/websocket-relay/example_test.wasm index 64fed340..a8261e2a 100755 Binary files a/examples/websocket-relay/example_test.wasm and b/examples/websocket-relay/example_test.wasm differ diff --git a/examples/websocket-relay/relay-app/src/lib/workflow.ts b/examples/websocket-relay/relay-app/src/lib/workflow.ts index 0761d2ab..b0631a0c 100644 --- a/examples/websocket-relay/relay-app/src/lib/workflow.ts +++ b/examples/websocket-relay/relay-app/src/lib/workflow.ts @@ -256,7 +256,7 @@ export const workflowOnePromised = WorkflowBuilder.workflow({ WorkflowBuilder.crop({ name: "crop", resource: - "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la", + "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q", args: { data: "{{ cid:bafybeiejevluvtoevgk66plh5t6xiy3ikyuuxg3vgofuvpeckb6eadresm }}", x: 150, @@ -268,7 +268,7 @@ export const workflowOnePromised = WorkflowBuilder.workflow({ WorkflowBuilder.rotate90({ name: "rotate90", resource: - "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la", + "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q", args: { data: "{{needs.crop.output}}", }, @@ -276,7 +276,7 @@ export const workflowOnePromised = WorkflowBuilder.workflow({ WorkflowBuilder.blur({ name: "blur", resource: - "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la", + "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q", args: { data: "{{needs.rotate90.output}}", sigma: 20.2, @@ -293,7 +293,7 @@ export const workflowTwoPromised = WorkflowBuilder.workflow({ WorkflowBuilder.crop({ name: "crop", resource: - "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la", + "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q", args: { data: "{{ cid:bafybeiejevluvtoevgk66plh5t6xiy3ikyuuxg3vgofuvpeckb6eadresm }}", x: 150, @@ -305,7 +305,7 @@ export const workflowTwoPromised = WorkflowBuilder.workflow({ WorkflowBuilder.rotate90({ name: "rotate90", resource: - "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la", + "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q", args: { data: "{{needs.crop.output}}", }, @@ -313,7 +313,7 @@ export const workflowTwoPromised = WorkflowBuilder.workflow({ WorkflowBuilder.grayscale({ name: "grayscale", resource: - "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la", + "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q", args: { data: "{{needs.rotate90.output}}", }, diff --git a/flake.lock b/flake.lock index 7217eee0..8b0df931 100644 --- a/flake.lock +++ b/flake.lock @@ -79,11 +79,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1708582955, - "narHash": "sha256-OOq0YCdOgCyMpr4TFPJVorU5I8k97G8AQ1mhnktp+ZA=", + "lastModified": 1709446916, + "narHash": "sha256-MX3eR3ao971besQvKt9aKu4tN8tZht7Do3G/eNylNY8=", "owner": "nix-community", "repo": "fenix", - "rev": "244b9af2d0180619adcca5d020d085341c0d28c9", + "rev": "4b07da0f91ea99f263f47165a11a48678c9e0dc3", "type": "github" }, "original": { @@ -175,11 +175,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "lastModified": 1709126324, + "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "rev": "d465f4819400de7c8d874d50b982301f28a84605", "type": "github" }, "original": { @@ -427,11 +427,11 @@ }, "nixlib_3": { "locked": { - "lastModified": 1708217146, - "narHash": "sha256-nGfEv7k78slqIR5E0zzWSx214d/4/ZPKDkObLJqVLVw=", + "lastModified": 1709426687, + "narHash": "sha256-jLBZmwXf0WYHzLkmEMq33bqhX55YtT5edvluFr0RcSA=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "e623008d8a46517470e6365505f1a3ce171fa46a", + "rev": "7873d84a89ae6e4841528ff7f5697ddcb5bdfe6c", "type": "github" }, "original": { @@ -442,11 +442,11 @@ }, "nixos-unstable": { "locked": { - "lastModified": 1708583918, - "narHash": "sha256-wcAivqrBghg/rPLBeuChEmSyb5j41zFZbVs6xFYgS7E=", + "lastModified": 1709558755, + "narHash": "sha256-hx4FIbk4X4ve1oiHLOj+VE6dzO4CtXBR5RSU6kaq34M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a7fa133a1e973c127e9c83e2c8e3407ae3797099", + "rev": "207107bbc7d6d19a8b2c36a088d3756d03490243", "type": "github" }, "original": { @@ -537,11 +537,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1708440434, - "narHash": "sha256-XY+B9mbhL/i+Q6fP6gBQ6P76rv9rWtpjQiUJ+DGtaUg=", + "lastModified": 1709309926, + "narHash": "sha256-VZFBtXGVD9LWTecGi6eXrE0hJ/mVB3zGUlHImUs2Qak=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "526d051b128b82ae045a70e5ff1adf8e6dafa560", + "rev": "79baff8812a0d68e24a836df0a364c678089e2c7", "type": "github" }, "original": { @@ -565,11 +565,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1708459863, - "narHash": "sha256-PzlnvPOv/1l2lSU0oj+gY+hq5MRqJNU3KWSO+RCwhgs=", + "lastModified": 1709373076, + "narHash": "sha256-vRBRyCVMhH+giewRQgOgNO+p7VlGeJNgCqrZBnvfWQc=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "543d7e98dbcc0668528dbf3f5b32d752882baa33", + "rev": "4ef6a49b44e8aa380da7522442234bfd7a52c55e", "type": "github" }, "original": { diff --git a/homestar-functions/README.md b/homestar-functions/README.md index 4c030e1f..ab173ca2 100644 --- a/homestar-functions/README.md +++ b/homestar-functions/README.md @@ -23,7 +23,8 @@ building Wasm components in order to run and test them on the latest We use the components compiled from this crate as fixtures for our execution-and-[IPLD][ipld]-focused [homestar-wasm crate](../homestar-wasm). We -currently rely on the [WIT format][wit-mvp] IDL to describe exports, for example: +currently rely on the [WIT format][wit-mvp] IDL to describe exports, for +example: ```wit default world homestar { @@ -33,39 +34,34 @@ default world homestar { } ``` - We then implement these functions in [lib.rs](./src/lib.rs) using -[wit-bindgen][wit-bindgen], a guest language bindings generator for -[WIT][wit-mvp] and the [Component Model][component-model]. +[wit-bindgen][wit-bindgen]/[wit-bindgen-rt][wit-bindgen-rt], a guest language +bindings generator for [WIT][wit-mvp] and the +[Component Model][component-model]. ## Build -Once functions are implemented, we can build the component in release-mode, -targetting [`wasm32-unknown-unknown`][wasm32], : +Once functions are implemented, we can use [cargo-component][cargo-component] to +generate the necessary bindings and build the component in release-mode, +targeting [`wasm32-unknown-unknown`][wasm32-unknown]: ```console # from this directory: -cd test && cargo build --target wasm32-unknown-unknown --profile release-wasm-fn +cd test && cargo component build --target wasm32-unknown-unknown --profile release-wasm-fn # or from the top-level workspace: -cargo build -p homestar-functions-test --target wasm32-unknown-unknown --profile release-wasm-fn +cargo component build -p homestar-functions-test --target wasm32-unknown-unknown --profile release-wasm-fn ``` -Guest Wasm modules will be generated in the top-level `homestar` directory: -`./target/wasm32-unknown-unknown/release-wasm-fn/homestar_functions_test.wasm`. - -Sadly, this module is **not yet** an actual `component`. But, we can leverage -the [wasm-tools][wasm-tools] tooling ([wit-component][wit-component] in -particular) to convert the core Wasm binary to a Wasm component and place -it in a different directory: +We can also use the [cargo-component][cargo-component] default [`wasm32-wasi`][wasm32-wasi] target: -```console -wasm-tools component new / -../target/wasm32-unknown-unknown/release-wasm-fn/homestar_functions_test.wasm -o ../homestar-wasm/fixtures/ +``` console +cargo component build -p homestar-functions-test --profile release-wasm-fn ``` -*Of note*, [homestar-wasm's](../homestar-wasm) execution model will do -[this conversion at runtime][conversion-code]! +Guest Wasm modules will be generated in the top-level `homestar` directory: +`./target/wasm32-unknown-unknown/release-wasm-fn/homestar_functions_test.wasm` +or `./target/wasm32-wasi/release-wasm-fn/homestar_functions_test.wasm`. ### Other Helpful Repos @@ -74,10 +70,6 @@ wasm-tools component new / abstract distributed application capabilities, such as key-value, messaging, http-server/client and more. -### Coming soon - -* [WASI][wasi] examples - ## License This project is licensed under the [Apache License 2.0](./LICENSE), or @@ -92,15 +84,17 @@ conditions. [apache]: https://www.apache.org/licenses/LICENSE-2.0 +[cargo-component]: https://github.com/bytecodealliance/cargo-component [component-model]: https://github.com/WebAssembly/component-model -[conversion-code]: https://github.com/ipvm-wg/homestar/blob/main/homestar-wasm/src/wasmtime/world.rs#L277 [ipld]: https://ipld.io/ [kv-demo]: https://github.com/Mossaka/keyvalue-component-model-demo [spiderlightning]: https://github.com/deislabs/spiderlightning [wasi]: https://github.com/WebAssembly/WASI -[wasm32]: https://rustwasm.github.io/docs/wasm-pack/prerequisites/non-rustup-setups.html#manually-add-wasm32-unknown-unknown +[wasm32-unknown]: https://rustwasm.github.io/docs/wasm-pack/prerequisites/non-rustup-setups.html#manually-add-wasm32-unknown-unknown +[wasm32-wasi]: https://wasmbyexample.dev/examples/wasi-hello-world/wasi-hello-world.rust.en-us [wasmtime]: https://github.com/bytecodealliance/wasmtime [wasm-tools]: https://github.com/bytecodealliance/wasm-tools [wit-bindgen]: https://github.com/bytecodealliance/wit-bindgen +[wit-bindgen-rt]: https://github.com/bytecodealliance/wit-bindgen/tree/main/crates/guest-rust [wit-component]: https://crates.io/crates/wit-component [wit-mvp]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md diff --git a/homestar-functions/add/Cargo.toml b/homestar-functions/add/Cargo.toml index 7dd97c11..296dc919 100644 --- a/homestar-functions/add/Cargo.toml +++ b/homestar-functions/add/Cargo.toml @@ -6,9 +6,7 @@ edition = { workspace = true } rust-version = { workspace = true } [dependencies] -wit-bindgen = { version = "0.18.0", default-features = false, features = [ - "realloc", -] } +wit-bindgen-rt = "0.20.0" [lib] crate-type = ["cdylib"] diff --git a/homestar-functions/add/src/bindings.rs b/homestar-functions/add/src/bindings.rs index de11d1a5..1f8780c5 100644 --- a/homestar-functions/add/src/bindings.rs +++ b/homestar-functions/add/src/bindings.rs @@ -1,70 +1,155 @@ -// Generated by `wit-bindgen` 0.16.0. DO NOT EDIT! -const _: () = { - - #[doc(hidden)] - #[export_name = "add-one"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_add_one(arg0: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::add_one(arg0); - wit_bindgen::rt::as_i32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "add-two"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_add_two(arg0: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::add_two(arg0); - wit_bindgen::rt::as_i32(result0) - } -}; -use super::Component as _GuestImpl; +// Generated by `wit-bindgen` 0.20.0. DO NOT EDIT! +// Options used: + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_add_one_cabi(arg0: i32) -> i32 { + let result0 = T::add_one(arg0); + _rt::as_i32(result0) +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_add_two_cabi(arg0: i32) -> i32 { + let result0 = T::add_two(arg0); + _rt::as_i32(result0) +} pub trait Guest { - fn add_one(input: i32,) -> i32; - fn add_two(input: i32,) -> i32; + fn add_one(input: i32) -> i32; + fn add_two(input: i32) -> i32; +} +#[doc(hidden)] + +macro_rules! __export_world_add_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + + #[export_name = "add-one"] + unsafe extern "C" fn export_add_one(arg0: i32,) -> i32 { + $($path_to_types)*::_export_add_one_cabi::<$ty>(arg0) + } + + #[export_name = "add-two"] + unsafe extern "C" fn export_add_two(arg0: i32,) -> i32 { + $($path_to_types)*::_export_add_two_cabi::<$ty>(arg0) + } + };); +} +#[doc(hidden)] +pub(crate) use __export_world_add_cabi; +mod _rt { + + pub fn as_i32(t: T) -> i32 { + t.as_i32() + } + + pub trait AsI32 { + fn as_i32(self) -> i32; + } + + impl<'a, T: Copy + AsI32> AsI32 for &'a T { + fn as_i32(self) -> i32 { + (*self).as_i32() + } + } + + impl AsI32 for i32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for char { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for usize { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } } +/// Generates `#[no_mangle]` functions to export the specified type as the +/// root implementation of all generated traits. +/// +/// For more information see the documentation of `wit_bindgen::generate!`. +/// +/// ```rust +/// # macro_rules! export{ ($($t:tt)*) => (); } +/// # trait Guest {} +/// struct MyType; +/// +/// impl Guest for MyType { +/// // ... +/// } +/// +/// export!(MyType); +/// ``` +#[allow(unused_macros)] +#[doc(hidden)] + +macro_rules! __export_add_impl { + ($ty:ident) => (self::export!($ty with_types_in self);); + ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( + $($path_to_types_root)*::__export_world_add_cabi!($ty with_types_in $($path_to_types_root)*); + ) +} +#[doc(inline)] +pub(crate) use __export_add_impl as export; + #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:add"] +#[link_section = "component-type:wit-bindgen:0.20.0:add:encoded world"] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 190] = [3, 0, 3, 97, 100, 100, 0, 97, 115, 109, 13, 0, 1, 0, 7, 73, 1, 65, 2, 1, 65, 3, 1, 64, 1, 5, 105, 110, 112, 117, 116, 122, 0, 122, 4, 0, 7, 97, 100, 100, 45, 111, 110, 101, 1, 0, 4, 0, 7, 97, 100, 100, 45, 116, 119, 111, 1, 0, 4, 1, 26, 104, 111, 109, 101, 115, 116, 97, 114, 45, 102, 117, 110, 99, 116, 105, 111, 110, 115, 58, 97, 100, 100, 47, 97, 100, 100, 4, 0, 11, 9, 1, 0, 3, 97, 100, 100, 3, 0, 0, 0, 16, 12, 112, 97, 99, 107, 97, 103, 101, 45, 100, 111, 99, 115, 0, 123, 125, 0, 70, 9, 112, 114, 111, 100, 117, 99, 101, 114, 115, 1, 12, 112, 114, 111, 99, 101, 115, 115, 101, 100, 45, 98, 121, 2, 13, 119, 105, 116, 45, 99, 111, 109, 112, 111, 110, 101, 110, 116, 6, 48, 46, 49, 56, 46, 50, 16, 119, 105, 116, 45, 98, 105, 110, 100, 103, 101, 110, 45, 114, 117, 115, 116, 6, 48, 46, 49, 54, 46, 48]; +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 194] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07I\x01A\x02\x01A\x03\x01\ +@\x01\x05inputz\0z\x04\0\x07add-one\x01\0\x04\0\x07add-two\x01\0\x04\x01\x1ahome\ +star-functions:add/add\x04\0\x0b\x09\x01\0\x03add\x03\0\0\0G\x09producers\x01\x0c\ +processed-by\x02\x0dwit-component\x070.201.0\x10wit-bindgen-rust\x060.20.0"; #[inline(never)] #[doc(hidden)] #[cfg(target_arch = "wasm32")] -pub fn __link_section() {} +pub fn __link_custom_section_describing_imports() { + wit_bindgen_rt::maybe_link_cabi_realloc(); +} diff --git a/homestar-functions/add/src/lib.rs b/homestar-functions/add/src/lib.rs index ab35a478..0065905a 100644 --- a/homestar-functions/add/src/lib.rs +++ b/homestar-functions/add/src/lib.rs @@ -15,3 +15,5 @@ impl Guest for Component { input + 2 } } + +bindings::export!(Component with_types_in bindings); diff --git a/homestar-functions/test/Cargo.toml b/homestar-functions/test/Cargo.toml index 3d31888c..01834f87 100644 --- a/homestar-functions/test/Cargo.toml +++ b/homestar-functions/test/Cargo.toml @@ -8,9 +8,7 @@ rust-version = { workspace = true } [dependencies] base64 = "0.21" image = { version = "0.24", default-features = false, features = ["png"] } -wit-bindgen = { version = "0.18.0", default-features = false, features = [ - "realloc", -] } +wit-bindgen-rt = "0.20.0" [dev-dependencies] image = { version = "0.24", default-features = false, features = [ diff --git a/homestar-functions/test/src/bindings.rs b/homestar-functions/test/src/bindings.rs index 030f001d..1fb3308a 100644 --- a/homestar-functions/test/src/bindings.rs +++ b/homestar-functions/test/src/bindings.rs @@ -1,923 +1,1055 @@ -// Generated by `wit-bindgen` 0.16.0. DO NOT EDIT! -const _: () = { - - #[doc(hidden)] - #[export_name = "add-one"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_add_one(arg0: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::add_one(arg0); - wit_bindgen::rt::as_i32(result0) - } -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "append-string"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_append_string(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let bytes0 = Vec::from_raw_parts(arg0 as *mut _, len0, len0); - let result1 = <_GuestImpl as Guest>::append_string(wit_bindgen::rt::string_lift(bytes0)); - let ptr2 = _RET_AREA.0.as_mut_ptr() as i32; +// Generated by `wit-bindgen` 0.20.0. DO NOT EDIT! +// Options used: +#[derive(Clone)] +pub struct NumKeys { + pub name: _rt::String, + pub val: Option, +} +impl ::core::fmt::Debug for NumKeys { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("NumKeys") + .field("name", &self.name) + .field("val", &self.val) + .finish() + } +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_add_one_cabi(arg0: i32) -> i32 { + let result0 = T::add_one(arg0); + _rt::as_i32(result0) +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_append_string_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let result1 = T::append_string(_rt::string_lift(bytes0)); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); let vec3 = (result1.into_bytes()).into_boxed_slice(); - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); ::core::mem::forget(vec3); - *((ptr2 + 4) as *mut i32) = len3; - *((ptr2 + 0) as *mut i32) = ptr3; + *ptr2.add(4).cast::() = len3; + *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_append-string"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_append_string(arg0: i32,) { - let l0 = *((arg0 + 0) as *const i32); - let l1 = *((arg0 + 4) as *const i32); - wit_bindgen::rt::dealloc(l0, (l1) as usize, 1); - } - }; -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "join-strings"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_join_strings(arg0: i32,arg1: i32,arg2: i32,arg3: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let bytes0 = Vec::from_raw_parts(arg0 as *mut _, len0, len0); - let len1 = arg3 as usize; - let bytes1 = Vec::from_raw_parts(arg2 as *mut _, len1, len1); - let result2 = <_GuestImpl as Guest>::join_strings(wit_bindgen::rt::string_lift(bytes0), wit_bindgen::rt::string_lift(bytes1)); - let ptr3 = _RET_AREA.0.as_mut_ptr() as i32; +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn __post_return_append_string(arg0: *mut u8) { + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + _rt::cabi_dealloc(l0, l1, 1); +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_join_strings_cabi( + arg0: *mut u8, + arg1: usize, + arg2: *mut u8, + arg3: usize, +) -> *mut u8 { + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let len1 = arg3; + let bytes1 = _rt::Vec::from_raw_parts(arg2.cast(), len1, len1); + let result2 = T::join_strings(_rt::string_lift(bytes0), _rt::string_lift(bytes1)); + let ptr3 = _RET_AREA.0.as_mut_ptr().cast::(); let vec4 = (result2.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr() as i32; - let len4 = vec4.len() as i32; + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); ::core::mem::forget(vec4); - *((ptr3 + 4) as *mut i32) = len4; - *((ptr3 + 0) as *mut i32) = ptr4; + *ptr3.add(4).cast::() = len4; + *ptr3.add(0).cast::<*mut u8>() = ptr4.cast_mut(); ptr3 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_join-strings"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_join_strings(arg0: i32,) { - let l0 = *((arg0 + 0) as *const i32); - let l1 = *((arg0 + 4) as *const i32); - wit_bindgen::rt::dealloc(l0, (l1) as usize, 1); - } - }; -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "host-fmt-current-time"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_host_fmt_current_time() -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let result0 = <_GuestImpl as Guest>::host_fmt_current_time(); - let ptr1 = _RET_AREA.0.as_mut_ptr() as i32; +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn __post_return_join_strings(arg0: *mut u8) { + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + _rt::cabi_dealloc(l0, l1, 1); +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_host_fmt_current_time_cabi() -> *mut u8 { + let result0 = T::host_fmt_current_time(); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr() as i32; - let len2 = vec2.len() as i32; + let ptr2 = vec2.as_ptr().cast::(); + let len2 = vec2.len(); ::core::mem::forget(vec2); - *((ptr1 + 4) as *mut i32) = len2; - *((ptr1 + 0) as *mut i32) = ptr2; + *ptr1.add(4).cast::() = len2; + *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); ptr1 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_host-fmt-current-time"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_host_fmt_current_time(arg0: i32,) { - let l0 = *((arg0 + 0) as *const i32); - let l1 = *((arg0 + 4) as *const i32); - wit_bindgen::rt::dealloc(l0, (l1) as usize, 1); - } - }; -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "transpose"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_transpose(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn __post_return_host_fmt_current_time(arg0: *mut u8) { + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + _rt::cabi_dealloc(l0, l1, 1); +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_transpose_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { let base3 = arg0; let len3 = arg1; - let mut result3 = Vec::with_capacity(len3 as usize); + let mut result3 = _rt::Vec::with_capacity(len3); for i in 0..len3 { - let base = base3 + i * 8; - let e3 = { - let l0 = *((base + 0) as *const i32); - let l1 = *((base + 4) as *const i32); - let len2 = l1 as usize; - - Vec::from_raw_parts(l0 as *mut _, len2, len2) - }; - result3.push(e3); - } - wit_bindgen::rt::dealloc(base3, (len3 as usize) * 8, 4); - let result4 = <_GuestImpl as Guest>::transpose(result3); - let ptr5 = _RET_AREA.0.as_mut_ptr() as i32; + let base = base3.add(i * 8); + let e3 = { + let l0 = *base.add(0).cast::<*mut u8>(); + let l1 = *base.add(4).cast::(); + let len2 = l1; + + _rt::Vec::from_raw_parts(l0.cast(), len2, len2) + }; + result3.push(e3); + } + _rt::cabi_dealloc(base3, len3 * 8, 4); + let result4 = T::transpose(result3); + let ptr5 = _RET_AREA.0.as_mut_ptr().cast::(); let vec7 = result4; - let len7 = vec7.len() as i32; - let layout7 = alloc::Layout::from_size_align_unchecked(vec7.len() * 8, 4); - let result7 = if layout7.size() != 0 - { - let ptr = alloc::alloc(layout7); - if ptr.is_null() - { - alloc::handle_alloc_error(layout7); - } - ptr - }else {{ - ::core::ptr::null_mut() - }}; + let len7 = vec7.len(); + let layout7 = _rt::alloc::Layout::from_size_align_unchecked(vec7.len() * 8, 4); + let result7 = if layout7.size() != 0 { + let ptr = _rt::alloc::alloc(layout7).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout7); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; for (i, e) in vec7.into_iter().enumerate() { - let base = result7 as i32 + (i as i32) * 8; - { - let vec6 = (e).into_boxed_slice(); - let ptr6 = vec6.as_ptr() as i32; - let len6 = vec6.len() as i32; - ::core::mem::forget(vec6); - *((base + 4) as *mut i32) = len6; - *((base + 0) as *mut i32) = ptr6; - } - } - *((ptr5 + 4) as *mut i32) = len7; - *((ptr5 + 0) as *mut i32) = result7 as i32; + let base = result7.add(i * 8); + { + let vec6 = (e).into_boxed_slice(); + let ptr6 = vec6.as_ptr().cast::(); + let len6 = vec6.len(); + ::core::mem::forget(vec6); + *base.add(4).cast::() = len6; + *base.add(0).cast::<*mut u8>() = ptr6.cast_mut(); + } + } + *ptr5.add(4).cast::() = len7; + *ptr5.add(0).cast::<*mut u8>() = result7; ptr5 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_transpose"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_transpose(arg0: i32,) { - let l3 = *((arg0 + 0) as *const i32); - let l4 = *((arg0 + 4) as *const i32); - let base5 = l3; - let len5 = l4; - for i in 0..len5 { - let base = base5 + i *8; +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn __post_return_transpose(arg0: *mut u8) { + let l3 = *arg0.add(0).cast::<*mut u8>(); + let l4 = *arg0.add(4).cast::(); + let base5 = l3; + let len5 = l4; + for i in 0..len5 { + let base = base5.add(i * 8); { - let l0 = *((base + 0) as *const i32); - let l1 = *((base + 4) as *const i32); - let base2 = l0; - let len2 = l1; - wit_bindgen::rt::dealloc(base2, (len2 as usize) * 2, 2); + let l0 = *base.add(0).cast::<*mut u8>(); + let l1 = *base.add(4).cast::(); + let base2 = l0; + let len2 = l1; + _rt::cabi_dealloc(base2, len2 * 2, 2); } - } - wit_bindgen::rt::dealloc(base5, (len5 as usize) * 8, 4); - } - }; -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "blur"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_blur(arg0: i32,arg1: i32,arg2: f32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let result1 = <_GuestImpl as Guest>::blur(Vec::from_raw_parts(arg0 as *mut _, len0, len0), arg2); - let ptr2 = _RET_AREA.0.as_mut_ptr() as i32; + } + _rt::cabi_dealloc(base5, len5 * 8, 4); +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_blur_cabi(arg0: *mut u8, arg1: usize, arg2: f32) -> *mut u8 { + let len0 = arg1; + let result1 = T::blur(_rt::Vec::from_raw_parts(arg0.cast(), len0, len0), arg2); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); let vec3 = (result1).into_boxed_slice(); - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); ::core::mem::forget(vec3); - *((ptr2 + 4) as *mut i32) = len3; - *((ptr2 + 0) as *mut i32) = ptr3; + *ptr2.add(4).cast::() = len3; + *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_blur"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_blur(arg0: i32,) { - let l0 = *((arg0 + 0) as *const i32); - let l1 = *((arg0 + 4) as *const i32); - let base2 = l0; - let len2 = l1; - wit_bindgen::rt::dealloc(base2, (len2 as usize) * 1, 1); - } - }; -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "blur-base64"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_blur_base64(arg0: i32,arg1: i32,arg2: f32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let bytes0 = Vec::from_raw_parts(arg0 as *mut _, len0, len0); - let result1 = <_GuestImpl as Guest>::blur_base64(wit_bindgen::rt::string_lift(bytes0), arg2); - let ptr2 = _RET_AREA.0.as_mut_ptr() as i32; +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn __post_return_blur(arg0: *mut u8) { + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + let base2 = l0; + let len2 = l1; + _rt::cabi_dealloc(base2, len2 * 1, 1); +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_blur_base64_cabi(arg0: *mut u8, arg1: usize, arg2: f32) -> *mut u8 { + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let result1 = T::blur_base64(_rt::string_lift(bytes0), arg2); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); let vec3 = (result1).into_boxed_slice(); - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); ::core::mem::forget(vec3); - *((ptr2 + 4) as *mut i32) = len3; - *((ptr2 + 0) as *mut i32) = ptr3; + *ptr2.add(4).cast::() = len3; + *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_blur-base64"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_blur_base64(arg0: i32,) { - let l0 = *((arg0 + 0) as *const i32); - let l1 = *((arg0 + 4) as *const i32); - let base2 = l0; - let len2 = l1; - wit_bindgen::rt::dealloc(base2, (len2 as usize) * 1, 1); - } - }; -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "crop"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_crop(arg0: i32,arg1: i32,arg2: i32,arg3: i32,arg4: i32,arg5: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let result1 = <_GuestImpl as Guest>::crop(Vec::from_raw_parts(arg0 as *mut _, len0, len0), arg2 as u32, arg3 as u32, arg4 as u32, arg5 as u32); - let ptr2 = _RET_AREA.0.as_mut_ptr() as i32; +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn __post_return_blur_base64(arg0: *mut u8) { + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + let base2 = l0; + let len2 = l1; + _rt::cabi_dealloc(base2, len2 * 1, 1); +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_crop_cabi( + arg0: *mut u8, + arg1: usize, + arg2: i32, + arg3: i32, + arg4: i32, + arg5: i32, +) -> *mut u8 { + let len0 = arg1; + let result1 = T::crop( + _rt::Vec::from_raw_parts(arg0.cast(), len0, len0), + arg2 as u32, + arg3 as u32, + arg4 as u32, + arg5 as u32, + ); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); let vec3 = (result1).into_boxed_slice(); - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); ::core::mem::forget(vec3); - *((ptr2 + 4) as *mut i32) = len3; - *((ptr2 + 0) as *mut i32) = ptr3; + *ptr2.add(4).cast::() = len3; + *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_crop"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_crop(arg0: i32,) { - let l0 = *((arg0 + 0) as *const i32); - let l1 = *((arg0 + 4) as *const i32); - let base2 = l0; - let len2 = l1; - wit_bindgen::rt::dealloc(base2, (len2 as usize) * 1, 1); - } - }; -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "crop-base64"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_crop_base64(arg0: i32,arg1: i32,arg2: i32,arg3: i32,arg4: i32,arg5: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let bytes0 = Vec::from_raw_parts(arg0 as *mut _, len0, len0); - let result1 = <_GuestImpl as Guest>::crop_base64(wit_bindgen::rt::string_lift(bytes0), arg2 as u32, arg3 as u32, arg4 as u32, arg5 as u32); - let ptr2 = _RET_AREA.0.as_mut_ptr() as i32; +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn __post_return_crop(arg0: *mut u8) { + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + let base2 = l0; + let len2 = l1; + _rt::cabi_dealloc(base2, len2 * 1, 1); +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_crop_base64_cabi( + arg0: *mut u8, + arg1: usize, + arg2: i32, + arg3: i32, + arg4: i32, + arg5: i32, +) -> *mut u8 { + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let result1 = T::crop_base64( + _rt::string_lift(bytes0), + arg2 as u32, + arg3 as u32, + arg4 as u32, + arg5 as u32, + ); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); let vec3 = (result1).into_boxed_slice(); - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); ::core::mem::forget(vec3); - *((ptr2 + 4) as *mut i32) = len3; - *((ptr2 + 0) as *mut i32) = ptr3; + *ptr2.add(4).cast::() = len3; + *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_crop-base64"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_crop_base64(arg0: i32,) { - let l0 = *((arg0 + 0) as *const i32); - let l1 = *((arg0 + 4) as *const i32); - let base2 = l0; - let len2 = l1; - wit_bindgen::rt::dealloc(base2, (len2 as usize) * 1, 1); - } - }; -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "grayscale"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_grayscale(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let result1 = <_GuestImpl as Guest>::grayscale(Vec::from_raw_parts(arg0 as *mut _, len0, len0)); - let ptr2 = _RET_AREA.0.as_mut_ptr() as i32; +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn __post_return_crop_base64(arg0: *mut u8) { + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + let base2 = l0; + let len2 = l1; + _rt::cabi_dealloc(base2, len2 * 1, 1); +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_grayscale_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { + let len0 = arg1; + let result1 = T::grayscale(_rt::Vec::from_raw_parts(arg0.cast(), len0, len0)); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); let vec3 = (result1).into_boxed_slice(); - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); ::core::mem::forget(vec3); - *((ptr2 + 4) as *mut i32) = len3; - *((ptr2 + 0) as *mut i32) = ptr3; + *ptr2.add(4).cast::() = len3; + *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_grayscale"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_grayscale(arg0: i32,) { - let l0 = *((arg0 + 0) as *const i32); - let l1 = *((arg0 + 4) as *const i32); - let base2 = l0; - let len2 = l1; - wit_bindgen::rt::dealloc(base2, (len2 as usize) * 1, 1); - } - }; -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "grayscale-base64"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_grayscale_base64(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let bytes0 = Vec::from_raw_parts(arg0 as *mut _, len0, len0); - let result1 = <_GuestImpl as Guest>::grayscale_base64(wit_bindgen::rt::string_lift(bytes0)); - let ptr2 = _RET_AREA.0.as_mut_ptr() as i32; +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn __post_return_grayscale(arg0: *mut u8) { + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + let base2 = l0; + let len2 = l1; + _rt::cabi_dealloc(base2, len2 * 1, 1); +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_grayscale_base64_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let result1 = T::grayscale_base64(_rt::string_lift(bytes0)); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); let vec3 = (result1).into_boxed_slice(); - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); ::core::mem::forget(vec3); - *((ptr2 + 4) as *mut i32) = len3; - *((ptr2 + 0) as *mut i32) = ptr3; + *ptr2.add(4).cast::() = len3; + *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_grayscale-base64"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_grayscale_base64(arg0: i32,) { - let l0 = *((arg0 + 0) as *const i32); - let l1 = *((arg0 + 4) as *const i32); - let base2 = l0; - let len2 = l1; - wit_bindgen::rt::dealloc(base2, (len2 as usize) * 1, 1); - } - }; -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "rotate90"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_rotate90(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let result1 = <_GuestImpl as Guest>::rotate90(Vec::from_raw_parts(arg0 as *mut _, len0, len0)); - let ptr2 = _RET_AREA.0.as_mut_ptr() as i32; +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn __post_return_grayscale_base64(arg0: *mut u8) { + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + let base2 = l0; + let len2 = l1; + _rt::cabi_dealloc(base2, len2 * 1, 1); +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_rotate90_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { + let len0 = arg1; + let result1 = T::rotate90(_rt::Vec::from_raw_parts(arg0.cast(), len0, len0)); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); let vec3 = (result1).into_boxed_slice(); - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); ::core::mem::forget(vec3); - *((ptr2 + 4) as *mut i32) = len3; - *((ptr2 + 0) as *mut i32) = ptr3; + *ptr2.add(4).cast::() = len3; + *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_rotate90"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_rotate90(arg0: i32,) { - let l0 = *((arg0 + 0) as *const i32); - let l1 = *((arg0 + 4) as *const i32); - let base2 = l0; - let len2 = l1; - wit_bindgen::rt::dealloc(base2, (len2 as usize) * 1, 1); - } - }; -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "rotate90-base64"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_rotate90_base64(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let bytes0 = Vec::from_raw_parts(arg0 as *mut _, len0, len0); - let result1 = <_GuestImpl as Guest>::rotate90_base64(wit_bindgen::rt::string_lift(bytes0)); - let ptr2 = _RET_AREA.0.as_mut_ptr() as i32; +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn __post_return_rotate90(arg0: *mut u8) { + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + let base2 = l0; + let len2 = l1; + _rt::cabi_dealloc(base2, len2 * 1, 1); +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_rotate90_base64_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let result1 = T::rotate90_base64(_rt::string_lift(bytes0)); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); let vec3 = (result1).into_boxed_slice(); - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); ::core::mem::forget(vec3); - *((ptr2 + 4) as *mut i32) = len3; - *((ptr2 + 0) as *mut i32) = ptr3; + *ptr2.add(4).cast::() = len3; + *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_rotate90-base64"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_rotate90_base64(arg0: i32,) { - let l0 = *((arg0 + 0) as *const i32); - let l1 = *((arg0 + 4) as *const i32); - let base2 = l0; - let len2 = l1; - wit_bindgen::rt::dealloc(base2, (len2 as usize) * 1, 1); - } - }; -}; -const _: () = { - - #[doc(hidden)] - #[export_name = "hash"] - #[allow(non_snake_case)] - unsafe extern "C" fn __export_hash(arg0: i32,arg1: i32,) -> i32 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - - // Before executing any other code, use this function to run all static - // constructors, if they have not yet been run. This is a hack required - // to work around wasi-libc ctors calling import functions to initialize - // the environment. - // - // This functionality will be removed once rust 1.69.0 is stable, at which - // point wasi-libc will no longer have this behavior. - // - // See - // https://github.com/bytecodealliance/preview2-prototyping/issues/99 - // for more details. - #[cfg(target_arch="wasm32")] - wit_bindgen::rt::run_ctors_once(); - - let len0 = arg1 as usize; - let bytes0 = Vec::from_raw_parts(arg0 as *mut _, len0, len0); - let result1 = <_GuestImpl as Guest>::hash(wit_bindgen::rt::string_lift(bytes0)); - let ptr2 = _RET_AREA.0.as_mut_ptr() as i32; +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn __post_return_rotate90_base64(arg0: *mut u8) { + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + let base2 = l0; + let len2 = l1; + _rt::cabi_dealloc(base2, len2 * 1, 1); +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_hash_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let result1 = T::hash(_rt::string_lift(bytes0)); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); let vec3 = (result1).into_boxed_slice(); - let ptr3 = vec3.as_ptr() as i32; - let len3 = vec3.len() as i32; + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); ::core::mem::forget(vec3); - *((ptr2 + 4) as *mut i32) = len3; - *((ptr2 + 0) as *mut i32) = ptr3; + *ptr2.add(4).cast::() = len3; + *ptr2.add(0).cast::<*mut u8>() = ptr3.cast_mut(); ptr2 - } - - const _: () = { - #[doc(hidden)] - #[export_name = "cabi_post_hash"] - #[allow(non_snake_case)] - unsafe extern "C" fn __post_return_hash(arg0: i32,) { - let l0 = *((arg0 + 0) as *const i32); - let l1 = *((arg0 + 4) as *const i32); - let base2 = l0; - let len2 = l1; - wit_bindgen::rt::dealloc(base2, (len2 as usize) * 1, 1); - } - }; -}; -use super::Component as _GuestImpl; +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn __post_return_hash(arg0: *mut u8) { + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + let base2 = l0; + let len2 = l1; + _rt::cabi_dealloc(base2, len2 * 1, 1); +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_pop_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { + let len0 = arg1; + let result1 = T::pop(_rt::Vec::from_raw_parts(arg0.cast(), len0, len0)); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Some(e) => { + *ptr2.add(0).cast::() = (1i32) as u8; + *ptr2.add(4).cast::() = _rt::as_i32(e); + } + None => { + *ptr2.add(0).cast::() = (0i32) as u8; + } + }; + ptr2 +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_binary_search_cabi( + arg0: *mut u8, + arg1: usize, + arg2: i32, +) -> *mut u8 { + let len0 = arg1; + let result1 = T::binary_search(_rt::Vec::from_raw_parts(arg0.cast(), len0, len0), arg2); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Ok(e) => { + *ptr2.add(0).cast::() = (0i32) as u8; + *ptr2.add(4).cast::() = _rt::as_i32(e); + } + Err(_) => { + *ptr2.add(0).cast::() = (1i32) as u8; + } + }; + ptr2 +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn _export_num_to_kv_cabi(arg0: i32, arg1: *mut u8, arg2: usize) -> *mut u8 { + let result1 = T::num_to_kv(match arg0 { + 0 => { + let e = arg1 as i32 as u32; + Ok(e) + } + 1 => { + let e = { + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + + _rt::string_lift(bytes0) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + }); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + let NumKeys { + name: name3, + val: val3, + } = result1; + let vec4 = (name3.into_bytes()).into_boxed_slice(); + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); + ::core::mem::forget(vec4); + *ptr2.add(4).cast::() = len4; + *ptr2.add(0).cast::<*mut u8>() = ptr4.cast_mut(); + match val3 { + Some(e) => { + *ptr2.add(8).cast::() = (1i32) as u8; + *ptr2.add(12).cast::() = _rt::as_i32(e); + } + None => { + *ptr2.add(8).cast::() = (0i32) as u8; + } + }; + ptr2 +} + +#[doc(hidden)] +#[allow(non_snake_case)] +pub unsafe fn __post_return_num_to_kv(arg0: *mut u8) { + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(4).cast::(); + _rt::cabi_dealloc(l0, l1, 1); +} pub trait Guest { - fn add_one(a: i32,) -> i32; - fn append_string(a: wit_bindgen::rt::string::String,) -> wit_bindgen::rt::string::String; - fn join_strings(a: wit_bindgen::rt::string::String,b: wit_bindgen::rt::string::String,) -> wit_bindgen::rt::string::String; - fn host_fmt_current_time() -> wit_bindgen::rt::string::String; - fn transpose(matrix: wit_bindgen::rt::vec::Vec::>,) -> wit_bindgen::rt::vec::Vec::>; - fn blur(data: wit_bindgen::rt::vec::Vec::,sigma: f32,) -> wit_bindgen::rt::vec::Vec::; - fn blur_base64(data: wit_bindgen::rt::string::String,sigma: f32,) -> wit_bindgen::rt::vec::Vec::; - fn crop(data: wit_bindgen::rt::vec::Vec::,x: u32,y: u32,target_width: u32,target_height: u32,) -> wit_bindgen::rt::vec::Vec::; - fn crop_base64(data: wit_bindgen::rt::string::String,x: u32,y: u32,target_width: u32,target_height: u32,) -> wit_bindgen::rt::vec::Vec::; - fn grayscale(data: wit_bindgen::rt::vec::Vec::,) -> wit_bindgen::rt::vec::Vec::; - fn grayscale_base64(data: wit_bindgen::rt::string::String,) -> wit_bindgen::rt::vec::Vec::; - fn rotate90(data: wit_bindgen::rt::vec::Vec::,) -> wit_bindgen::rt::vec::Vec::; - fn rotate90_base64(data: wit_bindgen::rt::string::String,) -> wit_bindgen::rt::vec::Vec::; - fn hash(data: wit_bindgen::rt::string::String,) -> wit_bindgen::rt::vec::Vec::; -} - -#[allow(unused_imports)] -use wit_bindgen::rt::{alloc, vec::Vec, string::String}; + fn add_one(a: i32) -> i32; + fn append_string(a: _rt::String) -> _rt::String; + fn join_strings(a: _rt::String, b: _rt::String) -> _rt::String; + fn host_fmt_current_time() -> _rt::String; + fn transpose(matrix: _rt::Vec<_rt::Vec>) -> _rt::Vec<_rt::Vec>; + fn blur(data: _rt::Vec, sigma: f32) -> _rt::Vec; + fn blur_base64(data: _rt::String, sigma: f32) -> _rt::Vec; + fn crop( + data: _rt::Vec, + x: u32, + y: u32, + target_width: u32, + target_height: u32, + ) -> _rt::Vec; + fn crop_base64( + data: _rt::String, + x: u32, + y: u32, + target_width: u32, + target_height: u32, + ) -> _rt::Vec; + fn grayscale(data: _rt::Vec) -> _rt::Vec; + fn grayscale_base64(data: _rt::String) -> _rt::Vec; + fn rotate90(data: _rt::Vec) -> _rt::Vec; + fn rotate90_base64(data: _rt::String) -> _rt::Vec; + fn hash(data: _rt::String) -> _rt::Vec; + fn pop(a: _rt::Vec) -> Option; + fn binary_search(slice: _rt::Vec, x: i32) -> Result; + fn num_to_kv(num: Result) -> NumKeys; +} +#[doc(hidden)] + +macro_rules! __export_world_test_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + + #[export_name = "add-one"] + unsafe extern "C" fn export_add_one(arg0: i32,) -> i32 { + $($path_to_types)*::_export_add_one_cabi::<$ty>(arg0) + } + + #[export_name = "append-string"] + unsafe extern "C" fn export_append_string(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_append_string_cabi::<$ty>(arg0, arg1) + } + + #[export_name = "cabi_post_append-string"] + unsafe extern "C" fn _post_return_append_string(arg0: *mut u8,) { + $($path_to_types)*::__post_return_append_string::<$ty>(arg0) + } + + #[export_name = "join-strings"] + unsafe extern "C" fn export_join_strings(arg0: *mut u8,arg1: usize,arg2: *mut u8,arg3: usize,) -> *mut u8 { + $($path_to_types)*::_export_join_strings_cabi::<$ty>(arg0, arg1, arg2, arg3) + } + + #[export_name = "cabi_post_join-strings"] + unsafe extern "C" fn _post_return_join_strings(arg0: *mut u8,) { + $($path_to_types)*::__post_return_join_strings::<$ty>(arg0) + } + + #[export_name = "host-fmt-current-time"] + unsafe extern "C" fn export_host_fmt_current_time() -> *mut u8 { + $($path_to_types)*::_export_host_fmt_current_time_cabi::<$ty>() + } + + #[export_name = "cabi_post_host-fmt-current-time"] + unsafe extern "C" fn _post_return_host_fmt_current_time(arg0: *mut u8,) { + $($path_to_types)*::__post_return_host_fmt_current_time::<$ty>(arg0) + } + + #[export_name = "transpose"] + unsafe extern "C" fn export_transpose(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_transpose_cabi::<$ty>(arg0, arg1) + } + + #[export_name = "cabi_post_transpose"] + unsafe extern "C" fn _post_return_transpose(arg0: *mut u8,) { + $($path_to_types)*::__post_return_transpose::<$ty>(arg0) + } + + #[export_name = "blur"] + unsafe extern "C" fn export_blur(arg0: *mut u8,arg1: usize,arg2: f32,) -> *mut u8 { + $($path_to_types)*::_export_blur_cabi::<$ty>(arg0, arg1, arg2) + } + + #[export_name = "cabi_post_blur"] + unsafe extern "C" fn _post_return_blur(arg0: *mut u8,) { + $($path_to_types)*::__post_return_blur::<$ty>(arg0) + } + + #[export_name = "blur-base64"] + unsafe extern "C" fn export_blur_base64(arg0: *mut u8,arg1: usize,arg2: f32,) -> *mut u8 { + $($path_to_types)*::_export_blur_base64_cabi::<$ty>(arg0, arg1, arg2) + } + + #[export_name = "cabi_post_blur-base64"] + unsafe extern "C" fn _post_return_blur_base64(arg0: *mut u8,) { + $($path_to_types)*::__post_return_blur_base64::<$ty>(arg0) + } + + #[export_name = "crop"] + unsafe extern "C" fn export_crop(arg0: *mut u8,arg1: usize,arg2: i32,arg3: i32,arg4: i32,arg5: i32,) -> *mut u8 { + $($path_to_types)*::_export_crop_cabi::<$ty>(arg0, arg1, arg2, arg3, arg4, arg5) + } + + #[export_name = "cabi_post_crop"] + unsafe extern "C" fn _post_return_crop(arg0: *mut u8,) { + $($path_to_types)*::__post_return_crop::<$ty>(arg0) + } + + #[export_name = "crop-base64"] + unsafe extern "C" fn export_crop_base64(arg0: *mut u8,arg1: usize,arg2: i32,arg3: i32,arg4: i32,arg5: i32,) -> *mut u8 { + $($path_to_types)*::_export_crop_base64_cabi::<$ty>(arg0, arg1, arg2, arg3, arg4, arg5) + } + + #[export_name = "cabi_post_crop-base64"] + unsafe extern "C" fn _post_return_crop_base64(arg0: *mut u8,) { + $($path_to_types)*::__post_return_crop_base64::<$ty>(arg0) + } + + #[export_name = "grayscale"] + unsafe extern "C" fn export_grayscale(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_grayscale_cabi::<$ty>(arg0, arg1) + } + + #[export_name = "cabi_post_grayscale"] + unsafe extern "C" fn _post_return_grayscale(arg0: *mut u8,) { + $($path_to_types)*::__post_return_grayscale::<$ty>(arg0) + } + + #[export_name = "grayscale-base64"] + unsafe extern "C" fn export_grayscale_base64(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_grayscale_base64_cabi::<$ty>(arg0, arg1) + } + + #[export_name = "cabi_post_grayscale-base64"] + unsafe extern "C" fn _post_return_grayscale_base64(arg0: *mut u8,) { + $($path_to_types)*::__post_return_grayscale_base64::<$ty>(arg0) + } + + #[export_name = "rotate90"] + unsafe extern "C" fn export_rotate90(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_rotate90_cabi::<$ty>(arg0, arg1) + } + + #[export_name = "cabi_post_rotate90"] + unsafe extern "C" fn _post_return_rotate90(arg0: *mut u8,) { + $($path_to_types)*::__post_return_rotate90::<$ty>(arg0) + } + + #[export_name = "rotate90-base64"] + unsafe extern "C" fn export_rotate90_base64(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_rotate90_base64_cabi::<$ty>(arg0, arg1) + } + + #[export_name = "cabi_post_rotate90-base64"] + unsafe extern "C" fn _post_return_rotate90_base64(arg0: *mut u8,) { + $($path_to_types)*::__post_return_rotate90_base64::<$ty>(arg0) + } + + #[export_name = "hash"] + unsafe extern "C" fn export_hash(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_hash_cabi::<$ty>(arg0, arg1) + } + + #[export_name = "cabi_post_hash"] + unsafe extern "C" fn _post_return_hash(arg0: *mut u8,) { + $($path_to_types)*::__post_return_hash::<$ty>(arg0) + } + + #[export_name = "pop"] + unsafe extern "C" fn export_pop(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_pop_cabi::<$ty>(arg0, arg1) + } + + #[export_name = "binary-search"] + unsafe extern "C" fn export_binary_search(arg0: *mut u8,arg1: usize,arg2: i32,) -> *mut u8 { + $($path_to_types)*::_export_binary_search_cabi::<$ty>(arg0, arg1, arg2) + } + + #[export_name = "num-to-kv"] + unsafe extern "C" fn export_num_to_kv(arg0: i32,arg1: *mut u8,arg2: usize,) -> *mut u8 { + $($path_to_types)*::_export_num_to_kv_cabi::<$ty>(arg0, arg1, arg2) + } + + #[export_name = "cabi_post_num-to-kv"] + unsafe extern "C" fn _post_return_num_to_kv(arg0: *mut u8,) { + $($path_to_types)*::__post_return_num_to_kv::<$ty>(arg0) + } + };); +} +#[doc(hidden)] +pub(crate) use __export_world_test_cabi; #[repr(align(4))] -struct _RetArea([u8; 8]); -static mut _RET_AREA: _RetArea = _RetArea([0; 8]); +struct _RetArea([::core::mem::MaybeUninit; 16]); +static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 16]); pub mod homestar { - pub mod host { - - #[allow(clippy::all)] - pub mod helpers { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - #[repr(C)] - #[derive(Clone, Copy)] - pub struct Time { - pub seconds: u64, - pub milliseconds: u32, - pub nanoseconds: u32, - } - impl ::core::fmt::Debug for Time { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - f.debug_struct("Time").field("seconds", &self.seconds).field("milliseconds", &self.milliseconds).field("nanoseconds", &self.nanoseconds).finish() - } - } - #[allow(unused_unsafe, clippy::all)] - /// Get current time in sub-seconds. - pub fn get_current_time() -> Time{ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - - #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "homestar:host/helpers@0.0.1")] - extern "C" { - #[link_name = "get-current-time"] - fn wit_import(_: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, ){ unreachable!() } - wit_import(ptr0); - let l1 = *((ptr0 + 0) as *const i64); - let l2 = *((ptr0 + 8) as *const i32); - let l3 = *((ptr0 + 12) as *const i32); - Time{ - seconds: l1 as u64, - milliseconds: l2 as u32, - nanoseconds: l3 as u32, - } - } - } - #[allow(unused_unsafe, clippy::all)] - /// Basic `print` helper. - pub fn print(msg: &str,){ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - let vec0 = msg; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "homestar:host/helpers@0.0.1")] - extern "C" { - #[link_name = "print"] - fn wit_import(_: i32, _: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, ){ unreachable!() } - wit_import(ptr0, len0); + pub mod host { + + #[allow(clippy::all)] + pub mod helpers { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + #[repr(C)] + #[derive(Clone, Copy)] + pub struct Time { + pub seconds: u64, + pub milliseconds: u32, + pub nanoseconds: u32, + } + impl ::core::fmt::Debug for Time { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Time") + .field("seconds", &self.seconds) + .field("milliseconds", &self.milliseconds) + .field("nanoseconds", &self.nanoseconds) + .finish() + } + } + #[allow(unused_unsafe, clippy::all)] + /// Get current time in sub-seconds. + pub fn get_current_time() -> Time { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "homestar:host/helpers@0.0.1")] + extern "C" { + #[link_name = "get-current-time"] + fn wit_import(_: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8) { + unreachable!() + } + wit_import(ptr0); + let l1 = *ptr0.add(0).cast::(); + let l2 = *ptr0.add(8).cast::(); + let l3 = *ptr0.add(12).cast::(); + Time { + seconds: l1 as u64, + milliseconds: l2 as u32, + nanoseconds: l3 as u32, + } + } + } + #[allow(unused_unsafe, clippy::all)] + /// Basic `print` helper. + pub fn print(msg: &str) { + unsafe { + let vec0 = msg; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "homestar:host/helpers@0.0.1")] + extern "C" { + #[link_name = "print"] + fn wit_import(_: *mut u8, _: usize); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8, _: usize) { + unreachable!() + } + wit_import(ptr0.cast_mut(), len0); + } + } } - } - } - - } } pub mod wasi { - pub mod logging { - - #[allow(clippy::all)] pub mod logging { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; - /// A log level, describing a kind of message. - #[repr(u8)] - #[derive(Clone, Copy, Eq, PartialEq)] - pub enum Level { - /// Describes messages about the values of variables and the flow of - /// control within a program. - Trace, - /// Describes messages likely to be of interest to someone debugging a - /// program. - Debug, - /// Describes messages likely to be of interest to someone monitoring a - /// program. - Info, - /// Describes messages indicating hazardous situations. - Warn, - /// Describes messages indicating serious errors. - Error, - /// Describes messages indicating fatal errors. - Critical, - } - impl ::core::fmt::Debug for Level { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - match self { - Level::Trace => { - f.debug_tuple("Level::Trace").finish() - } - Level::Debug => { - f.debug_tuple("Level::Debug").finish() - } - Level::Info => { - f.debug_tuple("Level::Info").finish() + + #[allow(clippy::all)] + pub mod logging { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + /// A log level, describing a kind of message. + #[repr(u8)] + #[derive(Clone, Copy, Eq, PartialEq)] + pub enum Level { + /// Describes messages about the values of variables and the flow of + /// control within a program. + Trace, + /// Describes messages likely to be of interest to someone debugging a + /// program. + Debug, + /// Describes messages likely to be of interest to someone monitoring a + /// program. + Info, + /// Describes messages indicating hazardous situations. + Warn, + /// Describes messages indicating serious errors. + Error, + /// Describes messages indicating fatal errors. + Critical, } - Level::Warn => { - f.debug_tuple("Level::Warn").finish() + impl ::core::fmt::Debug for Level { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Level::Trace => f.debug_tuple("Level::Trace").finish(), + Level::Debug => f.debug_tuple("Level::Debug").finish(), + Level::Info => f.debug_tuple("Level::Info").finish(), + Level::Warn => f.debug_tuple("Level::Warn").finish(), + Level::Error => f.debug_tuple("Level::Error").finish(), + Level::Critical => f.debug_tuple("Level::Critical").finish(), + } + } } - Level::Error => { - f.debug_tuple("Level::Error").finish() + + impl Level { + pub(crate) unsafe fn _lift(val: u8) -> Level { + if !cfg!(debug_assertions) { + return ::core::mem::transmute(val); + } + + match val { + 0 => Level::Trace, + 1 => Level::Debug, + 2 => Level::Info, + 3 => Level::Warn, + 4 => Level::Error, + 5 => Level::Critical, + + _ => panic!("invalid enum discriminant"), + } + } } - Level::Critical => { - f.debug_tuple("Level::Critical").finish() + + #[allow(unused_unsafe, clippy::all)] + /// Emit a log message. + /// + /// A log message has a `level` describing what kind of message is being + /// sent, a context, which is an uninterpreted string meant to help + /// consumers group similar messages, and a string containing the message + /// text. + pub fn log(level: Level, context: &str, message: &str) { + unsafe { + let vec0 = context; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let vec1 = message; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:logging/logging")] + extern "C" { + #[link_name = "log"] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8, _: usize); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8, _: usize) { + unreachable!() + } + wit_import( + level.clone() as i32, + ptr0.cast_mut(), + len0, + ptr1.cast_mut(), + len1, + ); + } } - } } - } - - impl Level{ - pub(crate) unsafe fn _lift(val: u8) -> Level{ - if !cfg!(debug_assertions) { - return ::core::mem::transmute(val); - } - - match val { - 0 => Level::Trace, - 1 => Level::Debug, - 2 => Level::Info, - 3 => Level::Warn, - 4 => Level::Error, - 5 => Level::Critical, - - _ => panic!("invalid enum discriminant"), - } + } +} +mod _rt { + pub use alloc_crate::string::String; + + pub fn as_i32(t: T) -> i32 { + t.as_i32() + } + + pub trait AsI32 { + fn as_i32(self) -> i32; + } + + impl<'a, T: Copy + AsI32> AsI32 for &'a T { + fn as_i32(self) -> i32 { + (*self).as_i32() + } + } + + impl AsI32 for i32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for char { + #[inline] + fn as_i32(self) -> i32 { + self as i32 } - } - - #[allow(unused_unsafe, clippy::all)] - /// Emit a log message. - /// - /// A log message has a `level` describing what kind of message is being - /// sent, a context, which is an uninterpreted string meant to help - /// consumers group similar messages, and a string containing the message - /// text. - pub fn log(level: Level,context: &str,message: &str,){ - - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, vec::Vec, string::String}; - unsafe { - let vec0 = context; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - let vec1 = message; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; - - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:logging/logging")] - extern "C" { - #[link_name = "log"] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, ){ unreachable!() } - wit_import(level.clone() as i32, ptr0, len0, ptr1, len1); + } + + impl AsI32 for usize { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + pub use alloc_crate::vec::Vec; + pub unsafe fn string_lift(bytes: Vec) -> String { + if cfg!(debug_assertions) { + String::from_utf8(bytes).unwrap() + } else { + String::from_utf8_unchecked(bytes) } - } - } - - } + pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) { + if size == 0 { + return; + } + let layout = alloc::Layout::from_size_align_unchecked(size, align); + alloc::dealloc(ptr as *mut u8, layout); + } + pub use alloc_crate::alloc; + pub unsafe fn invalid_enum_discriminant() -> T { + if cfg!(debug_assertions) { + panic!("invalid enum discriminant") + } else { + core::hint::unreachable_unchecked() + } + } + extern crate alloc as alloc_crate; +} + +/// Generates `#[no_mangle]` functions to export the specified type as the +/// root implementation of all generated traits. +/// +/// For more information see the documentation of `wit_bindgen::generate!`. +/// +/// ```rust +/// # macro_rules! export{ ($($t:tt)*) => (); } +/// # trait Guest {} +/// struct MyType; +/// +/// impl Guest for MyType { +/// // ... +/// } +/// +/// export!(MyType); +/// ``` +#[allow(unused_macros)] +#[doc(hidden)] + +macro_rules! __export_test_impl { + ($ty:ident) => (self::export!($ty with_types_in self);); + ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( + $($path_to_types_root)*::__export_world_test_cabi!($ty with_types_in $($path_to_types_root)*); + ) } +#[doc(inline)] +pub(crate) use __export_test_impl as export; #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:test"] +#[link_section = "component-type:wit-bindgen:0.20.0:test:encoded world"] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 824] = [3, 0, 4, 116, 101, 115, 116, 0, 97, 115, 109, 13, 0, 1, 0, 7, 192, 5, 1, 65, 2, 1, 65, 32, 1, 66, 4, 1, 109, 6, 5, 116, 114, 97, 99, 101, 5, 100, 101, 98, 117, 103, 4, 105, 110, 102, 111, 4, 119, 97, 114, 110, 5, 101, 114, 114, 111, 114, 8, 99, 114, 105, 116, 105, 99, 97, 108, 4, 0, 5, 108, 101, 118, 101, 108, 3, 0, 0, 1, 64, 3, 5, 108, 101, 118, 101, 108, 1, 7, 99, 111, 110, 116, 101, 120, 116, 115, 7, 109, 101, 115, 115, 97, 103, 101, 115, 1, 0, 4, 0, 3, 108, 111, 103, 1, 2, 3, 1, 20, 119, 97, 115, 105, 58, 108, 111, 103, 103, 105, 110, 103, 47, 108, 111, 103, 103, 105, 110, 103, 5, 0, 1, 66, 6, 1, 114, 3, 7, 115, 101, 99, 111, 110, 100, 115, 119, 12, 109, 105, 108, 108, 105, 115, 101, 99, 111, 110, 100, 115, 121, 11, 110, 97, 110, 111, 115, 101, 99, 111, 110, 100, 115, 121, 4, 0, 4, 116, 105, 109, 101, 3, 0, 0, 1, 64, 0, 0, 1, 4, 0, 16, 103, 101, 116, 45, 99, 117, 114, 114, 101, 110, 116, 45, 116, 105, 109, 101, 1, 2, 1, 64, 1, 3, 109, 115, 103, 115, 1, 0, 4, 0, 5, 112, 114, 105, 110, 116, 1, 3, 3, 1, 27, 104, 111, 109, 101, 115, 116, 97, 114, 58, 104, 111, 115, 116, 47, 104, 101, 108, 112, 101, 114, 115, 64, 48, 46, 48, 46, 49, 5, 1, 1, 64, 1, 1, 97, 122, 0, 122, 4, 0, 7, 97, 100, 100, 45, 111, 110, 101, 1, 2, 1, 64, 1, 1, 97, 115, 0, 115, 4, 0, 13, 97, 112, 112, 101, 110, 100, 45, 115, 116, 114, 105, 110, 103, 1, 3, 1, 64, 2, 1, 97, 115, 1, 98, 115, 0, 115, 4, 0, 12, 106, 111, 105, 110, 45, 115, 116, 114, 105, 110, 103, 115, 1, 4, 1, 64, 0, 0, 115, 4, 0, 21, 104, 111, 115, 116, 45, 102, 109, 116, 45, 99, 117, 114, 114, 101, 110, 116, 45, 116, 105, 109, 101, 1, 5, 1, 112, 123, 1, 112, 6, 1, 64, 1, 6, 109, 97, 116, 114, 105, 120, 7, 0, 7, 4, 0, 9, 116, 114, 97, 110, 115, 112, 111, 115, 101, 1, 8, 1, 112, 125, 1, 64, 2, 4, 100, 97, 116, 97, 9, 5, 115, 105, 103, 109, 97, 118, 0, 9, 4, 0, 4, 98, 108, 117, 114, 1, 10, 1, 64, 2, 4, 100, 97, 116, 97, 115, 5, 115, 105, 103, 109, 97, 118, 0, 9, 4, 0, 11, 98, 108, 117, 114, 45, 98, 97, 115, 101, 54, 52, 1, 11, 1, 64, 5, 4, 100, 97, 116, 97, 9, 1, 120, 121, 1, 121, 121, 12, 116, 97, 114, 103, 101, 116, 45, 119, 105, 100, 116, 104, 121, 13, 116, 97, 114, 103, 101, 116, 45, 104, 101, 105, 103, 104, 116, 121, 0, 9, 4, 0, 4, 99, 114, 111, 112, 1, 12, 1, 64, 5, 4, 100, 97, 116, 97, 115, 1, 120, 121, 1, 121, 121, 12, 116, 97, 114, 103, 101, 116, 45, 119, 105, 100, 116, 104, 121, 13, 116, 97, 114, 103, 101, 116, 45, 104, 101, 105, 103, 104, 116, 121, 0, 9, 4, 0, 11, 99, 114, 111, 112, 45, 98, 97, 115, 101, 54, 52, 1, 13, 1, 64, 1, 4, 100, 97, 116, 97, 9, 0, 9, 4, 0, 9, 103, 114, 97, 121, 115, 99, 97, 108, 101, 1, 14, 1, 64, 1, 4, 100, 97, 116, 97, 115, 0, 9, 4, 0, 16, 103, 114, 97, 121, 115, 99, 97, 108, 101, 45, 98, 97, 115, 101, 54, 52, 1, 15, 4, 0, 8, 114, 111, 116, 97, 116, 101, 57, 48, 1, 14, 4, 0, 15, 114, 111, 116, 97, 116, 101, 57, 48, 45, 98, 97, 115, 101, 54, 52, 1, 15, 4, 0, 4, 104, 97, 115, 104, 1, 15, 4, 1, 28, 104, 111, 109, 101, 115, 116, 97, 114, 45, 102, 117, 110, 99, 116, 105, 111, 110, 115, 58, 116, 101, 115, 116, 47, 116, 101, 115, 116, 4, 0, 11, 10, 1, 0, 4, 116, 101, 115, 116, 3, 0, 0, 0, 16, 12, 112, 97, 99, 107, 97, 103, 101, 45, 100, 111, 99, 115, 0, 123, 125, 0, 70, 9, 112, 114, 111, 100, 117, 99, 101, 114, 115, 1, 12, 112, 114, 111, 99, 101, 115, 115, 101, 100, 45, 98, 121, 2, 13, 119, 105, 116, 45, 99, 111, 109, 112, 111, 110, 101, 110, 116, 6, 48, 46, 49, 56, 46, 50, 16, 119, 105, 116, 45, 98, 105, 110, 100, 103, 101, 110, 45, 114, 117, 115, 116, 6, 48, 46, 49, 54, 46, 48]; +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 948] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xb9\x06\x01A\x02\x01\ +A-\x01B\x04\x01m\x06\x05trace\x05debug\x04info\x04warn\x05error\x08critical\x04\0\ +\x05level\x03\0\0\x01@\x03\x05level\x01\x07contexts\x07messages\x01\0\x04\0\x03l\ +og\x01\x02\x03\x01\x14wasi:logging/logging\x05\0\x01B\x06\x01r\x03\x07secondsw\x0c\ +millisecondsy\x0bnanosecondsy\x04\0\x04time\x03\0\0\x01@\0\0\x01\x04\0\x10get-cu\ +rrent-time\x01\x02\x01@\x01\x03msgs\x01\0\x04\0\x05print\x01\x03\x03\x01\x1bhome\ +star:host/helpers@0.0.1\x05\x01\x01ky\x01r\x02\x04names\x03val\x02\x03\0\x08num-\ +keys\x03\0\x03\x01@\x01\x01az\0z\x04\0\x07add-one\x01\x05\x01@\x01\x01as\0s\x04\0\ +\x0dappend-string\x01\x06\x01@\x02\x01as\x01bs\0s\x04\0\x0cjoin-strings\x01\x07\x01\ +@\0\0s\x04\0\x15host-fmt-current-time\x01\x08\x01p{\x01p\x09\x01@\x01\x06matrix\x0a\ +\0\x0a\x04\0\x09transpose\x01\x0b\x01p}\x01@\x02\x04data\x0c\x05sigmav\0\x0c\x04\ +\0\x04blur\x01\x0d\x01@\x02\x04datas\x05sigmav\0\x0c\x04\0\x0bblur-base64\x01\x0e\ +\x01@\x05\x04data\x0c\x01xy\x01yy\x0ctarget-widthy\x0dtarget-heighty\0\x0c\x04\0\ +\x04crop\x01\x0f\x01@\x05\x04datas\x01xy\x01yy\x0ctarget-widthy\x0dtarget-height\ +y\0\x0c\x04\0\x0bcrop-base64\x01\x10\x01@\x01\x04data\x0c\0\x0c\x04\0\x09graysca\ +le\x01\x11\x01@\x01\x04datas\0\x0c\x04\0\x10grayscale-base64\x01\x12\x04\0\x08ro\ +tate90\x01\x11\x04\0\x0frotate90-base64\x01\x12\x04\0\x04hash\x01\x12\x01pz\x01k\ +z\x01@\x01\x01a\x13\0\x14\x04\0\x03pop\x01\x15\x01j\x01z\0\x01@\x02\x05slice\x13\ +\x01xz\0\x16\x04\0\x0dbinary-search\x01\x17\x01j\x01y\x01s\x01@\x01\x03num\x18\0\ +\x04\x04\0\x09num-to-kv\x01\x19\x04\x01\x1chomestar-functions:test/test\x04\0\x0b\ +\x0a\x01\0\x04test\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-compon\ +ent\x070.201.0\x10wit-bindgen-rust\x060.20.0"; #[inline(never)] #[doc(hidden)] #[cfg(target_arch = "wasm32")] -pub fn __link_section() {} +pub fn __link_custom_section_describing_imports() { + wit_bindgen_rt::maybe_link_cabi_realloc(); +} diff --git a/homestar-functions/test/src/lib.rs b/homestar-functions/test/src/lib.rs index a7ac1ffd..6885dd5f 100644 --- a/homestar-functions/test/src/lib.rs +++ b/homestar-functions/test/src/lib.rs @@ -16,10 +16,10 @@ use std::{ use bindings::Guest; -struct Component; - type Matrix = Vec>; +struct Component; + impl Guest for Component { fn add_one(a: i32) -> i32 { #[cfg(target_arch = "wasm32")] @@ -179,6 +179,32 @@ impl Guest for Component { s.hash(&mut hash); hash.finish().to_be_bytes().to_vec() } + + fn pop(mut a: Vec) -> Option { + #[cfg(target_arch = "wasm32")] + log(Level::Info, "run-fn", "pop-array"); + a.pop() + } + + fn binary_search(mut slice: Vec, x: i32) -> Result { + #[cfg(target_arch = "wasm32")] + log(Level::Info, "run-fn", "binary-search"); + slice.sort(); + slice.binary_search(&x).map(|y| y as i32).map_err(|_| ()) + } + + fn num_to_kv(num: Result) -> bindings::NumKeys { + #[cfg(target_arch = "wasm32")] + log(Level::Info, "run-fn", "num-to-kv"); + let num_string = num + .as_ref() + .map(|n| n.to_string()) + .unwrap_or_else(|_err| "NAN".to_string()); + bindings::NumKeys { + name: num_string, + val: num.ok(), + } + } } #[cfg(test)] @@ -322,3 +348,5 @@ mod test_mod { Component::blur(cropped, 0.1); } } + +bindings::export!(Component with_types_in bindings); diff --git a/homestar-functions/test/wit/world.wit b/homestar-functions/test/wit/world.wit index b0e9ed97..1a783711 100644 --- a/homestar-functions/test/wit/world.wit +++ b/homestar-functions/test/wit/world.wit @@ -4,6 +4,11 @@ world test { import wasi:logging/logging; import homestar:host/helpers@0.0.1; + record num-keys { + name: string, + val: option, + } + export add-one: func(a: s32) -> s32; export append-string: func(a: string) -> string; export join-strings: func(a: string, b: string) -> string; @@ -18,4 +23,7 @@ world test { export rotate90: func(data: list) -> list; export rotate90-base64: func(data: string) -> list; export hash: func(data: string) -> list; + export pop: func(a: list) -> option; + export binary-search: func(slice: list, x: s32) -> result; + export num-to-kv: func(num: result) -> num-keys; } diff --git a/homestar-invocation/src/task.rs b/homestar-invocation/src/task.rs index f5a40e4b..61c63884 100644 --- a/homestar-invocation/src/task.rs +++ b/homestar-invocation/src/task.rs @@ -208,7 +208,7 @@ mod test { ( "rsc".into(), Ipld::String( - "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la".into(), + "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q".into(), ), ), ("op".into(), Ipld::String("ipld/fun".to_string())), diff --git a/homestar-invocation/src/task/instruction.rs b/homestar-invocation/src/task/instruction.rs index 115fc0dc..fe118b7f 100644 --- a/homestar-invocation/src/task/instruction.rs +++ b/homestar-invocation/src/task/instruction.rs @@ -156,7 +156,7 @@ where /// use libipld::Ipld; /// use url::Url; /// -/// let wasm = "bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la".to_string(); +/// let wasm = "bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q".to_string(); /// let resource = Url::parse(format!("ipfs://{wasm}").as_str()).unwrap(); /// /// let instr = Instruction::unique( @@ -179,7 +179,7 @@ where /// use libipld::{cid::{multihash::{Code, MultihashDigest}, Cid}, Ipld, Link}; /// use url::Url; -/// let wasm = "bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la".to_string(); +/// let wasm = "bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q".to_string(); /// let resource = Url::parse(format!("ipfs://{wasm}").as_str()).expect("IPFS URL"); /// let h = Code::Blake3_256.digest(b"beep boop"); /// let cid = Cid::new_v1(0x55, h); @@ -490,7 +490,7 @@ mod test { ( RESOURCE_KEY.into(), Ipld::String( - "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la".into() + "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q".into() ) ), (OP_KEY.into(), Ipld::String("ipld/fun".to_string())), @@ -511,7 +511,7 @@ mod test { "func": "join-strings" }, "nnc": "", "op": "wasm/run", - "rsc": "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la"}); + "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q"}); let instruction = Instruction::::try_from(ipld.clone()).unwrap(); let instr_cid = instruction.to_cid().unwrap(); diff --git a/homestar-invocation/src/test_utils/invocation.rs b/homestar-invocation/src/test_utils/invocation.rs index 474de81c..0869604f 100644 --- a/homestar-invocation/src/test_utils/invocation.rs +++ b/homestar-invocation/src/test_utils/invocation.rs @@ -22,7 +22,7 @@ use std::collections::BTreeMap; use url::Url; const RAW: u64 = 0x55; -const WASM_CID: &str = "bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la"; +const WASM_CID: &str = "bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q"; type NonceBytes = Vec; diff --git a/homestar-runtime/Cargo.toml b/homestar-runtime/Cargo.toml index e3bb02db..cac8f7e9 100644 --- a/homestar-runtime/Cargo.toml +++ b/homestar-runtime/Cargo.toml @@ -204,7 +204,6 @@ vergen = { version = "8.3", default-features = false, features = [ [dev-dependencies] assert_cmd = "2.0" criterion = "0.5" -flaky_test = "0.2" homestar-invocation = { version = "0.2", path = "../homestar-invocation", features = [ "diesel", "test-utils", diff --git a/homestar-runtime/src/logger.rs b/homestar-runtime/src/logger.rs index 9daf378a..744a21c5 100644 --- a/homestar-runtime/src/logger.rs +++ b/homestar-runtime/src/logger.rs @@ -43,17 +43,23 @@ fn init( guard: WorkerGuard, #[allow(unused_variables)] settings: &settings::Monitoring, ) -> WorkerGuard { - let format_layer = tracing_subscriber::fmt::layer() - .event_format(tracing_logfmt::EventsFormatter::default()) - .fmt_fields(tracing_logfmt::FieldsFormatter::default()) + // TODO: Add support for customizing logger(s) / specialzed formatters. + let format_layer = tracing_logfmt::builder() + .with_level(true) + .with_target(true) + .with_span_name(true) + .with_span_path(true) + .with_location(true) + .with_module_path(true) + .layer() .with_writer(writer); let filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| { EnvFilter::new("info") - .add_directive("homestar_wasm=debug".parse().expect(DIRECTIVE_EXPECT)) + .add_directive("homestar_wasm=info".parse().expect(DIRECTIVE_EXPECT)) .add_directive("libp2p=info".parse().expect(DIRECTIVE_EXPECT)) .add_directive( - "libp2p_gossipsub::behaviour=debug" + "libp2p_gossipsub::behaviour=info" .parse() .expect(DIRECTIVE_EXPECT), ) diff --git a/homestar-runtime/src/network/webserver/notifier.rs b/homestar-runtime/src/network/webserver/notifier.rs index 3ce6ba71..37b681aa 100644 --- a/homestar-runtime/src/network/webserver/notifier.rs +++ b/homestar-runtime/src/network/webserver/notifier.rs @@ -39,7 +39,10 @@ where /// Send a message to all connected WebSocket clients. pub(crate) fn notify(&self, msg: T) -> Result<()> { - let _ = self.0.send(msg)?; + // If there are no receivers, the message is dropped. + if self.0.receiver_count() > 0 { + let _ = self.0.send(msg)?; + } Ok(()) } } diff --git a/homestar-runtime/src/tasks/fetch.rs b/homestar-runtime/src/tasks/fetch.rs index 21d02474..5df0245c 100644 --- a/homestar-runtime/src/tasks/fetch.rs +++ b/homestar-runtime/src/tasks/fetch.rs @@ -15,7 +15,7 @@ pub(crate) struct Fetch; #[cfg(any(test, feature = "test-utils"))] #[doc(hidden)] -const WASM_CID: &str = "bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la"; +const WASM_CID: &str = "bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q"; #[cfg(any(test, feature = "test-utils"))] #[doc(hidden)] const CAT_CID: &str = "bafybeiejevluvtoevgk66plh5t6xiy3ikyuuxg3vgofuvpeckb6eadresm"; diff --git a/homestar-runtime/tests/cli.rs b/homestar-runtime/tests/cli.rs index c647aed9..55fd5b7d 100644 --- a/homestar-runtime/tests/cli.rs +++ b/homestar-runtime/tests/cli.rs @@ -188,6 +188,7 @@ fn test_server_integration() -> Result<()> { #[test] #[serial_test::parallel] +#[cfg(feature = "test-utils")] fn test_workflow_run_integration() -> Result<()> { let proc_info = ProcInfo::new().unwrap(); let rpc_port = proc_info.rpc_port; @@ -231,7 +232,7 @@ fn test_workflow_run_integration() -> Result<()> { .assert() .success() .stdout(predicate::str::contains( - "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la", + "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q", )) .stdout(predicate::str::contains("num_tasks")) .stdout(predicate::str::contains("progress_count")); @@ -245,7 +246,7 @@ fn test_workflow_run_integration() -> Result<()> { .assert() .success() .stdout(predicate::str::contains( - "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la", + "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q", )) .stdout(predicate::str::contains("num_tasks")) .stdout(predicate::str::contains("progress_count")); diff --git a/homestar-runtime/tests/fixtures/test-workflow-add-one-part-one.json b/homestar-runtime/tests/fixtures/test-workflow-add-one-part-one.json index 2718a396..a07b0922 100644 --- a/homestar-runtime/tests/fixtures/test-workflow-add-one-part-one.json +++ b/homestar-runtime/tests/fixtures/test-workflow-add-one-part-one.json @@ -15,7 +15,7 @@ }, "nnc": "", "op": "wasm/run", - "rsc": "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la" + "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" } } ] diff --git a/homestar-runtime/tests/fixtures/test-workflow-add-one-part-two.json b/homestar-runtime/tests/fixtures/test-workflow-add-one-part-two.json index 84a2c8b1..5df3b8fc 100644 --- a/homestar-runtime/tests/fixtures/test-workflow-add-one-part-two.json +++ b/homestar-runtime/tests/fixtures/test-workflow-add-one-part-two.json @@ -13,7 +13,7 @@ "args": [ { "await/ok": { - "/": "bafyrmicffbk5pvhdih4kqeix42irl7djjgzrzbilsj7dyxpgdipl5da5vq" + "/": "bafyrmigpfy6vvnfmv2wpsnpjmrn6iurejcjhz2doqdl6cfext27etqvi54" } } ], @@ -21,7 +21,7 @@ }, "nnc": "", "op": "wasm/run", - "rsc": "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la" + "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" } } ] diff --git a/homestar-runtime/tests/fixtures/test-workflow-add-one.json b/homestar-runtime/tests/fixtures/test-workflow-add-one.json index cbfa6df7..4e68887f 100644 --- a/homestar-runtime/tests/fixtures/test-workflow-add-one.json +++ b/homestar-runtime/tests/fixtures/test-workflow-add-one.json @@ -1,46 +1,46 @@ { - "tasks": [ - { - "cause": null, - "meta": { - "fuel": 18446744073709552000, - "memory": 4294967296, - "time": 100000 - }, - "prf": [], - "run": { - "input": { - "args": [1], - "func": "add_one" - }, - "nnc": "", - "op": "wasm/run", - "rsc": "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la" - } - }, - { - "cause": null, - "meta": { - "fuel": 18446744073709552000, - "memory": 4294967296, - "time": 100000 - }, - "prf": [], - "run": { - "input": { - "args": [ - { - "await/ok": { - "/": "bafyrmicffbk5pvhdih4kqeix42irl7djjgzrzbilsj7dyxpgdipl5da5vq" - } + "tasks": [ + { + "cause": null, + "meta": { + "fuel": 18446744073709552000, + "memory": 4294967296, + "time": 100000 + }, + "prf": [], + "run": { + "input": { + "args": [1], + "func": "add_one" + }, + "nnc": "", + "op": "wasm/run", + "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" } - ], - "func": "add_one" }, - "nnc": "", - "op": "wasm/run", - "rsc": "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la" - } - } - ] + { + "cause": null, + "meta": { + "fuel": 18446744073709552000, + "memory": 4294967296, + "time": 100000 + }, + "prf": [], + "run": { + "input": { + "args": [ + { + "await/ok": { + "/": "bafyrmigpfy6vvnfmv2wpsnpjmrn6iurejcjhz2doqdl6cfext27etqvi54" + } + } + ], + "func": "add_one" + }, + "nnc": "", + "op": "wasm/run", + "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" + } + } + ] } diff --git a/homestar-runtime/tests/fixtures/test-workflow-image-pipeline.json b/homestar-runtime/tests/fixtures/test-workflow-image-pipeline.json index 90bf3168..e32d9ef9 100644 --- a/homestar-runtime/tests/fixtures/test-workflow-image-pipeline.json +++ b/homestar-runtime/tests/fixtures/test-workflow-image-pipeline.json @@ -1,75 +1,75 @@ { - "tasks": [ - { - "cause": null, - "meta": { - "memory": 4294967296, - "time": 100000 - }, - "prf": [], - "run": { - "input": { - "args": [ - { - "/": "bafybeiejevluvtoevgk66plh5t6xiy3ikyuuxg3vgofuvpeckb6eadresm" + "tasks": [ + { + "cause": null, + "meta": { + "memory": 4294967296, + "time": 100000 }, - 150, - 350, - 500, - 500 - ], - "func": "crop" - }, - "nnc": "", - "op": "wasm/run", - "rsc": "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la" - } - }, - { - "cause": null, - "meta": { - "memory": 4294967296, - "time": 100000 - }, - "prf": [], - "run": { - "input": { - "args": [ - { - "await/ok": { - "/": "bafyrmibsgnnssvnwvetpgrpgb34rw25fvrj2vnoemhetnsarxgmiyuvor4" - } + "prf": [], + "run": { + "input": { + "args": [ + { + "/": "bafybeiejevluvtoevgk66plh5t6xiy3ikyuuxg3vgofuvpeckb6eadresm" + }, + 150, + 350, + 500, + 500 + ], + "func": "crop" + }, + "nnc": "", + "op": "wasm/run", + "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" } - ], - "func": "rotate90" }, - "nnc": "", - "op": "wasm/run", - "rsc": "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la" - } - }, - { - "cause": null, - "meta": { - "memory": 4294967296, - "time": 100000 - }, - "prf": [], - "run": { - "input": { - "args": [ - { - "await/ok": { - "/": "bafyrmihzec7cuxdng3tbiji5quyqheknho7ig6w4p366zzrdansfs6ya5u" - } + { + "cause": null, + "meta": { + "memory": 4294967296, + "time": 100000 + }, + "prf": [], + "run": { + "input": { + "args": [ + { + "await/ok": { + "/": "bafyrmif6exakmqcoobygui5s6eo6i4nrp7eyy2nfibj4hty2i72gqd6zhq" + } + } + ], + "func": "rotate90" + }, + "nnc": "", + "op": "wasm/run", + "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" } - ], - "func": "grayscale" }, - "nnc": "", - "op": "wasm/run", - "rsc": "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la" - } - } - ] + { + "cause": null, + "meta": { + "memory": 4294967296, + "time": 100000 + }, + "prf": [], + "run": { + "input": { + "args": [ + { + "await/ok": { + "/": "bafyrmihvwl55wcrqvz7p7s3tw3cnc3bbndzpl6fafckkoboadjafj5lkqe" + } + } + ], + "func": "grayscale" + }, + "nnc": "", + "op": "wasm/run", + "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" + } + } + ] } diff --git a/homestar-runtime/tests/fixtures/test-workflow-no-awaits1.json b/homestar-runtime/tests/fixtures/test-workflow-no-awaits1.json index 3831e5ff..6adf2448 100644 --- a/homestar-runtime/tests/fixtures/test-workflow-no-awaits1.json +++ b/homestar-runtime/tests/fixtures/test-workflow-no-awaits1.json @@ -22,7 +22,7 @@ }, "nnc": "", "op": "wasm/run", - "rsc": "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la" + "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" } } ] diff --git a/homestar-runtime/tests/fixtures/test-workflow-no-awaits2.json b/homestar-runtime/tests/fixtures/test-workflow-no-awaits2.json index 6bcead40..451ef097 100644 --- a/homestar-runtime/tests/fixtures/test-workflow-no-awaits2.json +++ b/homestar-runtime/tests/fixtures/test-workflow-no-awaits2.json @@ -22,7 +22,7 @@ }, "nnc": "", "op": "wasm/run", - "rsc": "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la" + "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" } }, { @@ -47,7 +47,7 @@ }, "nnc": "", "op": "wasm/run", - "rsc": "ipfs://bafybeidpmgamv4i6jqrlwbnkrm3kzvvu7hj3jnoolcswub27mkda6p75la" + "rsc": "ipfs://bafybeia32q3oy6u47x624rmsmgrrlpn7ulruissmz5z2ap6alv7goe7h3q" } } ] diff --git a/homestar-runtime/tests/network/dht.rs b/homestar-runtime/tests/network/dht.rs index e5a885e1..014ec4fa 100644 --- a/homestar-runtime/tests/network/dht.rs +++ b/homestar-runtime/tests/network/dht.rs @@ -528,9 +528,7 @@ fn test_libp2p_dht_quorum_failure_intregration() -> Result<()> { } #[test] -#[allow(unused_must_use)] -#[flaky_test::flaky_test] -#[serial_test::serial] +#[serial_test::parallel] fn test_libp2p_dht_workflow_info_provider_integration() -> Result<()> { let proc_info1 = ProcInfo::new().unwrap(); let proc_info2 = ProcInfo::new().unwrap(); @@ -674,9 +672,9 @@ fn test_libp2p_dht_workflow_info_provider_integration() -> Result<()> { // We want node two to request workflow info directly from node one // because of timeouts not because workflow info was missing from the // DHT, so we give node one time to put add workflow info to the DHT. - tokio::time::sleep(Duration::from_secs(9)).await; + tokio::time::sleep(Duration::from_secs(1)).await; - let expected_workflow_cid = "bafyrmigvqtitv6mxhhgn3ms6uqfvzixu22mj6avuk3l4ycd2xe4acxmvzm"; + let expected_workflow_cid = "bafyrmidbhanzivykbzxfichwvpvywhkthd6wycmwlaha46z3lk5v3ilo5q"; // Run the same workflow run on node two. // Node two should be request workflow info from @@ -689,26 +687,6 @@ fn test_libp2p_dht_workflow_info_provider_integration() -> Result<()> { .arg("tests/fixtures/test-workflow-add-one.json") .output(); - // Poll for sent workflow info message - let sent_workflow_info_cid: Cid; - loop { - if let Ok(msg) = sub1.next().with_timeout(Duration::from_secs(30)).await { - let json: serde_json::Value = - serde_json::from_slice(&msg.unwrap().unwrap()).unwrap(); - - if json["sent_workflow_info"].is_object() { - sent_workflow_info_cid = - Cid::from_str(json["sent_workflow_info"]["cid"].as_str().unwrap()) - .expect("Unable to parse sent workflow info CID."); - break; - } - } else { - panic!("Node one did not send workflow info in time.") - } - } - - assert_eq!(sent_workflow_info_cid.to_string(), expected_workflow_cid); - // Poll for retrieved workflow info message let received_workflow_info_cid: Cid; loop { diff --git a/homestar-runtime/tests/webserver.rs b/homestar-runtime/tests/webserver.rs index 0fc0f97d..c9237555 100644 --- a/homestar-runtime/tests/webserver.rs +++ b/homestar-runtime/tests/webserver.rs @@ -1,6 +1,9 @@ use crate::{ make_config, - utils::{wait_for_socket_connection, ChildGuard, ProcInfo, TimeoutFutureExt, BIN_NAME}, + utils::{ + check_for_line_with, kill_homestar, retrieve_output, wait_for_socket_connection, + ChildGuard, ProcInfo, TimeoutFutureExt, BIN_NAME, + }, }; use anyhow::Result; use jsonrpsee::{ @@ -20,7 +23,7 @@ use std::{ static BIN: Lazy = Lazy::new(|| assert_cmd::cargo::cargo_bin(BIN_NAME)); const SUBSCRIBE_RUN_WORKFLOW_ENDPOINT: &str = "subscribe_run_workflow"; const UNSUBSCRIBE_RUN_WORKFLOW_ENDPOINT: &str = "unsubscribe_run_workflow"; -const AWAIT_CID: &str = "bafyrmicmrkz6m3vmqasx2ko4roovcacgt324dhpiqx52bvxyomcygxmg6u"; +const AWAIT_CID: &str = "bafyrmic7gy3muoxiyepl44iwrkxxrnkl5oa77scqq3ptuigrm5faiqfgka"; #[test] #[serial_test::parallel] @@ -44,7 +47,6 @@ fn test_workflow_run_integration() -> Result<()> { ); let config = make_config!(toml); - let homestar_proc = Command::new(BIN.as_os_str()) .env("RUST_BACKTRACE", "0") .arg("start") @@ -55,7 +57,7 @@ fn test_workflow_run_integration() -> Result<()> { .stdout(Stdio::piped()) .spawn() .unwrap(); - let _proc_guard = ChildGuard::new(homestar_proc); + let proc_guard = ChildGuard::new(homestar_proc); if wait_for_socket_connection(ws_port, 1000).is_err() { panic!("Homestar server/runtime failed to start in time"); @@ -202,5 +204,20 @@ fn test_workflow_run_integration() -> Result<()> { } }); + // Collect logs then kill proceses. + let dead_proc = kill_homestar(proc_guard.take(), None); + + // Retrieve logs. + let stdout = retrieve_output(dead_proc); + + // Check tht Wasm guest functions logged. + let crop_ran = check_for_line_with(stdout.clone(), vec!["run-fn", "crop"]); + let rotate_ran = check_for_line_with(stdout.clone(), vec!["run-fn", "rotate90"]); + let grayscale_ran = check_for_line_with(stdout, vec!["run-fn", "grayscale"]); + + assert!(crop_ran); + assert!(rotate_ran); + assert!(grayscale_ran); + Ok(()) } diff --git a/homestar-wasm/Cargo.toml b/homestar-wasm/Cargo.toml index fc5c582b..d6509a27 100644 --- a/homestar-wasm/Cargo.toml +++ b/homestar-wasm/Cargo.toml @@ -27,6 +27,7 @@ enum-as-inner = { workspace = true } heck = "0.4" homestar-invocation = { version = "0.2", path = "../homestar-invocation" } homestar-workspace-hack = { workspace = true } +indexmap = { workspace = true } itertools = { workspace = true } libipld = { workspace = true } rust_decimal = { version = "1.33", default-features = false } diff --git a/homestar-wasm/fixtures/example_add.wasm b/homestar-wasm/fixtures/example_add.wasm index 1a1bd877..578eb58e 100755 Binary files a/homestar-wasm/fixtures/example_add.wasm and b/homestar-wasm/fixtures/example_add.wasm differ diff --git a/homestar-wasm/fixtures/example_add.wat b/homestar-wasm/fixtures/example_add.wat index 043fbf65..1e02f3ca 100644 --- a/homestar-wasm/fixtures/example_add.wat +++ b/homestar-wasm/fixtures/example_add.wat @@ -1,36 +1,21 @@ (module - (type (;0;) (func)) - (type (;1;) (func (param i32) (result i32))) - (type (;2;) (func (param i32 i32) (result i32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32))) - (type (;5;) (func (param i32 i32 i32 i32) (result i32))) - (type (;6;) (func (param i32 i32 i32) (result i32))) - (func (;0;) (type 0)) - (func (;1;) (type 1) (param i32) (result i32) - call 2 + (type (;0;) (func (param i32) (result i32))) + (type (;1;) (func (param i32 i32) (result i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32))) + (type (;4;) (func (param i32 i32 i32 i32) (result i32))) + (type (;5;) (func (param i32 i32 i32) (result i32))) + (func (;0;) (type 0) (param i32) (result i32) local.get 0 i32.const 1 i32.add ) - (func (;2;) (type 0) - block ;; label = @1 - i32.const 0 - i32.load8_u offset=1049029 - br_if 0 (;@1;) - call 0 - i32.const 0 - i32.const 1 - i32.store8 offset=1049029 - end - ) - (func (;3;) (type 1) (param i32) (result i32) - call 2 + (func (;1;) (type 0) (param i32) (result i32) local.get 0 i32.const 2 i32.add ) - (func (;4;) (type 2) (param i32 i32) (result i32) + (func (;2;) (type 1) (param i32 i32) (result i32) (local i32 i32 i32 i32 i32) i32.const 0 local.set 2 @@ -62,7 +47,7 @@ i32.add i32.const 12 i32.add - call 5 + call 3 local.tee 1 i32.eqz br_if 0 (;@1;) @@ -162,7 +147,7 @@ i32.store offset=4 local.get 2 local.get 1 - call 6 + call 4 br 1 (;@2;) end local.get 2 @@ -225,7 +210,7 @@ i32.store offset=4 local.get 1 local.get 3 - call 6 + call 4 end local.get 0 i32.const 8 @@ -234,7 +219,7 @@ end local.get 2 ) - (func (;5;) (type 1) (param i32) (result i32) + (func (;3;) (type 0) (param i32) (result i32) (local i32 i32 i32 i32 i32 i32 i32 i32 i64) block ;; label = @1 block ;; label = @2 @@ -262,7 +247,7 @@ i32.and local.set 2 i32.const 0 - i32.load offset=1048988 + i32.load offset=1048992 local.tee 3 i32.eqz br_if 4 (;@4;) @@ -306,7 +291,7 @@ local.get 4 i32.const 2 i32.shl - i32.const 1048576 + i32.const 1048580 i32.add i32.load local.tee 5 @@ -401,7 +386,7 @@ end block ;; label = @8 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 6 i32.const 16 local.get 0 @@ -436,11 +421,11 @@ i32.const 3 i32.shl local.tee 0 - i32.const 1048720 + i32.const 1048724 i32.add local.tee 1 local.get 0 - i32.const 1048728 + i32.const 1048732 i32.add i32.load local.tee 0 @@ -462,7 +447,7 @@ local.get 2 i32.rotl i32.and - i32.store offset=1048984 + i32.store offset=1048988 end local.get 0 local.get 2 @@ -488,7 +473,7 @@ end local.get 2 i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 i32.le_u br_if 3 (;@4;) block ;; label = @8 @@ -497,7 +482,7 @@ local.get 0 br_if 0 (;@10;) i32.const 0 - i32.load offset=1048988 + i32.load offset=1048992 local.tee 0 i32.eqz br_if 6 (;@4;) @@ -505,7 +490,7 @@ i32.ctz i32.const 2 i32.shl - i32.const 1048576 + i32.const 1048580 i32.add i32.load local.tee 5 @@ -614,7 +599,7 @@ i32.load offset=28 i32.const 2 i32.shl - i32.const 1048576 + i32.const 1048580 i32.add local.tee 5 i32.load @@ -644,13 +629,13 @@ br_if 3 (;@9;) i32.const 0 i32.const 0 - i32.load offset=1048988 + i32.load offset=1048992 i32.const -2 local.get 6 i32.load offset=28 i32.rotl i32.and - i32.store offset=1048988 + i32.store offset=1048992 br 4 (;@8;) end local.get 0 @@ -696,11 +681,11 @@ i32.const 3 i32.shl local.tee 0 - i32.const 1048720 + i32.const 1048724 i32.add local.tee 5 local.get 0 - i32.const 1048728 + i32.const 1048732 i32.add i32.load local.tee 0 @@ -722,7 +707,7 @@ local.get 1 i32.rotl i32.and - i32.store offset=1048984 + i32.store offset=1048988 end local.get 0 local.get 2 @@ -750,23 +735,23 @@ i32.store block ;; label = @10 i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 local.tee 6 i32.eqz br_if 0 (;@10;) local.get 6 i32.const -8 i32.and - i32.const 1048720 + i32.const 1048724 i32.add local.set 5 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 local.set 2 block ;; label = @11 block ;; label = @12 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 8 i32.const 1 local.get 6 @@ -780,7 +765,7 @@ local.get 8 local.get 6 i32.or - i32.store offset=1048984 + i32.store offset=1048988 local.get 5 local.set 6 br 1 (;@11;) @@ -804,10 +789,10 @@ end i32.const 0 local.get 7 - i32.store offset=1049000 + i32.store offset=1049004 i32.const 0 local.get 1 - i32.store offset=1048992 + i32.store offset=1048996 local.get 0 i32.const 8 i32.add @@ -871,23 +856,23 @@ local.get 1 i32.store i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 local.tee 7 i32.eqz br_if 1 (;@9;) local.get 7 i32.const -8 i32.and - i32.const 1048720 + i32.const 1048724 i32.add local.set 5 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 local.set 0 block ;; label = @11 block ;; label = @12 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 8 i32.const 1 local.get 7 @@ -901,7 +886,7 @@ local.get 8 local.get 7 i32.or - i32.store offset=1048984 + i32.store offset=1048988 local.get 5 local.set 7 br 1 (;@11;) @@ -945,10 +930,10 @@ end i32.const 0 local.get 2 - i32.store offset=1049000 + i32.store offset=1049004 i32.const 0 local.get 1 - i32.store offset=1048992 + i32.store offset=1048996 end local.get 6 i32.const 8 @@ -979,7 +964,7 @@ i32.ctz i32.const 2 i32.shl - i32.const 1048576 + i32.const 1048580 i32.add i32.load local.set 0 @@ -1045,7 +1030,7 @@ br_if 0 (;@4;) block ;; label = @5 i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 local.tee 0 local.get 2 i32.lt_u @@ -1142,7 +1127,7 @@ i32.load offset=28 i32.const 2 i32.shl - i32.const 1048576 + i32.const 1048580 i32.add local.tee 5 i32.load @@ -1172,13 +1157,13 @@ br_if 2 (;@2;) i32.const 0 i32.const 0 - i32.load offset=1048988 + i32.load offset=1048992 i32.const -2 local.get 6 i32.load offset=28 i32.rotl i32.and - i32.store offset=1048988 + i32.store offset=1048992 br 3 (;@1;) end block ;; label = @4 @@ -1188,14 +1173,14 @@ block ;; label = @8 block ;; label = @9 i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 local.tee 0 local.get 2 i32.ge_u br_if 0 (;@9;) block ;; label = @10 i32.const 0 - i32.load offset=1048996 + i32.load offset=1049000 local.tee 0 local.get 2 i32.gt_u @@ -1222,7 +1207,7 @@ br_if 7 (;@3;) i32.const 0 i32.const 0 - i32.load offset=1049008 + i32.load offset=1049012 i32.const 0 local.get 5 i32.const -65536 @@ -1232,26 +1217,26 @@ local.tee 8 i32.add local.tee 0 - i32.store offset=1049008 + i32.store offset=1049012 i32.const 0 i32.const 0 - i32.load offset=1049012 + i32.load offset=1049016 local.tee 1 local.get 0 local.get 1 local.get 0 i32.gt_u select - i32.store offset=1049012 + i32.store offset=1049016 block ;; label = @11 block ;; label = @12 block ;; label = @13 i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 local.tee 1 i32.eqz br_if 0 (;@13;) - i32.const 1048704 + i32.const 1048708 local.set 0 loop ;; label = @14 local.get 0 @@ -1274,7 +1259,7 @@ block ;; label = @13 block ;; label = @14 i32.const 0 - i32.load offset=1049020 + i32.load offset=1049024 local.tee 0 i32.eqz br_if 0 (;@14;) @@ -1285,221 +1270,221 @@ end i32.const 0 local.get 6 - i32.store offset=1049020 + i32.store offset=1049024 end i32.const 0 i32.const 4095 - i32.store offset=1049024 + i32.store offset=1049028 i32.const 0 local.get 8 - i32.store offset=1048708 + i32.store offset=1048712 i32.const 0 local.get 6 - i32.store offset=1048704 + i32.store offset=1048708 + i32.const 0 + i32.const 1048724 + i32.store offset=1048736 + i32.const 0 + i32.const 1048732 + i32.store offset=1048744 i32.const 0 - i32.const 1048720 + i32.const 1048724 i32.store offset=1048732 i32.const 0 - i32.const 1048728 + i32.const 1048740 + i32.store offset=1048752 + i32.const 0 + i32.const 1048732 i32.store offset=1048740 i32.const 0 - i32.const 1048720 - i32.store offset=1048728 + i32.const 1048748 + i32.store offset=1048760 i32.const 0 - i32.const 1048736 + i32.const 1048740 i32.store offset=1048748 i32.const 0 - i32.const 1048728 - i32.store offset=1048736 + i32.const 1048756 + i32.store offset=1048768 i32.const 0 - i32.const 1048744 + i32.const 1048748 i32.store offset=1048756 i32.const 0 - i32.const 1048736 - i32.store offset=1048744 + i32.const 1048764 + i32.store offset=1048776 i32.const 0 - i32.const 1048752 + i32.const 1048756 i32.store offset=1048764 i32.const 0 - i32.const 1048744 - i32.store offset=1048752 + i32.const 1048772 + i32.store offset=1048784 i32.const 0 - i32.const 1048760 + i32.const 1048764 i32.store offset=1048772 i32.const 0 - i32.const 1048752 - i32.store offset=1048760 + i32.const 1048780 + i32.store offset=1048792 i32.const 0 - i32.const 1048768 + i32.const 1048772 i32.store offset=1048780 i32.const 0 - i32.const 1048760 - i32.store offset=1048768 - i32.const 0 - i32.const 1048776 - i32.store offset=1048788 i32.const 0 - i32.const 1048768 - i32.store offset=1048776 + i32.store offset=1048720 i32.const 0 + i32.const 1048788 + i32.store offset=1048800 i32.const 0 - i32.store offset=1048716 + i32.const 1048780 + i32.store offset=1048788 i32.const 0 - i32.const 1048784 + i32.const 1048788 i32.store offset=1048796 i32.const 0 - i32.const 1048776 - i32.store offset=1048784 - i32.const 0 - i32.const 1048784 - i32.store offset=1048792 + i32.const 1048796 + i32.store offset=1048808 i32.const 0 - i32.const 1048792 + i32.const 1048796 i32.store offset=1048804 i32.const 0 - i32.const 1048792 - i32.store offset=1048800 + i32.const 1048804 + i32.store offset=1048816 i32.const 0 - i32.const 1048800 + i32.const 1048804 i32.store offset=1048812 i32.const 0 - i32.const 1048800 - i32.store offset=1048808 + i32.const 1048812 + i32.store offset=1048824 i32.const 0 - i32.const 1048808 + i32.const 1048812 i32.store offset=1048820 i32.const 0 - i32.const 1048808 - i32.store offset=1048816 + i32.const 1048820 + i32.store offset=1048832 i32.const 0 - i32.const 1048816 + i32.const 1048820 i32.store offset=1048828 i32.const 0 - i32.const 1048816 - i32.store offset=1048824 + i32.const 1048828 + i32.store offset=1048840 i32.const 0 - i32.const 1048824 + i32.const 1048828 i32.store offset=1048836 i32.const 0 - i32.const 1048824 - i32.store offset=1048832 + i32.const 1048836 + i32.store offset=1048848 i32.const 0 - i32.const 1048832 + i32.const 1048836 i32.store offset=1048844 i32.const 0 - i32.const 1048832 - i32.store offset=1048840 + i32.const 1048844 + i32.store offset=1048856 i32.const 0 - i32.const 1048840 + i32.const 1048844 i32.store offset=1048852 i32.const 0 - i32.const 1048840 - i32.store offset=1048848 + i32.const 1048852 + i32.store offset=1048864 + i32.const 0 + i32.const 1048860 + i32.store offset=1048872 i32.const 0 - i32.const 1048848 + i32.const 1048852 i32.store offset=1048860 i32.const 0 - i32.const 1048856 + i32.const 1048868 + i32.store offset=1048880 + i32.const 0 + i32.const 1048860 i32.store offset=1048868 i32.const 0 - i32.const 1048848 - i32.store offset=1048856 + i32.const 1048876 + i32.store offset=1048888 i32.const 0 - i32.const 1048864 + i32.const 1048868 i32.store offset=1048876 i32.const 0 - i32.const 1048856 - i32.store offset=1048864 + i32.const 1048884 + i32.store offset=1048896 i32.const 0 - i32.const 1048872 + i32.const 1048876 i32.store offset=1048884 i32.const 0 - i32.const 1048864 - i32.store offset=1048872 + i32.const 1048892 + i32.store offset=1048904 i32.const 0 - i32.const 1048880 + i32.const 1048884 i32.store offset=1048892 i32.const 0 - i32.const 1048872 - i32.store offset=1048880 + i32.const 1048900 + i32.store offset=1048912 i32.const 0 - i32.const 1048888 + i32.const 1048892 i32.store offset=1048900 i32.const 0 - i32.const 1048880 - i32.store offset=1048888 + i32.const 1048908 + i32.store offset=1048920 i32.const 0 - i32.const 1048896 + i32.const 1048900 i32.store offset=1048908 i32.const 0 - i32.const 1048888 - i32.store offset=1048896 + i32.const 1048916 + i32.store offset=1048928 i32.const 0 - i32.const 1048904 + i32.const 1048908 i32.store offset=1048916 i32.const 0 - i32.const 1048896 - i32.store offset=1048904 + i32.const 1048924 + i32.store offset=1048936 i32.const 0 - i32.const 1048912 + i32.const 1048916 i32.store offset=1048924 i32.const 0 - i32.const 1048904 - i32.store offset=1048912 + i32.const 1048932 + i32.store offset=1048944 i32.const 0 - i32.const 1048920 + i32.const 1048924 i32.store offset=1048932 i32.const 0 - i32.const 1048912 - i32.store offset=1048920 + i32.const 1048940 + i32.store offset=1048952 i32.const 0 - i32.const 1048928 + i32.const 1048932 i32.store offset=1048940 i32.const 0 - i32.const 1048920 - i32.store offset=1048928 + i32.const 1048948 + i32.store offset=1048960 i32.const 0 - i32.const 1048936 + i32.const 1048940 i32.store offset=1048948 i32.const 0 - i32.const 1048928 - i32.store offset=1048936 + i32.const 1048956 + i32.store offset=1048968 i32.const 0 - i32.const 1048944 + i32.const 1048948 i32.store offset=1048956 i32.const 0 - i32.const 1048936 - i32.store offset=1048944 + i32.const 1048964 + i32.store offset=1048976 i32.const 0 - i32.const 1048952 + i32.const 1048956 i32.store offset=1048964 i32.const 0 - i32.const 1048944 - i32.store offset=1048952 + i32.const 1048972 + i32.store offset=1048984 i32.const 0 - i32.const 1048960 + i32.const 1048964 i32.store offset=1048972 i32.const 0 - i32.const 1048952 - i32.store offset=1048960 - i32.const 0 - i32.const 1048968 - i32.store offset=1048980 - i32.const 0 - i32.const 1048960 - i32.store offset=1048968 - i32.const 0 local.get 6 - i32.store offset=1049004 + i32.store offset=1049008 i32.const 0 - i32.const 1048968 - i32.store offset=1048976 + i32.const 1048972 + i32.store offset=1048980 i32.const 0 local.get 8 i32.const -40 i32.add local.tee 0 - i32.store offset=1048996 + i32.store offset=1049000 local.get 6 local.get 0 i32.const 1 @@ -1512,7 +1497,7 @@ i32.store offset=4 i32.const 0 i32.const 2097152 - i32.store offset=1049016 + i32.store offset=1049020 br 8 (;@4;) end local.get 1 @@ -1530,19 +1515,19 @@ end i32.const 0 i32.const 0 - i32.load offset=1049020 + i32.load offset=1049024 local.tee 0 local.get 6 local.get 0 local.get 6 i32.lt_u select - i32.store offset=1049020 + i32.store offset=1049024 local.get 6 local.get 8 i32.add local.set 5 - i32.const 1048704 + i32.const 1048708 local.set 0 block ;; label = @11 block ;; label = @12 @@ -1565,7 +1550,7 @@ i32.eqz br_if 1 (;@11;) end - i32.const 1048704 + i32.const 1048708 local.set 0 block ;; label = @12 loop ;; label = @13 @@ -1593,13 +1578,13 @@ end i32.const 0 local.get 6 - i32.store offset=1049004 + i32.store offset=1049008 i32.const 0 local.get 8 i32.const -40 i32.add local.tee 0 - i32.store offset=1048996 + i32.store offset=1049000 local.get 6 local.get 0 i32.const 1 @@ -1612,7 +1597,7 @@ i32.store offset=4 i32.const 0 i32.const 2097152 - i32.store offset=1049016 + i32.store offset=1049020 local.get 1 local.get 5 i32.const -32 @@ -1632,31 +1617,31 @@ i32.const 27 i32.store offset=4 i32.const 0 - i64.load offset=1048704 align=4 + i64.load offset=1048708 align=4 local.set 9 local.get 7 i32.const 16 i32.add i32.const 0 - i64.load offset=1048712 align=4 + i64.load offset=1048716 align=4 i64.store align=4 local.get 7 local.get 9 i64.store offset=8 align=4 i32.const 0 local.get 8 - i32.store offset=1048708 + i32.store offset=1048712 i32.const 0 local.get 6 - i32.store offset=1048704 + i32.store offset=1048708 i32.const 0 local.get 7 i32.const 8 i32.add - i32.store offset=1048712 + i32.store offset=1048716 i32.const 0 i32.const 0 - i32.store offset=1048716 + i32.store offset=1048720 local.get 7 i32.const 28 i32.add @@ -1701,19 +1686,19 @@ br_if 0 (;@12;) local.get 1 local.get 0 - call 7 + call 5 br 8 (;@4;) end local.get 0 i32.const -8 i32.and - i32.const 1048720 + i32.const 1048724 i32.add local.set 5 block ;; label = @12 block ;; label = @13 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 6 i32.const 1 local.get 0 @@ -1727,7 +1712,7 @@ local.get 6 local.get 0 i32.or - i32.store offset=1048984 + i32.store offset=1048988 local.get 5 local.set 0 br 1 (;@12;) @@ -1773,12 +1758,12 @@ local.set 2 local.get 5 i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 i32.eq br_if 3 (;@7;) local.get 5 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.eq br_if 4 (;@6;) block ;; label = @11 @@ -1795,7 +1780,7 @@ i32.const -8 i32.and local.tee 1 - call 8 + call 6 local.get 1 local.get 2 i32.add @@ -1829,19 +1814,19 @@ br_if 0 (;@11;) local.get 0 local.get 2 - call 7 + call 5 br 6 (;@5;) end local.get 2 i32.const -8 i32.and - i32.const 1048720 + i32.const 1048724 i32.add local.set 1 block ;; label = @11 block ;; label = @12 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 5 i32.const 1 local.get 2 @@ -1855,7 +1840,7 @@ local.get 5 local.get 2 i32.or - i32.store offset=1048984 + i32.store offset=1048988 local.get 1 local.set 2 br 1 (;@11;) @@ -1883,15 +1868,15 @@ local.get 2 i32.sub local.tee 1 - i32.store offset=1048996 + i32.store offset=1049000 i32.const 0 i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 local.tee 0 local.get 2 i32.add local.tee 5 - i32.store offset=1049004 + i32.store offset=1049008 local.get 5 local.get 1 i32.const 1 @@ -1909,7 +1894,7 @@ br 6 (;@3;) end i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 local.set 1 block ;; label = @9 block ;; label = @10 @@ -1922,10 +1907,10 @@ br_if 0 (;@10;) i32.const 0 i32.const 0 - i32.store offset=1049000 + i32.store offset=1049004 i32.const 0 i32.const 0 - i32.store offset=1048992 + i32.store offset=1048996 local.get 1 local.get 0 i32.const 3 @@ -1944,13 +1929,13 @@ end i32.const 0 local.get 5 - i32.store offset=1048992 + i32.store offset=1048996 i32.const 0 local.get 1 local.get 2 i32.add local.tee 6 - i32.store offset=1049000 + i32.store offset=1049004 local.get 6 local.get 5 i32.const 1 @@ -1979,7 +1964,7 @@ i32.store offset=4 i32.const 0 i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 local.tee 0 i32.const 15 i32.add @@ -1989,13 +1974,13 @@ i32.const -8 i32.add local.tee 5 - i32.store offset=1049004 + i32.store offset=1049008 i32.const 0 local.get 0 local.get 1 i32.sub i32.const 0 - i32.load offset=1048996 + i32.load offset=1049000 local.get 8 i32.add local.tee 1 @@ -2003,7 +1988,7 @@ i32.const 8 i32.add local.tee 6 - i32.store offset=1048996 + i32.store offset=1049000 local.get 5 local.get 6 i32.const 1 @@ -2016,19 +2001,19 @@ i32.store offset=4 i32.const 0 i32.const 2097152 - i32.store offset=1049016 + i32.store offset=1049020 br 3 (;@4;) end i32.const 0 local.get 0 - i32.store offset=1049004 + i32.store offset=1049008 i32.const 0 i32.const 0 - i32.load offset=1048996 + i32.load offset=1049000 local.get 2 i32.add local.tee 2 - i32.store offset=1048996 + i32.store offset=1049000 local.get 0 local.get 2 i32.const 1 @@ -2038,14 +2023,14 @@ end i32.const 0 local.get 0 - i32.store offset=1049000 + i32.store offset=1049004 i32.const 0 i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 local.get 2 i32.add local.tee 2 - i32.store offset=1048992 + i32.store offset=1048996 local.get 0 local.get 2 i32.const 1 @@ -2065,7 +2050,7 @@ i32.const 0 local.set 1 i32.const 0 - i32.load offset=1048996 + i32.load offset=1049000 local.tee 0 local.get 2 i32.le_u @@ -2075,15 +2060,15 @@ local.get 2 i32.sub local.tee 1 - i32.store offset=1048996 + i32.store offset=1049000 i32.const 0 i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 local.tee 0 local.get 2 i32.add local.tee 5 - i32.store offset=1049004 + i32.store offset=1049008 local.get 5 local.get 1 i32.const 1 @@ -2165,19 +2150,19 @@ br_if 0 (;@3;) local.get 0 local.get 1 - call 7 + call 5 br 2 (;@1;) end local.get 1 i32.const -8 i32.and - i32.const 1048720 + i32.const 1048724 i32.add local.set 2 block ;; label = @3 block ;; label = @4 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 5 i32.const 1 local.get 1 @@ -2191,7 +2176,7 @@ local.get 5 local.get 1 i32.or - i32.store offset=1048984 + i32.store offset=1048988 local.get 2 local.set 1 br 1 (;@3;) @@ -2236,7 +2221,7 @@ i32.const 8 i32.add ) - (func (;6;) (type 3) (param i32 i32) + (func (;4;) (type 2) (param i32 i32) (local i32 i32) local.get 0 local.get 1 @@ -2267,7 +2252,7 @@ i32.sub local.tee 0 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.ne br_if 0 (;@3;) local.get 2 @@ -2279,7 +2264,7 @@ br_if 1 (;@2;) i32.const 0 local.get 1 - i32.store offset=1048992 + i32.store offset=1048996 local.get 2 local.get 2 i32.load offset=4 @@ -2298,7 +2283,7 @@ end local.get 0 local.get 3 - call 8 + call 6 end block ;; label = @2 block ;; label = @3 @@ -2312,12 +2297,12 @@ br_if 0 (;@5;) local.get 2 i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 i32.eq br_if 2 (;@3;) local.get 2 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.eq br_if 3 (;@2;) local.get 2 @@ -2325,7 +2310,7 @@ i32.const -8 i32.and local.tee 3 - call 8 + call 6 local.get 0 local.get 3 local.get 1 @@ -2341,12 +2326,12 @@ i32.store local.get 0 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.ne br_if 1 (;@4;) i32.const 0 local.get 1 - i32.store offset=1048992 + i32.store offset=1048996 return end local.get 2 @@ -2372,19 +2357,19 @@ br_if 0 (;@4;) local.get 0 local.get 1 - call 7 + call 5 br 3 (;@1;) end local.get 1 i32.const -8 i32.and - i32.const 1048720 + i32.const 1048724 i32.add local.set 2 block ;; label = @4 block ;; label = @5 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 3 i32.const 1 local.get 1 @@ -2398,7 +2383,7 @@ local.get 3 local.get 1 i32.or - i32.store offset=1048984 + i32.store offset=1048988 local.get 2 local.set 1 br 1 (;@4;) @@ -2423,14 +2408,14 @@ end i32.const 0 local.get 0 - i32.store offset=1049004 + i32.store offset=1049008 i32.const 0 i32.const 0 - i32.load offset=1048996 + i32.load offset=1049000 local.get 1 i32.add local.tee 1 - i32.store offset=1048996 + i32.store offset=1049000 local.get 0 local.get 1 i32.const 1 @@ -2438,27 +2423,27 @@ i32.store offset=4 local.get 0 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.ne br_if 1 (;@1;) i32.const 0 i32.const 0 - i32.store offset=1048992 + i32.store offset=1048996 i32.const 0 i32.const 0 - i32.store offset=1049000 + i32.store offset=1049004 return end i32.const 0 local.get 0 - i32.store offset=1049000 + i32.store offset=1049004 i32.const 0 i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 local.get 1 i32.add local.tee 1 - i32.store offset=1048992 + i32.store offset=1048996 local.get 0 local.get 1 i32.const 1 @@ -2472,7 +2457,7 @@ return end ) - (func (;7;) (type 3) (param i32 i32) + (func (;5;) (type 2) (param i32 i32) (local i32 i32 i32 i32) i32.const 31 local.set 2 @@ -2509,13 +2494,13 @@ local.get 2 i32.const 2 i32.shl - i32.const 1048576 + i32.const 1048580 i32.add local.set 3 block ;; label = @1 block ;; label = @2 i32.const 0 - i32.load offset=1048988 + i32.load offset=1048992 local.tee 4 i32.const 1 local.get 2 @@ -2527,7 +2512,7 @@ local.get 4 local.get 5 i32.or - i32.store offset=1048988 + i32.store offset=1048992 local.get 3 local.get 0 i32.store @@ -2628,7 +2613,7 @@ local.get 0 i32.store offset=8 ) - (func (;8;) (type 3) (param i32 i32) + (func (;6;) (type 2) (param i32 i32) (local i32 i32 i32 i32) local.get 0 i32.load offset=12 @@ -2723,7 +2708,7 @@ i32.load offset=28 i32.const 2 i32.shl - i32.const 1048576 + i32.const 1048580 i32.add local.tee 1 i32.load @@ -2753,13 +2738,13 @@ br_if 1 (;@2;) i32.const 0 i32.const 0 - i32.load offset=1048988 + i32.load offset=1048992 i32.const -2 local.get 0 i32.load offset=28 i32.rotl i32.and - i32.store offset=1048988 + i32.store offset=1048992 br 2 (;@1;) end block ;; label = @3 @@ -2779,14 +2764,14 @@ end i32.const 0 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 i32.const -2 local.get 1 i32.const 3 i32.shr_u i32.rotl i32.and - i32.store offset=1048984 + i32.store offset=1048988 return end local.get 2 @@ -2823,7 +2808,7 @@ return end ) - (func (;9;) (type 4) (param i32) + (func (;7;) (type 3) (param i32) (local i32 i32 i32 i32 i32) local.get 0 i32.const -8 @@ -2864,7 +2849,7 @@ i32.sub local.tee 1 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.ne br_if 0 (;@5;) local.get 3 @@ -2876,7 +2861,7 @@ br_if 1 (;@4;) i32.const 0 local.get 0 - i32.store offset=1048992 + i32.store offset=1048996 local.get 3 local.get 3 i32.load offset=4 @@ -2895,7 +2880,7 @@ end local.get 1 local.get 2 - call 8 + call 6 end block ;; label = @4 block ;; label = @5 @@ -2908,12 +2893,12 @@ br_if 0 (;@6;) local.get 3 i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 i32.eq br_if 2 (;@4;) local.get 3 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.eq br_if 5 (;@1;) local.get 3 @@ -2921,7 +2906,7 @@ i32.const -8 i32.and local.tee 2 - call 8 + call 6 local.get 1 local.get 2 local.get 0 @@ -2937,12 +2922,12 @@ i32.store local.get 1 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.ne br_if 1 (;@5;) i32.const 0 local.get 0 - i32.store offset=1048992 + i32.store offset=1048996 return end local.get 3 @@ -2967,21 +2952,21 @@ br_if 2 (;@2;) local.get 1 local.get 0 - call 7 + call 5 i32.const 0 local.set 1 i32.const 0 i32.const 0 - i32.load offset=1049024 + i32.load offset=1049028 i32.const -1 i32.add local.tee 0 - i32.store offset=1049024 + i32.store offset=1049028 local.get 0 br_if 1 (;@3;) block ;; label = @5 i32.const 0 - i32.load offset=1048712 + i32.load offset=1048716 local.tee 0 i32.eqz br_if 0 (;@5;) @@ -3005,19 +2990,19 @@ i32.const 4095 i32.gt_u select - i32.store offset=1049024 + i32.store offset=1049028 return end i32.const 0 local.get 1 - i32.store offset=1049004 + i32.store offset=1049008 i32.const 0 i32.const 0 - i32.load offset=1048996 + i32.load offset=1049000 local.get 0 i32.add local.tee 0 - i32.store offset=1048996 + i32.store offset=1049000 local.get 1 local.get 0 i32.const 1 @@ -3026,24 +3011,24 @@ block ;; label = @4 local.get 1 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.ne br_if 0 (;@4;) i32.const 0 i32.const 0 - i32.store offset=1048992 + i32.store offset=1048996 i32.const 0 i32.const 0 - i32.store offset=1049000 + i32.store offset=1049004 end local.get 0 i32.const 0 - i32.load offset=1049016 + i32.load offset=1049020 local.tee 4 i32.le_u br_if 0 (;@3;) i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 local.tee 3 i32.eqz br_if 0 (;@3;) @@ -3051,12 +3036,12 @@ local.set 1 block ;; label = @4 i32.const 0 - i32.load offset=1048996 + i32.load offset=1049000 local.tee 5 i32.const 41 i32.lt_u br_if 0 (;@4;) - i32.const 1048704 + i32.const 1048708 local.set 0 loop ;; label = @5 block ;; label = @6 @@ -3082,7 +3067,7 @@ end block ;; label = @4 i32.const 0 - i32.load offset=1048712 + i32.load offset=1048716 local.tee 0 i32.eqz br_if 0 (;@4;) @@ -3106,27 +3091,27 @@ i32.const 4095 i32.gt_u select - i32.store offset=1049024 + i32.store offset=1049028 local.get 5 local.get 4 i32.le_u br_if 0 (;@3;) i32.const 0 i32.const -1 - i32.store offset=1049016 + i32.store offset=1049020 end return end local.get 0 i32.const -8 i32.and - i32.const 1048720 + i32.const 1048724 i32.add local.set 3 block ;; label = @2 block ;; label = @3 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 2 i32.const 1 local.get 0 @@ -3140,7 +3125,7 @@ local.get 2 local.get 0 i32.or - i32.store offset=1048984 + i32.store offset=1048988 local.get 3 local.set 0 br 1 (;@2;) @@ -3165,14 +3150,14 @@ end i32.const 0 local.get 1 - i32.store offset=1049000 + i32.store offset=1049004 i32.const 0 i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 local.get 0 i32.add local.tee 0 - i32.store offset=1048992 + i32.store offset=1048996 local.get 1 local.get 0 i32.const 1 @@ -3184,380 +3169,379 @@ local.get 0 i32.store ) - (func (;10;) (type 5) (param i32 i32 i32 i32) (result i32) + (func (;8;) (type 4) (param i32 i32 i32 i32) (result i32) (local i32 i32 i32 i32) block ;; label = @1 block ;; label = @2 block ;; label = @3 block ;; label = @4 block ;; label = @5 + block ;; label = @6 + local.get 1 + br_if 0 (;@6;) + local.get 3 + br_if 1 (;@5;) + local.get 2 + return + end + block ;; label = @6 + local.get 2 + i32.const 9 + i32.lt_u + br_if 0 (;@6;) + local.get 2 + local.get 3 + call 2 + local.tee 2 + i32.eqz + br_if 2 (;@4;) + local.get 2 + local.get 0 + local.get 1 + local.get 3 + local.get 1 + local.get 3 + i32.lt_u + select + call 10 + local.set 3 + local.get 0 + call 7 + local.get 3 + return + end + local.get 3 + i32.const -65588 + i32.gt_u + br_if 1 (;@4;) + i32.const 16 + local.get 3 + i32.const 11 + i32.add + i32.const -8 + i32.and + local.get 3 + i32.const 11 + i32.lt_u + select + local.set 1 + local.get 0 + i32.const -4 + i32.add + local.tee 4 + i32.load + local.tee 5 + i32.const -8 + i32.and + local.set 2 block ;; label = @6 block ;; label = @7 - block ;; label = @8 - local.get 1 - br_if 0 (;@8;) - local.get 3 - br_if 1 (;@7;) - local.get 2 - return - end - block ;; label = @8 - local.get 2 - i32.const 9 - i32.lt_u - br_if 0 (;@8;) - local.get 2 - local.get 3 - call 4 - local.tee 2 - i32.eqz - br_if 5 (;@3;) - local.get 2 - local.get 0 - local.get 1 - local.get 3 - local.get 1 - local.get 3 - i32.lt_u - select - call 12 - local.set 3 - local.get 0 - call 9 - local.get 3 - return - end - local.get 3 - i32.const -65588 - i32.gt_u - br_if 4 (;@3;) - i32.const 16 - local.get 3 - i32.const 11 - i32.add - i32.const -8 + local.get 5 + i32.const 3 i32.and - local.get 3 - i32.const 11 + br_if 0 (;@7;) + local.get 1 + i32.const 256 i32.lt_u - select - local.set 1 - local.get 0 - i32.const -4 - i32.add - local.tee 4 - i32.load - local.tee 5 - i32.const -8 - i32.and - local.set 2 + br_if 1 (;@6;) + local.get 2 + local.get 1 + i32.const 4 + i32.or + i32.lt_u + br_if 1 (;@6;) + local.get 2 + local.get 1 + i32.sub + i32.const 131073 + i32.ge_u + br_if 1 (;@6;) + br 5 (;@2;) + end + local.get 0 + i32.const -8 + i32.add + local.tee 6 + local.get 2 + i32.add + local.set 7 + block ;; label = @7 block ;; label = @8 block ;; label = @9 - local.get 5 - i32.const 3 - i32.and - br_if 0 (;@9;) + local.get 2 local.get 1 - i32.const 256 - i32.lt_u + i32.ge_u + br_if 0 (;@9;) + local.get 7 + i32.const 0 + i32.load offset=1049008 + i32.eq + br_if 2 (;@7;) + local.get 7 + i32.const 0 + i32.load offset=1049004 + i32.eq br_if 1 (;@8;) + local.get 7 + i32.load offset=4 + local.tee 5 + i32.const 2 + i32.and + br_if 3 (;@6;) + local.get 5 + i32.const -8 + i32.and + local.tee 5 local.get 2 + i32.add + local.tee 2 local.get 1 - i32.const 4 - i32.or i32.lt_u - br_if 1 (;@8;) + br_if 3 (;@6;) + local.get 7 + local.get 5 + call 6 local.get 2 local.get 1 i32.sub - i32.const 131073 - i32.ge_u - br_if 1 (;@8;) - br 7 (;@2;) - end - local.get 0 - i32.const -8 - i32.add - local.tee 6 - local.get 2 - i32.add - local.set 7 - block ;; label = @9 - block ;; label = @10 - block ;; label = @11 - local.get 2 - local.get 1 - i32.ge_u - br_if 0 (;@11;) - local.get 7 - i32.const 0 - i32.load offset=1049004 - i32.eq - br_if 2 (;@9;) - local.get 7 - i32.const 0 - i32.load offset=1049000 - i32.eq - br_if 1 (;@10;) - local.get 7 - i32.load offset=4 - local.tee 5 - i32.const 2 - i32.and - br_if 3 (;@8;) - local.get 5 - i32.const -8 - i32.and - local.tee 5 - local.get 2 - i32.add - local.tee 2 - local.get 1 - i32.lt_u - br_if 3 (;@8;) - local.get 7 - local.get 5 - call 8 - local.get 2 - local.get 1 - i32.sub - local.tee 3 - i32.const 16 - i32.lt_u - br_if 5 (;@6;) - local.get 4 - local.get 1 - local.get 4 - i32.load - i32.const 1 - i32.and - i32.or - i32.const 2 - i32.or - i32.store - local.get 6 - local.get 1 - i32.add - local.tee 1 - local.get 3 - i32.const 3 - i32.or - i32.store offset=4 - local.get 6 - local.get 2 - i32.add - local.tee 2 - local.get 2 - i32.load offset=4 - i32.const 1 - i32.or - i32.store offset=4 - local.get 1 - local.get 3 - call 6 - local.get 0 - return - end - local.get 2 - local.get 1 - i32.sub - local.tee 3 - i32.const 15 - i32.le_u - br_if 8 (;@2;) - local.get 4 - local.get 1 - local.get 5 - i32.const 1 - i32.and - i32.or - i32.const 2 - i32.or - i32.store - local.get 6 - local.get 1 - i32.add - local.tee 1 - local.get 3 - i32.const 3 - i32.or - i32.store offset=4 - local.get 7 - local.get 7 - i32.load offset=4 - i32.const 1 - i32.or - i32.store offset=4 - local.get 1 - local.get 3 - call 6 - local.get 0 - return - end - i32.const 0 - i32.load offset=1048992 + local.tee 3 + i32.const 16 + i32.lt_u + br_if 6 (;@3;) + local.get 4 + local.get 1 + local.get 4 + i32.load + i32.const 1 + i32.and + i32.or + i32.const 2 + i32.or + i32.store + local.get 6 + local.get 1 + i32.add + local.tee 1 + local.get 3 + i32.const 3 + i32.or + i32.store offset=4 + local.get 6 local.get 2 i32.add local.tee 2 + local.get 2 + i32.load offset=4 + i32.const 1 + i32.or + i32.store offset=4 local.get 1 - i32.lt_u - br_if 1 (;@8;) - block ;; label = @10 - block ;; label = @11 - local.get 2 - local.get 1 - i32.sub - local.tee 3 - i32.const 15 - i32.gt_u - br_if 0 (;@11;) - local.get 4 - local.get 5 - i32.const 1 - i32.and - local.get 2 - i32.or - i32.const 2 - i32.or - i32.store - local.get 6 - local.get 2 - i32.add - local.tee 3 - local.get 3 - i32.load offset=4 - i32.const 1 - i32.or - i32.store offset=4 - i32.const 0 - local.set 3 - i32.const 0 - local.set 1 - br 1 (;@10;) - end - local.get 4 - local.get 1 - local.get 5 - i32.const 1 - i32.and - i32.or - i32.const 2 - i32.or - i32.store - local.get 6 - local.get 1 - i32.add - local.tee 1 - local.get 3 - i32.const 1 - i32.or - i32.store offset=4 - local.get 6 - local.get 2 - i32.add - local.tee 2 - local.get 3 - i32.store - local.get 2 - local.get 2 - i32.load offset=4 - i32.const -2 - i32.and - i32.store offset=4 - end - i32.const 0 - local.get 1 - i32.store offset=1049000 - i32.const 0 local.get 3 - i32.store offset=1048992 + call 4 local.get 0 return end - i32.const 0 - i32.load offset=1048996 local.get 2 + local.get 1 + i32.sub + local.tee 3 + i32.const 15 + i32.le_u + br_if 6 (;@2;) + local.get 4 + local.get 1 + local.get 5 + i32.const 1 + i32.and + i32.or + i32.const 2 + i32.or + i32.store + local.get 6 + local.get 1 i32.add - local.tee 2 + local.tee 1 + local.get 3 + i32.const 3 + i32.or + i32.store offset=4 + local.get 7 + local.get 7 + i32.load offset=4 + i32.const 1 + i32.or + i32.store offset=4 local.get 1 - i32.gt_u - br_if 7 (;@1;) + local.get 3 + call 4 + local.get 0 + return end - local.get 3 - call 5 - local.tee 1 - i32.eqz - br_if 4 (;@3;) - local.get 1 - local.get 0 - i32.const -4 - i32.const -8 - local.get 4 - i32.load - local.tee 2 - i32.const 3 - i32.and - select + i32.const 0 + i32.load offset=1048996 local.get 2 - i32.const -8 - i32.and i32.add local.tee 2 - local.get 3 - local.get 2 - local.get 3 + local.get 1 i32.lt_u - select - call 12 - local.set 3 - local.get 0 - call 9 + br_if 1 (;@6;) + block ;; label = @8 + block ;; label = @9 + local.get 2 + local.get 1 + i32.sub + local.tee 3 + i32.const 15 + i32.gt_u + br_if 0 (;@9;) + local.get 4 + local.get 5 + i32.const 1 + i32.and + local.get 2 + i32.or + i32.const 2 + i32.or + i32.store + local.get 6 + local.get 2 + i32.add + local.tee 3 + local.get 3 + i32.load offset=4 + i32.const 1 + i32.or + i32.store offset=4 + i32.const 0 + local.set 3 + i32.const 0 + local.set 1 + br 1 (;@8;) + end + local.get 4 + local.get 1 + local.get 5 + i32.const 1 + i32.and + i32.or + i32.const 2 + i32.or + i32.store + local.get 6 + local.get 1 + i32.add + local.tee 1 + local.get 3 + i32.const 1 + i32.or + i32.store offset=4 + local.get 6 + local.get 2 + i32.add + local.tee 2 + local.get 3 + i32.store + local.get 2 + local.get 2 + i32.load offset=4 + i32.const -2 + i32.and + i32.store offset=4 + end + i32.const 0 + local.get 1 + i32.store offset=1049004 + i32.const 0 local.get 3 + i32.store offset=1048996 + local.get 0 return end i32.const 0 - i32.load8_u offset=1049028 - drop - local.get 2 - i32.const 9 - i32.lt_u - br_if 1 (;@5;) + i32.load offset=1049000 local.get 2 - local.get 3 - call 4 - local.set 0 - br 2 (;@4;) + i32.add + local.tee 2 + local.get 1 + i32.gt_u + br_if 5 (;@1;) end - local.get 4 - local.get 2 + local.get 3 + call 3 + local.tee 1 + i32.eqz + br_if 1 (;@4;) + local.get 1 + local.get 0 + i32.const -4 + i32.const -8 local.get 4 i32.load - i32.const 1 + local.tee 2 + i32.const 3 i32.and - i32.or - i32.const 2 - i32.or - i32.store - local.get 6 + select local.get 2 + i32.const -8 + i32.and i32.add - local.tee 3 + local.tee 2 local.get 3 - i32.load offset=4 - i32.const 1 - i32.or - i32.store offset=4 - br 3 (;@2;) + local.get 2 + local.get 3 + i32.lt_u + select + call 10 + local.set 3 + local.get 0 + call 7 + local.get 3 + return end - local.get 3 - call 5 - local.set 0 + i32.const 0 + i32.load8_u offset=1049032 + drop + block ;; label = @5 + block ;; label = @6 + local.get 2 + i32.const 9 + i32.lt_u + br_if 0 (;@6;) + local.get 2 + local.get 3 + call 2 + local.set 0 + br 1 (;@5;) + end + local.get 3 + call 3 + local.set 0 + end + local.get 0 + br_if 2 (;@2;) end - local.get 0 - br_if 1 (;@2;) + unreachable + unreachable end - unreachable - unreachable + local.get 4 + local.get 2 + local.get 4 + i32.load + i32.const 1 + i32.and + i32.or + i32.const 2 + i32.or + i32.store + local.get 6 + local.get 2 + i32.add + local.tee 3 + local.get 3 + i32.load offset=4 + i32.const 1 + i32.or + i32.store offset=4 end local.get 0 return @@ -3584,13 +3568,13 @@ i32.store offset=4 i32.const 0 local.get 1 - i32.store offset=1048996 + i32.store offset=1049000 i32.const 0 local.get 3 - i32.store offset=1049004 + i32.store offset=1049008 local.get 0 ) - (func (;11;) (type 6) (param i32 i32 i32) (result i32) + (func (;9;) (type 5) (param i32 i32 i32) (result i32) (local i32 i32 i32 i32 i32 i32 i32 i32) block ;; label = @1 block ;; label = @2 @@ -3771,20 +3755,31 @@ end local.get 0 ) - (func (;12;) (type 6) (param i32 i32 i32) (result i32) + (func (;10;) (type 5) (param i32 i32 i32) (result i32) local.get 0 local.get 1 local.get 2 - call 11 + call 9 + ) + (func (;11;) (type 4) (param i32 i32 i32 i32) (result i32) + local.get 0 + local.get 1 + local.get 2 + local.get 3 + call 8 ) + (table (;0;) 2 2 funcref) (memory (;0;) 17) (global (;0;) (mut i32) i32.const 1048576) - (global (;1;) i32 i32.const 1049030) + (global (;1;) i32 i32.const 1049033) (global (;2;) i32 i32.const 1049040) (export "memory" (memory 0)) - (export "add-one" (func 1)) - (export "add-two" (func 3)) - (export "cabi_realloc" (func 10)) + (export "add-one" (func 0)) + (export "add-two" (func 1)) + (export "cabi_realloc_wit_bindgen_0_20_0" (func 8)) + (export "cabi_realloc" (func 11)) (export "__data_end" (global 1)) (export "__heap_base" (global 2)) + (elem (;0;) (i32.const 1) func 11) + (data (;0;) (i32.const 1048576) "\01\00\00\00") ) diff --git a/homestar-wasm/fixtures/example_add_cargo_component_wasi.wasm b/homestar-wasm/fixtures/example_add_cargo_component_wasi.wasm index 7faa17c4..b877f962 100755 Binary files a/homestar-wasm/fixtures/example_add_cargo_component_wasi.wasm and b/homestar-wasm/fixtures/example_add_cargo_component_wasi.wasm differ diff --git a/homestar-wasm/fixtures/example_add_cargo_component_wasi.wat b/homestar-wasm/fixtures/example_add_cargo_component_wasi.wat index 9cb88811..76c5062a 100644 --- a/homestar-wasm/fixtures/example_add_cargo_component_wasi.wat +++ b/homestar-wasm/fixtures/example_add_cargo_component_wasi.wat @@ -1,37 +1,23 @@ (component (core module (;0;) - (type (;0;) (func)) - (type (;1;) (func (param i32) (result i32))) - (type (;2;) (func (param i32 i32 i32 i32) (result i32))) - (type (;3;) (func (param i32))) - (type (;4;) (func (param i32 i32) (result i32))) - (type (;5;) (func (param i32 i32))) + (type (;0;) (func (param i32) (result i32))) + (type (;1;) (func (param i32 i32 i32 i32) (result i32))) + (type (;2;) (func (param i32))) + (type (;3;) (func (param i32 i32) (result i32))) + (type (;4;) (func (param i32 i32))) + (type (;5;) (func)) (type (;6;) (func (param i32 i32 i32) (result i32))) - (func (;0;) (type 0)) - (func (;1;) (type 1) (param i32) (result i32) - call 2 + (func (;0;) (type 0) (param i32) (result i32) local.get 0 i32.const 1 i32.add ) - (func (;2;) (type 0) - block ;; label = @1 - i32.const 0 - i32.load8_u offset=1048577 - br_if 0 (;@1;) - call 0 - i32.const 0 - i32.const 1 - i32.store8 offset=1048577 - end - ) - (func (;3;) (type 1) (param i32) (result i32) - call 2 + (func (;1;) (type 0) (param i32) (result i32) local.get 0 i32.const 2 i32.add ) - (func (;4;) (type 2) (param i32 i32 i32 i32) (result i32) + (func (;2;) (type 1) (param i32 i32 i32 i32) (result i32) (local i32) block ;; label = @1 block ;; label = @2 @@ -44,7 +30,7 @@ i32.eqz br_if 4 (;@1;) i32.const 0 - i32.load8_u offset=1048576 + i32.load8_u offset=1048580 drop block ;; label = @6 local.get 2 @@ -68,7 +54,7 @@ select local.get 3 i32.add - call 12 + call 10 local.set 2 br 2 (;@3;) end @@ -95,7 +81,7 @@ select local.get 3 i32.add - call 12 + call 10 local.tee 2 i32.eqz br_if 3 (;@2;) @@ -107,20 +93,20 @@ local.get 3 i32.lt_u select - call 15 + call 13 drop local.get 0 - call 7 + call 5 br 4 (;@1;) end local.get 0 local.get 3 - call 9 + call 7 local.set 2 br 1 (;@3;) end local.get 3 - call 5 + call 3 local.set 2 end local.get 2 @@ -131,11 +117,11 @@ end local.get 2 ) - (func (;5;) (type 1) (param i32) (result i32) + (func (;3;) (type 0) (param i32) (result i32) local.get 0 - call 6 + call 4 ) - (func (;6;) (type 1) (param i32) (result i32) + (func (;4;) (type 0) (param i32) (result i32) (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) global.get 0 i32.const 16 @@ -155,20 +141,20 @@ block ;; label = @11 block ;; label = @12 i32.const 0 - i32.load offset=1048604 + i32.load offset=1048608 local.tee 2 br_if 0 (;@12;) block ;; label = @13 i32.const 0 - i32.load offset=1049052 + i32.load offset=1049056 local.tee 3 br_if 0 (;@13;) i32.const 0 i64.const -1 - i64.store offset=1049064 align=4 + i64.store offset=1049068 align=4 i32.const 0 i64.const 281474976776192 - i64.store offset=1049056 align=4 + i64.store offset=1049060 align=4 i32.const 0 local.get 1 i32.const 8 @@ -178,13 +164,13 @@ i32.const 1431655768 i32.xor local.tee 3 - i32.store offset=1049052 + i32.store offset=1049056 i32.const 0 i32.const 0 - i32.store offset=1049072 + i32.store offset=1049076 i32.const 0 i32.const 0 - i32.store offset=1049024 + i32.store offset=1049028 end i32.const 1114112 i32.const 1049088 @@ -202,46 +188,46 @@ local.set 4 i32.const 0 i32.const 1049088 - i32.store offset=1049028 + i32.store offset=1049032 i32.const 0 i32.const 1049088 - i32.store offset=1048596 + i32.store offset=1048600 i32.const 0 local.get 3 - i32.store offset=1048616 + i32.store offset=1048620 i32.const 0 i32.const -1 - i32.store offset=1048612 + i32.store offset=1048616 i32.const 0 i32.const 1114112 i32.const 1049088 i32.sub - i32.store offset=1049032 + i32.store offset=1049036 loop ;; label = @13 local.get 4 - i32.const 1048640 + i32.const 1048644 i32.add local.get 4 - i32.const 1048628 + i32.const 1048632 i32.add local.tee 3 i32.store local.get 3 local.get 4 - i32.const 1048620 + i32.const 1048624 i32.add local.tee 5 i32.store local.get 4 - i32.const 1048632 + i32.const 1048636 i32.add local.get 5 i32.store local.get 4 - i32.const 1048648 + i32.const 1048652 i32.add local.get 4 - i32.const 1048636 + i32.const 1048640 i32.add local.tee 5 i32.store @@ -249,10 +235,10 @@ local.get 3 i32.store local.get 4 - i32.const 1048656 + i32.const 1048660 i32.add local.get 4 - i32.const 1048644 + i32.const 1048648 i32.add local.tee 3 i32.store @@ -260,7 +246,7 @@ local.get 5 i32.store local.get 4 - i32.const 1048652 + i32.const 1048656 i32.add local.get 3 i32.store @@ -304,14 +290,14 @@ i32.store i32.const 0 i32.const 0 - i32.load offset=1049068 - i32.store offset=1048608 + i32.load offset=1049072 + i32.store offset=1048612 i32.const 0 local.get 4 - i32.store offset=1048592 + i32.store offset=1048596 i32.const 0 local.get 2 - i32.store offset=1048604 + i32.store offset=1048608 local.get 3 i32.const 1049088 i32.add @@ -328,7 +314,7 @@ br_if 0 (;@13;) block ;; label = @14 i32.const 0 - i32.load offset=1048580 + i32.load offset=1048584 local.tee 6 i32.const 16 local.get 0 @@ -363,11 +349,11 @@ i32.const 3 i32.shl local.tee 3 - i32.const 1048620 + i32.const 1048624 i32.add local.tee 4 local.get 3 - i32.const 1048628 + i32.const 1048632 i32.add i32.load local.tee 3 @@ -381,7 +367,7 @@ local.get 5 i32.rotl i32.and - i32.store offset=1048580 + i32.store offset=1048584 br 1 (;@15;) end local.get 4 @@ -416,7 +402,7 @@ end local.get 7 i32.const 0 - i32.load offset=1048588 + i32.load offset=1048592 local.tee 8 i32.le_u br_if 1 (;@12;) @@ -448,11 +434,11 @@ i32.const 3 i32.shl local.tee 4 - i32.const 1048620 + i32.const 1048624 i32.add local.tee 5 local.get 4 - i32.const 1048628 + i32.const 1048632 i32.add i32.load local.tee 4 @@ -467,7 +453,7 @@ i32.rotl i32.and local.tee 6 - i32.store offset=1048580 + i32.store offset=1048584 br 1 (;@15;) end local.get 5 @@ -508,11 +494,11 @@ local.get 8 i32.const -8 i32.and - i32.const 1048620 + i32.const 1048624 i32.add local.set 7 i32.const 0 - i32.load offset=1048600 + i32.load offset=1048604 local.set 3 block ;; label = @16 block ;; label = @17 @@ -529,7 +515,7 @@ local.get 6 local.get 9 i32.or - i32.store offset=1048580 + i32.store offset=1048584 local.get 7 local.set 9 br 1 (;@16;) @@ -557,14 +543,14 @@ local.set 4 i32.const 0 local.get 0 - i32.store offset=1048600 + i32.store offset=1048604 i32.const 0 local.get 5 - i32.store offset=1048588 + i32.store offset=1048592 br 13 (;@1;) end i32.const 0 - i32.load offset=1048584 + i32.load offset=1048588 local.tee 10 i32.eqz br_if 1 (;@12;) @@ -576,7 +562,7 @@ i32.ctz i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add i32.load local.tee 0 @@ -641,7 +627,7 @@ i32.load offset=8 local.tee 4 i32.const 0 - i32.load offset=1048596 + i32.load offset=1048600 i32.lt_u drop local.get 9 @@ -709,7 +695,7 @@ i32.and local.set 7 i32.const 0 - i32.load offset=1048584 + i32.load offset=1048588 local.tee 10 i32.eqz br_if 0 (;@12;) @@ -756,7 +742,7 @@ local.get 8 i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add i32.load local.tee 5 @@ -870,7 +856,7 @@ i32.ctz i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add i32.load local.set 4 @@ -922,7 +908,7 @@ br_if 0 (;@12;) local.get 3 i32.const 0 - i32.load offset=1048588 + i32.load offset=1048592 local.get 7 i32.sub i32.ge_u @@ -941,7 +927,7 @@ i32.load offset=8 local.tee 4 i32.const 0 - i32.load offset=1048596 + i32.load offset=1048600 i32.lt_u drop local.get 0 @@ -997,13 +983,13 @@ end block ;; label = @12 i32.const 0 - i32.load offset=1048588 + i32.load offset=1048592 local.tee 4 local.get 7 i32.lt_u br_if 0 (;@12;) i32.const 0 - i32.load offset=1048600 + i32.load offset=1048604 local.set 3 block ;; label = @13 block ;; label = @14 @@ -1055,10 +1041,10 @@ end i32.const 0 local.get 5 - i32.store offset=1048588 + i32.store offset=1048592 i32.const 0 local.get 0 - i32.store offset=1048600 + i32.store offset=1048604 local.get 3 i32.const 8 i32.add @@ -1067,7 +1053,7 @@ end block ;; label = @12 i32.const 0 - i32.load offset=1048592 + i32.load offset=1048596 local.tee 5 local.get 7 i32.le_u @@ -1085,10 +1071,10 @@ i32.store offset=4 i32.const 0 local.get 4 - i32.store offset=1048604 + i32.store offset=1048608 i32.const 0 local.get 3 - i32.store offset=1048592 + i32.store offset=1048596 local.get 2 local.get 7 i32.const 3 @@ -1103,20 +1089,20 @@ block ;; label = @12 block ;; label = @13 i32.const 0 - i32.load offset=1049052 + i32.load offset=1049056 i32.eqz br_if 0 (;@13;) i32.const 0 - i32.load offset=1049060 + i32.load offset=1049064 local.set 3 br 1 (;@12;) end i32.const 0 i64.const -1 - i64.store offset=1049064 align=4 + i64.store offset=1049068 align=4 i32.const 0 i64.const 281474976776192 - i64.store offset=1049056 align=4 + i64.store offset=1049060 align=4 i32.const 0 local.get 1 i32.const 12 @@ -1125,13 +1111,13 @@ i32.and i32.const 1431655768 i32.xor - i32.store offset=1049052 + i32.store offset=1049056 i32.const 0 i32.const 0 - i32.store offset=1049072 + i32.store offset=1049076 i32.const 0 i32.const 0 - i32.store offset=1049024 + i32.store offset=1049028 i32.const 65536 local.set 3 end @@ -1156,18 +1142,18 @@ br_if 0 (;@12;) i32.const 0 i32.const 48 - i32.store offset=1049076 + i32.store offset=1049080 br 11 (;@1;) end block ;; label = @12 i32.const 0 - i32.load offset=1049020 + i32.load offset=1049024 local.tee 4 i32.eqz br_if 0 (;@12;) block ;; label = @13 i32.const 0 - i32.load offset=1049012 + i32.load offset=1049016 local.tee 3 local.get 9 i32.add @@ -1184,11 +1170,11 @@ local.set 4 i32.const 0 i32.const 48 - i32.store offset=1049076 + i32.store offset=1049080 br 11 (;@1;) end i32.const 0 - i32.load8_u offset=1049024 + i32.load8_u offset=1049028 i32.const 4 i32.and br_if 5 (;@6;) @@ -1198,7 +1184,7 @@ local.get 2 i32.eqz br_if 0 (;@14;) - i32.const 1049028 + i32.const 1049032 local.set 4 loop ;; label = @15 block ;; label = @16 @@ -1223,7 +1209,7 @@ end end i32.const 0 - call 14 + call 12 local.tee 0 i32.const -1 i32.eq @@ -1232,7 +1218,7 @@ local.set 6 block ;; label = @14 i32.const 0 - i32.load offset=1049056 + i32.load offset=1049060 local.tee 4 i32.const -1 i32.add @@ -1264,12 +1250,12 @@ br_if 6 (;@7;) block ;; label = @14 i32.const 0 - i32.load offset=1049020 + i32.load offset=1049024 local.tee 4 i32.eqz br_if 0 (;@14;) i32.const 0 - i32.load offset=1049012 + i32.load offset=1049016 local.tee 3 local.get 6 i32.add @@ -1283,7 +1269,7 @@ br_if 7 (;@7;) end local.get 6 - call 14 + call 12 local.tee 4 local.get 0 i32.ne @@ -1300,7 +1286,7 @@ i32.gt_u br_if 5 (;@7;) local.get 6 - call 14 + call 12 local.tee 0 local.get 4 i32.load @@ -1328,7 +1314,7 @@ local.get 6 i32.sub i32.const 0 - i32.load offset=1049060 + i32.load offset=1049064 local.tee 3 i32.add i32.const 0 @@ -1345,7 +1331,7 @@ end block ;; label = @13 local.get 3 - call 14 + call 12 i32.const -1 i32.eq br_if 0 (;@13;) @@ -1360,7 +1346,7 @@ i32.const 0 local.get 6 i32.sub - call 14 + call 12 drop br 5 (;@7;) end @@ -1390,20 +1376,20 @@ end i32.const 0 i32.const 0 - i32.load offset=1049024 + i32.load offset=1049028 i32.const 4 i32.or - i32.store offset=1049024 + i32.store offset=1049028 end local.get 9 i32.const 2147483646 i32.gt_u br_if 1 (;@4;) local.get 9 - call 14 + call 12 local.set 0 i32.const 0 - call 14 + call 12 local.set 4 local.get 0 i32.const -1 @@ -1429,31 +1415,31 @@ end i32.const 0 i32.const 0 - i32.load offset=1049012 + i32.load offset=1049016 local.get 6 i32.add local.tee 4 - i32.store offset=1049012 + i32.store offset=1049016 block ;; label = @5 local.get 4 i32.const 0 - i32.load offset=1049016 + i32.load offset=1049020 i32.le_u br_if 0 (;@5;) i32.const 0 local.get 4 - i32.store offset=1049016 + i32.store offset=1049020 end block ;; label = @5 block ;; label = @6 block ;; label = @7 block ;; label = @8 i32.const 0 - i32.load offset=1048604 + i32.load offset=1048608 local.tee 3 i32.eqz br_if 0 (;@8;) - i32.const 1049028 + i32.const 1049032 local.set 4 loop ;; label = @9 local.get 0 @@ -1476,7 +1462,7 @@ block ;; label = @8 block ;; label = @9 i32.const 0 - i32.load offset=1048596 + i32.load offset=1048600 local.tee 4 i32.eqz br_if 0 (;@9;) @@ -1487,51 +1473,51 @@ end i32.const 0 local.get 0 - i32.store offset=1048596 + i32.store offset=1048600 end i32.const 0 local.set 4 i32.const 0 local.get 6 - i32.store offset=1049032 + i32.store offset=1049036 i32.const 0 local.get 0 - i32.store offset=1049028 + i32.store offset=1049032 i32.const 0 i32.const -1 - i32.store offset=1048612 + i32.store offset=1048616 i32.const 0 i32.const 0 - i32.load offset=1049052 - i32.store offset=1048616 + i32.load offset=1049056 + i32.store offset=1048620 i32.const 0 i32.const 0 - i32.store offset=1049040 + i32.store offset=1049044 loop ;; label = @8 local.get 4 - i32.const 1048640 + i32.const 1048644 i32.add local.get 4 - i32.const 1048628 + i32.const 1048632 i32.add local.tee 3 i32.store local.get 3 local.get 4 - i32.const 1048620 + i32.const 1048624 i32.add local.tee 5 i32.store local.get 4 - i32.const 1048632 + i32.const 1048636 i32.add local.get 5 i32.store local.get 4 - i32.const 1048648 + i32.const 1048652 i32.add local.get 4 - i32.const 1048636 + i32.const 1048640 i32.add local.tee 5 i32.store @@ -1539,10 +1525,10 @@ local.get 3 i32.store local.get 4 - i32.const 1048656 + i32.const 1048660 i32.add local.get 4 - i32.const 1048644 + i32.const 1048648 i32.add local.tee 3 i32.store @@ -1550,7 +1536,7 @@ local.get 5 i32.store local.get 4 - i32.const 1048652 + i32.const 1048656 i32.add local.get 3 i32.store @@ -1590,14 +1576,14 @@ i32.store offset=4 i32.const 0 i32.const 0 - i32.load offset=1049068 - i32.store offset=1048608 + i32.load offset=1049072 + i32.store offset=1048612 i32.const 0 local.get 4 - i32.store offset=1048592 + i32.store offset=1048596 i32.const 0 local.get 3 - i32.store offset=1048604 + i32.store offset=1048608 local.get 0 local.get 5 i32.add @@ -1635,7 +1621,7 @@ i32.add local.tee 0 i32.const 0 - i32.load offset=1048592 + i32.load offset=1048596 local.get 6 i32.add local.tee 2 @@ -1652,14 +1638,14 @@ i32.store offset=4 i32.const 0 i32.const 0 - i32.load offset=1049068 - i32.store offset=1048608 + i32.load offset=1049072 + i32.store offset=1048612 i32.const 0 local.get 5 - i32.store offset=1048592 + i32.store offset=1048596 i32.const 0 local.get 0 - i32.store offset=1048604 + i32.store offset=1048608 local.get 3 local.get 2 i32.add @@ -1670,13 +1656,13 @@ block ;; label = @6 local.get 0 i32.const 0 - i32.load offset=1048596 + i32.load offset=1048600 local.tee 9 i32.ge_u br_if 0 (;@6;) i32.const 0 local.get 0 - i32.store offset=1048596 + i32.store offset=1048600 local.get 0 local.set 9 end @@ -1684,7 +1670,7 @@ local.get 6 i32.add local.set 5 - i32.const 1049028 + i32.const 1049032 local.set 4 block ;; label = @6 block ;; label = @7 @@ -1713,7 +1699,7 @@ i32.eqz br_if 1 (;@10;) end - i32.const 1049028 + i32.const 1049032 local.set 4 loop ;; label = @11 block ;; label = @12 @@ -1794,14 +1780,14 @@ br_if 0 (;@10;) i32.const 0 local.get 7 - i32.store offset=1048604 + i32.store offset=1048608 i32.const 0 i32.const 0 - i32.load offset=1048592 + i32.load offset=1048596 local.get 4 i32.add local.tee 4 - i32.store offset=1048592 + i32.store offset=1048596 local.get 7 local.get 4 i32.const 1 @@ -1812,19 +1798,19 @@ block ;; label = @10 local.get 6 i32.const 0 - i32.load offset=1048600 + i32.load offset=1048604 i32.ne br_if 0 (;@10;) i32.const 0 local.get 7 - i32.store offset=1048600 + i32.store offset=1048604 i32.const 0 i32.const 0 - i32.load offset=1048588 + i32.load offset=1048592 local.get 4 i32.add local.tee 4 - i32.store offset=1048588 + i32.store offset=1048592 local.get 7 local.get 4 i32.const 1 @@ -1865,7 +1851,7 @@ local.tee 9 i32.const 3 i32.shl - i32.const 1048620 + i32.const 1048624 i32.add local.tee 0 i32.eq @@ -1879,12 +1865,12 @@ br_if 0 (;@13;) i32.const 0 i32.const 0 - i32.load offset=1048580 + i32.load offset=1048584 i32.const -2 local.get 9 i32.rotl i32.and - i32.store offset=1048580 + i32.store offset=1048584 br 2 (;@11;) end local.get 3 @@ -1978,7 +1964,7 @@ local.tee 5 i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add local.tee 3 i32.load @@ -1991,12 +1977,12 @@ br_if 1 (;@12;) i32.const 0 i32.const 0 - i32.load offset=1048584 + i32.load offset=1048588 i32.const -2 local.get 5 i32.rotl i32.and - i32.store offset=1048584 + i32.store offset=1048588 br 2 (;@11;) end local.get 10 @@ -2078,13 +2064,13 @@ local.get 4 i32.const -8 i32.and - i32.const 1048620 + i32.const 1048624 i32.add local.set 3 block ;; label = @11 block ;; label = @12 i32.const 0 - i32.load offset=1048580 + i32.load offset=1048584 local.tee 5 i32.const 1 local.get 4 @@ -2098,7 +2084,7 @@ local.get 5 local.get 4 i32.or - i32.store offset=1048580 + i32.store offset=1048584 local.get 3 local.set 4 br 1 (;@11;) @@ -2156,12 +2142,12 @@ local.get 3 i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add local.set 5 block ;; label = @10 i32.const 0 - i32.load offset=1048584 + i32.load offset=1048588 local.tee 0 i32.const 1 local.get 3 @@ -2176,7 +2162,7 @@ local.get 0 local.get 9 i32.or - i32.store offset=1048584 + i32.store offset=1048588 local.get 7 local.get 5 i32.store offset=24 @@ -2307,38 +2293,38 @@ i32.store offset=4 i32.const 0 i32.const 0 - i32.load offset=1049068 - i32.store offset=1048608 + i32.load offset=1049072 + i32.store offset=1048612 i32.const 0 local.get 4 - i32.store offset=1048592 + i32.store offset=1048596 i32.const 0 local.get 2 - i32.store offset=1048604 + i32.store offset=1048608 local.get 9 i32.const 16 i32.add i32.const 0 - i64.load offset=1049036 align=4 + i64.load offset=1049040 align=4 i64.store align=4 local.get 9 i32.const 0 - i64.load offset=1049028 align=4 + i64.load offset=1049032 align=4 i64.store offset=8 align=4 i32.const 0 local.get 9 i32.const 8 i32.add - i32.store offset=1049036 + i32.store offset=1049040 i32.const 0 local.get 6 - i32.store offset=1049032 + i32.store offset=1049036 i32.const 0 local.get 0 - i32.store offset=1049028 + i32.store offset=1049032 i32.const 0 i32.const 0 - i32.store offset=1049040 + i32.store offset=1049044 local.get 9 i32.const 36 i32.add @@ -2384,13 +2370,13 @@ local.get 0 i32.const -8 i32.and - i32.const 1048620 + i32.const 1048624 i32.add local.set 4 block ;; label = @10 block ;; label = @11 i32.const 0 - i32.load offset=1048580 + i32.load offset=1048584 local.tee 5 i32.const 1 local.get 0 @@ -2404,7 +2390,7 @@ local.get 5 local.get 0 i32.or - i32.store offset=1048580 + i32.store offset=1048584 local.get 4 local.set 5 br 1 (;@10;) @@ -2462,12 +2448,12 @@ local.get 4 i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add local.set 5 block ;; label = @9 i32.const 0 - i32.load offset=1048584 + i32.load offset=1048588 local.tee 9 i32.const 1 local.get 4 @@ -2482,7 +2468,7 @@ local.get 9 local.get 6 i32.or - i32.store offset=1048584 + i32.store offset=1048588 local.get 3 local.get 5 i32.store offset=24 @@ -2596,13 +2582,13 @@ i32.store offset=8 end i32.const 0 - i32.load offset=1048592 + i32.load offset=1048596 local.tee 4 local.get 7 i32.le_u br_if 0 (;@4;) i32.const 0 - i32.load offset=1048604 + i32.load offset=1048608 local.tee 3 local.get 7 i32.add @@ -2616,10 +2602,10 @@ i32.store offset=4 i32.const 0 local.get 4 - i32.store offset=1048592 + i32.store offset=1048596 i32.const 0 local.get 5 - i32.store offset=1048604 + i32.store offset=1048608 local.get 3 local.get 7 i32.const 3 @@ -2635,7 +2621,7 @@ local.set 4 i32.const 0 i32.const 48 - i32.store offset=1049076 + i32.store offset=1049080 br 2 (;@1;) end block ;; label = @3 @@ -2650,7 +2636,7 @@ local.tee 5 i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add local.tee 4 i32.load @@ -2668,7 +2654,7 @@ i32.rotl i32.and local.tee 10 - i32.store offset=1048584 + i32.store offset=1048588 br 2 (;@3;) end local.get 2 @@ -2769,13 +2755,13 @@ local.get 3 i32.const -8 i32.and - i32.const 1048620 + i32.const 1048624 i32.add local.set 4 block ;; label = @5 block ;; label = @6 i32.const 0 - i32.load offset=1048580 + i32.load offset=1048584 local.tee 5 i32.const 1 local.get 3 @@ -2789,7 +2775,7 @@ local.get 5 local.get 3 i32.or - i32.store offset=1048580 + i32.store offset=1048584 local.get 4 local.set 3 br 1 (;@5;) @@ -2847,7 +2833,7 @@ local.get 4 i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add local.set 5 block ;; label = @4 @@ -2865,7 +2851,7 @@ local.get 10 local.get 7 i32.or - i32.store offset=1048584 + i32.store offset=1048588 local.get 0 local.get 5 i32.store offset=24 @@ -2973,7 +2959,7 @@ local.tee 5 i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add local.tee 4 i32.load @@ -2990,7 +2976,7 @@ local.get 5 i32.rotl i32.and - i32.store offset=1048584 + i32.store offset=1048588 br 2 (;@2;) end local.get 11 @@ -3090,11 +3076,11 @@ local.get 8 i32.const -8 i32.and - i32.const 1048620 + i32.const 1048624 i32.add local.set 7 i32.const 0 - i32.load offset=1048600 + i32.load offset=1048604 local.set 4 block ;; label = @4 block ;; label = @5 @@ -3111,7 +3097,7 @@ local.get 9 local.get 6 i32.or - i32.store offset=1048580 + i32.store offset=1048584 local.get 7 local.set 9 br 1 (;@4;) @@ -3135,10 +3121,10 @@ end i32.const 0 local.get 5 - i32.store offset=1048600 + i32.store offset=1048604 i32.const 0 local.get 3 - i32.store offset=1048588 + i32.store offset=1048592 end local.get 0 i32.const 8 @@ -3151,11 +3137,11 @@ global.set 0 local.get 4 ) - (func (;7;) (type 3) (param i32) + (func (;5;) (type 2) (param i32) local.get 0 - call 8 + call 6 ) - (func (;8;) (type 3) (param i32) + (func (;6;) (type 2) (param i32) (local i32 i32 i32 i32 i32 i32 i32) block ;; label = @1 local.get 0 @@ -3192,7 +3178,7 @@ i32.sub local.tee 1 i32.const 0 - i32.load offset=1048596 + i32.load offset=1048600 local.tee 4 i32.lt_u br_if 1 (;@1;) @@ -3203,7 +3189,7 @@ block ;; label = @3 local.get 1 i32.const 0 - i32.load offset=1048600 + i32.load offset=1048604 i32.eq br_if 0 (;@3;) block ;; label = @4 @@ -3220,7 +3206,7 @@ local.tee 5 i32.const 3 i32.shl - i32.const 1048620 + i32.const 1048624 i32.add local.tee 6 i32.eq @@ -3234,12 +3220,12 @@ br_if 0 (;@5;) i32.const 0 i32.const 0 - i32.load offset=1048580 + i32.load offset=1048584 i32.const -2 local.get 5 i32.rotl i32.and - i32.store offset=1048580 + i32.store offset=1048584 br 3 (;@2;) end local.get 2 @@ -3333,7 +3319,7 @@ local.tee 4 i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add local.tee 2 i32.load @@ -3346,12 +3332,12 @@ br_if 1 (;@4;) i32.const 0 i32.const 0 - i32.load offset=1048584 + i32.load offset=1048588 i32.const -2 local.get 4 i32.rotl i32.and - i32.store offset=1048584 + i32.store offset=1048588 br 3 (;@2;) end local.get 7 @@ -3415,7 +3401,7 @@ i32.store offset=4 i32.const 0 local.get 0 - i32.store offset=1048588 + i32.store offset=1048592 local.get 1 local.get 0 i32.add @@ -3448,19 +3434,19 @@ block ;; label = @4 local.get 3 i32.const 0 - i32.load offset=1048604 + i32.load offset=1048608 i32.ne br_if 0 (;@4;) i32.const 0 local.get 1 - i32.store offset=1048604 + i32.store offset=1048608 i32.const 0 i32.const 0 - i32.load offset=1048592 + i32.load offset=1048596 local.get 0 i32.add local.tee 0 - i32.store offset=1048592 + i32.store offset=1048596 local.get 1 local.get 0 i32.const 1 @@ -3468,33 +3454,33 @@ i32.store offset=4 local.get 1 i32.const 0 - i32.load offset=1048600 + i32.load offset=1048604 i32.ne br_if 3 (;@1;) i32.const 0 i32.const 0 - i32.store offset=1048588 + i32.store offset=1048592 i32.const 0 i32.const 0 - i32.store offset=1048600 + i32.store offset=1048604 return end block ;; label = @4 local.get 3 i32.const 0 - i32.load offset=1048600 + i32.load offset=1048604 i32.ne br_if 0 (;@4;) i32.const 0 local.get 1 - i32.store offset=1048600 + i32.store offset=1048604 i32.const 0 i32.const 0 - i32.load offset=1048588 + i32.load offset=1048592 local.get 0 i32.add local.tee 0 - i32.store offset=1048588 + i32.store offset=1048592 local.get 1 local.get 0 i32.const 1 @@ -3528,7 +3514,7 @@ local.tee 5 i32.const 3 i32.shl - i32.const 1048620 + i32.const 1048624 i32.add local.tee 6 i32.eq @@ -3542,12 +3528,12 @@ br_if 0 (;@6;) i32.const 0 i32.const 0 - i32.load offset=1048580 + i32.load offset=1048584 i32.const -2 local.get 5 i32.rotl i32.and - i32.store offset=1048580 + i32.store offset=1048584 br 2 (;@4;) end local.get 2 @@ -3577,7 +3563,7 @@ i32.load offset=8 local.tee 2 i32.const 0 - i32.load offset=1048596 + i32.load offset=1048600 i32.lt_u drop local.get 6 @@ -3642,7 +3628,7 @@ local.tee 4 i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add local.tee 2 i32.load @@ -3655,12 +3641,12 @@ br_if 1 (;@5;) i32.const 0 i32.const 0 - i32.load offset=1048584 + i32.load offset=1048588 i32.const -2 local.get 4 i32.rotl i32.and - i32.store offset=1048584 + i32.store offset=1048588 br 2 (;@4;) end local.get 7 @@ -3720,12 +3706,12 @@ i32.store offset=4 local.get 1 i32.const 0 - i32.load offset=1048600 + i32.load offset=1048604 i32.ne br_if 1 (;@2;) i32.const 0 local.get 0 - i32.store offset=1048588 + i32.store offset=1048592 return end local.get 3 @@ -3752,13 +3738,13 @@ local.get 0 i32.const -8 i32.and - i32.const 1048620 + i32.const 1048624 i32.add local.set 2 block ;; label = @3 block ;; label = @4 i32.const 0 - i32.load offset=1048580 + i32.load offset=1048584 local.tee 4 i32.const 1 local.get 0 @@ -3772,7 +3758,7 @@ local.get 4 local.get 0 i32.or - i32.store offset=1048580 + i32.store offset=1048584 local.get 2 local.set 0 br 1 (;@3;) @@ -3830,13 +3816,13 @@ local.get 2 i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add local.set 4 block ;; label = @2 block ;; label = @3 i32.const 0 - i32.load offset=1048584 + i32.load offset=1048588 local.tee 6 i32.const 1 local.get 2 @@ -3851,7 +3837,7 @@ local.get 6 local.get 3 i32.or - i32.store offset=1048584 + i32.store offset=1048588 local.get 1 local.get 4 i32.store offset=24 @@ -3943,23 +3929,23 @@ end i32.const 0 i32.const 0 - i32.load offset=1048612 + i32.load offset=1048616 i32.const -1 i32.add local.tee 1 i32.const -1 local.get 1 select - i32.store offset=1048612 + i32.store offset=1048616 end ) - (func (;9;) (type 4) (param i32 i32) (result i32) + (func (;7;) (type 3) (param i32 i32) (result i32) (local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) block ;; label = @1 local.get 0 br_if 0 (;@1;) local.get 1 - call 6 + call 4 return end block ;; label = @1 @@ -3969,7 +3955,7 @@ br_if 0 (;@1;) i32.const 0 i32.const 48 - i32.store offset=1049076 + i32.store offset=1049080 i32.const 0 return end @@ -4014,7 +4000,7 @@ local.get 2 i32.sub i32.const 0 - i32.load offset=1049060 + i32.load offset=1049064 i32.const 1 i32.shl i32.le_u @@ -4065,18 +4051,18 @@ i32.store offset=4 local.get 2 local.get 1 - call 10 + call 8 local.get 0 return end block ;; label = @3 local.get 7 i32.const 0 - i32.load offset=1048604 + i32.load offset=1048608 i32.ne br_if 0 (;@3;) i32.const 0 - i32.load offset=1048592 + i32.load offset=1048596 local.get 5 i32.add local.tee 5 @@ -4097,13 +4083,13 @@ local.get 2 i32.add local.tee 1 - i32.store offset=1048604 + i32.store offset=1048608 i32.const 0 local.get 5 local.get 2 i32.sub local.tee 2 - i32.store offset=1048592 + i32.store offset=1048596 local.get 1 local.get 2 i32.const 1 @@ -4115,11 +4101,11 @@ block ;; label = @3 local.get 7 i32.const 0 - i32.load offset=1048600 + i32.load offset=1048604 i32.ne br_if 0 (;@3;) i32.const 0 - i32.load offset=1048588 + i32.load offset=1048592 local.get 5 i32.add local.tee 5 @@ -4191,10 +4177,10 @@ end i32.const 0 local.get 2 - i32.store offset=1048600 + i32.store offset=1048604 i32.const 0 local.get 1 - i32.store offset=1048588 + i32.store offset=1048592 local.get 0 return end @@ -4232,7 +4218,7 @@ local.tee 11 i32.const 3 i32.shl - i32.const 1048620 + i32.const 1048624 i32.add local.tee 8 i32.eq @@ -4246,12 +4232,12 @@ br_if 0 (;@5;) i32.const 0 i32.const 0 - i32.load offset=1048580 + i32.load offset=1048584 i32.const -2 local.get 11 i32.rotl i32.and - i32.store offset=1048580 + i32.store offset=1048584 br 2 (;@3;) end local.get 5 @@ -4281,7 +4267,7 @@ i32.load offset=8 local.tee 1 i32.const 0 - i32.load offset=1048596 + i32.load offset=1048600 i32.lt_u drop local.get 8 @@ -4346,7 +4332,7 @@ local.tee 5 i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add local.tee 1 i32.load @@ -4359,12 +4345,12 @@ br_if 1 (;@4;) i32.const 0 i32.const 0 - i32.load offset=1048584 + i32.load offset=1048588 i32.const -2 local.get 5 i32.rotl i32.and - i32.store offset=1048584 + i32.store offset=1048588 br 2 (;@3;) end local.get 12 @@ -4466,13 +4452,13 @@ i32.store offset=4 local.get 1 local.get 10 - call 10 + call 8 local.get 0 return end block ;; label = @2 local.get 1 - call 6 + call 4 local.tee 2 br_if 0 (;@2;) i32.const 0 @@ -4498,16 +4484,16 @@ local.get 1 i32.lt_u select - call 15 + call 13 local.set 1 local.get 0 - call 8 + call 6 local.get 1 local.set 0 end local.get 0 ) - (func (;10;) (type 5) (param i32 i32) + (func (;8;) (type 4) (param i32 i32) (local i32 i32 i32 i32 i32 i32) local.get 0 local.get 1 @@ -4539,7 +4525,7 @@ i32.sub local.tee 0 i32.const 0 - i32.load offset=1048600 + i32.load offset=1048604 i32.eq br_if 0 (;@4;) block ;; label = @5 @@ -4556,7 +4542,7 @@ local.tee 5 i32.const 3 i32.shl - i32.const 1048620 + i32.const 1048624 i32.add local.tee 6 i32.eq @@ -4569,12 +4555,12 @@ br_if 2 (;@3;) i32.const 0 i32.const 0 - i32.load offset=1048580 + i32.load offset=1048584 i32.const -2 local.get 5 i32.rotl i32.and - i32.store offset=1048580 + i32.store offset=1048584 br 3 (;@2;) end local.get 0 @@ -4592,7 +4578,7 @@ i32.load offset=8 local.tee 3 i32.const 0 - i32.load offset=1048596 + i32.load offset=1048600 i32.lt_u drop local.get 6 @@ -4657,7 +4643,7 @@ local.tee 4 i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add local.tee 3 i32.load @@ -4670,12 +4656,12 @@ br_if 1 (;@5;) i32.const 0 i32.const 0 - i32.load offset=1048584 + i32.load offset=1048588 i32.const -2 local.get 4 i32.rotl i32.and - i32.store offset=1048584 + i32.store offset=1048588 br 4 (;@2;) end local.get 7 @@ -4739,7 +4725,7 @@ i32.store offset=4 i32.const 0 local.get 1 - i32.store offset=1048588 + i32.store offset=1048592 local.get 2 local.get 1 i32.store @@ -4772,19 +4758,19 @@ block ;; label = @4 local.get 2 i32.const 0 - i32.load offset=1048604 + i32.load offset=1048608 i32.ne br_if 0 (;@4;) i32.const 0 local.get 0 - i32.store offset=1048604 + i32.store offset=1048608 i32.const 0 i32.const 0 - i32.load offset=1048592 + i32.load offset=1048596 local.get 1 i32.add local.tee 1 - i32.store offset=1048592 + i32.store offset=1048596 local.get 0 local.get 1 i32.const 1 @@ -4792,33 +4778,33 @@ i32.store offset=4 local.get 0 i32.const 0 - i32.load offset=1048600 + i32.load offset=1048604 i32.ne br_if 3 (;@1;) i32.const 0 i32.const 0 - i32.store offset=1048588 + i32.store offset=1048592 i32.const 0 i32.const 0 - i32.store offset=1048600 + i32.store offset=1048604 return end block ;; label = @4 local.get 2 i32.const 0 - i32.load offset=1048600 + i32.load offset=1048604 i32.ne br_if 0 (;@4;) i32.const 0 local.get 0 - i32.store offset=1048600 + i32.store offset=1048604 i32.const 0 i32.const 0 - i32.load offset=1048588 + i32.load offset=1048592 local.get 1 i32.add local.tee 1 - i32.store offset=1048588 + i32.store offset=1048592 local.get 0 local.get 1 i32.const 1 @@ -4852,7 +4838,7 @@ local.tee 5 i32.const 3 i32.shl - i32.const 1048620 + i32.const 1048624 i32.add local.tee 6 i32.eq @@ -4866,12 +4852,12 @@ br_if 0 (;@6;) i32.const 0 i32.const 0 - i32.load offset=1048580 + i32.load offset=1048584 i32.const -2 local.get 5 i32.rotl i32.and - i32.store offset=1048580 + i32.store offset=1048584 br 2 (;@4;) end local.get 3 @@ -4901,7 +4887,7 @@ i32.load offset=8 local.tee 3 i32.const 0 - i32.load offset=1048596 + i32.load offset=1048600 i32.lt_u drop local.get 6 @@ -4966,7 +4952,7 @@ local.tee 4 i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add local.tee 3 i32.load @@ -4979,12 +4965,12 @@ br_if 1 (;@5;) i32.const 0 i32.const 0 - i32.load offset=1048584 + i32.load offset=1048588 i32.const -2 local.get 4 i32.rotl i32.and - i32.store offset=1048584 + i32.store offset=1048588 br 2 (;@4;) end local.get 7 @@ -5044,12 +5030,12 @@ i32.store offset=4 local.get 0 i32.const 0 - i32.load offset=1048600 + i32.load offset=1048604 i32.ne br_if 1 (;@2;) i32.const 0 local.get 1 - i32.store offset=1048588 + i32.store offset=1048592 return end local.get 2 @@ -5076,13 +5062,13 @@ local.get 1 i32.const -8 i32.and - i32.const 1048620 + i32.const 1048624 i32.add local.set 3 block ;; label = @3 block ;; label = @4 i32.const 0 - i32.load offset=1048580 + i32.load offset=1048584 local.tee 4 i32.const 1 local.get 1 @@ -5096,7 +5082,7 @@ local.get 4 local.get 1 i32.or - i32.store offset=1048580 + i32.store offset=1048584 local.get 3 local.set 1 br 1 (;@3;) @@ -5154,12 +5140,12 @@ local.get 3 i32.const 2 i32.shl - i32.const 1048884 + i32.const 1048888 i32.add local.set 4 block ;; label = @2 i32.const 0 - i32.load offset=1048584 + i32.load offset=1048588 local.tee 6 i32.const 1 local.get 3 @@ -5174,7 +5160,7 @@ local.get 6 local.get 2 i32.or - i32.store offset=1048584 + i32.store offset=1048588 local.get 0 local.get 4 i32.store offset=24 @@ -5265,7 +5251,7 @@ i32.store offset=8 end ) - (func (;11;) (type 4) (param i32 i32) (result i32) + (func (;9;) (type 3) (param i32 i32) (result i32) (local i32 i32 i32 i32 i32) block ;; label = @1 block ;; label = @2 @@ -5308,7 +5294,7 @@ br_if 0 (;@1;) i32.const 0 i32.const 48 - i32.store offset=1049076 + i32.store offset=1049080 i32.const 0 return end @@ -5328,7 +5314,7 @@ i32.add i32.const 12 i32.add - call 6 + call 4 local.tee 3 br_if 0 (;@1;) i32.const 0 @@ -5441,7 +5427,7 @@ i32.store offset=4 local.get 2 local.get 3 - call 10 + call 8 end block ;; label = @1 local.get 0 @@ -5491,31 +5477,31 @@ i32.store offset=4 local.get 3 local.get 1 - call 10 + call 8 end local.get 0 i32.const 8 i32.add ) - (func (;12;) (type 4) (param i32 i32) (result i32) + (func (;10;) (type 3) (param i32 i32) (result i32) block ;; label = @1 local.get 0 i32.const 16 i32.gt_u br_if 0 (;@1;) local.get 1 - call 6 + call 4 return end local.get 0 local.get 1 - call 11 + call 9 ) - (func (;13;) (type 0) + (func (;11;) (type 5) unreachable unreachable ) - (func (;14;) (type 1) (param i32) (result i32) + (func (;12;) (type 0) (param i32) (result i32) block ;; label = @1 local.get 0 br_if 0 (;@1;) @@ -5544,7 +5530,7 @@ br_if 0 (;@2;) i32.const 0 i32.const 48 - i32.store offset=1049076 + i32.store offset=1049080 i32.const -1 return end @@ -5553,10 +5539,10 @@ i32.shl return end - call 13 + call 11 unreachable ) - (func (;15;) (type 6) (param i32 i32 i32) (result i32) + (func (;13;) (type 6) (param i32 i32 i32) (result i32) (local i32 i32 i32 i32) block ;; label = @1 block ;; label = @2 @@ -6073,16 +6059,57 @@ end local.get 0 ) - (table (;0;) 1 1 funcref) + (func (;14;) (type 1) (param i32 i32 i32 i32) (result i32) + local.get 0 + local.get 1 + local.get 2 + local.get 3 + call 2 + ) + (func (;15;) (type 5)) + (func (;16;) (type 5) + call 15 + call 15 + ) + (func (;17;) (type 0) (param i32) (result i32) + local.get 0 + call 0 + call 16 + ) + (func (;18;) (type 0) (param i32) (result i32) + local.get 0 + call 1 + call 16 + ) + (func (;19;) (type 1) (param i32 i32 i32 i32) (result i32) + local.get 0 + local.get 1 + local.get 2 + local.get 3 + call 2 + call 16 + ) + (func (;20;) (type 1) (param i32 i32 i32 i32) (result i32) + local.get 0 + local.get 1 + local.get 2 + local.get 3 + call 14 + call 16 + ) + (table (;0;) 2 2 funcref) (memory (;0;) 17) (global (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) - (export "add-one" (func 1)) - (export "add-two" (func 3)) - (export "cabi_realloc" (func 4)) + (export "add-one" (func 17)) + (export "add-two" (func 18)) + (export "cabi_realloc_wit_bindgen_0_20_0" (func 19)) + (export "cabi_realloc" (func 20)) + (elem (;0;) (i32.const 1) func 14) + (data (;0;) (i32.const 1048576) "\01\00\00\00") (@producers - (processed-by "wit-component" "0.18.2") - (processed-by "wit-bindgen-rust" "0.16.0") + (processed-by "wit-component" "0.201.0") + (processed-by "wit-bindgen-rust" "0.20.0") ) ) (core instance (;0;) (instantiate 0)) @@ -6096,7 +6123,7 @@ (func (;2;) (type 0) (canon lift (core func 2))) (export (;3;) "add-two" (func 2)) (@producers - (processed-by "wit-component" "0.20.0") - (processed-by "cargo-component" "0.7.0 (wasi:ab5a448)") + (processed-by "wit-component" "0.201.0") + (processed-by "cargo-component" "0.9.0 (wasi:ab5a448)") ) ) diff --git a/homestar-wasm/fixtures/example_add_component.wasm b/homestar-wasm/fixtures/example_add_component.wasm index 5882a32c..c72d0231 100644 Binary files a/homestar-wasm/fixtures/example_add_component.wasm and b/homestar-wasm/fixtures/example_add_component.wasm differ diff --git a/homestar-wasm/fixtures/example_add_component.wat b/homestar-wasm/fixtures/example_add_component.wat index 7fbd897c..92376f13 100644 --- a/homestar-wasm/fixtures/example_add_component.wat +++ b/homestar-wasm/fixtures/example_add_component.wat @@ -1,37 +1,22 @@ (component (core module (;0;) - (type (;0;) (func)) - (type (;1;) (func (param i32) (result i32))) - (type (;2;) (func (param i32 i32) (result i32))) - (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32))) - (type (;5;) (func (param i32 i32 i32 i32) (result i32))) - (type (;6;) (func (param i32 i32 i32) (result i32))) - (func (;0;) (type 0)) - (func (;1;) (type 1) (param i32) (result i32) - call 2 + (type (;0;) (func (param i32) (result i32))) + (type (;1;) (func (param i32 i32) (result i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32))) + (type (;4;) (func (param i32 i32 i32 i32) (result i32))) + (type (;5;) (func (param i32 i32 i32) (result i32))) + (func (;0;) (type 0) (param i32) (result i32) local.get 0 i32.const 1 i32.add ) - (func (;2;) (type 0) - block ;; label = @1 - i32.const 0 - i32.load8_u offset=1049029 - br_if 0 (;@1;) - call 0 - i32.const 0 - i32.const 1 - i32.store8 offset=1049029 - end - ) - (func (;3;) (type 1) (param i32) (result i32) - call 2 + (func (;1;) (type 0) (param i32) (result i32) local.get 0 i32.const 2 i32.add ) - (func (;4;) (type 2) (param i32 i32) (result i32) + (func (;2;) (type 1) (param i32 i32) (result i32) (local i32 i32 i32 i32 i32) i32.const 0 local.set 2 @@ -63,7 +48,7 @@ i32.add i32.const 12 i32.add - call 5 + call 3 local.tee 1 i32.eqz br_if 0 (;@1;) @@ -163,7 +148,7 @@ i32.store offset=4 local.get 2 local.get 1 - call 6 + call 4 br 1 (;@2;) end local.get 2 @@ -226,7 +211,7 @@ i32.store offset=4 local.get 1 local.get 3 - call 6 + call 4 end local.get 0 i32.const 8 @@ -235,7 +220,7 @@ end local.get 2 ) - (func (;5;) (type 1) (param i32) (result i32) + (func (;3;) (type 0) (param i32) (result i32) (local i32 i32 i32 i32 i32 i32 i32 i32 i64) block ;; label = @1 block ;; label = @2 @@ -263,7 +248,7 @@ i32.and local.set 2 i32.const 0 - i32.load offset=1048988 + i32.load offset=1048992 local.tee 3 i32.eqz br_if 4 (;@4;) @@ -307,7 +292,7 @@ local.get 4 i32.const 2 i32.shl - i32.const 1048576 + i32.const 1048580 i32.add i32.load local.tee 5 @@ -402,7 +387,7 @@ end block ;; label = @8 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 6 i32.const 16 local.get 0 @@ -437,11 +422,11 @@ i32.const 3 i32.shl local.tee 0 - i32.const 1048720 + i32.const 1048724 i32.add local.tee 1 local.get 0 - i32.const 1048728 + i32.const 1048732 i32.add i32.load local.tee 0 @@ -463,7 +448,7 @@ local.get 2 i32.rotl i32.and - i32.store offset=1048984 + i32.store offset=1048988 end local.get 0 local.get 2 @@ -489,7 +474,7 @@ end local.get 2 i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 i32.le_u br_if 3 (;@4;) block ;; label = @8 @@ -498,7 +483,7 @@ local.get 0 br_if 0 (;@10;) i32.const 0 - i32.load offset=1048988 + i32.load offset=1048992 local.tee 0 i32.eqz br_if 6 (;@4;) @@ -506,7 +491,7 @@ i32.ctz i32.const 2 i32.shl - i32.const 1048576 + i32.const 1048580 i32.add i32.load local.tee 5 @@ -615,7 +600,7 @@ i32.load offset=28 i32.const 2 i32.shl - i32.const 1048576 + i32.const 1048580 i32.add local.tee 5 i32.load @@ -645,13 +630,13 @@ br_if 3 (;@9;) i32.const 0 i32.const 0 - i32.load offset=1048988 + i32.load offset=1048992 i32.const -2 local.get 6 i32.load offset=28 i32.rotl i32.and - i32.store offset=1048988 + i32.store offset=1048992 br 4 (;@8;) end local.get 0 @@ -697,11 +682,11 @@ i32.const 3 i32.shl local.tee 0 - i32.const 1048720 + i32.const 1048724 i32.add local.tee 5 local.get 0 - i32.const 1048728 + i32.const 1048732 i32.add i32.load local.tee 0 @@ -723,7 +708,7 @@ local.get 1 i32.rotl i32.and - i32.store offset=1048984 + i32.store offset=1048988 end local.get 0 local.get 2 @@ -751,23 +736,23 @@ i32.store block ;; label = @10 i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 local.tee 6 i32.eqz br_if 0 (;@10;) local.get 6 i32.const -8 i32.and - i32.const 1048720 + i32.const 1048724 i32.add local.set 5 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 local.set 2 block ;; label = @11 block ;; label = @12 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 8 i32.const 1 local.get 6 @@ -781,7 +766,7 @@ local.get 8 local.get 6 i32.or - i32.store offset=1048984 + i32.store offset=1048988 local.get 5 local.set 6 br 1 (;@11;) @@ -805,10 +790,10 @@ end i32.const 0 local.get 7 - i32.store offset=1049000 + i32.store offset=1049004 i32.const 0 local.get 1 - i32.store offset=1048992 + i32.store offset=1048996 local.get 0 i32.const 8 i32.add @@ -872,23 +857,23 @@ local.get 1 i32.store i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 local.tee 7 i32.eqz br_if 1 (;@9;) local.get 7 i32.const -8 i32.and - i32.const 1048720 + i32.const 1048724 i32.add local.set 5 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 local.set 0 block ;; label = @11 block ;; label = @12 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 8 i32.const 1 local.get 7 @@ -902,7 +887,7 @@ local.get 8 local.get 7 i32.or - i32.store offset=1048984 + i32.store offset=1048988 local.get 5 local.set 7 br 1 (;@11;) @@ -946,10 +931,10 @@ end i32.const 0 local.get 2 - i32.store offset=1049000 + i32.store offset=1049004 i32.const 0 local.get 1 - i32.store offset=1048992 + i32.store offset=1048996 end local.get 6 i32.const 8 @@ -980,7 +965,7 @@ i32.ctz i32.const 2 i32.shl - i32.const 1048576 + i32.const 1048580 i32.add i32.load local.set 0 @@ -1046,7 +1031,7 @@ br_if 0 (;@4;) block ;; label = @5 i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 local.tee 0 local.get 2 i32.lt_u @@ -1143,7 +1128,7 @@ i32.load offset=28 i32.const 2 i32.shl - i32.const 1048576 + i32.const 1048580 i32.add local.tee 5 i32.load @@ -1173,13 +1158,13 @@ br_if 2 (;@2;) i32.const 0 i32.const 0 - i32.load offset=1048988 + i32.load offset=1048992 i32.const -2 local.get 6 i32.load offset=28 i32.rotl i32.and - i32.store offset=1048988 + i32.store offset=1048992 br 3 (;@1;) end block ;; label = @4 @@ -1189,14 +1174,14 @@ block ;; label = @8 block ;; label = @9 i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 local.tee 0 local.get 2 i32.ge_u br_if 0 (;@9;) block ;; label = @10 i32.const 0 - i32.load offset=1048996 + i32.load offset=1049000 local.tee 0 local.get 2 i32.gt_u @@ -1223,7 +1208,7 @@ br_if 7 (;@3;) i32.const 0 i32.const 0 - i32.load offset=1049008 + i32.load offset=1049012 i32.const 0 local.get 5 i32.const -65536 @@ -1233,26 +1218,26 @@ local.tee 8 i32.add local.tee 0 - i32.store offset=1049008 + i32.store offset=1049012 i32.const 0 i32.const 0 - i32.load offset=1049012 + i32.load offset=1049016 local.tee 1 local.get 0 local.get 1 local.get 0 i32.gt_u select - i32.store offset=1049012 + i32.store offset=1049016 block ;; label = @11 block ;; label = @12 block ;; label = @13 i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 local.tee 1 i32.eqz br_if 0 (;@13;) - i32.const 1048704 + i32.const 1048708 local.set 0 loop ;; label = @14 local.get 0 @@ -1275,7 +1260,7 @@ block ;; label = @13 block ;; label = @14 i32.const 0 - i32.load offset=1049020 + i32.load offset=1049024 local.tee 0 i32.eqz br_if 0 (;@14;) @@ -1286,221 +1271,221 @@ end i32.const 0 local.get 6 - i32.store offset=1049020 + i32.store offset=1049024 end i32.const 0 i32.const 4095 - i32.store offset=1049024 + i32.store offset=1049028 i32.const 0 local.get 8 - i32.store offset=1048708 + i32.store offset=1048712 i32.const 0 local.get 6 - i32.store offset=1048704 + i32.store offset=1048708 + i32.const 0 + i32.const 1048724 + i32.store offset=1048736 + i32.const 0 + i32.const 1048732 + i32.store offset=1048744 i32.const 0 - i32.const 1048720 + i32.const 1048724 i32.store offset=1048732 i32.const 0 - i32.const 1048728 + i32.const 1048740 + i32.store offset=1048752 + i32.const 0 + i32.const 1048732 i32.store offset=1048740 i32.const 0 - i32.const 1048720 - i32.store offset=1048728 + i32.const 1048748 + i32.store offset=1048760 i32.const 0 - i32.const 1048736 + i32.const 1048740 i32.store offset=1048748 i32.const 0 - i32.const 1048728 - i32.store offset=1048736 + i32.const 1048756 + i32.store offset=1048768 i32.const 0 - i32.const 1048744 + i32.const 1048748 i32.store offset=1048756 i32.const 0 - i32.const 1048736 - i32.store offset=1048744 + i32.const 1048764 + i32.store offset=1048776 i32.const 0 - i32.const 1048752 + i32.const 1048756 i32.store offset=1048764 i32.const 0 - i32.const 1048744 - i32.store offset=1048752 + i32.const 1048772 + i32.store offset=1048784 i32.const 0 - i32.const 1048760 + i32.const 1048764 i32.store offset=1048772 i32.const 0 - i32.const 1048752 - i32.store offset=1048760 + i32.const 1048780 + i32.store offset=1048792 i32.const 0 - i32.const 1048768 + i32.const 1048772 i32.store offset=1048780 i32.const 0 - i32.const 1048760 - i32.store offset=1048768 - i32.const 0 - i32.const 1048776 - i32.store offset=1048788 i32.const 0 - i32.const 1048768 - i32.store offset=1048776 + i32.store offset=1048720 i32.const 0 + i32.const 1048788 + i32.store offset=1048800 i32.const 0 - i32.store offset=1048716 + i32.const 1048780 + i32.store offset=1048788 i32.const 0 - i32.const 1048784 + i32.const 1048788 i32.store offset=1048796 i32.const 0 - i32.const 1048776 - i32.store offset=1048784 - i32.const 0 - i32.const 1048784 - i32.store offset=1048792 + i32.const 1048796 + i32.store offset=1048808 i32.const 0 - i32.const 1048792 + i32.const 1048796 i32.store offset=1048804 i32.const 0 - i32.const 1048792 - i32.store offset=1048800 + i32.const 1048804 + i32.store offset=1048816 i32.const 0 - i32.const 1048800 + i32.const 1048804 i32.store offset=1048812 i32.const 0 - i32.const 1048800 - i32.store offset=1048808 + i32.const 1048812 + i32.store offset=1048824 i32.const 0 - i32.const 1048808 + i32.const 1048812 i32.store offset=1048820 i32.const 0 - i32.const 1048808 - i32.store offset=1048816 + i32.const 1048820 + i32.store offset=1048832 i32.const 0 - i32.const 1048816 + i32.const 1048820 i32.store offset=1048828 i32.const 0 - i32.const 1048816 - i32.store offset=1048824 + i32.const 1048828 + i32.store offset=1048840 i32.const 0 - i32.const 1048824 + i32.const 1048828 i32.store offset=1048836 i32.const 0 - i32.const 1048824 - i32.store offset=1048832 + i32.const 1048836 + i32.store offset=1048848 i32.const 0 - i32.const 1048832 + i32.const 1048836 i32.store offset=1048844 i32.const 0 - i32.const 1048832 - i32.store offset=1048840 + i32.const 1048844 + i32.store offset=1048856 i32.const 0 - i32.const 1048840 + i32.const 1048844 i32.store offset=1048852 i32.const 0 - i32.const 1048840 - i32.store offset=1048848 + i32.const 1048852 + i32.store offset=1048864 + i32.const 0 + i32.const 1048860 + i32.store offset=1048872 i32.const 0 - i32.const 1048848 + i32.const 1048852 i32.store offset=1048860 i32.const 0 - i32.const 1048856 + i32.const 1048868 + i32.store offset=1048880 + i32.const 0 + i32.const 1048860 i32.store offset=1048868 i32.const 0 - i32.const 1048848 - i32.store offset=1048856 + i32.const 1048876 + i32.store offset=1048888 i32.const 0 - i32.const 1048864 + i32.const 1048868 i32.store offset=1048876 i32.const 0 - i32.const 1048856 - i32.store offset=1048864 + i32.const 1048884 + i32.store offset=1048896 i32.const 0 - i32.const 1048872 + i32.const 1048876 i32.store offset=1048884 i32.const 0 - i32.const 1048864 - i32.store offset=1048872 + i32.const 1048892 + i32.store offset=1048904 i32.const 0 - i32.const 1048880 + i32.const 1048884 i32.store offset=1048892 i32.const 0 - i32.const 1048872 - i32.store offset=1048880 + i32.const 1048900 + i32.store offset=1048912 i32.const 0 - i32.const 1048888 + i32.const 1048892 i32.store offset=1048900 i32.const 0 - i32.const 1048880 - i32.store offset=1048888 + i32.const 1048908 + i32.store offset=1048920 i32.const 0 - i32.const 1048896 + i32.const 1048900 i32.store offset=1048908 i32.const 0 - i32.const 1048888 - i32.store offset=1048896 + i32.const 1048916 + i32.store offset=1048928 i32.const 0 - i32.const 1048904 + i32.const 1048908 i32.store offset=1048916 i32.const 0 - i32.const 1048896 - i32.store offset=1048904 + i32.const 1048924 + i32.store offset=1048936 i32.const 0 - i32.const 1048912 + i32.const 1048916 i32.store offset=1048924 i32.const 0 - i32.const 1048904 - i32.store offset=1048912 + i32.const 1048932 + i32.store offset=1048944 i32.const 0 - i32.const 1048920 + i32.const 1048924 i32.store offset=1048932 i32.const 0 - i32.const 1048912 - i32.store offset=1048920 + i32.const 1048940 + i32.store offset=1048952 i32.const 0 - i32.const 1048928 + i32.const 1048932 i32.store offset=1048940 i32.const 0 - i32.const 1048920 - i32.store offset=1048928 + i32.const 1048948 + i32.store offset=1048960 i32.const 0 - i32.const 1048936 + i32.const 1048940 i32.store offset=1048948 i32.const 0 - i32.const 1048928 - i32.store offset=1048936 + i32.const 1048956 + i32.store offset=1048968 i32.const 0 - i32.const 1048944 + i32.const 1048948 i32.store offset=1048956 i32.const 0 - i32.const 1048936 - i32.store offset=1048944 + i32.const 1048964 + i32.store offset=1048976 i32.const 0 - i32.const 1048952 + i32.const 1048956 i32.store offset=1048964 i32.const 0 - i32.const 1048944 - i32.store offset=1048952 + i32.const 1048972 + i32.store offset=1048984 i32.const 0 - i32.const 1048960 + i32.const 1048964 i32.store offset=1048972 i32.const 0 - i32.const 1048952 - i32.store offset=1048960 - i32.const 0 - i32.const 1048968 - i32.store offset=1048980 - i32.const 0 - i32.const 1048960 - i32.store offset=1048968 - i32.const 0 local.get 6 - i32.store offset=1049004 + i32.store offset=1049008 i32.const 0 - i32.const 1048968 - i32.store offset=1048976 + i32.const 1048972 + i32.store offset=1048980 i32.const 0 local.get 8 i32.const -40 i32.add local.tee 0 - i32.store offset=1048996 + i32.store offset=1049000 local.get 6 local.get 0 i32.const 1 @@ -1513,7 +1498,7 @@ i32.store offset=4 i32.const 0 i32.const 2097152 - i32.store offset=1049016 + i32.store offset=1049020 br 8 (;@4;) end local.get 1 @@ -1531,19 +1516,19 @@ end i32.const 0 i32.const 0 - i32.load offset=1049020 + i32.load offset=1049024 local.tee 0 local.get 6 local.get 0 local.get 6 i32.lt_u select - i32.store offset=1049020 + i32.store offset=1049024 local.get 6 local.get 8 i32.add local.set 5 - i32.const 1048704 + i32.const 1048708 local.set 0 block ;; label = @11 block ;; label = @12 @@ -1566,7 +1551,7 @@ i32.eqz br_if 1 (;@11;) end - i32.const 1048704 + i32.const 1048708 local.set 0 block ;; label = @12 loop ;; label = @13 @@ -1594,13 +1579,13 @@ end i32.const 0 local.get 6 - i32.store offset=1049004 + i32.store offset=1049008 i32.const 0 local.get 8 i32.const -40 i32.add local.tee 0 - i32.store offset=1048996 + i32.store offset=1049000 local.get 6 local.get 0 i32.const 1 @@ -1613,7 +1598,7 @@ i32.store offset=4 i32.const 0 i32.const 2097152 - i32.store offset=1049016 + i32.store offset=1049020 local.get 1 local.get 5 i32.const -32 @@ -1633,31 +1618,31 @@ i32.const 27 i32.store offset=4 i32.const 0 - i64.load offset=1048704 align=4 + i64.load offset=1048708 align=4 local.set 9 local.get 7 i32.const 16 i32.add i32.const 0 - i64.load offset=1048712 align=4 + i64.load offset=1048716 align=4 i64.store align=4 local.get 7 local.get 9 i64.store offset=8 align=4 i32.const 0 local.get 8 - i32.store offset=1048708 + i32.store offset=1048712 i32.const 0 local.get 6 - i32.store offset=1048704 + i32.store offset=1048708 i32.const 0 local.get 7 i32.const 8 i32.add - i32.store offset=1048712 + i32.store offset=1048716 i32.const 0 i32.const 0 - i32.store offset=1048716 + i32.store offset=1048720 local.get 7 i32.const 28 i32.add @@ -1702,19 +1687,19 @@ br_if 0 (;@12;) local.get 1 local.get 0 - call 7 + call 5 br 8 (;@4;) end local.get 0 i32.const -8 i32.and - i32.const 1048720 + i32.const 1048724 i32.add local.set 5 block ;; label = @12 block ;; label = @13 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 6 i32.const 1 local.get 0 @@ -1728,7 +1713,7 @@ local.get 6 local.get 0 i32.or - i32.store offset=1048984 + i32.store offset=1048988 local.get 5 local.set 0 br 1 (;@12;) @@ -1774,12 +1759,12 @@ local.set 2 local.get 5 i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 i32.eq br_if 3 (;@7;) local.get 5 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.eq br_if 4 (;@6;) block ;; label = @11 @@ -1796,7 +1781,7 @@ i32.const -8 i32.and local.tee 1 - call 8 + call 6 local.get 1 local.get 2 i32.add @@ -1830,19 +1815,19 @@ br_if 0 (;@11;) local.get 0 local.get 2 - call 7 + call 5 br 6 (;@5;) end local.get 2 i32.const -8 i32.and - i32.const 1048720 + i32.const 1048724 i32.add local.set 1 block ;; label = @11 block ;; label = @12 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 5 i32.const 1 local.get 2 @@ -1856,7 +1841,7 @@ local.get 5 local.get 2 i32.or - i32.store offset=1048984 + i32.store offset=1048988 local.get 1 local.set 2 br 1 (;@11;) @@ -1884,15 +1869,15 @@ local.get 2 i32.sub local.tee 1 - i32.store offset=1048996 + i32.store offset=1049000 i32.const 0 i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 local.tee 0 local.get 2 i32.add local.tee 5 - i32.store offset=1049004 + i32.store offset=1049008 local.get 5 local.get 1 i32.const 1 @@ -1910,7 +1895,7 @@ br 6 (;@3;) end i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 local.set 1 block ;; label = @9 block ;; label = @10 @@ -1923,10 +1908,10 @@ br_if 0 (;@10;) i32.const 0 i32.const 0 - i32.store offset=1049000 + i32.store offset=1049004 i32.const 0 i32.const 0 - i32.store offset=1048992 + i32.store offset=1048996 local.get 1 local.get 0 i32.const 3 @@ -1945,13 +1930,13 @@ end i32.const 0 local.get 5 - i32.store offset=1048992 + i32.store offset=1048996 i32.const 0 local.get 1 local.get 2 i32.add local.tee 6 - i32.store offset=1049000 + i32.store offset=1049004 local.get 6 local.get 5 i32.const 1 @@ -1980,7 +1965,7 @@ i32.store offset=4 i32.const 0 i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 local.tee 0 i32.const 15 i32.add @@ -1990,13 +1975,13 @@ i32.const -8 i32.add local.tee 5 - i32.store offset=1049004 + i32.store offset=1049008 i32.const 0 local.get 0 local.get 1 i32.sub i32.const 0 - i32.load offset=1048996 + i32.load offset=1049000 local.get 8 i32.add local.tee 1 @@ -2004,7 +1989,7 @@ i32.const 8 i32.add local.tee 6 - i32.store offset=1048996 + i32.store offset=1049000 local.get 5 local.get 6 i32.const 1 @@ -2017,19 +2002,19 @@ i32.store offset=4 i32.const 0 i32.const 2097152 - i32.store offset=1049016 + i32.store offset=1049020 br 3 (;@4;) end i32.const 0 local.get 0 - i32.store offset=1049004 + i32.store offset=1049008 i32.const 0 i32.const 0 - i32.load offset=1048996 + i32.load offset=1049000 local.get 2 i32.add local.tee 2 - i32.store offset=1048996 + i32.store offset=1049000 local.get 0 local.get 2 i32.const 1 @@ -2039,14 +2024,14 @@ end i32.const 0 local.get 0 - i32.store offset=1049000 + i32.store offset=1049004 i32.const 0 i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 local.get 2 i32.add local.tee 2 - i32.store offset=1048992 + i32.store offset=1048996 local.get 0 local.get 2 i32.const 1 @@ -2066,7 +2051,7 @@ i32.const 0 local.set 1 i32.const 0 - i32.load offset=1048996 + i32.load offset=1049000 local.tee 0 local.get 2 i32.le_u @@ -2076,15 +2061,15 @@ local.get 2 i32.sub local.tee 1 - i32.store offset=1048996 + i32.store offset=1049000 i32.const 0 i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 local.tee 0 local.get 2 i32.add local.tee 5 - i32.store offset=1049004 + i32.store offset=1049008 local.get 5 local.get 1 i32.const 1 @@ -2166,19 +2151,19 @@ br_if 0 (;@3;) local.get 0 local.get 1 - call 7 + call 5 br 2 (;@1;) end local.get 1 i32.const -8 i32.and - i32.const 1048720 + i32.const 1048724 i32.add local.set 2 block ;; label = @3 block ;; label = @4 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 5 i32.const 1 local.get 1 @@ -2192,7 +2177,7 @@ local.get 5 local.get 1 i32.or - i32.store offset=1048984 + i32.store offset=1048988 local.get 2 local.set 1 br 1 (;@3;) @@ -2237,7 +2222,7 @@ i32.const 8 i32.add ) - (func (;6;) (type 3) (param i32 i32) + (func (;4;) (type 2) (param i32 i32) (local i32 i32) local.get 0 local.get 1 @@ -2268,7 +2253,7 @@ i32.sub local.tee 0 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.ne br_if 0 (;@3;) local.get 2 @@ -2280,7 +2265,7 @@ br_if 1 (;@2;) i32.const 0 local.get 1 - i32.store offset=1048992 + i32.store offset=1048996 local.get 2 local.get 2 i32.load offset=4 @@ -2299,7 +2284,7 @@ end local.get 0 local.get 3 - call 8 + call 6 end block ;; label = @2 block ;; label = @3 @@ -2313,12 +2298,12 @@ br_if 0 (;@5;) local.get 2 i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 i32.eq br_if 2 (;@3;) local.get 2 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.eq br_if 3 (;@2;) local.get 2 @@ -2326,7 +2311,7 @@ i32.const -8 i32.and local.tee 3 - call 8 + call 6 local.get 0 local.get 3 local.get 1 @@ -2342,12 +2327,12 @@ i32.store local.get 0 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.ne br_if 1 (;@4;) i32.const 0 local.get 1 - i32.store offset=1048992 + i32.store offset=1048996 return end local.get 2 @@ -2373,19 +2358,19 @@ br_if 0 (;@4;) local.get 0 local.get 1 - call 7 + call 5 br 3 (;@1;) end local.get 1 i32.const -8 i32.and - i32.const 1048720 + i32.const 1048724 i32.add local.set 2 block ;; label = @4 block ;; label = @5 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 3 i32.const 1 local.get 1 @@ -2399,7 +2384,7 @@ local.get 3 local.get 1 i32.or - i32.store offset=1048984 + i32.store offset=1048988 local.get 2 local.set 1 br 1 (;@4;) @@ -2424,14 +2409,14 @@ end i32.const 0 local.get 0 - i32.store offset=1049004 + i32.store offset=1049008 i32.const 0 i32.const 0 - i32.load offset=1048996 + i32.load offset=1049000 local.get 1 i32.add local.tee 1 - i32.store offset=1048996 + i32.store offset=1049000 local.get 0 local.get 1 i32.const 1 @@ -2439,27 +2424,27 @@ i32.store offset=4 local.get 0 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.ne br_if 1 (;@1;) i32.const 0 i32.const 0 - i32.store offset=1048992 + i32.store offset=1048996 i32.const 0 i32.const 0 - i32.store offset=1049000 + i32.store offset=1049004 return end i32.const 0 local.get 0 - i32.store offset=1049000 + i32.store offset=1049004 i32.const 0 i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 local.get 1 i32.add local.tee 1 - i32.store offset=1048992 + i32.store offset=1048996 local.get 0 local.get 1 i32.const 1 @@ -2473,7 +2458,7 @@ return end ) - (func (;7;) (type 3) (param i32 i32) + (func (;5;) (type 2) (param i32 i32) (local i32 i32 i32 i32) i32.const 31 local.set 2 @@ -2510,13 +2495,13 @@ local.get 2 i32.const 2 i32.shl - i32.const 1048576 + i32.const 1048580 i32.add local.set 3 block ;; label = @1 block ;; label = @2 i32.const 0 - i32.load offset=1048988 + i32.load offset=1048992 local.tee 4 i32.const 1 local.get 2 @@ -2528,7 +2513,7 @@ local.get 4 local.get 5 i32.or - i32.store offset=1048988 + i32.store offset=1048992 local.get 3 local.get 0 i32.store @@ -2629,7 +2614,7 @@ local.get 0 i32.store offset=8 ) - (func (;8;) (type 3) (param i32 i32) + (func (;6;) (type 2) (param i32 i32) (local i32 i32 i32 i32) local.get 0 i32.load offset=12 @@ -2724,7 +2709,7 @@ i32.load offset=28 i32.const 2 i32.shl - i32.const 1048576 + i32.const 1048580 i32.add local.tee 1 i32.load @@ -2754,13 +2739,13 @@ br_if 1 (;@2;) i32.const 0 i32.const 0 - i32.load offset=1048988 + i32.load offset=1048992 i32.const -2 local.get 0 i32.load offset=28 i32.rotl i32.and - i32.store offset=1048988 + i32.store offset=1048992 br 2 (;@1;) end block ;; label = @3 @@ -2780,14 +2765,14 @@ end i32.const 0 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 i32.const -2 local.get 1 i32.const 3 i32.shr_u i32.rotl i32.and - i32.store offset=1048984 + i32.store offset=1048988 return end local.get 2 @@ -2824,7 +2809,7 @@ return end ) - (func (;9;) (type 4) (param i32) + (func (;7;) (type 3) (param i32) (local i32 i32 i32 i32 i32) local.get 0 i32.const -8 @@ -2865,7 +2850,7 @@ i32.sub local.tee 1 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.ne br_if 0 (;@5;) local.get 3 @@ -2877,7 +2862,7 @@ br_if 1 (;@4;) i32.const 0 local.get 0 - i32.store offset=1048992 + i32.store offset=1048996 local.get 3 local.get 3 i32.load offset=4 @@ -2896,7 +2881,7 @@ end local.get 1 local.get 2 - call 8 + call 6 end block ;; label = @4 block ;; label = @5 @@ -2909,12 +2894,12 @@ br_if 0 (;@6;) local.get 3 i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 i32.eq br_if 2 (;@4;) local.get 3 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.eq br_if 5 (;@1;) local.get 3 @@ -2922,7 +2907,7 @@ i32.const -8 i32.and local.tee 2 - call 8 + call 6 local.get 1 local.get 2 local.get 0 @@ -2938,12 +2923,12 @@ i32.store local.get 1 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.ne br_if 1 (;@5;) i32.const 0 local.get 0 - i32.store offset=1048992 + i32.store offset=1048996 return end local.get 3 @@ -2968,21 +2953,21 @@ br_if 2 (;@2;) local.get 1 local.get 0 - call 7 + call 5 i32.const 0 local.set 1 i32.const 0 i32.const 0 - i32.load offset=1049024 + i32.load offset=1049028 i32.const -1 i32.add local.tee 0 - i32.store offset=1049024 + i32.store offset=1049028 local.get 0 br_if 1 (;@3;) block ;; label = @5 i32.const 0 - i32.load offset=1048712 + i32.load offset=1048716 local.tee 0 i32.eqz br_if 0 (;@5;) @@ -3006,19 +2991,19 @@ i32.const 4095 i32.gt_u select - i32.store offset=1049024 + i32.store offset=1049028 return end i32.const 0 local.get 1 - i32.store offset=1049004 + i32.store offset=1049008 i32.const 0 i32.const 0 - i32.load offset=1048996 + i32.load offset=1049000 local.get 0 i32.add local.tee 0 - i32.store offset=1048996 + i32.store offset=1049000 local.get 1 local.get 0 i32.const 1 @@ -3027,24 +3012,24 @@ block ;; label = @4 local.get 1 i32.const 0 - i32.load offset=1049000 + i32.load offset=1049004 i32.ne br_if 0 (;@4;) i32.const 0 i32.const 0 - i32.store offset=1048992 + i32.store offset=1048996 i32.const 0 i32.const 0 - i32.store offset=1049000 + i32.store offset=1049004 end local.get 0 i32.const 0 - i32.load offset=1049016 + i32.load offset=1049020 local.tee 4 i32.le_u br_if 0 (;@3;) i32.const 0 - i32.load offset=1049004 + i32.load offset=1049008 local.tee 3 i32.eqz br_if 0 (;@3;) @@ -3052,12 +3037,12 @@ local.set 1 block ;; label = @4 i32.const 0 - i32.load offset=1048996 + i32.load offset=1049000 local.tee 5 i32.const 41 i32.lt_u br_if 0 (;@4;) - i32.const 1048704 + i32.const 1048708 local.set 0 loop ;; label = @5 block ;; label = @6 @@ -3083,7 +3068,7 @@ end block ;; label = @4 i32.const 0 - i32.load offset=1048712 + i32.load offset=1048716 local.tee 0 i32.eqz br_if 0 (;@4;) @@ -3107,27 +3092,27 @@ i32.const 4095 i32.gt_u select - i32.store offset=1049024 + i32.store offset=1049028 local.get 5 local.get 4 i32.le_u br_if 0 (;@3;) i32.const 0 i32.const -1 - i32.store offset=1049016 + i32.store offset=1049020 end return end local.get 0 i32.const -8 i32.and - i32.const 1048720 + i32.const 1048724 i32.add local.set 3 block ;; label = @2 block ;; label = @3 i32.const 0 - i32.load offset=1048984 + i32.load offset=1048988 local.tee 2 i32.const 1 local.get 0 @@ -3141,7 +3126,7 @@ local.get 2 local.get 0 i32.or - i32.store offset=1048984 + i32.store offset=1048988 local.get 3 local.set 0 br 1 (;@2;) @@ -3166,14 +3151,14 @@ end i32.const 0 local.get 1 - i32.store offset=1049000 + i32.store offset=1049004 i32.const 0 i32.const 0 - i32.load offset=1048992 + i32.load offset=1048996 local.get 0 i32.add local.tee 0 - i32.store offset=1048992 + i32.store offset=1048996 local.get 1 local.get 0 i32.const 1 @@ -3185,380 +3170,379 @@ local.get 0 i32.store ) - (func (;10;) (type 5) (param i32 i32 i32 i32) (result i32) + (func (;8;) (type 4) (param i32 i32 i32 i32) (result i32) (local i32 i32 i32 i32) block ;; label = @1 block ;; label = @2 block ;; label = @3 block ;; label = @4 block ;; label = @5 + block ;; label = @6 + local.get 1 + br_if 0 (;@6;) + local.get 3 + br_if 1 (;@5;) + local.get 2 + return + end + block ;; label = @6 + local.get 2 + i32.const 9 + i32.lt_u + br_if 0 (;@6;) + local.get 2 + local.get 3 + call 2 + local.tee 2 + i32.eqz + br_if 2 (;@4;) + local.get 2 + local.get 0 + local.get 1 + local.get 3 + local.get 1 + local.get 3 + i32.lt_u + select + call 10 + local.set 3 + local.get 0 + call 7 + local.get 3 + return + end + local.get 3 + i32.const -65588 + i32.gt_u + br_if 1 (;@4;) + i32.const 16 + local.get 3 + i32.const 11 + i32.add + i32.const -8 + i32.and + local.get 3 + i32.const 11 + i32.lt_u + select + local.set 1 + local.get 0 + i32.const -4 + i32.add + local.tee 4 + i32.load + local.tee 5 + i32.const -8 + i32.and + local.set 2 block ;; label = @6 block ;; label = @7 - block ;; label = @8 - local.get 1 - br_if 0 (;@8;) - local.get 3 - br_if 1 (;@7;) - local.get 2 - return - end - block ;; label = @8 - local.get 2 - i32.const 9 - i32.lt_u - br_if 0 (;@8;) - local.get 2 - local.get 3 - call 4 - local.tee 2 - i32.eqz - br_if 5 (;@3;) - local.get 2 - local.get 0 - local.get 1 - local.get 3 - local.get 1 - local.get 3 - i32.lt_u - select - call 12 - local.set 3 - local.get 0 - call 9 - local.get 3 - return - end - local.get 3 - i32.const -65588 - i32.gt_u - br_if 4 (;@3;) - i32.const 16 - local.get 3 - i32.const 11 - i32.add - i32.const -8 + local.get 5 + i32.const 3 i32.and - local.get 3 - i32.const 11 + br_if 0 (;@7;) + local.get 1 + i32.const 256 i32.lt_u - select - local.set 1 - local.get 0 - i32.const -4 - i32.add - local.tee 4 - i32.load - local.tee 5 - i32.const -8 - i32.and - local.set 2 + br_if 1 (;@6;) + local.get 2 + local.get 1 + i32.const 4 + i32.or + i32.lt_u + br_if 1 (;@6;) + local.get 2 + local.get 1 + i32.sub + i32.const 131073 + i32.ge_u + br_if 1 (;@6;) + br 5 (;@2;) + end + local.get 0 + i32.const -8 + i32.add + local.tee 6 + local.get 2 + i32.add + local.set 7 + block ;; label = @7 block ;; label = @8 block ;; label = @9 - local.get 5 - i32.const 3 - i32.and - br_if 0 (;@9;) + local.get 2 local.get 1 - i32.const 256 - i32.lt_u + i32.ge_u + br_if 0 (;@9;) + local.get 7 + i32.const 0 + i32.load offset=1049008 + i32.eq + br_if 2 (;@7;) + local.get 7 + i32.const 0 + i32.load offset=1049004 + i32.eq br_if 1 (;@8;) + local.get 7 + i32.load offset=4 + local.tee 5 + i32.const 2 + i32.and + br_if 3 (;@6;) + local.get 5 + i32.const -8 + i32.and + local.tee 5 local.get 2 + i32.add + local.tee 2 local.get 1 - i32.const 4 - i32.or i32.lt_u - br_if 1 (;@8;) + br_if 3 (;@6;) + local.get 7 + local.get 5 + call 6 local.get 2 local.get 1 i32.sub - i32.const 131073 - i32.ge_u - br_if 1 (;@8;) - br 7 (;@2;) - end - local.get 0 - i32.const -8 - i32.add - local.tee 6 - local.get 2 - i32.add - local.set 7 - block ;; label = @9 - block ;; label = @10 - block ;; label = @11 - local.get 2 - local.get 1 - i32.ge_u - br_if 0 (;@11;) - local.get 7 - i32.const 0 - i32.load offset=1049004 - i32.eq - br_if 2 (;@9;) - local.get 7 - i32.const 0 - i32.load offset=1049000 - i32.eq - br_if 1 (;@10;) - local.get 7 - i32.load offset=4 - local.tee 5 - i32.const 2 - i32.and - br_if 3 (;@8;) - local.get 5 - i32.const -8 - i32.and - local.tee 5 - local.get 2 - i32.add - local.tee 2 - local.get 1 - i32.lt_u - br_if 3 (;@8;) - local.get 7 - local.get 5 - call 8 - local.get 2 - local.get 1 - i32.sub - local.tee 3 - i32.const 16 - i32.lt_u - br_if 5 (;@6;) - local.get 4 - local.get 1 - local.get 4 - i32.load - i32.const 1 - i32.and - i32.or - i32.const 2 - i32.or - i32.store - local.get 6 - local.get 1 - i32.add - local.tee 1 - local.get 3 - i32.const 3 - i32.or - i32.store offset=4 - local.get 6 - local.get 2 - i32.add - local.tee 2 - local.get 2 - i32.load offset=4 - i32.const 1 - i32.or - i32.store offset=4 - local.get 1 - local.get 3 - call 6 - local.get 0 - return - end - local.get 2 - local.get 1 - i32.sub - local.tee 3 - i32.const 15 - i32.le_u - br_if 8 (;@2;) - local.get 4 - local.get 1 - local.get 5 - i32.const 1 - i32.and - i32.or - i32.const 2 - i32.or - i32.store - local.get 6 - local.get 1 - i32.add - local.tee 1 - local.get 3 - i32.const 3 - i32.or - i32.store offset=4 - local.get 7 - local.get 7 - i32.load offset=4 - i32.const 1 - i32.or - i32.store offset=4 - local.get 1 - local.get 3 - call 6 - local.get 0 - return - end - i32.const 0 - i32.load offset=1048992 + local.tee 3 + i32.const 16 + i32.lt_u + br_if 6 (;@3;) + local.get 4 + local.get 1 + local.get 4 + i32.load + i32.const 1 + i32.and + i32.or + i32.const 2 + i32.or + i32.store + local.get 6 + local.get 1 + i32.add + local.tee 1 + local.get 3 + i32.const 3 + i32.or + i32.store offset=4 + local.get 6 local.get 2 i32.add local.tee 2 + local.get 2 + i32.load offset=4 + i32.const 1 + i32.or + i32.store offset=4 local.get 1 - i32.lt_u - br_if 1 (;@8;) - block ;; label = @10 - block ;; label = @11 - local.get 2 - local.get 1 - i32.sub - local.tee 3 - i32.const 15 - i32.gt_u - br_if 0 (;@11;) - local.get 4 - local.get 5 - i32.const 1 - i32.and - local.get 2 - i32.or - i32.const 2 - i32.or - i32.store - local.get 6 - local.get 2 - i32.add - local.tee 3 - local.get 3 - i32.load offset=4 - i32.const 1 - i32.or - i32.store offset=4 - i32.const 0 - local.set 3 - i32.const 0 - local.set 1 - br 1 (;@10;) - end - local.get 4 - local.get 1 - local.get 5 - i32.const 1 - i32.and - i32.or - i32.const 2 - i32.or - i32.store - local.get 6 - local.get 1 - i32.add - local.tee 1 - local.get 3 - i32.const 1 - i32.or - i32.store offset=4 - local.get 6 - local.get 2 - i32.add - local.tee 2 - local.get 3 - i32.store - local.get 2 - local.get 2 - i32.load offset=4 - i32.const -2 - i32.and - i32.store offset=4 - end - i32.const 0 - local.get 1 - i32.store offset=1049000 - i32.const 0 local.get 3 - i32.store offset=1048992 + call 4 local.get 0 return end - i32.const 0 - i32.load offset=1048996 local.get 2 + local.get 1 + i32.sub + local.tee 3 + i32.const 15 + i32.le_u + br_if 6 (;@2;) + local.get 4 + local.get 1 + local.get 5 + i32.const 1 + i32.and + i32.or + i32.const 2 + i32.or + i32.store + local.get 6 + local.get 1 i32.add - local.tee 2 + local.tee 1 + local.get 3 + i32.const 3 + i32.or + i32.store offset=4 + local.get 7 + local.get 7 + i32.load offset=4 + i32.const 1 + i32.or + i32.store offset=4 local.get 1 - i32.gt_u - br_if 7 (;@1;) + local.get 3 + call 4 + local.get 0 + return end - local.get 3 - call 5 - local.tee 1 - i32.eqz - br_if 4 (;@3;) - local.get 1 - local.get 0 - i32.const -4 - i32.const -8 - local.get 4 - i32.load - local.tee 2 - i32.const 3 - i32.and - select + i32.const 0 + i32.load offset=1048996 local.get 2 - i32.const -8 - i32.and i32.add local.tee 2 - local.get 3 - local.get 2 - local.get 3 + local.get 1 i32.lt_u - select - call 12 - local.set 3 - local.get 0 - call 9 + br_if 1 (;@6;) + block ;; label = @8 + block ;; label = @9 + local.get 2 + local.get 1 + i32.sub + local.tee 3 + i32.const 15 + i32.gt_u + br_if 0 (;@9;) + local.get 4 + local.get 5 + i32.const 1 + i32.and + local.get 2 + i32.or + i32.const 2 + i32.or + i32.store + local.get 6 + local.get 2 + i32.add + local.tee 3 + local.get 3 + i32.load offset=4 + i32.const 1 + i32.or + i32.store offset=4 + i32.const 0 + local.set 3 + i32.const 0 + local.set 1 + br 1 (;@8;) + end + local.get 4 + local.get 1 + local.get 5 + i32.const 1 + i32.and + i32.or + i32.const 2 + i32.or + i32.store + local.get 6 + local.get 1 + i32.add + local.tee 1 + local.get 3 + i32.const 1 + i32.or + i32.store offset=4 + local.get 6 + local.get 2 + i32.add + local.tee 2 + local.get 3 + i32.store + local.get 2 + local.get 2 + i32.load offset=4 + i32.const -2 + i32.and + i32.store offset=4 + end + i32.const 0 + local.get 1 + i32.store offset=1049004 + i32.const 0 local.get 3 + i32.store offset=1048996 + local.get 0 return end i32.const 0 - i32.load8_u offset=1049028 - drop - local.get 2 - i32.const 9 - i32.lt_u - br_if 1 (;@5;) + i32.load offset=1049000 local.get 2 - local.get 3 - call 4 - local.set 0 - br 2 (;@4;) + i32.add + local.tee 2 + local.get 1 + i32.gt_u + br_if 5 (;@1;) end - local.get 4 - local.get 2 + local.get 3 + call 3 + local.tee 1 + i32.eqz + br_if 1 (;@4;) + local.get 1 + local.get 0 + i32.const -4 + i32.const -8 local.get 4 i32.load - i32.const 1 + local.tee 2 + i32.const 3 i32.and - i32.or - i32.const 2 - i32.or - i32.store - local.get 6 + select local.get 2 + i32.const -8 + i32.and i32.add - local.tee 3 + local.tee 2 local.get 3 - i32.load offset=4 - i32.const 1 - i32.or - i32.store offset=4 - br 3 (;@2;) + local.get 2 + local.get 3 + i32.lt_u + select + call 10 + local.set 3 + local.get 0 + call 7 + local.get 3 + return end - local.get 3 - call 5 - local.set 0 + i32.const 0 + i32.load8_u offset=1049032 + drop + block ;; label = @5 + block ;; label = @6 + local.get 2 + i32.const 9 + i32.lt_u + br_if 0 (;@6;) + local.get 2 + local.get 3 + call 2 + local.set 0 + br 1 (;@5;) + end + local.get 3 + call 3 + local.set 0 + end + local.get 0 + br_if 2 (;@2;) end - local.get 0 - br_if 1 (;@2;) + unreachable + unreachable end - unreachable - unreachable + local.get 4 + local.get 2 + local.get 4 + i32.load + i32.const 1 + i32.and + i32.or + i32.const 2 + i32.or + i32.store + local.get 6 + local.get 2 + i32.add + local.tee 3 + local.get 3 + i32.load offset=4 + i32.const 1 + i32.or + i32.store offset=4 end local.get 0 return @@ -3585,13 +3569,13 @@ i32.store offset=4 i32.const 0 local.get 1 - i32.store offset=1048996 + i32.store offset=1049000 i32.const 0 local.get 3 - i32.store offset=1049004 + i32.store offset=1049008 local.get 0 ) - (func (;11;) (type 6) (param i32 i32 i32) (result i32) + (func (;9;) (type 5) (param i32 i32 i32) (result i32) (local i32 i32 i32 i32 i32 i32 i32 i32) block ;; label = @1 block ;; label = @2 @@ -3772,25 +3756,36 @@ end local.get 0 ) - (func (;12;) (type 6) (param i32 i32 i32) (result i32) + (func (;10;) (type 5) (param i32 i32 i32) (result i32) local.get 0 local.get 1 local.get 2 - call 11 + call 9 + ) + (func (;11;) (type 4) (param i32 i32 i32 i32) (result i32) + local.get 0 + local.get 1 + local.get 2 + local.get 3 + call 8 ) + (table (;0;) 2 2 funcref) (memory (;0;) 17) (global (;0;) (mut i32) i32.const 1048576) - (global (;1;) i32 i32.const 1049030) + (global (;1;) i32 i32.const 1049033) (global (;2;) i32 i32.const 1049040) (export "memory" (memory 0)) - (export "add-one" (func 1)) - (export "add-two" (func 3)) - (export "cabi_realloc" (func 10)) + (export "add-one" (func 0)) + (export "add-two" (func 1)) + (export "cabi_realloc_wit_bindgen_0_20_0" (func 8)) + (export "cabi_realloc" (func 11)) (export "__data_end" (global 1)) (export "__heap_base" (global 2)) + (elem (;0;) (i32.const 1) func 11) + (data (;0;) (i32.const 1048576) "\01\00\00\00") (@producers - (processed-by "wit-component" "0.18.2") - (processed-by "wit-bindgen-rust" "0.16.0") + (processed-by "wit-component" "0.201.0") + (processed-by "wit-bindgen-rust" "0.20.0") ) ) (core instance (;0;) (instantiate 0)) @@ -3804,6 +3799,6 @@ (func (;2;) (type 0) (canon lift (core func 2))) (export (;3;) "add-two" (func 2)) (@producers - (processed-by "wit-component" "0.20.1") + (processed-by "wit-component" "0.201.0") ) ) diff --git a/homestar-wasm/fixtures/example_test.wasm b/homestar-wasm/fixtures/example_test.wasm index 64fed340..a8261e2a 100755 Binary files a/homestar-wasm/fixtures/example_test.wasm and b/homestar-wasm/fixtures/example_test.wasm differ diff --git a/homestar-wasm/fixtures/example_test_cargo_component.wasm b/homestar-wasm/fixtures/example_test_cargo_component.wasm index e5f213fe..ee331d15 100755 Binary files a/homestar-wasm/fixtures/example_test_cargo_component.wasm and b/homestar-wasm/fixtures/example_test_cargo_component.wasm differ diff --git a/homestar-wasm/fixtures/example_test_cargo_component_wasi.wasm b/homestar-wasm/fixtures/example_test_cargo_component_wasi.wasm index 87ee050a..cf324651 100755 Binary files a/homestar-wasm/fixtures/example_test_cargo_component_wasi.wasm and b/homestar-wasm/fixtures/example_test_cargo_component_wasi.wasm differ diff --git a/homestar-wasm/fixtures/example_test_component.wasm b/homestar-wasm/fixtures/example_test_component.wasm index 37988846..987cb4e6 100644 Binary files a/homestar-wasm/fixtures/example_test_component.wasm and b/homestar-wasm/fixtures/example_test_component.wasm differ diff --git a/homestar-wasm/fixtures/example_test_wasi.wasm b/homestar-wasm/fixtures/example_test_wasi.wasm index 97fc8075..68c5fb29 100755 Binary files a/homestar-wasm/fixtures/example_test_wasi.wasm and b/homestar-wasm/fixtures/example_test_wasi.wasm differ diff --git a/homestar-wasm/fixtures/example_test_wasi_component.wasm b/homestar-wasm/fixtures/example_test_wasi_component.wasm index 56318dd1..65905e1c 100644 Binary files a/homestar-wasm/fixtures/example_test_wasi_component.wasm and b/homestar-wasm/fixtures/example_test_wasi_component.wasm differ diff --git a/homestar-wasm/src/error.rs b/homestar-wasm/src/error.rs index 433f7697..f171448f 100644 --- a/homestar-wasm/src/error.rs +++ b/homestar-wasm/src/error.rs @@ -26,14 +26,12 @@ pub enum InterpreterError { /// Error casting from Ipld [i128] structure to a lower precision integer. #[error("failed to cast Ipld i128 to integer type: {0}")] IpldToInt(#[from] std::num::TryFromIntError), + /// Error involving mismatches with Ipld mapping(s). /// Error converting from Ipld structure to [Wit] structure. /// /// [Wit]: wasmtime::component::Val - #[error("no compatible Ipld type for Wit structure: {0:#?}")] + #[error("incompatible Ipld type to Wit structural conversion: {0:#?}")] IpldToWit(String), - /// Error involving mismatches with Ipld maps. - #[error("{0}")] - MapType(String), /// Bubble-up [TagsError] errors while executing the interpreter. #[error(transparent)] Tags(#[from] TagsError), diff --git a/homestar-wasm/src/wasmtime/ipld.rs b/homestar-wasm/src/wasmtime/ipld.rs index 0b1ea8bd..d3ccafd6 100644 --- a/homestar-wasm/src/wasmtime/ipld.rs +++ b/homestar-wasm/src/wasmtime/ipld.rs @@ -8,6 +8,8 @@ use crate::error::{InterpreterError, TagsError}; use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut}; +use homestar_invocation::ensure; +use indexmap::IndexMap; use itertools::{FoldWhile::Done, Itertools}; use libipld::{ cid::{self, multibase::Base, Cid}, @@ -24,6 +26,9 @@ use std::{ }; use wasmtime::component::{Type, Val}; +const DEFAULT_RED_ZONE: usize = 32 * 1024; +const DEFAULT_EXTRA_STACK: usize = 1024 * 1024; + /// Interface-type wrapper over wasmtime component [wasmtime::component::Type]. #[derive(Clone, Debug, Default)] pub enum InterfaceType<'a> { @@ -60,6 +65,13 @@ impl<'a> From<&'a Type> for InterfaceType<'a> { match typ { Type::List(_) | Type::Record(_) + | Type::Tuple(_) + | Type::Variant(_) + | Type::Option(_) + | Type::Result(_) + | Type::Flags(_) + | Type::Enum(_) + | Type::String | Type::S8 | Type::S16 | Type::S32 @@ -160,29 +172,94 @@ impl RuntimeVal { } /// Convert from Ipld to [RuntimeVal] with a given [InterfaceType]. - /// - /// TODOs: - /// * Enums - /// * Structs / Records - /// * Results / Options pub fn try_from( ipld: Ipld, interface_ty: &InterfaceType<'_>, ) -> Result { // TODO: Configure for recursion. - stacker::maybe_grow(64 * 1024, 1024 * 1024, || { + stacker::maybe_grow(DEFAULT_RED_ZONE, DEFAULT_EXTRA_STACK, || { let dyn_type = match ipld { Ipld::Null => match interface_ty { + InterfaceType::Type(Type::Option(opt_inst)) => { + RuntimeVal::new(opt_inst.new_val(None)?) + } InterfaceType::Type(Type::String) | InterfaceType::TypeRef(Type::String) | InterfaceType::Any => RuntimeVal::new(Val::String(Box::from("null"))), - _ => Err(InterpreterError::WitToIpld(Ipld::Null))?, + _ => Err(InterpreterError::IpldToWit( + "No conversion possible".to_string(), + ))?, }, + v if matches!(interface_ty.inner(), Some(Type::Option(_))) => { + let inner = + interface_ty + .inner() + .ok_or_else(|| InterpreterError::TypeMismatch { + expected: "