bug fixes for udp broadcast
[IRC.git] / Robust / src / buildscript
index 1ee6e48c304168c4ec06ab98fe321391d908285f..6042f0bb5b5bd8e4183fe7c41c16c87d3f8244bf 100755 (executable)
@@ -1,15 +1,28 @@
 #!/bin/bash
 
 printhelp() {
+echo -robustroot set up the ROBUSTROOT to directory other than default one
 echo -dsm distributed shared memory
+echo -trueprob double - probabiltiy of true branch
 echo -mac distributed shared memory mac support
 echo -check generate check code
 echo -dmalloc link in dmalloc
 echo -recover compile task code
 echo -specdir directory
+echo -printflat print out flat representation
+echo -selfloop task - this task cannot self loop forever
+echo "-excprefetch methoddescriptor - exclude prefetches for this method (specified as class.method)"
 echo -taskstate do task state analysis
+echo -tagstate do tag state analysis
+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 -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"
@@ -18,7 +31,10 @@ 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"
 echo -help help
 }
 
@@ -27,14 +43,20 @@ 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
+THREADSIMULATEFLAG=false;
 USEDMALLOC=false
 THREADFLAG=false
 SPECDIR=`pwd`
 SRCFILES=''
 EXTRAOPTIONS=''
 MAINFILE='a'
+JAVAFORWARDOPTS=''
 JAVAOPTS=''
 OPTIONALFLAG=false
 
@@ -50,6 +72,13 @@ if [[ $1 = '-help' ]]
 then
 printhelp
 exit
+elif [[ $1 = '-robustroot' ]]
+then
+ROBUSTROOT="$2"
+shift
+elif [[ $1 = '-nojava' ]]
+then
+NOJAVA=true
 elif [[ $1 = '-o' ]]
 then
 MAINFILE="$2"
@@ -58,16 +87,61 @@ elif [[ $1 = '-mainclass' ]]
 then
 JAVAOPTS="$JAVAOPTS -mainclass $2"
 shift
+elif [[ $1 = '-selfloop' ]]
+then
+JAVAOPTS="$JAVAOPTS -selfloop $2"
+shift
+elif [[ $1 = '-excprefetch' ]]
+then
+JAVAOPTS="$JAVAOPTS -excprefetch $2"
+shift
 elif [[ $1 = '-dsm' ]]
 then
 JAVAOPTS="$JAVAOPTS -dsm"
 DSMFLAG=true
+elif [[ $1 = '-prefetch' ]]
+then
+JAVAOPTS="$JAVAOPTS -prefetch"
+elif [[ $1 = '-transstats' ]]
+then
+TRANSSTATSFLAG=true
+elif [[ $1 = '-printflat' ]]
+then
+JAVAOPTS="$JAVAOPTS -printflat"
+elif [[ $1 = '-trueprob' ]]
+then
+JAVAOPTS="$JAVAOPTS -trueprob $2"
+shift
 elif [[ $1 = '-mac' ]]
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
+elif [[ $1 = '-profile' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -pg"
 elif [[ $1 = '-taskstate' ]]
 then
 JAVAOPTS="$JAVAOPTS -taskstate"
+elif [[ $1 = '-tagstate' ]]
+then
+JAVAOPTS="$JAVAOPTS -tagstate"
+elif [[ $1 = '-scheduling' ]]
+then
+JAVAOPTS="$JAVAOPTS -scheduling"
+elif [[ $1 = '-multicore' ]]
+then
+MULTICOREFLAG=true
+JAVAOPTS="$JAVAOPTS -multicore"
+elif [[ $1 = '-numcore' ]]
+then
+JAVAOPTS="$JAVAOPTS -numcore $2"
+shift
+elif [[ $1 = '-raw' ]]
+then
+RAWFLAG=true
+#JAVAOPTS="$JAVAOPTS -raw"
+elif [[ $1 = '-threadsimulate' ]]
+then
+THREADSIMULATEFLAG=true
 elif [[ $1 = '-optional' ]]
 then
 JAVAOPTS="$JAVAOPTS -optional"
@@ -89,6 +163,9 @@ elif [[ $1 = '-check' ]]
 then
 CHECKFLAG=true
 JAVAOPTS="$JAVAOPTS -conscheck"
+elif [[ $1 = '-enable-assertions' ]]
+then
+JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
 elif [[ $1 = '-specdir' ]]
 then
 cd $2
@@ -137,9 +214,24 @@ fi
 
 # Build bristlecone/java sources
 
-java -cp $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
+if $MULTICOREFLAG
+then
+if ! java $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
+$ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR \
+$JAVAOPTS $SRCFILES
+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
 
@@ -172,7 +264,7 @@ cd $BUILDDIR/specdir
 echo > $BUILDDIR/checkers.h
 for i in `cat $BUILDDIR/specs`
 do
-gcc -O0 -g -c $i\_aux.c
+gcc -O0 -g -fbounds-check -c $i\_aux.c
 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
 done
 fi # CHECKFLAG
@@ -184,22 +276,49 @@ cd $CURDIR
 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
 -I$BUILDDIR"
 
-FILES="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c \
+if $MULTICOREFLAG
+then
+RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
+else
+RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
+fi
+
+FILES="$RUNTIMEFILE \
 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
+$ROBUSTROOT/Runtime/ObjectHash.c \
 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
+$ROBUSTROOT/Runtime/math.c \
+$ROBUSTROOT/Runtime/signal.c \
 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
 
 if $DSMFLAG
 then
-EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -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/dstmserver.c $DSMRUNTIME/plookup.c $DSMRUNTIME/ip.c $DSMRUNTIME/queue.c $DSMRUNTIME/prelookup.c $DSMRUNTIME/machinepile.c $DSMRUNTIME/localobjects.c"
+EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
+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"
 fi
 
 if $RECOVERFLAG
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
+if $MULTICOREFLAG
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
+fi
 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c"
+if $RAWFLAG
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
+fi
+if $THREADSIMULATEFLAG
+then
+# -lpthread for pthread functions, -lrt for message queue functions
+EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
+fi
 fi
 
 if $OPTIONALFLAG
@@ -224,8 +343,14 @@ then
 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
 fi
 
+if $MULTICOREFLAG
+then
+gcc $INCLUDES $EXTRAOPTIONS \
+tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
+else
 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
-tmpbuilddirectory/methods.c $FILES -o $MAINFILE.bin
+tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
+fi
 
 exit