move the STM implementation out of the DSTM implementation
[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 SANDBOX=false;
74 ABORTREADERS=false;
75 ROBUSTROOT=~/research/Robust/src
76 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
77 STMRUNTIME=$ROBUSTROOT/Runtime/STM/
78 DSMRECOVERYRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface_recovery/
79 REPAIRROOT=~/research/Repair/RepairCompiler/
80 CURDIR=`pwd`
81 DSMFLAG=false
82 DSMRECOVERY=false
83 FASTMEMCPY=false
84 STM=false
85 NOJAVA=false
86 CHECKFLAG=false
87 RECOVERFLAG=false
88 MLP_ON=false
89 MLPDEBUG=false
90 MULTICOREFLAG=false
91 RAWFLAG=false
92 TILERAFLAG=false
93 TILERACONFIG=''
94 CACHEFLUSHFLAG=false
95 RAWCONFIG=''
96 DEBUGFLAG=false
97 RAWPATHFLAG=false
98 PROFILEFLAG=false
99 ACCURATEPROFILEFLAG=false
100 USEIOFLAG=false
101 INTERRUPTFLAG=false
102 THREADSIMULATEFLAG=false;
103 USEDMALLOC=false
104 THREADFLAG=false
105 FASTCHECK=false
106 SPECDIR=`pwd`
107 SRCFILES=''
108 EXTRAOPTIONS=''
109 MAINFILE='a'
110 JAVAFORWARDOPTS=''
111 JAVAOPTS=''
112 OPTIONALFLAG=false
113 EXITAFTERANALYSIS=false
114 ASSEMBLY=false
115
116 if [[ -z $1 ]]
117 then
118 printhelp
119 exit
120 fi
121
122 while [[ -n $1 ]]
123 do
124 if [[ $1 = '-help' ]]
125 then
126 printhelp
127 exit
128 elif [[ $1 = '-justanalyze' ]]
129 then
130 EXITAFTERANALYSIS=true
131 elif [[ $1 = '-assembly' ]]
132 then
133 ASSEMBLY=true
134 elif [[ $1 = '-abortreaders' ]]
135 then
136 ABORTREADERS=true
137 EXTRAOPTIONS="$EXTRAOPTIONS -DABORTREADERS"
138 JAVAOPTS="$JAVAOPTS -abortreaders"
139 elif [[ $1 = '-sandbox' ]]
140 then
141 SANDBOX=true
142 EXTRAOPTIONS="$EXTRAOPTIONS -DSANDBOX"
143 JAVAOPTS="$JAVAOPTS -sandbox"
144 elif [[ $1 = '-robustroot' ]]
145 then
146 ROBUSTROOT="$2"
147 shift
148 elif [[ $1 = '-nojava' ]]
149 then
150 NOJAVA=true
151 elif [[ $1 = '-garbagestats' ]]
152 then
153 EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
154 elif [[ $1 = '-64bit' ]]
155 then
156 EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64"
157 elif [[ $1 = '-32bit' ]]
158 then
159 EXTRAOPTIONS="$EXTRAOPTIONS -m32"
160 elif [[ $1 = '-fastcheck' ]]
161 then
162 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
163 JAVAOPTS="$JAVAOPTS -fastcheck"
164 FASTCHECK=true
165 elif [[ $1 = '-o' ]]
166 then
167 MAINFILE="$2"
168 shift
169 elif [[ $1 = '-mainclass' ]]
170 then
171 JAVAOPTS="$JAVAOPTS -mainclass $2"
172 shift
173 elif [[ $1 = '-selfloop' ]]
174 then
175 JAVAOPTS="$JAVAOPTS -selfloop $2"
176 shift
177 elif [[ $1 = '-excprefetch' ]]
178 then
179 JAVAOPTS="$JAVAOPTS -excprefetch $2"
180 shift
181 elif [[ $1 = '-arraypad' ]]
182 then
183 JAVAOPTS="$JAVAOPTS -arraypad"
184 elif [[ $1 = '-dsm' ]]
185 then
186 JAVAOPTS="$JAVAOPTS -dsm"
187 DSMFLAG=true
188 elif [[ $1 = '-fastmemcpy' ]]
189 then
190 FASTMEMCPY=true
191 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTMEMCPY"
192 elif [[ $1 = '-singleTM' ]]
193 then
194 JAVAOPTS="$JAVAOPTS -singleTM"
195 EXTRAOPTIONS="$EXTRAOPTIONS -DSTM"
196 STM=true
197 elif [[ $1 = '-readset' ]]
198 then
199 JAVAOPTS="$JAVAOPTS -readset"
200 EXTRAOPTIONS="$EXTRAOPTIONS -DREADSET"
201 elif [[ $1 = '-stmdebug' ]]
202 then
203 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMDEBUG"
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 = '-numcore' ]]
254 then
255 JAVAOPTS="$JAVAOPTS -numcore $2"
256 shift
257 elif [[ $1 = '-raw' ]]
258 then
259 RAWFLAG=true
260 JAVAOPTS="$JAVAOPTS -raw"
261 elif [[ $1 = '-tilera' ]]
262 then
263 TILERAFLAG=true
264 elif [[ $1 = '-tileraconfig' ]]
265 then
266 TILERACONFIG="$2"
267 shift
268 elif [[ $1 = '-cacheflush' ]]
269 then
270 CACHEFLUSHFLAG=true
271 elif [[ $1 = '-rawconfig' ]]
272 then
273 RAWCONFIG="$2"
274 shift
275 elif [[ $1 = '-interrupt' ]]
276 then
277 INTERRUPTFLAG=true
278 elif [[ $1 = '-threadsimulate' ]]
279 then
280 THREADSIMULATEFLAG=true
281 elif [[ $1 = '-abcclose' ]]
282 then
283 JAVAOPTS="$JAVAOPTS -abcclose"
284 elif [[ $1 = '-optional' ]]
285 then
286 JAVAOPTS="$JAVAOPTS -optional"
287 OPTIONALFLAG=true
288 elif [[ $1 = '-dmalloc' ]]
289 then
290 USEDMALLOC=true
291 elif [[ $1 = '-recover' ]]
292 then
293 RECOVERFLAG=true
294 JAVAOPTS="$JAVAOPTS -task"
295 elif [[ $1 = '-useprofile' ]]
296 then
297 JAVAOPTS="$JAVAOPTS -useprofile $2"
298 shift
299 elif [[ $1 = '-webinterface' ]]
300 then
301 JAVAOPTS="$JAVAOPTS -webinterface"
302 elif [[ $1 = '-instructionfailures' ]]
303 then
304 JAVAOPTS="$JAVAOPTS -instructionfailures"
305 elif [[ $1 = '-joptimize' ]]
306 then
307 JAVAOPTS="$JAVAOPTS -optimize"
308 elif [[ $1 = '-dcopts' ]]
309 then
310 JAVAOPTS="$JAVAOPTS -dcopts"
311 elif [[ $1 = '-delaycomp' ]]
312 then
313 JAVAOPTS="$JAVAOPTS -delaycomp"
314 EXTRAOPTIONS="$EXTRAOPTIONS -DDELAYCOMP"
315 elif [[ $1 = '-minimize' ]]
316 then
317 JAVAOPTS="$JAVAOPTS -minimize"
318
319 elif [[ $1 = '-mlp' ]]
320 then
321 MLP_ON=true
322 EXTRAOPTIONS="$EXTRAOPTIONS -DPRECISE_GC -lpthread"
323 JAVAOPTS="$JAVAOPTS -mlp $2 $3"
324 shift
325 shift
326
327 elif [[ $1 = '-mlpdebug' ]]
328 then
329 JAVAOPTS="$JAVAOPTS -mlpdebug"
330
331 elif [[ $1 = '-check' ]]
332 then
333 CHECKFLAG=true
334 JAVAOPTS="$JAVAOPTS -conscheck"
335 elif [[ $1 = '-enable-assertions' ]]
336 then
337 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
338 elif [[ $1 = '-specdir' ]]
339 then
340 cd $2
341 SPECDIR=`pwd`
342 cd $CURDIR
343 shift
344 elif [[ $1 = '-debug' ]]
345 then
346 DEBUGFLAG=true
347 EXTRAOPTIONS="$EXTRAOPTIONS -g -rdynamic"
348 elif [[ $1 = '-rawpath' ]]
349 then
350 RAWPATHFLAG=true
351 elif [[ $1 = '-runtimedebug' ]]
352 then
353 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
354 elif [[ $1 = '-dsmcaching' ]]
355 then
356 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
357 elif [[ $1 = '-rangeprefetch' ]]
358 then
359 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
360 elif [[ $1 = '-nooptimize' ]]
361 then
362 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
363 elif [[ $1 = '-optimize' ]]
364 then
365 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
366 elif [[ $1 = '-thread' ]]
367 then
368 JAVAOPTS="$JAVAOPTS -thread"
369 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
370 THREADFLAG=true
371 elif [[ $1 = '-recovery' ]]
372 then
373 EXTRAOPTIONS="$EXTRAOPTIONS -DRECOVERY"
374 DSMRECOVERY=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 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 $STM
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 cp $ROBUSTROOT/Tilera/Runtime/$MAKEFILE ./Makefile
625 cp $ROBUSTROOT/Tilera/Runtime/$SIMHVC ./sim.hvc
626 cp $ROBUSTROOT/Tilera/Runtime/$PCIHVC ./pci.hvc
627 cp $ROBUSTROOT/Tilera/Runtime/bamboo-vmlinux-pci.hvc ./bamboo-vmlinux-pci.hvc
628 cp ../Runtime/multicoretask.c ./
629 cp ../Runtime/multicoreruntime.c ./
630 cp ../Runtime/Queue.c ./
631 cp ../Runtime/file.c ./
632 cp ../Runtime/math.c ./
633 cp ../Runtime/object.c ./
634 cp ../Runtime/GenericHashtable.c ./
635 cp ../Runtime/SimpleHash.c ./
636 cp ../Runtime/ObjectHash.c ./
637 cp ../Runtime/socket.c ./
638 cp ../Runtime/mem.c ./
639 cp ../Runtime/GenericHashtable.h ./
640 cp ../Runtime/mem.h ./
641 cp ../Runtime/multicoreruntime.h ./
642 cp ../Runtime/object.h ./
643 cp ../Runtime/ObjectHash.h ./
644 cp ../Runtime/Queue.h ./
645 cp ../Runtime/runtime.h ./
646 cp ../Runtime/SimpleHash.h ./
647 cp ../Tilera/Runtime/*.c ./
648 cp ../Tilera/Runtime/*.h ./
649 cp ../Tilera/lib/* ./
650 cp ../tmpbuilddirectory/*.c ./
651 cp ../tmpbuilddirectory/*.h ./
652
653 make
654
655 else #!RAWFLAG && !TILERAFLAG
656 cd $CURDIR 
657
658 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
659 -I$BUILDDIR"
660
661 if $MULTICOREFLAG
662 then
663 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
664 else
665 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
666 fi
667
668 FILES="$RUNTIMEFILE \
669 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
670 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
671 $ROBUSTROOT/Runtime/ObjectHash.c \
672 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
673 $ROBUSTROOT/Runtime/math.c \
674 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
675
676 if $FASTMEMCPY
677 then
678 FILES="$FILES $ROBUSTROOT/Runtime/memcpy32.o $ROBUSTROOT/Runtime/instrset32.o"
679 fi
680
681 if $DSMFLAG
682 then
683 if $DSMRECOVERY
684 then
685 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRECOVERYRUNTIME"
686 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"
687 else
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 fi
692 if $STM
693 then
694 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$STMRUNTIME"
695 FILES="$FILES $STMRUNTIME/stmlock.c $STMRUNTIME/singleTMCommit.c $STMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c"
696 fi
697
698 if $SANDBOX
699 then
700 FILES="$FILES $STMRUNTIME/sandbox.c"
701 fi
702
703 if $ABORTREADERS
704 then
705 FILES="$FILES $DSMRUNTIME/abortreaders.c"
706 fi
707
708 if $FASTCHECK
709 then
710 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
711 fi
712
713 if $MLP_ON
714 then
715 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
716 FILES="$FILES $ROBUSTROOT/Runtime/psemaphore.c"
717 FILES="$FILES $ROBUSTROOT/Runtime/workschedule.c"
718 fi
719
720 if $RECOVERFLAG
721 then
722 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
723 if $MULTICOREFLAG
724 then
725 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
726 fi
727 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
728 if $RAWFLAG
729 then
730 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
731 fi
732 if $THREADSIMULATEFLAG
733 then
734 # -lpthread for pthread functions, -lrt for message queue functions
735 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
736 fi
737 fi
738
739 if $OPTIONALFLAG
740 then
741 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
742 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
743 fi
744
745 if $THREADFLAG
746 then
747 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
748 fi
749
750 if $CHECKFLAG
751 then
752 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
753 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
754 fi
755
756 if $USEDMALLOC
757 then
758 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
759 fi
760
761 if $ASSEMBLY
762 then
763 gcc -S $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
764 -c tmpbuilddirectory/methods.c -lm
765 fi
766
767 if $MULTICOREFLAG
768 then
769 gcc $INCLUDES $EXTRAOPTIONS \
770 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
771 else
772 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
773 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
774 fi
775
776 fi #!RAWFLAG
777
778
779 exit
780