4 echo -robustroot set up the ROBUSTROOT to directory other than default one
5 echo -dsm distributed shared memory
6 echo -trueprob double - probabiltiy of true branch
7 echo -mac distributed shared memory mac support
8 echo -check generate check code
9 echo -dmalloc link in dmalloc
10 echo -recover compile task code
11 echo -specdir directory
12 echo -printflat print out flat representation
13 echo -selfloop task - this task cannot self loop forever
14 echo "-excprefetch methoddescriptor - exclude prefetches for this method (specified as class.method)"
15 echo -taskstate do task state analysis
16 echo -tagstate do tag state analysis
17 echo -scheduling do task scheduling
18 echo -multicore generate multi-core version binary
19 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
20 echo "-raw generate raw version binary (should be used together with -multicore)"
21 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
22 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
23 echo -threadsimulate generate multi-thread simulate version binary
24 echo -optional enable optional
25 echo -debug generate debug symbols
26 echo -prefetch do prefetch analysis
27 echo -transstats generates transaction stats on commits and aborts
28 echo -webinterface enable web interface
29 echo -runtimedebug printout runtime debug messages
30 echo "-thread use support for multiple threads"
31 echo "-optimize call gcc with -O9 (optimize)"
32 echo "-nooptimize call gcc with -O0 (do not optimize)"
33 echo -curdir directory
34 echo -mainclass class with main method
36 echo -nojava do not run bristlecone compiler
37 echo -instructionfailures inject code for instructionfailures
38 echo -profile build with profile options
39 echo "-enable-assertions execute assert statements during compilation"
43 ROBUSTROOT=~/research/Robust/src
44 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
45 REPAIRROOT=~/research/Repair/RepairCompiler/
56 THREADSIMULATEFLAG=false;
79 elif [[ $1 = '-robustroot' ]]
83 elif [[ $1 = '-nojava' ]]
90 elif [[ $1 = '-mainclass' ]]
92 JAVAOPTS="$JAVAOPTS -mainclass $2"
94 elif [[ $1 = '-selfloop' ]]
96 JAVAOPTS="$JAVAOPTS -selfloop $2"
98 elif [[ $1 = '-excprefetch' ]]
100 JAVAOPTS="$JAVAOPTS -excprefetch $2"
102 elif [[ $1 = '-dsm' ]]
104 JAVAOPTS="$JAVAOPTS -dsm"
106 elif [[ $1 = '-prefetch' ]]
108 JAVAOPTS="$JAVAOPTS -prefetch"
109 elif [[ $1 = '-transstats' ]]
112 elif [[ $1 = '-printflat' ]]
114 JAVAOPTS="$JAVAOPTS -printflat"
115 elif [[ $1 = '-trueprob' ]]
117 JAVAOPTS="$JAVAOPTS -trueprob $2"
119 elif [[ $1 = '-mac' ]]
121 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
122 elif [[ $1 = '-profile' ]]
124 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
125 elif [[ $1 = '-taskstate' ]]
127 JAVAOPTS="$JAVAOPTS -taskstate"
128 elif [[ $1 = '-tagstate' ]]
130 JAVAOPTS="$JAVAOPTS -tagstate"
131 elif [[ $1 = '-scheduling' ]]
133 JAVAOPTS="$JAVAOPTS -scheduling"
134 elif [[ $1 = '-multicore' ]]
137 JAVAOPTS="$JAVAOPTS -multicore"
138 elif [[ $1 = '-numcore' ]]
140 JAVAOPTS="$JAVAOPTS -numcore $2"
142 elif [[ $1 = '-raw' ]]
145 JAVAOPTS="$JAVAOPTS -raw"
146 elif [[ $1 = '-rawconfig' ]]
150 elif [[ $1 = '-interrupt' ]]
153 elif [[ $1 = '-threadsimulate' ]]
155 THREADSIMULATEFLAG=true
156 elif [[ $1 = '-optional' ]]
158 JAVAOPTS="$JAVAOPTS -optional"
160 elif [[ $1 = '-dmalloc' ]]
163 elif [[ $1 = '-recover' ]]
166 JAVAOPTS="$JAVAOPTS -task"
167 elif [[ $1 = '-webinterface' ]]
169 JAVAOPTS="$JAVAOPTS -webinterface"
170 elif [[ $1 = '-instructionfailures' ]]
172 JAVAOPTS="$JAVAOPTS -instructionfailures"
173 elif [[ $1 = '-check' ]]
176 JAVAOPTS="$JAVAOPTS -conscheck"
177 elif [[ $1 = '-enable-assertions' ]]
179 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
180 elif [[ $1 = '-specdir' ]]
186 elif [[ $1 = '-debug' ]]
188 EXTRAOPTIONS="$EXTRAOPTIONS -g"
189 elif [[ $1 = '-runtimedebug' ]]
191 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
192 elif [[ $1 = '-nooptimize' ]]
194 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
195 elif [[ $1 = '-optimize' ]]
197 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
198 elif [[ $1 = '-thread' ]]
200 JAVAOPTS="$JAVAOPTS -thread"
201 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
203 elif [[ $1 = '-curdir' ]]
208 SRCFILES="$SRCFILES $1"
213 BUILDDIR="$CURDIR/tmpbuilddirectory"
221 if $CHECKFLAG #Generate structure files for repair tool
223 JAVAOPTS="$JAVAOPTS -struct structfile"
226 # Build bristlecone/java sources
230 if ! java $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
231 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR \
236 #if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
239 if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
240 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \
247 # Build all of the consistency specs
249 if $CHECKFLAG # CHECKFLAG
252 mkdir $BUILDDIR/specdir
253 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
255 echo > $BUILDDIR/specs
257 # compile specs into C code
258 for i in * # iterate over all directories
260 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
263 cat $BUILDDIR/structfile.struct $i.label > $i.struct
264 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
265 cp size.[c,h] $BUILDDIR/specdir
266 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
267 echo $i >> $BUILDDIR/specs
269 done # iterate over all directories
275 echo > $BUILDDIR/checkers.h
276 for i in `cat $BUILDDIR/specs`
278 gcc -O0 -g -fbounds-check -c $i\_aux.c
279 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
283 #build and link everything
288 MAKEFILE="../Makefile.raw"
295 then #INTERRUPT version
296 MAKEFILE="$MAKEFILE.i"
297 fi #INTERRUPT version
299 MAKEFILE="$MAKEFILE.$RAWCONFIG"
301 cp $MAKEFILE ./Makefile
306 cp ../tmpbuilddirectory/*.c ./
307 cp ../tmpbuilddirectory/*.h ./
314 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
319 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
321 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
324 FILES="$RUNTIMEFILE \
325 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
326 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
327 $ROBUSTROOT/Runtime/ObjectHash.c \
328 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
329 $ROBUSTROOT/Runtime/math.c \
330 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
334 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
337 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DTRANSSTATS -DCOMPILER -DDSTM -I$DSMRUNTIME"
339 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 $DSMRUNTIME/localobjects.c $ROBUSTROOT/Runtime/thread.c $DSMRUNTIME/sockpool.c $DSMRUNTIME/addUdpEnhance.c $DSMRUNTIME/signal.c $DSMRUNTIME/gCollect.c"
344 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
347 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
349 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c"
352 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
354 if $THREADSIMULATEFLAG
356 # -lpthread for pthread functions, -lrt for message queue functions
357 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
363 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
364 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
369 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
374 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
375 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
380 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
385 gcc $INCLUDES $EXTRAOPTIONS \
386 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
388 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
389 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin