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