public static String PREFIX="";
public static String arraytype="ArrayObject";
public static int flagcount = 0;
+ public boolean MLP=false;
Virtual virtualcalls;
TypeUtil typeutil;
protected int maxtaskparams=0;
this.backuptable=new Hashtable<TempDescriptor, TempDescriptor>();
this.reverttable=new Hashtable<LocalityBinding, TempDescriptor>();
}
+
+ this.MLP=st.MLP;
}
/** The buildCode method outputs C code for all the methods. The Flat
outmethodheader.println("#include \"abortreaders.h\"");
outmethodheader.println("#include <setjmp.h>");
}
+
/* Output Structures */
outputStructs(outstructs);
if (state.CONSCHECK) {
outmethod.println("#include \"checkers.h\"");
}
+ if (state.MLP) {
+ outmethod.println("#include \"mlp_runtime.h\"");
+ }
+
//Store the sizes of classes & array elements
generateSizeArray(outmethod);
-
//Store table of supertypes
generateSuperTypeTable(outmethod);
return;
case FKind.FlatSESEEnterNode:
- generateFlatSESEEnterNode(fm, lb, (FlatSESEEnterNode) fn, output);
+ if( MLP ) generateFlatSESEEnterNode(fm, lb, (FlatSESEEnterNode) fn, output);
return;
case FKind.FlatSESEExitNode:
- generateFlatSESEExitNode(fm, lb, (FlatSESEExitNode) fn, output);
+ if( MLP ) generateFlatSESEExitNode(fm, lb, (FlatSESEExitNode) fn, output);
return;
case FKind.FlatGlobalConvNode:
}
public void generateFlatSESEEnterNode(FlatMethod fm, LocalityBinding lb, FlatSESEEnterNode faen, PrintWriter output) {
-
+ output.println("mlpEnqueue( (struct SESE*)0 );");
}
public void generateFlatSESEExitNode(FlatMethod fm, LocalityBinding lb, FlatSESEExitNode faen, PrintWriter output) {
-
+ output.println("mlpNotifyExit( (struct SESE*)0 );");
}
private void generateFlatCheckNode(FlatMethod fm, LocalityBinding lb, FlatCheckNode fcn, PrintWriter output) {
public FlatSESEEnterNode( SESENode sn ) {
this.id=identifier++;
- treeNode = sn;
+ treeNode = sn;
}
public SESENode getTreeNode() {
return id;
}
+ public String getPrettyIdentifier() {
+ if( treeNode.getID() != null ) {
+ return treeNode.getID();
+ }
+ return ""+id;
+ }
+
public String toString() {
- return "sese "+id+" enter";
+ return "sese "+getPrettyIdentifier()+" enter";
}
public void setFlatExit( FlatSESEExitNode fsexn ) {
public String toString() {
assert enter != null;
- return "sese "+enter.getIdentifier()+" exit";
+ return "sese "+enter.getPrettyIdentifier()+" exit";
}
public int kind() {
public boolean THREAD=false;
public boolean CONSCHECK=false;
public boolean INSTRUCTIONFAILURE=false;
+ public boolean MLP=false;
public static double TRUEPROB=0.8;
public static boolean PRINTFLAT=false;
public static boolean PRINTSCHEDULING=false;
BlockNode body=parseSingleBlock(pn.getChild("statement").getFirstChild());
blockstatements.add(new LoopNode(condition,body,LoopNode.DOWHILELOOP));
} else if (isNode(pn,"sese")) {
- SESENode start=new SESENode();
- SESENode end =new SESENode();
+ ParseNode pnID=pn.getChild("identifier");
+ String stID=null;
+ if( pnID != null ) { stID=pnID.getFirstChild().getTerminal(); }
+ SESENode start=new SESENode(stID);
+ SESENode end =new SESENode(stID);
start.setEnd( end );
end.setStart( start );
blockstatements.add(start);
public class SESENode extends BlockStatementNode {
+ protected String id;
+
protected SESENode start;
protected SESENode end;
protected FlatSESEExitNode exit;
- public SESENode() {
+ public SESENode( String id ) {
+ this.id = id;
start = null;
end = null;
enter = null;
exit = null;
}
+ public String getID() {
+ return id;
+ }
public void setStart( SESENode n ) {
start = n;
state.INSTRUCTIONFAILURE=true;
else if (option.equals("-abcclose"))
state.ARRAYBOUNDARYCHECK=false;
+ else if (option.equals("-mlp"))
+ state.MLP=true;
else if (option.equals("-help")) {
System.out.println("-classlibrary classlibrarydirectory -- directory where classlibrary is located");
System.out.println("-selfloop task -- this task doesn't self loop its parameters forever");
System.out.println("-optional -- enable optional arguments");
System.out.println("-abcclose close the array boundary check");
System.out.println("-scheduling do task scheduling");
+ System.out.println("-mlp build mlp code");
System.out.println("-multicore generate multi-core version binary");
System.out.println("-numcore set the number of cores (should be used together with -multicore), defaultly set as 1");
System.out.println("-raw generate raw version binary (should be used together with -multicore)");
:}
;
sese_statement ::=
-
-// SESE variable_declarator_id:id LBRACE statement:st RBRACE {:
-
SESE block:blk {:
ParseNode pn = new ParseNode("sese");
-
-// pn.addChild("identifier").addChild(id);
-
pn.addChild("body").addChild(blk);
RESULT=pn;
:}
+ | SESE variable_declarator_id:id block:blk {:
+ ParseNode pn = new ParseNode("sese");
+ pn.addChild("body").addChild(blk);
+ pn.addChild("identifier").addChild(id);
+ RESULT=pn;
+ :}
;
//try_statement ::=
// TRY block catches
--- /dev/null
+#include <stdlib.h>
+#include <stdio.h>
+#include "mlp_runtime.h"
+
+
+struct SESE* root;
+
+
+void mlpIssue();
+
+
+struct SESE* mlpInit() {
+ return root;
+}
+
+
+void mlpEnqueue( struct SESE* sese ) {
+ printf( "mlp enqueue\n" );
+}
+
+void mlpBlock( struct SESE* sese ) {
+
+}
+
+void mlpNotifyExit( struct SESE* sese ) {
+ printf( "mlp notify exit\n" );
+}
+
+void mlpIssue() {
+
+}
--- /dev/null
+#ifndef __MLP_RUNTIME__
+#define __MLP_RUNTIME__
+
+struct SESE {
+
+};
+
+struct SESE* mlpInit();
+
+void mlpEnqueue ( struct SESE* sese );
+void mlpBlock ( struct SESE* sese );
+void mlpNotifyExit( struct SESE* sese );
+
+#endif /* __MLP_RUNTIME__ */
SOURCE_FILES=$(PROGRAM).java
BUILDSCRIPT=~/research/Robust/src/buildscript
-BSFLAGS= -mainclass Test -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions -flatirusermethods -ownaliasfile aliases.txt #-justanalyze -recover
+BSFLAGS= -mlp -mainclass Test -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions -flatirusermethods -ownaliasfile aliases.txt #-justanalyze -recover
all: $(PROGRAM).bin
int n = 10;
- sese {
-
+ sese s0 {
+
+ /*
int[] a = new int[n];
int[] b = new int[n];
int[] c = new int[n];
}
System.out.println( "total is "+total );
+ */
+
+ int x = n;
}
}
NOJAVA=false
CHECKFLAG=false
RECOVERFLAG=false
+MLPFLAG=false
MULTICOREFLAG=false
TRANSSTATSFLAG=false
RAWFLAG=false
elif [[ $1 = '-instructionfailures' ]]
then
JAVAOPTS="$JAVAOPTS -instructionfailures"
+elif [[ $1 = '-mlp' ]]
+then
+JAVAOPTS="$JAVAOPTS -mlp"
elif [[ $1 = '-check' ]]
then
CHECKFLAG=true
FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
fi
+if $MLP
+then
+FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
+fi
+
if $RECOVERFLAG
then
EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"