uk.ac.man.cs.rainbow.simulator
Class RASM.BinaryIntFunction

java.lang.Object
  |
  +--uk.ac.man.cs.rainbow.simulator.Instruction
        |
        +--uk.ac.man.cs.rainbow.simulator.RASM.BinaryIntFunction
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Add, Div, Mod, Mult, Shl, Shr, Shrz, Sub
Enclosing class:
RASM

public abstract static class RASM.BinaryIntFunction
extends Instruction

Binary operations over integers. Factorises out the actual stack manipulation code as that is common across all the variants. All are of the form:

x y op(x,y)

See Also:
RASMThread.popInt(), RASMThread.push(int), Serialized Form

Inner classes inherited from class uk.ac.man.cs.rainbow.simulator.Instruction
Instruction.MACRO
 
Constructor Summary
RASM.BinaryIntFunction()
           
RASM.BinaryIntFunction(RASMCode code)
           
 
Method Summary
protected abstract  int execute(int x, int y)
          Perform an integer binary operation.
protected  boolean execute(RASMThread thread)
          Make this instruction execute in the given context.
 
Methods inherited from class uk.ac.man.cs.rainbow.simulator.Instruction
addClass, getInstruction, getInstruction, getInstruction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RASM.BinaryIntFunction

public RASM.BinaryIntFunction()

RASM.BinaryIntFunction

public RASM.BinaryIntFunction(RASMCode code)
Method Detail

execute

protected abstract int execute(int x,
                               int y)
                        throws RASMThread.Exception
Perform an integer binary operation.
Parameters:
x - The first (lower on the stack) value argument.
y - The second (higher on the stack) value argument.
Returns:
The result of the operation.

execute

protected final boolean execute(RASMThread thread)
                         throws RASMThread.Exception
Description copied from class: Instruction
Make this instruction execute in the given context.
Overrides:
execute in class Instruction
Following copied from class: uk.ac.man.cs.rainbow.simulator.Instruction
Throws:
RainbowException - All sorts of things can go wrong during execution...