From aee2ca45cb701c3917d6ee9a8dd2f664d749996b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 24 Aug 2026 13:09:26 -0700 Subject: [PATCH 1/4] Update wasmtime/wasm-tools deps In hopeful preparation for eventually supporting a wasip3 target... Co-authored-by: Joel Dice --- Cargo.lock | 553 +++++++++++++++++++-------------------------- Cargo.toml | 20 +- build.rs | 4 +- runtime/Cargo.toml | 5 +- runtime/src/lib.rs | 75 +++++- src/lib.rs | 13 +- src/link.rs | 9 +- src/stubwasi.rs | 13 +- src/summary.rs | 102 ++++----- src/test/tests.rs | 12 +- 10 files changed, 385 insertions(+), 421 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4a9442c1..c8842db8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,15 +53,6 @@ version = "0.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9d4ee0d472d1cd2e28c97dfa124b3d8d992e10eb0a035f33f5d12e3a177ba3b" -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - [[package]] name = "anstream" version = "1.0.0" @@ -114,9 +105,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.102" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" [[package]] name = "arbitrary" @@ -289,43 +280,49 @@ checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "cap-fs-ext" -version = "3.4.5" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5528f85b1e134ae811704e41ef80930f56e795923f866813255bc342cc20654" +checksum = "56ff379b70af8e08307a8f65e7040c7301cb4a572538ade16b4984f0da77847f" dependencies = [ - "cap-primitives", - "cap-std", - "io-lifetimes", - "windows-sys 0.59.0", + "cap-primitives 4.0.3", + "cap-std 4.0.3", + "io-lifetimes 3.0.1", + "windows-sys 0.61.2", ] [[package]] -name = "cap-net-ext" +name = "cap-primitives" version = "3.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20a158160765c6a7d0d8c072a53d772e4cb243f38b04bfcf6b4939cfbe7482e7" +checksum = "b6cf3aea8a5081171859ef57bc1606b1df6999df4f1110f8eef68b30098d1d3a" dependencies = [ - "cap-primitives", - "cap-std", + "ambient-authority", + "fs-set-times", + "io-extras 0.18.4", + "io-lifetimes 2.0.4", + "ipnet", + "maybe-owned", "rustix", - "smallvec", + "rustix-linux-procfs", + "windows-sys 0.59.0", + "winx", ] [[package]] name = "cap-primitives" -version = "3.4.5" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6cf3aea8a5081171859ef57bc1606b1df6999df4f1110f8eef68b30098d1d3a" +checksum = "8b5f74729fd2f44701d1a8eb47e906cdb3ccd9ec0f02baad85a744b791940b18" dependencies = [ "ambient-authority", "fs-set-times", - "io-extras", - "io-lifetimes", + "io-extras 0.19.0", + "io-lifetimes 3.0.1", "ipnet", "maybe-owned", "rustix", "rustix-linux-procfs", - "windows-sys 0.59.0", + "windows-sys 0.61.2", "winx", ] @@ -335,24 +332,22 @@ version = "3.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6dc3090992a735d23219de5c204927163d922f42f575a0189b005c62d37549a" dependencies = [ - "cap-primitives", - "io-extras", - "io-lifetimes", + "cap-primitives 3.4.5", + "io-extras 0.18.4", + "io-lifetimes 2.0.4", "rustix", ] [[package]] -name = "cap-time-ext" -version = "3.4.5" +name = "cap-std" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "def102506ce40c11710a9b16e614af0cde8e76ae51b1f48c04b8d79f4b671a80" +checksum = "c1ec78e242cfa2cfe276807ac2ecc00315a6c97786977414bcd1c3963b6c91b8" dependencies = [ - "ambient-authority", - "cap-primitives", - "iana-time-zone", - "once_cell", + "cap-primitives 4.0.3", + "io-extras 0.19.0", + "io-lifetimes 3.0.1", "rustix", - "winx", ] [[package]] @@ -468,7 +463,7 @@ dependencies = [ "async-trait", "bincode", "bytes", - "cap-std", + "cap-std 3.4.5", "clap", "component-init-transform", "componentize-py-test-generator", @@ -491,14 +486,14 @@ dependencies = [ "tempfile", "tokio", "toml 0.8.23", - "wasm-encoder 0.245.1", - "wasmparser 0.245.1", + "wasm-encoder 0.258.0", + "wasmparser 0.258.0", "wasmtime", "wasmtime-wasi", - "wit-bindgen-core 0.53.1", - "wit-component 0.245.1", + "wit-bindgen-core 0.61.0", + "wit-component 0.258.0", "wit-dylib", - "wit-parser 0.245.1", + "wit-parser 0.258.0", "zstd", ] @@ -510,7 +505,7 @@ dependencies = [ "num-bigint", "once_cell", "pyo3", - "wit-bindgen 0.52.0", + "wit-bindgen 0.61.0", "wit-dylib-ffi", ] @@ -544,17 +539,11 @@ version = "0.4.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc14f565cf027a105f7a44ccf9e5b424348421a1d8952a8fc9d499d313107789" -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - [[package]] name = "cpp_demangle" -version = "0.4.5" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2bb79cb74d735044c972aae58ed0aaa9a837e85b01106a54c39e42e97f62253" +checksum = "0667304c32ea56cb4cd6d2d7c0cfe9a2f8041229db8c033af7f8d69492429def" dependencies = [ "cfg-if", ] @@ -579,27 +568,27 @@ dependencies = [ [[package]] name = "cranelift-assembler-x64" -version = "0.133.1" +version = "0.135.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e06aeba2c965fc446d13c56a6ccb2631b78445d7544543dd9a25289977630914" +checksum = "a4a59ddc4abd9c5560f4742864b2cd8c19e73c7263f0c866b2c45c2d31587adc" dependencies = [ "cranelift-assembler-x64-meta", ] [[package]] name = "cranelift-assembler-x64-meta" -version = "0.133.1" +version = "0.135.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2d2dde4ec1352715595b5cfa6fe2e5b8ebb9da3457b3ee8db0aa2808c069aa" +checksum = "8a8c361cd22fd0fdd8e61af6bfd86ad9c0c62f78b2b1caa2b9e4e97cd8f605fe" dependencies = [ "cranelift-srcgen", ] [[package]] name = "cranelift-bforest" -version = "0.133.1" +version = "0.135.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b4982ef9fa54ec9eee841e891e7ddc5434be1250e88de31572e000c888f30b" +checksum = "b86c34ae183cf2410318f899648fe1ef6ab9148486e7b938d7b4d814e61dafc9" dependencies = [ "cranelift-entity", "wasmtime-internal-core", @@ -607,9 +596,9 @@ dependencies = [ [[package]] name = "cranelift-bitset" -version = "0.133.1" +version = "0.135.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "529143118c4eeb58c39ecb02319557d512be6c61348486422974ab8e3906b8a8" +checksum = "415f1a12668869e16ac3b66a729fb8cce8bbe6e50e68d1fa0142acd0c9c05f0c" dependencies = [ "serde", "serde_derive", @@ -618,9 +607,9 @@ dependencies = [ [[package]] name = "cranelift-codegen" -version = "0.133.1" +version = "0.135.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7780677247ad3577e3a6a3ebf43f39b325a11d6393db72b2c9968a910d4d13d" +checksum = "73eecedc85ffca4f34dbe197c6545c8ade6579a61352457936f53c3bffa6353b" dependencies = [ "bumpalo", "cranelift-assembler-x64", @@ -649,9 +638,9 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.133.1" +version = "0.135.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac9645250416cbf92454fe61160e17e026e0ce405906a54500b114f923ddffc9" +checksum = "66834005198c3e9e3d89cd69cf1541419402ab75250afbeaa3128db6d5254025" dependencies = [ "cranelift-assembler-x64-meta", "cranelift-codegen-shared", @@ -662,24 +651,24 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" -version = "0.133.1" +version = "0.135.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20ee8d222ff0fd3681791979afbf88586ac9f49010d3db96b3cbe4c96759aee3" +checksum = "7e6efaf74077091a2ff41317cc8eb2779264dae4b8a16d955835f3fcda338f52" [[package]] name = "cranelift-control" -version = "0.133.1" +version = "0.135.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "591abe6f5312bd2c4220f1b3bead56c2ad00257c52668015ba013b85dcf2a17a" +checksum = "a4258d4ed6ad4e698fe1fec4277b1fcbea6f2a17cb5ec3f04bddfb38ca83d93e" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.133.1" +version = "0.135.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5300c49cf940526fe771517b3b3eabd5d0ff164ee61698579cf403fe8d3af3c" +checksum = "4f016b6f87b1a46a3f5df59b82d88bb352bf2fa6d7868875dfc4d6b65de5242d" dependencies = [ "cranelift-bitset", "serde", @@ -689,9 +678,9 @@ dependencies = [ [[package]] name = "cranelift-frontend" -version = "0.133.1" +version = "0.135.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da4adbf760207fdbbe130f1191cce01cdef66831a9f648b1f39ff2800d126d45" +checksum = "b16f2b149dae6ea3886bee931445196d86d8e71b66f7c3b21abe434f77189be8" dependencies = [ "cranelift-codegen", "hashbrown 0.17.1", @@ -702,15 +691,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.133.1" +version = "0.135.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8315b21ff018226a42a60a4702c2dd75f6447cac26e9bca622e14c22088c2ff5" +checksum = "f00258ff3d37f52ed731df679205e66175c728846dbde186ee20e93973d12ee7" [[package]] name = "cranelift-native" -version = "0.133.1" +version = "0.135.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d506ef23a60715bde451b06620b14402166ded3b648454fccbf04f3e46a4aa70" +checksum = "4f31eb7e08f31e5bc9c167c35718b0325efa3d4e234e2e9342316e01b18a4b51" dependencies = [ "cranelift-codegen", "libc", @@ -719,9 +708,9 @@ dependencies = [ [[package]] name = "cranelift-srcgen" -version = "0.133.1" +version = "0.135.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48ed47e602652e3410f9387fc0db70fefadcee4d78a78881421aabcab4e26b89" +checksum = "2e0b67d313f510520f40c1496c3446af0d6b30219d1ba9a4c09c77ec288a561b" [[package]] name = "crc32fast" @@ -960,7 +949,7 @@ version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a" dependencies = [ - "io-lifetimes", + "io-lifetimes 2.0.4", "rustix", "windows-sys 0.59.0", ] @@ -1151,11 +1140,6 @@ name = "hashbrown" version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" -dependencies = [ - "foldhash 0.2.0", - "serde", - "serde_core", -] [[package]] name = "hashbrown" @@ -1290,30 +1274,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "iana-time-zone" -version = "0.1.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - [[package]] name = "icu_collections" version = "2.2.0" @@ -1455,16 +1415,32 @@ version = "0.18.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2285ddfe3054097ef4b2fe909ef8c3bcd1ea52a8f0d274416caebeef39f04a65" dependencies = [ - "io-lifetimes", + "io-lifetimes 2.0.4", "windows-sys 0.59.0", ] +[[package]] +name = "io-extras" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20fd6de4ccfcc187e38bc21cfa543cb5a302cb86a8b114eb7f0bf0dc9f8ac00f" +dependencies = [ + "io-lifetimes 3.0.1", + "windows-sys 0.60.2", +] + [[package]] name = "io-lifetimes" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06432fb54d3be7964ecd3649233cddf80db2832f47fec34c01f65b3d9d774983" +[[package]] +name = "io-lifetimes" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0fb0570afe1fed943c5c3d4102d5358592d8625fda6a0007fdbe65a92fba96" + [[package]] name = "ipnet" version = "2.12.0" @@ -1851,9 +1827,9 @@ dependencies = [ [[package]] name = "pulley-interpreter" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b92604caae1a1899b6a5b54967289dd538177c626004c91accf9d0ec7e4a12" +checksum = "c455b90365c6c8fc95da08bfdb50090dc0ce5c77ce2585025d12370dbb2a7b14" dependencies = [ "cranelift-bitset", "log", @@ -1863,9 +1839,9 @@ dependencies = [ [[package]] name = "pulley-macros" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a7ac85c0bb3fb351f10d531230aaa5e366b46d7c4e5328e5f02801d6dac1165" +checksum = "92e6c1756d5b8ce2a6353593fc15a21ffbfbc7c030f0ea02eb53d61aa4121c07" dependencies = [ "proc-macro2", "quote", @@ -2117,9 +2093,9 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de2c52737737f8609e94f975dee22854a2d5c125772d4b1cf292120f4d45c186" +checksum = "757712e8e61590d6d4f5d563483755538b5aa13467837a3b41cd9832509a7f85" dependencies = [ "allocator-api2", "bumpalo", @@ -3013,9 +2989,9 @@ dependencies = [ [[package]] name = "wasm-compose" -version = "0.251.0" +version = "0.254.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b089037d7eb453ed57b560fe7833de0707411c8b9fdc429745ced77e2a1bacb9" +checksum = "8fd717357bff09b5f1ea49aea8ed1cd149b0c521823a1cc70bc2ac16b90b651a" dependencies = [ "anyhow", "heck", @@ -3023,8 +2999,8 @@ dependencies = [ "log", "petgraph", "smallvec", - "wasm-encoder 0.251.0", - "wasmparser 0.251.0", + "wasm-encoder 0.254.0", + "wasmparser 0.254.0", "wat", ] @@ -3040,32 +3016,22 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.245.1" +version = "0.254.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9dca005e69bf015e45577e415b9af8c67e8ee3c0e38b5b0add5aa92581ed5c" +checksum = "09480d646178e5fdd12bb06e812d0af9a3a191dbc9cd697fdc86687beade7393" dependencies = [ "leb128fmt", - "wasmparser 0.245.1", + "wasmparser 0.254.0", ] [[package]] name = "wasm-encoder" -version = "0.251.0" +version = "0.258.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a879a421bd17c528b74721b2abf4c62e8f1d1889c2ba8c3c50d02deaf2ce395" +checksum = "e974fe6821a8cf64575d51ea2194e2c8f77e7b66e9afe7419ce8a97f9ee0d251" dependencies = [ "leb128fmt", - "wasmparser 0.251.0", -] - -[[package]] -name = "wasm-encoder" -version = "0.252.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8185ae345fa5687c054626ff9a50e7089797a343d9904d1dc9820eb4c4d3196f" -dependencies = [ - "leb128fmt", - "wasmparser 0.252.0", + "wasmparser 0.258.0", ] [[package]] @@ -3089,37 +3055,36 @@ dependencies = [ [[package]] name = "wasm-metadata" -version = "0.245.1" +version = "0.254.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da55e60097e8b37b475a0fa35c3420dd71d9eb7bd66109978ab55faf56a57efb" +checksum = "b01df5f3b4ca7881e843f3bc0fb8a3905d79c68692250dcb8e33e698705ccdb6" dependencies = [ "anyhow", "indexmap", - "wasm-encoder 0.245.1", - "wasmparser 0.245.1", + "wasm-encoder 0.254.0", + "wasmparser 0.254.0", ] [[package]] -name = "wasmparser" -version = "0.244.0" +name = "wasm-metadata" +version = "0.258.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +checksum = "18a11585adb92fe9b55ad1d760e8d8fb5d87e0d2e303cb8eed57f078d54293a2" dependencies = [ - "bitflags", - "hashbrown 0.15.5", + "anyhow", "indexmap", - "semver", - "serde", + "wasm-encoder 0.258.0", + "wasmparser 0.258.0", ] [[package]] name = "wasmparser" -version = "0.245.1" +version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f08c9adee0428b7bddf3890fc27e015ac4b761cc608c822667102b8bfd6995e" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ "bitflags", - "hashbrown 0.16.1", + "hashbrown 0.15.5", "indexmap", "semver", "serde", @@ -3127,9 +3092,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.251.0" +version = "0.254.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "437970b35b1a85cfde9c74b2398352d8d653f3bd8e3a3db0c063ea8f5b4b36ff" +checksum = "d5769a29f799fbab136aaf65b4fe5384cd7d93fe6fc9ba0dcb6c8382a1f16e27" dependencies = [ "bitflags", "hashbrown 0.17.1", @@ -3140,31 +3105,33 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.252.0" +version = "0.258.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3eb099dcadcde5be9eef55e3a337128efd4e44b4c93122487e4d2e4e1c6627c" +checksum = "d9a61719f93a87b16d325921e251800c4833f8fab50fa21c7de73aed50086313" dependencies = [ "bitflags", + "hashbrown 0.17.1", "indexmap", "semver", + "serde", ] [[package]] name = "wasmprinter" -version = "0.251.0" +version = "0.254.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8798c1a699bd25648b6708eefe94d97c6f9891febb94b42cca1f7a4b086ea64e" +checksum = "64e3ba11e024f504698f87b629b2b66c22a1231758de7607754963f7d198be39" dependencies = [ "anyhow", "termcolor", - "wasmparser 0.251.0", + "wasmparser 0.254.0", ] [[package]] name = "wasmtime" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4213d2f019a5e44aa8a61d8826dd33a505bff79f749b14a8bafd67321cb9351" +checksum = "f12115b509def01c338ec8ee9b52c4cefb27f7b8db57279c5c7cfe2e9eaf9900" dependencies = [ "addr2line", "async-trait", @@ -3172,7 +3139,6 @@ dependencies = [ "bumpalo", "bytes", "cc", - "cfg-if", "encoding_rs", "futures", "fxprof-processed-profile", @@ -3196,8 +3162,8 @@ dependencies = [ "target-lexicon", "tempfile", "wasm-compose", - "wasm-encoder 0.251.0", - "wasmparser 0.251.0", + "wasm-encoder 0.254.0", + "wasmparser 0.254.0", "wasmtime-environ", "wasmtime-internal-cache", "wasmtime-internal-component-macro", @@ -3211,14 +3177,14 @@ dependencies = [ "wasmtime-internal-versioned-export-macros", "wat", "windows-sys 0.61.2", - "wit-parser 0.251.0", + "wit-parser 0.254.0", ] [[package]] name = "wasmtime-environ" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d45863de41977ec6453e859cf843d456fa3fcb45a659b66d16e794f90ec4f5b7" +checksum = "13b153945550fe9f370f611b33a2b6398cb9b6be333e3bc49e4cbe5219ef44b9" dependencies = [ "anyhow", "cpp_demangle", @@ -3238,8 +3204,8 @@ dependencies = [ "sha2", "smallvec", "target-lexicon", - "wasm-encoder 0.251.0", - "wasmparser 0.251.0", + "wasm-encoder 0.254.0", + "wasmparser 0.254.0", "wasmprinter", "wasmtime-internal-component-util", "wasmtime-internal-core", @@ -3247,9 +3213,9 @@ dependencies = [ [[package]] name = "wasmtime-internal-cache" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "438bc7dc45fb75297d75f79a9a0ce852345d13ebc6a6863f6f688f013836a9dd" +checksum = "4e1464c6a7ece16f1aeeab9a62d4a821581d143d6dfd462a99b66b04d31431da" dependencies = [ "base64", "directories-next", @@ -3267,9 +3233,9 @@ dependencies = [ [[package]] name = "wasmtime-internal-component-macro" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1e48f8d4966d62a10b6d70722bc432c1e163890be2801d3b5784589ad36ffc3" +checksum = "3791d98e7fa804e2a3ac13e1436b73c742bf358448ed6dc269872bf770061292" dependencies = [ "anyhow", "proc-macro2", @@ -3277,20 +3243,20 @@ dependencies = [ "syn", "wasmtime-internal-component-util", "wasmtime-internal-wit-bindgen", - "wit-parser 0.251.0", + "wit-parser 0.254.0", ] [[package]] name = "wasmtime-internal-component-util" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819ad5abd5822a22dbf4014475cdfd1fe790707761cd732d74aaa3ba4d5ba489" +checksum = "9d20fde8e4a894972646b183622e49212105960daa0a16621da41622464c9fc1" [[package]] name = "wasmtime-internal-core" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fc28372e36eaf8cf70faa83b5779137f7e99c8d18569a125d1580e735cc9e4d" +checksum = "2c01c81d781512e17b38c3a76ca9aa2564bc3f9fd8ff6ffc77ba3e1c290d488a" dependencies = [ "anyhow", "hashbrown 0.17.1", @@ -3300,11 +3266,10 @@ dependencies = [ [[package]] name = "wasmtime-internal-cranelift" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a433efc6e35112a5457e1dc8bc4d8d39820ac7722267e89bc04e5df641f32124" +checksum = "a83f10fbd4bcacec9bcf7be49932a738356ec027816230f9d6f053433b3de97f" dependencies = [ - "cfg-if", "cranelift-codegen", "cranelift-control", "cranelift-entity", @@ -3318,7 +3283,7 @@ dependencies = [ "smallvec", "target-lexicon", "thiserror 2.0.18", - "wasmparser 0.251.0", + "wasmparser 0.254.0", "wasmtime-environ", "wasmtime-internal-core", "wasmtime-internal-unwinder", @@ -3327,12 +3292,11 @@ dependencies = [ [[package]] name = "wasmtime-internal-fiber" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a1d3a39d0d210f6b8574ee96a4315e0a14c67f3a1fc3cd5372cb10d2fb4422" +checksum = "9d327512b9aaf18d41c8de650e1bbd9d8cbedc101fb0a9774a70c0e63a94e1bc" dependencies = [ "cc", - "cfg-if", "libc", "rustix", "wasmtime-environ", @@ -3342,9 +3306,9 @@ dependencies = [ [[package]] name = "wasmtime-internal-jit-debug" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f667288cb4dfa68a4639ffac4d5628535dda64ebdc2b990526efb12b30ba803" +checksum = "7fdc7614412bf6cfc99c90367e580940db2f75513bef1455d667e25ba37eb21f" dependencies = [ "cc", "object", @@ -3354,11 +3318,10 @@ dependencies = [ [[package]] name = "wasmtime-internal-jit-icache-coherence" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba651d44ab0faad4c58106b3adb45068189fb65ef50f0c404b6d9e3bf81a357" +checksum = "2a09abde04346919af1136a28f344e200685509e28815aef4c39dc08977cc1d8" dependencies = [ - "cfg-if", "libc", "wasmtime-internal-core", "windows-sys 0.61.2", @@ -3366,11 +3329,10 @@ dependencies = [ [[package]] name = "wasmtime-internal-unwinder" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ecc52563b0558af2a7487eb710de07cc4532564b55528876129238e83118cb1" +checksum = "cc0221393863c248fcb3d02afb7d83b4e690f0878fb095173ccfb9ea24456c28" dependencies = [ - "cfg-if", "cranelift-codegen", "log", "object", @@ -3379,9 +3341,9 @@ dependencies = [ [[package]] name = "wasmtime-internal-versioned-export-macros" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e747f4a074699ba1b4e4d841fb263f9b7df5bd1555181c4752bf5990d21ba676" +checksum = "fb0941017d1ae98c02bc7ab1935d6ccb037481fe6d3dad49cb43de19781ffa42" dependencies = [ "proc-macro2", "quote", @@ -3390,34 +3352,30 @@ dependencies = [ [[package]] name = "wasmtime-internal-wit-bindgen" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80009f46991622814196d96fac6fc0a938f46b5cba737a8f4e21e24e5a03856f" +checksum = "e34575ad64da80c2b075262905624f222ea33793519cd877c8fe051d2f54a520" dependencies = [ "anyhow", "bitflags", "heck", "indexmap", - "wit-parser 0.251.0", + "wit-component 0.254.0", + "wit-parser 0.254.0", ] [[package]] name = "wasmtime-wasi" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f65ef30a2c5478873cdb619085a7a649d3ce41cc3eaf298a7ce3dee96a8e11" +checksum = "506031bd0149c5ce550cac51a83b8b30f5bb564f6e7f6b05534eed97fd60357b" dependencies = [ "async-trait", "bitflags", "bytes", "cap-fs-ext", - "cap-net-ext", - "cap-std", - "cap-time-ext", - "cfg-if", + "cap-primitives 4.0.3", "futures", - "io-extras", - "io-lifetimes", "rand 0.10.2", "rustix", "thiserror 2.0.18", @@ -3432,9 +3390,9 @@ dependencies = [ [[package]] name = "wasmtime-wasi-io" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee57d5fef4976b1ab542615f4cef2c43278eb549d8078939668ea0f13d5c696" +checksum = "73bc54df469cdfd9fa82d80bf69253c4d23cb90ee4c1ca8b009cad59713ba794" dependencies = [ "async-trait", "bytes", @@ -3454,24 +3412,24 @@ dependencies = [ [[package]] name = "wast" -version = "252.0.0" +version = "258.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942a3449d6a593fccc111a6241c8df52bda168af30e40bf9580d4394d7374c65" +checksum = "97f7defc7ecca8b19ac7f824598eadd0c53985ee00c74060d65051e9da5b58a1" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width", - "wasm-encoder 0.252.0", + "wasm-encoder 0.258.0", ] [[package]] name = "wat" -version = "1.252.0" +version = "1.258.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c72a4ba7088f7bac94cf516e49882bdf97068904a563768cf249efc839ec42cb" +checksum = "7555c008cca87f2ac58d9f83ccda7e7b44611093ce28eb28f052e7c78024b9bf" dependencies = [ - "wast 252.0.0", + "wast 258.0.0", ] [[package]] @@ -3505,9 +3463,9 @@ dependencies = [ [[package]] name = "wiggle" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e03df88bf1a6068b02851aa3ef9427d285118f5c1c153b068a8995c69dd9562a" +checksum = "bfe256c1d97c59cd5e1cd3364c64f88cdd64432afcc9d153fd7353b75a67b45b" dependencies = [ "bitflags", "thiserror 2.0.18", @@ -3519,9 +3477,9 @@ dependencies = [ [[package]] name = "wiggle-generate" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e014aec8661b613154377e4b49dbbb0dfc4f424efcee749782054576c00537d9" +checksum = "46a1a1e72102163f98f79d5619c1a61136bbf4b1c4be06051e4a7e730c0c4986" dependencies = [ "heck", "proc-macro2", @@ -3533,9 +3491,9 @@ dependencies = [ [[package]] name = "wiggle-macro" -version = "46.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f67310a8ae5190b7f3dcacf8697f2890701a3a8427b3e77ed91d3632dcedaceb" +checksum = "c31d70e43e2cc7c981d77b52240c880f9a00d5a33f94c5bf878827d92f2be862" dependencies = [ "proc-macro2", "quote", @@ -3574,65 +3532,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-core" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link", - "windows-result", - "windows-strings", -] - -[[package]] -name = "windows-implement" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "windows-interface" -version = "0.59.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" -[[package]] -name = "windows-result" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-strings" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" -dependencies = [ - "windows-link", -] - [[package]] name = "windows-sys" version = "0.52.0" @@ -3832,15 +3737,6 @@ dependencies = [ "wit-bindgen-rust-macro 0.51.0", ] -[[package]] -name = "wit-bindgen" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e048f41ef90f0b5dd61f1059c35f5636252e56813bf616d0803aa3739867230" -dependencies = [ - "wit-bindgen-rust-macro 0.52.0", -] - [[package]] name = "wit-bindgen" version = "0.57.1" @@ -3848,21 +3744,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" [[package]] -name = "wit-bindgen-core" -version = "0.51.0" +name = "wit-bindgen" +version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +checksum = "fbfef9403167686bfe35ffa8787df4c0f50742e5b0f471c7fb156a6614193c5d" dependencies = [ - "anyhow", - "heck", - "wit-parser 0.244.0", + "wit-bindgen-rust-macro 0.61.0", ] [[package]] name = "wit-bindgen-core" -version = "0.52.0" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c15e7a56641cc9040480a26526a3229cbc4e8065adf98c9755d21c4c9b446c4c" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" dependencies = [ "anyhow", "heck", @@ -3871,13 +3765,13 @@ dependencies = [ [[package]] name = "wit-bindgen-core" -version = "0.53.1" +version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3deda4b7e9f522d994906f6e6e0fc67965ea8660306940a776b76732be8f3933" +checksum = "4814f3904ce1f5ba05f82d868edd2e0fc197b3f87f930b0777ca795de17df772" dependencies = [ "anyhow", "heck", - "wit-parser 0.245.1", + "wit-parser 0.258.0", ] [[package]] @@ -3898,18 +3792,18 @@ dependencies = [ [[package]] name = "wit-bindgen-rust" -version = "0.52.0" +version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd81b0ae1ec492bfe91683f1da6db6492ebc682e72d4f2715619dba783b066ca" +checksum = "b4c760bc63d9d3271f0e6476eba4c37707d983cf492095a9db1fed232f29d551" dependencies = [ "anyhow", "heck", "indexmap", "prettyplease", "syn", - "wasm-metadata 0.244.0", - "wit-bindgen-core 0.52.0", - "wit-component 0.244.0", + "wasm-metadata 0.258.0", + "wit-bindgen-core 0.61.0", + "wit-component 0.258.0", ] [[package]] @@ -3929,17 +3823,17 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" -version = "0.52.0" +version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e6ce04c549e7149b66a70d34fc5a2a01b374bf49ca61db65d16e3ae922866e" +checksum = "3521448f8b53272f9aa1caf134e8f008ce13a2b43b832672435c0c5328b01077" dependencies = [ "anyhow", "prettyplease", "proc-macro2", "quote", "syn", - "wit-bindgen-core 0.52.0", - "wit-bindgen-rust 0.52.0", + "wit-bindgen-core 0.61.0", + "wit-bindgen-rust 0.61.0", ] [[package]] @@ -3963,9 +3857,9 @@ dependencies = [ [[package]] name = "wit-component" -version = "0.245.1" +version = "0.254.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4894f10d2d5cbc17c77e91f86a1e48e191a788da4425293b55c98b44ba3fcac9" +checksum = "b0e65bb94c369b3c4741ce3d1d2704b1fec93db7c540df0e521a097e7ceeb5be" dependencies = [ "anyhow", "bitflags", @@ -3974,28 +3868,47 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder 0.245.1", - "wasm-metadata 0.245.1", - "wasmparser 0.245.1", - "wit-parser 0.245.1", + "wasm-encoder 0.254.0", + "wasm-metadata 0.254.0", + "wasmparser 0.254.0", + "wit-parser 0.254.0", +] + +[[package]] +name = "wit-component" +version = "0.258.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "481b5c47b2ecce0389b5e08a05557d6a190c9cd761773b8880a8017ee04dc7ef" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder 0.258.0", + "wasm-metadata 0.258.0", + "wasmparser 0.258.0", + "wit-parser 0.258.0", ] [[package]] name = "wit-dylib" -version = "0.245.1" +version = "0.258.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cfce934866f549164ec28f91d9b0db4a6e9b4c31f87090cf01504f249e630dc" +checksum = "b2d327c800c0fbf8c59c792711d7b945689b5252dcd39a538dea3176905be15d" dependencies = [ "anyhow", "indexmap", - "wasm-encoder 0.245.1", - "wit-parser 0.245.1", + "wasm-encoder 0.258.0", + "wit-parser 0.258.0", ] [[package]] name = "wit-dylib-ffi" version = "0.1.0" -source = "git+https://github.com/dicej/wasm-tools?rev=b072b0ca#b072b0caa8307779558d96a62bc9522abda6a7fb" +source = "git+https://github.com/bytecodealliance/wasm-tools?tag=v1.258.0#5c6d31c78f8bd503f558441ef9c732950a141d1a" [[package]] name = "wit-parser" @@ -4017,12 +3930,12 @@ dependencies = [ [[package]] name = "wit-parser" -version = "0.245.1" +version = "0.254.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "330698718e82983499419494dd1e3d7811a457a9bf9f69734e8c5f07a2547929" +checksum = "1655131e4f7d3f0cb141f6eca71315ca40eff0f3d4de7cff0a82bacedd8c89b4" dependencies = [ "anyhow", - "hashbrown 0.16.1", + "hashbrown 0.17.1", "id-arena", "indexmap", "log", @@ -4030,15 +3943,15 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "unicode-xid", - "wasmparser 0.245.1", + "unicode-ident", + "wasmparser 0.254.0", ] [[package]] name = "wit-parser" -version = "0.251.0" +version = "0.258.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e960732e824fab95099971a09e638979347c94ca48568d3c854c945729196947" +checksum = "ff4daaa3cd97ae49ecd0a99dc009d453f93e0f083dd3be38c0f24a83a93e37ac" dependencies = [ "anyhow", "hashbrown 0.17.1", @@ -4049,8 +3962,8 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "unicode-xid", - "wasmparser 0.251.0", + "unicode-ident", + "wasmparser 0.258.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index f4a96d67..7804fb50 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,11 +16,11 @@ clap = { version = "4.5.20", features = ["derive"] } tar = "0.4.42" tempfile = "3.13.0" zstd = "0.13.2" -wasm-encoder = { version = "0.245.0", features = ["wasmparser"] } -wit-dylib = "0.245.0" -wit-parser = "0.245.0" -wit-component = "0.245.0" -wasmparser = "0.245.0" +wasm-encoder = { version = "0.258.0", features = ["wasmparser"] } +wit-dylib = "0.258.0" +wit-parser = "0.258.0" +wit-component = "0.258.0" +wasmparser = "0.258.0" indexmap = "2.6.0" bincode = "1.3.3" heck = "0.5.0" @@ -28,8 +28,8 @@ pyo3 = { version = "0.28.3", features = [ "abi3-py39", "extension-module", ], optional = true } -wasmtime = "46.0.1" -wasmtime-wasi = { version = "46.0.1", features = [ "p3" ] } +wasmtime = "48.0.0" +wasmtime-wasi = { version = "48.0.0", features = [ "p3" ] } once_cell = "1.20.2" component-init-transform = "0.2.0" async-trait = "0.1.83" @@ -47,7 +47,7 @@ im-rc = "15.1.0" serde = { version = "1.0.213", features = ["derive"] } toml = "0.8.19" semver = "1.0.23" -wit-bindgen-core = "0.53.1" +wit-bindgen-core = "0.61.0" [dev-dependencies] assert_cmd = "2.0.16" @@ -81,8 +81,8 @@ tar = "0.4.41" zstd = "0.13.2" componentize-py-test-generator = { path = "test-generator", version = "0.25.0" } flate2 = "1.1.1" -wasmparser = "0.245.0" -wasm-encoder = "0.245.0" +wasmparser = "0.258.0" +wasm-encoder = "0.258.0" [workspace] package.version = "0.25.0" diff --git a/build.rs b/build.rs index 6c6e44ac..6e467325 100644 --- a/build.rs +++ b/build.rs @@ -1,7 +1,7 @@ #![deny(warnings)] use { - anyhow::{Context, Result, anyhow, bail}, + anyhow::{anyhow, bail, Context, Result}, std::{ env, fmt::Write as _, @@ -810,7 +810,7 @@ fn strip(input: &[u8]) -> anyhow::Result> { if let Some((id, range)) = payload.as_section() { RawSection { id, - data: &input[range], + data: &input[range.start as usize..range.end as usize], } .append_to(&mut output); } diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index ecda6a83..e2d8576c 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -13,9 +13,8 @@ anyhow = "1.0.91" once_cell = "1.20.2" pyo3 = { version="0.28.3", features = ["abi3-py312", "num-bigint"] } num-bigint = "0.4.6" -wit-bindgen = { version = "0.52.0", default-features = false, features = ["macros", "realloc"] } -# TODO: switch to a release when available: -wit-dylib-ffi = { git = "https://github.com/dicej/wasm-tools", rev = "b072b0ca", features = ["async-raw"] } +wit-bindgen = { version = "0.61.0", default-features = false, features = ["macros", "realloc"] } +wit-dylib-ffi = { git = "https://github.com/bytecodealliance/wasm-tools", tag = "v1.258.0", features = ["async-raw"] } [features] async = [] diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 1417a9e4..f9664690 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -20,13 +20,14 @@ use { num_bigint::BigUint, once_cell::sync::OnceCell, pyo3::{ - Bound, IntoPyObject, Py, PyAny, PyErr, PyResult, Python, exceptions::PyAssertionError, intern, types::{ - PyAnyMethods, PyBool, PyBytes, PyBytesMethods, PyDict, PyList, PyListMethods, - PyMapping, PyMappingMethods, PyModule, PyModuleMethods, PyString, PyTuple, + PyAnyMethods, PyBool, PyBytes, PyBytesMethods, PyDict, PyDictMethods, PyList, + PyListMethods, PyMapping, PyMappingMethods, PyModule, PyModuleMethods, PyString, + PyTuple, }, + Bound, IntoPyObject, Py, PyAny, PyErr, PyResult, Python, }, std::{ alloc::{self, Layout}, @@ -36,7 +37,7 @@ use { sync::Once, }, wit_dylib_ffi::{ - self as wit, Call, ExportFunction, Interpreter, List, Type, Wit, WitOption, WitResult, + self as wit, Call, ExportFunction, Interpreter, List, Map, Type, Wit, WitOption, WitResult, }, }; @@ -816,10 +817,10 @@ mod async_ { ty.write()(handle, buffer.cast()) }; - let resources = call - .resources - .take() - .and_then(|v| if v.is_empty() { None } else { Some(v) }); + let resources = + call.resources + .take() + .and_then(|v| if v.is_empty() { None } else { Some(v) }); Ok(if code == RETURN_CODE_BLOCKED { ERR_CONSTRUCTOR @@ -1638,6 +1639,7 @@ impl Call for MyCall<'_> { .bind(py) .get_item(value.get_type()) .unwrap() + .unwrap() .extract::() .unwrap(); @@ -1705,7 +1707,7 @@ impl Call for MyCall<'_> { }) } - fn pop_iter_next(&mut self, _ty: List) { + fn pop_list_iter_next(&mut self, _ty: List) { Python::attach(|py| { let index = *self.iter_stack.last().unwrap(); let element = self @@ -1721,7 +1723,40 @@ impl Call for MyCall<'_> { }) } - fn pop_iter(&mut self, _ty: List) { + fn pop_list_iter(&mut self, _ty: List) { + self.iter_stack.pop().unwrap(); + Python::attach(|py| { + self.stack.pop().unwrap().drop_ref(py); + }) + } + + fn pop_map(&mut self, _ty: Map) -> usize { + Python::attach(|py| { + self.iter_stack.push(0); + let value = self.stack.pop().unwrap(); + let value = value.cast_bound::(py).unwrap(); + let length = value.len(); + self.stack.push(value.items().into_any().unbind()); + length + }) + } + + fn pop_map_iter_next(&mut self, _ty: Map) { + Python::attach(|py| { + let index = *self.iter_stack.last().unwrap(); + let items = self.stack.last().unwrap(); + let items = items.cast_bound::(py).unwrap(); + let element = items.get_item(index).unwrap(); + let element = element.cast::().unwrap(); + *self.iter_stack.last_mut().unwrap() = index + 1; + self.stack + .push(element.get_item(1).unwrap().into_any().unbind()); + self.stack + .push(element.get_item(0).unwrap().into_any().unbind()); + }) + } + + fn pop_map_iter(&mut self, _ty: Map) { self.iter_stack.pop().unwrap(); Python::attach(|py| { self.stack.pop().unwrap().drop_ref(py); @@ -2076,6 +2111,26 @@ impl Call for MyCall<'_> { .unwrap() }); } + + fn push_map(&mut self, _ty: Map, _capacity: usize) { + self.stack.push(Python::attach(|py| { + PyDict::new(py).to_owned().into_any().unbind() + })); + } + + fn map_append(&mut self, _ty: Map) { + Python::attach(|py| { + let value = self.stack.pop().unwrap(); + let key = self.stack.pop().unwrap(); + self.stack + .last() + .unwrap() + .cast_bound::(py) + .unwrap() + .set_item(key, value) + .unwrap() + }); + } } fn imported_resource_from_canon(py: Python<'_>, ty: wit::Resource, handle: u32) -> Py { diff --git a/src/lib.rs b/src/lib.rs index c0b52fe6..c05a81b8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,7 +26,7 @@ use { component::{Component, Instance, Linker, ResourceTable, ResourceType}, }, wasmtime_wasi::{ - DirPerms, FilePerms, WasiCtx, WasiCtxBuilder, WasiCtxView, WasiView, + FsPerms, WasiCtx, WasiCtxBuilder, WasiCtxView, WasiView, p2::pipe::{MemoryInputPipe, MemoryOutputPipe}, }, wit_component::metadata, @@ -559,6 +559,7 @@ impl ComponentGenerator<'_> { &resolve, world, Some(&mut DylibOpts { + stack_pointer: wit_dylib::StackPointer::Global, interpreter: Some("libcomponentize_py_runtime.so".into()), async_: Default::default(), }), @@ -680,19 +681,17 @@ impl ComponentGenerator<'_> { .preopened_dir( embedded_python_standard_lib.path(), "python", - DirPerms::all(), - FilePerms::all(), + FsPerms::ReadWrite, )? .preopened_dir( embedded_helper_utils.path(), "bundled", - DirPerms::all(), - FilePerms::all(), + FsPerms::ReadWrite, )?; // Generate guest mounts for each host directory in `python_path`. for (index, path) in python_path.iter().enumerate() { - wasi.preopened_dir(path, index.to_string(), DirPerms::all(), FilePerms::all())?; + wasi.preopened_dir(path, index.to_string(), FsPerms::ReadWrite)?; } // For each Python module with a `componentize-py.toml` file that @@ -785,7 +784,7 @@ impl ComponentGenerator<'_> { world_dir.path().display() ); } - wasi.preopened_dir(world_dir.path(), mount, DirPerms::all(), FilePerms::all())?; + wasi.preopened_dir(world_dir.path(), mount, FsPerms::ReadWrite)?; } } diff --git a/src/link.rs b/src/link.rs index b2286a00..86793864 100644 --- a/src/link.rs +++ b/src/link.rs @@ -5,9 +5,8 @@ use anyhow::Result; use crate::Library; pub fn link_libraries(libraries: &[Library]) -> Result> { - let mut linker = wit_component::Linker::default() - .validate(true) - .use_built_in_libdl(true); + let mut linker = wit_component::Linker::default(); + linker.use_built_in_libdl(true).encoder().validate(true); for Library { name, @@ -15,10 +14,10 @@ pub fn link_libraries(libraries: &[Library]) -> Result> { dl_openable, } in libraries { - linker = linker.library(name, module, *dl_openable)?; + linker.library(name, module, *dl_openable)?; } - linker = linker.adapter( + linker.encoder().adapter( "wasi_snapshot_preview1", &zstd::decode_all(Cursor::new(include_bytes!(concat!( env!("OUT_DIR"), diff --git a/src/stubwasi.rs b/src/stubwasi.rs index 70366f6b..3de45801 100644 --- a/src/stubwasi.rs +++ b/src/stubwasi.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use anyhow::{Error, bail}; +use anyhow::{bail, Error}; use wasm_encoder::{ CodeSection, ExportKind, ExportSection, Function, FunctionSection, Instruction as Ins, Module, TypeSection, @@ -13,9 +13,8 @@ type LinkedStubModules = Option<(Vec, Box u32>)>; pub fn link_stub_modules(libraries: Vec) -> Result { let mut wasi_imports = HashMap::new(); - let mut linker = wit_component::Linker::default() - .validate(true) - .use_built_in_libdl(true); + let mut linker = wit_component::Linker::default(); + linker.use_built_in_libdl(true).encoder().validate(true); for Library { name, @@ -24,11 +23,13 @@ pub fn link_stub_modules(libraries: Vec) -> Result Self { - if full { Self::Full } else { Self::Short } + if full { + Self::Full + } else { + Self::Short + } } } @@ -1201,14 +1205,13 @@ impl<'a> Summary<'a> { unreachable!() }; - assert!( - tree.entry(info.name) - .or_default() - .entry(info.package.map(|p| (p.namespace, p.name))) - .or_default() - .insert(info.package.and_then(|p| p.version), (id, info.naming)) - .is_none() - ); + assert!(tree + .entry(info.name) + .or_default() + .entry(info.package.map(|p| (p.namespace, p.name))) + .or_default() + .insert(info.package.and_then(|p| p.version), (id, info.naming)) + .is_none()); } let mut names = HashMap::new(); @@ -1216,54 +1219,49 @@ impl<'a> Summary<'a> { for (package, versions) in packages { if let Some((package_namespace, package_name)) = package { for (version, &(id, naming)) in versions { - assert!( - names - .insert( - id, - if let Some(version) = version { - if let Some(name) = interface_names.get( - format!( - "{package_namespace}:{package_name}\ + assert!(names + .insert( + id, + if let Some(version) = version { + if let Some(name) = interface_names.get( + format!( + "{package_namespace}:{package_name}\ /{name}@{version}" - ) - .as_str(), - ) { + ) + .as_str(), + ) { + (*name).to_owned() + } else if versions.len() == 1 && naming == Naming::Short { + if packages.len() == 1 { (*name).to_owned() - } else if versions.len() == 1 && naming == Naming::Short { - if packages.len() == 1 { - (*name).to_owned() - } else { - format!("{package_namespace}-{package_name}-{name}") - } } else { - format!( - "{package_namespace}-{package_name}-{name}-{}", - version.to_string().replace('.', "-") - ) + format!("{package_namespace}-{package_name}-{name}") } - } else if let Some(name) = interface_names.get( - format!("{package_namespace}:{package_name}/{name}") - .as_str() - ) { - (*name).to_owned() - } else if packages.len() == 1 && naming == Naming::Short { - (*name).to_owned() } else { - format!("{package_namespace}-{package_name}-{name}",) + format!( + "{package_namespace}-{package_name}-{name}-{}", + version.to_string().replace('.', "-") + ) } - ) - .is_none() - ); + } else if let Some(name) = interface_names.get( + format!("{package_namespace}:{package_name}/{name}").as_str() + ) { + (*name).to_owned() + } else if packages.len() == 1 && naming == Naming::Short { + (*name).to_owned() + } else { + format!("{package_namespace}-{package_name}-{name}",) + } + ) + .is_none()); } } else { - assert!( - names - .insert( - versions.get(&None).unwrap().0, - (*interface_names.get(*name).unwrap_or(name)).to_owned() - ) - .is_none() - ); + assert!(names + .insert( + versions.get(&None).unwrap().0, + (*interface_names.get(*name).unwrap_or(name)).to_owned() + ) + .is_none()); } } } @@ -1422,7 +1420,7 @@ impl<'a> Summary<'a> { let mut future_payloads = HashSet::new(); let mut types = Types::default(); types.analyze(self.resolve); - types.collect_equal_types(self.resolve, &|_| true); + types.collect_equal_types(self.resolve, world, &|_| true); for (index, id) in self.types.iter().copied().enumerate() { if !self diff --git a/src/test/tests.rs b/src/test/tests.rs index 1c61452e..63f9c5d5 100644 --- a/src/test/tests.rs +++ b/src/test/tests.rs @@ -1,10 +1,10 @@ #![allow(non_local_definitions)] use { - super::{Ctx, SEED, Tester}, - anyhow::{Result, anyhow}, + super::{Ctx, Tester, SEED}, + anyhow::{anyhow, Result}, exports::componentize_py::test::streams_and_futures, - futures::{FutureExt, TryStreamExt, channel::oneshot, stream::FuturesUnordered}, + futures::{channel::oneshot, stream::FuturesUnordered, FutureExt, TryStreamExt}, once_cell::sync::Lazy, std::{ collections::BTreeMap, @@ -17,14 +17,14 @@ use { time::Duration, }, wasmtime::{ - Store, StoreContextMut, component::{ Accessor, Destination, FutureConsumer, FutureProducer, FutureReader, HasSelf, InstancePre, Lift, Linker, Resource, ResourceAny, Source, StreamConsumer, StreamProducer, StreamReader, StreamResult, VecBuffer, }, + Store, StoreContextMut, }, - wasmtime_wasi::{DirPerms, FilePerms, WasiCtxBuilder, WasiView}, + wasmtime_wasi::{FsPerms, WasiCtxBuilder, WasiView}, }; wasmtime::component::bindgen!({ @@ -972,7 +972,7 @@ fn filesystem() -> Result<()> { let wasi = WasiCtxBuilder::new() .inherit_stdout() .inherit_stderr() - .preopened_dir(dir.path(), "/", DirPerms::all(), FilePerms::all())? + .preopened_dir(dir.path(), "/", FsPerms::ReadWrite)? .build(); TESTER.test_with_wasi::(wasi, |world, store, runtime| { From fb7fc167ec937077c8f3516ec6f0b8b2139b4cc3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 24 Aug 2026 13:38:20 -0700 Subject: [PATCH 2/4] Run rustfmt --- build.rs | 2 +- runtime/src/lib.rs | 10 ++--- src/lib.rs | 6 +-- src/stubwasi.rs | 2 +- src/summary.rs | 100 +++++++++++++++++++++++---------------------- src/test/tests.rs | 8 ++-- 6 files changed, 63 insertions(+), 65 deletions(-) diff --git a/build.rs b/build.rs index 6e467325..3c0f468b 100644 --- a/build.rs +++ b/build.rs @@ -1,7 +1,7 @@ #![deny(warnings)] use { - anyhow::{anyhow, bail, Context, Result}, + anyhow::{Context, Result, anyhow, bail}, std::{ env, fmt::Write as _, diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index f9664690..0c51d53a 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -20,6 +20,7 @@ use { num_bigint::BigUint, once_cell::sync::OnceCell, pyo3::{ + Bound, IntoPyObject, Py, PyAny, PyErr, PyResult, Python, exceptions::PyAssertionError, intern, types::{ @@ -27,7 +28,6 @@ use { PyListMethods, PyMapping, PyMappingMethods, PyModule, PyModuleMethods, PyString, PyTuple, }, - Bound, IntoPyObject, Py, PyAny, PyErr, PyResult, Python, }, std::{ alloc::{self, Layout}, @@ -817,10 +817,10 @@ mod async_ { ty.write()(handle, buffer.cast()) }; - let resources = - call.resources - .take() - .and_then(|v| if v.is_empty() { None } else { Some(v) }); + let resources = call + .resources + .take() + .and_then(|v| if v.is_empty() { None } else { Some(v) }); Ok(if code == RETURN_CODE_BLOCKED { ERR_CONSTRUCTOR diff --git a/src/lib.rs b/src/lib.rs index c05a81b8..66164909 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -683,11 +683,7 @@ impl ComponentGenerator<'_> { "python", FsPerms::ReadWrite, )? - .preopened_dir( - embedded_helper_utils.path(), - "bundled", - FsPerms::ReadWrite, - )?; + .preopened_dir(embedded_helper_utils.path(), "bundled", FsPerms::ReadWrite)?; // Generate guest mounts for each host directory in `python_path`. for (index, path) in python_path.iter().enumerate() { diff --git a/src/stubwasi.rs b/src/stubwasi.rs index 3de45801..64f694ca 100644 --- a/src/stubwasi.rs +++ b/src/stubwasi.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use anyhow::{bail, Error}; +use anyhow::{Error, bail}; use wasm_encoder::{ CodeSection, ExportKind, ExportSection, Function, FunctionSection, Instruction as Ins, Module, TypeSection, diff --git a/src/summary.rs b/src/summary.rs index ee4d1fd7..9d62b6da 100644 --- a/src/summary.rs +++ b/src/summary.rs @@ -6,12 +6,12 @@ use { }, util::Types as _, }, - anyhow::{bail, Result}, + anyhow::{Result, bail}, heck::{ToShoutySnakeCase, ToSnakeCase, ToUpperCamelCase}, indexmap::{IndexMap, IndexSet}, semver::Version, std::{ - collections::{hash_map::Entry, BTreeMap, BTreeSet, HashMap, HashSet}, + collections::{BTreeMap, BTreeSet, HashMap, HashSet, hash_map::Entry}, fmt::Write as _, fs::{self, File}, io::Write as _, @@ -39,11 +39,7 @@ pub enum Naming { impl Naming { pub fn from_full(full: bool) -> Self { - if full { - Self::Full - } else { - Self::Short - } + if full { Self::Full } else { Self::Short } } } @@ -1205,13 +1201,14 @@ impl<'a> Summary<'a> { unreachable!() }; - assert!(tree - .entry(info.name) - .or_default() - .entry(info.package.map(|p| (p.namespace, p.name))) - .or_default() - .insert(info.package.and_then(|p| p.version), (id, info.naming)) - .is_none()); + assert!( + tree.entry(info.name) + .or_default() + .entry(info.package.map(|p| (p.namespace, p.name))) + .or_default() + .insert(info.package.and_then(|p| p.version), (id, info.naming)) + .is_none() + ); } let mut names = HashMap::new(); @@ -1219,49 +1216,54 @@ impl<'a> Summary<'a> { for (package, versions) in packages { if let Some((package_namespace, package_name)) = package { for (version, &(id, naming)) in versions { - assert!(names - .insert( - id, - if let Some(version) = version { - if let Some(name) = interface_names.get( - format!( - "{package_namespace}:{package_name}\ + assert!( + names + .insert( + id, + if let Some(version) = version { + if let Some(name) = interface_names.get( + format!( + "{package_namespace}:{package_name}\ /{name}@{version}" - ) - .as_str(), - ) { - (*name).to_owned() - } else if versions.len() == 1 && naming == Naming::Short { - if packages.len() == 1 { + ) + .as_str(), + ) { (*name).to_owned() + } else if versions.len() == 1 && naming == Naming::Short { + if packages.len() == 1 { + (*name).to_owned() + } else { + format!("{package_namespace}-{package_name}-{name}") + } } else { - format!("{package_namespace}-{package_name}-{name}") + format!( + "{package_namespace}-{package_name}-{name}-{}", + version.to_string().replace('.', "-") + ) } + } else if let Some(name) = interface_names.get( + format!("{package_namespace}:{package_name}/{name}") + .as_str() + ) { + (*name).to_owned() + } else if packages.len() == 1 && naming == Naming::Short { + (*name).to_owned() } else { - format!( - "{package_namespace}-{package_name}-{name}-{}", - version.to_string().replace('.', "-") - ) + format!("{package_namespace}-{package_name}-{name}",) } - } else if let Some(name) = interface_names.get( - format!("{package_namespace}:{package_name}/{name}").as_str() - ) { - (*name).to_owned() - } else if packages.len() == 1 && naming == Naming::Short { - (*name).to_owned() - } else { - format!("{package_namespace}-{package_name}-{name}",) - } - ) - .is_none()); + ) + .is_none() + ); } } else { - assert!(names - .insert( - versions.get(&None).unwrap().0, - (*interface_names.get(*name).unwrap_or(name)).to_owned() - ) - .is_none()); + assert!( + names + .insert( + versions.get(&None).unwrap().0, + (*interface_names.get(*name).unwrap_or(name)).to_owned() + ) + .is_none() + ); } } } diff --git a/src/test/tests.rs b/src/test/tests.rs index 63f9c5d5..8dd48bd3 100644 --- a/src/test/tests.rs +++ b/src/test/tests.rs @@ -1,10 +1,10 @@ #![allow(non_local_definitions)] use { - super::{Ctx, Tester, SEED}, - anyhow::{anyhow, Result}, + super::{Ctx, SEED, Tester}, + anyhow::{Result, anyhow}, exports::componentize_py::test::streams_and_futures, - futures::{channel::oneshot, stream::FuturesUnordered, FutureExt, TryStreamExt}, + futures::{FutureExt, TryStreamExt, channel::oneshot, stream::FuturesUnordered}, once_cell::sync::Lazy, std::{ collections::BTreeMap, @@ -17,12 +17,12 @@ use { time::Duration, }, wasmtime::{ + Store, StoreContextMut, component::{ Accessor, Destination, FutureConsumer, FutureProducer, FutureReader, HasSelf, InstancePre, Lift, Linker, Resource, ResourceAny, Source, StreamConsumer, StreamProducer, StreamReader, StreamResult, VecBuffer, }, - Store, StoreContextMut, }, wasmtime_wasi::{FsPerms, WasiCtxBuilder, WasiView}, }; From e09b1c89c14940e7fca273c70a6baa536cfa3fb0 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 24 Aug 2026 13:53:02 -0700 Subject: [PATCH 3/4] Appease clippy --- runtime/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 0c51d53a..4eb7c4e3 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -817,10 +817,7 @@ mod async_ { ty.write()(handle, buffer.cast()) }; - let resources = call - .resources - .take() - .and_then(|v| if v.is_empty() { None } else { Some(v) }); + let resources = call.resources.take().filter(|v| !v.is_empty()); Ok(if code == RETURN_CODE_BLOCKED { ERR_CONSTRUCTOR From 0bc61320f769b51a6d8b8fe9b60a18c612a4a488 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 24 Aug 2026 15:01:40 -0700 Subject: [PATCH 4/4] Review comments --- build.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 3c0f468b..774cb8a1 100644 --- a/build.rs +++ b/build.rs @@ -808,9 +808,11 @@ fn strip(input: &[u8]) -> anyhow::Result> { } if let Some((id, range)) = payload.as_section() { + let start = usize::try_from(range.start).unwrap(); + let end = usize::try_from(range.end).unwrap(); RawSection { id, - data: &input[range.start as usize..range.end as usize], + data: &input[start..end], } .append_to(&mut output); }