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 -webinterface enable web interface
26 echo -runtimedebug printout runtime debug messages
27 echo "-thread use support for multiple threads"
28 echo "-optimize call gcc with -O9 (optimize)"
29 echo "-nooptimize call gcc with -O0 (do not optimize)"
30 echo -curdir directory
31 echo -mainclass class with main method
33 echo -instructionfailures inject code for instructionfailures
34 echo -profile build with profile options
35 echo "-enable-assertions execute assert statements during compilation"
39 ROBUSTROOT=~/research/Robust/src
40 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
41 REPAIRROOT=~/research/Repair/RepairCompiler/
48 THREADSIMULATEFLAG=false;
71 elif [[ $1 = '-robustroot' ]]
79 elif [[ $1 = '-mainclass' ]]
81 JAVAOPTS="$JAVAOPTS -mainclass $2"
83 elif [[ $1 = '-selfloop' ]]
85 JAVAOPTS="$JAVAOPTS -selfloop $2"
87 elif [[ $1 = '-excprefetch' ]]
89 JAVAOPTS="$JAVAOPTS -excprefetch $2"
91 elif [[ $1 = '-dsm' ]]
93 JAVAOPTS="$JAVAOPTS -dsm"
95 elif [[ $1 = '-prefetch' ]]
97 JAVAOPTS="$JAVAOPTS -prefetch"
98 elif [[ $1 = '-printflat' ]]
100 JAVAOPTS="$JAVAOPTS -printflat"
101 elif [[ $1 = '-trueprob' ]]
103 JAVAOPTS="$JAVAOPTS -trueprob $2"
105 elif [[ $1 = '-mac' ]]
107 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
108 elif [[ $1 = '-profile' ]]
110 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
111 elif [[ $1 = '-taskstate' ]]
113 JAVAOPTS="$JAVAOPTS -taskstate"
114 elif [[ $1 = '-tagstate' ]]
116 JAVAOPTS="$JAVAOPTS -tagstate"
117 elif [[ $1 = '-scheduling' ]]
119 JAVAOPTS="$JAVAOPTS -scheduling"
120 elif [[ $1 = '-multicore' ]]
123 JAVAOPTS="$JAVAOPTS -multicore"
124 elif [[ $1 = '-numcore' ]]
126 JAVAOPTS="$JAVAOPTS -numcore $2"
128 elif [[ $1 = '-raw' ]]
131 #JAVAOPTS="$JAVAOPTS -raw"
132 elif [[ $1 = '-threadsimulate' ]]
134 THREADSIMULATEFLAG=true
135 elif [[ $1 = '-optional' ]]
137 JAVAOPTS="$JAVAOPTS -optional"
139 elif [[ $1 = '-dmalloc' ]]
142 elif [[ $1 = '-recover' ]]
145 JAVAOPTS="$JAVAOPTS -task"
146 elif [[ $1 = '-webinterface' ]]
148 JAVAOPTS="$JAVAOPTS -webinterface"
149 elif [[ $1 = '-instructionfailures' ]]
151 JAVAOPTS="$JAVAOPTS -instructionfailures"
152 elif [[ $1 = '-check' ]]
155 JAVAOPTS="$JAVAOPTS -conscheck"
156 elif [[ $1 = '-enable-assertions' ]]
158 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
159 elif [[ $1 = '-specdir' ]]
165 elif [[ $1 = '-debug' ]]
167 EXTRAOPTIONS="$EXTRAOPTIONS -g"
168 elif [[ $1 = '-runtimedebug' ]]
170 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
171 elif [[ $1 = '-nooptimize' ]]
173 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
174 elif [[ $1 = '-optimize' ]]
176 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
177 elif [[ $1 = '-thread' ]]
179 JAVAOPTS="$JAVAOPTS -thread"
180 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
182 elif [[ $1 = '-curdir' ]]
187 SRCFILES="$SRCFILES $1"
192 BUILDDIR="$CURDIR/tmpbuilddirectory"
200 if $CHECKFLAG #Generate structure files for repair tool
202 JAVAOPTS="$JAVAOPTS -struct structfile"
205 # Build bristlecone/java sources
209 if ! java $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
210 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR \
215 #if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
216 if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
217 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \
223 # Build all of the consistency specs
225 if $CHECKFLAG # CHECKFLAG
228 mkdir $BUILDDIR/specdir
229 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
231 echo > $BUILDDIR/specs
233 # compile specs into C code
234 for i in * # iterate over all directories
236 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
239 cat $BUILDDIR/structfile.struct $i.label > $i.struct
240 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
241 cp size.[c,h] $BUILDDIR/specdir
242 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
243 echo $i >> $BUILDDIR/specs
245 done # iterate over all directories
251 echo > $BUILDDIR/checkers.h
252 for i in `cat $BUILDDIR/specs`
254 gcc -O0 -g -fbounds-check -c $i\_aux.c
255 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
259 #build and link everything
263 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
268 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
270 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
273 FILES="$RUNTIMEFILE \
274 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
275 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
276 $ROBUSTROOT/Runtime/ObjectHash.c \
277 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
278 $ROBUSTROOT/Runtime/math.c \
279 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
283 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
284 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"
289 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
292 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
294 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c"
297 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
299 if $THREADSIMULATEFLAG
301 # -lpthread for pthread functions, -lrt for message queue functions
302 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
308 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
309 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
314 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
319 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
320 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
325 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
330 gcc $INCLUDES $EXTRAOPTIONS \
331 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
333 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
334 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin