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 -readset turn on readset
8 echo -stmdebug STM debug
9 echo "-stmstats prints single machine commit (stm) statistics for the benchmark"
10 echo -fastmemcpy use fast memcpy
11 echo -abortreaders abort readers immediately
12 echo -trueprob double - probabiltiy of true branch
13 echo -dsmcaching -enable caching in dsm runtime
14 echo -mac distributed shared memory mac support
15 echo -check generate check code
16 echo -dmalloc link in dmalloc
17 echo -64bit compile for 64 bit machine
18 echo -32bit compile for 32 bit machine
19 echo -joptimize java compiler optimizations
20 echo -dcopts conflict optimizations for transactional memory
21 echo -recover compile task code
22 echo -fastcheck fast checkpointing for Bristlecone
23 echo -specdir directory
24 echo -printflat print out flat representation
25 echo -selfloop task - this task cannot self loop forever
26 echo "-excprefetch methoddescriptor - exclude prefetches for this method (specified as class.method)"
27 echo -taskstate do task state analysis
28 echo -tagstate do tag state analysis
29 echo -scheduling do task scheduling
30 echo -multicore generate multi-core version binary
31 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
32 echo "-cacheflush enable cache flush in raw version binary (should be used togethere with -raw)"
33 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
34 echo "-rawpath print out execute path information for raw version (should be used together with -raw)"
35 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
36 echo -printscheduling print out scheduling graphs
37 echo -printschedulesim print out scheduling simulator result graphs
38 echo -abcclose close the array boundary check
39 echo "-tilera generate tilera version binary (should be used together with -multicore"
40 echo "-tileraconfig config tilera simulator/pci as nxm (should be used together with -tilera)"
41 echo "-raw generate raw version binary (should be used together with -multicore)"
42 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
43 echo -threadsimulate generate multi-thread simulate version binary
44 echo -optional enable optional
45 echo -debug generate debug symbols
46 echo -prefetch do prefetch analysis
47 echo -transstats generates transaction stats on commits and aborts
48 echo -garbagestats Print garbage collection statistics
49 echo -webinterface enable web interface
50 echo -runtimedebug printout runtime debug messages
51 echo -inlineatomic depth inline methods inside of transactions to specified depth
52 echo "-thread use support for multiple threads"
53 echo "-optimize call gcc with -O9 (optimize)"
54 echo "-nooptimize call gcc with -O0 (do not optimize)"
55 echo -curdir directory
56 echo -mainclass class with main method
58 echo -nojava do not run bristlecone compiler
59 echo -instructionfailures inject code for instructionfailures
60 echo -profile build with profile options
61 echo -accurateprofile build with accurate profile information including pre/post task processing info
62 echo "-useio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
63 echo "-enable-assertions execute assert statements during compilation"
64 echo -justanalyze exit after compiler analyses complete
65 echo "-distributioninfo execute to collect distribution info for simulated annealing in multi-core version"
66 echo "-disall execute to collect whole distribution"
67 echo "-disstart specify the start number of distribution information collection"
68 echo -assembly generate assembly
73 ROBUSTROOT=~/research/Robust/src
74 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
75 REPAIRROOT=~/research/Repair/RepairCompiler/
94 ACCURATEPROFILEFLAG=false
97 THREADSIMULATEFLAG=false;
108 EXITAFTERANALYSIS=false
119 if [[ $1 = '-help' ]]
123 elif [[ $1 = '-justanalyze' ]]
125 EXITAFTERANALYSIS=true
126 elif [[ $1 = '-assembly' ]]
129 elif [[ $1 = '-abortreaders' ]]
132 EXTRAOPTIONS="$EXTRAOPTIONS -DABORTREADERS"
133 JAVAOPTS="$JAVAOPTS -abortreaders"
134 elif [[ $1 = '-robustroot' ]]
138 elif [[ $1 = '-nojava' ]]
141 elif [[ $1 = '-garbagestats' ]]
143 EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
144 elif [[ $1 = '-64bit' ]]
146 EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64"
147 elif [[ $1 = '-32bit' ]]
149 EXTRAOPTIONS="$EXTRAOPTIONS -m32"
150 elif [[ $1 = '-fastcheck' ]]
152 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
153 JAVAOPTS="$JAVAOPTS -fastcheck"
159 elif [[ $1 = '-mainclass' ]]
161 JAVAOPTS="$JAVAOPTS -mainclass $2"
163 elif [[ $1 = '-selfloop' ]]
165 JAVAOPTS="$JAVAOPTS -selfloop $2"
167 elif [[ $1 = '-excprefetch' ]]
169 JAVAOPTS="$JAVAOPTS -excprefetch $2"
171 elif [[ $1 = '-arraypad' ]]
173 JAVAOPTS="$JAVAOPTS -arraypad"
174 elif [[ $1 = '-dsm' ]]
176 JAVAOPTS="$JAVAOPTS -dsm"
178 elif [[ $1 = '-fastmemcpy' ]]
181 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTMEMCPY"
182 elif [[ $1 = '-singleTM' ]]
184 JAVAOPTS="$JAVAOPTS -singleTM"
185 EXTRAOPTIONS="$EXTRAOPTIONS -DSTM"
187 elif [[ $1 = '-readset' ]]
189 JAVAOPTS="$JAVAOPTS -readset"
190 EXTRAOPTIONS="$EXTRAOPTIONS -DREADSET"
191 elif [[ $1 = '-stmdebug' ]]
193 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMDEBUG"
194 elif [[ $1 = '-stmstats' ]]
196 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMSTATS"
197 elif [[ $1 = '-prefetch' ]]
199 JAVAOPTS="$JAVAOPTS -prefetch"
200 elif [[ $1 = '-transstats' ]]
202 EXTRAOPTIONS="$EXTRAOPTIONS -DTRANSSTATS"
203 elif [[ $1 = '-printflat' ]]
205 JAVAOPTS="$JAVAOPTS -printflat"
206 elif [[ $1 = '-trueprob' ]]
208 JAVAOPTS="$JAVAOPTS -trueprob $2"
210 elif [[ $1 = '-inlineatomic' ]]
212 JAVAOPTS="$JAVAOPTS -inlineatomic $2"
214 elif [[ $1 = '-mac' ]]
216 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
217 elif [[ $1 = '-profile' ]]
220 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
221 elif [[ $1 = '-accurateprofile' ]]
223 ACCURATEPROFILEFLAG=true
224 elif [[ $1 = '-useio' ]]
227 elif [[ $1 = '-taskstate' ]]
229 JAVAOPTS="$JAVAOPTS -taskstate"
230 elif [[ $1 = '-tagstate' ]]
232 JAVAOPTS="$JAVAOPTS -tagstate"
233 elif [[ $1 = '-scheduling' ]]
235 JAVAOPTS="$JAVAOPTS -scheduling"
236 elif [[ $1 = '-multicore' ]]
239 JAVAOPTS="$JAVAOPTS -multicore"
240 elif [[ $1 = '-numcore' ]]
242 JAVAOPTS="$JAVAOPTS -numcore $2"
244 elif [[ $1 = '-raw' ]]
247 JAVAOPTS="$JAVAOPTS -raw"
248 elif [[ $1 = '-tilera' ]]
251 elif [[ $1 = '-tileraconfig' ]]
255 elif [[ $1 = '-cacheflush' ]]
258 elif [[ $1 = '-rawconfig' ]]
262 elif [[ $1 = '-interrupt' ]]
265 elif [[ $1 = '-threadsimulate' ]]
267 THREADSIMULATEFLAG=true
268 elif [[ $1 = '-abcclose' ]]
270 JAVAOPTS="$JAVAOPTS -abcclose"
271 elif [[ $1 = '-optional' ]]
273 JAVAOPTS="$JAVAOPTS -optional"
275 elif [[ $1 = '-dmalloc' ]]
278 elif [[ $1 = '-recover' ]]
281 JAVAOPTS="$JAVAOPTS -task"
282 elif [[ $1 = '-useprofile' ]]
284 JAVAOPTS="$JAVAOPTS -useprofile $2"
286 elif [[ $1 = '-webinterface' ]]
288 JAVAOPTS="$JAVAOPTS -webinterface"
289 elif [[ $1 = '-instructionfailures' ]]
291 JAVAOPTS="$JAVAOPTS -instructionfailures"
292 elif [[ $1 = '-joptimize' ]]
294 JAVAOPTS="$JAVAOPTS -optimize"
295 elif [[ $1 = '-dcopts' ]]
297 JAVAOPTS="$JAVAOPTS -dcopts"
298 elif [[ $1 = '-delaycomp' ]]
300 JAVAOPTS="$JAVAOPTS -delaycomp"
301 EXTRAOPTIONS="$EXTRAOPTIONS -DDELAYCOMP"
302 elif [[ $1 = '-minimize' ]]
304 JAVAOPTS="$JAVAOPTS -minimize"
305 elif [[ $1 = '-mlp' ]]
308 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread"
309 elif [[ $1 = '-mlpdebug' ]]
311 JAVAOPTS="$JAVAOPTS -mlpdebug"
313 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread"
314 elif [[ $1 = '-check' ]]
317 JAVAOPTS="$JAVAOPTS -conscheck"
318 elif [[ $1 = '-enable-assertions' ]]
320 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
321 elif [[ $1 = '-specdir' ]]
327 elif [[ $1 = '-debug' ]]
330 EXTRAOPTIONS="$EXTRAOPTIONS -g -rdynamic"
331 elif [[ $1 = '-rawpath' ]]
334 elif [[ $1 = '-runtimedebug' ]]
336 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
337 elif [[ $1 = '-dsmcaching' ]]
339 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
340 elif [[ $1 = '-rangeprefetch' ]]
342 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
343 elif [[ $1 = '-nooptimize' ]]
345 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
346 elif [[ $1 = '-optimize' ]]
348 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
349 elif [[ $1 = '-thread' ]]
351 JAVAOPTS="$JAVAOPTS -thread"
352 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
354 elif [[ $1 = '-distributioninfo' ]]
356 JAVAOPTS="$JAVAOPTS -distributioninfo"
357 elif [[ $1 = '-disall' ]]
359 JAVAOPTS="$JAVAOPTS -disall"
360 elif [[ $1 = '-disstart' ]]
362 JAVAOPTS="$JAVAOPTS -disstart $2"
364 elif [[ $1 = '-noc' ]]
367 elif [[ $1 = '-curdir' ]]
371 elif [[ $1 = '-outputdir' ]]
373 JAVAOPTS="$JAVAOPTS -outputdir $2"
376 SRCFILES="$SRCFILES $1"
381 BUILDDIR="$CURDIR/tmpbuilddirectory"
389 if $CHECKFLAG #Generate structure files for repair tool
391 JAVAOPTS="$JAVAOPTS -struct structfile"
401 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
403 #base bristlecone files
404 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
410 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
413 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
416 #threading java stuff
417 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
420 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
423 # Build bristlecone/java sources
427 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
428 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
429 -dir $BUILDDIR $JAVAOPTS $SRCFILES
433 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
436 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
437 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
444 if $EXITAFTERANALYSIS
449 # Build all of the consistency specs
451 if $CHECKFLAG # CHECKFLAG
454 mkdir $BUILDDIR/specdir
455 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
457 echo > $BUILDDIR/specs
459 # compile specs into C code
460 for i in * # iterate over all directories
462 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
465 cat $BUILDDIR/structfile.struct $i.label > $i.struct
466 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
467 cp size.[c,h] $BUILDDIR/specdir
468 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
469 echo $i >> $BUILDDIR/specs
471 done # iterate over all directories
477 echo > $BUILDDIR/checkers.h
478 for i in `cat $BUILDDIR/specs`
480 gcc -O0 -g -fbounds-check -c $i\_aux.c
481 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
485 #build and link everything
490 MAKEFILE="Makefile.raw"
496 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
500 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DCACHEFLUSH"
505 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
510 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
514 then # profile version
515 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
518 if $ACCURATEPROFILEFLAG
519 then # accurateprofile version
520 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DACCURATEPROFILE"
525 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
529 then #INTERRUPT version
530 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
531 fi #INTERRUPT version
535 MAKEFILE="$MAKEFILE.io"
536 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
538 MAKEFILE="$MAKEFILE.$RAWCONFIG"
541 cp $ROBUSTROOT/Runtime/RAW/$MAKEFILE ./Makefile
546 cp ../Runtime/RAW/*.c ./
547 cp ../Runtime/RAW/*.h ./
548 cp ../Runtime/RAW/*.S ./
549 cp ../Runtime/RAW/*.s ./
550 cp ../tmpbuilddirectory/*.c ./
551 cp ../tmpbuilddirectory/*.h ./
557 TILERADIR="$CURDIR/tilera"
558 MAKEFILE="Makefile.tilera.$TILERACONFIG"
559 SIMHVC="sim.hvc.$TILERACONFIG"
560 PCIHVC="pci.hvc.$TILERACONFIG"
566 export TILERACFLAGS="-DTASK -DMULTICORE"
570 TILERACFLAGS="${TILERACFLAGS} -DCACHEFLUSH"
575 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
580 TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
584 then # profile version
585 TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
588 if $ACCURATEPROFILEFLAG
589 then # accurateprofile version
590 TILERACFLAGS="${TILERACFLAGS} -DACCURATEPROFILE"
595 TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
599 then #INTERRUPT version
600 TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
601 fi #INTERRUPT version
603 cp $ROBUSTROOT/Tilera/Runtime/$MAKEFILE ./Makefile
604 cp $ROBUSTROOT/Tilera/Runtime/$SIMHVC ./sim.hvc
605 cp $ROBUSTROOT/Tilera/Runtime/$PCIHVC ./pci.hvc
606 cp $ROBUSTROOT/Tilera/Runtime/bamboo-vmlinux-pci.hvc ./bamboo-vmlinux-pci.hvc
607 cp ../Runtime/multicoretask.c ./
608 cp ../Runtime/multicoreruntime.c ./
609 cp ../Runtime/Queue.c ./
610 cp ../Runtime/file.c ./
611 cp ../Runtime/math.c ./
612 cp ../Runtime/object.c ./
613 cp ../Runtime/GenericHashtable.c ./
614 cp ../Runtime/SimpleHash.c ./
615 cp ../Runtime/ObjectHash.c ./
616 cp ../Runtime/socket.c ./
617 cp ../Runtime/mem.c ./
618 cp ../Runtime/GenericHashtable.h ./
619 cp ../Runtime/mem.h ./
620 cp ../Runtime/multicoreruntime.h ./
621 cp ../Runtime/object.h ./
622 cp ../Runtime/ObjectHash.h ./
623 cp ../Runtime/Queue.h ./
624 cp ../Runtime/runtime.h ./
625 cp ../Runtime/SimpleHash.h ./
626 cp ../Tilera/Runtime/*.c ./
627 cp ../Tilera/Runtime/*.h ./
628 cp ../Tilera/lib/* ./
629 cp ../tmpbuilddirectory/*.c ./
630 cp ../tmpbuilddirectory/*.h ./
634 else #!RAWFLAG && !TILERAFLAG
637 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
642 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
644 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
647 FILES="$RUNTIMEFILE \
648 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
649 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
650 $ROBUSTROOT/Runtime/ObjectHash.c \
651 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
652 $ROBUSTROOT/Runtime/math.c \
653 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
657 FILES="$FILES $ROBUSTROOT/Runtime/memcpy32.o $ROBUSTROOT/Runtime/instrset32.o"
662 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
663 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"
668 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$DSMRUNTIME"
669 FILES="$FILES $DSMRUNTIME/stmlock.c $DSMRUNTIME/singleTMCommit.c $DSMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c"
674 FILES="$FILES $DSMRUNTIME/abortreaders.c"
679 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
684 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
685 FILES="$FILES $ROBUSTROOT/Runtime/psemaphore.c"
686 FILES="$FILES $ROBUSTROOT/Runtime/workschedule.c"
691 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
694 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
696 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
699 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
701 if $THREADSIMULATEFLAG
703 # -lpthread for pthread functions, -lrt for message queue functions
704 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
710 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
711 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
716 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
721 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
722 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
727 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
732 gcc -S $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
733 -c tmpbuilddirectory/methods.c -lm
738 gcc $INCLUDES $EXTRAOPTIONS \
739 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
741 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
742 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin