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 -abortreaders abort readers immediately
8 echo -trueprob double - probabiltiy of true branch
9 echo -dsmcaching -enable caching in dsm runtime
10 echo -mac distributed shared memory mac support
11 echo -check generate check code
12 echo -dmalloc link in dmalloc
13 echo -64bit compile for 64 bit machine
14 echo -recover compile task code
15 echo -fastcheck fast checkpointing for Bristlecone
16 echo -specdir directory
17 echo -printflat print out flat representation
18 echo -selfloop task - this task cannot self loop forever
19 echo "-excprefetch methoddescriptor - exclude prefetches for this method (specified as class.method)"
20 echo -taskstate do task state analysis
21 echo -tagstate do tag state analysis
22 echo -scheduling do task scheduling
23 echo -multicore generate multi-core version binary
24 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
25 echo "-raw generate raw version binary (should be used together with -multicore)"
26 echo "-rawcacheflush enable cache flush in raw version binary (should be used togethere with -raw)"
27 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
28 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
29 echo "-rawpath print out execute path information for raw version (should be used together with -raw)"
30 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
31 echo -threadsimulate generate multi-thread simulate version binary
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 -optional enable optional
36 echo -debug generate debug symbols
37 echo -prefetch do prefetch analysis
38 echo -transstats generates transaction stats on commits and aborts
39 echo -garbagestats Print garbage collection statistics
40 echo -webinterface enable web interface
41 echo -runtimedebug printout runtime debug messages
42 echo "-thread use support for multiple threads"
43 echo "-optimize call gcc with -O9 (optimize)"
44 echo "-nooptimize call gcc with -O0 (do not optimize)"
45 echo -curdir directory
46 echo -mainclass class with main method
48 echo -nojava do not run bristlecone compiler
49 echo -instructionfailures inject code for instructionfailures
50 echo -profile build with profile options
51 echo "-rawuseio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
52 echo "-enable-assertions execute assert statements during compilation"
53 echo -justanalyze exit after compiler analyses complete
58 ROBUSTROOT=~/research/Robust/src
59 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
60 REPAIRROOT=~/research/Repair/RepairCompiler/
71 RAWCACHEFLUSHFLAG=false
78 THREADSIMULATEFLAG=false;
89 EXITAFTERANALYSIS=false
103 elif [[ $1 = '-justanalyze' ]]
105 EXITAFTERANALYSIS=true
106 elif [[ $1 = '-abortreaders' ]]
109 EXTRAOPTIONS="$EXTRAOPTIONS -DABORTREADERS"
110 JAVAOPTS="$JAVAOPTS -abortreaders"
111 elif [[ $1 = '-robustroot' ]]
115 elif [[ $1 = '-nojava' ]]
118 elif [[ $1 = '-garbagestats' ]]
120 EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
121 elif [[ $1 = '-64bit' ]]
123 EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64"
124 elif [[ $1 = '-fastcheck' ]]
126 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
127 JAVAOPTS="$JAVAOPTS -fastcheck"
133 elif [[ $1 = '-mainclass' ]]
135 JAVAOPTS="$JAVAOPTS -mainclass $2"
137 elif [[ $1 = '-selfloop' ]]
139 JAVAOPTS="$JAVAOPTS -selfloop $2"
141 elif [[ $1 = '-excprefetch' ]]
143 JAVAOPTS="$JAVAOPTS -excprefetch $2"
145 elif [[ $1 = '-dsm' ]]
147 JAVAOPTS="$JAVAOPTS -dsm"
149 elif [[ $1 = '-singleTM' ]]
151 JAVAOPTS="$JAVAOPTS -singleTM"
152 EXTRAOPTIONS="$EXTRAOPTIONS -DSTM"
154 elif [[ $1 = '-prefetch' ]]
156 JAVAOPTS="$JAVAOPTS -prefetch"
157 elif [[ $1 = '-transstats' ]]
159 EXTRAOPTIONS="$EXTRAOPTIONS -DTRANSSTATS"
160 elif [[ $1 = '-printflat' ]]
162 JAVAOPTS="$JAVAOPTS -printflat"
163 elif [[ $1 = '-trueprob' ]]
165 JAVAOPTS="$JAVAOPTS -trueprob $2"
167 elif [[ $1 = '-mac' ]]
169 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
170 elif [[ $1 = '-profile' ]]
173 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
174 elif [[ $1 = '-rawuseio' ]]
177 elif [[ $1 = '-taskstate' ]]
179 JAVAOPTS="$JAVAOPTS -taskstate"
180 elif [[ $1 = '-tagstate' ]]
182 JAVAOPTS="$JAVAOPTS -tagstate"
183 elif [[ $1 = '-scheduling' ]]
185 JAVAOPTS="$JAVAOPTS -scheduling"
186 elif [[ $1 = '-multicore' ]]
189 JAVAOPTS="$JAVAOPTS -multicore"
190 elif [[ $1 = '-numcore' ]]
192 JAVAOPTS="$JAVAOPTS -numcore $2"
194 elif [[ $1 = '-raw' ]]
197 JAVAOPTS="$JAVAOPTS -raw"
198 elif [[ $1 = '-rawcacheflush' ]]
200 RAWCACHEFLUSHFLAG=true
201 elif [[ $1 = '-rawconfig' ]]
205 elif [[ $1 = '-interrupt' ]]
208 elif [[ $1 = '-threadsimulate' ]]
210 THREADSIMULATEFLAG=true
211 elif [[ $1 = '-abcclose' ]]
213 JAVAOPTS="$JAVAOPTS -abcclose"
214 elif [[ $1 = '-optional' ]]
216 JAVAOPTS="$JAVAOPTS -optional"
218 elif [[ $1 = '-dmalloc' ]]
221 elif [[ $1 = '-recover' ]]
224 JAVAOPTS="$JAVAOPTS -task"
225 elif [[ $1 = '-useprofile' ]]
227 JAVAOPTS="$JAVAOPTS -useprofile"
228 elif [[ $1 = '-webinterface' ]]
230 JAVAOPTS="$JAVAOPTS -webinterface"
231 elif [[ $1 = '-instructionfailures' ]]
233 JAVAOPTS="$JAVAOPTS -instructionfailures"
234 elif [[ $1 = '-joptimize' ]]
236 JAVAOPTS="$JAVAOPTS -optimize"
238 elif [[ $1 = '-mlp' ]]
240 JAVAOPTS="$JAVAOPTS -mlp"
242 elif [[ $1 = '-mlpdebug' ]]
244 JAVAOPTS="$JAVAOPTS -mlpdebug"
246 elif [[ $1 = '-check' ]]
249 JAVAOPTS="$JAVAOPTS -conscheck"
250 elif [[ $1 = '-enable-assertions' ]]
252 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
253 elif [[ $1 = '-specdir' ]]
259 elif [[ $1 = '-debug' ]]
262 EXTRAOPTIONS="$EXTRAOPTIONS -g"
263 elif [[ $1 = '-rawpath' ]]
266 elif [[ $1 = '-runtimedebug' ]]
268 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
269 elif [[ $1 = '-dsmcaching' ]]
271 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
272 elif [[ $1 = '-rangeprefetch' ]]
274 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
275 elif [[ $1 = '-nooptimize' ]]
277 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
278 elif [[ $1 = '-optimize' ]]
280 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
281 elif [[ $1 = '-thread' ]]
283 JAVAOPTS="$JAVAOPTS -thread"
284 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
286 elif [[ $1 = '-distributioninfo' ]]
288 JAVAOPTS="$JAVAOPTS -distributioninfo"
289 elif [[ $1 = '-curdir' ]]
293 elif [[ $1 = '-outputdir' ]]
295 JAVAOPTS="$JAVAOPTS -outputdir $2"
298 SRCFILES="$SRCFILES $1"
303 BUILDDIR="$CURDIR/tmpbuilddirectory"
311 if $CHECKFLAG #Generate structure files for repair tool
313 JAVAOPTS="$JAVAOPTS -struct structfile"
323 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
325 #base bristlecone files
326 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
332 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
335 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
338 #threading java stuff
339 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
342 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
345 # Build bristlecone/java sources
349 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx800m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
350 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
351 -dir $BUILDDIR $JAVAOPTS $SRCFILES
355 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
358 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx600m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
359 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
366 if $EXITAFTERANALYSIS
371 # Build all of the consistency specs
373 if $CHECKFLAG # CHECKFLAG
376 mkdir $BUILDDIR/specdir
377 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
379 echo > $BUILDDIR/specs
381 # compile specs into C code
382 for i in * # iterate over all directories
384 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
387 cat $BUILDDIR/structfile.struct $i.label > $i.struct
388 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
389 cp size.[c,h] $BUILDDIR/specdir
390 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
391 echo $i >> $BUILDDIR/specs
393 done # iterate over all directories
399 echo > $BUILDDIR/checkers.h
400 for i in `cat $BUILDDIR/specs`
402 gcc -O0 -g -fbounds-check -c $i\_aux.c
403 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
407 #build and link everything
412 MAKEFILE="../Makefile.raw"
418 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
420 if $RAWCACHEFLUSHFLAG
422 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWCACHEFLUSH"
427 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
432 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWDEBUG"
436 then # profile version
437 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPROFILE"
442 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWUSEIO"
446 then #INTERRUPT version
447 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
448 fi #INTERRUPT version
452 MAKEFILE="$MAKEFILE.io"
453 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
455 MAKEFILE="$MAKEFILE.$RAWCONFIG"
458 cp $MAKEFILE ./Makefile
463 cp ../tmpbuilddirectory/*.c ./
464 cp ../tmpbuilddirectory/*.h ./
471 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
476 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
478 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
481 FILES="$RUNTIMEFILE \
482 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
483 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
484 $ROBUSTROOT/Runtime/ObjectHash.c \
485 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
486 $ROBUSTROOT/Runtime/math.c \
487 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
491 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
492 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"
497 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$DSMRUNTIME"
498 FILES="$FILES $DSMRUNTIME/dsmlock.c $DSMRUNTIME/singleTMCommit.c $DSMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c"
503 FILES="$FILES $DSMRUNTIME/abortreaders.c"
508 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
513 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
518 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
521 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
523 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
526 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
528 if $THREADSIMULATEFLAG
530 # -lpthread for pthread functions, -lrt for message queue functions
531 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
537 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
538 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
543 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
548 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
549 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
554 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
559 gcc $INCLUDES $EXTRAOPTIONS \
560 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
562 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
563 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin