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 -threadsimulate generate multi-thread simulate version binary
22 echo -optional enable optional
23 echo -debug generate debug symbols
24 echo -prefetch do prefetch analysis
25 echo -transstats generates transaction stats on commits and aborts
26 echo -webinterface enable web interface
27 echo -runtimedebug printout runtime debug messages
28 echo "-thread use support for multiple threads"
29 echo "-optimize call gcc with -O9 (optimize)"
30 echo "-nooptimize call gcc with -O0 (do not optimize)"
31 echo -curdir directory
32 echo -mainclass class with main method
34 echo -nojava do not run bristlecone compiler
35 echo -instructionfailures inject code for instructionfailures
36 echo -profile build with profile options
37 echo "-enable-assertions execute assert statements during compilation"
41 ROBUSTROOT=~/research/Robust/src
42 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
43 REPAIRROOT=~/research/Repair/RepairCompiler/
52 THREADSIMULATEFLAG=false;
75 elif [[ $1 = '-robustroot' ]]
79 elif [[ $1 = '-nojava' ]]
86 elif [[ $1 = '-mainclass' ]]
88 JAVAOPTS="$JAVAOPTS -mainclass $2"
90 elif [[ $1 = '-selfloop' ]]
92 JAVAOPTS="$JAVAOPTS -selfloop $2"
94 elif [[ $1 = '-excprefetch' ]]
96 JAVAOPTS="$JAVAOPTS -excprefetch $2"
98 elif [[ $1 = '-dsm' ]]
100 JAVAOPTS="$JAVAOPTS -dsm"
102 elif [[ $1 = '-prefetch' ]]
104 JAVAOPTS="$JAVAOPTS -prefetch"
105 elif [[ $1 = '-transstats' ]]
108 elif [[ $1 = '-printflat' ]]
110 JAVAOPTS="$JAVAOPTS -printflat"
111 elif [[ $1 = '-trueprob' ]]
113 JAVAOPTS="$JAVAOPTS -trueprob $2"
115 elif [[ $1 = '-mac' ]]
117 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
118 elif [[ $1 = '-profile' ]]
120 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
121 elif [[ $1 = '-taskstate' ]]
123 JAVAOPTS="$JAVAOPTS -taskstate"
124 elif [[ $1 = '-tagstate' ]]
126 JAVAOPTS="$JAVAOPTS -tagstate"
127 elif [[ $1 = '-scheduling' ]]
129 JAVAOPTS="$JAVAOPTS -scheduling"
130 elif [[ $1 = '-multicore' ]]
133 JAVAOPTS="$JAVAOPTS -multicore"
134 elif [[ $1 = '-numcore' ]]
136 JAVAOPTS="$JAVAOPTS -numcore $2"
138 elif [[ $1 = '-raw' ]]
141 #JAVAOPTS="$JAVAOPTS -raw"
142 elif [[ $1 = '-threadsimulate' ]]
144 THREADSIMULATEFLAG=true
145 elif [[ $1 = '-optional' ]]
147 JAVAOPTS="$JAVAOPTS -optional"
149 elif [[ $1 = '-dmalloc' ]]
152 elif [[ $1 = '-recover' ]]
155 JAVAOPTS="$JAVAOPTS -task"
156 elif [[ $1 = '-webinterface' ]]
158 JAVAOPTS="$JAVAOPTS -webinterface"
159 elif [[ $1 = '-instructionfailures' ]]
161 JAVAOPTS="$JAVAOPTS -instructionfailures"
162 elif [[ $1 = '-check' ]]
165 JAVAOPTS="$JAVAOPTS -conscheck"
166 elif [[ $1 = '-enable-assertions' ]]
168 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
169 elif [[ $1 = '-specdir' ]]
175 elif [[ $1 = '-debug' ]]
177 EXTRAOPTIONS="$EXTRAOPTIONS -g"
178 elif [[ $1 = '-runtimedebug' ]]
180 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
181 elif [[ $1 = '-nooptimize' ]]
183 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
184 elif [[ $1 = '-optimize' ]]
186 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
187 elif [[ $1 = '-thread' ]]
189 JAVAOPTS="$JAVAOPTS -thread"
190 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
192 elif [[ $1 = '-curdir' ]]
197 SRCFILES="$SRCFILES $1"
202 BUILDDIR="$CURDIR/tmpbuilddirectory"
210 if $CHECKFLAG #Generate structure files for repair tool
212 JAVAOPTS="$JAVAOPTS -struct structfile"
215 # Build bristlecone/java sources
219 if ! java $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
220 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR \
225 #if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
228 if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
229 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \
236 # Build all of the consistency specs
238 if $CHECKFLAG # CHECKFLAG
241 mkdir $BUILDDIR/specdir
242 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
244 echo > $BUILDDIR/specs
246 # compile specs into C code
247 for i in * # iterate over all directories
249 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
252 cat $BUILDDIR/structfile.struct $i.label > $i.struct
253 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
254 cp size.[c,h] $BUILDDIR/specdir
255 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
256 echo $i >> $BUILDDIR/specs
258 done # iterate over all directories
264 echo > $BUILDDIR/checkers.h
265 for i in `cat $BUILDDIR/specs`
267 gcc -O0 -g -fbounds-check -c $i\_aux.c
268 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
272 #build and link everything
276 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
281 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
283 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
286 FILES="$RUNTIMEFILE \
287 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
288 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
289 $ROBUSTROOT/Runtime/ObjectHash.c \
290 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
291 $ROBUSTROOT/Runtime/math.c \
292 $ROBUSTROOT/Runtime/signal.c \
293 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
297 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
300 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DTRANSSTATS -DCOMPILER -DDSTM -I$DSMRUNTIME"
302 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"
307 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
310 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
312 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c"
315 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
317 if $THREADSIMULATEFLAG
319 # -lpthread for pthread functions, -lrt for message queue functions
320 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
326 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
327 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
332 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
337 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
338 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
343 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
348 gcc $INCLUDES $EXTRAOPTIONS \
349 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
351 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
352 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin