changes to enable recovery
[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 -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 DSMRECOVERY=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 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 = '-sandbox' ]]
137 then
138 EXTRAOPTIONS="$EXTRAOPTIONS -DSANDBOX"
139 JAVAOPTS="$JAVAOPTS -sandbox"
140 elif [[ $1 = '-robustroot' ]]
141 then
142 ROBUSTROOT="$2"
143 shift
144 elif [[ $1 = '-nojava' ]]
145 then
146 NOJAVA=true
147 elif [[ $1 = '-garbagestats' ]]
148 then
149 EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
150 elif [[ $1 = '-64bit' ]]
151 then
152 EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64"
153 elif [[ $1 = '-32bit' ]]
154 then
155 EXTRAOPTIONS="$EXTRAOPTIONS -m32"
156 elif [[ $1 = '-fastcheck' ]]
157 then
158 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
159 JAVAOPTS="$JAVAOPTS -fastcheck"
160 FASTCHECK=true
161 elif [[ $1 = '-o' ]]
162 then
163 MAINFILE="$2"
164 shift
165 elif [[ $1 = '-mainclass' ]]
166 then
167 JAVAOPTS="$JAVAOPTS -mainclass $2"
168 shift
169 elif [[ $1 = '-selfloop' ]]
170 then
171 JAVAOPTS="$JAVAOPTS -selfloop $2"
172 shift
173 elif [[ $1 = '-excprefetch' ]]
174 then
175 JAVAOPTS="$JAVAOPTS -excprefetch $2"
176 shift
177 elif [[ $1 = '-arraypad' ]]
178 then
179 JAVAOPTS="$JAVAOPTS -arraypad"
180 elif [[ $1 = '-dsm' ]]
181 then
182 JAVAOPTS="$JAVAOPTS -dsm"
183 DSMFLAG=true
184 elif [[ $1 = '-fastmemcpy' ]]
185 then
186 FASTMEMCPY=true
187 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTMEMCPY"
188 elif [[ $1 = '-singleTM' ]]
189 then
190 JAVAOPTS="$JAVAOPTS -singleTM"
191 EXTRAOPTIONS="$EXTRAOPTIONS -DSTM"
192 SINGLETM=true
193 elif [[ $1 = '-readset' ]]
194 then
195 JAVAOPTS="$JAVAOPTS -readset"
196 EXTRAOPTIONS="$EXTRAOPTIONS -DREADSET"
197 elif [[ $1 = '-stmdebug' ]]
198 then
199 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMDEBUG"
200 elif [[ $1 = '-stmstats' ]]
201 then
202 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMSTATS"
203 elif [[ $1 = '-stmlog' ]]
204 then
205 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMLOG"
206 elif [[ $1 = '-prefetch' ]]
207 then
208 JAVAOPTS="$JAVAOPTS -prefetch"
209 elif [[ $1 = '-transstats' ]]
210 then
211 EXTRAOPTIONS="$EXTRAOPTIONS -DTRANSSTATS"
212 elif [[ $1 = '-printflat' ]]
213 then
214 JAVAOPTS="$JAVAOPTS -printflat"
215 elif [[ $1 = '-trueprob' ]]
216 then
217 JAVAOPTS="$JAVAOPTS -trueprob $2"
218 shift
219 elif [[ $1 = '-inlineatomic' ]]
220 then
221 JAVAOPTS="$JAVAOPTS -inlineatomic $2"
222 shift
223 elif [[ $1 = '-mac' ]]
224 then
225 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
226 elif [[ $1 = '-profile' ]]
227 then
228 PROFILEFLAG=true
229 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
230 elif [[ $1 = '-accurateprofile' ]]
231 then
232 ACCURATEPROFILEFLAG=true
233 elif [[ $1 = '-useio' ]]
234 then
235 USEIOFLAG=true
236 elif [[ $1 = '-taskstate' ]]
237 then
238 JAVAOPTS="$JAVAOPTS -taskstate"
239 elif [[ $1 = '-tagstate' ]]
240 then
241 JAVAOPTS="$JAVAOPTS -tagstate"
242 elif [[ $1 = '-scheduling' ]]
243 then
244 JAVAOPTS="$JAVAOPTS -scheduling"
245 elif [[ $1 = '-multicore' ]]
246 then
247 MULTICOREFLAG=true
248 JAVAOPTS="$JAVAOPTS -multicore"
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 = '-recovery' ]]
368 then
369 EXTRAOPTIONS="$EXTRAOPTIONS -DRECOVERY"
370 DSMRECOVERY=true
371 elif [[ $1 = '-distributioninfo' ]]
372 then
373 JAVAOPTS="$JAVAOPTS -distributioninfo"
374 elif [[ $1 = '-disall' ]]
375 then
376 JAVAOPTS="$JAVAOPTS -disall"
377 elif [[ $1 = '-disstart' ]]
378 then
379 JAVAOPTS="$JAVAOPTS -disstart $2"
380 shift
381 elif [[ $1 = '-noc' ]]
382 then
383 CCOMPILEFLAG=false
384 elif [[ $1 = '-curdir' ]]
385 then
386 CURDIR=$2
387 shift
388 elif [[ $1 = '-outputdir' ]]
389 then
390 JAVAOPTS="$JAVAOPTS -outputdir $2"
391 shift
392 else
393 SRCFILES="$SRCFILES $1"
394 fi
395 shift
396 done
397
398 BUILDDIR="$CURDIR/tmpbuilddirectory"
399
400 cd $1
401 cd $CURDIR
402 shift
403
404 mkdir $BUILDDIR
405
406 if $CHECKFLAG #Generate structure files for repair tool
407 then
408 JAVAOPTS="$JAVAOPTS -struct structfile"
409 fi
410
411 # Setup class path
412
413 if $RECOVERFLAG
414 then
415 if $FASTCHECK
416 then
417 #fast transactions
418 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
419 else
420 #base bristlecone files
421 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
422 fi
423 else
424 if $DSMFLAG
425 then
426 #dsm stuff
427 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
428 elif $SINGLETM
429 then
430 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
431 elif $THREADFLAG
432 then
433 #threading java stuff
434 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
435 fi
436 #base java stuff
437 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
438 fi
439
440 # Build bristlecone/java sources
441
442 if $MULTICOREFLAG
443 then
444 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
445 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
446 -dir $BUILDDIR $JAVAOPTS $SRCFILES
447 then exit $?
448 fi
449 else
450 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
451 if ! $NOJAVA
452 then
453 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
454 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
455 $JAVAOPTS $SRCFILES
456 then exit $?
457 fi
458 fi
459 fi
460
461 if $EXITAFTERANALYSIS
462 then
463 exit
464 fi
465
466 # Build all of the consistency specs
467
468 if $CHECKFLAG # CHECKFLAG
469 then
470 cd $SPECDIR
471 mkdir $BUILDDIR/specdir
472 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
473
474 echo > $BUILDDIR/specs
475
476 # compile specs into C code
477 for i in * # iterate over all directories
478 do
479 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
480 then
481 cd $SPECDIR/$i
482 cat $BUILDDIR/structfile.struct $i.label > $i.struct
483 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
484 cp size.[c,h] $BUILDDIR/specdir
485 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
486 echo $i >> $BUILDDIR/specs
487 fi # CVSDIR CHECK
488 done # iterate over all directories
489
490 #compile C code
491
492 cd $BUILDDIR/specdir
493 ./buildrobust
494 echo > $BUILDDIR/checkers.h
495 for i in `cat $BUILDDIR/specs`
496 do
497 gcc -O0 -g -fbounds-check -c $i\_aux.c
498 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
499 done
500 fi # CHECKFLAG
501
502 #build and link everything
503
504 if $RAWFLAG
505 then # RAWFLAG
506 RAWDIR="$CURDIR/raw"
507 MAKEFILE="Makefile.raw"
508 mkdir $RAWDIR
509 cd $RAWDIR
510 make clean
511 rm ./*
512
513 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
514
515 if $CACHEFLUSHFLAG
516 then # print path
517 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DCACHEFLUSH"
518 fi
519
520 if $RAWPATHFLAG
521 then # print path
522 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
523 fi
524
525 if $DEBUGFLAG
526 then #debug version
527 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
528 fi
529
530 if $PROFILEFLAG
531 then # profile version
532 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
533 fi
534
535 if $ACCURATEPROFILEFLAG
536 then # accurateprofile version
537 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DACCURATEPROFILE"
538 fi
539
540 if $USEIOFLAG
541 then # useio version
542 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
543 fi
544
545 if $INTERRUPTFLAG
546 then #INTERRUPT version
547 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
548 fi #INTERRUPT version
549
550 if $USEIOFLAG
551 then # useio version
552 MAKEFILE="$MAKEFILE.io"
553 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
554 else
555 MAKEFILE="$MAKEFILE.$RAWCONFIG"
556 fi #useio version
557
558 cp $ROBUSTROOT/Runtime/RAW/$MAKEFILE ./Makefile
559 cp ../Runtime/*.c ./
560 cp ../Runtime/*.h ./
561 cp ../Runtime/*.S ./
562 cp ../Runtime/*.s ./
563 cp ../Runtime/RAW/*.c ./
564 cp ../Runtime/RAW/*.h ./
565 cp ../Runtime/RAW/*.S ./
566 cp ../Runtime/RAW/*.s ./
567 cp ../tmpbuilddirectory/*.c ./
568 cp ../tmpbuilddirectory/*.h ./
569
570 make
571
572 elif $TILERAFLAG
573 then # TILERAFLAG
574 TILERADIR="$CURDIR/tilera"
575 MAKEFILE="Makefile.tilera.$TILERACONFIG"
576 SIMHVC="sim.hvc.$TILERACONFIG"
577 PCIHVC="pci.hvc.$TILERACONFIG"
578 mkdir $TILERADIR
579 cd $TILERADIR
580 make clean
581 rm ./*
582
583 export TILERACFLAGS="-DTASK -DMULTICORE"
584
585 if $CACHEFLUSHFLAG
586 then # print path
587 TILERACFLAGS="${TILERACFLAGS} -DCACHEFLUSH"
588 fi
589
590 if $RAWPATHFLAG
591 then # print path
592 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
593 fi
594
595 if $DEBUGFLAG
596 then #debug version
597 TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
598 fi
599
600 if $PROFILEFLAG
601 then # profile version
602 TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
603 fi
604
605 if $ACCURATEPROFILEFLAG
606 then # accurateprofile version
607 TILERACFLAGS="${TILERACFLAGS} -DACCURATEPROFILE"
608 fi
609
610 if $USEIOFLAG
611 then # useio version
612 TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
613 fi
614
615 if $INTERRUPTFLAG
616 then #INTERRUPT version
617 TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
618 fi #INTERRUPT version
619
620 cp $ROBUSTROOT/Tilera/Runtime/$MAKEFILE ./Makefile
621 cp $ROBUSTROOT/Tilera/Runtime/$SIMHVC ./sim.hvc
622 cp $ROBUSTROOT/Tilera/Runtime/$PCIHVC ./pci.hvc
623 cp $ROBUSTROOT/Tilera/Runtime/bamboo-vmlinux-pci.hvc ./bamboo-vmlinux-pci.hvc
624 cp ../Runtime/multicoretask.c ./
625 cp ../Runtime/multicoreruntime.c ./
626 cp ../Runtime/Queue.c ./
627 cp ../Runtime/file.c ./
628 cp ../Runtime/math.c ./
629 cp ../Runtime/object.c ./
630 cp ../Runtime/GenericHashtable.c ./
631 cp ../Runtime/SimpleHash.c ./
632 cp ../Runtime/ObjectHash.c ./
633 cp ../Runtime/socket.c ./
634 cp ../Runtime/mem.c ./
635 cp ../Runtime/GenericHashtable.h ./
636 cp ../Runtime/mem.h ./
637 cp ../Runtime/multicoreruntime.h ./
638 cp ../Runtime/object.h ./
639 cp ../Runtime/ObjectHash.h ./
640 cp ../Runtime/Queue.h ./
641 cp ../Runtime/runtime.h ./
642 cp ../Runtime/SimpleHash.h ./
643 cp ../Tilera/Runtime/*.c ./
644 cp ../Tilera/Runtime/*.h ./
645 cp ../Tilera/lib/* ./
646 cp ../tmpbuilddirectory/*.c ./
647 cp ../tmpbuilddirectory/*.h ./
648
649 make
650
651 else #!RAWFLAG && !TILERAFLAG
652 cd $CURDIR 
653
654 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
655 -I$BUILDDIR"
656
657 if $MULTICOREFLAG
658 then
659 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
660 else
661 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
662 fi
663
664 FILES="$RUNTIMEFILE \
665 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
666 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
667 $ROBUSTROOT/Runtime/ObjectHash.c \
668 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
669 $ROBUSTROOT/Runtime/math.c \
670 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
671
672 if $FASTMEMCPY
673 then
674 FILES="$FILES $ROBUSTROOT/Runtime/memcpy32.o $ROBUSTROOT/Runtime/instrset32.o"
675 fi
676
677 if $DSMFLAG
678 then
679 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
680 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"
681 fi
682
683 if $DSMRECOVERY
684 then
685 FILES="$FILES $DSMRUNTIME/trans.c $DSMRUNTIME/mcpileq.c $DSMRUNTIME/objstr.c $DSMRUNTIME/dstm.c $DSMRUNTIME/mlookup.c $DSMRUNTIME/clookup.c $DSMRUNTIME/llookup.c $DSMRUNTIME/tlookup.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"
686 fi
687
688 if $SINGLETM
689 then
690 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$DSMRUNTIME"
691 FILES="$FILES $DSMRUNTIME/stmlock.c $DSMRUNTIME/singleTMCommit.c $DSMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c"
692 fi
693
694 if $ABORTREADERS
695 then
696 FILES="$FILES $DSMRUNTIME/abortreaders.c"
697 fi
698
699 if $FASTCHECK
700 then
701 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
702 fi
703
704 if $MLP_ON
705 then
706 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
707 FILES="$FILES $ROBUSTROOT/Runtime/psemaphore.c"
708 FILES="$FILES $ROBUSTROOT/Runtime/workschedule.c"
709 fi
710
711 if $RECOVERFLAG
712 then
713 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
714 if $MULTICOREFLAG
715 then
716 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
717 fi
718 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
719 if $RAWFLAG
720 then
721 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
722 fi
723 if $THREADSIMULATEFLAG
724 then
725 # -lpthread for pthread functions, -lrt for message queue functions
726 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
727 fi
728 fi
729
730 if $OPTIONALFLAG
731 then
732 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
733 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
734 fi
735
736 if $THREADFLAG
737 then
738 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
739 fi
740
741 if $CHECKFLAG
742 then
743 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
744 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
745 fi
746
747 if $USEDMALLOC
748 then
749 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
750 fi
751
752 if $ASSEMBLY
753 then
754 gcc -S $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
755 -c tmpbuilddirectory/methods.c -lm
756 fi
757
758 if $MULTICOREFLAG
759 then
760 gcc $INCLUDES $EXTRAOPTIONS \
761 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
762 else
763 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
764 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
765 fi
766
767
768 fi #!RAWFLAG
769
770
771 exit
772