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 -fastmemcpy use fast memcpy
10 echo -abortreaders abort readers immediately
11 echo -trueprob double - probabiltiy of true branch
12 echo -dsmcaching -enable caching in dsm runtime
13 echo -mac distributed shared memory mac support
14 echo -check generate check code
15 echo -dmalloc link in dmalloc
16 echo -64bit compile for 64 bit machine
17 echo -joptimize java compiler optimizations
18 echo -dcopts conflict optimizations for transactional memory
19 echo -recover compile task code
20 echo -fastcheck fast checkpointing for Bristlecone
21 echo -specdir directory
22 echo -printflat print out flat representation
23 echo -selfloop task - this task cannot self loop forever
24 echo "-excprefetch methoddescriptor - exclude prefetches for this method (specified as class.method)"
25 echo -taskstate do task state analysis
26 echo -tagstate do tag state analysis
27 echo -scheduling do task scheduling
28 echo -multicore generate multi-core version binary
29 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
30 echo "-cacheflush enable cache flush in raw version binary (should be used togethere with -raw)"
31 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
32 echo "-rawpath print out execute path information for raw version (should be used together with -raw)"
33 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
34 echo -printscheduling print out scheduling graphs
35 echo -printschedulesim print out scheduling simulator result graphs
36 echo -abcclose close the array boundary check
37 echo "-tilera generate tilera version binary (should be used together with -multicore"
38 echo "-tileraconfig config tilera simulator/pci as nxm (should be used together with -tilera)"
39 echo "-raw generate raw version binary (should be used together with -multicore)"
40 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
41 echo -threadsimulate generate multi-thread simulate version binary
42 echo -optional enable optional
43 echo -debug generate debug symbols
44 echo -prefetch do prefetch analysis
45 echo -transstats generates transaction stats on commits and aborts
46 echo -garbagestats Print garbage collection statistics
47 echo -webinterface enable web interface
48 echo -runtimedebug printout runtime debug messages
49 echo -inlineatomic depth inline methods inside of transactions to specified depth
50 echo "-thread use support for multiple threads"
51 echo "-optimize call gcc with -O9 (optimize)"
52 echo "-nooptimize call gcc with -O0 (do not optimize)"
53 echo -curdir directory
54 echo -mainclass class with main method
56 echo -nojava do not run bristlecone compiler
57 echo -instructionfailures inject code for instructionfailures
58 echo -profile build with profile options
59 echo "-useio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
60 echo "-enable-assertions execute assert statements during compilation"
61 echo -justanalyze exit after compiler analyses complete
66 ROBUSTROOT=~/research/Robust/src
67 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
68 REPAIRROOT=~/research/Repair/RepairCompiler/
89 THREADSIMULATEFLAG=false;
100 EXITAFTERANALYSIS=false
110 if [[ $1 = '-help' ]]
114 elif [[ $1 = '-justanalyze' ]]
116 EXITAFTERANALYSIS=true
117 elif [[ $1 = '-abortreaders' ]]
120 EXTRAOPTIONS="$EXTRAOPTIONS -DABORTREADERS"
121 JAVAOPTS="$JAVAOPTS -abortreaders"
122 elif [[ $1 = '-robustroot' ]]
126 elif [[ $1 = '-nojava' ]]
129 elif [[ $1 = '-garbagestats' ]]
131 EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
132 elif [[ $1 = '-64bit' ]]
134 EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64"
135 elif [[ $1 = '-fastcheck' ]]
137 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
138 JAVAOPTS="$JAVAOPTS -fastcheck"
144 elif [[ $1 = '-mainclass' ]]
146 JAVAOPTS="$JAVAOPTS -mainclass $2"
148 elif [[ $1 = '-selfloop' ]]
150 JAVAOPTS="$JAVAOPTS -selfloop $2"
152 elif [[ $1 = '-excprefetch' ]]
154 JAVAOPTS="$JAVAOPTS -excprefetch $2"
156 elif [[ $1 = '-dsm' ]]
158 JAVAOPTS="$JAVAOPTS -dsm"
160 elif [[ $1 = '-fastmemcpy' ]]
163 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTMEMCPY"
164 elif [[ $1 = '-singleTM' ]]
166 JAVAOPTS="$JAVAOPTS -singleTM"
167 EXTRAOPTIONS="$EXTRAOPTIONS -DSTM"
169 elif [[ $1 = '-stmdebug' ]]
171 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMDEBUG"
172 elif [[ $1 = '-stmstats' ]]
174 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMSTATS"
175 elif [[ $1 = '-prefetch' ]]
177 JAVAOPTS="$JAVAOPTS -prefetch"
178 elif [[ $1 = '-transstats' ]]
180 EXTRAOPTIONS="$EXTRAOPTIONS -DTRANSSTATS"
181 elif [[ $1 = '-printflat' ]]
183 JAVAOPTS="$JAVAOPTS -printflat"
184 elif [[ $1 = '-trueprob' ]]
186 JAVAOPTS="$JAVAOPTS -trueprob $2"
188 elif [[ $1 = '-inlineatomic' ]]
190 JAVAOPTS="$JAVAOPTS -inlineatomic $2"
192 elif [[ $1 = '-mac' ]]
194 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
195 elif [[ $1 = '-profile' ]]
198 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
199 elif [[ $1 = '-useio' ]]
202 elif [[ $1 = '-taskstate' ]]
204 JAVAOPTS="$JAVAOPTS -taskstate"
205 elif [[ $1 = '-tagstate' ]]
207 JAVAOPTS="$JAVAOPTS -tagstate"
208 elif [[ $1 = '-scheduling' ]]
210 JAVAOPTS="$JAVAOPTS -scheduling"
211 elif [[ $1 = '-multicore' ]]
214 JAVAOPTS="$JAVAOPTS -multicore"
215 elif [[ $1 = '-numcore' ]]
217 JAVAOPTS="$JAVAOPTS -numcore $2"
219 elif [[ $1 = '-raw' ]]
222 JAVAOPTS="$JAVAOPTS -raw"
223 elif [[ $1 = '-tilera' ]]
226 elif [[ $1 = '-tileraconfig' ]]
230 elif [[ $1 = '-cacheflush' ]]
233 elif [[ $1 = '-rawconfig' ]]
237 elif [[ $1 = '-interrupt' ]]
240 elif [[ $1 = '-threadsimulate' ]]
242 THREADSIMULATEFLAG=true
243 elif [[ $1 = '-abcclose' ]]
245 JAVAOPTS="$JAVAOPTS -abcclose"
246 elif [[ $1 = '-optional' ]]
248 JAVAOPTS="$JAVAOPTS -optional"
250 elif [[ $1 = '-dmalloc' ]]
253 elif [[ $1 = '-recover' ]]
256 JAVAOPTS="$JAVAOPTS -task"
257 elif [[ $1 = '-useprofile' ]]
259 JAVAOPTS="$JAVAOPTS -useprofile"
260 elif [[ $1 = '-webinterface' ]]
262 JAVAOPTS="$JAVAOPTS -webinterface"
263 elif [[ $1 = '-instructionfailures' ]]
265 JAVAOPTS="$JAVAOPTS -instructionfailures"
266 elif [[ $1 = '-joptimize' ]]
268 JAVAOPTS="$JAVAOPTS -optimize"
269 elif [[ $1 = '-dcopts' ]]
271 JAVAOPTS="$JAVAOPTS -dcopts"
272 elif [[ $1 = '-delaycomp' ]]
274 JAVAOPTS="$JAVAOPTS -delaycomp"
275 EXTRAOPTIONS="$EXTRAOPTIONS -DDELAYCOMP"
276 elif [[ $1 = '-mlp' ]]
278 JAVAOPTS="$JAVAOPTS -mlp"
279 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread"
280 elif [[ $1 = '-mlpdebug' ]]
282 JAVAOPTS="$JAVAOPTS -mlpdebug"
283 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread"
284 elif [[ $1 = '-check' ]]
287 JAVAOPTS="$JAVAOPTS -conscheck"
288 elif [[ $1 = '-enable-assertions' ]]
290 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
291 elif [[ $1 = '-specdir' ]]
297 elif [[ $1 = '-debug' ]]
300 EXTRAOPTIONS="$EXTRAOPTIONS -g -rdynamic"
301 elif [[ $1 = '-rawpath' ]]
304 elif [[ $1 = '-runtimedebug' ]]
306 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
307 elif [[ $1 = '-dsmcaching' ]]
309 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
310 elif [[ $1 = '-rangeprefetch' ]]
312 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
313 elif [[ $1 = '-nooptimize' ]]
315 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
316 elif [[ $1 = '-optimize' ]]
318 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
319 elif [[ $1 = '-thread' ]]
321 JAVAOPTS="$JAVAOPTS -thread"
322 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
324 elif [[ $1 = '-distributioninfo' ]]
326 JAVAOPTS="$JAVAOPTS -distributioninfo"
327 elif [[ $1 = '-curdir' ]]
331 elif [[ $1 = '-outputdir' ]]
333 JAVAOPTS="$JAVAOPTS -outputdir $2"
336 SRCFILES="$SRCFILES $1"
341 BUILDDIR="$CURDIR/tmpbuilddirectory"
349 if $CHECKFLAG #Generate structure files for repair tool
351 JAVAOPTS="$JAVAOPTS -struct structfile"
361 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
363 #base bristlecone files
364 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
370 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
373 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
376 #threading java stuff
377 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
380 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
383 # Build bristlecone/java sources
387 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx800m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
388 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
389 -dir $BUILDDIR $JAVAOPTS $SRCFILES
393 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
396 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx600m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
397 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
404 if $EXITAFTERANALYSIS
409 # Build all of the consistency specs
411 if $CHECKFLAG # CHECKFLAG
414 mkdir $BUILDDIR/specdir
415 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
417 echo > $BUILDDIR/specs
419 # compile specs into C code
420 for i in * # iterate over all directories
422 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
425 cat $BUILDDIR/structfile.struct $i.label > $i.struct
426 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
427 cp size.[c,h] $BUILDDIR/specdir
428 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
429 echo $i >> $BUILDDIR/specs
431 done # iterate over all directories
437 echo > $BUILDDIR/checkers.h
438 for i in `cat $BUILDDIR/specs`
440 gcc -O0 -g -fbounds-check -c $i\_aux.c
441 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
445 #build and link everything
450 MAKEFILE="Makefile.raw"
456 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
460 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DCACHEFLUSH"
465 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
470 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
474 then # profile version
475 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
480 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
484 then #INTERRUPT version
485 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
486 fi #INTERRUPT version
490 MAKEFILE="$MAKEFILE.io"
491 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
493 MAKEFILE="$MAKEFILE.$RAWCONFIG"
496 cp $ROBUSTROOT/Runtime/RAW/$MAKEFILE ./Makefile
501 cp ../Runtime/RAW/*.c ./
502 cp ../Runtime/RAW/*.h ./
503 cp ../Runtime/RAW/*.S ./
504 cp ../Runtime/RAW/*.s ./
505 cp ../tmpbuilddirectory/*.c ./
506 cp ../tmpbuilddirectory/*.h ./
512 TILERADIR="$CURDIR/tilera"
513 MAKEFILE="Makefile.tilera.$TILERACONFIG"
514 SIMHVC="sim.hvc.$TILERACONFIG"
515 PCIHVC="pci.hvc.$TILERACONFIG"
521 export TILERACFLAGS="-DTASK -DMULTICORE"
525 TILERACFLAGS="${TILERACFLAGS} -DCACHEFLUSH"
530 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
535 TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
539 then # profile version
540 TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
545 TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
549 then #INTERRUPT version
550 TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
551 fi #INTERRUPT version
553 cp $ROBUSTROOT/Tilera/Runtime/$MAKEFILE ./Makefile
554 cp $ROBUSTROOT/Tilera/Runtime/$SIMHVC ./sim.hvc
555 cp $ROBUSTROOT/Tilera/Runtime/$PCIHVC ./pci.hvc
556 cp $ROBUSTROOT/Tilera/Runtime/bamboo-vmlinux-pci.hvc ./bamboo-vmlinux-pci.hvc
557 cp ../Runtime/multicoretask.c ./
558 cp ../Runtime/multicoreruntime.c ./
559 cp ../Runtime/Queue.c ./
560 cp ../Runtime/file.c ./
561 cp ../Runtime/math.c ./
562 cp ../Runtime/object.c ./
563 cp ../Runtime/GenericHashtable.c ./
564 cp ../Runtime/SimpleHash.c ./
565 cp ../Runtime/ObjectHash.c ./
566 cp ../Runtime/socket.c ./
567 cp ../Runtime/mem.c ./
568 cp ../Runtime/GenericHashtable.h ./
569 cp ../Runtime/mem.h ./
570 cp ../Runtime/multicoreruntime.h ./
571 cp ../Runtime/object.h ./
572 cp ../Runtime/ObjectHash.h ./
573 cp ../Runtime/Queue.h ./
574 cp ../Runtime/runtime.h ./
575 cp ../Runtime/SimpleHash.h ./
576 cp ../Tilera/Runtime/*.c ./
577 cp ../Tilera/Runtime/*.h ./
578 cp ../Tilera/lib/* ./
579 cp ../tmpbuilddirectory/*.c ./
580 cp ../tmpbuilddirectory/*.h ./
582 else #!RAWFLAG && !TILERAFLAG
585 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
590 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
592 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
595 FILES="$RUNTIMEFILE \
596 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
597 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
598 $ROBUSTROOT/Runtime/ObjectHash.c \
599 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
600 $ROBUSTROOT/Runtime/math.c \
601 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
605 FILES="$FILES $ROBUSTROOT/Runtime/memcpy32.o $ROBUSTROOT/Runtime/instrset32.o"
610 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
611 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"
616 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$DSMRUNTIME"
617 FILES="$FILES $DSMRUNTIME/stmlock.c $DSMRUNTIME/singleTMCommit.c $DSMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c"
622 FILES="$FILES $DSMRUNTIME/abortreaders.c"
627 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
632 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
633 FILES="$FILES $ROBUSTROOT/Runtime/psemaphore.c"
634 FILES="$FILES $ROBUSTROOT/Runtime/workschedule.c"
639 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
642 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
644 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
647 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
649 if $THREADSIMULATEFLAG
651 # -lpthread for pthread functions, -lrt for message queue functions
652 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
658 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
659 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
664 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
669 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
670 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
675 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
680 gcc $INCLUDES $EXTRAOPTIONS \
681 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
683 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
684 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin