From 4a53d192a550651e1d2423636998bb4472ceb0cf Mon Sep 17 00:00:00 2001 From: bdemsky Date: Wed, 1 Nov 2006 21:44:28 +0000 Subject: [PATCH] 1) Bug fix 2) Debug flag for tasks...has the compiler insert task enter/exit messages --- Robust/src/IR/Flat/BuildCode.java | 9 +++++++++ Robust/src/IR/Flat/BuildFlat.java | 4 +++- Robust/src/IR/State.java | 1 + Robust/src/Main/Main.java | 2 ++ Robust/src/buildscripttaskdebug | 8 ++++++++ 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 Robust/src/buildscripttaskdebug diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index e2f9a9e2..809fd147 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -848,6 +848,8 @@ public class BuildCode { } } } + if (task!=null&&state.TASKDEBUG) + output.println("printf(\"ENTER "+task.getSymbol()+"\\n\");"); //Do the actual code generation tovisit=new HashSet(); @@ -865,6 +867,8 @@ public class BuildCode { output.print(" "); generateFlatNode(fm, current_node, output); if (current_node.kind()!=FKind.FlatReturnNode) { + if (task!=null&&state.TASKDEBUG) + output.println("printf(\"EXIT "+task.getSymbol()+"\\n\");"); output.println(" return;"); } current_node=null; @@ -890,6 +894,8 @@ public class BuildCode { current_node=current_node.getNext(0); } else throw new Error(); } + + output.println("}\n\n"); } @@ -1191,6 +1197,9 @@ public class BuildCode { } private void generateFlatReturnNode(FlatMethod fm, FlatReturnNode frn, PrintWriter output) { + + if (fm.getTask()!=null&&state.TASKDEBUG) + output.println("printf(\"EXIT "+fm.getTask().getSymbol()+"\\n\");"); if (frn.getReturnTemp()!=null) output.println("return "+generateTemp(fm, frn.getReturnTemp())+";"); else diff --git a/Robust/src/IR/Flat/BuildFlat.java b/Robust/src/IR/Flat/BuildFlat.java index 17e988f2..dde06ea4 100644 --- a/Robust/src/IR/Flat/BuildFlat.java +++ b/Robust/src/IR/Flat/BuildFlat.java @@ -737,7 +737,9 @@ public class BuildFlat { updateFlagActionNode(ffan, ten.getFlagEffects()); NodePair fcn=flattenConstraintCheck(ten.getChecks()); ffan.addNext(fcn.getBegin()); - return new NodePair(ffan, fcn.getEnd()); + FlatReturnNode rnflat=new FlatReturnNode(null); + fcn.getEnd().addNext(rnflat); + return new NodePair(ffan, rnflat); } private NodePair flattenConstraintCheck(Vector ccs) { diff --git a/Robust/src/IR/State.java b/Robust/src/IR/State.java index a40ed70d..4797a6be 100644 --- a/Robust/src/IR/State.java +++ b/Robust/src/IR/State.java @@ -22,6 +22,7 @@ public class State { /** Boolean flag which indicates whether compiler is compiling a task-based * program. */ public boolean TASK; + public boolean TASKDEBUG; public String structfile; public String main; public boolean CONSCHECK=false; diff --git a/Robust/src/Main/Main.java b/Robust/src/Main/Main.java index 75487a3f..9ccb839e 100644 --- a/Robust/src/Main/Main.java +++ b/Robust/src/Main/Main.java @@ -33,6 +33,8 @@ public class Main { state.CONSCHECK=true; else if (option.equals("-task")) state.TASK=true; + else if (option.equals("-taskdebug")) + state.TASKDEBUG=true; else if (option.equals("-help")) { System.out.println("-classlibrary classlibrarydirectory -- directory where classlibrary is located"); System.out.println("-dir outputdirectory -- output code in outputdirectory"); diff --git a/Robust/src/buildscripttaskdebug b/Robust/src/buildscripttaskdebug new file mode 100755 index 00000000..ab704ab5 --- /dev/null +++ b/Robust/src/buildscripttaskdebug @@ -0,0 +1,8 @@ +#!/bin/bash +ROBUSTROOT=~/research/Robust/src +MAINFILE=$1 +shift +mkdir tmpbuilddirectory +java -cp $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary $ROBUSTROOT/ClassLibrary/ -dir tmpbuilddirectory -struct $MAINFILE -task -taskdebug $@ +#gcc -I$ROBUSTROOT/Runtime -Itmpbuilddirectory -O0 -DTASK -g tmpbuilddirectory/methods.c tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/Queue.c $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/GenericHashtable.c -o $MAINFILE.bin +gcc -I$ROBUSTROOT/Runtime -I. -IRuntime/include -Itmpbuilddirectory -O0 -DBOEHM_GC -LRuntime/lib/ -lgc -DTASK -DDEBUG -g tmpbuilddirectory/methods.c tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/GenericHashtable.c -o $MAINFILE.bin \ No newline at end of file -- 2.34.1