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 "-rawcacheflush enable cache flush in raw version binary (should be used togethere with -raw)"
23 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
24 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
25 echo "-rawpath print out execute path information for raw version (should be used together with -raw)"
26 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
27 echo -threadsimulate generate multi-thread simulate version binary
28 echo -printscheduling print out scheduling graphs
29 echo -printschedulesim print out scheduling simulator result graphs
30 echo -optional enable optional
31 echo -debug generate debug symbols
32 echo -prefetch do prefetch analysis
33 echo -transstats generates transaction stats on commits and aborts
34 echo -webinterface enable web interface
35 echo -runtimedebug printout runtime debug messages
36 echo "-thread use support for multiple threads"
37 echo "-optimize call gcc with -O9 (optimize)"
38 echo "-nooptimize call gcc with -O0 (do not optimize)"
39 echo -curdir directory
40 echo -mainclass class with main method
42 echo -nojava do not run bristlecone compiler
43 echo -instructionfailures inject code for instructionfailures
44 echo -profile build with profile options
45 echo "-rawuseio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
46 echo "-enable-assertions execute assert statements during compilation"
50 ROBUSTROOT=~/research/Robust/src
51 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
52 REPAIRROOT=~/research/Repair/RepairCompiler/
61 RAWCACHEFLUSHFLAG=false
68 THREADSIMULATEFLAG=false;
91 elif [[ $1 = '-robustroot' ]]
95 elif [[ $1 = '-nojava' ]]
102 elif [[ $1 = '-mainclass' ]]
104 JAVAOPTS="$JAVAOPTS -mainclass $2"
106 elif [[ $1 = '-selfloop' ]]
108 JAVAOPTS="$JAVAOPTS -selfloop $2"
110 elif [[ $1 = '-excprefetch' ]]
112 JAVAOPTS="$JAVAOPTS -excprefetch $2"
114 elif [[ $1 = '-dsm' ]]
116 JAVAOPTS="$JAVAOPTS -dsm"
118 elif [[ $1 = '-prefetch' ]]
120 JAVAOPTS="$JAVAOPTS -prefetch"
121 elif [[ $1 = '-transstats' ]]
124 elif [[ $1 = '-printflat' ]]
126 JAVAOPTS="$JAVAOPTS -printflat"
127 elif [[ $1 = '-trueprob' ]]
129 JAVAOPTS="$JAVAOPTS -trueprob $2"
131 elif [[ $1 = '-mac' ]]
133 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
134 elif [[ $1 = '-profile' ]]
137 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
138 elif [[ $1 = '-rawuseio' ]]
141 elif [[ $1 = '-taskstate' ]]
143 JAVAOPTS="$JAVAOPTS -taskstate"
144 elif [[ $1 = '-tagstate' ]]
146 JAVAOPTS="$JAVAOPTS -tagstate"
147 elif [[ $1 = '-scheduling' ]]
149 JAVAOPTS="$JAVAOPTS -scheduling"
150 elif [[ $1 = '-multicore' ]]
153 JAVAOPTS="$JAVAOPTS -multicore"
154 elif [[ $1 = '-numcore' ]]
156 JAVAOPTS="$JAVAOPTS -numcore $2"
158 elif [[ $1 = '-raw' ]]
161 JAVAOPTS="$JAVAOPTS -raw"
162 elif [[ $1 = '-rawcacheflush' ]]
164 RAWCACHEFLUSHFLAG=true
165 elif [[ $1 = '-rawconfig' ]]
169 elif [[ $1 = '-interrupt' ]]
172 elif [[ $1 = '-threadsimulate' ]]
174 THREADSIMULATEFLAG=true
175 elif [[ $1 = '-optional' ]]
177 JAVAOPTS="$JAVAOPTS -optional"
179 elif [[ $1 = '-dmalloc' ]]
182 elif [[ $1 = '-recover' ]]
185 JAVAOPTS="$JAVAOPTS -task"
186 elif [[ $1 = '-useprofile' ]]
188 JAVAOPTS="$JAVAOPTS -useprofile"
189 elif [[ $1 = '-webinterface' ]]
191 JAVAOPTS="$JAVAOPTS -webinterface"
192 elif [[ $1 = '-instructionfailures' ]]
194 JAVAOPTS="$JAVAOPTS -instructionfailures"
195 elif [[ $1 = '-check' ]]
198 JAVAOPTS="$JAVAOPTS -conscheck"
199 elif [[ $1 = '-enable-assertions' ]]
201 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
202 elif [[ $1 = '-specdir' ]]
208 elif [[ $1 = '-debug' ]]
211 EXTRAOPTIONS="$EXTRAOPTIONS -g"
212 elif [[ $1 = '-rawpath' ]]
215 elif [[ $1 = '-runtimedebug' ]]
217 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
218 elif [[ $1 = '-dsmcaching' ]]
220 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
221 elif [[ $1 = '-rangeprefetch' ]]
223 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
224 elif [[ $1 = '-nooptimize' ]]
226 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
227 elif [[ $1 = '-optimize' ]]
229 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
230 elif [[ $1 = '-thread' ]]
232 JAVAOPTS="$JAVAOPTS -thread"
233 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
235 elif [[ $1 = '-curdir' ]]
240 SRCFILES="$SRCFILES $1"
245 BUILDDIR="$CURDIR/tmpbuilddirectory"
253 if $CHECKFLAG #Generate structure files for repair tool
255 JAVAOPTS="$JAVAOPTS -struct structfile"
258 # Build bristlecone/java sources
262 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx800m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
263 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR \
268 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
271 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx600m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
272 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \
279 # Build all of the consistency specs
281 if $CHECKFLAG # CHECKFLAG
284 mkdir $BUILDDIR/specdir
285 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
287 echo > $BUILDDIR/specs
289 # compile specs into C code
290 for i in * # iterate over all directories
292 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
295 cat $BUILDDIR/structfile.struct $i.label > $i.struct
296 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
297 cp size.[c,h] $BUILDDIR/specdir
298 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
299 echo $i >> $BUILDDIR/specs
301 done # iterate over all directories
307 echo > $BUILDDIR/checkers.h
308 for i in `cat $BUILDDIR/specs`
310 gcc -O0 -g -fbounds-check -c $i\_aux.c
311 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
315 #build and link everything
320 MAKEFILE="../Makefile.raw"
326 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
328 if $RAWCACHEFLUSHFLAG
330 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWCACHEFLUSH"
335 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
340 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWDEBUG"
344 then # profile version
345 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPROFILE"
350 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWUSEIO"
354 then #INTERRUPT version
355 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
356 fi #INTERRUPT version
360 MAKEFILE="$MAKEFILE.io"
361 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
363 MAKEFILE="$MAKEFILE.$RAWCONFIG"
366 cp $MAKEFILE ./Makefile
371 cp ../tmpbuilddirectory/*.c ./
372 cp ../tmpbuilddirectory/*.h ./
379 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
384 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
386 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
389 FILES="$RUNTIMEFILE \
390 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
391 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
392 $ROBUSTROOT/Runtime/ObjectHash.c \
393 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
394 $ROBUSTROOT/Runtime/math.c \
395 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
399 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
402 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DTRANSSTATS -DCOMPILER -DDSTM -I$DSMRUNTIME"
404 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 $DSMRUNTIME/dsmlock.c $DSMRUNTIME/prefetch.c"
409 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
412 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
414 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
417 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
419 if $THREADSIMULATEFLAG
421 # -lpthread for pthread functions, -lrt for message queue functions
422 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
428 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
429 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
434 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
439 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
440 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
445 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
450 gcc $INCLUDES $EXTRAOPTIONS \
451 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
453 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
454 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin