3

For example if int-variables a and b are stored in local variables 1 and 2, this code would compute this.f(3+b*a). (this-pointer is stored in variable 0)

iload_1
aload_0
icons_3
iload_1
iload_1
imul
iadd
invokevirtual #4

for what does #4 stand here ?

1 Answers1

5

This is an index into the constant pool of the classfile; it says that the operand of invokevirtual is stored at index #4 of the constant pool (which will be a Constant_MethodRef_info.) If you invoke javap with the -v flag, it will dump out the constant pool and you'll see at index #4 what class and method it is invoking.

Brian Goetz
  • 90,105
  • 23
  • 150
  • 161
  • 2
    `javap` also writes the particular class and method right behind the instruction, in addition to the constant pool index, even when not using `-v`. – Holger Mar 18 '19 at 08:22