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