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
calledget_finalized_function_size
that returns the size of the compiled function.Alternatives
Two alternatives would be:
- make
get_finalized_function
itself return the pointer and size, just likeget_finalized_data
, which would be a breaking change- have the new
get_finalized_function_size
method return pointer and size, instead of simply the size
bjorn3 commented on issue #3018:
You can already get the function size through the return value of
define_function
. In addition if you set thePERF_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)
zachreizner commented on issue #3018:
Ah, I see now that the return value of
define_function
is aModuleCompiledFunction
with a single fieldsize
. 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.
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
calledget_finalized_function_size
that returns the size of the compiled function.Alternatives
Two alternatives would be:
- make
get_finalized_function
itself return the pointer and size, just likeget_finalized_data
, which would be a breaking change- have the new
get_finalized_function_size
method return pointer and size, instead of simply the size
Last updated: Dec 23 2024 at 12:05 UTC