Contents | Prev | Next | Index | The JavaTM Virtual Machine Specification |
anewarray_quick | |
indexbyte1 | |
indexbyte2 |
reference
Forms anewarray_quick = 222 (0xde)
Stack ..., count ..., arrayref
Description
The count must be of type int
. It is popped off the operand stack. The count represents the number of components of the array to be created. 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 item at that index in the constant pool must already have been successfully resolved and must be a class or interface type. A new array of that type, of length count, is allocated from the garbage-collected heap, and a reference
arrayref to this new array object is pushed onto the operand stack. All components of the new array are initialized to null
, the default value for reference types (§2.5.1).
Runtime Exception
If count is less than zero, the anewarray_quick instruction throws a NegativeArraySizeException
.
Notes The opcode of this instruction was originally anewarray. The operands of the anewarray instruction are not modified.
The anewarray_quick instruction is used to create a single dimension of an array of object references. It can also be used to create the first dimension of a multidimensional array.
checkcast_quick | |
indexbyte1 | |
indexbyte2 |
Forms checkcast_quick = 224 (0xe0)
Stack ..., objectref ..., objectref
Description
The objectref must be of type reference
. 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 object at that index of the constant pool must already have been successfully resolved and must be a class or interface type.
If objectref is null
or can be cast to the resolved class, array, or interface type, the operand stack is unchanged; otherwise, the checkcast_quick instruction throws a ClassCastException
.
The following rules are used to determine whether an objectref that is not null
can be cast to the resolved type: If S is the class of the object referred to by objectref and T is the resolved class, array, or interface type, checkcast_quick determines whether objectref can be cast to type T as follows:
[]
, that is, an array of components of type SC, then:
Object
(§2.4.6).
[]
, that is, an array of components of type TC, then one of the following must be true:
Runtime Exception
If objectref cannot be cast to the type of the resolved class, the checkcast_quick instruction throws a ClassCastException
.
Notes The opcode of this instruction was originally checkcast. The operands of the checkcast instruction are not modified.
The checkcast_quick instruction is very similar to the instanceof_quick instruction. It differs in its treatment of null
, its behavior when its test fails (checkcast_quick throws an exception, instanceof_quick pushes a result code), and its effect on the operand stack.
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 | |
indexbyte1 | |
indexbyte2 |
Forms getfield_quick_w = 227 (0xe3)
Stack ..., objectref ..., value
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.
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.
long
or double
field from objectgetfield2_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 | |
indexbyte1 | |
indexbyte2 |
Forms getstatic_quick = 210 (0xd2)
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 | |
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.
instanceof_quick | |
indexbyte1 | |
indexbyte2 |
Forms instanceof_quick = 225 (0xe1)
Stack ..., objectref ..., result
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 value of the index is (indexbyte1 << 8) | indexbyte2. The class at that index of the constant pool must have already been successfully resolved and may be a class, array, or interface.
If objectref is not null
and is an instance of the resolved class, array, or interface, the instanceof_quick instruction pushes an int
result of 1 as an int on the operand stack. Otherwise, it pushes an int
result of 0.
The following rules are used to determine whether an objectref that is not null
is an instance of the resolved type: If S is the class of the object referred to by objectref and T is the resolved class, array, or instance type, instanceof_quick determines whether objectref is an instance of T as follows:
[]
, that is, an array of components of type SC, then:
Object
(§2.4.6).
[]
, that is, an array of components of type TC, then one of the following must be true:
Notes The opcode of this instruction was originally instanceof. The operands of the instanceof instruction are not modified.
invokeinterface_quick | |
idbyte1 | |
idbyte2 | |
nargs | |
guess |
Forms invokeinterface_quick = 218 (0xda)
Stack ..., objectref, [arg1, [arg2 ...]] ...
Description The unsigned idbyte1 and idbyte2 are used to construct an identifier for the name and descriptor (§4.3.3) of the desired method, where the value of the identifier is (idbyte1 << 8) | idbyte2.
The nargs operand is an unsigned byte which must not be zero. The objectref must be of type reference
and must be followed on the operands stack by nargs - 1 words of arguments. The method table of the class of the type of objectref is determined. If objectref is an array type, then the method table of class Object
is used.
The unsigned guess is used to index into the method table. If there is a method at index guess, and if its identifier is identical to the constructed identifier, then that method is selected. Otherwise, the method table is searched for a method whose identifier is identical to the constructed identifier. If one is found, the current value of guess is overwritten by that index.
The result of the search is a method table entry, which includes a direct reference to the code for the interface method and the method's modifier information ((see Table 4.4, "Method access and modifier flags"). The method table entry must be that of a public
method.
synchronized
, the monitor associated with objectref is acquired.
If the method is not native
, the nargs - 1 words of arguments and objectref are popped from the operand stack. A new stack frame is created for the method being invoked, and objectref and the words of arguments are made the values of its first nargs local variables, with objectref in local variable 0, arg1 in local variable 1, and so on. The new stack frame is then made current, and the Java Virtual Machine pc
is set to the opcode of the first instruction of the method to be invoked. Execution continues with the first instruction of the method.
If the method is native
and the platform-dependent code that implements it has not yet been loaded and linked into the Java Virtual Machine, that is done. The nargs - 1 words of arguments and objectref are popped from the operand stack; the code that implements the method is invoked in an implementation-dependent manner.
Linking Exceptions
If no method matching the resolved name and descriptor can be found in the class of objectref, invokeinterface_quick throws an IncompatibleClassChangeError
.
Otherwise, if the selected method is a class (static
) method, the invokeinterface_quick instruction throws an IncompatibleClassChangeError
.
Otherwise, if the selected method is not public
, the in-vokeinterface_quick instruction throws an IllegalAccess-Error
.
Otherwise, if the selected method is abstract
, invoke-interface_quick throws an AbstractMethodError
.
Otherwise, if the selected method is native
and the code that implements the method cannot be loaded or linked, invoke-interface_quick throws an UnsatisfiedLinkError
.
null
, the invokeinterface_quick instruction throws a NullPointerException
. Notes The opcode of this instruction was originally invokeinterface. The initial value of guess is 0, the operand value supplied by invokeinterface. The identifiers being compared and stored in the invokeinterface_quick instruction encode a method name and descriptor as a 16-bit quantity that can be compared quickly. The details of the encoding are implementation-specific. The bytes of the identifier for the method being invoked, idbyte1 and idbyte2, replace the original constant pool index bytes. The identifier can be calculated when each method is loaded, or at run time. The value of the nargs operand is not modified.
invokenonvirtual_quick | |
indexbyte1 | |
indexbyte2 |
Forms invokenonvirtual_quick = 215 (0xd7)
Stack ..., objectref, [arg1, [arg2 ...]] ...
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_Methodref
(§4.4.2) which must already have been resolved successfully. The constant pool entry representing the resolved method includes a direct reference to the code for the method, an unsigned byte nargs which must be greater than zero, and the method's modifier information (see Table 4.4, "Method access and modifier flags").
If the method is synchronized
, the monitor associated with objectref is acquired.
If the method is not native
, the nargs - 1 words of arguments and objectref are popped from the operand stack. A new stack frame is created for the method being invoked, and objectref and the words of arguments are made the values of its first nargs local variables, with objectref in local variable 0, arg1 in local variable 1, and so on. The new stack frame is then made current, and the Java Virtual Machine pc
is set to the opcode of the first instruction of the method to be invoked. Execution continues with the first instruction of the method.
If the method is native
, the nargs - 1 words of arguments and objectref are popped from the operand stack; the code that implements the method is invoked in an implementation-dependent manner.
Runtime Exception
If objectref is null
, the invokenonvirtual_quick instruction throws a NullPointerException
.
Notes
The opcode of this instruction was originally invokespecial, and the method it invoked was determined dynamically to be either an instance initialization method <init>
or a private
method. The operands of the invokespecial instruction are not modified.
The difference between the invokenonvirtual_quick and the in-vokevirtual_quick_w instructions is that invokevirtual_quick_w invokes a method based on the actual (runtime) type of the object. The invokenonvirtual_quick instruction invokes an instance initialization method or private
method based on the compile-time type of the object.
invokesuper_quick | |
indexbyte1 | |
indexbyte2 |
Forms invokesuper_quick = 216 (0xd8)
Stack ..., objectref, [arg1, [arg2 ...]] ...
Description The unsigned indexbyte1 and indexbyte2 are used to construct an index into the method table of the superclass of the current class (§3.6), where the value of the index is (indexbyte1 << 8) | indexbyte2. The specified method table entry includes a direct reference to the code for the method, an unsigned byte nargs which must be greater than zero, and the method's modifier information (see Table 4.4, "Method access and modifier flags").
If the method is synchronized
, the monitor associated with objectref is acquired.
If the method is not native
, the nargs - 1 words of arguments and objectref are popped from the operand stack. A new stack frame is created for the method being invoked, and objectref and the words of arguments are made the values of its first nargs local variables, with objectref in local variable 0, arg1 in local variable 1, and so on. The new stack frame is then made current, and the Java Virtual Machine pc
is set to the opcode of the first instruction of the method to be invoked. Execution continues with the first instruction of the method.
If the method is native
, the nargs - 1 words of arguments and objectref are popped from the operand stack; the code that implements the method is invoked in an implementation-dependent manner.
Runtime Exception
If objectref is null
, the invokesuper_quick instruction throws a NullPointerException
.
Notes The opcode of this instruction was originally invokespecial, and the method it invoked was determined dynamically to be a method in a superclass of the current object. The operands of the invokespecial instruction are not modified.
The difference between the invokesuper_quick and the invokevirtual_quick_w instructions is that invokevirtual_quick_w invokes a method based on the class of the object. The invokesuper_quick instruction is used to invoke methods in a superclass of the current class.
The invokesuper_quick instruction was introduced in Sun's JDK 1.0.2 release to fix a bug in earlier versions of the Java Virtual Machine. Prior to that release, the invokespecial instruction (then named invokenonvirtual) would always be converted to the invokenonvirtual_quick instruction.
invokestatic_quick | |
indexbyte1 | |
indexbyte2 |
Forms invokestatic_quick = 217 (0xd9)
Stack ..., [arg1, [arg2 ...]] ...
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_Methodref
(§4.4.2) which must already have been resolved successfully.
The constant pool entry representing the resolved method includes a direct reference to the code for the method, an unsigned byte nargs which may be zero, and the method's modifier information (see Table 4.4, "Method access and modifier flags").
If the method is synchronized
, the monitor associated with the current class is acquired.
If the method is not native
, the nargs words of arguments are popped from the operand stack. A new stack frame is created for the method being invoked, and the words of arguments are made the values of its first nargs local variables, with arg1 in local variable 0, arg2 in local variable 1, and so on. The new stack frame is then made current, and the Java Virtual Machine pc
is set to the opcode of the first instruction of the method to be invoked. Execution continues with the first instruction of the method.
If the method is native
, the nargs words of arguments are popped from the operand stack; the code that implements the method is invoked in an implementation-dependent manner.
Notes The opcode of this instruction was originally invokestatic. The operands of the invokestatic instruction are not modified.
invokevirtual_quick | |
index | |
nargs |
Forms invokevirtual_quick = 214 (0xd6)
Stack ..., objectref, [arg1, [arg2 ...]] ...
Description
The objectref must be of type reference
and must reference a class instance. The index operand is an unsigned byte, and the nargs operand is an unsigned byte, which must not be zero. The index is an index into the method table of the class of the type of objectref. The table entry at that index includes the method's code and its modifier information (see Table 4.4, "Method access and modifier flags").
If the method is synchronized
, the monitor associated with objectref is acquired.
If the method is not native
, the nargs - 1 words of arguments and objectref are popped from the operand stack. A new stack frame is created for the method being invoked, and objectref and the words of arguments are made the values of its first nargs local variables, with objectref in local variable 0, arg1 in local variable 1, and so on. The new stack frame is then made current, and the Java Virtual Machine pc
is set to the opcode of the first instruction of the method to be invoked. Execution continues with the first instruction of the method.
If the method is native
and the platform-dependent code that implements it has not yet been loaded and linked into the Java Virtual Machine, that is done. The nargs - 1 words of arguments and objectref are popped from the operand stack; the code that implements the method is invoked in an implementation-dependent manner.
Linking Exception
If the specified method is native
and the code that implements the method cannot be loaded or linked, the invokevirtual_quick instruction throws an UnsatisfiedLinkError
.
Runtime Exception
Otherwise, if objectref is null
, the invokevirtual_quick instruction throws a NullPointerException
.
Notes
The opcode of this instruction was originally invokevirtual, with objectref not referring to an instance of java.lang.Object
and with operands determined dynamically to represent a method with a method table index of 255 or less. When the constant pool entry referenced by an invokevirtual instruction is resolved, a one-byte index for the method it references is generated. That index replaces the first operand byte of the original invokevirtual instruction. The second operand byte of the invokevirtual instruction is replaced by nargs, the number of argument words expected by the method.
An invokevirtual instruction referring to an instance of java.lang.Object
and with operands representing a constant pool index of 255 or less will instead be converted into an invokevirtualobject_quick instruction. Any invokevirtual instruction with operands representing a constant pool index greater than 255 will be converted into an invokevirtual_quick_w instruction.
invokevirtual_quick_w | |
indexbyte1 | |
indexbyte2 |
Forms invokevirtual_quick_w = 226 (0xe2)
Stack ..., objectref, [arg1, [arg2 ...]] ...
Description
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_Methodref
(§4.4.2) which must already have been resolved successfully. The constant pool entry representing the resolved method includes an unsigned index into the method table of the resolved class and an unsigned byte nargs which must not be zero.
The objectref must be of type reference
. The index is used as an index into the method table of the class of the type of objectref. If the objectref is an array type, then the method table of class Object
is used. The table entry at that index includes the method's code and its modifier information (see Table 4.4, "Method access and modifier flags").
If the method is synchronized
, the monitor associated with objectref is acquired.
If the method is not native
, the nargs - 1 words of arguments and objectref are popped from the operand stack. A new stack frame is created for the method being invoked, and objectref and the words of arguments are made the values of its first nargs local variables, with objectref in local variable 0, arg1 in local variable 1, and so on. The new stack frame is then made current, and the Java Virtual Machine pc
is set to the opcode of the first instruction of the method to be invoked. Execution continues with the first instruction of the method.
If the method is native
and the platform-dependent code that implements it has not yet been loaded and linked into the Java Virtual Machine, that is done. The nargs - 1 words of arguments and objectref are popped from the operand stack; the code that implements the method is invoked in an implementation-dependent manner.
Linking Exception
If the specified method is native
and the code that implements the method cannot be loaded or linked, the invokevirtual_quick_w instruction throws an UnsatisfiedLinkError
.
Runtime Exception
Otherwise, if objectref is null
, the invokevirtual_quick_w instruction throws a NullPointerException
.
Notes The opcode of this instruction was originally invokevirtual, with operands determined dynamically to represent a method with a method table index greater than 255. The operands of the invokevirtual instruction are not modified.
The invokevirtual_quick and invokevirtualobject_quick instructions only support a one-byte offset into the method table of objectref. The invokevirtual_quick_w instruction can be used to for invocations of methods that cannot be represented using invokevirtual_quick.
invokevirtualobject_quick | |
index | |
nargs |
java.lang.Object
Forms invokevirtualobject_quick = 219 (0xdb)
Stack ..., objectref, [arg1, [arg2 ...]] ...
Description
The objectref must be of type reference
. The index operand is an unsigned byte, and the nargs operand is an unsigned byte which must not be zero. The index is an index into the method table of the class of the type of objectref. If the objectref is an array type, then the method table of class Object
is used. The table entry at that index includes the method's code and its modifier information (see Table 4.4, "Method access and modifier flags").
If the method is synchronized
, the monitor associated with objectref is acquired.
If the method is not native
, the nargs - 1 words of arguments and objectref are popped from the operand stack. A new stack frame is created for the method being invoked, and objectref and the words of arguments are made the values of its first nargs local variables, with objectref in local variable 0, arg1 in local variable 1, and so on. The new stack frame is then made current, and the Java Virtual Machine pc
is set to the opcode of the first instruction of the method to be invoked. Execution continues with the first instruction of the method.
If the method is native
and the platform-dependent code that implements it has not yet been loaded and linked into the Java Virtual Machine, that is done. The nargs - 1 words of arguments and objectref are popped from the operand stack; the code that implements the method is invoked in an implementation-dependent manner.
Linking Exception
If the specified method is native
and the code that implements the method cannot be loaded or linked, invokevirtual_quick throws an UnsatisfiedLinkError
.
Runtime Exception
Otherwise, if objectref is null
, the invokevirtualobject_quick instruction throws a NullPointerException
.
Notes
The opcode of this instruction was originally invokevirtual, and it referred to a method of the class java.lang.Object
determined dynamically to have a method table index of 255 or less. The invokevirtualobject_quick instruction is specifically for the benefit of arrays.
When the constant pool entry referenced by an invokevirtual instruction is resolved, a one-byte index for the method it references is generated. That index replaces the first operand byte of the original invokevirtual instruction. The second operand byte of the invokevirtual instruction is replaced by nargs, the number of argument words expected by the method.
The invokevirtualobject_quick instruction only supports a one-byte index into the method table of objectref. Objects with large numbers of methods may not be able to have all their methods referenced with _quick variants. It is always correct, if less efficient, to re-fuse to convert an instance of an invokevirtual instruction to invokevirtualobject_quick.
An invokevirtual instruction not referring to an instance of java.lang.Object
and with operands representing a constant pool index of 255 or less will instead be converted into an invokevirtual_quick instruction. Any invokevirtual instruction with operands representing a constant pool index greater than 255 will be converted into an invokevirtual_quick_w instruction.
ldc_quick | |
index |
Description The index is an unsigned byte that must be a valid index into the constant pool of the current class (§3.6). The constant pool item at index must have already been resolved and must be one word wide. The item is fetched from the constant pool and pushed onto the operand stack.
Notes The opcode of this instruction was originally ldc. The operand of the ldc instruction is not modified.
ldc_w_quick | |
indexbyte1 | |
indexbyte2 |
Forms ldc_w_quick = 204 (0xcc)
Description The unsigned indexbyte1 and indexbyte2 are assembled into an unsigned 16-bit index into the constant pool of the current class (§3.6), where index is (indexbyte1 << 8) | indexbyte2. The index must be a valid index into the constant pool of the current class. The constant pool item at the index must have already been resolved and must be one word wide. The item is fetched from the constant pool and pushed onto the operand stack.
Notes The opcode of this instruction was originally ldc_w. The operands of the ldc_w instruction are not modified.
The ldc_w_quick instruction is identical to the ldc_quick instruction, except for its wider constant pool index.
long
or double
from constant pool (wide index)ldc2_w_quick | |
indexbyte1 | |
indexbyte2 |
Forms ldc2_w_quick = 205 (0xcd)
Stack ... ..., item.word1, item.word2
Description The unsigned indexbyte1 and indexbyte2 are assembled into an unsigned 16-bit index into the constant pool of the current class (§3.6), where the value of the index is (indexbyte1 << 8) | indexbyte2. The index must be a valid index into the constant pool of the current class. The (64-bit) constant pool constant at the index must have already been resolved and must be two words wide.
Notes The opcode of this instruction was originally ldc2_w. The operands of the original ldc2_w instruction are not modified.
Only a wide index version of this instruction exists; there is no ldc2_quick instruction that pushes a two-word constant with a single-byte index.
multianewarray_quick | |
indexbyte1 | |
indexbyte2 | |
dimensions |
Forms multianewarray_quick = 223 (0xdf)
Stack ..., count1, [count2, ...] ..., arrayref
Description
The dimensions is an unsigned byte which must be greater than or equal to 1. It represents the number of dimensions of the array to be created. The operand stack must contain dimensions words, which must be of type int
and nonnegative, each representing the number of components in a dimension of the array to be created. The count1 is the desired length in the first dimension, count2 in the second, etc.
All of the count values are popped off 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 value of the index is (indexbyte1 << 8) | indexbyte2. The resulting entry must have already been resolved to an array class type of dimensionality greater than or equal to dimensions.
A new multidimensional array of the array type is allocated from the garbage-collected heap. The components of the first dimension of the array are initialized to subarrays of the type of second dimension, and so on. The components of the array in the final dimension are initialized to the default initial value for its type (§2.5.1). A reference
arrayref to the new array is pushed onto the operand stack.
Runtime Exception
If any of the dimensions values on the operand stack is less than zero, multianewarray_quick throws a NegativeArraySize
-Exception
.
Notes The opcode of this instruction was originally multianewarray. The operands of the multianewarray instruction are not modified.
new_quick | |
indexbyte1 | |
indexbyte2 |
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 item at that index must have already been resolved to a class type. A new instance of that class is created, and the instance variables of the new object are initialized to their default initial values (§2.5.1). The objectref, a reference
to the instance, is pushed onto the operand stack.
Notes The opcode of this instruction was originally new. The operands of the original new instruction are not modified.
putfield_quick | |
offset | |
unused |
Forms putfield_quick = 207 (0xcf)
Stack ..., objectref, value ...
Description
The objectref, which must be of type reference
, and value, which must be a value of a type appropriate for the specified field, are popped from the operand stack. The value is written at offset into the class instance referenced by objectref.
Runtime Exception
If objectref is null
, the putfield_quick instruction throws a NullPointerException
.
Notes The opcode of this instruction was originally putfield, 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 putfield instruction is resolved, the offset for the field it references is generated. That offset replaces the first operand byte of the original putfield instruction. The second operand byte of the putfield is unused in putfield_quick.
putfield_quick_w | |
indexbyte1 | |
indexbyte2 |
Forms putfield_quick_w = 228 (0xe4)
Stack ..., objectref, value ...
Stack ..., objectref, value.word1, value.word2 ...
Description
The objectref, which must be of type reference
, and value, which must be a value of a type appropriate for the specified field, are 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. The value is written at offset into the class instance referenced by objectref.
Runtime Exception
If objectref is null
, the putfield_quick_w instruction throws a NullPointerException
.
Notes The opcode of this instruction was originally putfield, operating on a field determined dynamically to have an offset into the class instance data of more than 255 words.
The operands of the putfield instruction are not modified. Because the putfield_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 putfield 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, putfield_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.
long
or double
field in objectputfield2_quick | |
offset | |
unused |
Forms putfield2_quick = 209 (0xd1)
Stack ..., objectref, value.word1, value.word2 ...
Description
The objectref, which must be of type reference
, and value, which must be a value of a type appropriate for the specified field, are popped from the operand stack. The value is written at offset into the class instance referenced by objectref.
Runtime Exception
If objectref is null
, the putfield2_quick instruction throws a NullPointerException
.
Notes The opcode of this instruction was originally putfield, 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 putfield instruction is resolved, the offset for the field it references is generated. That offset replaces the first operand of the original putfield instruction. The second operand of the putfield is unused by putfield2_quick.
static
field in classputstatic_quick | |
indexbyte1 | |
indexbyte2 |
Forms putstatic_quick = 211 (0xd3)
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 must be a field reference to a class (static
) field that must have already been successfully resolved to a type that is one word wide. The value must be of a type appropriate to that class field. The value is popped from the operand stack, and that class field is set to value.
Notes
The opcode of this instruction was originally putstatic, operating on a static
field determined dynamically to be one word wide. The operands of the putstatic instruction are not modified. There is no equivalent to the putfield_quick instruction, storing a class offset as an instruction operand, for one-word static
fields.
static
field in classputstatic2_quick | |
indexbyte1 | |
indexbyte2 |
Forms putstatic2_quick = 213 (0xd5)
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 must be a field reference to a class (static
) field that must have already been successfully resolved to a type that is two words wide. The value must be of a type appropriate to that class field. The value is popped from the operand stack, and that class field is set to value.
Notes
The opcode of this instruction was originally putstatic, operating on a static
field determined dynamically to be two words wide. The operands of the putstatic instruction are not modified. There is no equivalent to the putfield2_quick instruction, storing a class offset as an instruction operand, for two-word static
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