Contents Prev Next Up


The Virtual Machine Instruction Set


Manipulating Object Fields

putfield
getfield
putstatic
getstatic

putfield

Set field in object

..., handle, value => ...

OR

..., handle, value-word1, value-word2 => ...

indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class. The constant pool item will be a field reference to a class name and a field name. The item is resolved to a field block pointer which has both the field width (in bytes) and the field offset (in bytes).

The field at that offset from the start of the instance pointed to by handle will be set to the value on the top of the stack.

This instruction handles both 32-bit and 64-bit wide fields.

If handle is null, a NullPointerException exception is generated.

If the specified field is a static field, a DynamicRefOfStaticField exception is generated.

getfield

Fetch field from object

..., handle => ..., value 

OR

..., handle => ..., value-word1, value-word2

indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class. The constant pool item will be a field reference to a class name and a field name. The item is resolved to a field block pointer which has both the field width (in bytes) and the field offset (in bytes).

handle should be a handle to an object. The value at offset into the object referenced by handle replaces handle on the top of the stack.

This instruction handles both 32-bit and 64-bit wide fields.

If the specified field is a static field, a DynamicRefOfStaticField exception is generated.

putstatic

Set static field in class

..., value => ...

OR

..., value-word1, value-word2 => ...

indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class. The constant pool item will be a field reference to a static field of a class. That field will be set to have the value on the top of the stack.

This instruction works for both 32-bit and 64-bit wide fields.

If the specified field is a dynamic field, a StaticRefOfDynamicFieldException is generated.

getstatic

Get static field from class

..., => ..., value	

OR

..., => ..., value-word1, value-word2

indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class. The constant pool item will be a field reference to a static field of a class. The value of that field will replace handle on the stack.

This instruction handles both 32-bit and 64-bit wide fields.

If the specified field is a dynamic field, a StaticRefOfDynamicFieldException is generated.


Contents Prev Next Up

Generated with CERN WebMaker