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