4 echo -robustroot set up the ROBUSTROOT to directory other than default one
5 echo -dsm distributed shared memory
6 echo -trueprob double - probabiltiy of true branch
7 echo -dsmcaching -enable caching in dsm runtime
8 echo -mac distributed shared memory mac support
9 echo -check generate check code
10 echo -dmalloc link in dmalloc
11 echo -recover compile task code
12 echo -fastcheck fast checkpointing for Bristlecone
13 echo -specdir directory
14 echo -printflat print out flat representation
15 echo -selfloop task - this task cannot self loop forever
16 echo "-excprefetch methoddescriptor - exclude prefetches for this method (specified as class.method)"
17 echo -taskstate do task state analysis
18 echo -tagstate do tag state analysis
19 echo -scheduling do task scheduling
20 echo -multicore generate multi-core version binary
21 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
22 echo "-raw generate raw version binary (should be used together with -multicore)"
23 echo "-rawcacheflush enable cache flush in raw version binary (should be used togethere with -raw)"
24 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
25 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
26 echo "-rawpath print out execute path information for raw version (should be used together with -raw)"
27 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
28 echo -threadsimulate generate multi-thread simulate version binary
29 echo -printscheduling print out scheduling graphs
30 echo -printschedulesim print out scheduling simulator result graphs
31 echo -optional enable optional
32 echo -debug generate debug symbols
33 echo -prefetch do prefetch analysis
34 echo -transstats generates transaction stats on commits and aborts
35 echo -webinterface enable web interface
36 echo -runtimedebug printout runtime debug messages
37 echo "-thread use support for multiple threads"
38 echo "-optimize call gcc with -O9 (optimize)"
39 echo "-nooptimize call gcc with -O0 (do not optimize)"
40 echo -curdir directory
41 echo -mainclass class with main method
43 echo -nojava do not run bristlecone compiler
44 echo -instructionfailures inject code for instructionfailures
45 echo -profile build with profile options
46 echo "-rawuseio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
47 echo "-enable-assertions execute assert statements during compilation"
51 ROBUSTROOT=~/research/Robust/src
52 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
53 REPAIRROOT=~/research/Repair/RepairCompiler/
62 RAWCACHEFLUSHFLAG=false
69 THREADSIMULATEFLAG=false;
93 elif [[ $1 = '-robustroot' ]]
97 elif [[ $1 = '-nojava' ]]
100 elif [[ $1 = '-fastcheck' ]]
102 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
103 JAVAOPTS="$JAVAOPTS -fastcheck"
109 elif [[ $1 = '-mainclass' ]]
111 JAVAOPTS="$JAVAOPTS -mainclass $2"
113 elif [[ $1 = '-selfloop' ]]
115 JAVAOPTS="$JAVAOPTS -selfloop $2"
117 elif [[ $1 = '-excprefetch' ]]
119 JAVAOPTS="$JAVAOPTS -excprefetch $2"
121 elif [[ $1 = '-dsm' ]]
123 JAVAOPTS="$JAVAOPTS -dsm"
125 elif [[ $1 = '-prefetch' ]]
127 JAVAOPTS="$JAVAOPTS -prefetch"
128 elif [[ $1 = '-transstats' ]]
131 elif [[ $1 = '-printflat' ]]
133 JAVAOPTS="$JAVAOPTS -printflat"
134 elif [[ $1 = '-trueprob' ]]
136 JAVAOPTS="$JAVAOPTS -trueprob $2"
138 elif [[ $1 = '-mac' ]]
140 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
141 elif [[ $1 = '-profile' ]]
144 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
145 elif [[ $1 = '-rawuseio' ]]
148 elif [[ $1 = '-taskstate' ]]
150 JAVAOPTS="$JAVAOPTS -taskstate"
151 elif [[ $1 = '-tagstate' ]]
153 JAVAOPTS="$JAVAOPTS -tagstate"
154 elif [[ $1 = '-scheduling' ]]
156 JAVAOPTS="$JAVAOPTS -scheduling"
157 elif [[ $1 = '-multicore' ]]
160 JAVAOPTS="$JAVAOPTS -multicore"
161 elif [[ $1 = '-numcore' ]]
163 JAVAOPTS="$JAVAOPTS -numcore $2"
165 elif [[ $1 = '-raw' ]]
168 JAVAOPTS="$JAVAOPTS -raw"
169 elif [[ $1 = '-rawcacheflush' ]]
171 RAWCACHEFLUSHFLAG=true
172 elif [[ $1 = '-rawconfig' ]]
176 elif [[ $1 = '-interrupt' ]]
179 elif [[ $1 = '-threadsimulate' ]]
181 THREADSIMULATEFLAG=true
182 elif [[ $1 = '-optional' ]]
184 JAVAOPTS="$JAVAOPTS -optional"
186 elif [[ $1 = '-dmalloc' ]]
189 elif [[ $1 = '-recover' ]]
192 JAVAOPTS="$JAVAOPTS -task"
193 elif [[ $1 = '-useprofile' ]]
195 JAVAOPTS="$JAVAOPTS -useprofile"
196 elif [[ $1 = '-webinterface' ]]
198 JAVAOPTS="$JAVAOPTS -webinterface"
199 elif [[ $1 = '-instructionfailures' ]]
201 JAVAOPTS="$JAVAOPTS -instructionfailures"
202 elif [[ $1 = '-check' ]]
205 JAVAOPTS="$JAVAOPTS -conscheck"
206 elif [[ $1 = '-enable-assertions' ]]
208 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
209 elif [[ $1 = '-specdir' ]]
215 elif [[ $1 = '-debug' ]]
218 EXTRAOPTIONS="$EXTRAOPTIONS -g"
219 elif [[ $1 = '-rawpath' ]]
222 elif [[ $1 = '-runtimedebug' ]]
224 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
225 elif [[ $1 = '-dsmcaching' ]]
227 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
228 elif [[ $1 = '-rangeprefetch' ]]
230 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
231 elif [[ $1 = '-nooptimize' ]]
233 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
234 elif [[ $1 = '-optimize' ]]
236 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
237 elif [[ $1 = '-thread' ]]
239 JAVAOPTS="$JAVAOPTS -thread"
240 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
242 elif [[ $1 = '-curdir' ]]
247 SRCFILES="$SRCFILES $1"
252 BUILDDIR="$CURDIR/tmpbuilddirectory"
260 if $CHECKFLAG #Generate structure files for repair tool
262 JAVAOPTS="$JAVAOPTS -struct structfile"
265 # Build bristlecone/java sources
269 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx800m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
270 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR \
275 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
278 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx600m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
279 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \
286 # Build all of the consistency specs
288 if $CHECKFLAG # CHECKFLAG
291 mkdir $BUILDDIR/specdir
292 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
294 echo > $BUILDDIR/specs
296 # compile specs into C code
297 for i in * # iterate over all directories
299 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
302 cat $BUILDDIR/structfile.struct $i.label > $i.struct
303 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
304 cp size.[c,h] $BUILDDIR/specdir
305 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
306 echo $i >> $BUILDDIR/specs
308 done # iterate over all directories
314 echo > $BUILDDIR/checkers.h
315 for i in `cat $BUILDDIR/specs`
317 gcc -O0 -g -fbounds-check -c $i\_aux.c
318 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
322 #build and link everything
327 MAKEFILE="../Makefile.raw"
333 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
335 if $RAWCACHEFLUSHFLAG
337 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWCACHEFLUSH"
342 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
347 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWDEBUG"
351 then # profile version
352 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPROFILE"
357 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWUSEIO"
361 then #INTERRUPT version
362 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
363 fi #INTERRUPT version
367 MAKEFILE="$MAKEFILE.io"
368 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
370 MAKEFILE="$MAKEFILE.$RAWCONFIG"
373 cp $MAKEFILE ./Makefile
378 cp ../tmpbuilddirectory/*.c ./
379 cp ../tmpbuilddirectory/*.h ./
386 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
391 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
393 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
396 FILES="$RUNTIMEFILE \
397 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
398 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
399 $ROBUSTROOT/Runtime/ObjectHash.c \
400 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
401 $ROBUSTROOT/Runtime/math.c \
402 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
406 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
409 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DTRANSSTATS -DCOMPILER -DDSTM -I$DSMRUNTIME"
411 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"
416 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
421 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
424 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
426 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
429 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
431 if $THREADSIMULATEFLAG
433 # -lpthread for pthread functions, -lrt for message queue functions
434 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
440 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
441 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
446 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
451 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
452 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
457 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
462 gcc $INCLUDES $EXTRAOPTIONS \
463 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
465 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
466 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin