added dsmdebug file for debugging using macros and setting flags in buildscript
[IRC.git] / Robust / src / buildscript
index f0140385447c82b405a247c7319bbee2baf5d5de..a9bea668513c68dc57fbc592535380601d3f2ff7 100755 (executable)
@@ -18,10 +18,13 @@ 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 "-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 -threadsimulate generate multi-thread simulate version binary
 echo -optional enable optional
 echo -debug generate debug symbols
 echo -prefetch do prefetch analysis
+echo -transstats generates transaction stats on commits and aborts
 echo -webinterface enable web interface
 echo -runtimedebug printout runtime debug messages
 echo "-thread use support for multiple threads"
@@ -30,6 +33,7 @@ echo "-nooptimize call gcc with -O0 (do not optimize)"
 echo -curdir directory 
 echo -mainclass class with main method
 echo -o binary
+echo -nojava do not run bristlecone compiler
 echo -instructionfailures inject code for instructionfailures
 echo -profile build with profile options
 echo "-enable-assertions execute assert statements during compilation"
@@ -41,10 +45,15 @@ DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
 REPAIRROOT=~/research/Repair/RepairCompiler/
 CURDIR=`pwd`
 DSMFLAG=false
+NOJAVA=false
 CHECKFLAG=false
 RECOVERFLAG=false
 MULTICOREFLAG=false
+TRANSSTATSFLAG=false
 RAWFLAG=false
+RAWCONFIG=''
+RAWDEBUGFLAG=false
+INTERRUPTFLAG=false
 THREADSIMULATEFLAG=false;
 USEDMALLOC=false
 THREADFLAG=false
@@ -72,6 +81,9 @@ elif [[ $1 = '-robustroot' ]]
 then
 ROBUSTROOT="$2"
 shift
+elif [[ $1 = '-nojava' ]]
+then
+NOJAVA=true
 elif [[ $1 = '-o' ]]
 then
 MAINFILE="$2"
@@ -95,6 +107,9 @@ DSMFLAG=true
 elif [[ $1 = '-prefetch' ]]
 then
 JAVAOPTS="$JAVAOPTS -prefetch"
+elif [[ $1 = '-transstats' ]]
+then
+TRANSSTATSFLAG=true
 elif [[ $1 = '-printflat' ]]
 then
 JAVAOPTS="$JAVAOPTS -printflat"
@@ -128,7 +143,14 @@ shift
 elif [[ $1 = '-raw' ]]
 then
 RAWFLAG=true
-#JAVAOPTS="$JAVAOPTS -raw"
+JAVAOPTS="$JAVAOPTS -raw"
+elif [[ $1 = '-rawconfig' ]]
+then
+RAWCONFIG="$2"
+shift
+elif [[ $1 = '-interrupt' ]]
+then
+INTERRUPTFLAG=true
 elif [[ $1 = '-threadsimulate' ]]
 then
 THREADSIMULATEFLAG=true
@@ -164,10 +186,12 @@ cd $CURDIR
 shift
 elif [[ $1 = '-debug' ]]
 then
+RAWDEBUGFLAG=true
 EXTRAOPTIONS="$EXTRAOPTIONS -g"
 elif [[ $1 = '-runtimedebug' ]]
 then
-EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
+#EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
+EXTRAOPTIONS="$EXTRAOPTIONS -DCHECKTB"
 elif [[ $1 = '-nooptimize' ]]
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
@@ -213,12 +237,15 @@ then exit $?
 fi
 else
 #if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
+if ! $NOJAVA
+then
 if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \
 $JAVAOPTS $SRCFILES
 then exit $?
 fi
 fi
+fi
 
 # Build all of the consistency specs
 
@@ -258,6 +285,41 @@ fi # CHECKFLAG
 
 #build and link everything
 
+if $RAWFLAG
+then # RAWFLAG
+RAWDIR="$CURDIR/raw"
+MAKEFILE="../Makefile.raw"
+mkdir $RAWDIR
+cd $RAWDIR
+make clean
+rm ./*
+
+export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
+
+if $RAWDEBUGFLAG
+then #debug version
+RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWDEBUG"
+fi
+
+if $INTERRUPTFLAG
+then #INTERRUPT version
+MAKEFILE="$MAKEFILE.i"
+RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
+fi #INTERRUPT version
+
+MAKEFILE="$MAKEFILE.$RAWCONFIG"
+
+cp $MAKEFILE ./Makefile
+cp ../Runtime/*.c ./
+cp ../Runtime/*.h ./
+cp ../Runtime/*.S ./
+cp ../Runtime/*.s ./
+cp ../tmpbuilddirectory/*.c ./
+cp ../tmpbuilddirectory/*.h ./
+
+make
+
+else #!RAWFLAG
 cd $CURDIR 
 
 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
@@ -281,7 +343,11 @@ $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
 if $DSMFLAG
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
-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" 
+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"
 fi
 
 if $RECOVERFLAG
@@ -334,5 +400,7 @@ gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
 fi
 
+fi #!RAWFLAG
+
 exit