diff --git a/Dockerfile b/Dockerfile index 7f211cd45..398bb406d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,13 +41,14 @@ RUN apt-get update && apt-get install -y curl build-essential=12.9 FROM wasm-base as wasm-libs-builder # clang / lld used by soft-float wasm RUN apt-get install -y clang=1:11.0-51+nmu5 lld=1:11.0-51+nmu5 wabt - # pinned rust 1.65.0 -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.68.2 --target x86_64-unknown-linux-gnu wasm32-unknown-unknown wasm32-wasi + # pinned rust 1.74.0 +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.74.0 --target x86_64-unknown-linux-gnu wasm32-unknown-unknown wasm32-wasi COPY ./Makefile ./ +COPY arbitrator/Cargo.* arbitrator/ +COPY arbitrator/arbutil arbitrator/arbutil COPY arbitrator/prover arbitrator/prover COPY arbitrator/wasm-libraries arbitrator/wasm-libraries COPY arbitrator/tools/wasmer arbitrator/tools/wasmer -COPY arbitrator/arbutil arbitrator/arbutil COPY --from=brotli-wasm-export / target/ RUN . ~/.cargo/env && NITRO_BUILD_IGNORE_TIMESTAMPS=1 RUSTFLAGS='-C symbol-mangling-version=v0' make build-wasm-libs @@ -82,13 +83,13 @@ COPY --from=contracts-builder workspace/contracts/build/contracts/src/precompile COPY --from=contracts-builder workspace/.make/ .make/ RUN PATH="$PATH:/usr/local/go/bin" NITRO_BUILD_IGNORE_TIMESTAMPS=1 make build-wasm-bin -FROM rust:1.68-slim-bullseye as prover-header-builder +FROM rust:1.74-slim-bullseye as prover-header-builder WORKDIR /workspace RUN export DEBIAN_FRONTEND=noninteractive && \ apt-get update && \ apt-get install -y make wabt && \ cargo install --force cbindgen -COPY arbitrator/Cargo.* arbitrator/stylus/cbindgen.toml arbitrator/stylus/ +COPY arbitrator/Cargo.* arbitrator/ COPY ./Makefile ./ COPY arbitrator/arbutil arbitrator/arbutil COPY arbitrator/prover arbitrator/prover @@ -101,15 +102,15 @@ RUN NITRO_BUILD_IGNORE_TIMESTAMPS=1 make build-prover-header FROM scratch as prover-header-export COPY --from=prover-header-builder /workspace/target/ / -FROM rust:1.68-slim-bullseye as prover-builder +FROM rust:1.74-slim-bullseye as prover-builder WORKDIR /workspace RUN export DEBIAN_FRONTEND=noninteractive && \ apt-get update && \ apt-get install -y make wget gpg software-properties-common zlib1g-dev libstdc++-10-dev wabt RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ - add-apt-repository 'deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-12 main' && \ + add-apt-repository 'deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-15 main' && \ apt-get update && \ - apt-get install -y llvm-12-dev libclang-common-12-dev + apt-get install -y llvm-15-dev libclang-common-15-dev libpolly-15-dev COPY arbitrator/Cargo.* arbitrator/ COPY arbitrator/arbutil arbitrator/arbutil COPY arbitrator/prover/Cargo.toml arbitrator/prover/ diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index 18faf400e..2ec646d1a 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -37,12 +37,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "aliasable" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" - [[package]] name = "ansi_term" version = "0.11.0" @@ -52,12 +46,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "anyhow" -version = "1.0.71" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" - [[package]] name = "arbutil" version = "0.1.0" @@ -84,7 +72,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi 0.1.19", + "hermit-abi", "libc", "winapi", ] @@ -125,6 +113,18 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "block-buffer" version = "0.9.0" @@ -178,19 +178,20 @@ checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "bytecheck" -version = "0.6.9" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d11cac2c12b5adc6570dad2ee1b87eff4955dac476fe12d81e5fdd352e52406f" +checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" dependencies = [ "bytecheck_derive", "ptr_meta", + "simdutf8", ] [[package]] name = "bytecheck_derive" -version = "0.6.9" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e576ebe98e605500b3c8041bb888e966653577172df6dd97398714eb30b9bf" +checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" dependencies = [ "proc-macro2", "quote", @@ -205,9 +206,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.3.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" @@ -236,38 +237,6 @@ dependencies = [ "vec_map", ] -[[package]] -name = "compiletest_rs" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0086d6ad78cf409c3061618cd98e2789d5c9ce598fc9651611cf62eae0a599cb" -dependencies = [ - "diff", - "filetime", - "getopts", - "lazy_static", - "libc", - "log", - "miow", - "regex", - "rustfix", - "serde", - "serde_derive", - "serde_json", - "tester", - "winapi", -] - -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - [[package]] name = "corosensei" version = "0.1.3" @@ -278,7 +247,7 @@ dependencies = [ "cfg-if", "libc", "scopeguard", - "windows-sys 0.33.0", + "windows-sys", ] [[package]] @@ -292,26 +261,28 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.86.1" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "529ffacce2249ac60edba2941672dfedf3d96558b415d0d8083cd007456e0f55" +checksum = "2a2ab4512dfd3a6f4be184403a195f76e81a8a9f9e6c898e19d2dc3ce20e0115" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.86.1" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427d105f617efc8cb55f8d036a7fded2e227892d8780b4985e5551f8d27c4a92" +checksum = "98b022ed2a5913a38839dfbafe6cf135342661293b08049843362df4301261dc" dependencies = [ + "arrayvec", + "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", + "cranelift-egraph", "cranelift-entity", "cranelift-isle", "gimli", - "hashbrown 0.11.2", "log", "regalloc2", "smallvec", @@ -320,33 +291,46 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.86.1" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "551674bed85b838d45358e3eab4f0ffaa6790c70dc08184204b9a54b41cdb7d1" +checksum = "639307b45434ad112a98f8300c0f0ab085cbefcd767efcdef9ef19d4c0756e74" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.86.1" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b3a63ae57498c3eb495360944a33571754241e15e47e3bcae6082f40fec5866" +checksum = "278e52e29c53fcf32431ef08406c295699a70306d05a0715c5b1bf50e33a9ab7" + +[[package]] +name = "cranelift-egraph" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624b54323b06e675293939311943ba82d323bb340468ce1889be5da7932c8d73" +dependencies = [ + "cranelift-entity", + "fxhash", + "hashbrown 0.12.3", + "indexmap", + "log", + "smallvec", +] [[package]] name = "cranelift-entity" -version = "0.86.1" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11aa8aa624c72cc1c94ea3d0739fa61248260b5b14d3646f51593a88d67f3e6e" +checksum = "9a59bcbca89c3f1b70b93ab3cbba5e5e0cbf3e63dadb23c7525cb142e21a9d4c" [[package]] name = "cranelift-frontend" -version = "0.86.1" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "544ee8f4d1c9559c9aa6d46e7aaeac4a13856d620561094f35527356c7d21bd0" +checksum = "0d70abacb8cfef3dc8ff7e8836e9c1d70f7967dfdac824a4cd5e30223415aca6" dependencies = [ "cranelift-codegen", - "hashbrown 0.11.2", "log", "smallvec", "target-lexicon", @@ -354,18 +338,9 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.86.1" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed16b14363d929b8c37e3c557d0a7396791b383ecc302141643c054343170aad" - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] +checksum = "393bc73c451830ff8dbb3a07f61843d6cb41a084f9996319917c0b291ed785bb" [[package]] name = "crossbeam-channel" @@ -397,10 +372,20 @@ dependencies = [ "cfg-if", "crossbeam-utils", "lazy_static", - "memoffset", + "memoffset 0.6.4", "scopeguard", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.8" @@ -427,8 +412,18 @@ version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.13.4", + "darling_macro 0.13.4", +] + +[[package]] +name = "darling" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +dependencies = [ + "darling_core 0.20.3", + "darling_macro 0.20.3", ] [[package]] @@ -445,17 +440,54 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "darling_core" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "syn 2.0.18", +] + [[package]] name = "darling_macro" version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ - "darling_core", + "darling_core 0.13.4", "quote", "syn 1.0.109", ] +[[package]] +name = "darling_macro" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +dependencies = [ + "darling_core 0.20.3", + "quote", + "syn 2.0.18", +] + +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.2", + "lock_api", + "once_cell", + "parking_lot_core", +] + [[package]] name = "derivative" version = "2.2.0" @@ -467,12 +499,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - [[package]] name = "digest" version = "0.9.0" @@ -492,27 +518,6 @@ dependencies = [ "crypto-common", ] -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "dynasm" version = "1.2.3" @@ -536,7 +541,7 @@ checksum = "64fba5a42bd76a17cad4bfa00de168ee1cbfa06a5e8ce992ae880218c05641a9" dependencies = [ "byteorder", "dynasm", - "memmap2", + "memmap2 0.5.7", ] [[package]] @@ -567,44 +572,23 @@ dependencies = [ [[package]] name = "enumset" -version = "1.0.11" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4799cdb24d48f1f8a7a98d06b7fde65a85a2d1e42b25a889f5406aa1fbefe074" +checksum = "226c0da7462c13fb57e5cc9e0dc8f0635e7d27f276a3a7fd30054647f669007d" dependencies = [ "enumset_derive", ] [[package]] name = "enumset_derive" -version = "0.6.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea83a3fbdc1d999ccfbcbee717eab36f8edf2d71693a23ce0d7cca19e085304c" +checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" dependencies = [ - "darling", + "darling 0.20.3", "proc-macro2", "quote", - "syn 1.0.109", -] - -[[package]] -name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", + "syn 2.0.18", ] [[package]] @@ -624,31 +608,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] -name = "fastrand" -version = "1.9.0" +name = "fnv" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "filetime" -version = "0.2.21" +name = "form_urlencoded" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.2.16", - "windows-sys 0.48.0", + "percent-encoding", ] [[package]] -name = "fnv" -version = "1.0.7" +name = "funty" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "fxhash" @@ -669,15 +647,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "getopts" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -dependencies = [ - "unicode-width", -] - [[package]] name = "getrandom" version = "0.2.7" @@ -707,28 +676,25 @@ dependencies = [ "arbutil", "eyre", "fnv", - "parking_lot 0.12.1", + "parking_lot", "rand", "rand_pcg", ] [[package]] name = "hashbrown" -version = "0.11.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ "ahash", ] [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash", -] +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" [[package]] name = "heck" @@ -739,12 +705,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "hermit-abi" version = "0.1.19" @@ -754,12 +714,6 @@ dependencies = [ "libc", ] -[[package]] -name = "hermit-abi" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" - [[package]] name = "hex" version = "0.4.3" @@ -772,6 +726,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "indenter" version = "0.3.3" @@ -780,61 +744,39 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "1.8.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown 0.11.2", - "serde", + "hashbrown 0.12.3", ] [[package]] name = "inkwell" -version = "0.1.0-beta.4" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2223d0eba0ae6d40a3e4680c6a3209143471e1f38b41746ea309aa36dde9f90b" +checksum = "bbac11e485159a525867fb7e6aa61981453e6a72f625fde6a4ab3047b0c6dec9" dependencies = [ "either", "inkwell_internals", "libc", "llvm-sys", "once_cell", - "parking_lot 0.11.2", - "regex", + "parking_lot", ] [[package]] name = "inkwell_internals" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7090af3d300424caa81976b8c97bca41cd70e861272c072e188ae082fb49f9" +checksum = "87d00c17e264ce02be5bc23d7bff959188ec7137beddd06b8b6b05a7c680ea85" dependencies = [ "proc-macro2", "quote", "syn 1.0.109", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "itertools" version = "0.10.5" @@ -859,8 +801,7 @@ dependencies = [ "go-js", "hex", "libc", - "ouroboros", - "parking_lot 0.12.1", + "parking_lot", "prover", "rand", "rand_pcg", @@ -909,30 +850,24 @@ version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - [[package]] name = "llvm-sys" -version = "120.2.4" +version = "150.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b716322964966a62377cf86e64f00ca7043505fdf27bd2ec7d41ae6682d1e7" +checksum = "417dbaef2fece3b186fe15704e010849279de5f7eea1caa8845558130867bdd2" dependencies = [ "cc", "lazy_static", "libc", "regex", - "semver 0.11.0", + "semver", ] [[package]] name = "lock_api" -version = "0.4.8" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f80bf5aacaf25cbfc8210d1cfb718f2bf3b11c4c54e5afe36c236853a8ec390" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -956,16 +891,6 @@ dependencies = [ "libc", ] -[[package]] -name = "macro-wasmer-universal-test" -version = "3.1.0" -dependencies = [ - "proc-macro2", - "proc-quote", - "quote", - "syn 1.0.109", -] - [[package]] name = "memchr" version = "2.4.1" @@ -981,6 +906,15 @@ dependencies = [ "libc", ] +[[package]] +name = "memmap2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d28bba84adfe6646737845bc5ebbfa2c08424eb1c37e94a1fd2a82adb56a872" +dependencies = [ + "libc", +] + [[package]] name = "memoffset" version = "0.6.4" @@ -990,6 +924,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +dependencies = [ + "autocfg", +] + [[package]] name = "minimal-lexical" version = "0.1.3" @@ -1005,15 +948,6 @@ dependencies = [ "adler", ] -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi", -] - [[package]] name = "more-asserts" version = "0.2.2" @@ -1124,7 +1058,7 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "hermit-abi 0.1.19", + "hermit-abi", "libc", ] @@ -1134,9 +1068,6 @@ version = "0.28.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" dependencies = [ - "crc32fast", - "hashbrown 0.11.2", - "indexmap", "memchr", ] @@ -1151,9 +1082,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.16.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -1161,41 +1092,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "ouroboros" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6a6d0919a92ba28d8109a103e0de08f89706be0eeaad1130fd1a34030dee84a" -dependencies = [ - "aliasable", - "ouroboros_macro", - "static_assertions", -] - -[[package]] -name = "ouroboros_macro" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bc2307dc3420554ae349230dac4969c66d7c2feead3a8cab05ea0c604daca6" -dependencies = [ - "heck 0.4.1", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.5", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -1203,45 +1099,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.3", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.9.3" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall", "smallvec", - "windows-sys 0.36.1", + "windows-targets", ] [[package]] -name = "pest" +name = "percent-encoding" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b0560d531d1febc25a3c9398a62a71256c0178f2e3443baedd9ad4bb8c9deb4" -dependencies = [ - "thiserror", - "ucd-trie", -] +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project-lite" @@ -1279,12 +1157,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "proc-macro-hack" -version = "0.5.20+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" - [[package]] name = "proc-macro2" version = "1.0.60" @@ -1294,30 +1166,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "proc-quote" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e84ab161de78c915302ca325a19bee6df272800e2ae1a43fe3ef430bab2a100" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "proc-quote-impl", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "proc-quote-impl" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fb3ec628b063cdbcf316e06a8b8c1a541d28fa6c0a8eacd2bfb2b7f49e88aa0" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", -] - [[package]] name = "prover" version = "0.1.0" @@ -1336,7 +1184,7 @@ dependencies = [ "nom", "nom-leb128", "num", - "parking_lot 0.12.1", + "parking_lot", "rayon", "rustc-demangle", "serde", @@ -1382,6 +1230,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.8.5" @@ -1448,38 +1302,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags", ] -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall 0.2.16", - "thiserror", -] - [[package]] name = "regalloc2" -version = "0.3.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d43a209257d978ef079f3d446331d0f1794f5e0fc19b306a199983857833a779" +checksum = "300d4fbfb40c1c66a78ba3ddd41c1110247cf52f97b87d0f2fc9209bd49b030c" dependencies = [ "fxhash", "log", @@ -1518,19 +1352,20 @@ dependencies = [ [[package]] name = "rend" -version = "0.3.6" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79af64b4b6362ffba04eef3a4e10829718a4896dac19daa741851c86781edf95" +checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" dependencies = [ "bytecheck", ] [[package]] name = "rkyv" -version = "0.7.39" +version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cec2b3485b07d96ddfd3134767b8a447b45ea4eb91448d0a35180ec0ffd5ed15" +checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" dependencies = [ + "bitvec", "bytecheck", "hashbrown 0.12.3", "indexmap", @@ -1538,13 +1373,15 @@ dependencies = [ "rend", "rkyv_derive", "seahash", + "tinyvec", + "uuid", ] [[package]] name = "rkyv_derive" -version = "0.7.39" +version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eaedadc88b53e36dd32d940ed21ae4d850d5916f2581526921f553a72ac34c4" +checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" dependencies = [ "proc-macro2", "quote", @@ -1563,33 +1400,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.13", -] - -[[package]] -name = "rustfix" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2c50b74badcddeb8f7652fa8323ce440b95286f8e4b64ebfd871c609672704e" -dependencies = [ - "anyhow", - "log", - "serde", - "serde_json", -] - -[[package]] -name = "rustix" -version = "0.37.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", + "semver", ] [[package]] @@ -1604,12 +1415,6 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - [[package]] name = "scopeguard" version = "1.1.0" @@ -1623,13 +1428,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] -name = "semver" -version = "0.11.0" +name = "self_cell" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser", -] +checksum = "e388332cd64eb80cd595a00941baf513caffae8dce9cfd0467fc9c66397dade6" [[package]] name = "semver" @@ -1637,15 +1439,6 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711" -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - [[package]] name = "serde" version = "1.0.132" @@ -1666,15 +1459,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "serde_bytes" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416bda436f9aab92e02c8e10d49a15ddd339cea90b6e340fe51ed97abb548294" -dependencies = [ - "serde", -] - [[package]] name = "serde_derive" version = "1.0.132" @@ -1714,7 +1498,7 @@ version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" dependencies = [ - "darling", + "darling 0.13.4", "proc-macro2", "quote", "syn 1.0.109", @@ -1742,6 +1526,22 @@ dependencies = [ "keccak", ] +[[package]] +name = "shared-buffer" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cf61602ee61e2f83dd016b3e6387245291cf728ea071c378b35088125b4d995" +dependencies = [ + "bytes", + "memmap2 0.6.2", +] + +[[package]] +name = "simdutf8" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" + [[package]] name = "siphasher" version = "0.3.10" @@ -1804,7 +1604,7 @@ version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ - "heck 0.3.3", + "heck", "proc-macro-error", "proc-macro2", "quote", @@ -1823,7 +1623,7 @@ dependencies = [ "hex", "libc", "num-bigint", - "parking_lot 0.12.1", + "parking_lot", "prover", "rand", "sha3 0.10.8", @@ -1859,48 +1659,16 @@ dependencies = [ ] [[package]] -name = "target-lexicon" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" - -[[package]] -name = "tempfile" -version = "3.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" -dependencies = [ - "autocfg", - "cfg-if", - "fastrand", - "redox_syscall 0.3.5", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "term" -version = "0.7.0" +name = "tap" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" -dependencies = [ - "dirs-next", - "rustversion", - "winapi", -] +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] -name = "tester" -version = "0.9.1" +name = "target-lexicon" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89e8bf7e0eb2dd7b4228cc1b6821fc5114cd6841ae59f652a85488c016091e5f" -dependencies = [ - "cfg-if", - "getopts", - "libc", - "num_cpus", - "term", -] +checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" [[package]] name = "textwrap" @@ -1931,6 +1699,21 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tracing" version = "0.1.34" @@ -1970,10 +1753,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" [[package]] -name = "ucd-trie" -version = "0.1.5" +name = "unicode-bidi" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" @@ -1981,6 +1764,15 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.8.0" @@ -1993,6 +1785,23 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "url" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "uuid" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" + [[package]] name = "vec_map" version = "0.8.2" @@ -2059,18 +1868,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "wasm-bindgen-macro" version = "0.2.83" @@ -2100,92 +1897,61 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" -[[package]] -name = "wasm-bindgen-test" -version = "0.3.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d2fff962180c3fadf677438054b1db62bee4aa32af26a45388af07d1287e1d" -dependencies = [ - "console_error_panic_hook", - "js-sys", - "scoped-tls", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-bindgen-test-macro", -] - -[[package]] -name = "wasm-bindgen-test-macro" -version = "0.3.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4683da3dfc016f704c9f82cf401520c4f1cb3ee440f7f52b3d6ac29506a49ca7" -dependencies = [ - "proc-macro2", - "quote", -] - [[package]] name = "wasm-encoder" -version = "0.25.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eff853c4f09eec94d76af527eddad4e9de13b11d6286a1ef7134bc30135a2b7" +checksum = "1ba64e81215916eaeb48fee292f29401d69235d62d8b8fd92a7b2844ec5ae5f7" dependencies = [ "leb128", ] [[package]] name = "wasmer" -version = "3.1.0" +version = "4.2.3" dependencies = [ - "anyhow", "bytes", "cfg-if", - "hashbrown 0.11.2", + "derivative", "indexmap", "js-sys", - "macro-wasmer-universal-test", "more-asserts", + "rustc-demangle", "serde", "serde-wasm-bindgen", + "shared-buffer", "target-lexicon", - "tempfile", "thiserror", - "tracing", "wasm-bindgen", "wasm-bindgen-downcast", - "wasm-bindgen-test", "wasmer-compiler", "wasmer-compiler-cranelift", - "wasmer-compiler-llvm", - "wasmer-compiler-singlepass", "wasmer-derive", "wasmer-types", "wasmer-vm", - "wasmparser", "wat", "winapi", ] [[package]] name = "wasmer-compiler" -version = "3.1.0" +version = "4.2.3" dependencies = [ "backtrace", + "bytes", "cfg-if", "enum-iterator", "enumset", - "hashbrown 0.11.2", "lazy_static", "leb128", - "memmap2", + "memmap2 0.5.7", "more-asserts", "region", - "rustc-demangle", - "serde", - "serde_bytes", + "rkyv", + "self_cell", + "shared-buffer", "smallvec", "thiserror", - "wasmer-object", "wasmer-types", "wasmer-vm", "wasmparser", @@ -2194,14 +1960,12 @@ dependencies = [ [[package]] name = "wasmer-compiler-cranelift" -version = "3.1.0" +version = "4.2.3" dependencies = [ "cranelift-codegen", "cranelift-entity", "cranelift-frontend", "gimli", - "hashbrown 0.11.2", - "lazy_static", "more-asserts", "rayon", "smallvec", @@ -2213,7 +1977,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-llvm" -version = "3.1.0" +version = "4.2.3" dependencies = [ "byteorder", "cc", @@ -2225,7 +1989,7 @@ dependencies = [ "rayon", "regex", "rustc_version", - "semver 1.0.13", + "semver", "smallvec", "target-lexicon", "wasmer-compiler", @@ -2235,78 +1999,66 @@ dependencies = [ [[package]] name = "wasmer-compiler-singlepass" -version = "3.1.0" +version = "4.2.3" dependencies = [ "byteorder", "dynasm", "dynasmrt", "enumset", "gimli", - "hashbrown 0.11.2", "lazy_static", "more-asserts", "rayon", "smallvec", - "target-lexicon", "wasmer-compiler", "wasmer-types", ] [[package]] name = "wasmer-derive" -version = "3.1.0" +version = "4.2.3" dependencies = [ - "compiletest_rs", "proc-macro-error", "proc-macro2", "quote", "syn 1.0.109", - "wasmer", -] - -[[package]] -name = "wasmer-object" -version = "3.1.0" -dependencies = [ - "object 0.28.4", - "thiserror", - "wasmer-types", ] [[package]] name = "wasmer-types" -version = "3.1.0" +version = "4.2.3" dependencies = [ + "bytecheck", "enum-iterator", "enumset", "indexmap", - "memoffset", "more-asserts", "rkyv", - "serde", - "serde_bytes", "target-lexicon", "thiserror", ] [[package]] name = "wasmer-vm" -version = "3.1.0" +version = "4.2.3" dependencies = [ "backtrace", "cc", "cfg-if", "corosensei", + "crossbeam-queue", + "dashmap", + "derivative", "enum-iterator", + "fnv", "indexmap", "lazy_static", "libc", "mach", - "memoffset", + "memoffset 0.8.0", "more-asserts", "region", "scopeguard", - "serde", "thiserror", "wasmer-types", "winapi", @@ -2314,15 +2066,19 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.83.0" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" +checksum = "f2ea896273ea99b15132414be1da01ab0d8836415083298ecaffbe308eaac87a" +dependencies = [ + "indexmap", + "url", +] [[package]] name = "wast" -version = "55.0.0" +version = "64.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4984d3e1406571f4930ba5cf79bd70f75f41d0e87e17506e0bd19b0e5d085f05" +checksum = "a259b226fd6910225aa7baeba82f9d9933b6d00f2ce1b49b80fa4214328237cc" dependencies = [ "leb128", "memchr", @@ -2332,23 +2088,13 @@ dependencies = [ [[package]] name = "wat" -version = "1.0.61" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af2b53f4da14db05d32e70e9c617abdf6620c575bd5dd972b7400037b4df2091" +checksum = "53253d920ab413fca1c7dc2161d601c79b4fdf631d0ba51dd4343bf9b556c3f6" dependencies = [ "wast", ] -[[package]] -name = "web-sys" -version = "0.3.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "winapi" version = "0.3.9" @@ -2384,28 +2130,6 @@ dependencies = [ "windows_x86_64_msvc 0.33.0", ] -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets", -] - [[package]] name = "windows-targets" version = "0.48.0" @@ -2433,12 +2157,6 @@ version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd761fd3eb9ab8cc1ed81e56e567f02dd82c4c837e48ac3b2181b9ffc5060807" -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - [[package]] name = "windows_aarch64_msvc" version = "0.48.0" @@ -2451,12 +2169,6 @@ version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cab0cf703a96bab2dc0c02c0fa748491294bf9b7feb27e1f4f96340f208ada0e" -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - [[package]] name = "windows_i686_gnu" version = "0.48.0" @@ -2469,12 +2181,6 @@ version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8cfdbe89cc9ad7ce618ba34abc34bbb6c36d99e96cae2245b7943cd75ee773d0" -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - [[package]] name = "windows_i686_msvc" version = "0.48.0" @@ -2487,12 +2193,6 @@ version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4dd9b0c0e9ece7bb22e84d70d01b71c6d6248b81a3c60d11869451b4cb24784" -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - [[package]] name = "windows_x86_64_gnu" version = "0.48.0" @@ -2513,12 +2213,15 @@ checksum = "ff1e4aa646495048ec7f3ffddc411e1d829c026a2ec62b39da15c1055e406eaa" [[package]] name = "windows_x86_64_msvc" -version = "0.36.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" +name = "wyz" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] diff --git a/arbitrator/Cargo.toml b/arbitrator/Cargo.toml index 979cfc77d..978e8c7f1 100644 --- a/arbitrator/Cargo.toml +++ b/arbitrator/Cargo.toml @@ -6,9 +6,21 @@ members = [ "jit", ] exclude = [ - "stylus/tests/" + "stylus/tests/", + "tools/wasmer/" ] resolver = "2" +[workspace.package] +authors = ["Offchain Labs"] +edition = "2021" +homepage = "https://arbitrum.io" +license = "BSL" +repository = "https://github.com/OffchainLabs/nitro.git" +rust-version = "1.67" + +[workspace.dependencies] +wasmparser = "0.95" + [profile.release] debug = true diff --git a/arbitrator/arbutil/Cargo.toml b/arbitrator/arbutil/Cargo.toml index e2a3a750e..c4b9c7035 100644 --- a/arbitrator/arbutil/Cargo.toml +++ b/arbitrator/arbutil/Cargo.toml @@ -10,7 +10,7 @@ hex = "0.4.3" num-traits = "0.2.17" sha3 = "0.10.5" siphasher = "0.3.10" -wasmparser = "0.83" +wasmparser.workspace = true serde = { version = "1.0.130", features = ["derive", "rc"] } [features] diff --git a/arbitrator/arbutil/src/operator.rs b/arbitrator/arbutil/src/operator.rs index f931f8701..87faca53f 100644 --- a/arbitrator/arbutil/src/operator.rs +++ b/arbitrator/arbutil/src/operator.rs @@ -349,7 +349,7 @@ impl Display for OperatorCode { 0xfd78 => "I8x16MaxS", 0xfd79 => "I8x16MaxU", 0xfd7a => "F64x2Trunc", - 0xfd7b => "I8x16RoundingAverageU", + 0xfd7b => "I8x16AvgrU", 0xfd7c => "I16x8ExtAddPairwiseI8x16S", 0xfd7d => "I16x8ExtAddPairwiseI8x16U", 0xfd7e => "I32x4ExtAddPairwiseI16x8S", @@ -380,7 +380,7 @@ impl Display for OperatorCode { 0xfd97 => "I16x8MinU", 0xfd98 => "I16x8MaxS", 0xfd99 => "I16x8MaxU", - 0xfd9b => "I16x8RoundingAverageU", + 0xfd9b => "I16x8AvgrU", 0xfd9c => "I16x8ExtMulLowI8x16S", 0xfd9d => "I16x8ExtMulHighI8x16S", 0xfd9e => "I16x8ExtMulLowI8x16U", @@ -400,11 +400,11 @@ impl Display for OperatorCode { 0xfdac => "I32x4ShrS", 0xfdad => "I32x4ShrU", 0xfdae => "I32x4Add", - 0xfdaf => "F32x4Fma", - 0xfdb0 => "F32x4Fms", + 0xfdaf => "F32x4RelaxedFma", + 0xfdb0 => "F32x4RelaxedFnma", 0xfdb1 => "I32x4Sub", - 0xfdb2 => "I8x16LaneSelect", - 0xfdb3 => "I16x8LaneSelect", + 0xfdb2 => "I8x16RelaxedLaneselect", + 0xfdb3 => "I16x8RelaxedLaneselect", 0xfdb4 => "F32x4RelaxedMin", 0xfdb5 => "I32x4Mul", 0xfdb6 => "I32x4MinS", @@ -430,11 +430,11 @@ impl Display for OperatorCode { 0xfdcc => "I64x2ShrS", 0xfdcd => "I64x2ShrU", 0xfdce => "I64x2Add", - 0xfdcf => "F64x2Fma", - 0xfdd0 => "F64x2Fms", + 0xfdcf => "F64x2RelaxedFma", + 0xfdd0 => "F64x2RelaxedFnma", 0xfdd1 => "I64x2Sub", - 0xfdd2 => "I32x4LaneSelect", - 0xfdd3 => "I64x2LaneSelect", + 0xfdd2 => "I32x4RelaxedLaneselect", + 0xfdd3 => "I64x2RelaxedLaneselect", 0xfdd4 => "F64x2RelaxedMin", 0xfdd5 => "I64x2Mul", 0xfdd6 => "I64x2Eq", @@ -546,6 +546,10 @@ impl Display for OperatorCode { 0xfe4c => "I64AtomicRmw8CmpxchgU", 0xfe4d => "I64AtomicRmw16CmpxchgU", 0xfe4e => "I64AtomicRmw32CmpxchgU", + 0xfd111 => "I16x8RelaxedQ15mulrS", + 0xfd112 => "I16x8DotI8x16I7x16S", + 0xfd113 => "I32x4DotI8x16I7x16AddS", + 0xfd114 => "F32x4RelaxedDotBf16x8AddF32x4", _ => "UNKNOWN", }; write!(f, "{name}") @@ -560,538 +564,542 @@ impl<'a> From> for OperatorCode { impl<'a> From<&Operator<'a>> for OperatorCode { fn from(op: &Operator) -> Self { - use Operator::*; + use Operator as O; OperatorCode(match op { - Unreachable => 0x00, - Nop => 0x01, - Block { .. } => 0x02, - Loop { .. } => 0x03, - If { .. } => 0x04, - Else => 0x05, - Try { .. } => 0x06, - Catch { .. } => 0x07, - Throw { .. } => 0x08, - Rethrow { .. } => 0x09, - End => 0x0b, - Br { .. } => 0x0c, - BrIf { .. } => 0x0d, - BrTable { .. } => 0x0e, - Return => 0x0f, - Call { .. } => 0x10, - CallIndirect { .. } => 0x11, - ReturnCall { .. } => 0x12, - ReturnCallIndirect { .. } => 0x13, - Delegate { .. } => 0x18, - CatchAll => 0x19, - Drop => 0x1a, - Select => 0x1b, - TypedSelect { .. } => 0x1c, - LocalGet { .. } => 0x20, - LocalSet { .. } => 0x21, - LocalTee { .. } => 0x22, - GlobalGet { .. } => 0x23, - GlobalSet { .. } => 0x24, - TableGet { .. } => 0x25, - TableSet { .. } => 0x26, - I32Load { .. } => 0x28, - I64Load { .. } => 0x29, - F32Load { .. } => 0x2a, - F64Load { .. } => 0x2b, - I32Load8S { .. } => 0x2c, - I32Load8U { .. } => 0x2d, - I32Load16S { .. } => 0x2e, - I32Load16U { .. } => 0x2f, - I64Load8S { .. } => 0x30, - I64Load8U { .. } => 0x31, - I64Load16S { .. } => 0x32, - I64Load16U { .. } => 0x33, - I64Load32S { .. } => 0x34, - I64Load32U { .. } => 0x35, - I32Store { .. } => 0x36, - I64Store { .. } => 0x37, - F32Store { .. } => 0x38, - F64Store { .. } => 0x39, - I32Store8 { .. } => 0x3a, - I32Store16 { .. } => 0x3b, - I64Store8 { .. } => 0x3c, - I64Store16 { .. } => 0x3d, - I64Store32 { .. } => 0x3e, - MemorySize { .. } => 0x3f, - MemoryGrow { .. } => 0x40, - I32Const { .. } => 0x41, - I64Const { .. } => 0x42, - F32Const { .. } => 0x43, - F64Const { .. } => 0x44, - I32Eqz => 0x45, - I32Eq => 0x46, - I32Ne => 0x47, - I32LtS => 0x48, - I32LtU => 0x49, - I32GtS => 0x4a, - I32GtU => 0x4b, - I32LeS => 0x4c, - I32LeU => 0x4d, - I32GeS => 0x4e, - I32GeU => 0x4f, - I64Eqz => 0x50, - I64Eq => 0x51, - I64Ne => 0x52, - I64LtS => 0x53, - I64LtU => 0x54, - I64GtS => 0x55, - I64GtU => 0x56, - I64LeS => 0x57, - I64LeU => 0x58, - I64GeS => 0x59, - I64GeU => 0x5a, - F32Eq => 0x5b, - F32Ne => 0x5c, - F32Lt => 0x5d, - F32Gt => 0x5e, - F32Le => 0x5f, - F32Ge => 0x60, - F64Eq => 0x61, - F64Ne => 0x62, - F64Lt => 0x63, - F64Gt => 0x64, - F64Le => 0x65, - F64Ge => 0x66, - I32Clz => 0x67, - I32Ctz => 0x68, - I32Popcnt => 0x69, - I32Add => 0x6a, - I32Sub => 0x6b, - I32Mul => 0x6c, - I32DivS => 0x6d, - I32DivU => 0x6e, - I32RemS => 0x6f, - I32RemU => 0x70, - I32And => 0x71, - I32Or => 0x72, - I32Xor => 0x73, - I32Shl => 0x74, - I32ShrS => 0x75, - I32ShrU => 0x76, - I32Rotl => 0x77, - I32Rotr => 0x78, - I64Clz => 0x79, - I64Ctz => 0x7a, - I64Popcnt => 0x7b, - I64Add => 0x7c, - I64Sub => 0x7d, - I64Mul => 0x7e, - I64DivS => 0x7f, - I64DivU => 0x80, - I64RemS => 0x81, - I64RemU => 0x82, - I64And => 0x83, - I64Or => 0x84, - I64Xor => 0x85, - I64Shl => 0x86, - I64ShrS => 0x87, - I64ShrU => 0x88, - I64Rotl => 0x89, - I64Rotr => 0x8a, - F32Abs => 0x8b, - F32Neg => 0x8c, - F32Ceil => 0x8d, - F32Floor => 0x8e, - F32Trunc => 0x8f, - F32Nearest => 0x90, - F32Sqrt => 0x91, - F32Add => 0x92, - F32Sub => 0x93, - F32Mul => 0x94, - F32Div => 0x95, - F32Min => 0x96, - F32Max => 0x97, - F32Copysign => 0x98, - F64Abs => 0x99, - F64Neg => 0x9a, - F64Ceil => 0x9b, - F64Floor => 0x9c, - F64Trunc => 0x9d, - F64Nearest => 0x9e, - F64Sqrt => 0x9f, - F64Add => 0xa0, - F64Sub => 0xa1, - F64Mul => 0xa2, - F64Div => 0xa3, - F64Min => 0xa4, - F64Max => 0xa5, - F64Copysign => 0xa6, - I32WrapI64 => 0xa7, - I32TruncF32S => 0xa8, - I32TruncF32U => 0xa9, - I32TruncF64S => 0xaa, - I32TruncF64U => 0xab, - I64ExtendI32S => 0xac, - I64ExtendI32U => 0xad, - I64TruncF32S => 0xae, - I64TruncF32U => 0xaf, - I64TruncF64S => 0xb0, - I64TruncF64U => 0xb1, - F32ConvertI32S => 0xb2, - F32ConvertI32U => 0xb3, - F32ConvertI64S => 0xb4, - F32ConvertI64U => 0xb5, - F32DemoteF64 => 0xb6, - F64ConvertI32S => 0xb7, - F64ConvertI32U => 0xb8, - F64ConvertI64S => 0xb9, - F64ConvertI64U => 0xba, - F64PromoteF32 => 0xbb, - I32ReinterpretF32 => 0xbc, - I64ReinterpretF64 => 0xbd, - F32ReinterpretI32 => 0xbe, - F64ReinterpretI64 => 0xbf, - I32Extend8S => 0xc0, - I32Extend16S => 0xc1, - I64Extend8S => 0xc2, - I64Extend16S => 0xc3, - I64Extend32S => 0xc4, - RefNull { .. } => 0xd0, - RefIsNull => 0xd1, - RefFunc { .. } => 0xd2, - I32TruncSatF32S => 0xfc00, - I32TruncSatF32U => 0xfc01, - I32TruncSatF64S => 0xfc02, - I32TruncSatF64U => 0xfc03, - I64TruncSatF32S => 0xfc04, - I64TruncSatF32U => 0xfc05, - I64TruncSatF64S => 0xfc06, - I64TruncSatF64U => 0xfc07, - MemoryInit { .. } => 0xfc08, - DataDrop { .. } => 0xfc09, - MemoryCopy { .. } => 0xfc0a, - MemoryFill { .. } => 0xfc0b, - TableInit { .. } => 0xfc0c, - ElemDrop { .. } => 0xfc0d, - TableCopy { .. } => 0xfc0e, - TableGrow { .. } => 0xfc0f, - TableSize { .. } => 0xfc10, - TableFill { .. } => 0xfc11, - V128Load { .. } => 0xfd00, - V128Load8x8S { .. } => 0xfd01, - V128Load8x8U { .. } => 0xfd02, - V128Load16x4S { .. } => 0xfd03, - V128Load16x4U { .. } => 0xfd04, - V128Load32x2S { .. } => 0xfd05, - V128Load32x2U { .. } => 0xfd06, - V128Load8Splat { .. } => 0xfd07, - V128Load16Splat { .. } => 0xfd08, - V128Load32Splat { .. } => 0xfd09, - V128Load64Splat { .. } => 0xfd0a, - V128Store { .. } => 0xfd0b, - V128Const { .. } => 0xfd0c, - I8x16Shuffle { .. } => 0xfd0d, - I8x16Swizzle => 0xfd0e, - I8x16Splat => 0xfd0f, - I16x8Splat => 0xfd10, - I32x4Splat => 0xfd11, - I64x2Splat => 0xfd12, - F32x4Splat => 0xfd13, - F64x2Splat => 0xfd14, - I8x16ExtractLaneS { .. } => 0xfd15, - I8x16ExtractLaneU { .. } => 0xfd16, - I8x16ReplaceLane { .. } => 0xfd17, - I16x8ExtractLaneS { .. } => 0xfd18, - I16x8ExtractLaneU { .. } => 0xfd19, - I16x8ReplaceLane { .. } => 0xfd1a, - I32x4ExtractLane { .. } => 0xfd1b, - I32x4ReplaceLane { .. } => 0xfd1c, - I64x2ExtractLane { .. } => 0xfd1d, - I64x2ReplaceLane { .. } => 0xfd1e, - F32x4ExtractLane { .. } => 0xfd1f, - F32x4ReplaceLane { .. } => 0xfd20, - F64x2ExtractLane { .. } => 0xfd21, - F64x2ReplaceLane { .. } => 0xfd22, - I8x16Eq => 0xfd23, - I8x16Ne => 0xfd24, - I8x16LtS => 0xfd25, - I8x16LtU => 0xfd26, - I8x16GtS => 0xfd27, - I8x16GtU => 0xfd28, - I8x16LeS => 0xfd29, - I8x16LeU => 0xfd2a, - I8x16GeS => 0xfd2b, - I8x16GeU => 0xfd2c, - I16x8Eq => 0xfd2d, - I16x8Ne => 0xfd2e, - I16x8LtS => 0xfd2f, - I16x8LtU => 0xfd30, - I16x8GtS => 0xfd31, - I16x8GtU => 0xfd32, - I16x8LeS => 0xfd33, - I16x8LeU => 0xfd34, - I16x8GeS => 0xfd35, - I16x8GeU => 0xfd36, - I32x4Eq => 0xfd37, - I32x4Ne => 0xfd38, - I32x4LtS => 0xfd39, - I32x4LtU => 0xfd3a, - I32x4GtS => 0xfd3b, - I32x4GtU => 0xfd3c, - I32x4LeS => 0xfd3d, - I32x4LeU => 0xfd3e, - I32x4GeS => 0xfd3f, - I32x4GeU => 0xfd40, - F32x4Eq => 0xfd41, - F32x4Ne => 0xfd42, - F32x4Lt => 0xfd43, - F32x4Gt => 0xfd44, - F32x4Le => 0xfd45, - F32x4Ge => 0xfd46, - F64x2Eq => 0xfd47, - F64x2Ne => 0xfd48, - F64x2Lt => 0xfd49, - F64x2Gt => 0xfd4a, - F64x2Le => 0xfd4b, - F64x2Ge => 0xfd4c, - V128Not => 0xfd4d, - V128And => 0xfd4e, - V128AndNot => 0xfd4f, - V128Or => 0xfd50, - V128Xor => 0xfd51, - V128Bitselect => 0xfd52, - V128AnyTrue => 0xfd53, - V128Load8Lane { .. } => 0xfd54, - V128Load16Lane { .. } => 0xfd55, - V128Load32Lane { .. } => 0xfd56, - V128Load64Lane { .. } => 0xfd57, - V128Store8Lane { .. } => 0xfd58, - V128Store16Lane { .. } => 0xfd59, - V128Store32Lane { .. } => 0xfd5a, - V128Store64Lane { .. } => 0xfd5b, - V128Load32Zero { .. } => 0xfd5c, - V128Load64Zero { .. } => 0xfd5d, - F32x4DemoteF64x2Zero => 0xfd5e, - F64x2PromoteLowF32x4 => 0xfd5f, - I8x16Abs => 0xfd60, - I8x16Neg => 0xfd61, - I8x16Popcnt => 0xfd62, - I8x16AllTrue => 0xfd63, - I8x16Bitmask => 0xfd64, - I8x16NarrowI16x8S => 0xfd65, - I8x16NarrowI16x8U => 0xfd66, - F32x4Ceil => 0xfd67, - F32x4Floor => 0xfd68, - F32x4Trunc => 0xfd69, - F32x4Nearest => 0xfd6a, - I8x16Shl => 0xfd6b, - I8x16ShrS => 0xfd6c, - I8x16ShrU => 0xfd6d, - I8x16Add => 0xfd6e, - I8x16AddSatS => 0xfd6f, - I8x16AddSatU => 0xfd70, - I8x16Sub => 0xfd71, - I8x16SubSatS => 0xfd72, - I8x16SubSatU => 0xfd73, - F64x2Ceil => 0xfd74, - F64x2Floor => 0xfd75, - I8x16MinS => 0xfd76, - I8x16MinU => 0xfd77, - I8x16MaxS => 0xfd78, - I8x16MaxU => 0xfd79, - F64x2Trunc => 0xfd7a, - I8x16RoundingAverageU => 0xfd7b, - I16x8ExtAddPairwiseI8x16S => 0xfd7c, - I16x8ExtAddPairwiseI8x16U => 0xfd7d, - I32x4ExtAddPairwiseI16x8S => 0xfd7e, - I32x4ExtAddPairwiseI16x8U => 0xfd7f, - I16x8Abs => 0xfd80, - I16x8Neg => 0xfd81, - I16x8Q15MulrSatS => 0xfd82, - I16x8AllTrue => 0xfd83, - I16x8Bitmask => 0xfd84, - I16x8NarrowI32x4S => 0xfd85, - I16x8NarrowI32x4U => 0xfd86, - I16x8ExtendLowI8x16S => 0xfd87, - I16x8ExtendHighI8x16S => 0xfd88, - I16x8ExtendLowI8x16U => 0xfd89, - I16x8ExtendHighI8x16U => 0xfd8a, - I16x8Shl => 0xfd8b, - I16x8ShrS => 0xfd8c, - I16x8ShrU => 0xfd8d, - I16x8Add => 0xfd8e, - I16x8AddSatS => 0xfd8f, - I16x8AddSatU => 0xfd90, - I16x8Sub => 0xfd91, - I16x8SubSatS => 0xfd92, - I16x8SubSatU => 0xfd93, - F64x2Nearest => 0xfd94, - I16x8Mul => 0xfd95, - I16x8MinS => 0xfd96, - I16x8MinU => 0xfd97, - I16x8MaxS => 0xfd98, - I16x8MaxU => 0xfd99, - I16x8RoundingAverageU => 0xfd9b, - I16x8ExtMulLowI8x16S => 0xfd9c, - I16x8ExtMulHighI8x16S => 0xfd9d, - I16x8ExtMulLowI8x16U => 0xfd9e, - I16x8ExtMulHighI8x16U => 0xfd9f, - I32x4Abs => 0xfda0, - I8x16RelaxedSwizzle => 0xfda2, - I32x4Neg => 0xfda1, - I32x4AllTrue => 0xfda3, - I32x4Bitmask => 0xfda4, - I32x4RelaxedTruncSatF32x4S => 0xfda5, - I32x4RelaxedTruncSatF32x4U => 0xfda6, - I32x4ExtendLowI16x8S => 0xfda7, - I32x4ExtendHighI16x8S => 0xfda8, - I32x4ExtendLowI16x8U => 0xfda9, - I32x4ExtendHighI16x8U => 0xfdaa, - I32x4Shl => 0xfdab, - I32x4ShrS => 0xfdac, - I32x4ShrU => 0xfdad, - I32x4Add => 0xfdae, - F32x4Fma => 0xfdaf, - F32x4Fms => 0xfdb0, - I32x4Sub => 0xfdb1, - I8x16LaneSelect => 0xfdb2, - I16x8LaneSelect => 0xfdb3, - F32x4RelaxedMin => 0xfdb4, - I32x4Mul => 0xfdb5, - I32x4MinS => 0xfdb6, - I32x4MinU => 0xfdb7, - I32x4MaxS => 0xfdb8, - I32x4MaxU => 0xfdb9, - I32x4DotI16x8S => 0xfdba, - I32x4ExtMulLowI16x8S => 0xfdbc, - I32x4ExtMulHighI16x8S => 0xfdbd, - I32x4ExtMulLowI16x8U => 0xfdbe, - I32x4ExtMulHighI16x8U => 0xfdbf, - I64x2Abs => 0xfdc0, - I64x2Neg => 0xfdc1, - I64x2AllTrue => 0xfdc3, - I64x2Bitmask => 0xfdc4, - I32x4RelaxedTruncSatF64x2SZero => 0xfdc5, - I32x4RelaxedTruncSatF64x2UZero => 0xfdc6, - I64x2ExtendLowI32x4S => 0xfdc7, - I64x2ExtendHighI32x4S => 0xfdc8, - I64x2ExtendLowI32x4U => 0xfdc9, - I64x2ExtendHighI32x4U => 0xfdca, - I64x2Shl => 0xfdcb, - I64x2ShrS => 0xfdcc, - I64x2ShrU => 0xfdcd, - I64x2Add => 0xfdce, - F64x2Fma => 0xfdcf, - F64x2Fms => 0xfdd0, - I64x2Sub => 0xfdd1, - I32x4LaneSelect => 0xfdd2, - I64x2LaneSelect => 0xfdd3, - F64x2RelaxedMin => 0xfdd4, - I64x2Mul => 0xfdd5, - I64x2Eq => 0xfdd6, - I64x2Ne => 0xfdd7, - I64x2LtS => 0xfdd8, - I64x2GtS => 0xfdd9, - I64x2LeS => 0xfdda, - I64x2GeS => 0xfddb, - I64x2ExtMulLowI32x4S => 0xfddc, - I64x2ExtMulHighI32x4S => 0xfddd, - I64x2ExtMulLowI32x4U => 0xfdde, - I64x2ExtMulHighI32x4U => 0xfddf, - F32x4Abs => 0xfde0, - F32x4Neg => 0xfde1, - F32x4RelaxedMax => 0xfde2, - F32x4Sqrt => 0xfde3, - F32x4Add => 0xfde4, - F32x4Sub => 0xfde5, - F32x4Mul => 0xfde6, - F32x4Div => 0xfde7, - F32x4Min => 0xfde8, - F32x4Max => 0xfde9, - F32x4PMin => 0xfdea, - F32x4PMax => 0xfdeb, - F64x2Abs => 0xfdec, - F64x2Neg => 0xfded, - F64x2RelaxedMax => 0xfdee, - F64x2Sqrt => 0xfdef, - F64x2Add => 0xfdf0, - F64x2Sub => 0xfdf1, - F64x2Mul => 0xfdf2, - F64x2Div => 0xfdf3, - F64x2Min => 0xfdf4, - F64x2Max => 0xfdf5, - F64x2PMin => 0xfdf6, - F64x2PMax => 0xfdf7, - I32x4TruncSatF32x4S => 0xfdf8, - I32x4TruncSatF32x4U => 0xfdf9, - F32x4ConvertI32x4S => 0xfdfa, - F32x4ConvertI32x4U => 0xfdfb, - I32x4TruncSatF64x2SZero => 0xfdfc, - I32x4TruncSatF64x2UZero => 0xfdfd, - F64x2ConvertLowI32x4S => 0xfdfe, - F64x2ConvertLowI32x4U => 0xfdff, - MemoryAtomicNotify { .. } => 0xfe00, - MemoryAtomicWait32 { .. } => 0xfe01, - MemoryAtomicWait64 { .. } => 0xfe02, - AtomicFence { .. } => 0xfe03, - I32AtomicLoad { .. } => 0xfe10, - I64AtomicLoad { .. } => 0xfe11, - I32AtomicLoad8U { .. } => 0xfe12, - I32AtomicLoad16U { .. } => 0xfe13, - I64AtomicLoad8U { .. } => 0xfe14, - I64AtomicLoad16U { .. } => 0xfe15, - I64AtomicLoad32U { .. } => 0xfe16, - I32AtomicStore { .. } => 0xfe17, - I64AtomicStore { .. } => 0xfe18, - I32AtomicStore8 { .. } => 0xfe19, - I32AtomicStore16 { .. } => 0xfe1a, - I64AtomicStore8 { .. } => 0xfe1b, - I64AtomicStore16 { .. } => 0xfe1c, - I64AtomicStore32 { .. } => 0xfe1d, - I32AtomicRmwAdd { .. } => 0xfe1e, - I64AtomicRmwAdd { .. } => 0xfe1f, - I32AtomicRmw8AddU { .. } => 0xfe20, - I32AtomicRmw16AddU { .. } => 0xfe21, - I64AtomicRmw8AddU { .. } => 0xfe22, - I64AtomicRmw16AddU { .. } => 0xfe23, - I64AtomicRmw32AddU { .. } => 0xfe24, - I32AtomicRmwSub { .. } => 0xfe25, - I64AtomicRmwSub { .. } => 0xfe26, - I32AtomicRmw8SubU { .. } => 0xfe27, - I32AtomicRmw16SubU { .. } => 0xfe28, - I64AtomicRmw8SubU { .. } => 0xfe29, - I64AtomicRmw16SubU { .. } => 0xfe2a, - I64AtomicRmw32SubU { .. } => 0xfe2b, - I32AtomicRmwAnd { .. } => 0xfe2c, - I64AtomicRmwAnd { .. } => 0xfe2d, - I32AtomicRmw8AndU { .. } => 0xfe2e, - I32AtomicRmw16AndU { .. } => 0xfe2f, - I64AtomicRmw8AndU { .. } => 0xfe30, - I64AtomicRmw16AndU { .. } => 0xfe31, - I64AtomicRmw32AndU { .. } => 0xfe32, - I32AtomicRmwOr { .. } => 0xfe33, - I64AtomicRmwOr { .. } => 0xfe34, - I32AtomicRmw8OrU { .. } => 0xfe35, - I32AtomicRmw16OrU { .. } => 0xfe36, - I64AtomicRmw8OrU { .. } => 0xfe37, - I64AtomicRmw16OrU { .. } => 0xfe38, - I64AtomicRmw32OrU { .. } => 0xfe39, - I32AtomicRmwXor { .. } => 0xfe3a, - I64AtomicRmwXor { .. } => 0xfe3b, - I32AtomicRmw8XorU { .. } => 0xfe3c, - I32AtomicRmw16XorU { .. } => 0xfe3d, - I64AtomicRmw8XorU { .. } => 0xfe3e, - I64AtomicRmw16XorU { .. } => 0xfe3f, - I64AtomicRmw32XorU { .. } => 0xfe40, - I32AtomicRmwXchg { .. } => 0xfe41, - I64AtomicRmwXchg { .. } => 0xfe42, - I32AtomicRmw8XchgU { .. } => 0xfe43, - I32AtomicRmw16XchgU { .. } => 0xfe44, - I64AtomicRmw8XchgU { .. } => 0xfe45, - I64AtomicRmw16XchgU { .. } => 0xfe46, - I64AtomicRmw32XchgU { .. } => 0xfe47, - I32AtomicRmwCmpxchg { .. } => 0xfe48, - I64AtomicRmwCmpxchg { .. } => 0xfe49, - I32AtomicRmw8CmpxchgU { .. } => 0xfe4a, - I32AtomicRmw16CmpxchgU { .. } => 0xfe4b, - I64AtomicRmw8CmpxchgU { .. } => 0xfe4c, - I64AtomicRmw16CmpxchgU { .. } => 0xfe4d, - I64AtomicRmw32CmpxchgU { .. } => 0xfe4e, + O::Unreachable => 0x00, + O::Nop => 0x01, + O::Block { .. } => 0x02, + O::Loop { .. } => 0x03, + O::If { .. } => 0x04, + O::Else => 0x05, + O::Try { .. } => 0x06, + O::Catch { .. } => 0x07, + O::Throw { .. } => 0x08, + O::Rethrow { .. } => 0x09, + O::End => 0x0b, + O::Br { .. } => 0x0c, + O::BrIf { .. } => 0x0d, + O::BrTable { .. } => 0x0e, + O::Return => 0x0f, + O::Call { .. } => 0x10, + O::CallIndirect { .. } => 0x11, + O::ReturnCall { .. } => 0x12, + O::ReturnCallIndirect { .. } => 0x13, + O::Delegate { .. } => 0x18, + O::CatchAll => 0x19, + O::Drop => 0x1a, + O::Select => 0x1b, + O::TypedSelect { .. } => 0x1c, + O::LocalGet { .. } => 0x20, + O::LocalSet { .. } => 0x21, + O::LocalTee { .. } => 0x22, + O::GlobalGet { .. } => 0x23, + O::GlobalSet { .. } => 0x24, + O::TableGet { .. } => 0x25, + O::TableSet { .. } => 0x26, + O::I32Load { .. } => 0x28, + O::I64Load { .. } => 0x29, + O::F32Load { .. } => 0x2a, + O::F64Load { .. } => 0x2b, + O::I32Load8S { .. } => 0x2c, + O::I32Load8U { .. } => 0x2d, + O::I32Load16S { .. } => 0x2e, + O::I32Load16U { .. } => 0x2f, + O::I64Load8S { .. } => 0x30, + O::I64Load8U { .. } => 0x31, + O::I64Load16S { .. } => 0x32, + O::I64Load16U { .. } => 0x33, + O::I64Load32S { .. } => 0x34, + O::I64Load32U { .. } => 0x35, + O::I32Store { .. } => 0x36, + O::I64Store { .. } => 0x37, + O::F32Store { .. } => 0x38, + O::F64Store { .. } => 0x39, + O::I32Store8 { .. } => 0x3a, + O::I32Store16 { .. } => 0x3b, + O::I64Store8 { .. } => 0x3c, + O::I64Store16 { .. } => 0x3d, + O::I64Store32 { .. } => 0x3e, + O::MemorySize { .. } => 0x3f, + O::MemoryGrow { .. } => 0x40, + O::I32Const { .. } => 0x41, + O::I64Const { .. } => 0x42, + O::F32Const { .. } => 0x43, + O::F64Const { .. } => 0x44, + O::I32Eqz => 0x45, + O::I32Eq => 0x46, + O::I32Ne => 0x47, + O::I32LtS => 0x48, + O::I32LtU => 0x49, + O::I32GtS => 0x4a, + O::I32GtU => 0x4b, + O::I32LeS => 0x4c, + O::I32LeU => 0x4d, + O::I32GeS => 0x4e, + O::I32GeU => 0x4f, + O::I64Eqz => 0x50, + O::I64Eq => 0x51, + O::I64Ne => 0x52, + O::I64LtS => 0x53, + O::I64LtU => 0x54, + O::I64GtS => 0x55, + O::I64GtU => 0x56, + O::I64LeS => 0x57, + O::I64LeU => 0x58, + O::I64GeS => 0x59, + O::I64GeU => 0x5a, + O::F32Eq => 0x5b, + O::F32Ne => 0x5c, + O::F32Lt => 0x5d, + O::F32Gt => 0x5e, + O::F32Le => 0x5f, + O::F32Ge => 0x60, + O::F64Eq => 0x61, + O::F64Ne => 0x62, + O::F64Lt => 0x63, + O::F64Gt => 0x64, + O::F64Le => 0x65, + O::F64Ge => 0x66, + O::I32Clz => 0x67, + O::I32Ctz => 0x68, + O::I32Popcnt => 0x69, + O::I32Add => 0x6a, + O::I32Sub => 0x6b, + O::I32Mul => 0x6c, + O::I32DivS => 0x6d, + O::I32DivU => 0x6e, + O::I32RemS => 0x6f, + O::I32RemU => 0x70, + O::I32And => 0x71, + O::I32Or => 0x72, + O::I32Xor => 0x73, + O::I32Shl => 0x74, + O::I32ShrS => 0x75, + O::I32ShrU => 0x76, + O::I32Rotl => 0x77, + O::I32Rotr => 0x78, + O::I64Clz => 0x79, + O::I64Ctz => 0x7a, + O::I64Popcnt => 0x7b, + O::I64Add => 0x7c, + O::I64Sub => 0x7d, + O::I64Mul => 0x7e, + O::I64DivS => 0x7f, + O::I64DivU => 0x80, + O::I64RemS => 0x81, + O::I64RemU => 0x82, + O::I64And => 0x83, + O::I64Or => 0x84, + O::I64Xor => 0x85, + O::I64Shl => 0x86, + O::I64ShrS => 0x87, + O::I64ShrU => 0x88, + O::I64Rotl => 0x89, + O::I64Rotr => 0x8a, + O::F32Abs => 0x8b, + O::F32Neg => 0x8c, + O::F32Ceil => 0x8d, + O::F32Floor => 0x8e, + O::F32Trunc => 0x8f, + O::F32Nearest => 0x90, + O::F32Sqrt => 0x91, + O::F32Add => 0x92, + O::F32Sub => 0x93, + O::F32Mul => 0x94, + O::F32Div => 0x95, + O::F32Min => 0x96, + O::F32Max => 0x97, + O::F32Copysign => 0x98, + O::F64Abs => 0x99, + O::F64Neg => 0x9a, + O::F64Ceil => 0x9b, + O::F64Floor => 0x9c, + O::F64Trunc => 0x9d, + O::F64Nearest => 0x9e, + O::F64Sqrt => 0x9f, + O::F64Add => 0xa0, + O::F64Sub => 0xa1, + O::F64Mul => 0xa2, + O::F64Div => 0xa3, + O::F64Min => 0xa4, + O::F64Max => 0xa5, + O::F64Copysign => 0xa6, + O::I32WrapI64 => 0xa7, + O::I32TruncF32S => 0xa8, + O::I32TruncF32U => 0xa9, + O::I32TruncF64S => 0xaa, + O::I32TruncF64U => 0xab, + O::I64ExtendI32S => 0xac, + O::I64ExtendI32U => 0xad, + O::I64TruncF32S => 0xae, + O::I64TruncF32U => 0xaf, + O::I64TruncF64S => 0xb0, + O::I64TruncF64U => 0xb1, + O::F32ConvertI32S => 0xb2, + O::F32ConvertI32U => 0xb3, + O::F32ConvertI64S => 0xb4, + O::F32ConvertI64U => 0xb5, + O::F32DemoteF64 => 0xb6, + O::F64ConvertI32S => 0xb7, + O::F64ConvertI32U => 0xb8, + O::F64ConvertI64S => 0xb9, + O::F64ConvertI64U => 0xba, + O::F64PromoteF32 => 0xbb, + O::I32ReinterpretF32 => 0xbc, + O::I64ReinterpretF64 => 0xbd, + O::F32ReinterpretI32 => 0xbe, + O::F64ReinterpretI64 => 0xbf, + O::I32Extend8S => 0xc0, + O::I32Extend16S => 0xc1, + O::I64Extend8S => 0xc2, + O::I64Extend16S => 0xc3, + O::I64Extend32S => 0xc4, + O::RefNull { .. } => 0xd0, + O::RefIsNull => 0xd1, + O::RefFunc { .. } => 0xd2, + O::I32TruncSatF32S => 0xfc00, + O::I32TruncSatF32U => 0xfc01, + O::I32TruncSatF64S => 0xfc02, + O::I32TruncSatF64U => 0xfc03, + O::I64TruncSatF32S => 0xfc04, + O::I64TruncSatF32U => 0xfc05, + O::I64TruncSatF64S => 0xfc06, + O::I64TruncSatF64U => 0xfc07, + O::MemoryInit { .. } => 0xfc08, + O::DataDrop { .. } => 0xfc09, + O::MemoryCopy { .. } => 0xfc0a, + O::MemoryFill { .. } => 0xfc0b, + O::TableInit { .. } => 0xfc0c, + O::ElemDrop { .. } => 0xfc0d, + O::TableCopy { .. } => 0xfc0e, + O::TableGrow { .. } => 0xfc0f, + O::TableSize { .. } => 0xfc10, + O::TableFill { .. } => 0xfc11, + O::V128Load { .. } => 0xfd00, + O::V128Load8x8S { .. } => 0xfd01, + O::V128Load8x8U { .. } => 0xfd02, + O::V128Load16x4S { .. } => 0xfd03, + O::V128Load16x4U { .. } => 0xfd04, + O::V128Load32x2S { .. } => 0xfd05, + O::V128Load32x2U { .. } => 0xfd06, + O::V128Load8Splat { .. } => 0xfd07, + O::V128Load16Splat { .. } => 0xfd08, + O::V128Load32Splat { .. } => 0xfd09, + O::V128Load64Splat { .. } => 0xfd0a, + O::V128Store { .. } => 0xfd0b, + O::V128Const { .. } => 0xfd0c, + O::I8x16Shuffle { .. } => 0xfd0d, + O::I8x16Swizzle => 0xfd0e, + O::I8x16Splat => 0xfd0f, + O::I16x8Splat => 0xfd10, + O::I32x4Splat => 0xfd11, + O::I64x2Splat => 0xfd12, + O::F32x4Splat => 0xfd13, + O::F64x2Splat => 0xfd14, + O::I8x16ExtractLaneS { .. } => 0xfd15, + O::I8x16ExtractLaneU { .. } => 0xfd16, + O::I8x16ReplaceLane { .. } => 0xfd17, + O::I16x8ExtractLaneS { .. } => 0xfd18, + O::I16x8ExtractLaneU { .. } => 0xfd19, + O::I16x8ReplaceLane { .. } => 0xfd1a, + O::I32x4ExtractLane { .. } => 0xfd1b, + O::I32x4ReplaceLane { .. } => 0xfd1c, + O::I64x2ExtractLane { .. } => 0xfd1d, + O::I64x2ReplaceLane { .. } => 0xfd1e, + O::F32x4ExtractLane { .. } => 0xfd1f, + O::F32x4ReplaceLane { .. } => 0xfd20, + O::F64x2ExtractLane { .. } => 0xfd21, + O::F64x2ReplaceLane { .. } => 0xfd22, + O::I8x16Eq => 0xfd23, + O::I8x16Ne => 0xfd24, + O::I8x16LtS => 0xfd25, + O::I8x16LtU => 0xfd26, + O::I8x16GtS => 0xfd27, + O::I8x16GtU => 0xfd28, + O::I8x16LeS => 0xfd29, + O::I8x16LeU => 0xfd2a, + O::I8x16GeS => 0xfd2b, + O::I8x16GeU => 0xfd2c, + O::I16x8Eq => 0xfd2d, + O::I16x8Ne => 0xfd2e, + O::I16x8LtS => 0xfd2f, + O::I16x8LtU => 0xfd30, + O::I16x8GtS => 0xfd31, + O::I16x8GtU => 0xfd32, + O::I16x8LeS => 0xfd33, + O::I16x8LeU => 0xfd34, + O::I16x8GeS => 0xfd35, + O::I16x8GeU => 0xfd36, + O::I32x4Eq => 0xfd37, + O::I32x4Ne => 0xfd38, + O::I32x4LtS => 0xfd39, + O::I32x4LtU => 0xfd3a, + O::I32x4GtS => 0xfd3b, + O::I32x4GtU => 0xfd3c, + O::I32x4LeS => 0xfd3d, + O::I32x4LeU => 0xfd3e, + O::I32x4GeS => 0xfd3f, + O::I32x4GeU => 0xfd40, + O::F32x4Eq => 0xfd41, + O::F32x4Ne => 0xfd42, + O::F32x4Lt => 0xfd43, + O::F32x4Gt => 0xfd44, + O::F32x4Le => 0xfd45, + O::F32x4Ge => 0xfd46, + O::F64x2Eq => 0xfd47, + O::F64x2Ne => 0xfd48, + O::F64x2Lt => 0xfd49, + O::F64x2Gt => 0xfd4a, + O::F64x2Le => 0xfd4b, + O::F64x2Ge => 0xfd4c, + O::V128Not => 0xfd4d, + O::V128And => 0xfd4e, + O::V128AndNot => 0xfd4f, + O::V128Or => 0xfd50, + O::V128Xor => 0xfd51, + O::V128Bitselect => 0xfd52, + O::V128AnyTrue => 0xfd53, + O::V128Load8Lane { .. } => 0xfd54, + O::V128Load16Lane { .. } => 0xfd55, + O::V128Load32Lane { .. } => 0xfd56, + O::V128Load64Lane { .. } => 0xfd57, + O::V128Store8Lane { .. } => 0xfd58, + O::V128Store16Lane { .. } => 0xfd59, + O::V128Store32Lane { .. } => 0xfd5a, + O::V128Store64Lane { .. } => 0xfd5b, + O::V128Load32Zero { .. } => 0xfd5c, + O::V128Load64Zero { .. } => 0xfd5d, + O::F32x4DemoteF64x2Zero => 0xfd5e, + O::F64x2PromoteLowF32x4 => 0xfd5f, + O::I8x16Abs => 0xfd60, + O::I8x16Neg => 0xfd61, + O::I8x16Popcnt => 0xfd62, + O::I8x16AllTrue => 0xfd63, + O::I8x16Bitmask => 0xfd64, + O::I8x16NarrowI16x8S => 0xfd65, + O::I8x16NarrowI16x8U => 0xfd66, + O::F32x4Ceil => 0xfd67, + O::F32x4Floor => 0xfd68, + O::F32x4Trunc => 0xfd69, + O::F32x4Nearest => 0xfd6a, + O::I8x16Shl => 0xfd6b, + O::I8x16ShrS => 0xfd6c, + O::I8x16ShrU => 0xfd6d, + O::I8x16Add => 0xfd6e, + O::I8x16AddSatS => 0xfd6f, + O::I8x16AddSatU => 0xfd70, + O::I8x16Sub => 0xfd71, + O::I8x16SubSatS => 0xfd72, + O::I8x16SubSatU => 0xfd73, + O::F64x2Ceil => 0xfd74, + O::F64x2Floor => 0xfd75, + O::I8x16MinS => 0xfd76, + O::I8x16MinU => 0xfd77, + O::I8x16MaxS => 0xfd78, + O::I8x16MaxU => 0xfd79, + O::F64x2Trunc => 0xfd7a, + O::I8x16AvgrU => 0xfd7b, + O::I16x8ExtAddPairwiseI8x16S => 0xfd7c, + O::I16x8ExtAddPairwiseI8x16U => 0xfd7d, + O::I32x4ExtAddPairwiseI16x8S => 0xfd7e, + O::I32x4ExtAddPairwiseI16x8U => 0xfd7f, + O::I16x8Abs => 0xfd80, + O::I16x8Neg => 0xfd81, + O::I16x8Q15MulrSatS => 0xfd82, + O::I16x8AllTrue => 0xfd83, + O::I16x8Bitmask => 0xfd84, + O::I16x8NarrowI32x4S => 0xfd85, + O::I16x8NarrowI32x4U => 0xfd86, + O::I16x8ExtendLowI8x16S => 0xfd87, + O::I16x8ExtendHighI8x16S => 0xfd88, + O::I16x8ExtendLowI8x16U => 0xfd89, + O::I16x8ExtendHighI8x16U => 0xfd8a, + O::I16x8Shl => 0xfd8b, + O::I16x8ShrS => 0xfd8c, + O::I16x8ShrU => 0xfd8d, + O::I16x8Add => 0xfd8e, + O::I16x8AddSatS => 0xfd8f, + O::I16x8AddSatU => 0xfd90, + O::I16x8Sub => 0xfd91, + O::I16x8SubSatS => 0xfd92, + O::I16x8SubSatU => 0xfd93, + O::F64x2Nearest => 0xfd94, + O::I16x8Mul => 0xfd95, + O::I16x8MinS => 0xfd96, + O::I16x8MinU => 0xfd97, + O::I16x8MaxS => 0xfd98, + O::I16x8MaxU => 0xfd99, + O::I16x8AvgrU => 0xfd9b, + O::I16x8ExtMulLowI8x16S => 0xfd9c, + O::I16x8ExtMulHighI8x16S => 0xfd9d, + O::I16x8ExtMulLowI8x16U => 0xfd9e, + O::I16x8ExtMulHighI8x16U => 0xfd9f, + O::I32x4Abs => 0xfda0, + O::I8x16RelaxedSwizzle => 0xfda2, + O::I32x4Neg => 0xfda1, + O::I32x4AllTrue => 0xfda3, + O::I32x4Bitmask => 0xfda4, + O::I32x4RelaxedTruncSatF32x4S => 0xfda5, + O::I32x4RelaxedTruncSatF32x4U => 0xfda6, + O::I32x4ExtendLowI16x8S => 0xfda7, + O::I32x4ExtendHighI16x8S => 0xfda8, + O::I32x4ExtendLowI16x8U => 0xfda9, + O::I32x4ExtendHighI16x8U => 0xfdaa, + O::I32x4Shl => 0xfdab, + O::I32x4ShrS => 0xfdac, + O::I32x4ShrU => 0xfdad, + O::I32x4Add => 0xfdae, + O::F32x4RelaxedFma => 0xfdaf, + O::F32x4RelaxedFnma => 0xfdb0, + O::I32x4Sub => 0xfdb1, + O::I8x16RelaxedLaneselect => 0xfdb2, + O::I16x8RelaxedLaneselect => 0xfdb3, + O::F32x4RelaxedMin => 0xfdb4, + O::I32x4Mul => 0xfdb5, + O::I32x4MinS => 0xfdb6, + O::I32x4MinU => 0xfdb7, + O::I32x4MaxS => 0xfdb8, + O::I32x4MaxU => 0xfdb9, + O::I32x4DotI16x8S => 0xfdba, + O::I32x4ExtMulLowI16x8S => 0xfdbc, + O::I32x4ExtMulHighI16x8S => 0xfdbd, + O::I32x4ExtMulLowI16x8U => 0xfdbe, + O::I32x4ExtMulHighI16x8U => 0xfdbf, + O::I64x2Abs => 0xfdc0, + O::I64x2Neg => 0xfdc1, + O::I64x2AllTrue => 0xfdc3, + O::I64x2Bitmask => 0xfdc4, + O::I32x4RelaxedTruncSatF64x2SZero => 0xfdc5, + O::I32x4RelaxedTruncSatF64x2UZero => 0xfdc6, + O::I64x2ExtendLowI32x4S => 0xfdc7, + O::I64x2ExtendHighI32x4S => 0xfdc8, + O::I64x2ExtendLowI32x4U => 0xfdc9, + O::I64x2ExtendHighI32x4U => 0xfdca, + O::I64x2Shl => 0xfdcb, + O::I64x2ShrS => 0xfdcc, + O::I64x2ShrU => 0xfdcd, + O::I64x2Add => 0xfdce, + O::F64x2RelaxedFma => 0xfdcf, + O::F64x2RelaxedFnma => 0xfdd0, + O::I64x2Sub => 0xfdd1, + O::I32x4RelaxedLaneselect => 0xfdd2, + O::I64x2RelaxedLaneselect => 0xfdd3, + O::F64x2RelaxedMin => 0xfdd4, + O::I64x2Mul => 0xfdd5, + O::I64x2Eq => 0xfdd6, + O::I64x2Ne => 0xfdd7, + O::I64x2LtS => 0xfdd8, + O::I64x2GtS => 0xfdd9, + O::I64x2LeS => 0xfdda, + O::I64x2GeS => 0xfddb, + O::I64x2ExtMulLowI32x4S => 0xfddc, + O::I64x2ExtMulHighI32x4S => 0xfddd, + O::I64x2ExtMulLowI32x4U => 0xfdde, + O::I64x2ExtMulHighI32x4U => 0xfddf, + O::F32x4Abs => 0xfde0, + O::F32x4Neg => 0xfde1, + O::F32x4RelaxedMax => 0xfde2, + O::F32x4Sqrt => 0xfde3, + O::F32x4Add => 0xfde4, + O::F32x4Sub => 0xfde5, + O::F32x4Mul => 0xfde6, + O::F32x4Div => 0xfde7, + O::F32x4Min => 0xfde8, + O::F32x4Max => 0xfde9, + O::F32x4PMin => 0xfdea, + O::F32x4PMax => 0xfdeb, + O::F64x2Abs => 0xfdec, + O::F64x2Neg => 0xfded, + O::F64x2RelaxedMax => 0xfdee, + O::F64x2Sqrt => 0xfdef, + O::F64x2Add => 0xfdf0, + O::F64x2Sub => 0xfdf1, + O::F64x2Mul => 0xfdf2, + O::F64x2Div => 0xfdf3, + O::F64x2Min => 0xfdf4, + O::F64x2Max => 0xfdf5, + O::F64x2PMin => 0xfdf6, + O::F64x2PMax => 0xfdf7, + O::I32x4TruncSatF32x4S => 0xfdf8, + O::I32x4TruncSatF32x4U => 0xfdf9, + O::F32x4ConvertI32x4S => 0xfdfa, + O::F32x4ConvertI32x4U => 0xfdfb, + O::I32x4TruncSatF64x2SZero => 0xfdfc, + O::I32x4TruncSatF64x2UZero => 0xfdfd, + O::F64x2ConvertLowI32x4S => 0xfdfe, + O::F64x2ConvertLowI32x4U => 0xfdff, + O::MemoryAtomicNotify { .. } => 0xfe00, + O::MemoryAtomicWait32 { .. } => 0xfe01, + O::MemoryAtomicWait64 { .. } => 0xfe02, + O::AtomicFence { .. } => 0xfe03, + O::I32AtomicLoad { .. } => 0xfe10, + O::I64AtomicLoad { .. } => 0xfe11, + O::I32AtomicLoad8U { .. } => 0xfe12, + O::I32AtomicLoad16U { .. } => 0xfe13, + O::I64AtomicLoad8U { .. } => 0xfe14, + O::I64AtomicLoad16U { .. } => 0xfe15, + O::I64AtomicLoad32U { .. } => 0xfe16, + O::I32AtomicStore { .. } => 0xfe17, + O::I64AtomicStore { .. } => 0xfe18, + O::I32AtomicStore8 { .. } => 0xfe19, + O::I32AtomicStore16 { .. } => 0xfe1a, + O::I64AtomicStore8 { .. } => 0xfe1b, + O::I64AtomicStore16 { .. } => 0xfe1c, + O::I64AtomicStore32 { .. } => 0xfe1d, + O::I32AtomicRmwAdd { .. } => 0xfe1e, + O::I64AtomicRmwAdd { .. } => 0xfe1f, + O::I32AtomicRmw8AddU { .. } => 0xfe20, + O::I32AtomicRmw16AddU { .. } => 0xfe21, + O::I64AtomicRmw8AddU { .. } => 0xfe22, + O::I64AtomicRmw16AddU { .. } => 0xfe23, + O::I64AtomicRmw32AddU { .. } => 0xfe24, + O::I32AtomicRmwSub { .. } => 0xfe25, + O::I64AtomicRmwSub { .. } => 0xfe26, + O::I32AtomicRmw8SubU { .. } => 0xfe27, + O::I32AtomicRmw16SubU { .. } => 0xfe28, + O::I64AtomicRmw8SubU { .. } => 0xfe29, + O::I64AtomicRmw16SubU { .. } => 0xfe2a, + O::I64AtomicRmw32SubU { .. } => 0xfe2b, + O::I32AtomicRmwAnd { .. } => 0xfe2c, + O::I64AtomicRmwAnd { .. } => 0xfe2d, + O::I32AtomicRmw8AndU { .. } => 0xfe2e, + O::I32AtomicRmw16AndU { .. } => 0xfe2f, + O::I64AtomicRmw8AndU { .. } => 0xfe30, + O::I64AtomicRmw16AndU { .. } => 0xfe31, + O::I64AtomicRmw32AndU { .. } => 0xfe32, + O::I32AtomicRmwOr { .. } => 0xfe33, + O::I64AtomicRmwOr { .. } => 0xfe34, + O::I32AtomicRmw8OrU { .. } => 0xfe35, + O::I32AtomicRmw16OrU { .. } => 0xfe36, + O::I64AtomicRmw8OrU { .. } => 0xfe37, + O::I64AtomicRmw16OrU { .. } => 0xfe38, + O::I64AtomicRmw32OrU { .. } => 0xfe39, + O::I32AtomicRmwXor { .. } => 0xfe3a, + O::I64AtomicRmwXor { .. } => 0xfe3b, + O::I32AtomicRmw8XorU { .. } => 0xfe3c, + O::I32AtomicRmw16XorU { .. } => 0xfe3d, + O::I64AtomicRmw8XorU { .. } => 0xfe3e, + O::I64AtomicRmw16XorU { .. } => 0xfe3f, + O::I64AtomicRmw32XorU { .. } => 0xfe40, + O::I32AtomicRmwXchg { .. } => 0xfe41, + O::I64AtomicRmwXchg { .. } => 0xfe42, + O::I32AtomicRmw8XchgU { .. } => 0xfe43, + O::I32AtomicRmw16XchgU { .. } => 0xfe44, + O::I64AtomicRmw8XchgU { .. } => 0xfe45, + O::I64AtomicRmw16XchgU { .. } => 0xfe46, + O::I64AtomicRmw32XchgU { .. } => 0xfe47, + O::I32AtomicRmwCmpxchg { .. } => 0xfe48, + O::I64AtomicRmwCmpxchg { .. } => 0xfe49, + O::I32AtomicRmw8CmpxchgU { .. } => 0xfe4a, + O::I32AtomicRmw16CmpxchgU { .. } => 0xfe4b, + O::I64AtomicRmw8CmpxchgU { .. } => 0xfe4c, + O::I64AtomicRmw16CmpxchgU { .. } => 0xfe4d, + O::I64AtomicRmw32CmpxchgU { .. } => 0xfe4e, + O::I16x8RelaxedQ15mulrS { .. } => 0xfd111, + O::I16x8DotI8x16I7x16S { .. } => 0xfd112, + O::I32x4DotI8x16I7x16AddS { .. } => 0xfd113, + O::F32x4RelaxedDotBf16x8AddF32x4 { .. } => 0xfd114, }) } } diff --git a/arbitrator/jit/Cargo.toml b/arbitrator/jit/Cargo.toml index bdaca5a58..75effe73f 100644 --- a/arbitrator/jit/Cargo.toml +++ b/arbitrator/jit/Cargo.toml @@ -20,7 +20,6 @@ hex = "0.4.3" structopt = "0.3.26" sha3 = "0.9.1" libc = "0.2.132" -ouroboros = "0.16.0" [features] llvm = ["dep:wasmer-compiler-llvm"] diff --git a/arbitrator/jit/src/arbcompress.rs b/arbitrator/jit/src/arbcompress.rs index 710bf8767..d90a9378a 100644 --- a/arbitrator/jit/src/arbcompress.rs +++ b/arbitrator/jit/src/arbcompress.rs @@ -32,8 +32,8 @@ pub enum BrotliStatus { } /// go side: λ(inBuf []byte, outBuf []byte, level, windowSize uint64) (outLen uint64, status BrotliStatus) -pub fn brotli_compress(env: WasmEnvMut, sp: u32) { - let mut sp = GoStack::simple(sp, &env); +pub fn brotli_compress(mut env: WasmEnvMut, sp: u32) { + let mut sp = GoStack::simple(sp, &mut env); let (in_buf_ptr, in_buf_len) = sp.read_go_slice(); let (out_buf_ptr, out_buf_len) = sp.read_go_slice(); let level = sp.read_u32(); @@ -66,8 +66,8 @@ pub fn brotli_compress(env: WasmEnvMut, sp: u32) { } /// go side: λ(inBuf []byte, outBuf []byte) (outLen uint64, status BrotliStatus) -pub fn brotli_decompress(env: WasmEnvMut, sp: u32) { - let mut sp = GoStack::simple(sp, &env); +pub fn brotli_decompress(mut env: WasmEnvMut, sp: u32) { + let mut sp = GoStack::simple(sp, &mut env); let (in_buf_ptr, in_buf_len) = sp.read_go_slice(); let (out_buf_ptr, out_buf_len) = sp.read_go_slice(); diff --git a/arbitrator/jit/src/gostack.rs b/arbitrator/jit/src/gostack.rs index 5436bfbaf..4daa3b654 100644 --- a/arbitrator/jit/src/gostack.rs +++ b/arbitrator/jit/src/gostack.rs @@ -9,76 +9,41 @@ use crate::{ }; use eyre::Result; use go_js::JsValueId; -use ouroboros::self_referencing; use rand_pcg::Pcg32; use std::{ collections::{BTreeSet, BinaryHeap}, fmt::Debug, }; -use wasmer::{AsStoreRef, Memory, MemoryView, StoreMut, StoreRef, WasmPtr}; - -#[self_referencing] -struct MemoryViewContainer { - memory: Memory, - #[borrows(memory)] - #[covariant] - view: MemoryView<'this>, -} - -impl MemoryViewContainer { - fn create(env: &WasmEnvMut<'_>) -> Self { - // this func exists to properly constrain the closure's type - fn closure<'a>( - store: &'a StoreRef, - ) -> impl (for<'b> FnOnce(&'b Memory) -> MemoryView<'b>) + 'a { - move |memory: &Memory| memory.view(&store) - } +use wasmer::{Memory, MemoryView, StoreMut, WasmPtr}; - let store = env.as_store_ref(); - let memory = env.data().memory.clone().unwrap(); - let view_builder = closure(&store); - MemoryViewContainerBuilder { - memory, - view_builder, - } - .build() - } - - fn view(&self) -> &MemoryView { - self.borrow_view() - } -} - -pub struct GoStack { +pub struct GoStack<'s> { pub sp: u32, pub top: u32, - memory: MemoryViewContainer, + pub memory: Memory, + pub store: StoreMut<'s>, } #[allow(dead_code)] -impl GoStack { - pub fn new<'a, 'b: 'a>(start: u32, env: &'a mut WasmEnvMut<'b>) -> (Self, &'a mut WasmEnv) { - let sp = Self::simple(start, env); - (sp, env.data_mut()) - } - - pub fn new_with_store<'a, 'b: 'a>( - start: u32, - env: &'a mut WasmEnvMut<'b>, - ) -> (Self, &'a mut WasmEnv, StoreMut<'a>) { - let sp = Self::simple(start, env); - let (env, store) = env.data_and_store_mut(); - (sp, env, store) +impl<'s> GoStack<'s> { + pub fn new(sp: u32, env: &'s mut WasmEnvMut) -> (Self, &'s mut WasmEnv) { + let top = sp + 8; + let memory = env.data().memory.clone().unwrap(); + let (data, store) = env.data_and_store_mut(); + let sp = Self { + sp, + top, + memory, + store, + }; + (sp, data) } - pub fn simple(sp: u32, env: &WasmEnvMut<'_>) -> Self { - let top = sp + 8; - let memory = MemoryViewContainer::create(env); - Self { sp, top, memory } + pub fn simple(sp: u32, env: &'s mut WasmEnvMut<'_>) -> Self { + Self::new(sp, env).0 } - fn view(&self) -> &MemoryView { - self.memory.view() + fn view(&self) -> MemoryView { + self.memory.view(&self.store) } /// Returns the memory size, in bytes. @@ -115,22 +80,22 @@ impl GoStack { pub fn read_u8_raw(&self, ptr: u32) -> u8 { let ptr: WasmPtr = WasmPtr::new(ptr); - ptr.deref(self.view()).read().unwrap() + ptr.deref(&self.view()).read().unwrap() } pub fn read_u16_raw(&self, ptr: u32) -> u16 { let ptr: WasmPtr = WasmPtr::new(ptr); - ptr.deref(self.view()).read().unwrap() + ptr.deref(&self.view()).read().unwrap() } pub fn read_u32_raw(&self, ptr: u32) -> u32 { let ptr: WasmPtr = WasmPtr::new(ptr); - ptr.deref(self.view()).read().unwrap() + ptr.deref(&self.view()).read().unwrap() } pub fn read_u64_raw(&self, ptr: u32) -> u64 { let ptr: WasmPtr = WasmPtr::new(ptr); - ptr.deref(self.view()).read().unwrap() + ptr.deref(&self.view()).read().unwrap() } pub fn read_ptr(&mut self) -> *const T { @@ -183,25 +148,25 @@ impl GoStack { pub fn write_u8_raw(&mut self, ptr: u32, x: u8) -> &mut Self { let ptr: WasmPtr = WasmPtr::new(ptr); - ptr.deref(self.view()).write(x).unwrap(); + ptr.deref(&self.view()).write(x).unwrap(); self } pub fn write_u16_raw(&mut self, ptr: u32, x: u16) -> &mut Self { let ptr: WasmPtr = WasmPtr::new(ptr); - ptr.deref(self.view()).write(x).unwrap(); + ptr.deref(&self.view()).write(x).unwrap(); self } pub fn write_u32_raw(&mut self, ptr: u32, x: u32) -> &mut Self { let ptr: WasmPtr = WasmPtr::new(ptr); - ptr.deref(self.view()).write(x).unwrap(); + ptr.deref(&self.view()).write(x).unwrap(); self } pub fn write_u64_raw(&mut self, ptr: u32, x: u64) -> &mut Self { let ptr: WasmPtr = WasmPtr::new(ptr); - ptr.deref(self.view()).write(x).unwrap(); + ptr.deref(&self.view()).write(x).unwrap(); self } @@ -393,12 +358,12 @@ fn test_sp() -> Result<()> { use prover::programs::prelude::CompileConfig; use wasmer::{FunctionEnv, MemoryType}; - let mut store = CompileConfig::default().store(); + let store = &mut CompileConfig::default().store(); let mut env = WasmEnv::default(); - env.memory = Some(Memory::new(&mut store, MemoryType::new(0, None, false))?); - let env = FunctionEnv::new(&mut store, env); + env.memory = Some(Memory::new(store, MemoryType::new(0, None, false))?); + let env = &mut FunctionEnv::new(store, env).into_mut(store); - let mut sp = GoStack::simple(0, &env.into_mut(&mut store)); + let mut sp = GoStack::simple(0, env); assert_eq!(sp.advance(3), 8 + 0); assert_eq!(sp.advance(2), 8 + 3); assert_eq!(sp.skip_space().top, 8 + 8); diff --git a/arbitrator/jit/src/runtime.rs b/arbitrator/jit/src/runtime.rs index be1c146e8..8496963e1 100644 --- a/arbitrator/jit/src/runtime.rs +++ b/arbitrator/jit/src/runtime.rs @@ -15,14 +15,14 @@ pub fn go_debug(x: u32) { pub fn reset_memory_data_view(_: u32) {} /// go side: λ(code int32) -pub fn wasm_exit(env: WasmEnvMut, sp: u32) -> MaybeEscape { - let mut sp = GoStack::simple(sp, &env); +pub fn wasm_exit(mut env: WasmEnvMut, sp: u32) -> MaybeEscape { + let mut sp = GoStack::simple(sp, &mut env); Escape::exit(sp.read_u32()) } /// go side: λ(fd uintptr, p pointer, len int32) -pub fn wasm_write(env: WasmEnvMut, sp: u32) { - let mut sp = GoStack::simple(sp, &env); +pub fn wasm_write(mut env: WasmEnvMut, sp: u32) { + let mut sp = GoStack::simple(sp, &mut env); let fd = sp.read_u64(); let ptr = sp.read_u64(); let len = sp.read_u32(); diff --git a/arbitrator/jit/src/syscall.rs b/arbitrator/jit/src/syscall.rs index d6cb86358..7da01e7b4 100644 --- a/arbitrator/jit/src/syscall.rs +++ b/arbitrator/jit/src/syscall.rs @@ -8,7 +8,7 @@ use crate::{ use arbutil::Color; use go_js::JsEnv; -use wasmer::{StoreMut, TypedFunction}; +use wasmer::TypedFunction; /// go side: λ(v value) pub fn js_finalize_ref(mut env: WasmEnvMut, sp: u32) { @@ -61,14 +61,12 @@ pub struct WasmerJsEnv<'a, 'b> { rng: &'a mut rand_pcg::Pcg32, resume: &'a TypedFunction<(), ()>, get_stack_pointer: &'a TypedFunction<(), i32>, - go_stack: &'a mut GoStack, - store: &'a mut StoreMut<'b>, + go_stack: &'a mut GoStack<'b>, } impl<'a, 'b> WasmerJsEnv<'a, 'b> { pub fn new( - sp: &'a mut GoStack, - store: &'a mut StoreMut<'b>, + go_stack: &'a mut GoStack<'b>, exports: &'a mut WasmEnvFuncs, go_state: &'a mut GoRuntimeState, ) -> Result { @@ -83,8 +81,7 @@ impl<'a, 'b> WasmerJsEnv<'a, 'b> { rng: &mut go_state.rng, resume, get_stack_pointer, - go_stack: sp, - store, + go_stack, }) } } @@ -95,8 +92,8 @@ impl<'a, 'b> JsEnv for WasmerJsEnv<'a, 'b> { } fn resume(&mut self) -> eyre::Result<()> { - let store = &mut *self.store; let go_stack = &mut *self.go_stack; + let store = &mut go_stack.store; self.resume.call(store)?; @@ -113,40 +110,40 @@ impl<'a, 'b> JsEnv for WasmerJsEnv<'a, 'b> { /// go side: λ(v value, args []value) (value, bool) pub fn js_value_new(mut env: WasmEnvMut, sp: u32) -> MaybeEscape { - let (mut sp, env, mut store) = GoStack::new_with_store(sp, &mut env); + let (mut sp, env) = GoStack::new(sp, &mut env); let constructor = sp.read_js(); let (args_ptr, args_len) = sp.read_go_slice(); let args = sp.read_value_ids(args_ptr, args_len); - let mut js_env = WasmerJsEnv::new(&mut sp, &mut store, &mut env.exports, &mut env.go_state)?; + let mut js_env = WasmerJsEnv::new(&mut sp, &mut env.exports, &mut env.go_state)?; let result = env.js_state.value_new(&mut js_env, constructor, &args); sp.write_call_result(result, || "constructor call".into()) } /// go side: λ(v value, args []value) (value, bool) pub fn js_value_invoke(mut env: WasmEnvMut, sp: u32) -> MaybeEscape { - let (mut sp, env, mut store) = GoStack::new_with_store(sp, &mut env); + let (mut sp, env) = GoStack::new(sp, &mut env); let object = sp.read_js(); let (args_ptr, args_len) = sp.read_go_slice(); let args = sp.read_value_ids(args_ptr, args_len); - let mut js_env = WasmerJsEnv::new(&mut sp, &mut store, &mut env.exports, &mut env.go_state)?; + let mut js_env = WasmerJsEnv::new(&mut sp, &mut env.exports, &mut env.go_state)?; let result = env.js_state.value_invoke(&mut js_env, object, &args); sp.write_call_result(result, || "invocation".into()) } /// go side: λ(v value, method string, args []value) (value, bool) pub fn js_value_call(mut env: WasmEnvMut, sp: u32) -> MaybeEscape { - let (mut sp, env, mut store) = GoStack::new_with_store(sp, &mut env); + let (mut sp, env) = GoStack::new(sp, &mut env); let object = sp.read_js(); let method = sp.read_string(); let (args_ptr, args_len) = sp.read_go_slice(); let args = sp.read_value_ids(args_ptr, args_len); - let mut js_env = WasmerJsEnv::new(&mut sp, &mut store, &mut env.exports, &mut env.go_state)?; + let mut js_env = WasmerJsEnv::new(&mut sp, &mut env.exports, &mut env.go_state)?; let result = env.js_state.value_call(&mut js_env, object, &method, &args); sp.write_call_result(result, || format!("method call to {method}")) } diff --git a/arbitrator/jit/src/user/evm_api.rs b/arbitrator/jit/src/user/evm_api.rs index e80ff8dc0..766fe5d0c 100644 --- a/arbitrator/jit/src/user/evm_api.rs +++ b/arbitrator/jit/src/user/evm_api.rs @@ -3,11 +3,7 @@ #![allow(clippy::too_many_arguments)] -use crate::{ - gostack::GoStack, - machine::{ModuleAsm, WasmEnvMut}, - syscall::WasmerJsEnv, -}; +use crate::{gostack::GoStack, machine::WasmEnv, syscall::WasmerJsEnv, wavmio::Bytes32}; use arbutil::{ evm::{ api::EvmApiMethod, @@ -53,8 +49,8 @@ impl JsCallIntoGo for ApiCaller { /// Executes a wasm on a new thread pub(super) fn exec_wasm( sp: &mut GoStack, - mut env: WasmEnvMut, - module: ModuleAsm, + env: &mut WasmEnv, + module: Bytes32, calldata: Vec, compile: CompileConfig, config: StylusConfig, @@ -65,6 +61,13 @@ pub(super) fn exec_wasm( use EvmMsg::*; use UserOutcomeKind::*; + let Some(module) = env.module_asms.get(&module).cloned() else { + bail!( + "module hash {module:?} not found in {:?}", + env.module_asms.keys() + ); + }; + let (tx, rx) = mpsc::sync_channel(0); let evm_api = JsEvmApi::new(ApiCaller::new(tx.clone())); @@ -91,17 +94,16 @@ pub(super) fn exec_wasm( }); loop { - let msg = match rx.recv_timeout(env.data().process.child_timeout) { + let msg = match rx.recv_timeout(env.process.child_timeout) { Ok(msg) => msg, Err(err) => bail!("{}", err.red()), }; match msg { Call(method, args, respond) => { - let (env, mut store) = env.data_and_store_mut(); let js_state = &mut env.js_state; let exports = &mut env.exports; - let js_env = &mut WasmerJsEnv::new(sp, &mut store, exports, &mut env.go_state)?; + let js_env = &mut WasmerJsEnv::new(sp, exports, &mut env.go_state)?; let outs = js_state.call_stylus_func(api_id, method, args, js_env)?; respond.send(outs).unwrap(); } diff --git a/arbitrator/jit/src/user/mod.rs b/arbitrator/jit/src/user/mod.rs index ccaecfd74..a145b1c62 100644 --- a/arbitrator/jit/src/user/mod.rs +++ b/arbitrator/jit/src/user/mod.rs @@ -35,8 +35,8 @@ mod evm_api; /// These values are placed on the stack as follows /// || wasm... || pageLimit | version | debug || modhash ptr || gas ptr || footprint | 6 pad || err ptr || /// -pub fn stylus_activate(env: WasmEnvMut, sp: u32) { - let mut sp = GoStack::simple(sp, &env); +pub fn stylus_activate(mut env: WasmEnvMut, sp: u32) { + let mut sp = GoStack::simple(sp, &mut env); let wasm = sp.read_go_slice_owned(); let page_limit = sp.read_u16(); let version = sp.read_u16(); @@ -78,12 +78,13 @@ pub fn stylus_activate(env: WasmEnvMut, sp: u32) { /// These values are placed on the stack as follows /// || modHash || calldata... || params || evmApi | 4 pad || evmData || gas || status | 7 pad | out ptr || /// -pub fn stylus_call(env: WasmEnvMut, sp: u32) -> MaybeEscape { - let sp = &mut GoStack::simple(sp, &env); +pub fn stylus_call(mut env: WasmEnvMut, sp: u32) -> MaybeEscape { + let (mut sp, env) = GoStack::new(sp, &mut env); + let sp = &mut sp; use UserOutcome::*; // move inputs - let module_hash = sp.read_bytes32(); + let module = sp.read_bytes32(); let calldata = sp.read_go_slice_owned(); let (compile, config): (CompileConfig, StylusConfig) = sp.unbox(); let api_id = sp.read_u32(); @@ -94,13 +95,6 @@ pub fn stylus_call(env: WasmEnvMut, sp: u32) -> MaybeEscape { let pricing = config.pricing; let ink = pricing.gas_to_ink(sp.read_u64_raw(gas)); - let Some(module) = env.data().module_asms.get(&module_hash).cloned() else { - return Escape::failure(format!( - "module hash {module_hash:?} not found in {:?}", - env.data().module_asms.keys() - )); - }; - let result = exec_wasm( sp, env, module, calldata, compile, config, api_id, evm_data, ink, ); @@ -127,8 +121,8 @@ pub fn stylus_call(env: WasmEnvMut, sp: u32) -> MaybeEscape { /// These values are placed on the stack as follows /// || vec ptr || len u32 | pad 4 || /// -pub fn read_rust_vec_len(env: WasmEnvMut, sp: u32) { - let mut sp = GoStack::simple(sp, &env); +pub fn read_rust_vec_len(mut env: WasmEnvMut, sp: u32) { + let mut sp = GoStack::simple(sp, &mut env); let vec: &Vec = unsafe { sp.read_ref() }; sp.write_u32(vec.len() as u32); } @@ -143,8 +137,8 @@ pub fn read_rust_vec_len(env: WasmEnvMut, sp: u32) { /// These values are placed on the stack as follows /// || vec ptr || dest... || /// -pub fn rust_vec_into_slice(env: WasmEnvMut, sp: u32) { - let mut sp = GoStack::simple(sp, &env); +pub fn rust_vec_into_slice(mut env: WasmEnvMut, sp: u32) { + let mut sp = GoStack::simple(sp, &mut env); let vec: Vec = sp.unbox(); let ptr: *mut u8 = sp.read_ptr_mut(); sp.write_slice(ptr as u64, &vec); @@ -161,8 +155,8 @@ pub fn rust_vec_into_slice(env: WasmEnvMut, sp: u32) { /// The values are placed on the stack as follows /// || version | 2 garbage bytes | max_depth || ink_price | debugMode || result ptr || /// -pub fn rust_config_impl(env: WasmEnvMut, sp: u32) { - let mut sp = GoStack::simple(sp, &env); +pub fn rust_config_impl(mut env: WasmEnvMut, sp: u32) { + let mut sp = GoStack::simple(sp, &mut env); let config = StylusConfig { version: sp.read_u16(), @@ -190,8 +184,8 @@ pub fn rust_config_impl(env: WasmEnvMut, sp: u32) { /// || baseFee || chainid || coinbase || gas limit || block number || timestamp || address || /// || sender || value || gas price || origin || reentrant | 4 pad || data ptr || /// -pub fn evm_data_impl(env: WasmEnvMut, sp: u32) { - let mut sp = GoStack::simple(sp, &env); +pub fn evm_data_impl(mut env: WasmEnvMut, sp: u32) { + let mut sp = GoStack::simple(sp, &mut env); let evm_data = EvmData { block_basefee: sp.read_bytes32().into(), chainid: sp.read_u64(), diff --git a/arbitrator/jit/src/wavmio.rs b/arbitrator/jit/src/wavmio.rs index 3831d16c7..a040cab3b 100644 --- a/arbitrator/jit/src/wavmio.rs +++ b/arbitrator/jit/src/wavmio.rs @@ -140,9 +140,6 @@ fn inbox_message_impl(sp: &mut GoStack, inbox: &Inbox, name: &str) -> MaybeEscap None => error!("missing inbox message {msg_num} in {name}"), }; - if out_ptr + 32 > sp.memory_size() { - error!("unknown message type in {name}"); - } let offset = match u32::try_from(offset) { Ok(offset) => offset as usize, Err(_) => error!("bad offset {offset} in {name}"), diff --git a/arbitrator/prover/Cargo.toml b/arbitrator/prover/Cargo.toml index 091fff13c..9e8ddebaf 100644 --- a/arbitrator/prover/Cargo.toml +++ b/arbitrator/prover/Cargo.toml @@ -30,10 +30,10 @@ smallvec = { version = "1.10.0", features = ["serde"] } brotli2 = { version = "0.3.2", optional = true } rayon = { version = "1.5.1", optional = true } arbutil = { path = "../arbutil/" } -wasmer = { path = "../tools/wasmer/lib/api/", optional = true } +wasmer = { path = "../tools/wasmer/lib/api", optional = true } wasmer-types = { path = "../tools/wasmer/lib/types" } wasmer-compiler-singlepass = { path = "../tools/wasmer/lib/compiler-singlepass", optional = true, default-features = false, features = ["std", "unwind", "avx"] } -wasmparser = "0.83" +wasmparser.workspace = true [lib] name = "prover" diff --git a/arbitrator/prover/src/binary.rs b/arbitrator/prover/src/binary.rs index c9a3d6040..e4f7c2fc5 100644 --- a/arbitrator/prover/src/binary.rs +++ b/arbitrator/prover/src/binary.rs @@ -22,9 +22,9 @@ use serde::{Deserialize, Serialize}; use std::{convert::TryInto, fmt::Debug, hash::Hash, mem, path::Path, str::FromStr}; use wasmer_types::{entity::EntityRef, FunctionIndex, LocalFunctionIndex}; use wasmparser::{ - Data, Element, Export, ExternalKind, Global, Import, ImportSectionEntryType, MemoryType, Name, - NameSectionReader, Naming, Operator, Parser, Payload, TableType, Type, TypeDef, Validator, - WasmFeatures, + Data, Element, Export, ExternalKind, Global, Import, MemoryType, Name, NameSectionReader, + Naming, Operator, Parser, Payload, SectionReader, SectionWithLimitedItems, TableType, Type, + TypeRef, ValType, Validator, WasmFeatures, }; #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] @@ -220,7 +220,7 @@ pub fn op_as_const(op: Operator) -> Result { pub struct FuncImport<'a> { pub offset: u32, pub module: &'a str, - pub name: Option<&'a str>, // in wasmparser 0.95+ this won't be optional + pub name: &'a str, } /// This enum primarily exists because wasmer's ExternalKind doesn't impl these derived functions @@ -237,14 +237,13 @@ impl TryFrom for ExportKind { type Error = eyre::Error; fn try_from(kind: ExternalKind) -> Result { - use ExternalKind::*; + use ExternalKind as E; match kind { - Function => Ok(Self::Func), - Table => Ok(Self::Table), - Memory => Ok(Self::Memory), - Global => Ok(Self::Global), - Tag => Ok(Self::Tag), - kind => bail!("unsupported kind {:?}", kind), + E::Func => Ok(Self::Func), + E::Table => Ok(Self::Table), + E::Memory => Ok(Self::Memory), + E::Global => Ok(Self::Global), + E::Tag => Ok(Self::Tag), } } } @@ -294,7 +293,6 @@ pub fn parse<'a>(input: &'a [u8], path: &'_ Path) -> Result> { reference_types: false, multi_value: true, bulk_memory: true, // not all ops supported yet - module_linking: false, simd: false, relaxed_simd: false, threads: false, @@ -304,10 +302,9 @@ pub fn parse<'a>(input: &'a [u8], path: &'_ Path) -> Result> { exceptions: false, memory64: false, extended_const: false, + component_model: false, }; - let mut validator = Validator::new(); - validator.wasm_features(features); - validator + Validator::new_with_features(features) .validate_all(input) .wrap_err_with(|| eyre!("failed to validate {}", path.to_string_lossy().red()))?; @@ -339,10 +336,7 @@ pub fn parse<'a>(input: &'a [u8], path: &'_ Path) -> Result> { match &mut section { TypeSection(type_section) => { for _ in 0..type_section.get_count() { - let ty = match type_section.read()? { - TypeDef::Func(ty) => ty, - x => bail!("Unsupported type section {:?}", x), - }; + let Type::Func(ty) = type_section.read()?; binary.types.push(ty.try_into()?); } } @@ -381,30 +375,31 @@ pub fn parse<'a>(input: &'a [u8], path: &'_ Path) -> Result> { } ImportSection(imports) => { for import in flatten!(Import, imports) { - let ImportSectionEntryType::Function(offset) = import.ty else { + let TypeRef::Func(offset) = import.ty else { bail!("unsupported import kind {:?}", import) }; let import = FuncImport { offset, module: import.module, - name: import.field, + name: import.name, }; binary.imports.push(import); } } ExportSection(exports) => { - use ExternalKind::*; + use ExternalKind as E; for export in flatten!(Export, exports) { - let name = export.field.to_owned(); - if let Function = export.kind { + let name = export.name.to_owned(); + let kind = export.kind; + if let E::Func = kind { let index = export.index; let name = || name.clone(); binary.names.functions.entry(index).or_insert_with(name); } // TODO: we'll only support the types also in wasmparser 0.95+ - if matches!(export.kind, Function | Table | Memory | Global | Tag) { - let kind = export.kind.try_into()?; + if matches!(kind, E::Func | E::Table | E::Memory | E::Global | E::Tag) { + let kind = kind.try_into()?; binary.exports.insert(name, (export.index, kind)); } else { bail!("unsupported export kind {:?}", export) @@ -418,25 +413,19 @@ pub fn parse<'a>(input: &'a [u8], path: &'_ Path) -> Result> { ElementSection(elements) => process!(binary.elements, elements), DataSection(datas) => process!(binary.datas, datas), CodeSectionStart { .. } => {} - CustomSection { - name, - data_offset, - data, - .. - } => { - if *name != "name" { + CustomSection(reader) => { + if reader.name() != "name" { continue; } - let mut name_reader = NameSectionReader::new(data, *data_offset)?; + let mut name_reader = NameSectionReader::new(reader.data(), reader.data_offset())?; while !name_reader.eof() { match name_reader.read()? { - Name::Module(name) => binary.names.module = name.get_name()?.to_owned(), - Name::Function(namemap) => { - let mut map_reader = namemap.get_map()?; - for _ in 0..map_reader.get_count() { - let Naming { index, name } = map_reader.read()?; + Name::Module { name, .. } => binary.names.module = name.to_owned(), + Name::Function(mut namemap) => { + for _ in 0..namemap.get_count() { + let Naming { index, name } = namemap.read()?; binary.names.functions.insert(index, name.to_owned()); } } @@ -446,7 +435,7 @@ pub fn parse<'a>(input: &'a [u8], path: &'_ Path) -> Result> { } Version { num, .. } => ensure!(*num == 1, "wasm format version not supported {}", num), UnknownSection { id, .. } => bail!("unsupported unknown section type {}", id), - End => {} + End(_) => {} x => bail!("unsupported section type {:?}", x), } } @@ -474,10 +463,9 @@ pub fn parse<'a>(input: &'a [u8], path: &'_ Path) -> Result> { exports.extend(export); } for import in &binary.imports { - if let Some(name) = import.name { - if exports.contains(name) { - bail!("binary exports an import with the same name {}", name.red()); - } + let name = import.name; + if exports.contains(name) { + bail!("binary exports an import with the same name {}", name.red()); } } @@ -486,7 +474,7 @@ pub fn parse<'a>(input: &'a [u8], path: &'_ Path) -> Result> { if let Some(name) = exports.into_iter().find(reserved) { bail!("binary exports reserved symbol {}", name.red()) } - if let Some(name) = binary.imports.iter().filter_map(|x| x.name).find(reserved) { + if let Some(name) = binary.imports.iter().map(|x| x.name).find(reserved) { bail!("binary imports reserved symbol {}", name.red()) } @@ -541,7 +529,7 @@ impl<'a> WasmBinary<'a> { for (index, code) in self.codes.iter_mut().enumerate() { let index = LocalFunctionIndex::from_u32(index as u32); - let locals: Vec = code.locals.iter().map(|x| x.value.into()).collect(); + let locals: Vec = code.locals.iter().map(|x| x.value.into()).collect(); let mut build = mem::take(&mut code.expr); let mut input = Vec::with_capacity(build.len()); diff --git a/arbitrator/prover/src/machine.rs b/arbitrator/prover/src/machine.rs index 7204e836b..9d71d9bc6 100644 --- a/arbitrator/prover/src/machine.rs +++ b/arbitrator/prover/src/machine.rs @@ -325,12 +325,9 @@ impl Module { for import in &bin.imports { let module = import.module; let have_ty = &bin.types[import.offset as usize]; - let Some(import_name) = import.name else { - bail!("Missing name for import in {}", module.red()); - }; - let (forward, import_name) = match import_name.strip_prefix(Module::FORWARDING_PREFIX) { + let (forward, import_name) = match import.name.strip_prefix(Module::FORWARDING_PREFIX) { Some(name) => (true, name), - None => (false, import_name), + None => (false, import.name), }; let mut qualified_name = format!("{module}__{import_name}"); @@ -380,9 +377,8 @@ impl Module { let func_exports: HashMap = bin .exports .iter() - .filter_map(|(name, (offset, kind))| { - (kind == &ExportKind::Func).then(|| (name.to_owned(), *offset)) - }) + .filter(|(_, (_, kind))| kind == &ExportKind::Func) + .map(|(name, (offset, _))| (name.to_owned(), *offset)) .collect(); let internals = host::new_internal_funcs(stylus_data); @@ -453,8 +449,8 @@ impl Module { let (memory_index, mut init) = match data.kind { DataKind::Active { memory_index, - init_expr, - } => (memory_index, init_expr.get_operators_reader()), + offset_expr, + } => (memory_index, offset_expr.get_operators_reader()), _ => continue, }; ensure!( @@ -491,8 +487,8 @@ impl Module { let (t, mut init) = match elem.kind { ElementKind::Active { table_index, - init_expr, - } => (table_index, init_expr.get_operators_reader()), + offset_expr, + } => (table_index, offset_expr.get_operators_reader()), _ => continue, }; let offset = match (init.read()?, init.read()?, init.eof()) { diff --git a/arbitrator/prover/src/main.rs b/arbitrator/prover/src/main.rs index 1c88b7dd2..af114f74b 100644 --- a/arbitrator/prover/src/main.rs +++ b/arbitrator/prover/src/main.rs @@ -407,9 +407,7 @@ fn main() -> Result<()> { while let Some((module, func, profile)) = func_stack.pop() { sum.total_cycles += profile.total_cycles; sum.count += profile.count; - let entry = func_profile - .entry((module, func)) - .or_insert_with(SimpleProfile::default); + let entry = func_profile.entry((module, func)).or_default(); entry.count += sum.count; entry.total_cycles += sum.total_cycles; entry.local_cycles += profile.local_cycles; diff --git a/arbitrator/prover/src/programs/depth.rs b/arbitrator/prover/src/programs/depth.rs index 998f13b0e..24e247ea8 100644 --- a/arbitrator/prover/src/programs/depth.rs +++ b/arbitrator/prover/src/programs/depth.rs @@ -15,7 +15,7 @@ use std::sync::Arc; use wasmer_types::{ FunctionIndex, GlobalIndex, GlobalInit, LocalFunctionIndex, SignatureIndex, Type, }; -use wasmparser::{Operator, Type as WpType, TypeOrFuncType as BlockType}; +use wasmparser::{BlockType, Operator, ValType}; pub const STYLUS_STACK_LEFT: &str = "stylus_stack_left"; @@ -132,7 +132,7 @@ impl<'a> FuncDepthChecker<'a> { } impl<'a> FuncMiddleware<'a> for FuncDepthChecker<'a> { - fn locals_info(&mut self, locals: &[WpType]) { + fn locals_info(&mut self, locals: &[ValType]) { self.locals = Some(locals.len()); } @@ -176,14 +176,13 @@ impl<'a> FuncMiddleware<'a> for FuncDepthChecker<'a> { bail!("frame too large: {} > {}-word limit", size.red(), limit); } + let blockty = BlockType::Empty; out.extend([ // if space <= size => panic with depth = 0 GlobalGet { global_index }, I32Const { value: size as i32 }, I32LeU, - If { - ty: BlockType::Type(WpType::EmptyBlockType), - }, + If { blockty }, I32Const { value: 0 }, GlobalSet { global_index }, Unreachable, @@ -274,7 +273,7 @@ impl<'a> FuncDepthChecker<'a> { macro_rules! block_type { ($ty:expr) => {{ match $ty { - BlockType::Type(WpType::EmptyBlockType) => {} + BlockType::Empty => {} BlockType::Type(_) => push!(1), BlockType::FuncType(id) => { let index = SignatureIndex::from_u32(*id); @@ -292,17 +291,17 @@ impl<'a> FuncDepthChecker<'a> { for op in &self.code { #[rustfmt::skip] match op { - Block { ty } => { - block_type!(ty); // we'll say any return slots have been pre-allocated + Block { blockty } => { + block_type!(blockty); // we'll say any return slots have been pre-allocated scopes.push(stack); } - Loop { ty } => { - block_type!(ty); // return slots + Loop { blockty } => { + block_type!(blockty); // return slots scopes.push(stack); } - If { ty } => { - pop!(); // pop the conditional - block_type!(ty); // return slots + If { blockty } => { + pop!(); // pop the conditional + block_type!(blockty); // return slots scopes.push(stack); } Else => { @@ -325,10 +324,10 @@ impl<'a> FuncDepthChecker<'a> { }; ins_and_outs!(ty) } - CallIndirect { index, .. } => { - let index = SignatureIndex::from_u32(*index); + CallIndirect { type_index, .. } => { + let index = SignatureIndex::from_u32(*type_index); let Some(ty) = self.sigs.get(&index) else { - bail!("missing type for signature {}", index.as_u32().red()) + bail!("missing type for signature {}", type_index.red()) }; ins_and_outs!(ty); pop!() // the table index @@ -449,13 +448,13 @@ impl<'a> FuncDepthChecker<'a> { I8x16Abs, I8x16Neg, I8x16Popcnt, I8x16AllTrue, I8x16Bitmask, I8x16NarrowI16x8S, I8x16NarrowI16x8U, I8x16Shl, I8x16ShrS, I8x16ShrU, I8x16Add, I8x16AddSatS, I8x16AddSatU, I8x16Sub, I8x16SubSatS, - I8x16SubSatU, I8x16MinS, I8x16MinU, I8x16MaxS, I8x16MaxU, I8x16RoundingAverageU, + I8x16SubSatU, I8x16MinS, I8x16MinU, I8x16MaxS, I8x16MaxU, I8x16AvgrU, I16x8ExtAddPairwiseI8x16S, I16x8ExtAddPairwiseI8x16U, I16x8Abs, I16x8Neg, I16x8Q15MulrSatS, I16x8AllTrue, I16x8Bitmask, I16x8NarrowI32x4S, I16x8NarrowI32x4U, I16x8ExtendLowI8x16S, I16x8ExtendHighI8x16S, I16x8ExtendLowI8x16U, I16x8ExtendHighI8x16U, I16x8Shl, I16x8ShrS, I16x8ShrU, I16x8Add, I16x8AddSatS, I16x8AddSatU, I16x8Sub, I16x8SubSatS, I16x8SubSatU, I16x8Mul, I16x8MinS, I16x8MinU, - I16x8MaxS, I16x8MaxU, I16x8RoundingAverageU, I16x8ExtMulLowI8x16S, + I16x8MaxS, I16x8MaxU, I16x8AvgrU, I16x8ExtMulLowI8x16S, I16x8ExtMulHighI8x16S, I16x8ExtMulLowI8x16U, I16x8ExtMulHighI8x16U, I32x4ExtAddPairwiseI16x8U, I32x4Abs, I32x4Neg, I32x4AllTrue, I32x4Bitmask, I32x4ExtAddPairwiseI16x8S, I32x4ExtendLowI16x8S, I32x4ExtendHighI16x8S, I32x4ExtendLowI16x8U, @@ -473,9 +472,11 @@ impl<'a> FuncDepthChecker<'a> { F32x4ConvertI32x4U, I32x4TruncSatF64x2SZero, I32x4TruncSatF64x2UZero, F64x2ConvertLowI32x4S, F64x2ConvertLowI32x4U, F32x4DemoteF64x2Zero, F64x2PromoteLowF32x4, I8x16RelaxedSwizzle, I32x4RelaxedTruncSatF32x4S, I32x4RelaxedTruncSatF32x4U, I32x4RelaxedTruncSatF64x2SZero, - I32x4RelaxedTruncSatF64x2UZero, F32x4Fma, F32x4Fms, F64x2Fma, F64x2Fms, I8x16LaneSelect, - I16x8LaneSelect, I32x4LaneSelect, I64x2LaneSelect, F32x4RelaxedMin, F32x4RelaxedMax, - F64x2RelaxedMin, F64x2RelaxedMax + I32x4RelaxedTruncSatF64x2UZero, F32x4RelaxedFma, F32x4RelaxedFnma, F64x2RelaxedFma, + F64x2RelaxedFnma, I8x16RelaxedLaneselect, I16x8RelaxedLaneselect, I32x4RelaxedLaneselect, + I64x2RelaxedLaneselect, F32x4RelaxedMin, F32x4RelaxedMax, F64x2RelaxedMin, F64x2RelaxedMax, + I16x8RelaxedQ15mulrS, I16x8DotI8x16I7x16S, I32x4DotI8x16I7x16AddS, + F32x4RelaxedDotBf16x8AddF32x4 ) ) => bail!("SIMD extension not supported {:?}", unsupported), }; diff --git a/arbitrator/prover/src/programs/dynamic.rs b/arbitrator/prover/src/programs/dynamic.rs index 250337722..36f49af85 100644 --- a/arbitrator/prover/src/programs/dynamic.rs +++ b/arbitrator/prover/src/programs/dynamic.rs @@ -9,7 +9,7 @@ use super::{ use eyre::{bail, Result}; use parking_lot::RwLock; use wasmer_types::{GlobalIndex, GlobalInit, LocalFunctionIndex, Type}; -use wasmparser::{Operator, Type as WpType, TypeOrFuncType}; +use wasmparser::{BlockType, Operator}; pub const SCRATCH_GLOBAL: &str = "stylus_scratch_global"; @@ -99,7 +99,7 @@ impl<'a> FuncMiddleware<'a> for FuncDynamicMeter { } let [ink, status, scratch] = self.globals.map(|x| x.as_u32()); - let if_ty = TypeOrFuncType::Type(WpType::EmptyBlockType); + let blockty = BlockType::Empty; #[rustfmt::skip] let linear = |coefficient| { @@ -122,7 +122,7 @@ impl<'a> FuncMiddleware<'a> for FuncDynamicMeter { // [old_ink, new_ink] → (old_ink < new_ink) (overflow detected) I64LtU, - If { ty: if_ty }, + If { blockty }, I32Const { value: 1 }, set!(status), Unreachable, diff --git a/arbitrator/prover/src/programs/meter.rs b/arbitrator/prover/src/programs/meter.rs index 2381fb8fa..197150c60 100644 --- a/arbitrator/prover/src/programs/meter.rs +++ b/arbitrator/prover/src/programs/meter.rs @@ -16,7 +16,7 @@ use std::{ sync::Arc, }; use wasmer_types::{GlobalIndex, GlobalInit, LocalFunctionIndex, SignatureIndex, Type}; -use wasmparser::{Operator, Type as WpType, TypeOrFuncType}; +use wasmparser::{BlockType, Operator}; use super::config::SigMap; @@ -137,15 +137,14 @@ impl<'a, F: OpcodePricer> FuncMiddleware<'a> for FuncMeter<'a, F> { if end { let ink = self.ink_global.as_u32(); let status = self.status_global.as_u32(); + let blockty = BlockType::Empty; let mut header = [ // if ink < cost => panic with status = 1 GlobalGet { global_index: ink }, I64Const { value: cost as i64 }, I64LtU, - If { - ty: TypeOrFuncType::Type(WpType::EmptyBlockType), - }, + If { blockty }, I32Const { value: 1 }, GlobalSet { global_index: status, @@ -401,11 +400,11 @@ pub fn pricing_v1(op: &Operator, tys: &HashMap) -> dot!(MemoryCopy) => 3100, dot!(MemoryFill) => 3100, - BrTable { table } => { - 2400 + 325 * table.len() as u64 + BrTable { targets } => { + 2400 + 325 * targets.len() as u64 }, - CallIndirect { index, .. } => { - let ty = tys.get(&SignatureIndex::from_u32(*index)).expect("no type"); + CallIndirect { type_index, .. } => { + let ty = tys.get(&SignatureIndex::from_u32(*type_index)).expect("no type"); 13610 + 650 * ty.inputs.len() as u64 }, @@ -466,12 +465,12 @@ pub fn pricing_v1(op: &Operator, tys: &HashMap) -> V128Not, V128And, V128AndNot, V128Or, V128Xor, V128Bitselect, V128AnyTrue, I8x16Abs, I8x16Neg, I8x16Popcnt, I8x16AllTrue, I8x16Bitmask, I8x16NarrowI16x8S, I8x16NarrowI16x8U, I8x16Shl, I8x16ShrS, I8x16ShrU, I8x16Add, I8x16AddSatS, I8x16AddSatU, I8x16Sub, I8x16SubSatS, - I8x16SubSatU, I8x16MinS, I8x16MinU, I8x16MaxS, I8x16MaxU, I8x16RoundingAverageU, + I8x16SubSatU, I8x16MinS, I8x16MinU, I8x16MaxS, I8x16MaxU, I8x16AvgrU, I16x8ExtAddPairwiseI8x16S, I16x8ExtAddPairwiseI8x16U, I16x8Abs, I16x8Neg, I16x8Q15MulrSatS, I16x8AllTrue, I16x8Bitmask, I16x8NarrowI32x4S, I16x8NarrowI32x4U, I16x8ExtendLowI8x16S, I16x8ExtendHighI8x16S, I16x8ExtendLowI8x16U, I16x8ExtendHighI8x16U, I16x8Shl, I16x8ShrS, I16x8ShrU, I16x8Add, I16x8AddSatS, I16x8AddSatU, I16x8Sub, I16x8SubSatS, I16x8SubSatU, I16x8Mul, I16x8MinS, - I16x8MinU, I16x8MaxS, I16x8MaxU, I16x8RoundingAverageU, I16x8ExtMulLowI8x16S, + I16x8MinU, I16x8MaxS, I16x8MaxU, I16x8AvgrU, I16x8ExtMulLowI8x16S, I16x8ExtMulHighI8x16S, I16x8ExtMulLowI8x16U, I16x8ExtMulHighI8x16U, I32x4ExtAddPairwiseI16x8S, I32x4ExtAddPairwiseI16x8U, I32x4Abs, I32x4Neg, I32x4AllTrue, I32x4Bitmask, I32x4ExtendLowI16x8S, I32x4ExtendHighI16x8S, I32x4ExtendLowI16x8U, I32x4ExtendHighI16x8U, I32x4Shl, I32x4ShrS, I32x4ShrU, @@ -487,9 +486,10 @@ pub fn pricing_v1(op: &Operator, tys: &HashMap) -> F32x4ConvertI32x4U, I32x4TruncSatF64x2SZero, I32x4TruncSatF64x2UZero, F64x2ConvertLowI32x4S, F64x2ConvertLowI32x4U, F32x4DemoteF64x2Zero, F64x2PromoteLowF32x4, I8x16RelaxedSwizzle, I32x4RelaxedTruncSatF32x4S, I32x4RelaxedTruncSatF32x4U, I32x4RelaxedTruncSatF64x2SZero, - I32x4RelaxedTruncSatF64x2UZero, F32x4Fma, F32x4Fms, F64x2Fma, F64x2Fms, I8x16LaneSelect, - I16x8LaneSelect, I32x4LaneSelect, I64x2LaneSelect, F32x4RelaxedMin, F32x4RelaxedMax, - F64x2RelaxedMin, F64x2RelaxedMax + I32x4RelaxedTruncSatF64x2UZero, F32x4RelaxedFma, F32x4RelaxedFnma, F64x2RelaxedFma, + F64x2RelaxedFnma, I8x16RelaxedLaneselect, I16x8RelaxedLaneselect, I32x4RelaxedLaneselect, + I64x2RelaxedLaneselect, F32x4RelaxedMin, F32x4RelaxedMax, F64x2RelaxedMin, F64x2RelaxedMax, + I16x8RelaxedQ15mulrS, I16x8DotI8x16I7x16S, I32x4DotI8x16I7x16AddS, F32x4RelaxedDotBf16x8AddF32x4 ) => u64::MAX, }; ink diff --git a/arbitrator/prover/src/programs/mod.rs b/arbitrator/prover/src/programs/mod.rs index 423cb0974..b7331bd1a 100644 --- a/arbitrator/prover/src/programs/mod.rs +++ b/arbitrator/prover/src/programs/mod.rs @@ -16,7 +16,7 @@ use wasmer_types::{ entity::EntityRef, FunctionIndex, GlobalIndex, GlobalInit, ImportIndex, LocalFunctionIndex, SignatureIndex, Type, }; -use wasmparser::{Operator, Type as WpType}; +use wasmparser::{Operator, ValType}; #[cfg(feature = "native")] use { @@ -62,7 +62,7 @@ pub trait Middleware { pub trait FuncMiddleware<'a> { /// Provide info on the function's locals. This is called before feed. - fn locals_info(&mut self, _locals: &[WpType]) {} + fn locals_info(&mut self, _locals: &[ValType]) {} /// Processes the given operator. fn feed(&mut self, op: Operator<'a>, out: &mut O) -> Result<()> @@ -144,7 +144,7 @@ impl<'a, T> FunctionMiddleware<'a> for FuncMiddlewareWrapper<'a, T> where T: FuncMiddleware<'a> + Debug, { - fn locals_info(&mut self, locals: &[WpType]) { + fn locals_info(&mut self, locals: &[ValType]) { self.0.locals_info(locals); } @@ -331,7 +331,7 @@ impl<'a> ModuleMod for WasmBinary<'a> { fn get_import(&self, module: &str, name: &str) -> Result { self.imports .iter() - .position(|x| x.module == module && x.name == Some(name)) + .position(|x| x.module == module && x.name == name) .map(|x| ImportIndex::Function(FunctionIndex::from_u32(x as u32))) .ok_or_else(|| eyre!("missing import {}", name.red())) } diff --git a/arbitrator/prover/src/utils.rs b/arbitrator/prover/src/utils.rs index 722243651..075009d08 100644 --- a/arbitrator/prover/src/utils.rs +++ b/arbitrator/prover/src/utils.rs @@ -4,7 +4,7 @@ use eyre::{eyre, Result}; use serde::{Deserialize, Serialize}; use std::{borrow::Borrow, convert::TryInto, fmt, fs::File, io::Read, ops::Deref, path::Path}; -use wasmparser::{TableType, Type}; +use wasmparser::{TableType, ValType}; /// A Vec allocated with libc::malloc pub struct CBytes { @@ -61,7 +61,7 @@ impl From<&[u8]> for CBytes { } #[derive(Serialize, Deserialize)] -#[serde(remote = "Type")] +#[serde(remote = "ValType")] enum RemoteType { I32, I64, @@ -70,18 +70,13 @@ enum RemoteType { V128, FuncRef, ExternRef, - - // TODO: types removed in wasmparser 0.95+ - ExnRef, - Func, - EmptyBlockType, } #[derive(Serialize, Deserialize)] #[serde(remote = "TableType")] pub struct RemoteTableType { #[serde(with = "RemoteType")] - pub element_type: Type, + pub element_type: ValType, pub initial: u32, pub maximum: Option, } diff --git a/arbitrator/prover/src/value.rs b/arbitrator/prover/src/value.rs index 6bd688604..a63d6c578 100644 --- a/arbitrator/prover/src/value.rs +++ b/arbitrator/prover/src/value.rs @@ -13,7 +13,7 @@ use std::{ fmt::Display, ops::Add, }; -use wasmparser::{FuncType, Type}; +use wasmparser::{FuncType, ValType}; #[derive(Clone, Copy, PartialEq, Eq, Debug, Hash, Serialize, Deserialize)] #[repr(u8)] @@ -33,61 +33,56 @@ impl ArbValueType { } } -impl TryFrom for ArbValueType { +impl TryFrom for ArbValueType { type Error = eyre::Error; - fn try_from(ty: Type) -> Result { - use Type::*; + fn try_from(ty: ValType) -> Result { + use ValType as V; Ok(match ty { - I32 => Self::I32, - I64 => Self::I64, - F32 => Self::F32, - F64 => Self::F64, - FuncRef => Self::FuncRef, - ExternRef => Self::FuncRef, - V128 => bail!("128-bit types are not supported"), - - // TODO: removed in wasmparser 0.95+ - ExnRef => bail!("Type not used in newer versions of wasmparser"), - Func => bail!("Type not used in newer versions of wasmparser"), - EmptyBlockType => bail!("Type not used in newer versions of wasmparser"), + V::I32 => Self::I32, + V::I64 => Self::I64, + V::F32 => Self::F32, + V::F64 => Self::F64, + V::FuncRef => Self::FuncRef, + V::ExternRef => Self::FuncRef, + V::V128 => bail!("128-bit types are not supported"), }) } } -impl From for Type { +impl From for ValType { fn from(ty: ArbValueType) -> Self { - use ArbValueType::*; + use ArbValueType as V; match ty { - I32 => Self::I32, - I64 => Self::I64, - F32 => Self::F32, - F64 => Self::F64, + V::I32 => Self::I32, + V::I64 => Self::I64, + V::F32 => Self::F32, + V::F64 => Self::F64, // InternalRef's aren't analogous, but they can be viewed as function pointers from wavm's perspective - RefNull | FuncRef | InternalRef => Self::FuncRef, + V::RefNull | V::FuncRef | V::InternalRef => Self::FuncRef, } } } #[cfg(feature = "native")] -pub fn parser_type(ty: &wasmer::Type) -> wasmer::wasmparser::Type { +pub fn parser_type(ty: &wasmer::Type) -> wasmer::wasmparser::ValType { match ty { - wasmer::Type::I32 => wasmer::wasmparser::Type::I32, - wasmer::Type::I64 => wasmer::wasmparser::Type::I64, - wasmer::Type::F32 => wasmer::wasmparser::Type::F32, - wasmer::Type::F64 => wasmer::wasmparser::Type::F64, - wasmer::Type::V128 => wasmer::wasmparser::Type::V128, - wasmer::Type::ExternRef => wasmer::wasmparser::Type::ExternRef, - wasmer::Type::FuncRef => wasmer::wasmparser::Type::FuncRef, + wasmer::Type::I32 => wasmer::wasmparser::ValType::I32, + wasmer::Type::I64 => wasmer::wasmparser::ValType::I64, + wasmer::Type::F32 => wasmer::wasmparser::ValType::F32, + wasmer::Type::F64 => wasmer::wasmparser::ValType::F64, + wasmer::Type::V128 => wasmer::wasmparser::ValType::V128, + wasmer::Type::ExternRef => wasmer::wasmparser::ValType::ExternRef, + wasmer::Type::FuncRef => wasmer::wasmparser::ValType::FuncRef, } } #[cfg(feature = "native")] pub fn parser_func_type(ty: wasmer::FunctionType) -> FuncType { - let convert = |t: &[wasmer::Type]| -> Vec { t.iter().map(parser_type).collect() }; - let params = convert(ty.params()).into_boxed_slice(); - let returns = convert(ty.results()).into_boxed_slice(); - FuncType { params, returns } + let convert = |t: &[wasmer::Type]| -> Vec { t.iter().map(parser_type).collect() }; + let params = convert(ty.params()); + let results = convert(ty.results()); + FuncType::new(params, results) } impl From for ArbValueType { @@ -442,10 +437,10 @@ impl TryFrom for FunctionType { let mut inputs = vec![]; let mut outputs = vec![]; - for input in func.params.iter() { + for input in func.params() { inputs.push(ArbValueType::try_from(*input)?) } - for output in func.returns.iter() { + for output in func.results() { outputs.push(ArbValueType::try_from(*output)?) } Ok(Self { inputs, outputs }) diff --git a/arbitrator/prover/src/wavm.rs b/arbitrator/prover/src/wavm.rs index f7f9434b9..c255d6833 100644 --- a/arbitrator/prover/src/wavm.rs +++ b/arbitrator/prover/src/wavm.rs @@ -15,7 +15,7 @@ use parking_lot::Mutex; use serde::{Deserialize, Serialize}; use sha3::Keccak256; use std::ops::{Add, AddAssign, Sub, SubAssign}; -use wasmparser::{Operator, Type, TypeOrFuncType as BlockType}; +use wasmparser::{BlockType, Operator}; #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum IRelOpType { @@ -645,7 +645,7 @@ pub fn wasm_to_wavm( let block_type_params = |ty: BlockType| -> usize { match ty { - BlockType::Type(Type::EmptyBlockType) => 0, + BlockType::Empty => 0, BlockType::Type(_) => 0, BlockType::FuncType(idx) => all_types[idx as usize].inputs.len(), } @@ -653,7 +653,7 @@ pub fn wasm_to_wavm( let block_type_results = |ty: BlockType| -> usize { match ty { - BlockType::Type(Type::EmptyBlockType) => 0, + BlockType::Empty => 0, BlockType::Type(_) => 1, BlockType::FuncType(idx) => all_types[idx as usize].outputs.len(), } @@ -732,16 +732,16 @@ pub fn wasm_to_wavm( stack = StackState::Unreachable; }, Nop => opcode!(Nop), - Block { ty } => { - scopes.push(Scope::Simple(*ty, vec![], height_after_block!(ty))); + Block { blockty } => { + scopes.push(Scope::Simple(*blockty, vec![], height_after_block!(blockty))); } - Loop { ty } => { - scopes.push(Scope::Loop(*ty, out.len(), stack, height_after_block!(ty))); + Loop { blockty } => { + scopes.push(Scope::Loop(*blockty, out.len(), stack, height_after_block!(blockty))); } - If { ty } => { + If { blockty } => { opcode!(I32Eqz); stack -= 1; // the else block shouldn't have the conditional that gets popped next instruction - scopes.push(Scope::IfElse(*ty, vec![], Some(out.len()), stack, height_after_block!(ty))); + scopes.push(Scope::IfElse(*blockty, vec![], Some(out.len()), stack, height_after_block!(blockty))); opcode!(ArbitraryJumpIf); } Else => { @@ -779,11 +779,11 @@ pub fn wasm_to_wavm( } Br { relative_depth } => branch!(ArbitraryJump, *relative_depth), BrIf { relative_depth } => branch!(ArbitraryJumpIf, *relative_depth), - BrTable { table } => { + BrTable { targets } => { let start_stack = stack; // evaluate each branch let mut subjumps = vec![]; - for (index, target) in table.targets().enumerate() { + for (index, target) in targets.targets().enumerate() { opcode!(Dup, @push 1); opcode!(I32Const, index as u64, @push 1); compare!(I32, Eq, false); @@ -793,7 +793,7 @@ pub fn wasm_to_wavm( // nothing matched: drop the index and jump to the default. opcode!(Drop, @pop 1); - branch!(ArbitraryJump, table.default()); + branch!(ArbitraryJump, targets.default()); // simulate a jump table of branches for (jump, branch) in subjumps { @@ -806,10 +806,10 @@ pub fn wasm_to_wavm( Return => branch!(ArbitraryJump, scopes.len() - 1), Call { function_index } => call!(*function_index), - CallIndirect { index, table_index, .. } => { - let ty = &all_types[*index as usize]; + CallIndirect { type_index, table_index, .. } => { + let ty = &all_types[*type_index as usize]; let delta = ty.outputs.len() as isize - ty.inputs.len() as isize; - opcode!(CallIndirect, pack_call_indirect(*table_index, *index), @push delta - 1); + opcode!(CallIndirect, pack_call_indirect(*table_index, *type_index), @push delta - 1); } unsupported @ dot!(ReturnCall, ReturnCallIndirect) => { @@ -1016,8 +1016,8 @@ pub fn wasm_to_wavm( ensure!(*mem == 0, "multi-memory proposal not supported"); call!(internals_offset + InternalFunc::MemoryFill as u32) }, - MemoryCopy { src, dst } => { - ensure!(*src == 0 && *dst == 0, "multi-memory proposal not supported"); + MemoryCopy { src_mem, dst_mem } => { + ensure!(*src_mem == 0 && *dst_mem == 0, "multi-memory proposal not supported"); call!(internals_offset + InternalFunc::MemoryCopy as u32) }, @@ -1066,12 +1066,12 @@ pub fn wasm_to_wavm( V128Not, V128And, V128AndNot, V128Or, V128Xor, V128Bitselect, V128AnyTrue, I8x16Abs, I8x16Neg, I8x16Popcnt, I8x16AllTrue, I8x16Bitmask, I8x16NarrowI16x8S, I8x16NarrowI16x8U, I8x16Shl, I8x16ShrS, I8x16ShrU, I8x16Add, I8x16AddSatS, I8x16AddSatU, I8x16Sub, I8x16SubSatS, - I8x16SubSatU, I8x16MinS, I8x16MinU, I8x16MaxS, I8x16MaxU, I8x16RoundingAverageU, + I8x16SubSatU, I8x16MinS, I8x16MinU, I8x16MaxS, I8x16MaxU, I8x16AvgrU, I16x8ExtAddPairwiseI8x16S, I16x8ExtAddPairwiseI8x16U, I16x8Abs, I16x8Neg, I16x8Q15MulrSatS, I16x8AllTrue, I16x8Bitmask, I16x8NarrowI32x4S, I16x8NarrowI32x4U, I16x8ExtendLowI8x16S, I16x8ExtendHighI8x16S, I16x8ExtendLowI8x16U, I16x8ExtendHighI8x16U, I16x8Shl, I16x8ShrS, I16x8ShrU, I16x8Add, I16x8AddSatS, I16x8AddSatU, I16x8Sub, I16x8SubSatS, I16x8SubSatU, I16x8Mul, I16x8MinS, - I16x8MinU, I16x8MaxS, I16x8MaxU, I16x8RoundingAverageU, I16x8ExtMulLowI8x16S, + I16x8MinU, I16x8MaxS, I16x8MaxU, I16x8AvgrU, I16x8ExtMulLowI8x16S, I16x8ExtMulHighI8x16S, I16x8ExtMulLowI8x16U, I16x8ExtMulHighI8x16U, I32x4ExtAddPairwiseI16x8S, I32x4ExtAddPairwiseI16x8U, I32x4Abs, I32x4Neg, I32x4AllTrue, I32x4Bitmask, I32x4ExtendLowI16x8S, I32x4ExtendHighI16x8S, I32x4ExtendLowI16x8U, I32x4ExtendHighI16x8U, I32x4Shl, I32x4ShrS, I32x4ShrU, @@ -1087,13 +1087,14 @@ pub fn wasm_to_wavm( F32x4ConvertI32x4U, I32x4TruncSatF64x2SZero, I32x4TruncSatF64x2UZero, F64x2ConvertLowI32x4S, F64x2ConvertLowI32x4U, F32x4DemoteF64x2Zero, F64x2PromoteLowF32x4, I8x16RelaxedSwizzle, I32x4RelaxedTruncSatF32x4S, I32x4RelaxedTruncSatF32x4U, I32x4RelaxedTruncSatF64x2SZero, - I32x4RelaxedTruncSatF64x2UZero, F32x4Fma, F32x4Fms, F64x2Fma, F64x2Fms, I8x16LaneSelect, - I16x8LaneSelect, I32x4LaneSelect, I64x2LaneSelect, F32x4RelaxedMin, F32x4RelaxedMax, - F64x2RelaxedMin, F64x2RelaxedMax + I32x4RelaxedTruncSatF64x2UZero, F32x4RelaxedFma, F32x4RelaxedFnma, F64x2RelaxedFma, + F64x2RelaxedFnma, I8x16RelaxedLaneselect, I16x8RelaxedLaneselect, I32x4RelaxedLaneselect, + I64x2RelaxedLaneselect, F32x4RelaxedMin, F32x4RelaxedMax, F64x2RelaxedMin, F64x2RelaxedMax, + I16x8RelaxedQ15mulrS, I16x8DotI8x16I7x16S, I32x4DotI8x16I7x16AddS, + F32x4RelaxedDotBf16x8AddF32x4 ) ) => bail!("SIMD extension not supported {:?}", unsupported) }; } - Ok(()) } diff --git a/arbitrator/stylus/Cargo.toml b/arbitrator/stylus/Cargo.toml index b469288dc..b9e67bf4f 100644 --- a/arbitrator/stylus/Cargo.toml +++ b/arbitrator/stylus/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] arbutil = { path = "../arbutil/" } prover = { path = "../prover/", default-features = false, features = ["native"] } -wasmer = { path = "../tools/wasmer/lib/api/" } +wasmer = { path = "../tools/wasmer/lib/api" } wasmer-vm = { path = "../tools/wasmer/lib/vm/" } wasmer-types = { path = "../tools/wasmer/lib/types/" } wasmer-compiler-singlepass = { path = "../tools/wasmer/lib/compiler-singlepass", default-features = false, features = ["std", "unwind", "avx"] } diff --git a/arbitrator/stylus/src/env.rs b/arbitrator/stylus/src/env.rs index b71ee3397..82dd3fb64 100644 --- a/arbitrator/stylus/src/env.rs +++ b/arbitrator/stylus/src/env.rs @@ -16,9 +16,7 @@ use std::{ ptr::NonNull, }; use thiserror::Error; -use wasmer::{ - AsStoreRef, FunctionEnvMut, Memory, MemoryAccessError, MemoryView, Pages, StoreMut, WasmPtr, -}; +use wasmer::{FunctionEnvMut, Memory, MemoryAccessError, MemoryView, Pages, StoreMut, WasmPtr}; use wasmer_types::RawValue; use wasmer_vm::VMGlobalDefinition; @@ -151,7 +149,7 @@ impl<'a, E: EvmApi> HostioInfo<'a, E> { } pub fn view(&self) -> MemoryView { - self.memory.view(&self.store.as_store_ref()) + self.memory.view(&self.store) } pub fn memory_size(&self) -> Pages { diff --git a/arbitrator/stylus/src/native.rs b/arbitrator/stylus/src/native.rs index 5ce13b92d..315c623fe 100644 --- a/arbitrator/stylus/src/native.rs +++ b/arbitrator/stylus/src/native.rs @@ -28,9 +28,10 @@ use std::{ ops::{Deref, DerefMut}, }; use wasmer::{ - imports, AsStoreMut, Function, FunctionEnv, Global, Instance, Memory, Module, Pages, Store, + imports, AsStoreMut, Function, FunctionEnv, Instance, Memory, Module, Pages, Store, TypedFunction, Value, WasmTypeList, }; +use wasmer_vm::VMExtern; #[derive(Debug)] pub struct NativeInstance { @@ -182,9 +183,14 @@ impl NativeInstance { let store = &mut self.store; let exports = &self.instance.exports; - let expect_global = |name| -> Global { exports.get_global(name).unwrap().clone() }; - let ink_left = unsafe { expect_global(STYLUS_INK_LEFT).vmglobal(store) }; - let ink_status = unsafe { expect_global(STYLUS_INK_STATUS).vmglobal(store) }; + let mut expect_global = |name| { + let VMExtern::Global(sh) = exports.get_extern(name).unwrap().to_vm_extern() else { + panic!("name not found global"); + }; + sh.get(store.objects_mut()).vmglobal() + }; + let ink_left = expect_global(STYLUS_INK_LEFT); + let ink_status = expect_global(STYLUS_INK_STATUS); self.env_mut().meter = Some(MeterData { ink_left, diff --git a/arbitrator/tools/wasmer b/arbitrator/tools/wasmer index 80125b562..061b594df 160000 --- a/arbitrator/tools/wasmer +++ b/arbitrator/tools/wasmer @@ -1 +1 @@ -Subproject commit 80125b5627040db0b0ec4b94ba687e1f7a491f0c +Subproject commit 061b594dfc8eaa336b2840dbdc3f83ceac4ed5e0 diff --git a/arbitrator/wasm-libraries/Cargo.lock b/arbitrator/wasm-libraries/Cargo.lock index 1e551edff..b2cc7e143 100644 --- a/arbitrator/wasm-libraries/Cargo.lock +++ b/arbitrator/wasm-libraries/Cargo.lock @@ -74,6 +74,18 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "block-buffer" version = "0.9.0" @@ -109,23 +121,24 @@ dependencies = [ [[package]] name = "bytecheck" -version = "0.6.9" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d11cac2c12b5adc6570dad2ee1b87eff4955dac476fe12d81e5fdd352e52406f" +checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" dependencies = [ "bytecheck_derive", "ptr_meta", + "simdutf8", ] [[package]] name = "bytecheck_derive" -version = "0.6.9" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e576ebe98e605500b3c8041bb888e966653577172df6dd97398714eb30b9bf" +checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -180,12 +193,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.14.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" dependencies = [ - "darling_core 0.14.2", - "darling_macro 0.14.2", + "darling_core 0.20.3", + "darling_macro 0.20.3", ] [[package]] @@ -199,20 +212,20 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn", + "syn 1.0.107", ] [[package]] name = "darling_core" -version = "0.14.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -223,18 +236,18 @@ checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ "darling_core 0.13.4", "quote", - "syn", + "syn 1.0.107", ] [[package]] name = "darling_macro" -version = "0.14.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ - "darling_core 0.14.2", + "darling_core 0.20.3", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -245,7 +258,7 @@ checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -290,28 +303,28 @@ checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] name = "enumset" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19be8061a06ab6f3a6cf21106c873578bf01bd42ad15e0311a9c76161cb1c753" +checksum = "226c0da7462c13fb57e5cc9e0dc8f0635e7d27f276a3a7fd30054647f669007d" dependencies = [ "enumset_derive", ] [[package]] name = "enumset_derive" -version = "0.6.1" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03e7b551eba279bf0fa88b83a46330168c1560a52a94f5126f892f0b364ab3e0" +checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" dependencies = [ - "darling 0.14.2", + "darling 0.20.3", "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -330,6 +343,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "generic-array" version = "0.14.6" @@ -433,6 +461,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "indenter" version = "0.3.3" @@ -651,6 +689,12 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -660,7 +704,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn", + "syn 1.0.107", "version_check", ] @@ -677,9 +721,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.50" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -732,18 +776,24 @@ checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.8.5" @@ -779,19 +829,20 @@ dependencies = [ [[package]] name = "rend" -version = "0.3.6" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79af64b4b6362ffba04eef3a4e10829718a4896dac19daa741851c86781edf95" +checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" dependencies = [ "bytecheck", ] [[package]] name = "rkyv" -version = "0.7.39" +version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cec2b3485b07d96ddfd3134767b8a447b45ea4eb91448d0a35180ec0ffd5ed15" +checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" dependencies = [ + "bitvec", "bytecheck", "hashbrown", "indexmap", @@ -799,17 +850,19 @@ dependencies = [ "rend", "rkyv_derive", "seahash", + "tinyvec", + "uuid", ] [[package]] name = "rkyv_derive" -version = "0.7.39" +version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eaedadc88b53e36dd32d940ed21ae4d850d5916f2581526921f553a72ac34c4" +checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -853,7 +906,7 @@ checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -886,7 +939,7 @@ dependencies = [ "darling 0.13.4", "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -911,6 +964,12 @@ dependencies = [ "keccak", ] +[[package]] +name = "simdutf8" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" + [[package]] name = "siphasher" version = "0.3.10" @@ -965,7 +1024,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.107", ] [[package]] @@ -979,6 +1038,23 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "target-lexicon" version = "0.12.5" @@ -1011,21 +1087,51 @@ checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.107", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", ] +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "typenum" version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + [[package]] name = "unicode-ident" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.10.0" @@ -1038,6 +1144,17 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "url" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + [[package]] name = "user-host" version = "0.1.0" @@ -1063,6 +1180,12 @@ dependencies = [ "prover", ] +[[package]] +name = "uuid" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" + [[package]] name = "vec_map" version = "0.8.2" @@ -1100,8 +1223,9 @@ dependencies = [ [[package]] name = "wasmer-types" -version = "3.1.0" +version = "4.2.3" dependencies = [ + "bytecheck", "enum-iterator", "enumset", "indexmap", @@ -1113,9 +1237,13 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.83.0" +version = "0.95.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" +checksum = "f2ea896273ea99b15132414be1da01ab0d8836415083298ecaffbe308eaac87a" +dependencies = [ + "indexmap", + "url", +] [[package]] name = "wast" @@ -1216,3 +1344,12 @@ name = "windows_x86_64_msvc" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +]