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 elif [[ $1 = '-mlpdebug' ]]
272 JAVAOPTS="$JAVAOPTS -mlpdebug"
273 elif [[ $1 = '-check' ]]
276 JAVAOPTS="$JAVAOPTS -conscheck"
277 elif [[ $1 = '-enable-assertions' ]]
279 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
280 elif [[ $1 = '-specdir' ]]
286 elif [[ $1 = '-debug' ]]
289 EXTRAOPTIONS="$EXTRAOPTIONS -g -rdynamic"
290 elif [[ $1 = '-rawpath' ]]
293 elif [[ $1 = '-runtimedebug' ]]
295 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
296 elif [[ $1 = '-dsmcaching' ]]
298 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
299 elif [[ $1 = '-rangeprefetch' ]]
301 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
302 elif [[ $1 = '-nooptimize' ]]
304 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
305 elif [[ $1 = '-optimize' ]]
307 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
308 elif [[ $1 = '-thread' ]]
310 JAVAOPTS="$JAVAOPTS -thread"
311 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
313 elif [[ $1 = '-distributioninfo' ]]
315 JAVAOPTS="$JAVAOPTS -distributioninfo"
316 elif [[ $1 = '-curdir' ]]
320 elif [[ $1 = '-outputdir' ]]
322 JAVAOPTS="$JAVAOPTS -outputdir $2"
325 SRCFILES="$SRCFILES $1"
330 BUILDDIR="$CURDIR/tmpbuilddirectory"
338 if $CHECKFLAG #Generate structure files for repair tool
340 JAVAOPTS="$JAVAOPTS -struct structfile"
350 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
352 #base bristlecone files
353 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
359 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
362 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
365 #threading java stuff
366 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
369 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
372 # Build bristlecone/java sources
376 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx800m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
377 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
378 -dir $BUILDDIR $JAVAOPTS $SRCFILES
382 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
385 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx600m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
386 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
393 if $EXITAFTERANALYSIS
398 # Build all of the consistency specs
400 if $CHECKFLAG # CHECKFLAG
403 mkdir $BUILDDIR/specdir
404 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
406 echo > $BUILDDIR/specs
408 # compile specs into C code
409 for i in * # iterate over all directories
411 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
414 cat $BUILDDIR/structfile.struct $i.label > $i.struct
415 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
416 cp size.[c,h] $BUILDDIR/specdir
417 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
418 echo $i >> $BUILDDIR/specs
420 done # iterate over all directories
426 echo > $BUILDDIR/checkers.h
427 for i in `cat $BUILDDIR/specs`
429 gcc -O0 -g -fbounds-check -c $i\_aux.c
430 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
434 #build and link everything
439 MAKEFILE="Makefile.raw"
445 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
449 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DCACHEFLUSH"
454 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
459 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
463 then # profile version
464 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
469 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
473 then #INTERRUPT version
474 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
475 fi #INTERRUPT version
479 MAKEFILE="$MAKEFILE.io"
480 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
482 MAKEFILE="$MAKEFILE.$RAWCONFIG"
485 cp $ROBUSTROOT/Runtime/RAW/$MAKEFILE ./Makefile
490 cp ../Runtime/RAW/*.c ./
491 cp ../Runtime/RAW/*.h ./
492 cp ../Runtime/RAW/*.S ./
493 cp ../Runtime/RAW/*.s ./
494 cp ../tmpbuilddirectory/*.c ./
495 cp ../tmpbuilddirectory/*.h ./
501 TILERADIR="$CURDIR/tilera"
502 MAKEFILE="Makefile.tilera.$TILERACONFIG"
503 SIMHVC="sim.hvc.$TILERACONFIG"
509 export TILERACFLAGS="-DTASK -DMULTICORE"
513 TILERACFLAGS="${TILERACFLAGS} -DCACHEFLUSH"
518 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
523 TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
527 then # profile version
528 TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
533 TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
537 then #INTERRUPT version
538 TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
539 fi #INTERRUPT version
541 cp $ROBUSTROOT/Runtime/Tilera/$MAKEFILE ./Makefile
542 cp $ROBUSTROOT/Runtime/Tilera/$SIMHVC ./sim.hvc
543 cp ../Runtime/multicoretask.c ./
544 cp ../Runtime/multicoreruntime.c ./
545 cp ../Runtime/Queue.c ./
546 cp ../Runtime/file.c ./
547 cp ../Runtime/math.c ./
548 cp ../Runtime/object.c ./
549 cp ../Runtime/GenericHashtable.c ./
550 cp ../Runtime/SimpleHash.c ./
551 cp ../Runtime/ObjectHash.c ./
552 cp ../Runtime/socket.c ./
553 cp ../Runtime/mem.c ./
554 cp ../Runtime/GenericHashtable.h ./
555 cp ../Runtime/mem.h ./
556 cp ../Runtime/multicoreruntime.h ./
557 cp ../Runtime/object.h ./
558 cp ../Runtime/ObjectHash.h ./
559 cp ../Runtime/Queue.h ./
560 cp ../Runtime/runtime.h ./
561 cp ../Runtime/SimpleHash.h ./
562 cp ../Runtime/Tilera/*.c ./
563 cp ../Runtime/Tilera/*.h ./
564 cp ../tmpbuilddirectory/*.c ./
565 cp ../tmpbuilddirectory/*.h ./
567 else #!RAWFLAG && !TILERAFLAG
570 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
575 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
577 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
580 FILES="$RUNTIMEFILE \
581 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
582 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
583 $ROBUSTROOT/Runtime/ObjectHash.c \
584 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
585 $ROBUSTROOT/Runtime/math.c \
586 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
590 FILES="$FILES $ROBUSTROOT/Runtime/memcpy32.o $ROBUSTROOT/Runtime/instrset32.o"
595 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
596 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"
601 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$DSMRUNTIME"
602 FILES="$FILES $DSMRUNTIME/stmlock.c $DSMRUNTIME/singleTMCommit.c $DSMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c"
607 FILES="$FILES $DSMRUNTIME/abortreaders.c"
612 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
617 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
622 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
625 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
627 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
630 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
632 if $THREADSIMULATEFLAG
634 # -lpthread for pthread functions, -lrt for message queue functions
635 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
641 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
642 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
647 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
652 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
653 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
658 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
663 gcc $INCLUDES $EXTRAOPTIONS \
664 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
666 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
667 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin