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