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