at.dms.kjc.rstream
Class JoinerFusionState

java.lang.Object
  extended by at.dms.kjc.rstream.FusionState
      extended by at.dms.kjc.rstream.JoinerFusionState

public class JoinerFusionState
extends FusionState

This class represent the state and conversion necessary to convert a joiner FlatNode into imperative SIR code so it can be added to the application's SIR code. Essentially, we create an outer loop with trip count equal to the multiplicity of the joiner, inside the loop we read from each incoming buffer for the number of times given by the weight on the incoming edge corresponding to the buffer and place the items in the single outgoing buffer.

Author:
Michael Gordon

Field Summary
static String INIT_PATH_COPY
           
static String INIT_PATH_INDEX
           
static String JOINERCOUNTER
           
static String JOINERINNERVAR
           
 
Fields inherited from class at.dms.kjc.rstream.FusionState
BACKUPCOUNTER, BUFFERNAME, bufferVar, fusionState, myUniqueID, necessary, node, remaining
 
Constructor Summary
protected JoinerFusionState(FlatNode node)
           
 
Method Summary
 int getBufferSize(FlatNode prev, boolean init)
          return the buffer size for the incoming buffer from *prev* to this node
 JVariableDefinition getBufferVar(FlatNode node, boolean init)
          return the var def of the incoming (pop) buffer from *node* to this joiner
 int getRemaining(FlatNode prev, boolean isInit)
          return the items remaining (after the init stage) on the incoming buffer from *prev* to this node.
 JStatement[] getWork(JBlock enclosingBlock, boolean isInit)
          Construct the code necessary to perform the joining of the incoming buffers as given by the round-robin weights of the joiner
 void initTasks(Vector<JFieldDeclaration> fields, Vector<JMethodDeclaration> functions, JBlock initFunctionCalls, JBlock main)
          Perform the initialization tasks of this joiner, including declaring the incoming buffers and calling the init path function and placing the results in the correct incoming buffer if this joiner is a feedback joiner
 
Methods inherited from class at.dms.kjc.rstream.FusionState
getFusionState, getNode, intAssignStm, isNecesary, makeBuffer, remainingBackupLoop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JOINERINNERVAR

public static String JOINERINNERVAR

JOINERCOUNTER

public static String JOINERCOUNTER

INIT_PATH_INDEX

public static String INIT_PATH_INDEX

INIT_PATH_COPY

public static String INIT_PATH_COPY
Constructor Detail

JoinerFusionState

protected JoinerFusionState(FlatNode node)
Method Detail

initTasks

public void initTasks(Vector<JFieldDeclaration> fields,
                      Vector<JMethodDeclaration> functions,
                      JBlock initFunctionCalls,
                      JBlock main)
Perform the initialization tasks of this joiner, including declaring the incoming buffers and calling the init path function and placing the results in the correct incoming buffer if this joiner is a feedback joiner

Specified by:
initTasks in class FusionState

getWork

public JStatement[] getWork(JBlock enclosingBlock,
                            boolean isInit)
Construct the code necessary to perform the joining of the incoming buffers as given by the round-robin weights of the joiner

Specified by:
getWork in class FusionState

getBufferVar

public JVariableDefinition getBufferVar(FlatNode node,
                                        boolean init)
return the var def of the incoming (pop) buffer from *node* to this joiner

Specified by:
getBufferVar in class FusionState

getBufferSize

public int getBufferSize(FlatNode prev,
                         boolean init)
return the buffer size for the incoming buffer from *prev* to this node

Specified by:
getBufferSize in class FusionState

getRemaining

public int getRemaining(FlatNode prev,
                        boolean isInit)
return the items remaining (after the init stage) on the incoming buffer from *prev* to this node. remember to add the initpath items that were not consumed by this joiner if it is a feedback joiner

Specified by:
getRemaining in class FusionState