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