From: jjenista Date: Mon, 1 Jun 2009 23:09:53 +0000 (+0000) Subject: about to make lots of changes to system, just committing this stable compilation... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6a37681b314d9ed892ea004ee4cb638f8118820b;p=IRC.git about to make lots of changes to system, just committing this stable compilation that is benign to other compiler uses to reduce conflicts --- diff --git a/Robust/src/Analysis/MLP/MLPAnalysis.java b/Robust/src/Analysis/MLP/MLPAnalysis.java index 1848d470..3c6a3819 100644 --- a/Robust/src/Analysis/MLP/MLPAnalysis.java +++ b/Robust/src/Analysis/MLP/MLPAnalysis.java @@ -30,12 +30,21 @@ public class MLPAnalysis { private Hashtable< FlatNode, Set > 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 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; diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 9c75c336..6bf05f0a 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -196,6 +196,11 @@ public class BuildCode { } /* 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 @@ -292,6 +297,10 @@ public class BuildCode { if (state.MLP) { outmethod.println(" mlpInit();"); + + FlatSESEEnterNode rootSESE = mlpa.getRootSESE(); + + outmethod.println(" "); } MethodDescriptor md=typeutil.getMain(); @@ -1550,10 +1559,7 @@ public class BuildCode { 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(" }"); @@ -2269,12 +2275,26 @@ public class BuildCode { 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) { diff --git a/Robust/src/IR/Flat/FlatSESEEnterNode.java b/Robust/src/IR/Flat/FlatSESEEnterNode.java index 4d8968d4..524ea973 100644 --- a/Robust/src/IR/Flat/FlatSESEEnterNode.java +++ b/Robust/src/IR/Flat/FlatSESEEnterNode.java @@ -4,7 +4,11 @@ import IR.Tree.SESENode; 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; diff --git a/Robust/src/Runtime/mlp_runtime.c b/Robust/src/Runtime/mlp_runtime.c index 0a42e27d..a28fef89 100644 --- a/Robust/src/Runtime/mlp_runtime.c +++ b/Robust/src/Runtime/mlp_runtime.c @@ -1,19 +1,40 @@ #include #include +#include #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; } @@ -23,18 +44,21 @@ struct SESErecord* mlpGetCurrent() { 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) -*/ diff --git a/Robust/src/Runtime/mlp_runtime.h b/Robust/src/Runtime/mlp_runtime.h index 2830fd2c..d7f929af 100644 --- a/Robust/src/Runtime/mlp_runtime.h +++ b/Robust/src/Runtime/mlp_runtime.h @@ -2,6 +2,10 @@ #define __MLP_RUNTIME__ +#include +#include "Queue.h" + + // value mode means the variable's value // is present in the SESEvar struct #define SESEvar_MODE_VALUE 3001 @@ -27,14 +31,15 @@ struct SESEvar { // 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 @@ -65,16 +70,26 @@ struct SESErecord { // 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__ */ diff --git a/Robust/src/Tests/mlp/tinyTest/makefile b/Robust/src/Tests/mlp/tinyTest/makefile index 88d02d0e..aba20a39 100644 --- a/Robust/src/Tests/mlp/tinyTest/makefile +++ b/Robust/src/Tests/mlp/tinyTest/makefile @@ -3,8 +3,8 @@ PROGRAM=test 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 diff --git a/Robust/src/Tests/mlp/tinyTest/test.java b/Robust/src/Tests/mlp/tinyTest/test.java index 93a7a37d..b2883db6 100644 --- a/Robust/src/Tests/mlp/tinyTest/test.java +++ b/Robust/src/Tests/mlp/tinyTest/test.java @@ -1,32 +1,6 @@ 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; @@ -38,7 +12,7 @@ public class Test { } } - /* + /* ADD BACK IN LATER, TO TEST STALLS // shouldn't cause a stall int z = x; @@ -51,8 +25,12 @@ public class Test { 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 ); + } @@ -62,7 +40,9 @@ public class Test { //afunc( i ); } + /* public static void afunc( Integer i ) { i = null; } + */ } diff --git a/Robust/src/buildscript b/Robust/src/buildscript index 9236c4ab..020807fb 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -267,9 +267,11 @@ JAVAOPTS="$JAVAOPTS -dcopts" 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