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