missing commit for specifying output dir for simulation result
[IRC.git] / Robust / src / buildscript
index 5f2a4a8b5364916625d5ab40ac91e26a9017c077..50f305fdd73490a8fef17e7db2836c6c064a92a5 100755 (executable)
@@ -3,12 +3,14 @@
 printhelp() {
 echo -robustroot set up the ROBUSTROOT to directory other than default one
 echo -dsm distributed shared memory
+echo -abortreaders abort readers immediately
 echo -trueprob double - probabiltiy of true branch
 echo -dsmcaching -enable caching in dsm runtime
 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
@@ -19,11 +21,14 @@ echo -scheduling do task scheduling
 echo -multicore generate multi-core version binary
 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
 echo "-raw generate raw version binary (should be used together with -multicore)"
+echo "-rawcacheflush enable cache flush in raw version binary (should be used togethere with -raw)"
 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
 echo "-rawpath print out execute path information for raw version (should be used together with -raw)"
 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
 echo -threadsimulate generate multi-thread simulate version binary
+echo -printscheduling print out scheduling graphs
+echo -printschedulesim print out scheduling simulator result graphs
 echo -optional enable optional
 echo -debug generate debug symbols
 echo -prefetch do prefetch analysis
@@ -41,9 +46,11 @@ echo -instructionfailures inject code for instructionfailures
 echo -profile build with profile options
 echo "-rawuseio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
 echo "-enable-assertions execute assert statements during compilation"
+echo -justanalyze exit after compiler analyses complete
 echo -help help
 }
 
+ABORTREADERS=false;
 ROBUSTROOT=~/research/Robust/src
 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
 REPAIRROOT=~/research/Repair/RepairCompiler/
@@ -55,6 +62,7 @@ RECOVERFLAG=false
 MULTICOREFLAG=false
 TRANSSTATSFLAG=false
 RAWFLAG=false
+RAWCACHEFLUSHFLAG=false
 RAWCONFIG=''
 RAWDEBUGFLAG=false
 RAWPATHFLAG=false
@@ -64,6 +72,7 @@ INTERRUPTFLAG=false
 THREADSIMULATEFLAG=false;
 USEDMALLOC=false
 THREADFLAG=false
+FASTCHECK=false
 SPECDIR=`pwd`
 SRCFILES=''
 EXTRAOPTIONS=''
@@ -71,6 +80,7 @@ MAINFILE='a'
 JAVAFORWARDOPTS=''
 JAVAOPTS=''
 OPTIONALFLAG=false
+EXITAFTERANALYSIS=false
 
 if [[ -z $1 ]]
 then
@@ -84,6 +94,14 @@ if [[ $1 = '-help' ]]
 then
 printhelp
 exit
+elif [[ $1 = '-justanalyze' ]]
+then
+EXITAFTERANALYSIS=true
+elif [[ $1 = '-abortreaders' ]]
+then
+ABORTREADERS=true
+EXTRAOPTIONS="$EXTRAOPTIONS -DABORTREADERS"
+JAVAOPTS="$JAVAOPTS -abortreaders"
 elif [[ $1 = '-robustroot' ]]
 then
 ROBUSTROOT="$2"
@@ -91,6 +109,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"
@@ -155,6 +178,9 @@ elif [[ $1 = '-raw' ]]
 then
 RAWFLAG=true
 JAVAOPTS="$JAVAOPTS -raw"
+elif [[ $1 = '-rawcacheflush' ]]
+then
+RAWCACHEFLUSHFLAG=true
 elif [[ $1 = '-rawconfig' ]]
 then
 RAWCONFIG="$2"
@@ -207,10 +233,13 @@ then
 RAWPATHFLAG=true
 elif [[ $1 = '-runtimedebug' ]]
 then
-EXTRAOPTIONS="$EXTRAOPTIONS -DCHECKTA"
+EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
 elif [[ $1 = '-dsmcaching' ]]
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
+elif [[ $1 = '-rangeprefetch' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
 elif [[ $1 = '-nooptimize' ]]
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
@@ -226,6 +255,10 @@ elif [[ $1 = '-curdir' ]]
 then
 CURDIR=$2
 shift
+elif [[ $1 = '-outputdir' ]]
+then
+JAVAOPTS="$JAVAOPTS -outputdir $2"
+shift
 else
 SRCFILES="$SRCFILES $1"
 fi
@@ -245,27 +278,57 @@ then
 JAVAOPTS="$JAVAOPTS -struct structfile"
 fi
 
+# Setup class path
+
+if $RECOVERFLAG
+then
+if $FASTCHECK
+then
+#fast transactions
+JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
+fi
+#base bristlecone files
+JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
+else
+if $DSMFLAG
+then
+#dsm stuff
+JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
+elif $THREADFLAG
+then
+#threading java stuff
+JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
+fi
+#base java stuff
+JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
+fi
+
 # Build bristlecone/java sources
 
 if $MULTICOREFLAG
 then
-if ! java $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
-$ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR \
-$JAVAOPTS $SRCFILES
+if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx800m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
+$ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
+-dir $BUILDDIR $JAVAOPTS $SRCFILES
 then exit $?
 fi
 else
-#if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
+#if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
 if ! $NOJAVA
 then
-if ! java -Xms50m -Xmx600m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
-$ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \
+if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx600m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
+$ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
 $JAVAOPTS $SRCFILES
 then exit $?
 fi
 fi
 fi
 
+if $EXITAFTERANALYSIS
+then
+exit
+fi
+
 # Build all of the consistency specs
 
 if $CHECKFLAG # CHECKFLAG
@@ -315,6 +378,11 @@ rm ./*
 
 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
 
+if $RAWCACHEFLUSHFLAG
+then # print path
+RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWCACHEFLUSH"
+fi
+
 if $RAWPATHFLAG
 then # print path
 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
@@ -337,11 +405,16 @@ fi
 
 if $INTERRUPTFLAG
 then #INTERRUPT version
-MAKEFILE="$MAKEFILE.i"
 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
 fi #INTERRUPT version
 
+if $RAWUSEIOFLAG
+then # useio version
+MAKEFILE="$MAKEFILE.io"
+echo "+++++++++++use Makefile.raw.io++++++++++++++++"
+else
 MAKEFILE="$MAKEFILE.$RAWCONFIG"
+fi #useio version
 
 cp $MAKEFILE ./Makefile
 cp ../Runtime/*.c ./
@@ -381,7 +454,17 @@ 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"
+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 $ABORTREADERS
+then
+FILES="$FILES $DSMRUNTIME/abortreaders.c"
+fi
+
+if $FASTCHECK
+then
+FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
 fi
 
 if $RECOVERFLAG