adding a test case
[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 OOOJava options
20 echo -coreprof, turn on profiling API
21 echo -coreprof-eventwords NUM, space in words/thread for coreprof events
22 echo -coreprof-checkoverflow, ONLY use for debugging event overflow
23 echo -coreprof-enable EVENTNAME, only enable desired events to reduce overhead
24 echo   EVENTNAME can be: cpe_main, cpe_runmalloc, cpe_runfree, cpe_poolalloc, cpe_count_poolalloc, cpe_count_poolreuse, cpe_workschedgrab, cpe_taskdispatch, cpe_preparememq, cpe_taskexecute, cpe_taskretire, cpe_taskstallvar, cpe_taskstallmem 
25 echo "-ooojava <numberofcores> <maxseseage>"
26 echo -ooodebug general OOOJava debugging messages
27 echo -ooodebug-disable-task-mem-pool this is a tricky module, disable for simpler runtime
28 echo -mempool-detect-misuse turn on to find code misusing pool-allocated records
29 echo -rcr turn on runtime conflict resolver
30 echo -rcr_debug Shows weakly connected heaproots and which allocation sites were considered for traversal
31 echo -rcr_debug_verbose in addition to above, also prints out effects passed in, internal representation of effects, and internal representation of reach graph
32 echo -squeue use single queue
33 echo -corepin use core pinning
34 echo -nostalltr turn off RCR traversers that only handle conflicts between task and stallsite
35 echo -nolock turn off synchronization lock
36 echo
37 echo Disjoint Reachability Analysis options
38 echo -disjoint enable analysis
39 echo -disjoint-k set k-limit for heap nodes per allocation site
40 echo "-disjoint-write-dots <all/final> write reach graphs for all method sols. or only final sols."
41 echo -disjoint-write-initial-contexts write reach graphs for callee initial contexts from all call sites
42 echo -disjoint-write-ihms write reach graphs for each call site\'s Initial Heap Model
43 echo "-disjoint-alias-file <filename> <normal/tabbed> write sharing for normal human reading or LaTeX tabbed"
44 echo "-disjoint-debug-callsite <callee> <caller> <visit to start> <num caps> <T/F stop after>"
45 echo "  To debug call site, give callee caller symbols (ie foo) the analysis visit to start capturing, num captures to take, and whether to halt analysis after capturing"
46 echo "-disjoint-debug-snap-method <method> <visit to start> <num caps> <T/F stop after>"
47 echo "  To take snapshots at statements, give method symbol, the analysis visit to start capturing, num captures to take, and whether to halt analsyis after capturing"
48 echo "-disjoint-dvisit-stack use stack strat to visit descriptors (tasks or methods)"
49 echo -disjoint-dvisit-stack-callees-on-top alternate stack strat
50 echo -disjoint-dvisit-pqueue use prio. q strat to visit descriptors
51 echo -disjoint-desire-determinism set above interproc for determinism
52 echo -disjoint-debug-scheduling debug when methods are scheduled for analysis
53 echo -disjoint-count-visits for counting visits in the fixed point algorithm to evaluate convergence behavior
54 echo -disjoint-count-graph-elements FILE nodes, edges and states in final graph for main method context
55 echo
56 echo -do-definite-reach-analysis enable improved precision for disjoint reachability analysis
57 echo -disjoint-disable-global-sweep
58 echo -disjoint-disable-strong-update
59 echo -disjoint-disable-predicates
60 echo -disjoint-summarize-per-class
61 echo
62 echo
63 echo -pointsto-check-v-runtime check allocation site of pointer targets at runtime to help verify heap analysis results
64 echo 
65 echo "-mlp <num cores> <max sese age> build mlp code"
66 echo -mlpdebug if mlp, report progress and interim results
67 echo
68 echo DSM options
69 echo -dsm distributed shared memory
70 echo -abortreaders abort readers immediately
71 echo -trueprob double - probabiltiy of true branch
72 echo -dsmcaching -enable caching in dsm runtime
73 echo
74 echo BAMBOO Multicore options
75 echo -scheduling do task scheduling
76 echo "-distributioninfo  execute to collect distribution info for simulated annealing in multi-core version"
77 echo "-disall  execute to collect whole distribution"
78 echo "-disstart specify the start number of distribution information collection"
79 echo -multicore generate multi-core version binary
80 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
81 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
82 echo "-rawpath print out execute path information for raw version (should be used together with -raw)"
83 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
84 echo -printscheduling print out scheduling graphs
85 echo -printschedulesim print out scheduling simulator result graphs
86 echo "-tilera_output_dir specify the output directory for the generated TILERA code"
87 echo "-tilera_bme generate tilera version binary for Bare Mental Environment (should be used together with -multicore"
88 echo "-tilera_zlinux generate tilera version binary for Zero-Overhead Linux with multi-process mode (should be used together with -multicore"
89 echo "-tileraconfig config tilera simulator/pci as nxm (should be used together with -tilera)"
90 echo "-raw generate raw version binary (should be used together with -multicore)"
91 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
92 echo "-tilera_memprof build the memprof version (should be used together with -tilera_xx) "
93 echo -accurateprofile build with accurate profile information including pre/post task processing info
94 echo -profile_interrupt build with profile information of interrupts
95 echo "-useio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
96 echo -gccachecoherent turns on the cache coherence during gc
97 echo -inputfile enables reading input files in Tilera
98 echo -inputfilecompress enables the compressed version of input files
99 echo
100 echo Multicore GC options
101 echo -perfcount performance counters
102 echo -memperfcount Memory performance counters
103 echo -multicoregc generate multi-core binary with garbage collection
104 echo -pmc parallel collector
105 echo "-numcore4gc set the number of cores for gc (should be used together with -multicoregc), defaultly set as 0"
106 echo "-gcmem_local set the gc shared memory allocation strategy as local (should be used together with -multicoregc)"
107 echo "-gcmem_fixed set the gc shared memory allocation strategy as fixed (should be used together with -multicoregc)"
108 echo "-gcmem_mixed set the gc shared memory allocation strategy as mixed (should be used together with -multicoregc)"
109 echo "-gcmem_global set the gc shared memory allocation strategy as global (should be used together with -multicoregc)"
110 echo "-gccache_local set the gc shared memory cache strategy as local (should be used together with -multicoregc)"
111 echo "-gccache_ran set the gc shared memory cache strategy as random (should be used together with -multicoregc)"
112 echo "-gccontroller_near set the gc shared memory to use the nearest controller for each core (should be used together with -multicoregc)"
113 echo "-gccontroller_remote set the gc shared memory to use a remote controller for each core (should be used together with -multicoregc)"
114 echo "-gcsmallpagesize(2) set the gc shared memory to use small page size (should be used together with -multicoregc)"
115 echo "-gclargepagesize set the gc shared memory to use large page size (should be used together with -multicoregc)"
116 echo "-gclargesharedheap(2) set the gc shared memory as large (should be used together with -multicoregc)"
117 echo "-tilera_page_size set the page size in multicore code"
118 echo "-tilera_page_size_bits set the page size bits in multicore code"
119 echo "-tilera_num_blocks set the total number of blocks in multicore code"
120 echo "-tilera_num_pages_per_block set the number of pages per block in multicore code"
121 echo "-gccacheadapt setup as cacheadaptable mode (should be used together with -multicoregc)"
122 echo -gcprofile build with gcprofile options
123 echo -mgc generate Multicore GC binary without task stuff
124 echo -objectlockdebug generate OBJECT_LOCK_DEBUG code
125 echo -gctbldebug generate GC_TBL_DEBUG code
126 echo
127 echo SSJava options
128 echo -ssjava enables SSJava
129 echo -ssjavadebug reports interim results
130 echo -ssjavainfer location type inference
131 echo -ssjava-induce-error N S where 1/N is the probability to error at any deref or divide and S is a random seed
132 echo -ssjava-infer-naive-writedots write lattice dots generated by the naive approach
133 echo
134 echo Other options
135 echo -jni enable jni
136 echo -abcclose turnoff array boundary checks
137 echo -builddir setup different build directory
138 echo -robustroot set up the ROBUSTROOT to directory other than default one
139 echo -readset turn on readset
140 echo -mac distributed shared memory mac support
141 echo -check generate check code
142 echo -dmalloc link in dmalloc
143 echo -64bit compile for 64 bit machine
144 echo -32bit compile for 32 bit machine
145 echo -joptimize java compiler optimizations
146 echo -noloop turnoff loop optimizations
147 echo -recover compile task code
148 echo -fastcheck fast checkpointing for Bristlecone
149 echo -specdir directory
150 echo -printflat print out flat representation
151 echo -selfloop task - this task cannot self loop forever
152 echo "-excprefetch methoddescriptor - exclude prefetches for this method (specified as class.method)"
153 echo -taskstate do task state analysis
154 echo -tagstate do tag state analysis
155 echo -optional enable optional
156 echo -debug generate debug symbols
157 echo -prefetch do prefetch analysis
158 echo -heapsize-mb NUM  set output program initial heap size in MB, default is 256
159 echo -compiler-heapsize-mb NUM  set heap size in MB for the JVM running the compiler, default is 1500
160 echo -garbagestats Print garbage collection statistics
161 echo -webinterface enable web interface
162 echo -runtimedebug printout runtime debug messages
163 echo "-thread use support for multiple threads"
164 echo "-optimize call gcc with -O9 (optimize)"
165 echo "-nooptimize call gcc with -O0 (do not optimize)"
166 echo -curdir directory 
167 echo -mainclass class with main method
168 echo -o binary
169 echo -nojava do not run bristlecone compiler
170 echo -instructionfailures inject code for instructionfailures
171 echo -profile build with profile options
172 echo "-enable-assertions execute assert statements during compilation"
173 echo -justanalyze exit after compiler analyses complete
174 echo -assembly generate assembly
175 echo -recovery compile recovery code
176 echo -dsmtask support work and task class library
177 echo -recoverystats print out recovery record 
178 echo -src-after-pp prints source code after preprocessor to tmp.c
179 echo -capture-null-dereferences generates code to warn before derefencing null
180 echo -printlinenum print out line numbers in generated C codes
181 echo -help help
182 }
183
184 tmpbuilddirectory="tmpbuilddirectory"
185 JNI=false
186 SSJAVA=false
187 USE_SSJAVA_CLASSPATH=false
188 USE_SSJAVA_INFER_CLASSPATH=false
189 USE_SSJAVA_NOCLASSPATH=false
190 SRCAFTERPP=false;
191 COREPROF=false;
192 NUMA=false;
193 SANDBOX=false;
194 ABORTREADERS=false;
195 ROBUSTROOT=~/research/Robust/src
196 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
197 STMRUNTIME=$ROBUSTROOT/Runtime/STM/
198 DSMRECOVERYRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface_recovery/
199 REPAIRROOT=~/research/Repair/RepairCompiler/
200 CURDIR=`pwd`
201 SQUEUE=false
202 DSMFLAG=false
203 DSMRECOVERY=false
204 FASTMEMCPY=false
205 STMARRAY=false
206 DUALVIEW=false
207 STM=false
208 EVENTMONITOR=false
209 NOJAVA=false
210 CHECKFLAG=false
211 RECOVERFLAG=false
212 MLP_ON=false
213 OOOJAVA=false
214 RCR=false
215 RCR_DEBUG=false
216 RCR_DEBUG_VERBOSE=false
217 MLPDEBUG=false
218 MULTICOREFLAG=false
219 RAWFLAG=false
220 TILERAFLAG=false
221 TILERABMEFLAG=false
222 TILERAZLINUXFLAG=false
223 TILERAMEMPROFFLAG=false
224 TILERACONFIG=''
225 TILERACORES=''
226 RAWCONFIG=''
227 DEBUGFLAG=false
228 RAWPATHFLAG=false
229 PROFILEFLAG=false
230 GCPROFILEFLAG=false
231 GCPROFILESFLAG=false
232 ACCURATEPROFILEFLAG=false
233 PROFILEINTERRUPTFLAG=false
234 USEIOFLAG=false
235 INTERRUPTFLAG=false
236 THREADSIMULATEFLAG=false;
237 MULTICOREGCFLAG=false;
238 PERFCOUNT=false;
239 MEMPERFCOUNT=false;
240 PMCFLAG=false;
241 GCMEMLOCALFLAG=false;
242 GCMEMFIXEDFLAG=false;
243 GCMEMMIXEDFLAG=false;
244 GCMEMGLOBALFLAG=false;
245 GCCACHELOCALFLAG=false;
246 GCCACHERANFLAG=false;
247 GCCONTROLLERNEARFLAG=false;
248 GCCONTROLLERREMOTEFLAG=false;
249 GCSMALLPAGESIZEFLAG=false;
250 GCLARGEPAGESIZEFLAG=false;
251 GCLARGEPAGESIZE2FLAG=false;
252 GCLARGESHAREDHEAPFLAG=false;
253 GCSMALLPAGESIZEFLAG2=false;
254 GCLARGESHAREDHEAPFLAG2=false;
255 GCCACHEADAPTFLAG=false
256 GCCACHEADAPTPOLICYFLAG=false
257 GCCACHEADAPTPOLICY=''
258 GCCACHESAMPLINGFLAG=false
259 MGCFLAG=false
260 MGCINTELFLAG=false
261 OBJECTLOCKDEBUGFLAG=false
262 GCTBLDEBUGFLAG=false
263 USEDMALLOC=false
264 THREADFLAG=false
265 FASTCHECK=false
266 SPECDIR=`pwd`
267 SRCFILES=''
268 EXTRAOPTIONS=''
269 MAINFILE='a'
270 JAVAFORWARDOPTS=''
271 JAVAOPTS=''
272 OPTIONALFLAG=false
273 EXITAFTERANALYSIS=false
274 ASSEMBLY=false
275 GCCORES=''
276 TILERAN1COREFLAG=false
277 TILERA56COREFLAG=false
278 TILERAOUTPUTDIR="tilera"
279 TILERA_PAGE_SIZE="0x10000"
280 TILERA_PAGE_SIZE_BITS="16"
281 TILERA_NUM_BLOCKS="20"
282 TILERA_NUM_PAGES_PER_BLOCK="16"
283 INPUTFILEFLAG=false
284 INPUTFILES=''
285 INPUTFILEOPTS=''
286 GCCACHECOHERENTFLAG=false
287 COMPILER_HEAP_SIZE="1500"
288
289
290 if [[ -z $1 ]]
291 then
292 printhelp
293 exit
294 fi
295
296 while [[ -n $1 ]]
297 do
298 if [[ $1 = '-help' ]]
299 then
300 printhelp
301 exit
302 elif [[ $1 = '-jni' ]]
303 then
304 JNI=true
305 JAVAOPTS="$JAVAOPTS -jni"
306 EXTRAOPTIONS="$EXTRAOPTIONS -DJNI -I$ROBUSTROOT/Runtime/jni"
307 elif [[ $1 = '-justanalyze' ]]
308 then
309 EXITAFTERANALYSIS=true
310 elif [[ $1 = '-capture-null-dereferences' ]]
311 then
312 JAVAOPTS="$JAVAOPTS -capture-null-dereferences"
313 EXTRAOPTIONS="$EXTRAOPTIONS -DCAPTURE_NULL_DEREFERENCES"
314 elif [[ $1 = '-src-after-pp' ]]
315 then
316 SRCAFTERPP=true
317 elif [[ $1 = '-assembly' ]]
318 then
319 ASSEMBLY=true
320 elif [[ $1 = '-abortreaders' ]]
321 then
322 ABORTREADERS=true
323 EXTRAOPTIONS="$EXTRAOPTIONS -DABORTREADERS"
324 JAVAOPTS="$JAVAOPTS -abortreaders"
325 elif [[ $1 = '-sandbox' ]]
326 then
327 SANDBOX=true
328 EXTRAOPTIONS="$EXTRAOPTIONS -DSANDBOX"
329 JAVAOPTS="$JAVAOPTS -sandbox"
330 elif [[ $1 = '-numa' ]]
331 then
332 EXTRAOPTIONS="$EXTRAOPTIONS -DAFFINITY -D_GNU_SOURCE"
333 NUMA=true
334 elif [[ $1 = '-robustroot' ]]
335 then
336 ROBUSTROOT="$2"
337 shift
338 elif [[ $1 = '-builddir' ]]
339 then
340 tmpbuilddirectory="$2"
341 shift
342 elif [[ $1 = '-nojava' ]]
343 then
344 NOJAVA=true
345 elif [[ $1 = '-eventmonitor' ]]
346 then
347 JAVAOPTS="$JAVAOPTS -eventmonitor"
348 EVENTMONITOR=true
349 EXTRAOPTIONS="$EXTRAOPTIONS -DEVENTMONITOR"
350 elif [[ $1 = '-garbagestats' ]]
351 then
352 EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
353 elif [[ $1 = '-64bit' ]]
354 then
355 EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64 -m64"
356 elif [[ $1 = '-32bit' ]]
357 then
358 EXTRAOPTIONS="$EXTRAOPTIONS -m32"
359 elif [[ $1 = '-fastcheck' ]]
360 then
361 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
362 JAVAOPTS="$JAVAOPTS -fastcheck"
363 FASTCHECK=true
364 elif [[ $1 = '-o' ]]
365 then
366 MAINFILE="$2"
367 shift
368 elif [[ $1 = '-mainclass' ]]
369 then
370 JAVAOPTS="$JAVAOPTS -mainclass $2"
371 shift
372 elif [[ $1 = '-selfloop' ]]
373 then
374 JAVAOPTS="$JAVAOPTS -selfloop $2"
375 shift
376 elif [[ $1 = '-excprefetch' ]]
377 then
378 JAVAOPTS="$JAVAOPTS -excprefetch $2"
379 shift
380 elif [[ $1 = '-arraypad' ]]
381 then
382 JAVAOPTS="$JAVAOPTS -arraypad"
383 elif [[ $1 = '-dsm' ]]
384 then
385 JAVAOPTS="$JAVAOPTS -dsm"
386 DSMFLAG=true
387 elif [[ $1 = '-fastmemcpy' ]]
388 then
389 FASTMEMCPY=true
390 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTMEMCPY"
391 elif [[ $1 = '-singleTM' ]]
392 then
393 JAVAOPTS="$JAVAOPTS -singleTM"
394 EXTRAOPTIONS="$EXTRAOPTIONS -DSTM"
395 STM=true
396 elif [[ $1 = '-stmarray' ]]
397 then
398 JAVAOPTS="$JAVAOPTS -stmarray"
399 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMARRAY"
400 STMARRAY=true
401 elif [[ $1 = '-dualview' ]]
402 then
403 JAVAOPTS="$JAVAOPTS -dualview"
404 EXTRAOPTIONS="$EXTRAOPTIONS -DDUALVIEW"
405 DUALVIEW=true
406 elif [[ $1 = '-readset' ]]
407 then
408 JAVAOPTS="$JAVAOPTS -readset"
409 EXTRAOPTIONS="$EXTRAOPTIONS -DREADSET"
410 elif [[ $1 = '-stmdebug' ]]
411 then
412 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMDEBUG"
413 elif [[ $1 = '-stmstats' ]]
414 then
415 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMSTATS"
416 elif [[ $1 = '-stmlog' ]]
417 then
418 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMLOG"
419 elif [[ $1 = '-prefetch' ]]
420 then
421 JAVAOPTS="$JAVAOPTS -prefetch"
422 elif [[ $1 = '-transstats' ]]
423 then
424 EXTRAOPTIONS="$EXTRAOPTIONS -DTRANSSTATS"
425 elif [[ $1 = '-printflat' ]]
426 then
427 JAVAOPTS="$JAVAOPTS -printflat"
428 elif [[ $1 = '-trueprob' ]]
429 then
430 JAVAOPTS="$JAVAOPTS -trueprob $2"
431 shift
432 elif [[ $1 = '-inlineatomic' ]]
433 then
434 JAVAOPTS="$JAVAOPTS -inlineatomic $2"
435 shift
436 elif [[ $1 = '-mac' ]]
437 then
438 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
439 elif [[ $1 = '-squeue' ]]
440 then
441 EXTRAOPTIONS="$EXTRAOPTIONS -DSQUEUE"
442 elif [[ $1 = '-corepin' ]]
443 then
444 EXTRAOPTIONS="$EXTRAOPTIONS -DCOREPIN"
445 SQUEUE=true
446 elif [[ $1 = '-profile' ]]
447 then
448 PROFILEFLAG=true
449 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
450 elif [[ $1 = '-gcprofile' ]]
451 then
452 GCPROFILEFLAG=true
453 elif [[ $1 = '-gcprofile_s' ]]
454 then
455 GCPROFILESFLAG=true
456 elif [[ $1 = '-accurateprofile' ]]
457 then
458 ACCURATEPROFILEFLAG=true
459 elif [[ $1 = '-profile_interrupt' ]]
460 then
461 PROFILEINTERRUPTFLAG=true
462 elif [[ $1 = '-useio' ]]
463 then
464 USEIOFLAG=true
465 elif [[ $1 = '-gccachecoherent' ]]
466 then
467 GCCACHECOHERENTFLAG=true
468 elif [[ $1 = '-taskstate' ]]
469 then
470 JAVAOPTS="$JAVAOPTS -taskstate"
471 elif [[ $1 = '-tagstate' ]]
472 then
473 JAVAOPTS="$JAVAOPTS -tagstate"
474 elif [[ $1 = '-scheduling' ]]
475 then
476 JAVAOPTS="$JAVAOPTS -scheduling"
477 elif [[ $1 = '-multicore' ]]
478 then
479 MULTICOREFLAG=true
480 JAVAOPTS="$JAVAOPTS -multicore"
481 elif [[ $1 = '-numcore' ]]
482 then
483 JAVAOPTS="$JAVAOPTS -numcore $2"
484 TILERACORES="$2"
485 if [[ "$2" -gt "1" ]]
486 then
487 TILERAN1COREFLAG=true
488 if [[ "$2" -eq "56" ]]
489 then
490 TILERA56COREFLAG=true
491 fi
492 fi
493 shift
494 elif [[ $1 = '-numcore4gc' ]]
495 then
496 JAVAOPTS="$JAVAOPTS -numcore4gc $2"
497 GCCORES="GC_$2"
498 shift
499 elif [[ $1 = '-raw' ]]
500 then
501 RAWFLAG=true
502 JAVAOPTS="$JAVAOPTS -raw"
503 elif [[ $1 = '-tilera_output_dir' ]]
504 then
505 TILERAOUTPUTDIR="$2"
506 shift
507 elif [[ $1 = '-tilera_page_size' ]]
508 then
509 TILERA_PAGE_SIZE="$2"
510 shift
511 elif [[ $1 = '-tilera_page_size_bits' ]]
512 then
513 TILERA_PAGE_SIZE_BITS="$2"
514 shift
515 elif [[ $1 = '-tilera_num_blocks' ]]
516 then
517 TILERA_NUM_BLOCKS="$2"
518 shift
519 elif [[ $1 = '-tilera_num_pages_per_block' ]]
520 then
521 TILERA_NUM_PAGES_PER_BLOCK="$2"
522 shift
523 elif [[ $1 = '-tilera_bme' ]]
524 then
525 TILERAFLAG=true
526 TILERABMEFLAG=true
527 elif [[ $1 = '-tilera_zlinux' ]]
528 then
529 TILERAFLAG=true
530 TILERAZLINUXFLAG=true
531 elif [[ $1 = '-tilera_memprof' ]]
532 then
533 TILERAMEMPROFFLAG=true
534 elif [[ $1 = '-tileraconfig' ]]
535 then
536 TILERACONFIG="$2"
537 shift
538 elif [[ $1 = '-rawconfig' ]]
539 then
540 RAWCONFIG="$2"
541 shift
542 elif [[ $1 = '-interrupt' ]]
543 then
544 INTERRUPTFLAG=true
545 elif [[ $1 = '-abcclose' ]]
546 then
547 JAVAOPTS="$JAVAOPTS -abcclose"
548 elif [[ $1 = '-optional' ]]
549 then
550 JAVAOPTS="$JAVAOPTS -optional"
551 OPTIONALFLAG=true
552 elif [[ $1 = '-multicoregc' ]]
553 then
554 MULTICOREGCFLAG=true
555 JAVAOPTS="$JAVAOPTS -multicoregc"
556 elif [[ $1 = '-pmc' ]]
557 then
558 PMCFLAG=true
559 JAVAOPTS="$JAVAOPTS -pmc"
560 elif [[ $1 = '-perfcount' ]]
561 then
562 PERFCOUNT=true
563 elif [[ $1 = '-memperfcount' ]]
564 then
565 MEMPERFCOUNT=true
566 elif [[ $1 = '-gcmem_local' ]]
567 then
568 GCMEMLOCALFLAG=true
569 elif [[ $1 = '-gcmem_fixed' ]]
570 then
571 GCMEMFIXEDFLAG=true
572 elif [[ $1 = '-gcmem_mixed' ]]
573 then
574 GCMEMMIXEDFLAG=true
575 elif [[ $1 = '-gcmem_global' ]]
576 then
577 GCMEMGLOBALFLAG=true
578 elif [[ $1 = '-gccache_local' ]]
579 then
580 GCCACHELOCALFLAG=true
581 elif [[ $1 = '-gccache_ran' ]]
582 then
583 GCCACHERANFLAG=true
584 elif [[ $1 = '-gccontroller_near' ]]
585 then
586 GCCONTROLLERNEARFLAG=true
587 elif [[ $1 = '-gccontroller_remote' ]]
588 then
589 GCCONTROLLERREMOTEFLAG=true
590 elif [[ $1 = '-gcsmallpagesize' ]]
591 then
592 GCSMALLPAGESIZEFLAG=true
593 elif [[ $1 = '-gcsmallpagesize2' ]]
594 then
595 GCSMALLPAGESIZEFLAG2=true
596 elif [[ $1 = '-gclargepagesize' ]]
597 then
598 GCLARGEPAGESIZEFLAG=true
599 elif [[ $1 = '-gclargepagesize2' ]]
600 then
601 GCLARGEPAGESIZE2FLAG=true
602 elif [[ $1 = '-gclargesharedheap' ]]
603 then
604 GCLARGESHAREDHEAPFLAG=true
605 elif [[ $1 = '-gclargesharedheap2' ]]
606 then
607 GCLARGESHAREDHEAPFLAG2=true
608 elif [[ $1 = '-gccacheadapt' ]]
609 then
610 GCCACHEADAPTFLAG=true
611 elif [[ $1 = '-gccacheadaptpolicy' ]]
612 then
613 GCCACHEADAPTPOLICYFLAG=true
614 GCCACHEADAPTPOLICY="$2"
615 shift
616 elif [[ $1 = '-gccachesampling' ]]
617 then
618 GCCACHESAMPLINGFLAG=true
619 elif [[ $1 = '-mgc' ]]
620 then
621 MGCFLAG=true
622 JAVAOPTS="$JAVAOPTS -mgc"
623 elif [[ $1 = '-inputfile' ]]
624 then
625 INPUTFILEFLAG=true
626 INPUTFILES="$INPUTFILES $2"
627 shift
628 elif [[ $1 = '-inputfilecompress' ]]
629 then
630 INPUTFILEOPTS="$INPUTFILEOPTS -compress"
631 elif [[ $1 = '-mgcintel' ]]
632 then
633 MGCINTELFLAG=true
634 elif [[ $1 = '-objectlockdebug' ]]
635 then
636 OBJECTLOCKDEBUGFLAG=true
637 JAVAOPTS="$JAVAOPTS -objectlockdebug"
638 elif [[ $1 = '-gctbldebug' ]]
639 then
640 GCTBLDEBUGFLAG=true
641 elif [[ $1 = '-dmalloc' ]]
642 then
643 USEDMALLOC=true
644 elif [[ $1 = '-recover' ]]
645 then
646 RECOVERFLAG=true
647 JAVAOPTS="$JAVAOPTS -task"
648 elif [[ $1 = '-useprofile' ]]
649 then
650 JAVAOPTS="$JAVAOPTS -useprofile $2"
651 shift
652 elif [[ $1 = '-webinterface' ]]
653 then
654 JAVAOPTS="$JAVAOPTS -webinterface"
655 elif [[ $1 = '-instructionfailures' ]]
656 then
657 JAVAOPTS="$JAVAOPTS -instructionfailures"
658 elif [[ $1 = '-joptimize' ]]
659 then
660 JAVAOPTS="$JAVAOPTS -optimize"
661 elif [[ $1 = '-noloop' ]]
662 then
663 JAVAOPTS="$JAVAOPTS -noloop"
664 elif [[ $1 = '-dcopts' ]]
665 then
666 JAVAOPTS="$JAVAOPTS -dcopts"
667 elif [[ $1 = '-delaycomp' ]]
668 then
669 JAVAOPTS="$JAVAOPTS -delaycomp"
670 EXTRAOPTIONS="$EXTRAOPTIONS -DDELAYCOMP"
671 elif [[ $1 = '-hybrid' ]]
672 then
673 JAVAOPTS="$JAVAOPTS -hybrid"
674 EXTRAOPTIONS="$EXTRAOPTIONS -DHYBRID"
675 elif [[ $1 = '-minimize' ]]
676 then
677 JAVAOPTS="$JAVAOPTS -minimize"
678
679 elif [[ $1 = '-ooojava' ]]
680 then
681 MLP_ON=true
682 OOOJAVA=true
683 JAVAOPTS="$JAVAOPTS -ooojava $2 $3"
684 EXTRAOPTIONS="$EXTRAOPTIONS -DPRECISE_GC -lpthread -DMLP"
685 shift
686 shift
687
688 elif [[ $1 = '-ooodebug-disable-task-mem-pool' ]]
689 then
690 EXTRAOPTIONS="$EXTRAOPTIONS -DOOO_DISABLE_TASKMEMPOOL"
691
692 elif [[ $1 = '-ssjava' ]]
693 then
694 SSJAVA=true
695 USE_SSJAVA_CLASSPATH=true
696 JAVAOPTS="$JAVAOPTS -ssjava"
697
698 elif [[ $1 = '-ssjavadebug' ]]
699 then
700 JAVAOPTS="$JAVAOPTS -ssjavadebug"
701
702 elif [[ $1 = '-ssjavanoclasspath' ]]
703 then
704 USE_SSJAVA_NOCLASSPATH=true
705
706 elif [[ $1 = '-ssjavainfer' ]]
707 then
708 USE_SSJAVA_INFER_CLASSPATH=true
709 JAVAOPTS="$JAVAOPTS -ssjavainfer"
710
711 elif [[ $1 = '-ssjava-infer-naive-writedots' ]]
712 then
713 USE_SSJAVA_INFER_CLASSPATH=true
714 JAVAOPTS="$JAVAOPTS -ssjava-infer-naive-writedots"
715
716 elif [[ $1 = '-ssjava-inject-error' ]]
717 then
718 USE_SSJAVA_CLASSPATH=true
719 JAVAOPTS="$JAVAOPTS -ssjava-inject-error $2 $3"
720 shift
721 shift
722
723 elif [[ $1 = '-mempool-detect-misuse' ]]
724 then
725 EXTRAOPTIONS="$EXTRAOPTIONS -DMEMPOOL_DETECT_MISUSE"
726
727 elif [[ $1 = '-heapsize-mb' ]]
728 then
729 EXTRAOPTIONS="$EXTRAOPTIONS -DINITIALHEAPSIZE_MB=($2)"
730 shift
731
732 elif [[ $1 = '-compiler-heapsize-mb' ]]
733 then
734 COMPILER_HEAP_SIZE="$2"
735 shift
736
737 elif [[ $1 = '-nostalltr' ]]
738 then
739 JAVAOPTS="$JAVAOPTS -nostalltr"
740
741 elif [[ $1 = '-printlinenum' ]]
742 then
743 JAVAOPTS="$JAVAOPTS -printlinenum"
744
745 elif [[ $1 = '-rcr' ]]
746 then
747 JAVAOPTS="$JAVAOPTS -rcr"
748 RCR=true
749 EXTRAOPTIONS="$EXTRAOPTIONS -DRCR -I$ROBUSTROOT/Runtime/oooJava"
750
751 elif [[ $1 = '-rcr_debug' ]]
752 then
753 JAVAOPTS="$JAVAOPTS -rcr_debug"
754 RCR_DEBUG=true
755
756 elif [[ $1 = '-rcr_debug_verbose' ]]
757 then
758 JAVAOPTS="$JAVAOPTS -rcr_debug_verbose"
759 RCR_DEBUG_VERBOSE=true
760
761 elif [[ $1 = '-debug-deque' ]]
762 then
763 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG_DEQUE"
764
765 elif [[ $1 = '-nolock' ]]
766 then
767 EXTRAOPTIONS="$EXTRAOPTIONS -DNOLOCK"
768
769 elif [[ $1 = '-coreprof' ]]
770 then
771 COREPROF=true
772 JAVAOPTS="$JAVAOPTS -coreprof"
773 EXTRAOPTIONS="$EXTRAOPTIONS -DCOREPROF -I$ROBUSTROOT/Runtime/coreprof"
774
775 elif [[ $1 = '-coreprof-eventwords' ]]
776 then
777 EXTRAOPTIONS="$EXTRAOPTIONS -DCP_MAXEVENTWORDS=($2)"
778 shift
779
780 elif [[ $1 = '-coreprof-checkoverflow' ]]
781 then
782 EXTRAOPTIONS="$EXTRAOPTIONS -DCOREPROF_CHECKOVERFLOW"
783
784 elif [[ $1 = '-coreprof-enable' ]]
785 then
786 EXTRAOPTIONS="$EXTRAOPTIONS -D$2"
787 shift
788
789 elif [[ $1 = '-mlp' ]]
790 then
791 MLP_ON=true
792 EXTRAOPTIONS="$EXTRAOPTIONS -DPRECISE_GC -lpthread -DMLP"
793 JAVAOPTS="$JAVAOPTS -mlp $2 $3"
794 shift
795 shift
796
797 elif [[ $1 = '-mlpdebug' ]]
798 then
799 JAVAOPTS="$JAVAOPTS -mlpdebug"
800
801 elif [[ $1 = '-check' ]]
802 then
803 CHECKFLAG=true
804 JAVAOPTS="$JAVAOPTS -conscheck"
805 elif [[ $1 = '-enable-assertions' ]]
806 then
807 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
808 elif [[ $1 = '-specdir' ]]
809 then
810 cd $2
811 SPECDIR=`pwd`
812 cd $CURDIR
813 shift
814 elif [[ $1 = '-debug' ]]
815 then
816 DEBUGFLAG=true
817 EXTRAOPTIONS="$EXTRAOPTIONS -g -rdynamic"
818 elif [[ $1 = '-rawpath' ]]
819 then
820 RAWPATHFLAG=true
821 elif [[ $1 = '-runtimedebug' ]]
822 then
823 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
824 elif [[ $1 = '-dsmcaching' ]]
825 then
826 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
827 elif [[ $1 = '-rangeprefetch' ]]
828 then
829 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
830 elif [[ $1 = '-nooptimize' ]]
831 then
832 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
833 elif [[ $1 = '-optimize' ]]
834 then
835 EXTRAOPTIONS="$EXTRAOPTIONS -O3"
836 elif [[ $1 = '-thread' ]]
837 then
838 JAVAOPTS="$JAVAOPTS -thread"
839 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
840 THREADFLAG=true
841 elif [[ $1 = '-recovery' ]]
842 then
843 EXTRAOPTIONS="$EXTRAOPTIONS -DRECOVERY"
844 DSMRECOVERY=true
845 elif [[ $1 = '-recoverystats' ]]
846 then
847 JAVAOPTS="$JAVAOPTS -recoverystats"
848 EXTRAOPTIONS="$EXTRAOPTIONS -DRECOVERYSTATS"
849 elif [[ $1 = '-distributioninfo' ]]
850 then
851 JAVAOPTS="$JAVAOPTS -distributioninfo"
852 elif [[ $1 = '-disall' ]]
853 then
854 JAVAOPTS="$JAVAOPTS -disall"
855 elif [[ $1 = '-disstart' ]]
856 then
857 JAVAOPTS="$JAVAOPTS -disstart $2"
858 shift
859 elif [[ $1 = '-noc' ]]
860 then
861 CCOMPILEFLAG=false
862 elif [[ $1 = '-curdir' ]]
863 then
864 CURDIR=$2
865 shift
866 elif [[ $1 = '-outputdir' ]]
867 then
868 JAVAOPTS="$JAVAOPTS -outputdir $2"
869 shift
870 else
871 SRCFILES="$SRCFILES $1"
872 fi
873 shift
874 done
875
876
877 BUILDDIR="$CURDIR/$tmpbuilddirectory"
878
879 BAMBOORUNTIME=$ROBUSTROOT/Runtime/bamboo
880
881 cd $1
882 cd $CURDIR
883 shift
884
885 mkdir $BUILDDIR
886
887 if $CHECKFLAG #Generate structure files for repair tool
888 then
889 JAVAOPTS="$JAVAOPTS -struct structfile"
890 fi
891
892 if $TILERAFLAG
893 then
894 # for tilera code, generate multicorememsize.h
895 ./generate_memsize.sh ${TILERA_PAGE_SIZE} ${TILERA_PAGE_SIZE_BITS} ${TILERA_NUM_BLOCKS} ${TILERA_NUM_PAGES_PER_BLOCK} ${BUILDDIR}
896 fi
897
898
899 #########################
900 # Setup class path
901 #########################
902 if $OOOJAVA
903   then
904   # stuff for OoOJava to mask parts of the base
905   JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/OoOJava"  
906 fi
907
908 if $JNI
909   then
910   JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/classpath/ -classlibrary $ROBUSTROOT/classpath/vm/reference/"
911 elif $MGCINTELFLAG
912   then
913   JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/MGC/ -classlibrary $ROBUSTROOT/ClassLibrary/MGC/gnu/"
914
915 elif $MGCFLAG
916   then
917   #base multicore gc files
918   JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/MGC/ -classlibrary $ROBUSTROOT/ClassLibrary/MGC/gnu/"
919
920 elif $USE_SSJAVA_CLASSPATH
921   then
922   if $USE_SSJAVA_INFER_CLASSPATH
923     then
924     JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/SSJavaInfer"
925   elif ! $USE_SSJAVA_NOCLASSPATH
926     then
927     JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/SSJava"  
928   fi
929
930 else
931   JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/"
932
933   if $RECOVERFLAG
934     then
935     if $FASTCHECK
936       then
937       #fast transactions
938       JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
939     else
940       #base bristlecone files
941       JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
942     fi
943
944   elif $DSMFLAG
945     then
946     #dsm stuff
947     JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
948
949   elif $STM
950     then
951     JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
952
953   elif $THREADFLAG
954     then
955     #threading java stuff
956     JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
957
958   else 
959     #base java stuff
960     JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
961   fi
962 fi
963
964 # everyone gets this except ssjava!
965 if ! $USE_SSJAVA_CLASSPATH
966   then
967   JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/"
968 fi
969 #########################
970 # end classpath
971 #########################
972
973
974 echo "compiler running in JVM with heap size: ${COMPILER_HEAP_SIZE}MB"
975
976
977 # Build bristlecone/java sources
978
979 if $MULTICOREFLAG
980   then
981   if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx${COMPILER_HEAP_SIZE}m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main \
982        -dir $BUILDDIR $JAVAOPTS $SRCFILES
983     then exit $?
984   fi
985
986 else
987
988   if $MGCINTELFLAG
989     then
990     if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx${COMPILER_HEAP_SIZE}m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main $JAVAOPTS \
991          -dir $BUILDDIR -precise $SRCFILES
992       then exit $?
993     fi
994
995   else
996     if ! $NOJAVA
997       then
998       if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx${COMPILER_HEAP_SIZE}m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main \
999            -dir $BUILDDIR -precise $JAVAOPTS $SRCFILES
1000         then exit $?
1001       fi
1002     fi
1003   fi
1004 fi
1005
1006 # transfer the input files
1007
1008 if $INPUTFILEFLAG
1009 then
1010 ./ourjavac -cp ../cup:.:$(CLASSPATH) ${ROBUSTROOT}/Tilera/Benchmarks/GC/galois/InputFileTranslator.java
1011 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx${COMPILER_HEAP_SIZE}m -classpath $ROBUSTROOT/Tilera/Benchmarks/GC/galois InputFileTranslator \
1012        -dir $BUILDDIR $INPUTFILEOPTS $INPUTFILES
1013     then exit $?
1014 fi
1015 fi
1016
1017 # after executing Main, if -justanalyze flag, just exit
1018 if $EXITAFTERANALYSIS
1019 then
1020 exit
1021 fi
1022
1023
1024
1025 # Build all of the consistency specs
1026
1027 if $CHECKFLAG # CHECKFLAG
1028 then
1029 cd $SPECDIR
1030 mkdir $BUILDDIR/specdir
1031 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
1032
1033 echo > $BUILDDIR/specs
1034
1035 # compile specs into C code
1036 for i in * # iterate over all directories
1037 do
1038 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
1039 then
1040 cd $SPECDIR/$i
1041 cat $BUILDDIR/structfile.struct $i.label > $i.struct
1042 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
1043 cp size.[c,h] $BUILDDIR/specdir
1044 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
1045 echo $i >> $BUILDDIR/specs
1046 fi # CVSDIR CHECK
1047 done # iterate over all directories
1048
1049 #compile C code
1050
1051 cd $BUILDDIR/specdir
1052 ./buildrobust
1053 echo > $BUILDDIR/checkers.h
1054 for i in `cat $BUILDDIR/specs`
1055 do
1056 gcc -O0 -g -fbounds-check -c $i\_aux.c
1057 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
1058 done
1059 fi # CHECKFLAG
1060
1061 #build and link everything
1062
1063 if $RAWFLAG
1064 then # RAWFLAG
1065 RAWDIR="$CURDIR/raw"
1066 MAKEFILE="Makefile.raw"
1067 mkdir $RAWDIR
1068 cd $RAWDIR
1069 make clean
1070 rm ./*
1071
1072 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
1073
1074 if $RAWPATHFLAG
1075 then # print path
1076 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
1077 fi
1078
1079 if $DEBUGFLAG
1080 then #debug version
1081 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
1082 fi
1083
1084 if $PROFILEFLAG
1085 then # profile version
1086 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
1087 fi
1088
1089 if $ACCURATEPROFILEFLAG
1090 then # accurateprofile version
1091 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DACCURATEPROFILE"
1092 fi
1093
1094 if $USEIOFLAG
1095 then # useio version
1096 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
1097 fi
1098
1099 if $INTERRUPTFLAG
1100 then #INTERRUPT version
1101 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
1102 fi #INTERRUPT version
1103
1104 if $USEIOFLAG
1105 then # useio version
1106 MAKEFILE="$MAKEFILE.io"
1107 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
1108 else
1109 MAKEFILE="$MAKEFILE.$RAWCONFIG"
1110 fi #useio version
1111
1112 cp $BAMBOORUNTIME/RAW/$MAKEFILE ./Makefile
1113 cp ../Runtime/*.c ./
1114 cp ../Runtime/*.h ./
1115 cp ../Runtime/*.S ./
1116 cp ../Runtime/*.s ./
1117 cp $BAMBOORUNTIME/*.c ./
1118 cp $BAMBOORUNTIME/*.h ./
1119 cp $BAMBOORUNTIME/RAW/*.c ./
1120 cp $BAMBOORUNTIME/RAW/*.h ./
1121 cp $BAMBOORUNTIME/RAW/*.S ./
1122 cp $BAMBOORUNTIME/RAW/*.s ./
1123 cp ../$tmpbuilddirectory/*.c ./
1124 cp ../$tmpbuilddirectory/*.h ./
1125
1126 make
1127
1128 elif $TILERAFLAG
1129 then # TILERAFLAG
1130 TILERADIR="$CURDIR/${TILERAOUTPUTDIR}"
1131 if $TILERABMEFLAG
1132 then # TILERABMEFLAG
1133 TILERA_INDIR="BME"
1134 MAKEFILE="Makefile.tilera.$TILERACORES"
1135 #SIMHVC="sim.hvc.$TILERACONFIG"
1136 PCIHVC="pci.hvc.$TILERACORES"
1137 if $TILERA56COREFLAG
1138 then
1139   PCIHVC="$PCIHVC.56"
1140 fi
1141 elif $TILERAZLINUXFLAG
1142 then # TILERAZLINUXFLAG
1143 TILERA_INDIR="ZLinux"
1144 MAKEFILE="Makefile.tilera.$TILERACONFIG"
1145 fi
1146
1147 mkdir $TILERADIR
1148 cd $TILERADIR
1149 make clean
1150 rm ./*
1151
1152 if $MGCFLAG
1153 then
1154 export TILERACFLAGS="-DMULTICORE -DCLOSE_PRINT -DTILERA"
1155 else
1156 export TILERACFLAGS="-DTASK -DMULTICORE -DCLOSE_PRINT -DTILERA"
1157 fi
1158
1159 if $INPUTFILEFLAG
1160 then
1161 TILERACFLAGS="${TILERACFLAGS} -DINPUTFILE"
1162 fi
1163
1164 if $GCTBLDEBUGFLAG
1165 then
1166 TILERACFLAGS="${TILERACFLAGS} -DGC_TBL_DEBUG"
1167 fi
1168
1169 if $OBJECTLOCKDEBUGFLAG
1170 then
1171 TILERACFLAGS="${TILERACFLAGS} -DOBJECT_LOCK_DEBUG"
1172 fi
1173
1174 if $TILERAMEMPROFFLAG
1175 then # not only with 1 core
1176   PCIHVC="$PCIHVC.memprof"
1177   TILERACFLAGS="${TILERACFLAGS} -DBAMBOO_MEMPROF"
1178 fi
1179
1180 if $TILERABMEFLAG
1181 then # TILERABMEFLAG
1182 TILERACFLAGS="${TILERACFLAGS} -DTILERA_BME"
1183 elif $TILERAZLINUXFLAG
1184 then # TILERAZLINUXFLAG
1185 TILERACFLAGS="${TILERACFLAGS} -DTILERA_ZLINUX"
1186 fi
1187
1188 if $RAWPATHFLAG
1189 then # print path
1190 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
1191 fi
1192
1193 if $DEBUGFLAG
1194 then #debug version
1195 TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
1196 fi
1197
1198 if $PROFILEFLAG
1199 then # profile version
1200 TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
1201 fi
1202
1203 if $ACCURATEPROFILEFLAG
1204 then # accurateprofile version
1205 TILERACFLAGS="${TILERACFLAGS} -DACCURATEPROFILE"
1206 fi
1207
1208 if $PROFILEINTERRUPTFLAG
1209 then # profile_interrupt version
1210 TILERACFLAGS="${TILERACFLAGS} -DPROFILE_INTERRUPT"
1211 fi
1212
1213 if $USEIOFLAG
1214 then # useio version
1215 TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
1216 fi
1217
1218 if $INTERRUPTFLAG
1219 then #INTERRUPT version
1220 TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
1221 fi #INTERRUPT version
1222
1223 if $MGCFLAG
1224 then #MGCFLAG
1225 TILERACFLAGS="${TILERACFLAGS} -DMGC -DMGC_SPEC"
1226 fi
1227
1228 if $MULTICOREGCFLAG
1229 then #MULTICOREGC version
1230 TILERACFLAGS="${TILERACFLAGS} -DMULTICORE_GC -D${GCCORES}"
1231 fi
1232
1233 if $PMCFLAG
1234 then #MULTICOREGC version
1235 TILERACFLAGS="${TILERACFLAGS} -DPMC_GC -D${GCCORES}"
1236 fi
1237
1238 if $PERFCOUNT
1239 then #MULTICOREGC version
1240 TILERACFLAGS="${TILERACFLAGS} -DPERFCOUNT"
1241 fi
1242
1243 if $MEMPERFCOUNT
1244 then #MULTICOREGC version
1245 TILERACFLAGS="${TILERACFLAGS} -DMEMPERFCOUNT"
1246 fi
1247
1248 if $GCPROFILEFLAG
1249 then # GC_PROFILE version
1250 TILERACFLAGS="${TILERACFLAGS} -DGC_PROFILE"
1251 fi
1252
1253 if $GCPROFILESFLAG
1254 then # GC_PROFILE_S version
1255 TILERACFLAGS="${TILERACFLAGS} -DGC_PROFILE_S"
1256 fi
1257
1258 if $GCMEMLOCALFLAG
1259 then # SMEMLOCAL version
1260 TILERACFLAGS="${TILERACFLAGS} -DSMEML"
1261 fi
1262
1263 if $GCMEMFIXEDFLAG
1264 then # SMEMFIXED version
1265 TILERACFLAGS="${TILERACFLAGS} -DSMEMF"
1266 fi
1267
1268 if $GCMEMMIXEDFLAG
1269 then # SMEMMIXED version
1270 TILERACFLAGS="${TILERACFLAGS} -DSMEMM"
1271 fi
1272
1273 if $GCMEMGLOBALFLAG
1274 then # SMEMGLOBAL version
1275 TILERACFLAGS="${TILERACFLAGS} -DSMEMG"
1276 fi
1277
1278 if $GCCACHELOCALFLAG
1279 then # CACHE_LOCAL version
1280 TILERACFLAGS="${TILERACFLAGS} -DCACHE_LOCAL"
1281 fi
1282
1283 if $GCCACHERANFLAG
1284 then # CACHE_RAN version
1285 TILERACFLAGS="${TILERACFLAGS} -DCACHE_RAN"
1286 fi
1287
1288 if $GCCONTROLLERNEARFLAG
1289 then # CONTROLLER_NEAR version
1290 TILERACFLAGS="${TILERACFLAGS} -DCONTROLLER_NEAR"
1291 fi
1292
1293 if $GCCONTROLLERREMOTEFLAG
1294 then # CONTROLLER_REMOTE version
1295 TILERACFLAGS="${TILERACFLAGS} -DCONTROLLER_REMOTE"
1296 fi
1297
1298 if $GCSMALLPAGESIZEFLAG
1299 then # GC_SMALLPAGESIZE version
1300 TILERACFLAGS="${TILERACFLAGS} -DGC_SMALLPAGESIZE"
1301 fi
1302
1303 if $GCLARGEPAGESIZEFLAG
1304 then # GC_LARGEPAGESIZE version
1305 TILERACFLAGS="${TILERACFLAGS} -DGC_LARGEPAGESIZE"
1306 fi
1307
1308 if $GCLARGEPAGESIZE2FLAG
1309 then # GC_LARGEPAGESIZE2 version
1310 TILERACFLAGS="${TILERACFLAGS} -DGC_LARGEPAGESIZE2"
1311 fi
1312
1313 if $GCLARGESHAREDHEAPFLAG
1314 then # GC_LARGESHAREDHEAP version
1315 TILERACFLAGS="${TILERACFLAGS} -DGC_LARGESHAREDHEAP"
1316 fi
1317
1318 if $GCSMALLPAGESIZEFLAG2
1319 then # GC_SMALLPAGESIZE2 version
1320 TILERACFLAGS="${TILERACFLAGS} -DGC_SMALLPAGESIZE2"
1321 fi
1322
1323 if $GCLARGESHAREDHEAPFLAG2
1324 then # GC_LARGESHAREDHEAP2 version
1325 TILERACFLAGS="${TILERACFLAGS} -DGC_LARGESHAREDHEAP2"
1326 fi
1327
1328 if $GCCACHEADAPTFLAG
1329 then # GC_CACHE_ADAPT version
1330 TILERACFLAGS="${TILERACFLAGS} -DGC_CACHE_ADAPT"
1331 fi
1332
1333 if $GCCACHEADAPTPOLICYFLAG
1334 then # GC_CACHE_ADAPT version
1335 TILERACFLAGS="${TILERACFLAGS} -DGC_CACHE_ADAPT_POLICY${GCCACHEADAPTPOLICY}"
1336 fi
1337
1338 if $GCCACHESAMPLINGFLAG
1339 then # GC_CACHE_ADAPT version
1340 TILERACFLAGS="${TILERACFLAGS} -DGC_CACHE_SAMPLING"
1341 fi
1342
1343 if $GCCACHECOHERENTFLAG
1344 then # gc cache coherent version
1345 TILERACFLAGS="${TILERACFLAGS} -DGC_CACHE_COHERENT_ON"
1346 fi
1347
1348 if $PMCFLAG
1349 then
1350 cp $ROBUSTROOT/Tilera/Runtime/PMC/$MAKEFILE ./Makefile
1351 elif $MGCFLAG
1352 then
1353 cp $ROBUSTROOT/Tilera/Runtime/MGC/$MAKEFILE ./Makefile
1354 else
1355 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$MAKEFILE ./Makefile
1356 fi
1357 if $TILERABMEFLAG
1358 then # TILERABMEFLAG
1359 #cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$SIMHVC ./sim.hvc
1360 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$PCIHVC ./pci.hvc
1361 if $TILERA56COREFLAG
1362 then
1363 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/bamboo-vmlinux-pci.hvc.56 ./bamboo-vmlinux-pci.hvc.56
1364 else
1365 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/bamboo-vmlinux-pci.hvc ./bamboo-vmlinux-pci.hvc
1366 fi
1367 fi
1368 cp ../Runtime/Queue.c ./
1369 cp ../Runtime/file.c ./
1370 cp ../Runtime/math.c ./
1371 if [ !$MGCFLAG ]
1372 then
1373 cp ../Runtime/object.c ./
1374 fi
1375 cp ../Runtime/GenericHashtable.c ./
1376 cp ../Runtime/SimpleHash.c ./
1377 cp ../Runtime/ObjectHash.c ./
1378 cp ../Runtime/socket.c ./
1379 cp ../Runtime/mem.c ./
1380 cp ../Runtime/GenericHashtable.h ./
1381 cp ../Runtime/mem.h ./
1382 if [ !$MGCFLAG ]
1383 then
1384 cp ../Runtime/object.h ./
1385 fi
1386 cp ../Runtime/ObjectHash.h ./
1387 cp ../Runtime/Queue.h ./
1388 cp ../Runtime/runtime.h ./
1389 cp ../Runtime/SimpleHash.h ./
1390 cp ../Runtime/objtypes.h ./
1391 cp $BAMBOORUNTIME/*.c ./
1392 cp $BAMBOORUNTIME/*.h ./
1393 cp ../Tilera/Runtime/*.c ./
1394 cp ../Tilera/Runtime/*.h ./
1395 cp ../Tilera/Runtime/$TILERA_INDIR/*.c ./
1396 cp ../Tilera/Runtime/$TILERA_INDIR/*.h ./
1397 if $TILERAZLINUXFLAG
1398 then # TILERAZLINUXFLAG
1399 cp ../Tilera/Runtime/$TILERA_INDIR/*.S ./
1400 fi
1401 #if $TILERAMEMPROFFLAG
1402 #then # TILERAMEMPROFFLAG
1403 cp ../Tilera/Runtime/$TILERA_INDIR/linux_client.c ./
1404 #fi
1405 if $MGCFLAG
1406 then
1407 cp ../Tilera/Runtime/MGC/*.c ./
1408 cp ../Tilera/Runtime/MGC/*.h ./
1409 fi
1410 cp ../Tilera/lib/* ./
1411 cp ../$tmpbuilddirectory/*.c ./
1412 cp ../$tmpbuilddirectory/*.h ./
1413
1414 echo $TILERACFLAGS > ./tileracflags.txt
1415
1416 make
1417
1418 else #!RAWFLAG && !TILERABMEFLAG  && ! TILERAZLINUXFLAG
1419 cd $CURDIR 
1420
1421 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
1422 -I$BUILDDIR"
1423
1424 if $MULTICOREFLAG
1425 then
1426 RUNTIMEFILE="$BAMBOORUNTIME/multicoreruntime.c $BAMBOORUNTIME/multicoretask.c"
1427 INCLUDES="$INCLUDES -I$BAMBOORUNTIME"
1428 else
1429 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
1430 fi
1431
1432 FILES="$RUNTIMEFILE \
1433 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
1434 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
1435 $ROBUSTROOT/Runtime/ObjectHash.c \
1436 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
1437 $ROBUSTROOT/Runtime/taskgarbage.c $ROBUSTROOT/Runtime/oojgarbage.c \
1438 $ROBUSTROOT/Runtime/math.c \
1439 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
1440
1441 if $JNI
1442 then
1443 FILES="$FILES $ROBUSTROOT/Runtime/jni/jni.c $ROBUSTROOT/Runtime/jni/jni-stuff.c"
1444 fi
1445
1446 if $NUMA
1447 then
1448 FILES="$FILES $ROBUSTROOT/Runtime/affinity.c"
1449 fi
1450
1451 if $EVENTMONITOR
1452 then
1453 FILES="$FILES $ROBUSTROOT/Runtime/STM/monitor.c"
1454 fi
1455
1456 if $FASTMEMCPY
1457 then
1458 FILES="$FILES $ROBUSTROOT/Runtime/memcpy32.o $ROBUSTROOT/Runtime/instrset32.o"
1459 fi
1460
1461 if $DSMFLAG
1462 then
1463 if $DSMRECOVERY
1464 then
1465 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRECOVERYRUNTIME"
1466 FILES="$FILES $DSMRECOVERYRUNTIME/trans.c $DSMRECOVERYRUNTIME/mcpileq.c $DSMRECOVERYRUNTIME/objstr.c $DSMRECOVERYRUNTIME/dstm.c $DSMRECOVERYRUNTIME/altmlookup.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/altprelookup.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 $DSMRECOVERYRUNTIME/translist.c $DSMRECOVERYRUNTIME/paxos.c"
1467 else
1468 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
1469 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"
1470 fi
1471 fi
1472
1473 if $STM
1474 then
1475 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$STMRUNTIME"
1476 FILES="$FILES $STMRUNTIME/stmlock.c $STMRUNTIME/stm.c $STMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c $STMRUNTIME/stats.c $STMRUNTIME/commit.c $STMRUNTIME/objstr.c"
1477 fi
1478
1479 if $SANDBOX
1480 then
1481 if $DSMFLAG
1482 then
1483 FILES="$FILES $DSMRUNTIME/sandbox.c"
1484 else
1485 FILES="$FILES $STMRUNTIME/sandbox.c"
1486 fi
1487 fi
1488
1489 if $ABORTREADERS
1490 then
1491 FILES="$FILES $DSMRUNTIME/abortreaders.c"
1492 fi
1493
1494 if $FASTCHECK
1495 then
1496 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
1497 fi
1498
1499 if $COREPROF
1500 then
1501 FILES="$FILES $ROBUSTROOT/Runtime/coreprof/coreprof.c"
1502 fi
1503
1504 if $RCR
1505 then
1506 FILES="$FILES $tmpbuilddirectory/RuntimeConflictResolver.c $ROBUSTROOT/Runtime/oooJava/hashRCR.c $ROBUSTROOT/Runtime/oooJava/Queue_RCR.c $ROBUSTROOT/Runtime/oooJava/hashStructure.c $ROBUSTROOT/Runtime/oooJava/trqueue.c $ROBUSTROOT/Runtime/oooJava/rcr_runtime.c"
1507 fi
1508
1509 if $MLP_ON
1510 then
1511 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
1512 FILES="$FILES $ROBUSTROOT/Runtime/psemaphore.c"
1513 FILES="$FILES $ROBUSTROOT/Runtime/workschedule.c"
1514 if ! $SQUEUE
1515 then
1516 FILES="$FILES $ROBUSTROOT/Runtime/deque.c"
1517 fi
1518 fi
1519
1520 if $RECOVERFLAG
1521 then
1522 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
1523 if $MULTICOREFLAG
1524 then
1525 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
1526 fi
1527 FILES="$FILES $tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
1528 if $RAWFLAG
1529 then
1530 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
1531 fi
1532 if $THREADSIMULATEFLAG
1533 then
1534 # -lpthread for pthread functions, -lrt for message queue functions
1535 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
1536 fi
1537 fi
1538
1539 if $OPTIONALFLAG
1540 then
1541 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
1542 FILES="$FILES $tmpbuilddirectory/optionalarrays.c"
1543 fi
1544
1545 if $THREADFLAG
1546 then
1547 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
1548 fi
1549
1550 if $CHECKFLAG
1551 then
1552 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
1553 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
1554 fi
1555
1556 if $USEDMALLOC
1557 then
1558 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
1559 fi
1560
1561 echo Compiling C...
1562 echo EXTRAOPTIONS=$EXTRAOPTIONS
1563
1564 if $ASSEMBLY
1565 then
1566 gcc -S $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
1567 -c $tmpbuilddirectory/methods.c -lm
1568 fi
1569
1570 if $MULTICOREFLAG
1571 then
1572 NONMULTICOREOPTS=
1573 else
1574 NONMULTICOREOPTS=-DPRECISE_GC
1575 fi
1576
1577 if $SRCAFTERPP
1578 then
1579 gcc -E $INCLUDES $EXTRAOPTIONS $NONMULTICOREOPTS \
1580 $tmpbuilddirectory/methods.c $FILES > tmp.c
1581 fi
1582
1583 gcc $INCLUDES $EXTRAOPTIONS $NONMULTICOREOPTS \
1584 $tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
1585
1586
1587 fi #!RAWFLAG
1588
1589
1590 exit
1591