4 echo -robustroot set up the ROBUSTROOT to directory other than default one
5 echo -dsm distributed shared memory
6 echo -singleTM single machine committing transactions
7 echo -stmdebug STM debug
8 echo "-stmstats prints single machine commit (stm) statistics for the benchmark"
9 echo -abortreaders abort readers immediately
10 echo -trueprob double - probabiltiy of true branch
11 echo -dsmcaching -enable caching in dsm runtime
12 echo -mac distributed shared memory mac support
13 echo -check generate check code
14 echo -dmalloc link in dmalloc
15 echo -64bit compile for 64 bit machine
16 echo -joptimize java compiler optimizations
17 echo -dcopts conflict optimizations for transactional memory
18 echo -recover compile task code
19 echo -fastcheck fast checkpointing for Bristlecone
20 echo -specdir directory
21 echo -printflat print out flat representation
22 echo -selfloop task - this task cannot self loop forever
23 echo "-excprefetch methoddescriptor - exclude prefetches for this method (specified as class.method)"
24 echo -taskstate do task state analysis
25 echo -tagstate do tag state analysis
26 echo -scheduling do task scheduling
27 echo -multicore generate multi-core version binary
28 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
29 echo "-cacheflush enable cache flush in raw version binary (should be used togethere with -raw)"
30 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
31 echo "-rawpath print out execute path information for raw version (should be used together with -raw)"
32 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
33 echo -printscheduling print out scheduling graphs
34 echo -printschedulesim print out scheduling simulator result graphs
35 echo -abcclose close the array boundary check
36 echo "-tilera generate tilera version binary (should be used together with -multicore"
37 echo "-tileraconfig config tilera simulator/pci as nxm (should be used together with -tilera)"
38 echo "-raw generate raw version binary (should be used together with -multicore)"
39 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
40 echo -threadsimulate generate multi-thread simulate version binary
41 echo -optional enable optional
42 echo -debug generate debug symbols
43 echo -prefetch do prefetch analysis
44 echo -transstats generates transaction stats on commits and aborts
45 echo -garbagestats Print garbage collection statistics
46 echo -webinterface enable web interface
47 echo -runtimedebug printout runtime debug messages
48 echo "-thread use support for multiple threads"
49 echo "-optimize call gcc with -O9 (optimize)"
50 echo "-nooptimize call gcc with -O0 (do not optimize)"
51 echo -curdir directory
52 echo -mainclass class with main method
54 echo -nojava do not run bristlecone compiler
55 echo -instructionfailures inject code for instructionfailures
56 echo -profile build with profile options
57 echo "-useio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
58 echo "-enable-assertions execute assert statements during compilation"
59 echo -justanalyze exit after compiler analyses complete
64 ROBUSTROOT=~/research/Robust/src
65 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
66 REPAIRROOT=~/research/Repair/RepairCompiler/
86 THREADSIMULATEFLAG=false;
97 EXITAFTERANALYSIS=false
107 if [[ $1 = '-help' ]]
111 elif [[ $1 = '-justanalyze' ]]
113 EXITAFTERANALYSIS=true
114 elif [[ $1 = '-abortreaders' ]]
117 EXTRAOPTIONS="$EXTRAOPTIONS -DABORTREADERS"
118 JAVAOPTS="$JAVAOPTS -abortreaders"
119 elif [[ $1 = '-robustroot' ]]
123 elif [[ $1 = '-nojava' ]]
126 elif [[ $1 = '-garbagestats' ]]
128 EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
129 elif [[ $1 = '-64bit' ]]
131 EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64"
132 elif [[ $1 = '-fastcheck' ]]
134 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
135 JAVAOPTS="$JAVAOPTS -fastcheck"
141 elif [[ $1 = '-mainclass' ]]
143 JAVAOPTS="$JAVAOPTS -mainclass $2"
145 elif [[ $1 = '-selfloop' ]]
147 JAVAOPTS="$JAVAOPTS -selfloop $2"
149 elif [[ $1 = '-excprefetch' ]]
151 JAVAOPTS="$JAVAOPTS -excprefetch $2"
153 elif [[ $1 = '-dsm' ]]
155 JAVAOPTS="$JAVAOPTS -dsm"
157 elif [[ $1 = '-singleTM' ]]
159 JAVAOPTS="$JAVAOPTS -singleTM"
160 EXTRAOPTIONS="$EXTRAOPTIONS -DSTM"
162 elif [[ $1 = '-stmdebug' ]]
164 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMDEBUG"
165 elif [[ $1 = '-stmstats' ]]
167 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMSTATS"
168 elif [[ $1 = '-prefetch' ]]
170 JAVAOPTS="$JAVAOPTS -prefetch"
171 elif [[ $1 = '-transstats' ]]
173 EXTRAOPTIONS="$EXTRAOPTIONS -DTRANSSTATS"
174 elif [[ $1 = '-printflat' ]]
176 JAVAOPTS="$JAVAOPTS -printflat"
177 elif [[ $1 = '-trueprob' ]]
179 JAVAOPTS="$JAVAOPTS -trueprob $2"
181 elif [[ $1 = '-mac' ]]
183 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
184 elif [[ $1 = '-profile' ]]
187 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
188 elif [[ $1 = '-useio' ]]
191 elif [[ $1 = '-taskstate' ]]
193 JAVAOPTS="$JAVAOPTS -taskstate"
194 elif [[ $1 = '-tagstate' ]]
196 JAVAOPTS="$JAVAOPTS -tagstate"
197 elif [[ $1 = '-scheduling' ]]
199 JAVAOPTS="$JAVAOPTS -scheduling"
200 elif [[ $1 = '-multicore' ]]
203 JAVAOPTS="$JAVAOPTS -multicore"
204 elif [[ $1 = '-numcore' ]]
206 JAVAOPTS="$JAVAOPTS -numcore $2"
208 elif [[ $1 = '-raw' ]]
211 JAVAOPTS="$JAVAOPTS -raw"
212 elif [[ $1 = '-tilera' ]]
215 elif [[ $1 = '-tileraconfig' ]]
219 elif [[ $1 = '-cacheflush' ]]
222 elif [[ $1 = '-rawconfig' ]]
226 elif [[ $1 = '-interrupt' ]]
229 elif [[ $1 = '-threadsimulate' ]]
231 THREADSIMULATEFLAG=true
232 elif [[ $1 = '-abcclose' ]]
234 JAVAOPTS="$JAVAOPTS -abcclose"
235 elif [[ $1 = '-optional' ]]
237 JAVAOPTS="$JAVAOPTS -optional"
239 elif [[ $1 = '-dmalloc' ]]
242 elif [[ $1 = '-recover' ]]
245 JAVAOPTS="$JAVAOPTS -task"
246 elif [[ $1 = '-useprofile' ]]
248 JAVAOPTS="$JAVAOPTS -useprofile"
249 elif [[ $1 = '-webinterface' ]]
251 JAVAOPTS="$JAVAOPTS -webinterface"
252 elif [[ $1 = '-instructionfailures' ]]
254 JAVAOPTS="$JAVAOPTS -instructionfailures"
255 elif [[ $1 = '-joptimize' ]]
257 JAVAOPTS="$JAVAOPTS -optimize"
258 elif [[ $1 = '-dcopts' ]]
260 JAVAOPTS="$JAVAOPTS -dcopts"
261 elif [[ $1 = '-mlp' ]]
263 JAVAOPTS="$JAVAOPTS -mlp"
264 elif [[ $1 = '-mlpdebug' ]]
266 JAVAOPTS="$JAVAOPTS -mlpdebug"
267 elif [[ $1 = '-check' ]]
270 JAVAOPTS="$JAVAOPTS -conscheck"
271 elif [[ $1 = '-enable-assertions' ]]
273 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
274 elif [[ $1 = '-specdir' ]]
280 elif [[ $1 = '-debug' ]]
283 EXTRAOPTIONS="$EXTRAOPTIONS -g"
284 elif [[ $1 = '-rawpath' ]]
287 elif [[ $1 = '-runtimedebug' ]]
289 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
290 elif [[ $1 = '-dsmcaching' ]]
292 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
293 elif [[ $1 = '-rangeprefetch' ]]
295 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
296 elif [[ $1 = '-nooptimize' ]]
298 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
299 elif [[ $1 = '-optimize' ]]
301 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
302 elif [[ $1 = '-thread' ]]
304 JAVAOPTS="$JAVAOPTS -thread"
305 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
307 elif [[ $1 = '-distributioninfo' ]]
309 JAVAOPTS="$JAVAOPTS -distributioninfo"
310 elif [[ $1 = '-curdir' ]]
314 elif [[ $1 = '-outputdir' ]]
316 JAVAOPTS="$JAVAOPTS -outputdir $2"
319 SRCFILES="$SRCFILES $1"
324 BUILDDIR="$CURDIR/tmpbuilddirectory"
332 if $CHECKFLAG #Generate structure files for repair tool
334 JAVAOPTS="$JAVAOPTS -struct structfile"
344 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
346 #base bristlecone files
347 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
353 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
356 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
359 #threading java stuff
360 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
363 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
366 # Build bristlecone/java sources
370 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx800m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
371 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
372 -dir $BUILDDIR $JAVAOPTS $SRCFILES
376 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
379 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx600m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
380 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
387 if $EXITAFTERANALYSIS
392 # Build all of the consistency specs
394 if $CHECKFLAG # CHECKFLAG
397 mkdir $BUILDDIR/specdir
398 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
400 echo > $BUILDDIR/specs
402 # compile specs into C code
403 for i in * # iterate over all directories
405 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
408 cat $BUILDDIR/structfile.struct $i.label > $i.struct
409 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
410 cp size.[c,h] $BUILDDIR/specdir
411 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
412 echo $i >> $BUILDDIR/specs
414 done # iterate over all directories
420 echo > $BUILDDIR/checkers.h
421 for i in `cat $BUILDDIR/specs`
423 gcc -O0 -g -fbounds-check -c $i\_aux.c
424 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
428 #build and link everything
433 MAKEFILE="Makefile.raw"
439 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
443 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DCACHEFLUSH"
448 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
453 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
457 then # profile version
458 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
463 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
467 then #INTERRUPT version
468 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
469 fi #INTERRUPT version
473 MAKEFILE="$MAKEFILE.io"
474 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
476 MAKEFILE="$MAKEFILE.$RAWCONFIG"
479 cp $ROBUSTROOT/Runtime/RAW/$MAKEFILE ./Makefile
484 cp ../Runtime/RAW/*.c ./
485 cp ../Runtime/RAW/*.h ./
486 cp ../Runtime/RAW/*.S ./
487 cp ../Runtime/RAW/*.s ./
488 cp ../tmpbuilddirectory/*.c ./
489 cp ../tmpbuilddirectory/*.h ./
495 TILERADIR="$CURDIR/tilera"
496 MAKEFILE="Makefile.tilera.$TILERACONFIG"
497 SIMHVC="sim.hvc.$TILERACONFIG"
503 export TILERACFLAGS="-DTASK -DMULTICORE"
507 TILERACFLAGS="${TILERACFLAGS} -DCACHEFLUSH"
512 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
517 TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
521 then # profile version
522 TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
527 TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
531 then #INTERRUPT version
532 TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
533 fi #INTERRUPT version
535 cp $ROBUSTROOT/Runtime/Tilera/$MAKEFILE ./Makefile
536 cp $ROBUSTROOT/Runtime/Tilera/$SIMHVS ./sim.hvc
537 cp ../Runtime/multicoretask.c ./
538 cp ../Runtime/multicoreruntime.c ./
539 cp ../Runtime/Queue.c ./
540 cp ../Runtime/file.c ./
541 cp ../Runtime/math.c ./
542 cp ../Runtime/object.c ./
543 cp ../Runtime/GenericHashtable.c ./
544 cp ../Runtime/SimpleHash.c ./
545 cp ../Runtime/ObjectHash.c ./
546 cp ../Runtime/socket.c ./
547 cp ../Runtime/mem.c ./
548 cp ../Runtime/GenericHashtable.h ./
549 cp ../Runtime/mem.h ./
550 cp ../Runtime/multicoreruntime.h ./
551 cp ../Runtime/object.h ./
552 cp ../Runtime/ObjectHash.h ./
553 cp ../Runtime/Queue.h ./
554 cp ../Runtime/runtime.h ./
555 cp ../Runtime/SimpleHash.h ./
556 cp ../Runtime/Tilera/*.c ./
557 cp ../Runtime/Tilera/*.h ./
558 cp ../tmpbuilddirectory/*.c ./
559 cp ../tmpbuilddirectory/*.h ./
561 else #!RAWFLAG && !TILERAFLAG
564 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
569 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
571 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
574 FILES="$RUNTIMEFILE \
575 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
576 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
577 $ROBUSTROOT/Runtime/ObjectHash.c \
578 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
579 $ROBUSTROOT/Runtime/math.c \
580 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
584 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
585 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"
590 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$DSMRUNTIME"
591 FILES="$FILES $DSMRUNTIME/dsmlock.c $DSMRUNTIME/singleTMCommit.c $DSMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c"
596 FILES="$FILES $DSMRUNTIME/abortreaders.c"
601 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
606 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
611 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
614 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
616 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
619 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
621 if $THREADSIMULATEFLAG
623 # -lpthread for pthread functions, -lrt for message queue functions
624 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
630 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
631 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
636 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
641 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
642 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
647 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
652 gcc $INCLUDES $EXTRAOPTIONS \
653 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
655 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
656 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin