Search code examples
javabytecodejava-bytecode-asm

Java ASM Opcodes: "H_" prefixed mnemonics (e.g. Opcodes.H_GETFIELD vs. Opcodes.GETFIELD)


I'm using the ASM Framework for java bytecode manipulations. Some of the opcode-mnemonics existing twice in ASM, they are prefixed with "H_":

Opcodes.H_GETFIELD         vs. Opcodes.GETFIELD
Opcodes.H_GETSTATIC        vs. Opcodes.GETSTATIC
Opcodes.H_INVOKEINTERFACE  vs. Opcodes.INVOKEINTERFACE
Opcodes.H_INVOKESPECIAL    vs. Opcodes.INVOKESPECIAL
Opcodes.H_INVOKESTATIC     vs. Opcodes.INVOKESTATIC
Opcodes.H_NEWINVOKESPECIAL vs. Opcodes.NEWINVOKESPECIAL
Opcodes.H_PUTFIELD         vs. Opcodes.PUTFIELD
Opcodes.H_PUTSTATIC        vs. Opcodes.PUTSTATIC

Whats the difference between these two opcodes?


Solution

  • The H_ constants in the Opcodes class are no actual opcodes, they are used for building a MethodHandle (using ASMs Handle class) which can be used in InvokeDynamic instructions.