d81958a61735127ab80b7702193306d9ba043877
[IRC.git] / Robust / src / buildscript
1 #!/bin/bash
2
3 printhelp() {
4 echo STM Options
5 echo -singleTM single machine committing transactions
6 echo -stmdebug STM debug
7 echo "-stmstats prints single machine commit (stm) statistics for the benchmark"
8 echo -fastmemcpy use fast memcpy
9 echo -sandbox sandbox transactions
10 echo -dcopts conflict optimizations for transactional memory
11 echo -transstats generates transaction stats on commits and aborts
12 echo -inlineatomic depth inline methods inside of transactions to specified depth
13 echo "-stmarray partial array treatment"
14 echo "-dualview dual view of arrays"
15 echo "-hybrid use fission only when it looks like a good choice"
16 echo "-numa numa aware"
17 echo "-eventmonitor turn on transaction event trace recording"
18 echo
19 echo DSM options
20 echo -dsm distributed shared memory
21 echo -abortreaders abort readers immediately
22 echo -trueprob double - probabiltiy of true branch
23 echo -dsmcaching -enable caching in dsm runtime
24 echo
25 echo BAMBOO Multicore options
26 echo -scheduling do task scheduling
27 echo -multicore generate multi-core version binary
28 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
29 echo "-cacheflush enable cache flush in raw version binary (should be used togethere with -raw)"
30 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
31 echo "-rawpath print out execute path information for raw version (should be used together with -raw)"
32 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
33 echo -printscheduling print out scheduling graphs
34 echo -printschedulesim print out scheduling simulator result graphs
35 echo -abcclose close the array boundary check
36 echo "-tilera_bme generate tilera version binary for Bare Mental Environment (should be used together with -multicore"
37 echo "-tilera_zlinux generate tilera version binary for Zero-Overhead Linux with multi-process mode (should be used together with -multicore"
38 echo "-tileraconfig config tilera simulator/pci as nxm (should be used together with -tilera)"
39 echo "-raw generate raw version binary (should be used together with -multicore)"
40 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
41 echo -multicoregc generate multi-core binary with garbage collection
42 echo "-numcore4gc set the number of cores for gc (should be used together with -multicoregc), defaultly set as 0"
43 echo "-gcmem_local set the gc shared memory allocation strategy as local (should be used together with -multicoregc)"
44 echo "-gcmem_fixed set the gc shared memory allocation strategy as fixed (should be used together with -multicoregc)"
45 echo "-gcmem_mixed set the gc shared memory allocation strategy as mixed (should be used together with -multicoregc)"
46 echo "-gcmem_global set the gc shared memory allocation strategy as global (should be used together with -multicoregc)"
47 echo -gcprofile build with gcprofile options
48 echo -accurateprofile build with accurate profile information including pre/post task processing info
49 echo "-useio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
50 echo
51 echo Other options
52 echo -builddir setup different build directory
53 echo -robustroot set up the ROBUSTROOT to directory other than default one
54 echo -readset turn on readset
55 echo -mac distributed shared memory mac support
56 echo -check generate check code
57 echo -dmalloc link in dmalloc
58 echo -64bit compile for 64 bit machine
59 echo -32bit compile for 32 bit machine
60 echo -joptimize java compiler optimizations
61 echo -recover compile task code
62 echo -fastcheck fast checkpointing for Bristlecone
63 echo -specdir directory
64 echo -printflat print out flat representation
65 echo -selfloop task - this task cannot self loop forever
66 echo "-excprefetch methoddescriptor - exclude prefetches for this method (specified as class.method)"
67 echo -taskstate do task state analysis
68 echo -tagstate do tag state analysis
69 echo -optional enable optional
70 echo -debug generate debug symbols
71 echo -prefetch do prefetch analysis
72 echo -garbagestats Print garbage collection statistics
73 echo -webinterface enable web interface
74 echo -runtimedebug printout runtime debug messages
75 echo "-thread use support for multiple threads"
76 echo "-optimize call gcc with -O9 (optimize)"
77 echo "-nooptimize call gcc with -O0 (do not optimize)"
78 echo -curdir directory 
79 echo -mainclass class with main method
80 echo -o binary
81 echo -nojava do not run bristlecone compiler
82 echo -instructionfailures inject code for instructionfailures
83 echo -profile build with profile options
84 echo "-enable-assertions execute assert statements during compilation"
85 echo -justanalyze exit after compiler analyses complete
86 echo "-distributioninfo  execute to collect distribution info for simulated annealing in multi-core version"
87 echo "-disall  execute to collect whole distribution"
88 echo "-disstart specify the start number of distribution information collection"
89 echo -assembly generate assembly
90 echo -recovery compile recovery code
91 echo -dsmtask support work and task class library
92 echo -recoverystats print out recovery record 
93 echo -help help
94 }
95
96 tmpbuilddirectory="tmpbuilddirectory"
97 NUMA=false;
98 SANDBOX=false;
99 ABORTREADERS=false;
100 ROBUSTROOT=~/research/Robust/src
101 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
102 STMRUNTIME=$ROBUSTROOT/Runtime/STM/
103 DSMRECOVERYRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface_recovery/
104 REPAIRROOT=~/research/Repair/RepairCompiler/
105 CURDIR=`pwd`
106 DSMFLAG=false
107 DSMRECOVERY=false
108 FASTMEMCPY=false
109 STMARRAY=false
110 DUALVIEW=false
111 STM=false
112 EVENTMONITOR=false
113 NOJAVA=false
114 CHECKFLAG=false
115 RECOVERFLAG=false
116 MLP_ON=false
117 MLPDEBUG=false
118 MULTICOREFLAG=false
119 RAWFLAG=false
120 TILERAFLAG=false
121 TILERABMEFLAG=false
122 TILERAZLINUXFLAG=false
123 TILERACONFIG=''
124 CACHEFLUSHFLAG=false
125 RAWCONFIG=''
126 DEBUGFLAG=false
127 RAWPATHFLAG=false
128 PROFILEFLAG=false
129 GCPROFILEFLAG=false
130 ACCURATEPROFILEFLAG=false
131 USEIOFLAG=false
132 INTERRUPTFLAG=false
133 THREADSIMULATEFLAG=false;
134 MULTICOREGCFLAG=false;
135 GCMEMLOCALFLAG=false;
136 GCMEMFIXEDFLAG=false;
137 GCMEMMIXEDFLAG=false;
138 GCMEMGLOBALFLAG=false;
139 USEDMALLOC=false
140 THREADFLAG=false
141 FASTCHECK=false
142 SPECDIR=`pwd`
143 SRCFILES=''
144 EXTRAOPTIONS=''
145 MAINFILE='a'
146 JAVAFORWARDOPTS=''
147 JAVAOPTS=''
148 OPTIONALFLAG=false
149 EXITAFTERANALYSIS=false
150 ASSEMBLY=false
151 GCCORES=''
152 GC1COREFLAG=false
153 TILERAN1COREFLAG=false
154
155 if [[ -z $1 ]]
156 then
157 printhelp
158 exit
159 fi
160
161 while [[ -n $1 ]]
162 do
163 if [[ $1 = '-help' ]]
164 then
165 printhelp
166 exit
167 elif [[ $1 = '-justanalyze' ]]
168 then
169 EXITAFTERANALYSIS=true
170 elif [[ $1 = '-assembly' ]]
171 then
172 ASSEMBLY=true
173 elif [[ $1 = '-abortreaders' ]]
174 then
175 ABORTREADERS=true
176 EXTRAOPTIONS="$EXTRAOPTIONS -DABORTREADERS"
177 JAVAOPTS="$JAVAOPTS -abortreaders"
178 elif [[ $1 = '-sandbox' ]]
179 then
180 SANDBOX=true
181 EXTRAOPTIONS="$EXTRAOPTIONS -DSANDBOX"
182 JAVAOPTS="$JAVAOPTS -sandbox"
183 elif [[ $1 = '-numa' ]]
184 then
185 EXTRAOPTIONS="$EXTRAOPTIONS -DAFFINITY -D_GNU_SOURCE"
186 NUMA=true
187 elif [[ $1 = '-robustroot' ]]
188 then
189 ROBUSTROOT="$2"
190 shift
191 elif [[ $1 = '-builddir' ]]
192 then
193 tmpbuilddirectory="$2"
194 shift
195 elif [[ $1 = '-nojava' ]]
196 then
197 NOJAVA=true
198 elif [[ $1 = '-eventmonitor' ]]
199 then
200 JAVAOPTS="$JAVAOPTS -eventmonitor"
201 EVENTMONITOR=true
202 EXTRAOPTIONS="$EXTRAOPTIONS -DEVENTMONITOR"
203 elif [[ $1 = '-garbagestats' ]]
204 then
205 EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
206 elif [[ $1 = '-64bit' ]]
207 then
208 EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64 -m64"
209 elif [[ $1 = '-32bit' ]]
210 then
211 EXTRAOPTIONS="$EXTRAOPTIONS -m32"
212 elif [[ $1 = '-fastcheck' ]]
213 then
214 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
215 JAVAOPTS="$JAVAOPTS -fastcheck"
216 FASTCHECK=true
217 elif [[ $1 = '-o' ]]
218 then
219 MAINFILE="$2"
220 shift
221 elif [[ $1 = '-mainclass' ]]
222 then
223 JAVAOPTS="$JAVAOPTS -mainclass $2"
224 shift
225 elif [[ $1 = '-selfloop' ]]
226 then
227 JAVAOPTS="$JAVAOPTS -selfloop $2"
228 shift
229 elif [[ $1 = '-excprefetch' ]]
230 then
231 JAVAOPTS="$JAVAOPTS -excprefetch $2"
232 shift
233 elif [[ $1 = '-arraypad' ]]
234 then
235 JAVAOPTS="$JAVAOPTS -arraypad"
236 elif [[ $1 = '-dsm' ]]
237 then
238 JAVAOPTS="$JAVAOPTS -dsm"
239 DSMFLAG=true
240 elif [[ $1 = '-fastmemcpy' ]]
241 then
242 FASTMEMCPY=true
243 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTMEMCPY"
244 elif [[ $1 = '-singleTM' ]]
245 then
246 JAVAOPTS="$JAVAOPTS -singleTM"
247 EXTRAOPTIONS="$EXTRAOPTIONS -DSTM"
248 STM=true
249 elif [[ $1 = '-stmarray' ]]
250 then
251 JAVAOPTS="$JAVAOPTS -stmarray"
252 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMARRAY"
253 STMARRAY=true
254 elif [[ $1 = '-dualview' ]]
255 then
256 JAVAOPTS="$JAVAOPTS -dualview"
257 EXTRAOPTIONS="$EXTRAOPTIONS -DDUALVIEW"
258 DUALVIEW=true
259 elif [[ $1 = '-readset' ]]
260 then
261 JAVAOPTS="$JAVAOPTS -readset"
262 EXTRAOPTIONS="$EXTRAOPTIONS -DREADSET"
263 elif [[ $1 = '-stmdebug' ]]
264 then
265 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMDEBUG"
266 elif [[ $1 = '-stmstats' ]]
267 then
268 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMSTATS"
269 elif [[ $1 = '-stmlog' ]]
270 then
271 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMLOG"
272 elif [[ $1 = '-prefetch' ]]
273 then
274 JAVAOPTS="$JAVAOPTS -prefetch"
275 elif [[ $1 = '-transstats' ]]
276 then
277 EXTRAOPTIONS="$EXTRAOPTIONS -DTRANSSTATS"
278 elif [[ $1 = '-printflat' ]]
279 then
280 JAVAOPTS="$JAVAOPTS -printflat"
281 elif [[ $1 = '-trueprob' ]]
282 then
283 JAVAOPTS="$JAVAOPTS -trueprob $2"
284 shift
285 elif [[ $1 = '-inlineatomic' ]]
286 then
287 JAVAOPTS="$JAVAOPTS -inlineatomic $2"
288 shift
289 elif [[ $1 = '-mac' ]]
290 then
291 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
292 elif [[ $1 = '-profile' ]]
293 then
294 PROFILEFLAG=true
295 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
296 elif [[ $1 = '-gcprofile' ]]
297 then
298 GCPROFILEFLAG=true
299 elif [[ $1 = '-accurateprofile' ]]
300 then
301 ACCURATEPROFILEFLAG=true
302 elif [[ $1 = '-useio' ]]
303 then
304 USEIOFLAG=true
305 elif [[ $1 = '-taskstate' ]]
306 then
307 JAVAOPTS="$JAVAOPTS -taskstate"
308 elif [[ $1 = '-tagstate' ]]
309 then
310 JAVAOPTS="$JAVAOPTS -tagstate"
311 elif [[ $1 = '-scheduling' ]]
312 then
313 JAVAOPTS="$JAVAOPTS -scheduling"
314 elif [[ $1 = '-multicore' ]]
315 then
316 MULTICOREFLAG=true
317 JAVAOPTS="$JAVAOPTS -multicore"
318 elif [[ $1 = '-numcore' ]]
319 then
320 JAVAOPTS="$JAVAOPTS -numcore $2"
321 if [[ "$2" -gt "1" ]]
322 then
323 TILERAN1COREFLAG=true
324 fi
325 shift
326 elif [[ $1 = '-numcore4gc' ]]
327 then
328 JAVAOPTS="$JAVAOPTS -numcore4gc $2"
329 GCCORES="GC_$2"
330 if [[ "$2" -eq "1" ]]
331 then
332 GC1COREFLAG=true
333 fi
334 shift
335 elif [[ $1 = '-raw' ]]
336 then
337 RAWFLAG=true
338 JAVAOPTS="$JAVAOPTS -raw"
339 elif [[ $1 = '-tilera_bme' ]]
340 then
341 TILERAFLAG=true
342 TILERABMEFLAG=true
343 elif [[ $1 = '-tilera_zlinux' ]]
344 then
345 TILERAFLAG=true
346 TILERAZLINUXFLAG=true
347 elif [[ $1 = '-tileraconfig' ]]
348 then
349 TILERACONFIG="$2"
350 shift
351 elif [[ $1 = '-cacheflush' ]]
352 then
353 CACHEFLUSHFLAG=true
354 elif [[ $1 = '-rawconfig' ]]
355 then
356 RAWCONFIG="$2"
357 shift
358 elif [[ $1 = '-interrupt' ]]
359 then
360 INTERRUPTFLAG=true
361 elif [[ $1 = '-abcclose' ]]
362 then
363 JAVAOPTS="$JAVAOPTS -abcclose"
364 elif [[ $1 = '-optional' ]]
365 then
366 JAVAOPTS="$JAVAOPTS -optional"
367 OPTIONALFLAG=true
368 elif [[ $1 = '-multicoregc' ]]
369 then
370 MULTICOREGCFLAG=true
371 JAVAOPTS="$JAVAOPTS -multicoregc"
372 elif [[ $1 = '-gcmem_local' ]]
373 then
374 GCMEMLOCALFLAG=true
375 elif [[ $1 = '-gcmem_fixed' ]]
376 then
377 GCMEMFIXEDFLAG=true
378 elif [[ $1 = '-gcmem_mixed' ]]
379 then
380 GCMEMMIXEDFLAG=true
381 elif [[ $1 = '-gcmem_global' ]]
382 then
383 GCMEMGLOBALFLAG=true
384 elif [[ $1 = '-dmalloc' ]]
385 then
386 USEDMALLOC=true
387 elif [[ $1 = '-recover' ]]
388 then
389 RECOVERFLAG=true
390 JAVAOPTS="$JAVAOPTS -task"
391 elif [[ $1 = '-useprofile' ]]
392 then
393 JAVAOPTS="$JAVAOPTS -useprofile $2"
394 shift
395 elif [[ $1 = '-webinterface' ]]
396 then
397 JAVAOPTS="$JAVAOPTS -webinterface"
398 elif [[ $1 = '-instructionfailures' ]]
399 then
400 JAVAOPTS="$JAVAOPTS -instructionfailures"
401 elif [[ $1 = '-joptimize' ]]
402 then
403 JAVAOPTS="$JAVAOPTS -optimize"
404 elif [[ $1 = '-dcopts' ]]
405 then
406 JAVAOPTS="$JAVAOPTS -dcopts"
407 elif [[ $1 = '-delaycomp' ]]
408 then
409 JAVAOPTS="$JAVAOPTS -delaycomp"
410 EXTRAOPTIONS="$EXTRAOPTIONS -DDELAYCOMP"
411 elif [[ $1 = '-hybrid' ]]
412 then
413 JAVAOPTS="$JAVAOPTS -hybrid"
414 EXTRAOPTIONS="$EXTRAOPTIONS -DHYBRID"
415 elif [[ $1 = '-minimize' ]]
416 then
417 JAVAOPTS="$JAVAOPTS -minimize"
418
419 elif [[ $1 = '-ooojava' ]]
420 then
421 MLP_ON=true
422 JAVAOPTS="$JAVAOPTS -ooojava $2 $3"
423 EXTRAOPTIONS="$EXTRAOPTIONS -DPRECISE_GC -lpthread -DMLP"
424 shift
425 shift
426
427 elif [[ $1 = '-mlp' ]]
428 then
429 MLP_ON=true
430 EXTRAOPTIONS="$EXTRAOPTIONS -DPRECISE_GC -lpthread -DMLP"
431 JAVAOPTS="$JAVAOPTS -mlp $2 $3"
432 shift
433 shift
434
435 elif [[ $1 = '-mlpdebug' ]]
436 then
437 JAVAOPTS="$JAVAOPTS -mlpdebug"
438
439 elif [[ $1 = '-check' ]]
440 then
441 CHECKFLAG=true
442 JAVAOPTS="$JAVAOPTS -conscheck"
443 elif [[ $1 = '-enable-assertions' ]]
444 then
445 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
446 elif [[ $1 = '-specdir' ]]
447 then
448 cd $2
449 SPECDIR=`pwd`
450 cd $CURDIR
451 shift
452 elif [[ $1 = '-debug' ]]
453 then
454 DEBUGFLAG=true
455 EXTRAOPTIONS="$EXTRAOPTIONS -g -rdynamic"
456 elif [[ $1 = '-rawpath' ]]
457 then
458 RAWPATHFLAG=true
459 elif [[ $1 = '-runtimedebug' ]]
460 then
461 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
462 elif [[ $1 = '-dsmcaching' ]]
463 then
464 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
465 elif [[ $1 = '-rangeprefetch' ]]
466 then
467 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
468 elif [[ $1 = '-nooptimize' ]]
469 then
470 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
471 elif [[ $1 = '-optimize' ]]
472 then
473 EXTRAOPTIONS="$EXTRAOPTIONS -O3"
474 elif [[ $1 = '-thread' ]]
475 then
476 JAVAOPTS="$JAVAOPTS -thread"
477 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
478 THREADFLAG=true
479 elif [[ $1 = '-recovery' ]]
480 then
481 EXTRAOPTIONS="$EXTRAOPTIONS -DRECOVERY"
482 DSMRECOVERY=true
483 elif [[ $1 = '-recoverystats' ]]
484 then
485 JAVAOPTS="$JAVAOPTS -recoverystats"
486 EXTRAOPTIONS="$EXTRAOPTIONS -DRECOVERYSTATS"
487 elif [[ $1 = '-distributioninfo' ]]
488 then
489 JAVAOPTS="$JAVAOPTS -distributioninfo"
490 elif [[ $1 = '-disall' ]]
491 then
492 JAVAOPTS="$JAVAOPTS -disall"
493 elif [[ $1 = '-disstart' ]]
494 then
495 JAVAOPTS="$JAVAOPTS -disstart $2"
496 shift
497 elif [[ $1 = '-noc' ]]
498 then
499 CCOMPILEFLAG=false
500 elif [[ $1 = '-curdir' ]]
501 then
502 CURDIR=$2
503 shift
504 elif [[ $1 = '-outputdir' ]]
505 then
506 JAVAOPTS="$JAVAOPTS -outputdir $2"
507 shift
508 else
509 SRCFILES="$SRCFILES $1"
510 fi
511 shift
512 done
513
514 BUILDDIR="$CURDIR/$tmpbuilddirectory"
515
516 cd $1
517 cd $CURDIR
518 shift
519
520 mkdir $BUILDDIR
521
522 if $CHECKFLAG #Generate structure files for repair tool
523 then
524 JAVAOPTS="$JAVAOPTS -struct structfile"
525 fi
526
527 # Setup class path
528
529 if $RECOVERFLAG
530 then
531 if $FASTCHECK
532 then
533 #fast transactions
534 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
535 else
536 #base bristlecone files
537 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
538 fi
539 else
540 if $DSMFLAG
541 then
542 #dsm stuff
543 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
544 elif $STM
545 then
546 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
547 elif $THREADFLAG
548 then
549 #threading java stuff
550 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
551 fi
552 #base java stuff
553 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
554 fi
555
556 # Build bristlecone/java sources
557
558 if $MULTICOREFLAG
559 then
560 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
561 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
562 -dir $BUILDDIR $JAVAOPTS $SRCFILES
563 then exit $?
564 fi
565 else
566 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
567 if ! $NOJAVA
568 then
569 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
570 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
571 $JAVAOPTS $SRCFILES
572 then exit $?
573 fi
574 fi
575 fi
576
577 if $EXITAFTERANALYSIS
578 then
579 exit
580 fi
581
582 # Build all of the consistency specs
583
584 if $CHECKFLAG # CHECKFLAG
585 then
586 cd $SPECDIR
587 mkdir $BUILDDIR/specdir
588 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
589
590 echo > $BUILDDIR/specs
591
592 # compile specs into C code
593 for i in * # iterate over all directories
594 do
595 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
596 then
597 cd $SPECDIR/$i
598 cat $BUILDDIR/structfile.struct $i.label > $i.struct
599 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
600 cp size.[c,h] $BUILDDIR/specdir
601 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
602 echo $i >> $BUILDDIR/specs
603 fi # CVSDIR CHECK
604 done # iterate over all directories
605
606 #compile C code
607
608 cd $BUILDDIR/specdir
609 ./buildrobust
610 echo > $BUILDDIR/checkers.h
611 for i in `cat $BUILDDIR/specs`
612 do
613 gcc -O0 -g -fbounds-check -c $i\_aux.c
614 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
615 done
616 fi # CHECKFLAG
617
618 #build and link everything
619
620 if $RAWFLAG
621 then # RAWFLAG
622 RAWDIR="$CURDIR/raw"
623 MAKEFILE="Makefile.raw"
624 mkdir $RAWDIR
625 cd $RAWDIR
626 make clean
627 rm ./*
628
629 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
630
631 if $CACHEFLUSHFLAG
632 then # print path
633 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DCACHEFLUSH"
634 fi
635
636 if $RAWPATHFLAG
637 then # print path
638 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
639 fi
640
641 if $DEBUGFLAG
642 then #debug version
643 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
644 fi
645
646 if $PROFILEFLAG
647 then # profile version
648 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
649 fi
650
651 if $ACCURATEPROFILEFLAG
652 then # accurateprofile version
653 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DACCURATEPROFILE"
654 fi
655
656 if $USEIOFLAG
657 then # useio version
658 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
659 fi
660
661 if $INTERRUPTFLAG
662 then #INTERRUPT version
663 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
664 fi #INTERRUPT version
665
666 if $USEIOFLAG
667 then # useio version
668 MAKEFILE="$MAKEFILE.io"
669 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
670 else
671 MAKEFILE="$MAKEFILE.$RAWCONFIG"
672 fi #useio version
673
674 cp $ROBUSTROOT/Runtime/RAW/$MAKEFILE ./Makefile
675 cp ../Runtime/*.c ./
676 cp ../Runtime/*.h ./
677 cp ../Runtime/*.S ./
678 cp ../Runtime/*.s ./
679 cp ../Runtime/RAW/*.c ./
680 cp ../Runtime/RAW/*.h ./
681 cp ../Runtime/RAW/*.S ./
682 cp ../Runtime/RAW/*.s ./
683 cp ../$tmpbuilddirectory/*.c ./
684 cp ../$tmpbuilddirectory/*.h ./
685
686 make
687
688 elif $TILERAFLAG
689 then # TILERAFLAG
690 TILERADIR="$CURDIR/tilera"
691 if $TILERABMEFLAG
692 then # TILERABMEFLAG
693 TILERA_INDIR="BME"
694 MAKEFILE="Makefile.tilera.$TILERACONFIG"
695 SIMHVC="sim.hvc.$TILERACONFIG"
696 PCIHVC="pci.hvc.$TILERACONFIG"
697 if $GC1COREFLAG 
698 then # 1-core gc
699   if $TILERAN1COREFLAG
700   then # not only with 1 core
701         PCIHVC="$PCIHVC.1gc"
702   fi
703 fi
704 elif $TILERAZLINUXFLAG
705 then # TILERAZLINUXFLAG
706 TILERA_INDIR="ZLinux"
707 MAKEFILE="Makefile.tilera.$TILERACONFIG"
708 fi
709 mkdir $TILERADIR
710 cd $TILERADIR
711 make clean
712 rm ./*
713
714 export TILERACFLAGS="-DTASK -DMULTICORE -DCLOSE_PRINT -DTILERA"
715
716 if $TILERABMEFLAG
717 then # TILERABMEFLAG
718 TILERACFLAGS="${TILERACFLAGS} -DTILERA_BME"
719 elif $TILERAZLINUXFLAG
720 then # TILERAZLINUXFLAG
721 TILERACFLAGS="${TILERACFLAGS} -DTILERA_ZLINUX"
722 fi
723
724 if $CACHEFLUSHFLAG
725 then # print path
726 TILERACFLAGS="${TILERACFLAGS} -DCACHEFLUSH"
727 fi
728
729 if $RAWPATHFLAG
730 then # print path
731 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
732 fi
733
734 if $DEBUGFLAG
735 then #debug version
736 TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
737 fi
738
739 if $PROFILEFLAG
740 then # profile version
741 TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
742 fi
743
744 if $ACCURATEPROFILEFLAG
745 then # accurateprofile version
746 TILERACFLAGS="${TILERACFLAGS} -DACCURATEPROFILE"
747 fi
748
749 if $USEIOFLAG
750 then # useio version
751 TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
752 fi
753
754 if $INTERRUPTFLAG
755 then #INTERRUPT version
756 TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
757 fi #INTERRUPT version
758
759 if $MULTICOREGCFLAG
760 then #MULTICOREGC version
761 TILERACFLAGS="${TILERACFLAGS} -DMULTICORE_GC -D${GCCORES}"
762 fi
763
764 if $GCPROFILEFLAG
765 then # GC_PROFILE version
766 TILERACFLAGS="${TILERACFLAGS} -DGC_PROFILE"
767 fi
768
769 if $GCMEMLOCALFLAG
770 then # SMEMLOCAL version
771 TILERACFLAGS="${TILERACFLAGS} -DSMEML"
772 fi
773
774 if $GCMEMFIXEDFLAG
775 then # SMEMFIXED version
776 TILERACFLAGS="${TILERACFLAGS} -DSMEMF"
777 fi
778
779 if $GCMEMMIXEDFLAG
780 then # SMEMMIXED version
781 TILERACFLAGS="${TILERACFLAGS} -DSMEMM"
782 fi
783
784 if $GCMEMGLOBALFLAG
785 then # SMEMGLOBAL version
786 TILERACFLAGS="${TILERACFLAGS} -DSMEMG"
787 fi
788
789 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$MAKEFILE ./Makefile
790 if $TILERABMEFLAG
791 then # TILERABMEFLAG
792 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$SIMHVC ./sim.hvc
793 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$PCIHVC ./pci.hvc
794 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/bamboo-vmlinux-pci.hvc ./bamboo-vmlinux-pci.hvc
795 fi
796 cp ../Runtime/multicoretask.c ./
797 cp ../Runtime/multicoreruntime.c ./
798 cp ../Runtime/Queue.c ./
799 cp ../Runtime/file.c ./
800 cp ../Runtime/math.c ./
801 cp ../Runtime/object.c ./
802 cp ../Runtime/GenericHashtable.c ./
803 cp ../Runtime/SimpleHash.c ./
804 cp ../Runtime/GCSharedHash.c ./
805 cp ../Runtime/ObjectHash.c ./
806 cp ../Runtime/socket.c ./
807 cp ../Runtime/mem.c ./
808 cp ../Runtime/multicoregarbage.c ./
809 cp ../Runtime/MGCHash.c ./
810 cp ../Runtime/GenericHashtable.h ./
811 cp ../Runtime/mem.h ./
812 cp ../Runtime/multicoreruntime.h ./
813 cp ../Runtime/object.h ./
814 cp ../Runtime/ObjectHash.h ./
815 cp ../Runtime/Queue.h ./
816 cp ../Runtime/runtime.h ./
817 cp ../Runtime/SimpleHash.h ./
818 cp ../Runtime/GCSharedHash.h ./
819 cp ../Runtime/multicoregc.h ./
820 cp ../Runtime/multicoregarbage.h ./
821 cp ../Runtime/multicorehelper.h ./
822 cp ../Runtime/MGCHash.h ./
823 cp ../Tilera/Runtime/*.c ./
824 cp ../Tilera/Runtime/*.h ./
825 cp ../Tilera/Runtime/$TILERA_INDIR/*.c ./
826 cp ../Tilera/Runtime/$TILERA_INDIR/*.h ./
827 if $TILERAZLINUXFLAG
828 then # TILERAZLINUXFLAG
829 cp ../Tilera/Runtime/$TILERA_INDIR/*.S ./
830 fi
831 cp ../Tilera/lib/* ./
832 cp ../$tmpbuilddirectory/*.c ./
833 cp ../$tmpbuilddirectory/*.h ./
834
835 make
836
837 else #!RAWFLAG && !TILERABMEFLAG  && ! TILERAZLINUXFLAG
838 cd $CURDIR 
839
840 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
841 -I$BUILDDIR"
842
843 if $MULTICOREFLAG
844 then
845 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
846 else
847 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
848 fi
849
850 FILES="$RUNTIMEFILE \
851 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
852 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
853 $ROBUSTROOT/Runtime/ObjectHash.c \
854 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
855 $ROBUSTROOT/Runtime/math.c \
856 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
857
858 if $NUMA
859 then
860 FILES="$FILES $ROBUSTROOT/Runtime/affinity.c"
861 fi
862
863 if $EVENTMONITOR
864 then
865 FILES="$FILES $ROBUSTROOT/Runtime/STM/monitor.c"
866 fi
867
868 if $FASTMEMCPY
869 then
870 FILES="$FILES $ROBUSTROOT/Runtime/memcpy32.o $ROBUSTROOT/Runtime/instrset32.o"
871 fi
872
873 if $DSMFLAG
874 then
875 if $DSMRECOVERY
876 then
877 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRECOVERYRUNTIME"
878 FILES="$FILES $DSMRECOVERYRUNTIME/trans.c $DSMRECOVERYRUNTIME/mcpileq.c $DSMRECOVERYRUNTIME/objstr.c $DSMRECOVERYRUNTIME/dstm.c $DSMRECOVERYRUNTIME/altmlookup.c $DSMRECOVERYRUNTIME/clookup.c $DSMRECOVERYRUNTIME/llookup.c $DSMRECOVERYRUNTIME/tlookup.c $DSMRECOVERYRUNTIME/threadnotify.c $DSMRECOVERYRUNTIME/dstmserver.c $DSMRECOVERYRUNTIME/plookup.c $DSMRECOVERYRUNTIME/ip.c $DSMRECOVERYRUNTIME/queue.c $DSMRECOVERYRUNTIME/altprelookup.c $DSMRECOVERYRUNTIME/machinepile.c $ROBUSTROOT/Runtime/localobjects.c $ROBUSTROOT/Runtime/thread.c $DSMRECOVERYRUNTIME/sockpool.c $DSMRECOVERYRUNTIME/addUdpEnhance.c $DSMRECOVERYRUNTIME/signal.c $DSMRECOVERYRUNTIME/gCollect.c $DSMRECOVERYRUNTIME/addPrefetchEnhance.c $DSMRECOVERYRUNTIME/dsmlock.c $DSMRECOVERYRUNTIME/translist.c $DSMRECOVERYRUNTIME/paxos.c"
879 else
880 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
881 FILES="$FILES $DSMRUNTIME/trans.c $DSMRUNTIME/mcpileq.c $DSMRUNTIME/objstr.c $DSMRUNTIME/dstm.c $DSMRUNTIME/clookup.c $DSMRUNTIME/llookup.c $DSMRUNTIME/threadnotify.c $DSMRUNTIME/dstmserver.c $DSMRUNTIME/plookup.c $DSMRUNTIME/ip.c $DSMRUNTIME/queue.c $DSMRUNTIME/altprelookup.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 $DSMRUNTIME/altmlookup.c"
882 fi
883 fi
884
885 if $STM
886 then
887 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$STMRUNTIME"
888 FILES="$FILES $STMRUNTIME/stmlock.c $STMRUNTIME/stm.c $STMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c $STMRUNTIME/stats.c $STMRUNTIME/commit.c $STMRUNTIME/objstr.c"
889 fi
890
891 if $SANDBOX
892 then
893 if $DSMFLAG
894 then
895 FILES="$FILES $DSMRUNTIME/sandbox.c"
896 else
897 FILES="$FILES $STMRUNTIME/sandbox.c"
898 fi
899 fi
900
901 if $ABORTREADERS
902 then
903 FILES="$FILES $DSMRUNTIME/abortreaders.c"
904 fi
905
906 if $FASTCHECK
907 then
908 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
909 fi
910
911 if $MLP_ON
912 then
913 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
914 FILES="$FILES $ROBUSTROOT/Runtime/psemaphore.c"
915 FILES="$FILES $ROBUSTROOT/Runtime/workschedule.c"
916 fi
917
918 if $RECOVERFLAG
919 then
920 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
921 if $MULTICOREFLAG
922 then
923 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
924 fi
925 FILES="$FILES $tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
926 if $RAWFLAG
927 then
928 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
929 fi
930 if $THREADSIMULATEFLAG
931 then
932 # -lpthread for pthread functions, -lrt for message queue functions
933 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
934 fi
935 fi
936
937 if $OPTIONALFLAG
938 then
939 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
940 FILES="$FILES $tmpbuilddirectory/optionalarrays.c"
941 fi
942
943 if $THREADFLAG
944 then
945 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
946 fi
947
948 if $CHECKFLAG
949 then
950 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
951 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
952 fi
953
954 if $USEDMALLOC
955 then
956 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
957 fi
958
959 if $ASSEMBLY
960 then
961 gcc -S $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
962 -c $tmpbuilddirectory/methods.c -lm
963 fi
964
965 if $MULTICOREFLAG
966 then
967 gcc $INCLUDES $EXTRAOPTIONS \
968 $tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
969 else
970 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
971 $tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
972 fi
973
974 fi #!RAWFLAG
975
976
977 exit
978