6

ByteCode:ldc pushes a one-word constant onto the operand stack. ldc takes a single parameter, , which is the value to push.

Most of the bytecodes in JVM can figure out their name by the code description. However, the ldc, I don't see any clue.

W.Zhe
  • 97
  • 1
  • 8

2 Answers2

8

It is Load Constant. It loads an item from the constant pool onto the stack. The available types are:

  • int
  • float
  • java.lang.String
  • java.lang.Class

The Java 7 JVM added java.lang.invoke.MethodType and java.lang.invoke.MethodHandle.

The special variant ldc2_w will load an item of either long or double type onto the stack.

Holger
  • 285,553
  • 42
  • 434
  • 765
Charles Forsythe
  • 1,831
  • 11
  • 12
6

I suppose it is LoaD Constant but I do not have any reference.

Stilgar
  • 22,354
  • 14
  • 64
  • 101