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