![]() |
Sponsored Link •
|
Advertisement
|
_quick
InstructionsThe first edition of the Java virtual machine specification described a technique used by one of Sun's
early implementations of the Java virtual machine to speed up the interpretation of bytecodes. In this
scheme, opcodes that refer to constant pool entries are replaced by a "_quick
" opcode
when the constant pool entry is resolved. When the virtual machine encounters a
_quick
instruction, it knows the constant pool entry is already resolved and can
therefore execute the instruction faster.
The core instruction set of the Java virtual machine consists of 200 single-byte opcodes, all of which are
described in Appendix A, "Instruction Set by Opcode Mnemonic." These 200 opcodes are the only opcodes
you will ever see in class files. Virtual machine implementations that use the "_quick
"
technique use another 25 single-byte opcodes internally, the "_quick
" opcodes.
For example, when a virtual machine that uses the _quick
technique resolves a
constant pool entry referred to by an ldc
instruction (opcode value 0x12), it replaces
the ldc
opcode byte in the bytecode stream with an ldc_quick
instruction (opcode value 0xcb). This technique is part of the process of replacing a symbolic reference with
a direct reference in Sun's early virtual machine.
For some instructions, in addition to overwriting the normal opcode with a _quick
opcode, a virtual machine that uses the _quick
technique overwrites the operands of
the instruction with data that represents the direct reference. For example, in addition to replacing an
invokevirtual
opcode with an invokevirtual_quick
,
the virtual machine also puts the method table offset and the number of arguments into the two operand
bytes that follow every invokevirtual
instruction. Placing the method table offset
in the bytecode stream following the invokevirtual_quick
opcode saves the
virtual machine the time it would take to look up the offset in the resolved constant pool entry.
Sponsored Links
|