uk.ac.man.cs.rainbow.simulator.rasm
Class Parallel

java.lang.Object
  |
  +--uk.ac.man.cs.rainbow.simulator.Instruction
        |
        +--uk.ac.man.cs.rainbow.simulator.rasm.Parallel
All Implemented Interfaces:
Serializable

public class Parallel
extends Instruction

Execute in parallel.

Executes the code starting at addr0 in parallel with the code starting at addr1 in parallel with ... in parallel with the code starting at addrn-1. Execution resumes at the instruction following this one once both of those parallel executions have terminated.

Each of the executing sub-threads has a copy of the (top-most) stack frame (after all the addresses have been popped) as its sole stack frame, and after the termination of all of them, the stack frame of the parent thread will have the same stack frame at the top as all of the sub-threads received, though it will also have all the stack frames below the current one as well, unlike the sub-threads. Thus, it is a checked error for a sub-thread to attempt to return from its initial stack frame, even if the parent of that thread was not in its topmost frame. (In other words, the number of return instructions performed by a thread at any point must not exceed the number of call instructions performed by that thread - a sane restriction, in my opinion.)

v0 ... vm addr0 ... addrn-1 n v0 ... vm

See Also:
Exit, Serialized Form

Inner classes inherited from class uk.ac.man.cs.rainbow.simulator.Instruction
Instruction.MACRO
 
Constructor Summary
Parallel()
           
Parallel(RASMCode code)
           
 
Method Summary
protected  boolean execute(RASMThread thread)
          Make this instruction execute in the given context.
 String toString()
           
 
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, wait, wait, wait
 

Constructor Detail

Parallel

public Parallel()

Parallel

public Parallel(RASMCode code)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

execute

protected 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...