From 579b9c4f1b653e76bd055ff695ff43aaf3e02704 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 23 Oct 2025 15:31:12 -0600 Subject: [PATCH] update `core_function_count` in more cases; update wasm-tools This is related to porting `componentize-py` to use `wit-dylib`. Note that `component-init` is mostly obsolete at this point now that Wizer has component support. For now, though, `componentize-py` has to keep using it due to how `--stub-wasi` is implemented so as to work around `wasmtime-py` limitations. Alex is working to remove those limitations, at which point we'll be able to remove `--stub-wasi` and lean on e.g. `wasi-virt` instead. In the meantime, `component-init` exists only for `componentize-py`, so I'll treat it that way :) Signed-off-by: Joel Dice --- Cargo.toml | 9 +++++---- transform/src/lib.rs | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 51a0f61..8dc9c05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,11 +30,12 @@ syn = "2.0" test-programs = { path = "./test-programs" } test-programs-artifacts = { path = "./test-programs/artifacts" } tokio = { version = "1", features = ["full"] } -wasm-encoder = { version = "0.238.1", features = ["wasmparser"] } -wasmparser = "0.238.1" +# TODO: switch to wasm-tools 1.241.0 when available +wasm-encoder = { git = "https://github.com/bytecodealliance/wasm-tools", rev = "b1d8ff59", features = ["wasmparser"] } +wasmparser = { git = "https://github.com/bytecodealliance/wasm-tools", rev = "b1d8ff59" } +wasm-metadata = { git = "https://github.com/bytecodealliance/wasm-tools", rev = "b1d8ff59" } +wat = { git = "https://github.com/bytecodealliance/wasm-tools", rev = "b1d8ff59" } wasmtime = "36.0.2" wasmtime-wasi = "36.0.2" wasmtime-wasi-http = "36.0.2" -wat = "1.238.1" wit-bindgen = "0.45.0" -wasm-metadata = "0.238.1" diff --git a/transform/src/lib.rs b/transform/src/lib.rs index 7f70551..f88a924 100644 --- a/transform/src/lib.rs +++ b/transform/src/lib.rs @@ -505,7 +505,23 @@ fn instrument(component_stage1: &[u8]) -> Result<(Vec, Instrumentation)> { CanonicalFunction::Lower { .. } | CanonicalFunction::ResourceNew { .. } | CanonicalFunction::ResourceDrop { .. } - | CanonicalFunction::ResourceRep { .. } => { + | CanonicalFunction::ResourceRep { .. } + | CanonicalFunction::BackpressureSet + | CanonicalFunction::BackpressureInc + | CanonicalFunction::BackpressureDec + | CanonicalFunction::TaskCancel + | CanonicalFunction::ContextGet(_) + | CanonicalFunction::ContextSet(_) + | CanonicalFunction::ThreadYield { .. } + | CanonicalFunction::SubtaskDrop + | CanonicalFunction::WaitableSetNew + | CanonicalFunction::WaitableSetWait { .. } + | CanonicalFunction::WaitableSetPoll { .. } + | CanonicalFunction::WaitableSetDrop + | CanonicalFunction::WaitableJoin + | CanonicalFunction::ErrorContextNew { .. } + | CanonicalFunction::ErrorContextDebugMessage { .. } + | CanonicalFunction::ErrorContextDrop => { core_function_count += 1; } CanonicalFunction::Lift { .. } => {