I'm playing around with cranelift/wasm and I'm trying to add some instrumentation to wasm, and I'm trying to do this by injecting CallIndirect's in the cranelift IR, which call a host function, but I'm not sure how to access my host function. How do I know the offset's to the pointers to my host function (I'm guessing this is in vmctx). The host function will collect call statistics. Or is this a bad way to do what i'm trying to achieve?
this is probably the wrong place to go about doing this kind of thing, this is more internals and raw stuff. if you want to wrap wasm entry/exit in order to collect metrics/statistics/etc, you should take a look at https://docs.rs/wasmtime/latest/wasmtime/struct.Store.html#method.call_hook and its async variant
Last updated: Nov 22 2024 at 17:03 UTC