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