Contents Prev Up


A.6 Miscellaneous Object Operations (_quick variants)

new_quick

Create new object
 
new_quick
indexbyte1
indexbyte2

Stack: ... => ..., objectref

indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class. The item at that index must be a class. A new instance of that class is then created and objectref, a reference to that object is pushed on the stack.

checkcast_quick

Make sure object is of given type
 
checkcast_quick
indexbyte1
indexbyte2

Stack: ..., objectref => ..., objectref

objectref must be a reference to an object. indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class. The object at that index of the constant pool must have already been resolved.

checkcast then determines whether objectref can be cast to a reference to an object of class class. A null reference can be cast to any class, and otherwise the superclasses of objectref's type are searched for class. If class is determined to be a superclass of objectref's type, or if objectref is null, it can be cast to objectref cannot be cast to class, a ClassCastException is thrown.

Note: here (and probably in other places) we assume casts don't change the reference; this is implementation dependent.

instanceof_quick

 
instanceof_quick
indexbyte1
indexbyte2
Determine if object is of given type

Stack: ..., objectref => ..., result

objectref must be a reference to an object. indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class. The item of class class at that index of the constant pool must have already been resolved.

instanceof determines whether objectref can be cast to an object of the class class. A null objectref can be cast to any class, and otherwise the superclasses of objectref's type are searched for class. If class is determined to be a superclass of objectref's type, result is 1 (true). Otherwise, result is 0 (false). If handle is null, result is 0 (false).


Contents Prev Up