Happy new year everyone :)
It would be useful to get the compiled function from a JITModule as a slice to disassemble it for debugging. Looking at the code, It seems like a straightforward addition. Would you accept a PR adding that feature? Maybe I should open an issue first?
That seems like a reasonable API -- happy to look at a PR (@bjorn3 may also have more opinions as one of the more frequent users of/contributors to that code)
also, for what it's worth, one can look at disassemblies with either clif-util compile --target ... file.clif
(for raw CLIF input) or wasmtime compile file.wasm
+ objdump -d file.cwasm
(for Wasm input)
or wasmtime explore
for a nice html'ified view
You can also inspect the compilation result stored in the Context after define_function. If you called the right function before define_function that will even contain the vcode of the function (which is pretty close to the final machine code) already as string.
@Chris Fallin thanks for the tips! I'm not using cranelift in the context of wasm this time though
@bjorn3 that sounds like what I need! So iirc, after I call make_context
, I can set the want_disas
flag, and then retrieve the asm from the compile code (as vcode
)? neat I'll try that ! thanks
Last updated: Jan 24 2025 at 00:11 UTC