Contents | Prev | Next | IndexThe JavaTM Virtual Machine Specification


getfield_quick

Operation
Fetch field from object

getfield_quick
offset
<unused>

Forms
getfield_quick = 206 (0xce)

Stack
..., objectref ..., value

Description
The objectref, which must be of type reference, is popped from the operand stack. The value of the one-word field at offset into the class instance referenced by objectref is fetched and pushed onto the operand stack.

Runtime Exception
If objectref is null, the getfield_quick instruction throws a NullPointerException.

Notes
The opcode of this instruction was originally getfield, operating on a field determined dynamically to have an offset into the class instance data of 255 words or less and to have a width of one word.

When the constant pool entry referenced by a getfield instruction is resolved, the offset for the field it references is generated. That offset replaces the first operand byte of the original getfield instruction. The second operand byte of the getfield is unused by getfield_quick.

getfield_quick_w getfield_quick_w

Operation
Fetch field from object

getfield_quick_w
indexbyte1
indexbyte2

Forms
getfield_quick_w = 227 (0xe3)

Stack
..., objectref ..., value

OR

Stack
..., objectref ..., value.word1, value.word2

Description
The objectref, which must be of type reference, is popped from the operand stack. The unsigned indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class (§3.6), where the index is (indexbyte1 << 8) | indexbyte2. The constant pool item at the index must be a CONSTANT_Fieldref (§4.4.2) which must already have been resolved and must not be a class (static) field. A field offset must have been stored in the constant pool. The value at that offset into the class instance referenced by objectref is fetched and pushed onto the operand stack.

Runtime Exception
If objectref is null, the getfield_quick_w instruction throws a NullPointerException.

Notes
The opcode of this instruction was originally getfield, operating on a field determined dynamically to have an offset into the class instance data of more than 255 words.

getfield_quick_w (cont.) getfield_quick_w (cont.)

The operands of the getfield instruction are not modified. Because the getfield_quick_w instruction operates on both one- and two-word wide fields, it needs to know both the field offset and the type of that field. Because the original getfield instruction needed a 16-bit index, the field offset may be 16 bits wide. As there is insufficient space in the instruction to store both a 16-bit offset and a field type, getfield_quick_w retains its original operands and uses them to index into the constant pool, where the offset and field type are available in the resolved entry.

getfield2_quick getfield2_quick

Operation
Fetch long or double field from object

getfield2_quick
offset
<unused>

Forms
getfield2_quick = 208 (0xd0)

Stack
..., objectref ..., value.word1, value.word2

Description
The objectref, which must be of type reference, is popped from the operand stack. The value of the two-word field at offset into the class instance referenced by objectref is fetched and pushed onto the operand stack.

Runtime Exception
If objectref is null, the getfield2_quick instruction throws a NullPointerException.

Notes
The opcode of this instruction was originally getfield, operating on a field determined dynamically to have an offset into the class instance data of 255 words or less and to have a width of two words.

When the constant pool entry referenced by a getfield instruction is resolved, the offset for the field it references is generated. That offset replaces the first operand of the original getfield instruction. The second operand of the getfield is unused by getfield2_quick.

getstatic_quick getstatic_quick

Operation
Get static field from class

getstatic_quick
indexbyte1
indexbyte2

Forms
getstatic_quick = 210 (0xd2)

Stack
..., ..., value

Description
The unsigned indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class (§3.6), where the value of the index is (indexbyte1 << 8) | indexbyte2. The constant pool item at that index must be a CONSTANT_Fieldref (§4.4.2) which must already have been resolved and must be a class (static) field that is one word wide. The value of that class field is fetched and pushed onto the operand stack.

Notes
The opcode of this instruction was originally getstatic, operating on a static field determined dynamically to be one word wide. The operands of the getstatic instruction are not modified. There is no equivalent to the getfield_quick instruction, storing a class offset as an instruction operand, for one-word static fields.

getstatic2_quick getstatic2_quick

Operation
Get static field from class

getstatic2_quick
indexbyte1
indexbyte2

Forms
getstatic2_quick = 212 (0xd4)

Stack
..., ..., value.word1, value.word2

Description
The unsigned indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class (§3.6), where the value of the index is (indexbyte1 << 8) | indexbyte2. The constant pool item at that index must be a CONSTANT_Fieldref (§4.4.2) which must already have been resolved and must be a class (static) field that is two words wide. The value of that class field is fetched and pushed onto the operand stack.

The constant pool item is a field reference to a static field of a class. The type of the field must be long or double. The value of that field is pushed onto the stack.

Notes
The opcode of this instruction was originally getstatic, operating on a class field determined dynamically to be two words wide. The operands of the getstatic instruction are not modified. There is no equivalent to the getfield2_quick instruction, storing a class offset as an instruction operand, for two-word static fields.



Contents | Prev | Next | Index

Java Virtual Machine Specification (HTML generated by chsieh on March 13, 1997)
Copyright © 1996, 1997 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to doug.kramer@sun.com