0

I'm trying to count the instructions and their frequency from a bytecode .class file. I came across this SO post and this one but they don't seem to give me an answer. I also read about ASM, and I still don't know how it can be used. javap lists the instructions but not their frequencies.

SDJ
  • 4,083
  • 1
  • 17
  • 35
Self
  • 147
  • 2
  • 16
  • You're going to have to add up the instruction counts yourself if you want frequencies. This is like programming 101. – Antimony Jan 21 '19 at 03:28
  • @Antimony Can you just show me how to display the instructions by using ASM? You don't need to count them :) – Self Jan 21 '19 at 04:27
  • 1
    I suggest starting with the [asm user guide](https://asm.ow2.io/asm4-guide.pdf). But be aware that ASM is designed to process the instructions according to their semantics, so the application does not have to deal with different instruction forms meaning the same. Depending on *what* you actually want to count, this may be an issue or not. E.g. there’s an `aload_0` instruction and there’s `aload 0`, the `aload` instruction with embedded parameter zero. ASM will not distinguish between them, so you can’t count these forms individually with this library. – Holger Jan 21 '19 at 09:20

0 Answers0