Java Reference
In-Depth Information
value1 just beneath it. As a result of the execution of the instruction, value1 and value2
are popped from the operand stack and replaced by result value, which has been calculated
by the instruction. The remainder of the operand stack, represented by an ellipsis (), is
unaected by the instruction's execution. Values of types long and double are represented
by a single entry on the operand stack.
D.5.1
Object Instructions
Mnemonic
Operation
Operand Stack
new Create new object
) ;objectref
instanceof Determine if object is of
given type
;objectref ) ;result
checkcast Check whether object is of
given type
;objectref ) ;objectref
The above instructions can be added to the code section of a method by sending the
CLEmitter instance the following message:
publicvoidaddReferenceInstruction(intopcode,
Stringtype)
where opcode is the mnemonic of the instruction to be added, and type is the reference
type in internal form or a type descriptor if it is an array type.
D.5.2
Field Instructions
Mnemonic
Operation
Operand Stack
getfield Get eld from object ;objectref ) ;value
putfield Set eld in object ;objectref;value )
getstatic Get static eld from class ) ;value
putstatic Set static field in class
;value )
The above instructions can be added to the code section of a method by sending the
CLEmitter instance the following message:
publicvoidaddMemberAccessInstruction(intopcode,
Stringtarget,
Stringname,
Stringtype)
where opcode is the mnemonic of the instruction to be added, target is the name (in
internal form) of the class to which the field belongs, name is the name of the field, and
type is the type descriptor of the field.
 
Search WWH ::




Custom Search