|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.dms.kjc.rstream.FusionState
public abstract class FusionState
This abstract class represents the state necessary for each FlatNode in the application to be converted to imperative SIR code by GenerateCCode. Any state that can be shared over FilterFusionState, JoinerFusionState, and SplitterFusionState is here. Plus it defines a common interface (getWork(), initTasks()) for those nodes.
Field Summary | |
---|---|
protected static String |
BACKUPCOUNTER
|
static String |
BUFFERNAME
the variaible prefix of the incoming buffer |
protected JVariableDefinition[] |
bufferVar
the size of the incoming buffers for each incoming edge |
protected static HashMap<FlatNode,FusionState> |
fusionState
a hashmap of all fusionstates created so far, indexed by flatnode |
protected int |
myUniqueID
the unique ID of this fusionstate |
protected boolean |
necessary
true if this node *needs* to code generated for correctness false for some identity's and duplicate splitters |
protected FlatNode |
node
the flatnode that this object represents |
protected int[] |
remaining
the number of items remaining on the tape after the init stage has completed for each incoming channel of the node |
Constructor Summary | |
---|---|
protected |
FusionState(FlatNode node)
create a new FusionState object that represents *node*, note one should never create fusionstates, they are created using getFusionState(). |
Method Summary | |
---|---|
abstract int |
getBufferSize(FlatNode prev,
boolean init)
get the size of the buffer from *prev* to this node |
abstract JVariableDefinition |
getBufferVar(FlatNode prev,
boolean init)
Return the JVariableDefinition associated with the incoming buffer from *prev* to this node. |
static FusionState |
getFusionState(FlatNode node)
Given FlatNode *node*, return the fusion state object representing it. |
FlatNode |
getNode()
Return the FlatNode associated with this FusionState |
abstract int |
getRemaining(FlatNode prev,
boolean init)
get the number of items remaining after the init stage on the incoming buffer from *prev* to this node |
abstract JStatement[] |
getWork(JBlock enclosingBlock,
boolean isInit)
get the block that will perform the init stage (*isInit* = true) or the steady-state (*isInit* = false), add any var decls to *enclosingBlock* |
abstract void |
initTasks(Vector<JFieldDeclaration> fields,
Vector<JMethodDeclaration> functions,
JBlock initFunctionCalls,
JBlock main)
called by GenerateCCode so that this node can add any initialization code to the application |
protected JStatement |
intAssignStm(JVariableDefinition def,
int value)
Returnn a JAssignmentStatement that will assign *value* to def*. |
boolean |
isNecesary()
|
protected JVariableDefinition |
makeBuffer(int bufferSize,
CType elementType,
String bufferName)
create a JVarDef representing an array of type *elementType* (which itself can be an array, with *bufferSize* elements and name *bufferName*. |
protected JStatement |
remainingBackupLoop(JVariableDefinition buffer,
JVariableDefinition loopCounterBackup,
int offset,
int remainingItems)
Return SIR code to move *remainingItems* to the beginning of *buffer* starting at *offset*, using *loopCounterBackup* as the induction variable of the loop. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean necessary
protected FlatNode node
protected int[] remaining
protected JVariableDefinition[] bufferVar
protected static HashMap<FlatNode,FusionState> fusionState
protected int myUniqueID
public static String BUFFERNAME
protected static String BACKUPCOUNTER
Constructor Detail |
---|
protected FusionState(FlatNode node)
Method Detail |
---|
public abstract int getBufferSize(FlatNode prev, boolean init)
public abstract int getRemaining(FlatNode prev, boolean init)
public boolean isNecesary()
public abstract void initTasks(Vector<JFieldDeclaration> fields, Vector<JMethodDeclaration> functions, JBlock initFunctionCalls, JBlock main)
public abstract JStatement[] getWork(JBlock enclosingBlock, boolean isInit)
public static FusionState getFusionState(FlatNode node)
public abstract JVariableDefinition getBufferVar(FlatNode prev, boolean init)
public FlatNode getNode()
protected JStatement intAssignStm(JVariableDefinition def, int value)
protected JStatement remainingBackupLoop(JVariableDefinition buffer, JVariableDefinition loopCounterBackup, int offset, int remainingItems)
protected JVariableDefinition makeBuffer(int bufferSize, CType elementType, String bufferName)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |