Anyway to hack JITTed code manually?
Filipp Zhinkin
filipp.zhinkin at gmail.com
Tue May 12 09:32:21 UTC 2015
Hi Wei,
in order to profile JIT-generated code using perf you can use
perf-map-agent [1] which is aimed to generate map files for compiled
methods.
Regards,
Filipp.
[1] https://github.com/jrudolph/perf-map-agent
On Tue, May 12, 2015 at 10:05 AM, Tangwei (Euler) <tangwei6 at huawei.com> wrote:
> Hi Kris,
>
> Sorry for inaccurate question description, the tool I am looking for is to
> sampling specific function.
>
> For example I know some function called “Foo” is hot, but has poor
> performance. I just want to sample
>
> it with some PMU event set. I am working on ARM, so some X86 only profiler
> is not suitable to me.
>
>
>
>
>
> Regards!
>
> wei
>
>
>
> From: Krystal Mok [mailto:rednaxelafx at gmail.com]
> Sent: Tuesday, May 12, 2015 2:50 PM
>
>
> To: Tangwei (Euler)
> Cc: hotspot-compiler-dev at openjdk.java.net
> Subject: Re: Anyway to hack JITTed code manually?
>
>
>
> Hi Wei,
>
>
>
> HotSpot VM is known to be able to work with other more native profiling
> tools.
>
>
>
> HotSpot can work with Linux perf. An easy way to run benchmarks and
> profiling them is with the JMH framework and with the "perfasm" feature
> [1][2].
>
>
>
> Other profilers like Oracle Solaris Studio Performance Analyzer [3], Intel
> VTune and AMD CodeAnalyst are also known to work with HotSpot.
>
>
>
> - Kris
>
>
>
> [1]: http://cr.openjdk.java.net/~shade/jmh/perfasm-sample.log
>
> [2]: http://shipilev.net/blog/2014/java-scala-divided-we-fail/
>
> [3]:
> http://www.oracle.com/technetwork/server-storage/solarisstudio/features/performance-analyzer-2292312.html
>
>
>
> On Mon, May 11, 2015 at 11:42 PM, Tangwei (Euler) <tangwei6 at huawei.com>
> wrote:
>
> Hi Kris,
>
> Thanks for quick response. Is there any other hacking way in OpenJDK for
> fast performance measurement?
>
> Or is that possible to invoke other profiling tool such as “perf” instead of
> hprof in JVM to sampling more PMU events.
>
>
>
> Regards!
>
> wei
>
>
>
> From: Krystal Mok [mailto:rednaxelafx at gmail.com]
> Sent: Tuesday, May 12, 2015 2:34 PM
> To: Tangwei (Euler)
> Cc: hotspot-compiler-dev at openjdk.java.net
> Subject: Re: Anyway to hack JITTed code manually?
>
>
>
> Hi Wei,
>
>
>
> For HotSpot VM as it is now, the answer is no, there isn't a simple way to
> do that.
>
>
>
> One of the various problem that you'd have with trying to do something like
> this is relocation: there are a lot of addresses embedded into JIT compiled
> code as constants -- some could be Klass*, some could be compiled entry
> points to other compiled methods or stubs.
>
>
>
> The kind of feature you're asking for is more likely to be present in a VM
> that supports some certain form of AOT compilation, where the system has to
> deal with relocation of code anyway. The HotSpot VM we can see in OpenJDK
> doesn't do that right now.
>
>
>
> - Kris
>
>
>
> On Mon, May 11, 2015 at 11:24 PM, Tangwei (Euler) <tangwei6 at huawei.com>
> wrote:
>
> Hi All,
>
> Is there any simple way to hack JITTed code and relocate at runtime?
> Following steps are expected.
>
>
>
> 1. Dump JITTed code (c1/c2) to file or some cached directory.
>
> 2. Hack assembly code
>
> 3. Run JVM to load the hacked assembly code and relocating in memory
>
>
>
>
>
> Regards!
>
> wei
>
>
>
>
More information about the hotspot-compiler-dev
mailing list