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 ?
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.