Stable, not functional. Builds a switch case for unique SESE class invocation, inclu...
authorjjenista <jjenista>
Tue, 26 May 2009 18:23:53 +0000 (18:23 +0000)
committerjjenista <jjenista>
Tue, 26 May 2009 18:23:53 +0000 (18:23 +0000)
Robust/src/Analysis/MLP/MLPAnalysis.java
Robust/src/IR/Flat/BuildCode.java
Robust/src/Runtime/mlp_runtime.c
Robust/src/Runtime/mlp_runtime.h

index 74edb3fe10387e530d2ba24df533e50f38e75d8c..1848d470889da562caeb06d55573e385cff91273 100644 (file)
@@ -142,7 +142,7 @@ public class MLPAnalysis {
       //System.out.println( fmMain.printMethod( livenessRootView ) );
       //System.out.println( fmMain.printMethod( variableResults ) );
       //System.out.println( fmMain.printMethod( notAvailableResults ) );
-      System.out.println( "CODE PLANS\n"+fmMain.printMethod( codePlans ) );
+      //System.out.println( "CODE PLANS\n"+fmMain.printMethod( codePlans ) );
     }
 
 
index e02ff92fbd51c73ddc1c061b06e7faf57468eaa4..a58b3622bc33ce13f472cbcf814a36bfa221f55e 100644 (file)
@@ -290,6 +290,9 @@ public class BuildCode {
       outmethod.println("    ((void **)(((char *)& stringarray->___length___)+sizeof(int)))[i-1]=newstring;");
     outmethod.println("  }");
 
+    if (state.MLP) {
+      outmethod.println("  mlpInit();");
+    }
 
     MethodDescriptor md=typeutil.getMain();
     ClassDescriptor cd=typeutil.getMainClass();
@@ -354,7 +357,6 @@ public class BuildCode {
       outmethod.println("pthread_exit(NULL);");
 
     outmethod.println("}");
-
   }
 
   /* This method outputs code for each task. */
@@ -1511,8 +1513,15 @@ public class BuildCode {
                                             PrintWriter outmethod
                                             ) {
 
-    outmethodheader.println("void invokeSESEmethod( int classID, struct SESErecord* record );");
-    outmethod.println(      "void invokeSESEmethod( int classID, struct SESErecord* record ) {");
+    outmethodheader.println("void invokeSESEmethod( int classID, struct SESErecord* invokee, struct SESErecord* parent );");
+    outmethod.println(      "void invokeSESEmethod( int classID, struct SESErecord* invokee, struct SESErecord* parent ) {");
+
+    // use this info in the invocation cases to decide whether
+    // to gather SESE variables from a parent SESE record, or
+    // if parent is root, from noraml temps
+    outmethod.println(      "  char parentIsRoot = (parent == NULL);");
+
+    // generate a case for each SESE class that can be invoked
     outmethod.println(      "  switch( classID ) {");
     outmethod.println(      "    ");
     for(Iterator<FlatSESEEnterNode> seseit=mlpa.getAllSESEs().iterator();seseit.hasNext();) {
@@ -1523,6 +1532,8 @@ public class BuildCode {
       outmethod.println(    "      break;");
       outmethod.println(    "");
     }
+
+    // default case should never be taken, error out
     outmethod.println(      "    default:");
     outmethod.println(      "      printf(\"Error: unknown SESE class ID in invoke method.\\n\");");
     outmethod.println(      "      exit(-30);");
@@ -1544,7 +1555,12 @@ 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("        ");
+    output.println("      }");
 
     // then invoke the sese's method
     output.print("      "+cn.getSafeSymbol()+bogusmd.getSafeSymbol()+"_"+bogusmd.getSafeMethodDescriptor());
@@ -1552,15 +1568,17 @@ public class BuildCode {
 
     // why doesn't this work?
     //output.print("("+cn.getSafeSymbol()+bogusmd.getSafeSymbol()+"_"+bogusmd.getSafeMethodDescriptor()+paramsprefix+")");
-    output.print("(struct "+cn.getSafeSymbol()+bogusmd.getSafeSymbol()+"__params*)");
 
-    output.print("&(record->paramStruct)");
+    // first argument is parameter structure
+    output.print("(struct "+cn.getSafeSymbol()+bogusmd.getSafeSymbol()+"__params*)");
+    output.print("&(invokee->paramStruct)");
 
+    // other arguments are primitive parameters
     for(int i=0; i<objectparams.numPrimitives(); i++) {
       TempDescriptor td=objectparams.getPrimitive(i);
       TypeDescriptor type=td.getType();
       assert type.isPrimitive();
-      output.print(", record->vars["+i+"].sesetype_"+type.toString());
+      output.print(", invokee->vars["+i+"].sesetype_"+type.toString());
     }
     
     output.println(");");
index 57604a9834a11a9da124c268f9142bc4fa0caa45..0a42e27df20a67f237baf7fdcb9d768b590bff7a 100644 (file)
@@ -4,11 +4,21 @@
 #include "Queue.h"
 
 
-struct Queue* issued;
+static struct Queue* issued;
+
+
+// each core should have a current SESE
+static struct SESErecord* current;
 
 
 void mlpInit() {
-  issued = createQueue();
+  issued  = createQueue();
+  current = NULL;
+}
+
+
+struct SESErecord* mlpGetCurrent() {
+  return current;
 }
 
 
index 5480ad2f0567bd2a62360e21ef49ec5738bcbf42..2830fd2c8b089729747c148cf507e1bd7e2bbadc 100644 (file)
@@ -39,6 +39,9 @@ struct SESEvar {
   
   // a statically or dynamically known SESE
   // to gather the variable's value from
+  // if source==NULL it indicates the root
+  // SESE, which has no record, just normal
+  // temp names
   struct SESErecord* source;
   unsigned int index;
 };
@@ -67,6 +70,8 @@ struct SESErecord {
 
 void mlpInit();
 
+struct SESErecord* mlpGetCurrent();
+
 void mlpIssue     ( struct SESErecord* sese );
 void mlpStall     ( struct SESErecord* sese );
 void mlpNotifyExit( struct SESErecord* sese );