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