Stream: git-wasmtime

Topic: wasmtime / PR #9919 jit module return code slice


view this post on Zulip Wasmtime GitHub notifications bot (Jan 04 2025 at 15:07):

MarinPostma opened PR #9919 from MarinPostma:jit-module-return-code-slice to bytecodealliance:main:

It can be usefull to get the compiled function as a slice from a JITModule, for example, if one wants to disassemble it, to inspect the assembled code. It is currently possible to get pseudo assembly from the module context, by explicitely requesting ctx.want_disasm, but it is not very practical and it is not the _actual_ machine code.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 04 2025 at 15:07):

MarinPostma requested fitzgen for a review on PR #9919.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 04 2025 at 15:07):

MarinPostma requested wasmtime-compiler-reviewers for a review on PR #9919.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 04 2025 at 15:07):

MarinPostma requested wasmtime-core-reviewers for a review on PR #9919.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 04 2025 at 15:08):

MarinPostma updated PR #9919.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 04 2025 at 15:09):

MarinPostma updated PR #9919.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 04 2025 at 15:09):

MarinPostma updated PR #9919.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 04 2025 at 18:50):

bjorn3 commented on PR #9919:

If you want the actual machine code you can already find it in context.compiled_code().unwrap().buffer.data() after you use define_function. You can also find all relocations in context.compiled_code().unwrap().buffer.relocs() to know which functions you are actually calling. cranelift-jit throws all relocations away after applying them as it doesn't need them anymore after applying them.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 04 2025 at 19:08):

MarinPostma commented on PR #9919:

@bjorn3 but that's only for the current function no? Is there a way to get the buffer for any function in a module?

view this post on Zulip Wasmtime GitHub notifications bot (Jan 04 2025 at 19:09):

bjorn3 commented on PR #9919:

Yeah, you have to do that right after calling define_function for the function which you want machine code for.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 04 2025 at 23:55):

MarinPostma commented on PR #9919:

I'll close then :+1:

view this post on Zulip Wasmtime GitHub notifications bot (Jan 04 2025 at 23:55):

MarinPostma closed without merge PR #9919.


Last updated: Jan 24 2025 at 00:11 UTC