Contents | Prev | Next | IndexThe JavaTM Virtual Machine Specification


pop

Operation Pop top operand stack word

pop


Forms pop = 87 (0x57)

Stack ..., word ...

Description The top word is popped from the operand stack.

The pop instruction must not be used unless word is a word that contains a 32-bit data type.

Notes Except for restrictions preserving the integrity of 64-bit data types, the pop instruction operates on an untyped word, ignoring the type of the datum it contains.


pop2

Operation Pop top two operand stack word

pop2


s

Forms pop2 = 88 (0x58)

Stack ..., word2, word1 ...

Description The top two words are popped from the operand stack.

The pop2 instruction must not be used unless each of word word1 and word2 is a word that contains a 32-bit data types or together are the two words of a single 64-bit datum.

Notes Except for restrictions preserving the integrity of 64-bit data types, the pop2 instruction operates on raw words, ignoring the types of the data they contain.


putfield

Operation Set field in object

putfield
indexbyte1
indexbyte2


Forms putfield = 181 (0xb5)

Stack ..., objectref, value ...

OR

Stack ..., objectref, 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 the index must be a CONSTANT_Fieldref (§4.4.2), a reference to a class name and a field name. If the field is protected (§4.6), 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 constant pool item is resolved (§5.2), determining both the field width and the field offset. The type of a value stored by a putfield instruction must be compatible with the descriptor of the field (§4.3.2) of the class instance being stored into. If the field descriptor type is byte, char, short, or int, then the value must be an int. If the field descriptor type is float, long, or double, then the value must be a float, long, or double, respectively. If the field descriptor type is a reference type, then the value must be of a type that is assignment compatible (§2.6.6) with the field descriptor type.

The value and objectref, which must be of type reference, are popped from the operand stack. The field at the offset from the start of the object referenced by objectref is set to the value.

Linking Exceptions During resolution of the CONSTANT_Fieldref constant pool item, any of the exceptions documented in §5.2 can be thrown.

Otherwise, if the specified field exists but is a static field, putfield throws an IncompatibleClassChangeError.

Runtime Exception Otherwise, if objectref is null, the putfield instruction throws a NullPointerException.

Notes The putfield instruction operates on both one- and two-word wide fields.


putstatic

Operation Set static field in class

putstatic
indexbyte1
indexbyte2


Forms putstatic = 179 (0xb3)

Stack ..., value ...

OR

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 the index must be a CONSTANT_Fieldref (§4.4.2), a reference to a class name and a field name. If the field is protected (§4.6), then it must be either a member of the current class or a member of a superclass of the current class.

The constant pool item is resolved (§5.2), determining both the class field and its width. The type of a value stored by a putstatic instruction must be compatible with the descriptor of the field (§4.3.2) of the class instance being stored into. If the field descriptor type is byte, char, short, or int, then the value must be an int. If the field descriptor type is float, long, or double, then the value must be a float, long, or double, respectively. If the field descriptor type is a reference type, then the value must be of a type that is assignment compatible (§2.6.6) with the field descriptor type.

The value is popped from the operand stack, and the class field is set to value.

Linking Exceptions During resolution of the CONSTANT_Fieldref constant pool item, any of the exceptions documented in §5.2 can be thrown.

Otherwise, if the specified field exists but is not a static field (class variable), putstatic throws an Incompatible-Class-ChangeError.

Notes The putstatic instruction operates on both one- and two-word wide fields.


Contents | Prev | Next | Index

Java Virtual Machine Specification

Copyright © 1996, 1997 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to jvm@java.sun.com