private Hashtable< FlatNode, Set<TempDescriptor> > notAvailableResults;
private Hashtable< FlatNode, CodePlan > codePlans;
+ private static final int maxSESEage = 2;
// use these methods in BuildCode to have access to analysis results
public Set<FlatSESEEnterNode> getAllSESEs() {
return allSESEs;
}
+ public FlatSESEEnterNode getRootSESE() {
+ return rootSESE;
+ }
+
+ public int getMaxSESEage() {
+ return maxSESEage;
+ }
+
public CodePlan getCodePlan( FlatNode fn ) {
CodePlan cp = codePlans.get( fn );
assert cp != null;
}
/* Build the actual methods */
+ if( state.MLP ) {
+ outmethod.println("/* GET RID OF THIS LATER */");
+ outmethod.println("struct SESErecord* tempSESE;");
+ outmethod.println("struct SESErecord* tempParentSESE;");
+ }
outputMethods(outmethod);
// Output function prototypes and structures for SESE's and code
if (state.MLP) {
outmethod.println(" mlpInit();");
+
+ FlatSESEEnterNode rootSESE = mlpa.getRootSESE();
+
+ outmethod.println(" ");
}
MethodDescriptor md=typeutil.getMain();
ParamsObject objectparams = (ParamsObject)paramstable.get(bogusmd);
// first copy SESE record into param structure
- output.println(" if( parentIsRoot ) {");
- output.println(" ");
- output.println(" ");
- output.println(" } else {");
+ output.println(" if( parentIsRoot ) {");
output.println(" ");
output.println(" }");
return;
}
+ output.println(" tempSESE = (struct SESErecord*) malloc( sizeof( struct SESErecord ) );");
+ output.println(" tempSESE->vars = (struct SESEvar*) malloc( sizeof( struct SESEvar ) * "+
+ +fsen.numParameters()+
+ ");");
+
+ for( int i = 0; i < fsen.numParameters(); ++i ) {
+ TempDescriptor td = fsen.getParameter( i );
+ TypeDescriptor type = td.getType();
+ output.println(" tempSESE->vars["+i+"].sesetype_"+type.toString()+" = "+td+";");
+ }
+
+ output.println(" mlpIssue( tempSESE );");
+ output.println(" tempSESE = mlpSchedule();");
+ output.println(" tempParentSESE = mlpGetCurrent();");
output.println(" invokeSESEmethod("+
fsen.getIdentifier()+", "+
- "malloc( sizeof( struct SESErecord ) ), "+
- "NULL"+
+ "tempSESE, "+
+ "tempParentSESE"+
");"
- );
+ );
}
public void generateFlatSESEExitNode(FlatMethod fm, LocalityBinding lb, FlatSESEExitNode fsen, PrintWriter output) {
import java.util.*;
public class FlatSESEEnterNode extends FlatNode {
+
+ // SESE class identifiers should be numbered
+ // sequentially from 0 to 1-(total # SESE's)
private static int identifier=0;
+
private int id;
protected FlatSESEExitNode exit;
protected SESENode treeNode;
#include <stdlib.h>
#include <stdio.h>
+#include <assert.h>
#include "mlp_runtime.h"
#include "Queue.h"
-static struct Queue* issued;
+// the root sese is accessible globally so
+// buildcode can generate references to it
+struct SESErecord* rootsese;
+
+
+// the issuedQ, in this simple version, spits
+// out SESErecord's in the order they were issued
+static struct Queue* issuedQ;
+
+
+// the class_age2instance maps an SESE class id and
+// age value to a particular SESErecord instance
+static struct SESErecord** class_age2instance;
// each core should have a current SESE
static struct SESErecord* current;
-void mlpInit() {
- issued = createQueue();
- current = NULL;
+void mlpInit( int totalNumSESEs, int maxSESEage ) {
+ rootsese = (struct SESErecord*) malloc( sizeof( struct SESErecord ) );
+
+ issuedQ = createQueue();
+
+ class_age2instance = (struct SESErecord**) malloc( sizeof( struct SESErecord* ) *
+ maxSESEage *
+ totalNumSESEs
+ );
+
+ current = rootsese;
}
void mlpIssue( struct SESErecord* sese ) {
- addNewItem( issued, (void*) sese );
+ addNewItem( issuedQ, (void*) sese );
}
+
+struct SESErecord* mlpSchedule() {
+ assert( !isEmpty( issuedQ ) );
+ return (struct SESErecord*) getItem( issuedQ );
+}
+
+
void mlpStall( struct SESErecord* sese ) {
}
+
void mlpNotifyExit( struct SESErecord* sese ) {
}
-
-/*
-isEmpty(queue)
-void* getItem(queue)
-*/
#define __MLP_RUNTIME__
+#include <pthread.h>
+#include "Queue.h"
+
+
// value mode means the variable's value
// is present in the SESEvar struct
#define SESEvar_MODE_VALUE 3001
// in this location, which can be accessed
// as a variety of types
union {
- char sesetype_byte;
- char sesetype_boolean;
- short sesetype_short;
- int sesetype_int;
- long sesetype_long;
- char sesetype_char;
- float sesetype_float;
- double sesetype_double;
+ char sesetype_byte;
+ int sesetype_boolean;
+ short sesetype_short;
+ int sesetype_int;
+ long long sesetype_long;
+ short sesetype_char;
+ float sesetype_float;
+ double sesetype_double;
+ void* sesetype_object;
};
// a statically or dynamically known SESE
// the primitives will be passed out of the
// above var array at the call site
void* paramStruct;
+
+ // use a list of SESErecords and a lock to let
+ // consumers tell this SESE who wants values
+ // forwarded to it
+ pthread_mutex_t forwardListLock;// = PTHREAD_MUTUX_INITIALIZER;
+ struct Queue* forwardList;
};
void mlpInit();
struct SESErecord* mlpGetCurrent();
+struct SESErecord* mlpSchedule();
void mlpIssue ( struct SESErecord* sese );
void mlpStall ( struct SESErecord* sese );
void mlpNotifyExit( struct SESErecord* sese );
+extern struct SESErecord* rootsese;
+
+
#endif /* __MLP_RUNTIME__ */
SOURCE_FILES=$(PROGRAM).java
BUILDSCRIPT=~/research/Robust/src/buildscript
-#BSFLAGS= -mlpdebug -mainclass Test -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions -flatirusermethods -ownaliasfile aliases.txt
-BSFLAGS= -mainclass Test -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions -flatirusermethods -ownaliasfile aliases.txt
+BSFLAGS= -mlpdebug -nooptimize -debug -mainclass Test -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions -flatirusermethods -ownaliasfile aliases.txt
+#BSFLAGS= -mainclass Test -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions -flatirusermethods -ownaliasfile aliases.txt
all: $(PROGRAM).bin
public class Test {
public static void main( String args[] ) {
- /*
- int n = 10;
-
- sese top {
- int x = 0;
-
- for( int i = 0; i < 3; ++i ) {
- sese iter {
- x = x + i;
- }
- }
-
- int j = x + n;
- }
-
- int z = n + j;
- */
-
-
-
-
-
-
-
-
-
int x = 1;
int y = 1;
}
}
- /*
+ /* ADD BACK IN LATER, TO TEST STALLS
// shouldn't cause a stall
int z = x;
z = z + 1;
*/
- // expecting x=3, y=3
- System.out.println( "x="+x+", y="+y );
+ // see that values from sese fi are
+ // forwarded to this sibling
+ sese fo {
+ // expecting x=3, y=3
+ System.out.println( "x="+x+", y="+y );
+ }
//afunc( i );
}
+ /*
public static void afunc( Integer i ) {
i = null;
}
+ */
}
elif [[ $1 = '-mlp' ]]
then
JAVAOPTS="$JAVAOPTS -mlp"
+EXTRAOPTIONS="$EXTRAOPTIONS -lpthread"
elif [[ $1 = '-mlpdebug' ]]
then
JAVAOPTS="$JAVAOPTS -mlpdebug"
+EXTRAOPTIONS="$EXTRAOPTIONS -lpthread"
elif [[ $1 = '-check' ]]
then
CHECKFLAG=true