change
[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 -I$ROBUSTROOT/Runtime/coreprof"
495
496 elif [[ $1 = '-mlp' ]]
497 then
498 MLP_ON=true
499 EXTRAOPTIONS="$EXTRAOPTIONS -DPRECISE_GC -lpthread -DMLP"
500 JAVAOPTS="$JAVAOPTS -mlp $2 $3"
501 shift
502 shift
503
504 elif [[ $1 = '-mlpdebug' ]]
505 then
506 JAVAOPTS="$JAVAOPTS -mlpdebug"
507
508 elif [[ $1 = '-check' ]]
509 then
510 CHECKFLAG=true
511 JAVAOPTS="$JAVAOPTS -conscheck"
512 elif [[ $1 = '-enable-assertions' ]]
513 then
514 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
515 elif [[ $1 = '-specdir' ]]
516 then
517 cd $2
518 SPECDIR=`pwd`
519 cd $CURDIR
520 shift
521 elif [[ $1 = '-debug' ]]
522 then
523 DEBUGFLAG=true
524 EXTRAOPTIONS="$EXTRAOPTIONS -g -rdynamic"
525 elif [[ $1 = '-rawpath' ]]
526 then
527 RAWPATHFLAG=true
528 elif [[ $1 = '-runtimedebug' ]]
529 then
530 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
531 elif [[ $1 = '-dsmcaching' ]]
532 then
533 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
534 elif [[ $1 = '-rangeprefetch' ]]
535 then
536 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
537 elif [[ $1 = '-nooptimize' ]]
538 then
539 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
540 elif [[ $1 = '-optimize' ]]
541 then
542 EXTRAOPTIONS="$EXTRAOPTIONS -O3"
543 elif [[ $1 = '-thread' ]]
544 then
545 JAVAOPTS="$JAVAOPTS -thread"
546 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
547 THREADFLAG=true
548 elif [[ $1 = '-recovery' ]]
549 then
550 EXTRAOPTIONS="$EXTRAOPTIONS -DRECOVERY"
551 DSMRECOVERY=true
552 elif [[ $1 = '-recoverystats' ]]
553 then
554 JAVAOPTS="$JAVAOPTS -recoverystats"
555 EXTRAOPTIONS="$EXTRAOPTIONS -DRECOVERYSTATS"
556 elif [[ $1 = '-distributioninfo' ]]
557 then
558 JAVAOPTS="$JAVAOPTS -distributioninfo"
559 elif [[ $1 = '-disall' ]]
560 then
561 JAVAOPTS="$JAVAOPTS -disall"
562 elif [[ $1 = '-disstart' ]]
563 then
564 JAVAOPTS="$JAVAOPTS -disstart $2"
565 shift
566 elif [[ $1 = '-noc' ]]
567 then
568 CCOMPILEFLAG=false
569 elif [[ $1 = '-curdir' ]]
570 then
571 CURDIR=$2
572 shift
573 elif [[ $1 = '-outputdir' ]]
574 then
575 JAVAOPTS="$JAVAOPTS -outputdir $2"
576 shift
577 else
578 SRCFILES="$SRCFILES $1"
579 fi
580 shift
581 done
582
583 BUILDDIR="$CURDIR/$tmpbuilddirectory"
584
585 cd $1
586 cd $CURDIR
587 shift
588
589 mkdir $BUILDDIR
590
591 if $CHECKFLAG #Generate structure files for repair tool
592 then
593 JAVAOPTS="$JAVAOPTS -struct structfile"
594 fi
595
596 # Setup class path
597
598 if $RECOVERFLAG
599 then
600 if $FASTCHECK
601 then
602 #fast transactions
603 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
604 else
605 #base bristlecone files
606 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
607 fi
608 else
609 if $DSMFLAG
610 then
611 #dsm stuff
612 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
613 elif $STM
614 then
615 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
616 elif $THREADFLAG
617 then
618 #threading java stuff
619 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
620 fi
621 #base java stuff
622 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
623 fi
624
625 # Build bristlecone/java sources
626
627 if $MULTICOREFLAG
628 then
629 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
630 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
631 -dir $BUILDDIR $JAVAOPTS $SRCFILES
632 then exit $?
633 fi
634 else
635 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
636 if ! $NOJAVA
637 then
638 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
639 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
640 $JAVAOPTS $SRCFILES
641 then exit $?
642 fi
643 fi
644 fi
645
646 if $EXITAFTERANALYSIS
647 then
648 exit
649 fi
650
651 # Build all of the consistency specs
652
653 if $CHECKFLAG # CHECKFLAG
654 then
655 cd $SPECDIR
656 mkdir $BUILDDIR/specdir
657 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
658
659 echo > $BUILDDIR/specs
660
661 # compile specs into C code
662 for i in * # iterate over all directories
663 do
664 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
665 then
666 cd $SPECDIR/$i
667 cat $BUILDDIR/structfile.struct $i.label > $i.struct
668 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
669 cp size.[c,h] $BUILDDIR/specdir
670 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
671 echo $i >> $BUILDDIR/specs
672 fi # CVSDIR CHECK
673 done # iterate over all directories
674
675 #compile C code
676
677 cd $BUILDDIR/specdir
678 ./buildrobust
679 echo > $BUILDDIR/checkers.h
680 for i in `cat $BUILDDIR/specs`
681 do
682 gcc -O0 -g -fbounds-check -c $i\_aux.c
683 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
684 done
685 fi # CHECKFLAG
686
687 #build and link everything
688
689 if $RAWFLAG
690 then # RAWFLAG
691 RAWDIR="$CURDIR/raw"
692 MAKEFILE="Makefile.raw"
693 mkdir $RAWDIR
694 cd $RAWDIR
695 make clean
696 rm ./*
697
698 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
699
700 if $CACHEFLUSHFLAG
701 then # print path
702 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DCACHEFLUSH"
703 fi
704
705 if $RAWPATHFLAG
706 then # print path
707 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
708 fi
709
710 if $DEBUGFLAG
711 then #debug version
712 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
713 fi
714
715 if $PROFILEFLAG
716 then # profile version
717 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
718 fi
719
720 if $ACCURATEPROFILEFLAG
721 then # accurateprofile version
722 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DACCURATEPROFILE"
723 fi
724
725 if $USEIOFLAG
726 then # useio version
727 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
728 fi
729
730 if $INTERRUPTFLAG
731 then #INTERRUPT version
732 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
733 fi #INTERRUPT version
734
735 if $USEIOFLAG
736 then # useio version
737 MAKEFILE="$MAKEFILE.io"
738 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
739 else
740 MAKEFILE="$MAKEFILE.$RAWCONFIG"
741 fi #useio version
742
743 cp $ROBUSTROOT/Runtime/RAW/$MAKEFILE ./Makefile
744 cp ../Runtime/*.c ./
745 cp ../Runtime/*.h ./
746 cp ../Runtime/*.S ./
747 cp ../Runtime/*.s ./
748 cp ../Runtime/RAW/*.c ./
749 cp ../Runtime/RAW/*.h ./
750 cp ../Runtime/RAW/*.S ./
751 cp ../Runtime/RAW/*.s ./
752 cp ../$tmpbuilddirectory/*.c ./
753 cp ../$tmpbuilddirectory/*.h ./
754
755 make
756
757 elif $TILERAFLAG
758 then # TILERAFLAG
759 TILERADIR="$CURDIR/tilera"
760 if $TILERABMEFLAG
761 then # TILERABMEFLAG
762 TILERA_INDIR="BME"
763 MAKEFILE="Makefile.tilera.$TILERACONFIG"
764 SIMHVC="sim.hvc.$TILERACONFIG"
765 PCIHVC="pci.hvc.$TILERACONFIG"
766 if $GC1COREFLAG 
767 then # 1-core gc
768   if $TILERAN1COREFLAG
769   then # not only with 1 core
770         PCIHVC="$PCIHVC.1gc"
771   fi
772 fi
773 elif $TILERAZLINUXFLAG
774 then # TILERAZLINUXFLAG
775 TILERA_INDIR="ZLinux"
776 MAKEFILE="Makefile.tilera.$TILERACONFIG"
777 fi
778
779 mkdir $TILERADIR
780 cd $TILERADIR
781 make clean
782 rm ./*
783
784 export TILERACFLAGS="-DTASK -DMULTICORE -DCLOSE_PRINT -DTILERA"
785
786 if $TILERAMEMPROFFLAG
787 then # not only with 1 core
788   PCIHVC="$PCIHVC.memprof"
789   TILERACFLAGS="${TILERACFLAGS} -DBAMBOO_MEMPROF"
790 fi
791
792 if $TILERABMEFLAG
793 then # TILERABMEFLAG
794 TILERACFLAGS="${TILERACFLAGS} -DTILERA_BME"
795 elif $TILERAZLINUXFLAG
796 then # TILERAZLINUXFLAG
797 TILERACFLAGS="${TILERACFLAGS} -DTILERA_ZLINUX"
798 fi
799
800 if $CACHEFLUSHFLAG
801 then # print path
802 TILERACFLAGS="${TILERACFLAGS} -DCACHEFLUSH"
803 fi
804
805 if $RAWPATHFLAG
806 then # print path
807 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
808 fi
809
810 if $DEBUGFLAG
811 then #debug version
812 TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
813 fi
814
815 if $PROFILEFLAG
816 then # profile version
817 TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
818 fi
819
820 if $ACCURATEPROFILEFLAG
821 then # accurateprofile version
822 TILERACFLAGS="${TILERACFLAGS} -DACCURATEPROFILE"
823 fi
824
825 if $USEIOFLAG
826 then # useio version
827 TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
828 fi
829
830 if $INTERRUPTFLAG
831 then #INTERRUPT version
832 TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
833 fi #INTERRUPT version
834
835 if $MULTICOREGCFLAG
836 then #MULTICOREGC version
837 TILERACFLAGS="${TILERACFLAGS} -DMULTICORE_GC -D${GCCORES}"
838 fi
839
840 if $GCPROFILEFLAG
841 then # GC_PROFILE version
842 TILERACFLAGS="${TILERACFLAGS} -DGC_PROFILE"
843 fi
844
845 if $GCPROFILESFLAG
846 then # GC_PROFILE_S version
847 TILERACFLAGS="${TILERACFLAGS} -DGC_PROFILE_S"
848 fi
849
850 if $GCMEMLOCALFLAG
851 then # SMEMLOCAL version
852 TILERACFLAGS="${TILERACFLAGS} -DSMEML"
853 fi
854
855 if $GCMEMFIXEDFLAG
856 then # SMEMFIXED version
857 TILERACFLAGS="${TILERACFLAGS} -DSMEMF"
858 fi
859
860 if $GCMEMMIXEDFLAG
861 then # SMEMMIXED version
862 TILERACFLAGS="${TILERACFLAGS} -DSMEMM"
863 fi
864
865 if $GCMEMGLOBALFLAG
866 then # SMEMGLOBAL version
867 TILERACFLAGS="${TILERACFLAGS} -DSMEMG"
868 fi
869
870 if $GCCACHELOCALFLAG
871 then # CACHE_LOCAL version
872 TILERACFLAGS="${TILERACFLAGS} -DCACHE_LOCAL"
873 fi
874
875 if $GCCACHERANFLAG
876 then # CACHE_RAN version
877 TILERACFLAGS="${TILERACFLAGS} -DCACHE_RAN"
878 fi
879
880 if $GCCONTROLLERNEARFLAG
881 then # CONTROLLER_NEAR version
882 TILERACFLAGS="${TILERACFLAGS} -DCONTROLLER_NEAR"
883 fi
884
885 if $GCCONTROLLERREMOTEFLAG
886 then # CONTROLLER_REMOTE version
887 TILERACFLAGS="${TILERACFLAGS} -DCONTROLLER_REMOTE"
888 fi
889
890 if $GCSMALLPAGESIZEFLAG
891 then # GC_SMALLPAGESIZE version
892 TILERACFLAGS="${TILERACFLAGS} -DGC_SMALLPAGESIZE"
893 fi
894
895 if $GCLARGEPAGESIZEFLAG
896 then # GC_LARGEPAGESIZE version
897 TILERACFLAGS="${TILERACFLAGS} -DGC_LARGEPAGESIZE"
898 fi
899
900 if $GCLARGESHAREDHEAPFLAG
901 then # GC_LARGESHAREDHEAP version
902 TILERACFLAGS="${TILERACFLAGS} -DGC_LARGESHAREDHEAP"
903 fi
904
905 if $GCSMALLPAGESIZEFLAG2
906 then # GC_SMALLPAGESIZE2 version
907 TILERACFLAGS="${TILERACFLAGS} -DGC_SMALLPAGESIZE2"
908 fi
909
910 if $GCLARGESHAREDHEAPFLAG2
911 then # GC_LARGESHAREDHEAP2 version
912 TILERACFLAGS="${TILERACFLAGS} -DGC_LARGESHAREDHEAP2"
913 fi
914
915
916 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$MAKEFILE ./Makefile
917 if $TILERABMEFLAG
918 then # TILERABMEFLAG
919 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$SIMHVC ./sim.hvc
920 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$PCIHVC ./pci.hvc
921 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/bamboo-vmlinux-pci.hvc ./bamboo-vmlinux-pci.hvc
922 fi
923 cp ../Runtime/multicoretask.c ./
924 cp ../Runtime/multicoreruntime.c ./
925 cp ../Runtime/Queue.c ./
926 cp ../Runtime/file.c ./
927 cp ../Runtime/math.c ./
928 cp ../Runtime/object.c ./
929 cp ../Runtime/GenericHashtable.c ./
930 cp ../Runtime/SimpleHash.c ./
931 cp ../Runtime/GCSharedHash.c ./
932 cp ../Runtime/ObjectHash.c ./
933 cp ../Runtime/socket.c ./
934 cp ../Runtime/mem.c ./
935 cp ../Runtime/multicoregarbage.c ./
936 cp ../Runtime/MGCHash.c ./
937 cp ../Runtime/GenericHashtable.h ./
938 cp ../Runtime/mem.h ./
939 cp ../Runtime/multicoreruntime.h ./
940 cp ../Runtime/object.h ./
941 cp ../Runtime/ObjectHash.h ./
942 cp ../Runtime/Queue.h ./
943 cp ../Runtime/runtime.h ./
944 cp ../Runtime/SimpleHash.h ./
945 cp ../Runtime/GCSharedHash.h ./
946 cp ../Runtime/multicoregc.h ./
947 cp ../Runtime/multicoregarbage.h ./
948 cp ../Runtime/multicorehelper.h ./
949 cp ../Runtime/MGCHash.h ./
950 cp ../Tilera/Runtime/*.c ./
951 cp ../Tilera/Runtime/*.h ./
952 cp ../Tilera/Runtime/$TILERA_INDIR/*.c ./
953 cp ../Tilera/Runtime/$TILERA_INDIR/*.h ./
954 if $TILERAZLINUXFLAG
955 then # TILERAZLINUXFLAG
956 cp ../Tilera/Runtime/$TILERA_INDIR/*.S ./
957 fi
958 #if $TILERAMEMPROFFLAG
959 #then # TILERAMEMPROFFLAG
960 cp ../Tilera/Runtime/$TILERA_INDIR/linux_client.c ./
961 #fi
962 cp ../Tilera/lib/* ./
963 cp ../$tmpbuilddirectory/*.c ./
964 cp ../$tmpbuilddirectory/*.h ./
965
966 make
967
968 else #!RAWFLAG && !TILERABMEFLAG  && ! TILERAZLINUXFLAG
969 cd $CURDIR 
970
971 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
972 -I$BUILDDIR"
973
974 if $MULTICOREFLAG
975 then
976 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
977 else
978 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
979 fi
980
981 FILES="$RUNTIMEFILE \
982 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
983 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
984 $ROBUSTROOT/Runtime/ObjectHash.c \
985 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
986 $ROBUSTROOT/Runtime/math.c \
987 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
988
989 if $NUMA
990 then
991 FILES="$FILES $ROBUSTROOT/Runtime/affinity.c"
992 fi
993
994 if $EVENTMONITOR
995 then
996 FILES="$FILES $ROBUSTROOT/Runtime/STM/monitor.c"
997 fi
998
999 if $FASTMEMCPY
1000 then
1001 FILES="$FILES $ROBUSTROOT/Runtime/memcpy32.o $ROBUSTROOT/Runtime/instrset32.o"
1002 fi
1003
1004 if $DSMFLAG
1005 then
1006 if $DSMRECOVERY
1007 then
1008 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRECOVERYRUNTIME"
1009 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"
1010 else
1011 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
1012 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"
1013 fi
1014 fi
1015
1016 if $STM
1017 then
1018 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$STMRUNTIME"
1019 FILES="$FILES $STMRUNTIME/stmlock.c $STMRUNTIME/stm.c $STMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c $STMRUNTIME/stats.c $STMRUNTIME/commit.c $STMRUNTIME/objstr.c"
1020 fi
1021
1022 if $SANDBOX
1023 then
1024 if $DSMFLAG
1025 then
1026 FILES="$FILES $DSMRUNTIME/sandbox.c"
1027 else
1028 FILES="$FILES $STMRUNTIME/sandbox.c"
1029 fi
1030 fi
1031
1032 if $ABORTREADERS
1033 then
1034 FILES="$FILES $DSMRUNTIME/abortreaders.c"
1035 fi
1036
1037 if $FASTCHECK
1038 then
1039 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
1040 fi
1041
1042 if $COREPROF
1043 then
1044 FILES="$FILES $ROBUSTROOT/Runtime/coreprof/coreprof.c"
1045 fi
1046
1047 if $MLP_ON
1048 then
1049 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
1050 FILES="$FILES $ROBUSTROOT/Runtime/psemaphore.c"
1051 FILES="$FILES $ROBUSTROOT/Runtime/workschedule.c"
1052 fi
1053
1054 if $RECOVERFLAG
1055 then
1056 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
1057 if $MULTICOREFLAG
1058 then
1059 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
1060 fi
1061 FILES="$FILES $tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
1062 if $RAWFLAG
1063 then
1064 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
1065 fi
1066 if $THREADSIMULATEFLAG
1067 then
1068 # -lpthread for pthread functions, -lrt for message queue functions
1069 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
1070 fi
1071 fi
1072
1073 if $OPTIONALFLAG
1074 then
1075 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
1076 FILES="$FILES $tmpbuilddirectory/optionalarrays.c"
1077 fi
1078
1079 if $THREADFLAG
1080 then
1081 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
1082 fi
1083
1084 if $CHECKFLAG
1085 then
1086 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
1087 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
1088 fi
1089
1090 if $USEDMALLOC
1091 then
1092 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
1093 fi
1094
1095 if $ASSEMBLY
1096 then
1097 gcc -S $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
1098 -c $tmpbuilddirectory/methods.c -lm
1099 fi
1100
1101 if $MULTICOREFLAG
1102 then
1103 gcc $INCLUDES $EXTRAOPTIONS \
1104 $tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
1105 else
1106 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
1107 $tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
1108 fi
1109
1110 fi #!RAWFLAG
1111
1112
1113 exit
1114