Fetch field from object
Bytecode
Type | Description |
u1 | getfield_quick_w opcode = 0xE3 (227) |
u2 | index |
Stack ..., objectref => ..., value OR ..., objectref => ..., value.word1, value.word2
Description
The objectref, which must be of type reference
,
is popped from the operand stack. The index points to a position into the constant
pool of the field entry, a reference to a class name and a field name. If the field is protected
,
then it must be either a member of the current class or a member of a superclass of the
current class, and the class of objectref must be either the current class or a
subclass of the current class.
The item is resolved, determining both the field width and the field offset. The value at that offset into the class instance referenced by objectref is fetched and pushed onto the operand stack.
NullPointerException - objectref is null
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.
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.