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"
48 echo -justanalyze exit after compiler analyses complete
52 ROBUSTROOT=~/research/Robust/src
53 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
54 REPAIRROOT=~/research/Repair/RepairCompiler/
63 RAWCACHEFLUSHFLAG=false
70 THREADSIMULATEFLAG=false;
81 EXITAFTERANALYSIS=false
95 elif [[ $1 = '-justanalyze' ]]
97 EXITAFTERANALYSIS=true
98 elif [[ $1 = '-robustroot' ]]
102 elif [[ $1 = '-nojava' ]]
105 elif [[ $1 = '-fastcheck' ]]
107 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
108 JAVAOPTS="$JAVAOPTS -fastcheck"
114 elif [[ $1 = '-mainclass' ]]
116 JAVAOPTS="$JAVAOPTS -mainclass $2"
118 elif [[ $1 = '-selfloop' ]]
120 JAVAOPTS="$JAVAOPTS -selfloop $2"
122 elif [[ $1 = '-excprefetch' ]]
124 JAVAOPTS="$JAVAOPTS -excprefetch $2"
126 elif [[ $1 = '-dsm' ]]
128 JAVAOPTS="$JAVAOPTS -dsm"
130 elif [[ $1 = '-prefetch' ]]
132 JAVAOPTS="$JAVAOPTS -prefetch"
133 elif [[ $1 = '-transstats' ]]
136 elif [[ $1 = '-printflat' ]]
138 JAVAOPTS="$JAVAOPTS -printflat"
139 elif [[ $1 = '-trueprob' ]]
141 JAVAOPTS="$JAVAOPTS -trueprob $2"
143 elif [[ $1 = '-mac' ]]
145 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
146 elif [[ $1 = '-profile' ]]
149 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
150 elif [[ $1 = '-rawuseio' ]]
153 elif [[ $1 = '-taskstate' ]]
155 JAVAOPTS="$JAVAOPTS -taskstate"
156 elif [[ $1 = '-tagstate' ]]
158 JAVAOPTS="$JAVAOPTS -tagstate"
159 elif [[ $1 = '-scheduling' ]]
161 JAVAOPTS="$JAVAOPTS -scheduling"
162 elif [[ $1 = '-multicore' ]]
165 JAVAOPTS="$JAVAOPTS -multicore"
166 elif [[ $1 = '-numcore' ]]
168 JAVAOPTS="$JAVAOPTS -numcore $2"
170 elif [[ $1 = '-raw' ]]
173 JAVAOPTS="$JAVAOPTS -raw"
174 elif [[ $1 = '-rawcacheflush' ]]
176 RAWCACHEFLUSHFLAG=true
177 elif [[ $1 = '-rawconfig' ]]
181 elif [[ $1 = '-interrupt' ]]
184 elif [[ $1 = '-threadsimulate' ]]
186 THREADSIMULATEFLAG=true
187 elif [[ $1 = '-optional' ]]
189 JAVAOPTS="$JAVAOPTS -optional"
191 elif [[ $1 = '-dmalloc' ]]
194 elif [[ $1 = '-recover' ]]
197 JAVAOPTS="$JAVAOPTS -task"
198 elif [[ $1 = '-useprofile' ]]
200 JAVAOPTS="$JAVAOPTS -useprofile"
201 elif [[ $1 = '-webinterface' ]]
203 JAVAOPTS="$JAVAOPTS -webinterface"
204 elif [[ $1 = '-instructionfailures' ]]
206 JAVAOPTS="$JAVAOPTS -instructionfailures"
207 elif [[ $1 = '-check' ]]
210 JAVAOPTS="$JAVAOPTS -conscheck"
211 elif [[ $1 = '-enable-assertions' ]]
213 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
214 elif [[ $1 = '-specdir' ]]
220 elif [[ $1 = '-debug' ]]
223 EXTRAOPTIONS="$EXTRAOPTIONS -g"
224 elif [[ $1 = '-rawpath' ]]
227 elif [[ $1 = '-runtimedebug' ]]
229 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
230 elif [[ $1 = '-dsmcaching' ]]
232 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
233 elif [[ $1 = '-rangeprefetch' ]]
235 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
236 elif [[ $1 = '-nooptimize' ]]
238 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
239 elif [[ $1 = '-optimize' ]]
241 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
242 elif [[ $1 = '-thread' ]]
244 JAVAOPTS="$JAVAOPTS -thread"
245 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
247 elif [[ $1 = '-curdir' ]]
252 SRCFILES="$SRCFILES $1"
257 BUILDDIR="$CURDIR/tmpbuilddirectory"
265 if $CHECKFLAG #Generate structure files for repair tool
267 JAVAOPTS="$JAVAOPTS -struct structfile"
270 # Build bristlecone/java sources
274 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx800m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
275 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR \
280 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
283 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx600m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
284 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \
291 if $EXITAFTERANALYSIS
296 # Build all of the consistency specs
298 if $CHECKFLAG # CHECKFLAG
301 mkdir $BUILDDIR/specdir
302 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
304 echo > $BUILDDIR/specs
306 # compile specs into C code
307 for i in * # iterate over all directories
309 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
312 cat $BUILDDIR/structfile.struct $i.label > $i.struct
313 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
314 cp size.[c,h] $BUILDDIR/specdir
315 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
316 echo $i >> $BUILDDIR/specs
318 done # iterate over all directories
324 echo > $BUILDDIR/checkers.h
325 for i in `cat $BUILDDIR/specs`
327 gcc -O0 -g -fbounds-check -c $i\_aux.c
328 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
332 #build and link everything
337 MAKEFILE="../Makefile.raw"
343 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
345 if $RAWCACHEFLUSHFLAG
347 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWCACHEFLUSH"
352 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
357 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWDEBUG"
361 then # profile version
362 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPROFILE"
367 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWUSEIO"
371 then #INTERRUPT version
372 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
373 fi #INTERRUPT version
377 MAKEFILE="$MAKEFILE.io"
378 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
380 MAKEFILE="$MAKEFILE.$RAWCONFIG"
383 cp $MAKEFILE ./Makefile
388 cp ../tmpbuilddirectory/*.c ./
389 cp ../tmpbuilddirectory/*.h ./
396 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
401 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
403 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
406 FILES="$RUNTIMEFILE \
407 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
408 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
409 $ROBUSTROOT/Runtime/ObjectHash.c \
410 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
411 $ROBUSTROOT/Runtime/math.c \
412 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
416 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
419 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DTRANSSTATS -DCOMPILER -DDSTM -I$DSMRUNTIME"
421 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"
426 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
431 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
434 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
436 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
439 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
441 if $THREADSIMULATEFLAG
443 # -lpthread for pthread functions, -lrt for message queue functions
444 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
450 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
451 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
456 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
461 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
462 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
467 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
472 gcc $INCLUDES $EXTRAOPTIONS \
473 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
475 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
476 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin