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 -32bit compile for 32 bit machine
18 echo -joptimize java compiler optimizations
19 echo -dcopts conflict optimizations for transactional memory
20 echo -recover compile task code
21 echo -fastcheck fast checkpointing for Bristlecone
22 echo -specdir directory
23 echo -printflat print out flat representation
24 echo -selfloop task - this task cannot self loop forever
25 echo "-excprefetch methoddescriptor - exclude prefetches for this method (specified as class.method)"
26 echo -taskstate do task state analysis
27 echo -tagstate do tag state analysis
28 echo -scheduling do task scheduling
29 echo -multicore generate multi-core version binary
30 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
31 echo "-cacheflush enable cache flush in raw version binary (should be used togethere with -raw)"
32 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
33 echo "-rawpath print out execute path information for raw version (should be used together with -raw)"
34 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
35 echo -printscheduling print out scheduling graphs
36 echo -printschedulesim print out scheduling simulator result graphs
37 echo -abcclose close the array boundary check
38 echo "-tilera generate tilera version binary (should be used together with -multicore"
39 echo "-tileraconfig config tilera simulator/pci as nxm (should be used together with -tilera)"
40 echo "-raw generate raw version binary (should be used together with -multicore)"
41 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
42 echo -threadsimulate generate multi-thread simulate version binary
43 echo -optional enable optional
44 echo -debug generate debug symbols
45 echo -prefetch do prefetch analysis
46 echo -transstats generates transaction stats on commits and aborts
47 echo -garbagestats Print garbage collection statistics
48 echo -webinterface enable web interface
49 echo -runtimedebug printout runtime debug messages
50 echo -inlineatomic depth inline methods inside of transactions to specified depth
51 echo "-thread use support for multiple threads"
52 echo "-optimize call gcc with -O9 (optimize)"
53 echo "-nooptimize call gcc with -O0 (do not optimize)"
54 echo -curdir directory
55 echo -mainclass class with main method
57 echo -nojava do not run bristlecone compiler
58 echo -instructionfailures inject code for instructionfailures
59 echo -profile build with profile options
60 echo "-useio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
61 echo "-enable-assertions execute assert statements during compilation"
62 echo -justanalyze exit after compiler analyses complete
67 ROBUSTROOT=~/research/Robust/src
68 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
69 REPAIRROOT=~/research/Repair/RepairCompiler/
90 THREADSIMULATEFLAG=false;
101 EXITAFTERANALYSIS=false
111 if [[ $1 = '-help' ]]
115 elif [[ $1 = '-justanalyze' ]]
117 EXITAFTERANALYSIS=true
118 elif [[ $1 = '-abortreaders' ]]
121 EXTRAOPTIONS="$EXTRAOPTIONS -DABORTREADERS"
122 JAVAOPTS="$JAVAOPTS -abortreaders"
123 elif [[ $1 = '-robustroot' ]]
127 elif [[ $1 = '-nojava' ]]
130 elif [[ $1 = '-garbagestats' ]]
132 EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
133 elif [[ $1 = '-64bit' ]]
135 EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64"
136 elif [[ $1 = '-32bit' ]]
138 EXTRAOPTIONS="$EXTRAOPTIONS -m32"
139 elif [[ $1 = '-fastcheck' ]]
141 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
142 JAVAOPTS="$JAVAOPTS -fastcheck"
148 elif [[ $1 = '-mainclass' ]]
150 JAVAOPTS="$JAVAOPTS -mainclass $2"
152 elif [[ $1 = '-selfloop' ]]
154 JAVAOPTS="$JAVAOPTS -selfloop $2"
156 elif [[ $1 = '-excprefetch' ]]
158 JAVAOPTS="$JAVAOPTS -excprefetch $2"
160 elif [[ $1 = '-dsm' ]]
162 JAVAOPTS="$JAVAOPTS -dsm"
164 elif [[ $1 = '-fastmemcpy' ]]
167 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTMEMCPY"
168 elif [[ $1 = '-singleTM' ]]
170 JAVAOPTS="$JAVAOPTS -singleTM"
171 EXTRAOPTIONS="$EXTRAOPTIONS -DSTM"
173 elif [[ $1 = '-stmdebug' ]]
175 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMDEBUG"
176 elif [[ $1 = '-stmstats' ]]
178 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMSTATS"
179 elif [[ $1 = '-prefetch' ]]
181 JAVAOPTS="$JAVAOPTS -prefetch"
182 elif [[ $1 = '-transstats' ]]
184 EXTRAOPTIONS="$EXTRAOPTIONS -DTRANSSTATS"
185 elif [[ $1 = '-printflat' ]]
187 JAVAOPTS="$JAVAOPTS -printflat"
188 elif [[ $1 = '-trueprob' ]]
190 JAVAOPTS="$JAVAOPTS -trueprob $2"
192 elif [[ $1 = '-inlineatomic' ]]
194 JAVAOPTS="$JAVAOPTS -inlineatomic $2"
196 elif [[ $1 = '-mac' ]]
198 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
199 elif [[ $1 = '-profile' ]]
202 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
203 elif [[ $1 = '-useio' ]]
206 elif [[ $1 = '-taskstate' ]]
208 JAVAOPTS="$JAVAOPTS -taskstate"
209 elif [[ $1 = '-tagstate' ]]
211 JAVAOPTS="$JAVAOPTS -tagstate"
212 elif [[ $1 = '-scheduling' ]]
214 JAVAOPTS="$JAVAOPTS -scheduling"
215 elif [[ $1 = '-multicore' ]]
218 JAVAOPTS="$JAVAOPTS -multicore"
219 elif [[ $1 = '-numcore' ]]
221 JAVAOPTS="$JAVAOPTS -numcore $2"
223 elif [[ $1 = '-raw' ]]
226 JAVAOPTS="$JAVAOPTS -raw"
227 elif [[ $1 = '-tilera' ]]
230 elif [[ $1 = '-tileraconfig' ]]
234 elif [[ $1 = '-cacheflush' ]]
237 elif [[ $1 = '-rawconfig' ]]
241 elif [[ $1 = '-interrupt' ]]
244 elif [[ $1 = '-threadsimulate' ]]
246 THREADSIMULATEFLAG=true
247 elif [[ $1 = '-abcclose' ]]
249 JAVAOPTS="$JAVAOPTS -abcclose"
250 elif [[ $1 = '-optional' ]]
252 JAVAOPTS="$JAVAOPTS -optional"
254 elif [[ $1 = '-dmalloc' ]]
257 elif [[ $1 = '-recover' ]]
260 JAVAOPTS="$JAVAOPTS -task"
261 elif [[ $1 = '-useprofile' ]]
263 JAVAOPTS="$JAVAOPTS -useprofile"
264 elif [[ $1 = '-webinterface' ]]
266 JAVAOPTS="$JAVAOPTS -webinterface"
267 elif [[ $1 = '-instructionfailures' ]]
269 JAVAOPTS="$JAVAOPTS -instructionfailures"
270 elif [[ $1 = '-joptimize' ]]
272 JAVAOPTS="$JAVAOPTS -optimize"
273 elif [[ $1 = '-dcopts' ]]
275 JAVAOPTS="$JAVAOPTS -dcopts"
276 elif [[ $1 = '-delaycomp' ]]
278 JAVAOPTS="$JAVAOPTS -delaycomp"
279 EXTRAOPTIONS="$EXTRAOPTIONS -DDELAYCOMP"
280 elif [[ $1 = '-minimize' ]]
282 JAVAOPTS="$JAVAOPTS -minimize"
283 elif [[ $1 = '-mlp' ]]
285 JAVAOPTS="$JAVAOPTS -mlp"
286 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread"
287 elif [[ $1 = '-mlpdebug' ]]
289 JAVAOPTS="$JAVAOPTS -mlpdebug"
290 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread"
291 elif [[ $1 = '-check' ]]
294 JAVAOPTS="$JAVAOPTS -conscheck"
295 elif [[ $1 = '-enable-assertions' ]]
297 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
298 elif [[ $1 = '-specdir' ]]
304 elif [[ $1 = '-debug' ]]
307 EXTRAOPTIONS="$EXTRAOPTIONS -g -rdynamic"
308 elif [[ $1 = '-rawpath' ]]
311 elif [[ $1 = '-runtimedebug' ]]
313 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
314 elif [[ $1 = '-dsmcaching' ]]
316 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
317 elif [[ $1 = '-rangeprefetch' ]]
319 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
320 elif [[ $1 = '-nooptimize' ]]
322 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
323 elif [[ $1 = '-optimize' ]]
325 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
326 elif [[ $1 = '-thread' ]]
328 JAVAOPTS="$JAVAOPTS -thread"
329 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
331 elif [[ $1 = '-distributioninfo' ]]
333 JAVAOPTS="$JAVAOPTS -distributioninfo"
334 elif [[ $1 = '-curdir' ]]
338 elif [[ $1 = '-outputdir' ]]
340 JAVAOPTS="$JAVAOPTS -outputdir $2"
343 SRCFILES="$SRCFILES $1"
348 BUILDDIR="$CURDIR/tmpbuilddirectory"
356 if $CHECKFLAG #Generate structure files for repair tool
358 JAVAOPTS="$JAVAOPTS -struct structfile"
368 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
370 #base bristlecone files
371 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
377 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
380 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
383 #threading java stuff
384 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
387 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
390 # Build bristlecone/java sources
394 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx800m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
395 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
396 -dir $BUILDDIR $JAVAOPTS $SRCFILES
400 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
403 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
404 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
411 if $EXITAFTERANALYSIS
416 # Build all of the consistency specs
418 if $CHECKFLAG # CHECKFLAG
421 mkdir $BUILDDIR/specdir
422 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
424 echo > $BUILDDIR/specs
426 # compile specs into C code
427 for i in * # iterate over all directories
429 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
432 cat $BUILDDIR/structfile.struct $i.label > $i.struct
433 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
434 cp size.[c,h] $BUILDDIR/specdir
435 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
436 echo $i >> $BUILDDIR/specs
438 done # iterate over all directories
444 echo > $BUILDDIR/checkers.h
445 for i in `cat $BUILDDIR/specs`
447 gcc -O0 -g -fbounds-check -c $i\_aux.c
448 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
452 #build and link everything
457 MAKEFILE="Makefile.raw"
463 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
467 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DCACHEFLUSH"
472 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
477 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
481 then # profile version
482 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
487 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
491 then #INTERRUPT version
492 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
493 fi #INTERRUPT version
497 MAKEFILE="$MAKEFILE.io"
498 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
500 MAKEFILE="$MAKEFILE.$RAWCONFIG"
503 cp $ROBUSTROOT/Runtime/RAW/$MAKEFILE ./Makefile
508 cp ../Runtime/RAW/*.c ./
509 cp ../Runtime/RAW/*.h ./
510 cp ../Runtime/RAW/*.S ./
511 cp ../Runtime/RAW/*.s ./
512 cp ../tmpbuilddirectory/*.c ./
513 cp ../tmpbuilddirectory/*.h ./
519 TILERADIR="$CURDIR/tilera"
520 MAKEFILE="Makefile.tilera.$TILERACONFIG"
521 SIMHVC="sim.hvc.$TILERACONFIG"
522 PCIHVC="pci.hvc.$TILERACONFIG"
528 export TILERACFLAGS="-DTASK -DMULTICORE"
532 TILERACFLAGS="${TILERACFLAGS} -DCACHEFLUSH"
537 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
542 TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
546 then # profile version
547 TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
552 TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
556 then #INTERRUPT version
557 TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
558 fi #INTERRUPT version
560 cp $ROBUSTROOT/Tilera/Runtime/$MAKEFILE ./Makefile
561 cp $ROBUSTROOT/Tilera/Runtime/$SIMHVC ./sim.hvc
562 cp $ROBUSTROOT/Tilera/Runtime/$PCIHVC ./pci.hvc
563 cp $ROBUSTROOT/Tilera/Runtime/bamboo-vmlinux-pci.hvc ./bamboo-vmlinux-pci.hvc
564 cp ../Runtime/multicoretask.c ./
565 cp ../Runtime/multicoreruntime.c ./
566 cp ../Runtime/Queue.c ./
567 cp ../Runtime/file.c ./
568 cp ../Runtime/math.c ./
569 cp ../Runtime/object.c ./
570 cp ../Runtime/GenericHashtable.c ./
571 cp ../Runtime/SimpleHash.c ./
572 cp ../Runtime/ObjectHash.c ./
573 cp ../Runtime/socket.c ./
574 cp ../Runtime/mem.c ./
575 cp ../Runtime/GenericHashtable.h ./
576 cp ../Runtime/mem.h ./
577 cp ../Runtime/multicoreruntime.h ./
578 cp ../Runtime/object.h ./
579 cp ../Runtime/ObjectHash.h ./
580 cp ../Runtime/Queue.h ./
581 cp ../Runtime/runtime.h ./
582 cp ../Runtime/SimpleHash.h ./
583 cp ../Tilera/Runtime/*.c ./
584 cp ../Tilera/Runtime/*.h ./
585 cp ../Tilera/lib/* ./
586 cp ../tmpbuilddirectory/*.c ./
587 cp ../tmpbuilddirectory/*.h ./
589 else #!RAWFLAG && !TILERAFLAG
592 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
597 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
599 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
602 FILES="$RUNTIMEFILE \
603 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
604 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
605 $ROBUSTROOT/Runtime/ObjectHash.c \
606 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
607 $ROBUSTROOT/Runtime/math.c \
608 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
612 FILES="$FILES $ROBUSTROOT/Runtime/memcpy32.o $ROBUSTROOT/Runtime/instrset32.o"
617 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
618 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"
623 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$DSMRUNTIME"
624 FILES="$FILES $DSMRUNTIME/stmlock.c $DSMRUNTIME/singleTMCommit.c $DSMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c"
629 FILES="$FILES $DSMRUNTIME/abortreaders.c"
634 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
639 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
640 FILES="$FILES $ROBUSTROOT/Runtime/psemaphore.c"
641 FILES="$FILES $ROBUSTROOT/Runtime/workschedule.c"
646 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
649 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
651 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
654 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
656 if $THREADSIMULATEFLAG
658 # -lpthread for pthread functions, -lrt for message queue functions
659 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
665 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
666 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
671 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
676 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
677 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
682 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
687 gcc $INCLUDES $EXTRAOPTIONS \
688 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
690 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
691 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin