Stream: cranelift

Topic: vmctx & calling host functions


view this post on Zulip Joseph Kanichai (Jul 05 2024 at 13:36):

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?

view this post on Zulip fitzgen (he/him) (Jul 08 2024 at 17:49):

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: Dec 23 2024 at 12:05 UTC