jit: support for uprobe-based dynamic instrumentation
Introduce a `dynamic_instrumentation` flag to the JIT compilation
pipeline to support instrumentation of JIT-compiled methods with
uprobes. Introduce a dedicated entrypoint (a no-op) for the same.
A new flag is plumbed from `JitCompiler::CompileMethod` down to
`CodeGeneratorARM64`. The instruction builder will now insert a call to
the dedicated entrypoint if the `dynamic_instrumentation` flag is
true. This allows for on-demand instrumentation of JIT code without
requiring the process to be fully debuggable.
This functionality is exposed through
`VMDebug.getExecutableMethodFileOffsets()`. If a method is not
AOT-compiled, this function will now trigger a JIT compilation with
dynamic instrumentation enabled. This allows tools like uprobes to
instrument methods on-demand by calling the VMDebug method.
With the method was successfully jitted with the hook inserted,
`VMDebug_getExecutableMethodFileOffsets` will return the path to the
entrypoint (libart.so) and the offset of the entrypoint in the .so
Design: go/hummingbird-art-jit
Test: TH
Test: atest uprobestats-art-test
Bug: 410630539
Flag: com.android.art.rw.flags.dynamic_instrumentation_method_entry_hook
Change-Id: Ifb0649d2c00fbf81650a05b429a73ccb4ec11ef3
17 files changed