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