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