Contents Prev Next Up


- An Optimization


Miscellaneous Object Operations (_quick variants)

new_quick
checkcast_quick
instanceof_quick

new_quick

Create new object

... => ..., handle

indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current class. The item at that index should be a class. A new instance of that class is then created and a handle for it pushed on the stack.

checkcast_quick

Make sure object is of given type

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

handle should be a handle 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 should have already been resolved.

checkcast then determines whether handle can be cast to an object of class class. A null handle can be cast to any class, and otherwise the superclasses of handle are searched for class. If class is determined to be a superclass of handle, or if handle is null, object can be cast to class and execution proceeds at the next instruction, and the handle for handle remains on the stack.

If handle cannot be cast to class, a ClassCastException is thrown.

instanceof_quick



Determine if object is of given type

..., handle => ..., result

handle should be a handle 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 is assumed to have already been resolved.

instanceof determines whether handle can be cast to an object of the class class. A null handle can be cast to any class, and otherwise the superclasses of handle are searched for class. If class is determined to be a superclass of handle, or if handle is null, handle is overwritten by 1. Otherwise, handle is overwritten by 0.


Contents Prev Next Up

Generated with CERN WebMaker