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 "-thread use support for multiple threads"
50 echo "-optimize call gcc with -O9 (optimize)"
51 echo "-nooptimize call gcc with -O0 (do not optimize)"
52 echo -curdir directory
53 echo -mainclass class with main method
55 echo -nojava do not run bristlecone compiler
56 echo -instructionfailures inject code for instructionfailures
57 echo -profile build with profile options
58 echo "-useio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
59 echo "-enable-assertions execute assert statements during compilation"
60 echo -justanalyze exit after compiler analyses complete
65 ROBUSTROOT=~/research/Robust/src
66 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
67 REPAIRROOT=~/research/Repair/RepairCompiler/
88 THREADSIMULATEFLAG=false;
99 EXITAFTERANALYSIS=false
109 if [[ $1 = '-help' ]]
113 elif [[ $1 = '-justanalyze' ]]
115 EXITAFTERANALYSIS=true
116 elif [[ $1 = '-abortreaders' ]]
119 EXTRAOPTIONS="$EXTRAOPTIONS -DABORTREADERS"
120 JAVAOPTS="$JAVAOPTS -abortreaders"
121 elif [[ $1 = '-robustroot' ]]
125 elif [[ $1 = '-nojava' ]]
128 elif [[ $1 = '-garbagestats' ]]
130 EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
131 elif [[ $1 = '-64bit' ]]
133 EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64"
134 elif [[ $1 = '-fastcheck' ]]
136 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
137 JAVAOPTS="$JAVAOPTS -fastcheck"
143 elif [[ $1 = '-mainclass' ]]
145 JAVAOPTS="$JAVAOPTS -mainclass $2"
147 elif [[ $1 = '-selfloop' ]]
149 JAVAOPTS="$JAVAOPTS -selfloop $2"
151 elif [[ $1 = '-excprefetch' ]]
153 JAVAOPTS="$JAVAOPTS -excprefetch $2"
155 elif [[ $1 = '-dsm' ]]
157 JAVAOPTS="$JAVAOPTS -dsm"
159 elif [[ $1 = '-fastmemcpy' ]]
162 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTMEMCPY"
163 elif [[ $1 = '-singleTM' ]]
165 JAVAOPTS="$JAVAOPTS -singleTM"
166 EXTRAOPTIONS="$EXTRAOPTIONS -DSTM"
168 elif [[ $1 = '-stmdebug' ]]
170 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMDEBUG"
171 elif [[ $1 = '-stmstats' ]]
173 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMSTATS"
174 elif [[ $1 = '-prefetch' ]]
176 JAVAOPTS="$JAVAOPTS -prefetch"
177 elif [[ $1 = '-transstats' ]]
179 EXTRAOPTIONS="$EXTRAOPTIONS -DTRANSSTATS"
180 elif [[ $1 = '-printflat' ]]
182 JAVAOPTS="$JAVAOPTS -printflat"
183 elif [[ $1 = '-trueprob' ]]
185 JAVAOPTS="$JAVAOPTS -trueprob $2"
187 elif [[ $1 = '-mac' ]]
189 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
190 elif [[ $1 = '-profile' ]]
193 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
194 elif [[ $1 = '-useio' ]]
197 elif [[ $1 = '-taskstate' ]]
199 JAVAOPTS="$JAVAOPTS -taskstate"
200 elif [[ $1 = '-tagstate' ]]
202 JAVAOPTS="$JAVAOPTS -tagstate"
203 elif [[ $1 = '-scheduling' ]]
205 JAVAOPTS="$JAVAOPTS -scheduling"
206 elif [[ $1 = '-multicore' ]]
209 JAVAOPTS="$JAVAOPTS -multicore"
210 elif [[ $1 = '-numcore' ]]
212 JAVAOPTS="$JAVAOPTS -numcore $2"
214 elif [[ $1 = '-raw' ]]
217 JAVAOPTS="$JAVAOPTS -raw"
218 elif [[ $1 = '-tilera' ]]
221 elif [[ $1 = '-tileraconfig' ]]
225 elif [[ $1 = '-cacheflush' ]]
228 elif [[ $1 = '-rawconfig' ]]
232 elif [[ $1 = '-interrupt' ]]
235 elif [[ $1 = '-threadsimulate' ]]
237 THREADSIMULATEFLAG=true
238 elif [[ $1 = '-abcclose' ]]
240 JAVAOPTS="$JAVAOPTS -abcclose"
241 elif [[ $1 = '-optional' ]]
243 JAVAOPTS="$JAVAOPTS -optional"
245 elif [[ $1 = '-dmalloc' ]]
248 elif [[ $1 = '-recover' ]]
251 JAVAOPTS="$JAVAOPTS -task"
252 elif [[ $1 = '-useprofile' ]]
254 JAVAOPTS="$JAVAOPTS -useprofile"
255 elif [[ $1 = '-webinterface' ]]
257 JAVAOPTS="$JAVAOPTS -webinterface"
258 elif [[ $1 = '-instructionfailures' ]]
260 JAVAOPTS="$JAVAOPTS -instructionfailures"
261 elif [[ $1 = '-joptimize' ]]
263 JAVAOPTS="$JAVAOPTS -optimize"
264 elif [[ $1 = '-dcopts' ]]
266 JAVAOPTS="$JAVAOPTS -dcopts"
267 elif [[ $1 = '-mlp' ]]
269 JAVAOPTS="$JAVAOPTS -mlp"
270 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread"
271 elif [[ $1 = '-mlpdebug' ]]
273 JAVAOPTS="$JAVAOPTS -mlpdebug"
274 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread"
275 elif [[ $1 = '-check' ]]
278 JAVAOPTS="$JAVAOPTS -conscheck"
279 elif [[ $1 = '-enable-assertions' ]]
281 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
282 elif [[ $1 = '-specdir' ]]
288 elif [[ $1 = '-debug' ]]
291 EXTRAOPTIONS="$EXTRAOPTIONS -g -rdynamic"
292 elif [[ $1 = '-rawpath' ]]
295 elif [[ $1 = '-runtimedebug' ]]
297 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
298 elif [[ $1 = '-dsmcaching' ]]
300 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
301 elif [[ $1 = '-rangeprefetch' ]]
303 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
304 elif [[ $1 = '-nooptimize' ]]
306 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
307 elif [[ $1 = '-optimize' ]]
309 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
310 elif [[ $1 = '-thread' ]]
312 JAVAOPTS="$JAVAOPTS -thread"
313 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
315 elif [[ $1 = '-distributioninfo' ]]
317 JAVAOPTS="$JAVAOPTS -distributioninfo"
318 elif [[ $1 = '-curdir' ]]
322 elif [[ $1 = '-outputdir' ]]
324 JAVAOPTS="$JAVAOPTS -outputdir $2"
327 SRCFILES="$SRCFILES $1"
332 BUILDDIR="$CURDIR/tmpbuilddirectory"
340 if $CHECKFLAG #Generate structure files for repair tool
342 JAVAOPTS="$JAVAOPTS -struct structfile"
352 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
354 #base bristlecone files
355 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
361 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
364 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
367 #threading java stuff
368 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
371 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
374 # Build bristlecone/java sources
378 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx800m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
379 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
380 -dir $BUILDDIR $JAVAOPTS $SRCFILES
384 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
387 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx600m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
388 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
395 if $EXITAFTERANALYSIS
400 # Build all of the consistency specs
402 if $CHECKFLAG # CHECKFLAG
405 mkdir $BUILDDIR/specdir
406 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
408 echo > $BUILDDIR/specs
410 # compile specs into C code
411 for i in * # iterate over all directories
413 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
416 cat $BUILDDIR/structfile.struct $i.label > $i.struct
417 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
418 cp size.[c,h] $BUILDDIR/specdir
419 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
420 echo $i >> $BUILDDIR/specs
422 done # iterate over all directories
428 echo > $BUILDDIR/checkers.h
429 for i in `cat $BUILDDIR/specs`
431 gcc -O0 -g -fbounds-check -c $i\_aux.c
432 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
436 #build and link everything
441 MAKEFILE="Makefile.raw"
447 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
451 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DCACHEFLUSH"
456 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
461 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
465 then # profile version
466 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
471 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
475 then #INTERRUPT version
476 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
477 fi #INTERRUPT version
481 MAKEFILE="$MAKEFILE.io"
482 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
484 MAKEFILE="$MAKEFILE.$RAWCONFIG"
487 cp $ROBUSTROOT/Runtime/RAW/$MAKEFILE ./Makefile
492 cp ../Runtime/RAW/*.c ./
493 cp ../Runtime/RAW/*.h ./
494 cp ../Runtime/RAW/*.S ./
495 cp ../Runtime/RAW/*.s ./
496 cp ../tmpbuilddirectory/*.c ./
497 cp ../tmpbuilddirectory/*.h ./
503 TILERADIR="$CURDIR/tilera"
504 MAKEFILE="Makefile.tilera.$TILERACONFIG"
505 SIMHVC="sim.hvc.$TILERACONFIG"
506 PCIHVC="pci.hvc.$TILERACONFIG"
512 export TILERACFLAGS="-DTASK -DMULTICORE"
516 TILERACFLAGS="${TILERACFLAGS} -DCACHEFLUSH"
521 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
526 TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
530 then # profile version
531 TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
536 TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
540 then #INTERRUPT version
541 TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
542 fi #INTERRUPT version
544 cp $ROBUSTROOT/Tilera/Runtime/$MAKEFILE ./Makefile
545 cp $ROBUSTROOT/Tilera/Runtime/$SIMHVC ./sim.hvc
546 cp $ROBUSTROOT/Tilera/Runtime/$PCIHVC ./pci.hvc
547 cp ../Runtime/multicoretask.c ./
548 cp ../Runtime/multicoreruntime.c ./
549 cp ../Runtime/Queue.c ./
550 cp ../Runtime/file.c ./
551 cp ../Runtime/math.c ./
552 cp ../Runtime/object.c ./
553 cp ../Runtime/GenericHashtable.c ./
554 cp ../Runtime/SimpleHash.c ./
555 cp ../Runtime/ObjectHash.c ./
556 cp ../Runtime/socket.c ./
557 cp ../Runtime/mem.c ./
558 cp ../Runtime/GenericHashtable.h ./
559 cp ../Runtime/mem.h ./
560 cp ../Runtime/multicoreruntime.h ./
561 cp ../Runtime/object.h ./
562 cp ../Runtime/ObjectHash.h ./
563 cp ../Runtime/Queue.h ./
564 cp ../Runtime/runtime.h ./
565 cp ../Runtime/SimpleHash.h ./
566 cp ../Tilera/Runtime/*.c ./
567 cp ../Tilera/Runtime/*.h ./
568 cp ../Tilera/lib/* ./
569 cp ../tmpbuilddirectory/*.c ./
570 cp ../tmpbuilddirectory/*.h ./
572 else #!RAWFLAG && !TILERAFLAG
575 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
580 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
582 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
585 FILES="$RUNTIMEFILE \
586 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
587 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
588 $ROBUSTROOT/Runtime/ObjectHash.c \
589 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
590 $ROBUSTROOT/Runtime/math.c \
591 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
595 FILES="$FILES $ROBUSTROOT/Runtime/memcpy32.o $ROBUSTROOT/Runtime/instrset32.o"
600 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
601 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"
606 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$DSMRUNTIME"
607 FILES="$FILES $DSMRUNTIME/stmlock.c $DSMRUNTIME/singleTMCommit.c $DSMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c"
612 FILES="$FILES $DSMRUNTIME/abortreaders.c"
617 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
622 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
627 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
630 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
632 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
635 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
637 if $THREADSIMULATEFLAG
639 # -lpthread for pthread functions, -lrt for message queue functions
640 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
646 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
647 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
652 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
657 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
658 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
663 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
668 gcc $INCLUDES $EXTRAOPTIONS \
669 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
671 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
672 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin