changes
authorbdemsky <bdemsky>
Mon, 2 Feb 2009 09:31:03 +0000 (09:31 +0000)
committerbdemsky <bdemsky>
Mon, 2 Feb 2009 09:31:03 +0000 (09:31 +0000)
Robust/src/IR/Flat/BuildCode.java
Robust/src/IR/State.java
Robust/src/Main/Main.java
Robust/src/buildscript

index 44c0a6e8a6be66761f913acd51f6fab9b0acdadd..c1e4b6b8fe6463c105df4a4c2f6dc8ea0fafb26e 100644 (file)
@@ -29,6 +29,7 @@ public class BuildCode {
   Hashtable flagorder;
   int tag=0;
   String localsprefix="___locals___";
+  String fcrevert="___fcrevert___";
   String paramsprefix="___params___";
   String oidstr="___nextobject___";
   String nextobjstr="___nextobject___";
@@ -328,6 +329,9 @@ public class BuildCode {
       outmethod.println("#include \"addPrefetchEnhance.h\"");
       outmethod.println("#include \"localobjects.h\"");
     }
+    if (state.FASTCHECK) {
+      outmethod.println("#include \"localobjects.h\"");      
+    }
     if(state.MULTICORE) {
       outmethod.println("#include \"task.h\"");
     }
@@ -2071,6 +2075,18 @@ public class BuildCode {
        output.println("}");
       }
     } else {
+      if (state.FASTCHECK) {
+       String dst=generateTemp(fm, fsfn.getDst(),lb);
+       output.println("if(!"+dst+"->"+localcopystr+") {");
+       /* Link object into list */
+       if (GENERATEPRECISEGC)
+         output.println("COPY_OBJ((struct garbagelist *)&"+localsprefix+",(struct ___Object___ *)"+dst+");");
+       else
+         output.println("COPY_OBJ("+dst+");");
+       output.println(dst+"->"+nextobjstr+"="+fcrevert+";");
+       output.println(fcrevert+"=(struct ___Object___ *)"+dst+";");
+       output.println("}");
+      }
       output.println(generateTemp(fm, fsfn.getDst(),lb)+"->"+ fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc(),lb)+";");
     }
   }
@@ -2167,8 +2183,21 @@ public class BuildCode {
       } else {
        output.println("(("+type +"*)(((char *) &("+ generateTemp(fm,fsen.getDst(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fsen.getIndex(),lb)+"]="+generateTemp(fm,fsen.getSrc(),lb)+";");
       }
-    } else
+    } else {
+      if (state.FASTCHECK) {
+       String dst=generateTemp(fm, fsen.getDst(),lb);
+       output.println("if(!"+dst+"->"+localcopystr+") {");
+       /* Link object into list */
+       if (GENERATEPRECISEGC)
+         output.println("COPY_OBJ((struct garbagelist *)&"+localsprefix+",(struct ___Object___ *)"+dst+");");
+       else
+         output.println("COPY_OBJ("+dst+");");
+       output.println(dst+"->"+nextobjstr+"="+fcrevert+";");
+       output.println(fcrevert+"=(struct ___Object___ *)"+dst+";");
+       output.println("}");
+      }
       output.println("(("+type +"*)(((char *) &("+ generateTemp(fm,fsen.getDst(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fsen.getIndex(),lb)+"]="+generateTemp(fm,fsen.getSrc(),lb)+";");
+    }
   }
 
   protected void generateFlatNew(FlatMethod fm, LocalityBinding lb, FlatNew fn, PrintWriter output) {
@@ -2198,10 +2227,16 @@ public class BuildCode {
     if (state.DSM && locality.getAtomic(lb).get(fn).intValue()>0&&!fn.isGlobal()) {
       String revertptr=generateTemp(fm, reverttable.get(lb),lb);
       String dst=generateTemp(fm,fn.getDst(),lb);
-      output.println(dst+"->___localcopy___=1;");
+      output.println(dst+"->___localcopy___=(struct ___Object___*)1;");
       output.println(dst+"->"+nextobjstr+"="+revertptr+";");
       output.println("trans->revertlist=(struct ___Object___ *)"+dst+";");
     }
+    if (state.FASTCHECK) {
+      String dst=generateTemp(fm,fn.getDst(),lb);
+      output.println(dst+"->___localcopy___=(struct ___Object___*)1;");
+      output.println(dst+"->"+nextobjstr+"="+fcrevert+";");
+      output.println(fcrevert+"=(struct ___Object___ *)"+dst+";");
+    }
   }
 
   private void generateFlatTagDeclaration(FlatMethod fm, LocalityBinding lb, FlatTagDeclaration fn, PrintWriter output) {
index 42c5bcd9aa20779a2463bb676f1ab88cc3d1d4a5..5ceca0f87adce4f8333e1456e49eb49c2138cb85 100644 (file)
@@ -45,6 +45,7 @@ public class State {
    * program. */
   public boolean WEBINTERFACE=false;
   public boolean TASK=false;
+  public boolean FASTCHECK=false;
   public boolean DSM=false;
   public boolean PREFETCH=false;
   public boolean TASKSTATE=false;
index 3867b70d9a9393b43b0143af397dd284bbd8e8cb..93c8cb073e759f3e63b0e93b55b04f248256b4cb 100644 (file)
@@ -60,6 +60,8 @@ public class Main {
        state.PREFETCH=true;
       else if (option.equals("-dir"))
        IR.Flat.BuildCode.PREFIX=args[++i]+"/";
+      else if (option.equals("-fastcheck"))
+       state.FASTCHECK=true;
       else if (option.equals("-selfloop"))
        state.selfloops.add(args[++i]);
       else if (option.equals("-excprefetch"))
@@ -137,6 +139,7 @@ public class Main {
        System.out.println("-precise -- use precise garbage collection");
        System.out.println("-conscheck -- turn on consistency checking");
        System.out.println("-task -- compiler for tasks");
+       System.out.println("-fastcheck -- fastcheckpointing for Bristlecone");
        System.out.println("-thread -- threads");
        System.out.println("-trueprob <d> -- probability of true branch");
        System.out.println("-printflat -- print out flat representation");
@@ -202,7 +205,10 @@ public class Main {
     readSourceFile(state, ClassLibraryPrefix+"Date.java");
 
     if (state.TASK) {
-      readSourceFile(state, ClassLibraryPrefix+"Object.java");
+      if (state.FASTCHECK)
+       readSourceFile(state, ClassLibraryPrefix+"ObjectFC.java");
+      else
+       readSourceFile(state, ClassLibraryPrefix+"Object.java");
       readSourceFile(state, ClassLibraryPrefix+"TagDescriptor.java");
     } else if (state.DSM) {
       readSourceFile(state, ClassLibraryPrefix+"ThreadDSM.java");
index b9a22578c18539634abee3b99873994258337d88..788332a480ed192e633be414fe82b60d416afee0 100755 (executable)
@@ -9,6 +9,7 @@ echo -mac distributed shared memory mac support
 echo -check generate check code
 echo -dmalloc link in dmalloc
 echo -recover compile task code
+echo -fastcheck fast checkpointing for Bristlecone
 echo -specdir directory
 echo -printflat print out flat representation
 echo -selfloop task - this task cannot self loop forever
@@ -68,6 +69,7 @@ INTERRUPTFLAG=false
 THREADSIMULATEFLAG=false;
 USEDMALLOC=false
 THREADFLAG=false
+FASTCHECK=false
 SPECDIR=`pwd`
 SRCFILES=''
 EXTRAOPTIONS=''
@@ -95,6 +97,11 @@ shift
 elif [[ $1 = '-nojava' ]]
 then
 NOJAVA=true
+elif [[ $1 = '-fastcheck' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
+JAVAOPTS="$JAVAOPTS -fastcheck"
+FASTCHECK=true
 elif [[ $1 = '-o' ]]
 then
 MAINFILE="$2"
@@ -401,7 +408,12 @@ if $TRANSSTATSFLAG
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DTRANSSTATS -DCOMPILER -DDSTM -I$DSMRUNTIME"
 fi
-FILES="$FILES $DSMRUNTIME/trans.c $DSMRUNTIME/mcpileq.c $DSMRUNTIME/objstr.c $DSMRUNTIME/dstm.c $DSMRUNTIME/mlookup.c $DSMRUNTIME/clookup.c $DSMRUNTIME/llookup.c $DSMRUNTIME/threadnotify.c $DSMRUNTIME/dstmserver.c $DSMRUNTIME/plookup.c $DSMRUNTIME/ip.c $DSMRUNTIME/queue.c $DSMRUNTIME/prelookup.c $DSMRUNTIME/machinepile.c $DSMRUNTIME/localobjects.c $ROBUSTROOT/Runtime/thread.c $DSMRUNTIME/sockpool.c $DSMRUNTIME/addUdpEnhance.c $DSMRUNTIME/signal.c $DSMRUNTIME/gCollect.c $DSMRUNTIME/addPrefetchEnhance.c $DSMRUNTIME/dsmlock.c $DSMRUNTIME/prefetch.c"
+FILES="$FILES $DSMRUNTIME/trans.c $DSMRUNTIME/mcpileq.c $DSMRUNTIME/objstr.c $DSMRUNTIME/dstm.c $DSMRUNTIME/mlookup.c $DSMRUNTIME/clookup.c $DSMRUNTIME/llookup.c $DSMRUNTIME/threadnotify.c $DSMRUNTIME/dstmserver.c $DSMRUNTIME/plookup.c $DSMRUNTIME/ip.c $DSMRUNTIME/queue.c $DSMRUNTIME/prelookup.c $DSMRUNTIME/machinepile.c $ROBUSTROOT/Runtime/localobjects.c $ROBUSTROOT/Runtime/thread.c $DSMRUNTIME/sockpool.c $DSMRUNTIME/addUdpEnhance.c $DSMRUNTIME/signal.c $DSMRUNTIME/gCollect.c $DSMRUNTIME/addPrefetchEnhance.c $DSMRUNTIME/dsmlock.c $DSMRUNTIME/prefetch.c"
+fi
+
+if $FASTCHECK
+then
+FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
 fi
 
 if $RECOVERFLAG