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 -specdir directory
13 echo -printflat print out flat representation
14 echo -selfloop task - this task cannot self loop forever
15 echo "-excprefetch methoddescriptor - exclude prefetches for this method (specified as class.method)"
16 echo -taskstate do task state analysis
17 echo -tagstate do tag state analysis
18 echo -scheduling do task scheduling
19 echo -multicore generate multi-core version binary
20 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
21 echo "-raw generate raw version binary (should be used together with -multicore)"
22 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
23 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
24 echo -threadsimulate generate multi-thread simulate version binary
25 echo -optional enable optional
26 echo -debug generate debug symbols
27 echo -prefetch do prefetch analysis
28 echo -transstats generates transaction stats on commits and aborts
29 echo -webinterface enable web interface
30 echo -runtimedebug printout runtime debug messages
31 echo "-thread use support for multiple threads"
32 echo "-optimize call gcc with -O9 (optimize)"
33 echo "-nooptimize call gcc with -O0 (do not optimize)"
34 echo -curdir directory
35 echo -mainclass class with main method
37 echo -nojava do not run bristlecone compiler
38 echo -instructionfailures inject code for instructionfailures
39 echo -profile build with profile options
40 echo "-enable-assertions execute assert statements during compilation"
44 ROBUSTROOT=~/research/Robust/src
45 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
46 REPAIRROOT=~/research/Repair/RepairCompiler/
58 THREADSIMULATEFLAG=false;
81 elif [[ $1 = '-robustroot' ]]
85 elif [[ $1 = '-nojava' ]]
92 elif [[ $1 = '-mainclass' ]]
94 JAVAOPTS="$JAVAOPTS -mainclass $2"
96 elif [[ $1 = '-selfloop' ]]
98 JAVAOPTS="$JAVAOPTS -selfloop $2"
100 elif [[ $1 = '-excprefetch' ]]
102 JAVAOPTS="$JAVAOPTS -excprefetch $2"
104 elif [[ $1 = '-dsm' ]]
106 JAVAOPTS="$JAVAOPTS -dsm"
108 elif [[ $1 = '-prefetch' ]]
110 JAVAOPTS="$JAVAOPTS -prefetch"
111 elif [[ $1 = '-transstats' ]]
114 elif [[ $1 = '-printflat' ]]
116 JAVAOPTS="$JAVAOPTS -printflat"
117 elif [[ $1 = '-trueprob' ]]
119 JAVAOPTS="$JAVAOPTS -trueprob $2"
121 elif [[ $1 = '-mac' ]]
123 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
124 elif [[ $1 = '-profile' ]]
126 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
127 elif [[ $1 = '-taskstate' ]]
129 JAVAOPTS="$JAVAOPTS -taskstate"
130 elif [[ $1 = '-tagstate' ]]
132 JAVAOPTS="$JAVAOPTS -tagstate"
133 elif [[ $1 = '-scheduling' ]]
135 JAVAOPTS="$JAVAOPTS -scheduling"
136 elif [[ $1 = '-multicore' ]]
139 JAVAOPTS="$JAVAOPTS -multicore"
140 elif [[ $1 = '-numcore' ]]
142 JAVAOPTS="$JAVAOPTS -numcore $2"
144 elif [[ $1 = '-raw' ]]
147 JAVAOPTS="$JAVAOPTS -raw"
148 elif [[ $1 = '-rawconfig' ]]
152 elif [[ $1 = '-interrupt' ]]
155 elif [[ $1 = '-threadsimulate' ]]
157 THREADSIMULATEFLAG=true
158 elif [[ $1 = '-optional' ]]
160 JAVAOPTS="$JAVAOPTS -optional"
162 elif [[ $1 = '-dmalloc' ]]
165 elif [[ $1 = '-recover' ]]
168 JAVAOPTS="$JAVAOPTS -task"
169 elif [[ $1 = '-webinterface' ]]
171 JAVAOPTS="$JAVAOPTS -webinterface"
172 elif [[ $1 = '-instructionfailures' ]]
174 JAVAOPTS="$JAVAOPTS -instructionfailures"
175 elif [[ $1 = '-check' ]]
178 JAVAOPTS="$JAVAOPTS -conscheck"
179 elif [[ $1 = '-enable-assertions' ]]
181 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
182 elif [[ $1 = '-specdir' ]]
188 elif [[ $1 = '-debug' ]]
191 EXTRAOPTIONS="$EXTRAOPTIONS -g"
192 elif [[ $1 = '-runtimedebug' ]]
194 EXTRAOPTIONS="$EXTRAOPTIONS -DCHECKTA"
195 elif [[ $1 = '-dsmcaching' ]]
197 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
198 elif [[ $1 = '-nooptimize' ]]
200 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
201 elif [[ $1 = '-optimize' ]]
203 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
204 elif [[ $1 = '-thread' ]]
206 JAVAOPTS="$JAVAOPTS -thread"
207 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
209 elif [[ $1 = '-curdir' ]]
214 SRCFILES="$SRCFILES $1"
219 BUILDDIR="$CURDIR/tmpbuilddirectory"
227 if $CHECKFLAG #Generate structure files for repair tool
229 JAVAOPTS="$JAVAOPTS -struct structfile"
232 # Build bristlecone/java sources
236 if ! java $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
237 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR \
242 #if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
245 if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
246 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \
253 # Build all of the consistency specs
255 if $CHECKFLAG # CHECKFLAG
258 mkdir $BUILDDIR/specdir
259 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
261 echo > $BUILDDIR/specs
263 # compile specs into C code
264 for i in * # iterate over all directories
266 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
269 cat $BUILDDIR/structfile.struct $i.label > $i.struct
270 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
271 cp size.[c,h] $BUILDDIR/specdir
272 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
273 echo $i >> $BUILDDIR/specs
275 done # iterate over all directories
281 echo > $BUILDDIR/checkers.h
282 for i in `cat $BUILDDIR/specs`
284 gcc -O0 -g -fbounds-check -c $i\_aux.c
285 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
289 #build and link everything
294 MAKEFILE="../Makefile.raw"
300 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
304 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWDEBUG"
308 then #INTERRUPT version
309 MAKEFILE="$MAKEFILE.i"
310 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
311 fi #INTERRUPT version
313 MAKEFILE="$MAKEFILE.$RAWCONFIG"
315 cp $MAKEFILE ./Makefile
320 cp ../tmpbuilddirectory/*.c ./
321 cp ../tmpbuilddirectory/*.h ./
328 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
333 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
335 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
338 FILES="$RUNTIMEFILE \
339 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
340 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
341 $ROBUSTROOT/Runtime/ObjectHash.c \
342 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
343 $ROBUSTROOT/Runtime/math.c \
344 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
348 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
351 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DTRANSSTATS -DCOMPILER -DDSTM -I$DSMRUNTIME"
353 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"
358 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
361 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
363 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c"
366 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
368 if $THREADSIMULATEFLAG
370 # -lpthread for pthread functions, -lrt for message queue functions
371 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
377 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
378 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
383 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
388 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
389 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
394 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
399 gcc $INCLUDES $EXTRAOPTIONS \
400 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
402 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
403 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin