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