Added mlp runtime skeleton, flags to build it, syntax option to name sese blocks
authorjjenista <jjenista>
Tue, 31 Mar 2009 20:56:27 +0000 (20:56 +0000)
committerjjenista <jjenista>
Tue, 31 Mar 2009 20:56:27 +0000 (20:56 +0000)
13 files changed:
Robust/src/IR/Flat/BuildCode.java
Robust/src/IR/Flat/FlatSESEEnterNode.java
Robust/src/IR/Flat/FlatSESEExitNode.java
Robust/src/IR/State.java
Robust/src/IR/Tree/BuildIR.java
Robust/src/IR/Tree/SESENode.java
Robust/src/Main/Main.java
Robust/src/Parse/java14.cup
Robust/src/Runtime/mlp_runtime.c [new file with mode: 0644]
Robust/src/Runtime/mlp_runtime.h [new file with mode: 0644]
Robust/src/Tests/mlp/tinyTest/makefile
Robust/src/Tests/mlp/tinyTest/test.java
Robust/src/buildscript

index 6ef224b1ce6734228bc3e04af7ea83fa7fffb23b..4b4498856b48b3489fc3b0efd98782b6f7649800 100644 (file)
@@ -38,6 +38,7 @@ public class BuildCode {
   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;
@@ -74,6 +75,8 @@ public class BuildCode {
       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
@@ -128,6 +131,7 @@ public class BuildCode {
       outmethodheader.println("#include \"abortreaders.h\"");
       outmethodheader.println("#include <setjmp.h>");
     }
+
     /* Output Structures */
     outputStructs(outstructs);
 
@@ -347,10 +351,13 @@ public class BuildCode {
     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);
 
@@ -1515,11 +1522,11 @@ public class BuildCode {
       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:
@@ -1871,11 +1878,11 @@ public class BuildCode {
   }
 
   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) {
index a56d8972e1acb54a1fd82e1b39f0189f73ed8c0f..15a1606ff5933676e6b56babc1e2e94ba71306bf 100644 (file)
@@ -10,7 +10,7 @@ public class FlatSESEEnterNode extends FlatNode {
 
   public FlatSESEEnterNode( SESENode sn ) {
     this.id=identifier++;
-    treeNode = sn;
+    treeNode = sn;    
   }
 
   public SESENode getTreeNode() {
@@ -21,8 +21,15 @@ public class FlatSESEEnterNode extends FlatNode {
     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 ) {
index 7aa954f4164091bcdad6e64c721be065a48e4fa3..bcfd0451ff32b0f158bef59fb671486feba9a945 100644 (file)
@@ -24,7 +24,7 @@ public class FlatSESEExitNode extends FlatNode {
 
   public String toString() {
     assert enter != null;
-    return "sese "+enter.getIdentifier()+" exit";
+    return "sese "+enter.getPrettyIdentifier()+" exit";
   }
 
   public int kind() {
index 9cfe1633931d19a86271c84ff5afe46beabae677..9a911461379516eeae06138aeae2b87061bd1d6b 100644 (file)
@@ -72,6 +72,7 @@ public class State {
   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;
index 320f666379fdaf7013d7b78431c9f7c7af9cb809..5293f865966e5832f565bff97c965f27a70bfb17 100644 (file)
@@ -734,8 +734,11 @@ public class BuildIR {
       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);
index 64d0dfbb2a6e831c566d45f142f56ed573ffd3cd..423a331bb004bbea4c1cfa2cbef5ad6a9ba18765 100644 (file)
@@ -4,6 +4,8 @@ import IR.Flat.FlatSESEExitNode;
 
 public class SESENode extends BlockStatementNode {
 
+  protected String id;
+
   protected SESENode start;
   protected SESENode end;
 
@@ -11,13 +13,17 @@ public class SESENode extends BlockStatementNode {
   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;
index f913eebc246aa2133d899bc07d09b95eaf2856d0..0430dd0ef6c1a13a9da35e5fb76c34b23099b159 100644 (file)
@@ -145,6 +145,8 @@ public class Main {
        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");
@@ -173,6 +175,7 @@ public class Main {
        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)");
index 299a5e9b21a505456f398cfaefa7ba01db2e8073..4ddaac5629c73ef8ec6cc7d3b3dca0f0363aa7dd 100644 (file)
@@ -1369,17 +1369,17 @@ atomic_statement ::=
        :}
        ;
 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
diff --git a/Robust/src/Runtime/mlp_runtime.c b/Robust/src/Runtime/mlp_runtime.c
new file mode 100644 (file)
index 0000000..eae0383
--- /dev/null
@@ -0,0 +1,31 @@
+#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() {
+
+}
diff --git a/Robust/src/Runtime/mlp_runtime.h b/Robust/src/Runtime/mlp_runtime.h
new file mode 100644 (file)
index 0000000..85e6b9b
--- /dev/null
@@ -0,0 +1,14 @@
+#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__ */
index 335dd500bf4811585b43294a2c32cee2be760bce..402bc180fc862a31c8f634ae348342d49fecdbb6 100644 (file)
@@ -3,7 +3,7 @@ PROGRAM=test
 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
 
index 81be3a43d6be8b89d4e128317484815c2c4ec1cf..e75fa8989fe51a6f0439cc42cc2479332961fc55 100644 (file)
@@ -4,8 +4,9 @@ public class Test {
 
     int n = 10;
 
-    sese {
-
+    sese s0 {
+      
+      /*
       int[] a = new int[n];
       int[] b = new int[n];
       int[] c = new int[n];
@@ -31,6 +32,9 @@ public class Test {
       }
 
       System.out.println( "total is "+total );
+      */
+
+      int x = n;
     }
 
   }
index e740a42e567cf8e108d06fcd99e6bc36d0bec294..b07b34855b6f756d438dc080fb40ba6e5cc5ea45 100755 (executable)
@@ -60,6 +60,7 @@ DSMFLAG=false
 NOJAVA=false
 CHECKFLAG=false
 RECOVERFLAG=false
+MLPFLAG=false
 MULTICOREFLAG=false
 TRANSSTATSFLAG=false
 RAWFLAG=false
@@ -215,6 +216,9 @@ JAVAOPTS="$JAVAOPTS -webinterface"
 elif [[ $1 = '-instructionfailures' ]]
 then
 JAVAOPTS="$JAVAOPTS -instructionfailures"
+elif [[ $1 = '-mlp' ]]
+then
+JAVAOPTS="$JAVAOPTS -mlp"
 elif [[ $1 = '-check' ]]
 then
 CHECKFLAG=true
@@ -475,6 +479,11 @@ then
 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
 fi
 
+if $MLP
+then
+FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
+fi
+
 if $RECOVERFLAG
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"