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 -abortreaders abort readers immediately
9 echo -trueprob double - probabiltiy of true branch
10 echo -dsmcaching -enable caching in dsm runtime
11 echo -mac distributed shared memory mac support
12 echo -check generate check code
13 echo -dmalloc link in dmalloc
14 echo -64bit compile for 64 bit machine
15 echo -joptimize java compiler optimizations
16 echo -dcopts conflict optimizations for transactional memory
17 echo -recover compile task code
18 echo -fastcheck fast checkpointing for Bristlecone
19 echo -specdir directory
20 echo -printflat print out flat representation
21 echo -selfloop task - this task cannot self loop forever
22 echo "-excprefetch methoddescriptor - exclude prefetches for this method (specified as class.method)"
23 echo -taskstate do task state analysis
24 echo -tagstate do tag state analysis
25 echo -scheduling do task scheduling
26 echo -multicore generate multi-core version binary
27 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
28 echo "-cacheflush enable cache flush in raw version binary (should be used togethere with -raw)"
29 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
30 echo "-rawpath print out execute path information for raw version (should be used together with -raw)"
31 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
32 echo -printscheduling print out scheduling graphs
33 echo -printschedulesim print out scheduling simulator result graphs
34 echo -abcclose close the array boundary check
35 echo "-tilera generate tilera version binary (should be used together with -multicore"
36 echo "-raw generate raw version binary (should be used together with -multicore)"
37 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
38 echo -threadsimulate generate multi-thread simulate version binary
39 echo -optional enable optional
40 echo -debug generate debug symbols
41 echo -prefetch do prefetch analysis
42 echo -transstats generates transaction stats on commits and aborts
43 echo -garbagestats Print garbage collection statistics
44 echo -webinterface enable web interface
45 echo -runtimedebug printout runtime debug messages
46 echo "-thread use support for multiple threads"
47 echo "-optimize call gcc with -O9 (optimize)"
48 echo "-nooptimize call gcc with -O0 (do not optimize)"
49 echo -curdir directory
50 echo -mainclass class with main method
52 echo -nojava do not run bristlecone compiler
53 echo -instructionfailures inject code for instructionfailures
54 echo -profile build with profile options
55 echo "-useio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
56 echo "-enable-assertions execute assert statements during compilation"
57 echo -justanalyze exit after compiler analyses complete
62 ROBUSTROOT=~/research/Robust/src
63 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
64 REPAIRROOT=~/research/Repair/RepairCompiler/
83 THREADSIMULATEFLAG=false;
94 EXITAFTERANALYSIS=false
104 if [[ $1 = '-help' ]]
108 elif [[ $1 = '-justanalyze' ]]
110 EXITAFTERANALYSIS=true
111 elif [[ $1 = '-abortreaders' ]]
114 EXTRAOPTIONS="$EXTRAOPTIONS -DABORTREADERS"
115 JAVAOPTS="$JAVAOPTS -abortreaders"
116 elif [[ $1 = '-robustroot' ]]
120 elif [[ $1 = '-nojava' ]]
123 elif [[ $1 = '-garbagestats' ]]
125 EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
126 elif [[ $1 = '-64bit' ]]
128 EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64"
129 elif [[ $1 = '-fastcheck' ]]
131 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
132 JAVAOPTS="$JAVAOPTS -fastcheck"
138 elif [[ $1 = '-mainclass' ]]
140 JAVAOPTS="$JAVAOPTS -mainclass $2"
142 elif [[ $1 = '-selfloop' ]]
144 JAVAOPTS="$JAVAOPTS -selfloop $2"
146 elif [[ $1 = '-excprefetch' ]]
148 JAVAOPTS="$JAVAOPTS -excprefetch $2"
150 elif [[ $1 = '-dsm' ]]
152 JAVAOPTS="$JAVAOPTS -dsm"
154 elif [[ $1 = '-singleTM' ]]
156 JAVAOPTS="$JAVAOPTS -singleTM"
157 EXTRAOPTIONS="$EXTRAOPTIONS -DSTM"
159 elif [[ $1 = '-stmdebug' ]]
161 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMDEBUG"
162 elif [[ $1 = '-prefetch' ]]
164 JAVAOPTS="$JAVAOPTS -prefetch"
165 elif [[ $1 = '-transstats' ]]
167 EXTRAOPTIONS="$EXTRAOPTIONS -DTRANSSTATS"
168 elif [[ $1 = '-printflat' ]]
170 JAVAOPTS="$JAVAOPTS -printflat"
171 elif [[ $1 = '-trueprob' ]]
173 JAVAOPTS="$JAVAOPTS -trueprob $2"
175 elif [[ $1 = '-mac' ]]
177 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
178 elif [[ $1 = '-profile' ]]
181 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
182 elif [[ $1 = '-useio' ]]
185 elif [[ $1 = '-taskstate' ]]
187 JAVAOPTS="$JAVAOPTS -taskstate"
188 elif [[ $1 = '-tagstate' ]]
190 JAVAOPTS="$JAVAOPTS -tagstate"
191 elif [[ $1 = '-scheduling' ]]
193 JAVAOPTS="$JAVAOPTS -scheduling"
194 elif [[ $1 = '-multicore' ]]
197 JAVAOPTS="$JAVAOPTS -multicore"
198 elif [[ $1 = '-numcore' ]]
200 JAVAOPTS="$JAVAOPTS -numcore $2"
202 elif [[ $1 = '-raw' ]]
205 elif [[ $1 = '-tilera' ]]
208 elif [[ $1 = '-cacheflush' ]]
211 elif [[ $1 = '-rawconfig' ]]
215 elif [[ $1 = '-interrupt' ]]
218 elif [[ $1 = '-threadsimulate' ]]
220 THREADSIMULATEFLAG=true
221 elif [[ $1 = '-abcclose' ]]
223 JAVAOPTS="$JAVAOPTS -abcclose"
224 elif [[ $1 = '-optional' ]]
226 JAVAOPTS="$JAVAOPTS -optional"
228 elif [[ $1 = '-dmalloc' ]]
231 elif [[ $1 = '-recover' ]]
234 JAVAOPTS="$JAVAOPTS -task"
235 elif [[ $1 = '-useprofile' ]]
237 JAVAOPTS="$JAVAOPTS -useprofile"
238 elif [[ $1 = '-webinterface' ]]
240 JAVAOPTS="$JAVAOPTS -webinterface"
241 elif [[ $1 = '-instructionfailures' ]]
243 JAVAOPTS="$JAVAOPTS -instructionfailures"
244 elif [[ $1 = '-joptimize' ]]
246 JAVAOPTS="$JAVAOPTS -optimize"
247 elif [[ $1 = '-dcopts' ]]
249 JAVAOPTS="$JAVAOPTS -dcopts"
250 elif [[ $1 = '-mlp' ]]
252 JAVAOPTS="$JAVAOPTS -mlp"
253 elif [[ $1 = '-mlpdebug' ]]
255 JAVAOPTS="$JAVAOPTS -mlpdebug"
256 elif [[ $1 = '-check' ]]
259 JAVAOPTS="$JAVAOPTS -conscheck"
260 elif [[ $1 = '-enable-assertions' ]]
262 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
263 elif [[ $1 = '-specdir' ]]
269 elif [[ $1 = '-debug' ]]
272 EXTRAOPTIONS="$EXTRAOPTIONS -g"
273 elif [[ $1 = '-rawpath' ]]
276 elif [[ $1 = '-runtimedebug' ]]
278 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
279 elif [[ $1 = '-dsmcaching' ]]
281 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
282 elif [[ $1 = '-rangeprefetch' ]]
284 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
285 elif [[ $1 = '-nooptimize' ]]
287 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
288 elif [[ $1 = '-optimize' ]]
290 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
291 elif [[ $1 = '-thread' ]]
293 JAVAOPTS="$JAVAOPTS -thread"
294 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
296 elif [[ $1 = '-distributioninfo' ]]
298 JAVAOPTS="$JAVAOPTS -distributioninfo"
299 elif [[ $1 = '-curdir' ]]
303 elif [[ $1 = '-outputdir' ]]
305 JAVAOPTS="$JAVAOPTS -outputdir $2"
308 SRCFILES="$SRCFILES $1"
313 BUILDDIR="$CURDIR/tmpbuilddirectory"
321 if $CHECKFLAG #Generate structure files for repair tool
323 JAVAOPTS="$JAVAOPTS -struct structfile"
333 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
335 #base bristlecone files
336 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
342 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
345 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
348 #threading java stuff
349 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
352 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
355 # Build bristlecone/java sources
359 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx800m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
360 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
361 -dir $BUILDDIR $JAVAOPTS $SRCFILES
365 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
368 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx600m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
369 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
376 if $EXITAFTERANALYSIS
381 # Build all of the consistency specs
383 if $CHECKFLAG # CHECKFLAG
386 mkdir $BUILDDIR/specdir
387 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
389 echo > $BUILDDIR/specs
391 # compile specs into C code
392 for i in * # iterate over all directories
394 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
397 cat $BUILDDIR/structfile.struct $i.label > $i.struct
398 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
399 cp size.[c,h] $BUILDDIR/specdir
400 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
401 echo $i >> $BUILDDIR/specs
403 done # iterate over all directories
409 echo > $BUILDDIR/checkers.h
410 for i in `cat $BUILDDIR/specs`
412 gcc -O0 -g -fbounds-check -c $i\_aux.c
413 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
417 #build and link everything
422 MAKEFILE="Makefile.raw"
428 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
432 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DCACHEFLUSH"
437 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
442 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
446 then # profile version
447 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
452 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
456 then #INTERRUPT version
457 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
458 fi #INTERRUPT version
462 MAKEFILE="$MAKEFILE.io"
463 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
465 MAKEFILE="$MAKEFILE.$RAWCONFIG"
468 cp $ROBUSTROOT/Runtime/RAW/$MAKEFILE ./Makefile
473 cp ../Runtime/RAW/*.c ./
474 cp ../Runtime/RAW/*.h ./
475 cp ../Runtime/RAW/*.S ./
476 cp ../Runtime/RAW/*.s ./
477 cp ../tmpbuilddirectory/*.c ./
478 cp ../tmpbuilddirectory/*.h ./
484 TILERADIR="$CURDIR/tilera"
485 MAKEFILE="Makefile.tilera"
491 export TILERACFLAGS="-DTASK -DMULTICORE"
495 TILERACFLAGS="${TILERACFLAGS} -DCACHEFLUSH"
500 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
505 TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
509 then # profile version
510 TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
515 TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
519 then #INTERRUPT version
520 TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
521 fi #INTERRUPT version
523 cp $ROBUSTROOT/Runtime/Tilera/$MAKEFILE ./Makefile
524 cp ../Runtime/multicoretask.c ./
525 cp ../Runtime/multicoreruntime.c ./
526 cp ../Runtime/Queue.c ./
527 cp ../Runtime/file.c ./
528 cp ../Runtime/math.c ./
529 cp ../Runtime/object.c ./
530 cp ../Runtime/GenericHashtable.c ./
531 cp ../Runtime/SimpleHash.c ./
532 cp ../Runtime/ObjectHash.c ./
533 cp ../Runtime/socket.c ./
534 cp ../Runtime/taskdefs.c ./
535 cp ../Runtime/methods.c ./
536 cp ../Runtime/mem.c ./
537 cp ../Runtime/GenericHashtable.h ./
538 cp ../Runtime/mem.h ./
539 cp ../Runtime/multicoreruntime.h ./
540 cp ../Runtime/object.h ./
541 cp ../Runtime/ObjectHash.h ./
542 cp ../Runtime/Queue.h ./
543 cp ../Runtime/runtime.h ./
544 cp ../Runtime/SimpleHash.h ./
545 cp ../Runtime/Tilera/*.c ./
546 cp ../Runtime/Tilera/*.h ./
547 cp ../tmpbuilddirectory/*.c ./
548 cp ../tmpbuilddirectory/*.h ./
550 else #!RAWFLAG && !TILERAFLAG
553 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
558 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
560 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
563 FILES="$RUNTIMEFILE \
564 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
565 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
566 $ROBUSTROOT/Runtime/ObjectHash.c \
567 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
568 $ROBUSTROOT/Runtime/math.c \
569 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
573 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
574 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"
579 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$DSMRUNTIME"
580 FILES="$FILES $DSMRUNTIME/dsmlock.c $DSMRUNTIME/singleTMCommit.c $DSMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c"
585 FILES="$FILES $DSMRUNTIME/abortreaders.c"
590 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
595 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
600 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
603 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
605 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
608 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
610 if $THREADSIMULATEFLAG
612 # -lpthread for pthread functions, -lrt for message queue functions
613 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
619 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
620 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
625 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
630 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
631 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
636 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
641 gcc $INCLUDES $EXTRAOPTIONS \
642 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
644 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
645 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin