I am wondering why the line numbers of Java Bytecode are not consecutive.
What happens for example in the (not listed) lines 2 and 3 of the following getter?
public java.lang.String getX();
Code:
0: aload_0
1: getfield #2; //Field x:Ljava/lang/String;
4: areturn
I'm using the ASM framework to work on bytecode. When visiting the code of a method using the tree API I get these "hidden" instructions as well (however with opcode -1). I would like to know what they are for.
I don't think that 0, 1, 4
are linenumbers but byte offsets in the bytecode.
aload_0
is one bytegetfield
is three bytes (one opcode, one "index" arg with two bytes"areturn
is one byteSo 2
and 3
are simply part of the getfield
operation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With