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