fan
fan

Reputation: 11

How to get data reuse distance based on JAVA bytecode?

I have got java bytecode by hotspot ./hotspot -XX:+TraceBytecodes -jar HelloWorld.jar. Now I want to get the data reuse distance, but opcode does not give variable name. So I have to trace stack values to define variable. How to trace stack values of java bytecode? The bytecode is like this:

    [1435280] static void ZFArray.main(jobject)
    [1435280]  4028364     0  iconst_3
    [1435280]  4028365     1  newarray int
    [1435280]  4028366     3  astore_1
    [1435280]  4028367     4  iconst_0
    [1435280]  4028368     5  istore_2
    [1435280]  4028369     6  iload_2
    [1435280]  4028370     7  aload_1
    [1435280]  4028371     8  arraylength
    [1435280]  4028372     9  if_icmpge 22
    [1435280]  4028373    12  aload_1
    [1435280]  4028374    13  iload_2
    [1435280]  4028375    14  iconst_5
    [1435280]  4028376    15  iastore
    [1435280]  4028377    16  iinc #2 1
    [1435280]  4028378    19  goto 6
    [1435280]  4028379     6  iload_2

It seems like "ASM" can be used to manipulate java bytecode, but I don't know how to trace stack values for each bytecode instruction.

Upvotes: 0

Views: 40

Answers (0)

Related Questions