From f1565a6669aeb529c63ba077ac7c0414e335f1d7 Mon Sep 17 00:00:00 2001
From: jjenista <jjenista>
Date: Tue, 26 May 2009 20:55:08 +0000
Subject: [PATCH] Stable compile, seg fault in MLP mode.

---
 Robust/src/IR/Flat/BuildCode.java      | 22 ++++++++++++++++++++--
 Robust/src/Tests/mlp/tinyTest/makefile |  4 ++--
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java
index a58b3622..93b2228f 100644
--- a/Robust/src/IR/Flat/BuildCode.java
+++ b/Robust/src/IR/Flat/BuildCode.java
@@ -1777,6 +1777,7 @@ public class BuildCode {
 	FlatNode nextnode;
 	if (state.MLP && current_node.kind()==FKind.FlatSESEEnterNode) {
 	  FlatSESEEnterNode fsen = (FlatSESEEnterNode)current_node;
+	  generateFlatNode(fm, lb, current_node, output);
 	  nextnode=fsen.getFlatExit().getNext(0);
 	} else {
 	  output.print("   ");
@@ -1886,9 +1887,11 @@ public class BuildCode {
       return;
 
     case FKind.FlatSESEEnterNode:
+      generateFlatSESEEnterNode(fm, lb, (FlatSESEEnterNode)fn, output);
       return;
 
     case FKind.FlatSESEExitNode:
+      generateFlatSESEExitNode(fm, lb, (FlatSESEExitNode)fn, output);
       return;
 
     case FKind.FlatGlobalConvNode:
@@ -2265,10 +2268,25 @@ public class BuildCode {
     output.println("}");
   }
 
-  public void generateFlatSESEEnterNode(FlatMethod fm,  LocalityBinding lb, FlatSESEEnterNode faen, PrintWriter output) {
+  public void generateFlatSESEEnterNode(FlatMethod fm,  LocalityBinding lb, FlatSESEEnterNode fsen, PrintWriter output) {
+    if( !state.MLP ) {
+      // SESE nodes can be parsed for normal compilation, just skip over them
+      return;
+    }
+    
+    output.println("  invokeSESEmethod("+
+                   fsen.getIdentifier()+", "+
+                   "malloc( sizeof( struct SESErecord ) ), "+
+                   "NULL"+
+                   ");"
+                   );
   }
 
-  public void generateFlatSESEExitNode(FlatMethod fm,  LocalityBinding lb, FlatSESEExitNode faen, PrintWriter output) {
+  public void generateFlatSESEExitNode(FlatMethod fm,  LocalityBinding lb, FlatSESEExitNode fsen, PrintWriter output) {
+    if( !state.MLP ) {
+      // SESE nodes can be parsed for normal compilation, just skip over them
+      return;
+    }
   }
 
   private void generateFlatCheckNode(FlatMethod fm,  LocalityBinding lb, FlatCheckNode fcn, PrintWriter output) {
diff --git a/Robust/src/Tests/mlp/tinyTest/makefile b/Robust/src/Tests/mlp/tinyTest/makefile
index 4c4a7a8c..88d02d0e 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  -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
-- 
2.34.1