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