Stream: git-wasmtime

Topic: wasmtime / issue #3018 Add means of getting function size...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 22 2021 at 14:53):

zachreizner opened issue #3018:

Feature

Add a means of getting function size from JITModule, like how finalized data size can be retrieved.

Benefit

Getting the size of a function allows for tracking memory usage of the JITModule's generated functions. It would also make debugging the machine code output easier by knowing how big each function is so that a given disassembler knows when to stop.

Implementation

Add another method to JITModule called get_finalized_function_size that returns the size of the compiled function.

Alternatives

Two alternatives would be:

view this post on Zulip Wasmtime GitHub notifications bot (Jun 22 2021 at 15:04):

bjorn3 commented on issue #3018:

You can already get the function size through the return value of define_function. In addition if you set the PERF_BUILDID_DIR env var to any value and you are on linux, a file called /tmp/perf-<pid>.map will be written containing the address and size of every function. (This allows perf to get the function names for jitted functions)

view this post on Zulip Wasmtime GitHub notifications bot (Jun 22 2021 at 17:08):

zachreizner commented on issue #3018:

Ah, I see now that the return value of define_function is a ModuleCompiledFunction with a single field size. FWIW, I did try searching the API docs for something like this, but I didn't search down the route you outlined above. Thank you for quickly pointing me down the right path.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 22 2021 at 17:08):

zachreizner closed issue #3018:

Feature

Add a means of getting function size from JITModule, like how finalized data size can be retrieved.

Benefit

Getting the size of a function allows for tracking memory usage of the JITModule's generated functions. It would also make debugging the machine code output easier by knowing how big each function is so that a given disassembler knows when to stop.

Implementation

Add another method to JITModule called get_finalized_function_size that returns the size of the compiled function.

Alternatives

Two alternatives would be:


Last updated: Oct 23 2024 at 20:03 UTC