decouple ssjava code gen to prevent crashes from the analysis, so we can turn it...
[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
873 elif $MGCINTELFLAG
874   then
875   JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/MGC/ -classlibrary $ROBUSTROOT/ClassLibrary/MGC/gnu/"
876
877 elif $MGCFLAG
878   then
879   #base multicore gc files
880   JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/MGC/ -classlibrary $ROBUSTROOT/ClassLibrary/MGC/gnu/"
881
882 elif $USE_SSJAVA_CLASSPATH
883   then
884   JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/SSJava"  
885
886 else
887   if $RECOVERFLAG
888     then
889     if $FASTCHECK
890       then
891       #fast transactions
892       JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
893     else
894       #base bristlecone files
895       JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
896     fi
897
898   elif $DSMFLAG
899     then
900     #dsm stuff
901     JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
902
903   elif $STM
904     then
905     JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
906
907   elif $THREADFLAG
908     then
909     #threading java stuff
910     JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
911
912   else 
913     #base java stuff
914     JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
915   fi
916 fi
917
918 # everyone gets this except ssjava!
919 if ! $USE_SSJAVA_CLASSPATH
920   then
921   JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/"
922 fi
923 #########################
924 # end classpath
925 #########################
926
927
928 echo "compiler running in JVM with heap size: ${COMPILER_HEAP_SIZE}MB"
929
930
931 # Build bristlecone/java sources
932
933 if $MULTICOREFLAG
934   then
935   if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx${COMPILER_HEAP_SIZE}m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main \
936        -dir $BUILDDIR $JAVAOPTS $SRCFILES
937     then exit $?
938   fi
939
940 else
941
942   if $MGCINTELFLAG
943     then
944     if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx${COMPILER_HEAP_SIZE}m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main $JAVAOPTS \
945          -dir $BUILDDIR -precise $SRCFILES
946       then exit $?
947     fi
948
949   else
950     if ! $NOJAVA
951       then
952       if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx${COMPILER_HEAP_SIZE}m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main \
953            -dir $BUILDDIR -precise $JAVAOPTS $SRCFILES
954         then exit $?
955       fi
956     fi
957   fi
958 fi
959
960 # after executing Main, if -justanalyze flag, just exit
961 if $EXITAFTERANALYSIS
962 then
963 exit
964 fi
965
966
967
968 # Build all of the consistency specs
969
970 if $CHECKFLAG # CHECKFLAG
971 then
972 cd $SPECDIR
973 mkdir $BUILDDIR/specdir
974 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
975
976 echo > $BUILDDIR/specs
977
978 # compile specs into C code
979 for i in * # iterate over all directories
980 do
981 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
982 then
983 cd $SPECDIR/$i
984 cat $BUILDDIR/structfile.struct $i.label > $i.struct
985 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
986 cp size.[c,h] $BUILDDIR/specdir
987 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
988 echo $i >> $BUILDDIR/specs
989 fi # CVSDIR CHECK
990 done # iterate over all directories
991
992 #compile C code
993
994 cd $BUILDDIR/specdir
995 ./buildrobust
996 echo > $BUILDDIR/checkers.h
997 for i in `cat $BUILDDIR/specs`
998 do
999 gcc -O0 -g -fbounds-check -c $i\_aux.c
1000 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
1001 done
1002 fi # CHECKFLAG
1003
1004 #build and link everything
1005
1006 if $RAWFLAG
1007 then # RAWFLAG
1008 RAWDIR="$CURDIR/raw"
1009 MAKEFILE="Makefile.raw"
1010 mkdir $RAWDIR
1011 cd $RAWDIR
1012 make clean
1013 rm ./*
1014
1015 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
1016
1017 if $RAWPATHFLAG
1018 then # print path
1019 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
1020 fi
1021
1022 if $DEBUGFLAG
1023 then #debug version
1024 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
1025 fi
1026
1027 if $PROFILEFLAG
1028 then # profile version
1029 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
1030 fi
1031
1032 if $ACCURATEPROFILEFLAG
1033 then # accurateprofile version
1034 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DACCURATEPROFILE"
1035 fi
1036
1037 if $USEIOFLAG
1038 then # useio version
1039 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
1040 fi
1041
1042 if $INTERRUPTFLAG
1043 then #INTERRUPT version
1044 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
1045 fi #INTERRUPT version
1046
1047 if $USEIOFLAG
1048 then # useio version
1049 MAKEFILE="$MAKEFILE.io"
1050 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
1051 else
1052 MAKEFILE="$MAKEFILE.$RAWCONFIG"
1053 fi #useio version
1054
1055 cp $BAMBOORUNTIME/RAW/$MAKEFILE ./Makefile
1056 cp ../Runtime/*.c ./
1057 cp ../Runtime/*.h ./
1058 cp ../Runtime/*.S ./
1059 cp ../Runtime/*.s ./
1060 cp $BAMBOORUNTIME/*.c ./
1061 cp $BAMBOORUNTIME/*.h ./
1062 cp $BAMBOORUNTIME/RAW/*.c ./
1063 cp $BAMBOORUNTIME/RAW/*.h ./
1064 cp $BAMBOORUNTIME/RAW/*.S ./
1065 cp $BAMBOORUNTIME/RAW/*.s ./
1066 cp ../$tmpbuilddirectory/*.c ./
1067 cp ../$tmpbuilddirectory/*.h ./
1068
1069 make
1070
1071 elif $TILERAFLAG
1072 then # TILERAFLAG
1073 TILERADIR="$CURDIR/${TILERAOUTPUTDIR}"
1074 if $TILERABMEFLAG
1075 then # TILERABMEFLAG
1076 TILERA_INDIR="BME"
1077 MAKEFILE="Makefile.tilera.$TILERACORES"
1078 #SIMHVC="sim.hvc.$TILERACONFIG"
1079 PCIHVC="pci.hvc.$TILERACORES"
1080 if $TILERA56COREFLAG
1081 then
1082   PCIHVC="$PCIHVC.56"
1083 fi
1084 elif $TILERAZLINUXFLAG
1085 then # TILERAZLINUXFLAG
1086 TILERA_INDIR="ZLinux"
1087 MAKEFILE="Makefile.tilera.$TILERACONFIG"
1088 fi
1089
1090 mkdir $TILERADIR
1091 cd $TILERADIR
1092 make clean
1093 rm ./*
1094
1095 if $MGCFLAG
1096 then
1097 export TILERACFLAGS="-DMULTICORE -DCLOSE_PRINT -DTILERA"
1098 else
1099 export TILERACFLAGS="-DTASK -DMULTICORE -DCLOSE_PRINT -DTILERA"
1100 fi
1101
1102 if $GCTBLDEBUGFLAG
1103 then
1104 TILERACFLAGS="${TILERACFLAGS} -DGC_TBL_DEBUG"
1105 fi
1106
1107 if $OBJECTLOCKDEBUGFLAG
1108 then
1109 TILERACFLAGS="${TILERACFLAGS} -DOBJECT_LOCK_DEBUG"
1110 fi
1111
1112 if $TILERAMEMPROFFLAG
1113 then # not only with 1 core
1114   PCIHVC="$PCIHVC.memprof"
1115   TILERACFLAGS="${TILERACFLAGS} -DBAMBOO_MEMPROF"
1116 fi
1117
1118 if $TILERABMEFLAG
1119 then # TILERABMEFLAG
1120 TILERACFLAGS="${TILERACFLAGS} -DTILERA_BME"
1121 elif $TILERAZLINUXFLAG
1122 then # TILERAZLINUXFLAG
1123 TILERACFLAGS="${TILERACFLAGS} -DTILERA_ZLINUX"
1124 fi
1125
1126 if $RAWPATHFLAG
1127 then # print path
1128 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
1129 fi
1130
1131 if $DEBUGFLAG
1132 then #debug version
1133 TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
1134 fi
1135
1136 if $PROFILEFLAG
1137 then # profile version
1138 TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
1139 fi
1140
1141 if $ACCURATEPROFILEFLAG
1142 then # accurateprofile version
1143 TILERACFLAGS="${TILERACFLAGS} -DACCURATEPROFILE"
1144 fi
1145
1146 if $PROFILEINTERRUPTFLAG
1147 then # profile_interrupt version
1148 TILERACFLAGS="${TILERACFLAGS} -DPROFILE_INTERRUPT"
1149 fi
1150
1151 if $USEIOFLAG
1152 then # useio version
1153 TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
1154 fi
1155
1156 if $INTERRUPTFLAG
1157 then #INTERRUPT version
1158 TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
1159 fi #INTERRUPT version
1160
1161 if $MGCFLAG
1162 then #MGCFLAG
1163 TILERACFLAGS="${TILERACFLAGS} -DMGC -DMGC_SPEC"
1164 fi
1165
1166 if $MULTICOREGCFLAG
1167 then #MULTICOREGC version
1168 TILERACFLAGS="${TILERACFLAGS} -DMULTICORE_GC -D${GCCORES}"
1169 fi
1170
1171 if $PMCFLAG
1172 then #MULTICOREGC version
1173 TILERACFLAGS="${TILERACFLAGS} -DPMC_GC -D${GCCORES}"
1174 fi
1175
1176 if $PERFCOUNT
1177 then #MULTICOREGC version
1178 TILERACFLAGS="${TILERACFLAGS} -DPERFCOUNT"
1179 fi
1180
1181 if $MEMPERFCOUNT
1182 then #MULTICOREGC version
1183 TILERACFLAGS="${TILERACFLAGS} -DMEMPERFCOUNT"
1184 fi
1185
1186 if $GCPROFILEFLAG
1187 then # GC_PROFILE version
1188 TILERACFLAGS="${TILERACFLAGS} -DGC_PROFILE"
1189 fi
1190
1191 if $GCPROFILESFLAG
1192 then # GC_PROFILE_S version
1193 TILERACFLAGS="${TILERACFLAGS} -DGC_PROFILE_S"
1194 fi
1195
1196 if $GCMEMLOCALFLAG
1197 then # SMEMLOCAL version
1198 TILERACFLAGS="${TILERACFLAGS} -DSMEML"
1199 fi
1200
1201 if $GCMEMFIXEDFLAG
1202 then # SMEMFIXED version
1203 TILERACFLAGS="${TILERACFLAGS} -DSMEMF"
1204 fi
1205
1206 if $GCMEMMIXEDFLAG
1207 then # SMEMMIXED version
1208 TILERACFLAGS="${TILERACFLAGS} -DSMEMM"
1209 fi
1210
1211 if $GCMEMGLOBALFLAG
1212 then # SMEMGLOBAL version
1213 TILERACFLAGS="${TILERACFLAGS} -DSMEMG"
1214 fi
1215
1216 if $GCCACHELOCALFLAG
1217 then # CACHE_LOCAL version
1218 TILERACFLAGS="${TILERACFLAGS} -DCACHE_LOCAL"
1219 fi
1220
1221 if $GCCACHERANFLAG
1222 then # CACHE_RAN version
1223 TILERACFLAGS="${TILERACFLAGS} -DCACHE_RAN"
1224 fi
1225
1226 if $GCCONTROLLERNEARFLAG
1227 then # CONTROLLER_NEAR version
1228 TILERACFLAGS="${TILERACFLAGS} -DCONTROLLER_NEAR"
1229 fi
1230
1231 if $GCCONTROLLERREMOTEFLAG
1232 then # CONTROLLER_REMOTE version
1233 TILERACFLAGS="${TILERACFLAGS} -DCONTROLLER_REMOTE"
1234 fi
1235
1236 if $GCSMALLPAGESIZEFLAG
1237 then # GC_SMALLPAGESIZE version
1238 TILERACFLAGS="${TILERACFLAGS} -DGC_SMALLPAGESIZE"
1239 fi
1240
1241 if $GCLARGEPAGESIZEFLAG
1242 then # GC_LARGEPAGESIZE version
1243 TILERACFLAGS="${TILERACFLAGS} -DGC_LARGEPAGESIZE"
1244 fi
1245
1246 if $GCLARGEPAGESIZE2FLAG
1247 then # GC_LARGEPAGESIZE2 version
1248 TILERACFLAGS="${TILERACFLAGS} -DGC_LARGEPAGESIZE2"
1249 fi
1250
1251 if $GCLARGESHAREDHEAPFLAG
1252 then # GC_LARGESHAREDHEAP version
1253 TILERACFLAGS="${TILERACFLAGS} -DGC_LARGESHAREDHEAP"
1254 fi
1255
1256 if $GCSMALLPAGESIZEFLAG2
1257 then # GC_SMALLPAGESIZE2 version
1258 TILERACFLAGS="${TILERACFLAGS} -DGC_SMALLPAGESIZE2"
1259 fi
1260
1261 if $GCLARGESHAREDHEAPFLAG2
1262 then # GC_LARGESHAREDHEAP2 version
1263 TILERACFLAGS="${TILERACFLAGS} -DGC_LARGESHAREDHEAP2"
1264 fi
1265
1266 if $GCCACHEADAPTFLAG
1267 then # GC_CACHE_ADAPT version
1268 TILERACFLAGS="${TILERACFLAGS} -DGC_CACHE_ADAPT"
1269 fi
1270
1271 if $GCCACHEADAPTPOLICYFLAG
1272 then # GC_CACHE_ADAPT version
1273 TILERACFLAGS="${TILERACFLAGS} -DGC_CACHE_ADAPT_POLICY${GCCACHEADAPTPOLICY}"
1274 fi
1275
1276 if $GCCACHESAMPLINGFLAG
1277 then # GC_CACHE_ADAPT version
1278 TILERACFLAGS="${TILERACFLAGS} -DGC_CACHE_SAMPLING"
1279 fi
1280
1281 if $GCCACHECOHERENTFLAG
1282 then # gc cache coherent version
1283 TILERACFLAGS="${TILERACFLAGS} -DGC_CACHE_COHERENT_ON"
1284 fi
1285
1286 if $PMCFLAG
1287 then
1288 cp $ROBUSTROOT/Tilera/Runtime/PMC/$MAKEFILE ./Makefile
1289 elif $MGCFLAG
1290 then
1291 cp $ROBUSTROOT/Tilera/Runtime/MGC/$MAKEFILE ./Makefile
1292 else
1293 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$MAKEFILE ./Makefile
1294 fi
1295 if $TILERABMEFLAG
1296 then # TILERABMEFLAG
1297 #cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$SIMHVC ./sim.hvc
1298 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$PCIHVC ./pci.hvc
1299 if $TILERA56COREFLAG
1300 then
1301 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/bamboo-vmlinux-pci.hvc.56 ./bamboo-vmlinux-pci.hvc.56
1302 else
1303 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/bamboo-vmlinux-pci.hvc ./bamboo-vmlinux-pci.hvc
1304 fi
1305 fi
1306 cp ../Runtime/Queue.c ./
1307 cp ../Runtime/file.c ./
1308 cp ../Runtime/math.c ./
1309 if [ !$MGCFLAG ]
1310 then
1311 cp ../Runtime/object.c ./
1312 fi
1313 cp ../Runtime/GenericHashtable.c ./
1314 cp ../Runtime/SimpleHash.c ./
1315 cp ../Runtime/ObjectHash.c ./
1316 cp ../Runtime/socket.c ./
1317 cp ../Runtime/mem.c ./
1318 cp ../Runtime/GenericHashtable.h ./
1319 cp ../Runtime/mem.h ./
1320 if [ !$MGCFLAG ]
1321 then
1322 cp ../Runtime/object.h ./
1323 fi
1324 cp ../Runtime/ObjectHash.h ./
1325 cp ../Runtime/Queue.h ./
1326 cp ../Runtime/runtime.h ./
1327 cp ../Runtime/SimpleHash.h ./
1328 cp ../Runtime/objtypes.h ./
1329 cp $BAMBOORUNTIME/*.c ./
1330 cp $BAMBOORUNTIME/*.h ./
1331 cp ../Tilera/Runtime/*.c ./
1332 cp ../Tilera/Runtime/*.h ./
1333 cp ../Tilera/Runtime/$TILERA_INDIR/*.c ./
1334 cp ../Tilera/Runtime/$TILERA_INDIR/*.h ./
1335 if $TILERAZLINUXFLAG
1336 then # TILERAZLINUXFLAG
1337 cp ../Tilera/Runtime/$TILERA_INDIR/*.S ./
1338 fi
1339 #if $TILERAMEMPROFFLAG
1340 #then # TILERAMEMPROFFLAG
1341 cp ../Tilera/Runtime/$TILERA_INDIR/linux_client.c ./
1342 #fi
1343 if $MGCFLAG
1344 then
1345 cp ../Tilera/Runtime/MGC/*.c ./
1346 cp ../Tilera/Runtime/MGC/*.h ./
1347 fi
1348 cp ../Tilera/lib/* ./
1349 cp ../$tmpbuilddirectory/*.c ./
1350 cp ../$tmpbuilddirectory/*.h ./
1351
1352 echo $TILERACFLAGS > ./tileracflags.txt
1353
1354 make
1355
1356 else #!RAWFLAG && !TILERABMEFLAG  && ! TILERAZLINUXFLAG
1357 cd $CURDIR 
1358
1359 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
1360 -I$BUILDDIR"
1361
1362 if $MULTICOREFLAG
1363 then
1364 RUNTIMEFILE="$BAMBOORUNTIME/multicoreruntime.c $BAMBOORUNTIME/multicoretask.c"
1365 INCLUDES="$INCLUDES -I$BAMBOORUNTIME"
1366 else
1367 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
1368 fi
1369
1370 FILES="$RUNTIMEFILE \
1371 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
1372 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
1373 $ROBUSTROOT/Runtime/ObjectHash.c \
1374 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
1375 $ROBUSTROOT/Runtime/taskgarbage.c $ROBUSTROOT/Runtime/oojgarbage.c \
1376 $ROBUSTROOT/Runtime/math.c \
1377 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
1378
1379 if $JNI
1380 then
1381 FILES="$FILES $ROBUSTROOT/Runtime/jni/jni.c $ROBUSTROOT/Runtime/jni/jni-stuff.c"
1382 fi
1383
1384 if $NUMA
1385 then
1386 FILES="$FILES $ROBUSTROOT/Runtime/affinity.c"
1387 fi
1388
1389 if $EVENTMONITOR
1390 then
1391 FILES="$FILES $ROBUSTROOT/Runtime/STM/monitor.c"
1392 fi
1393
1394 if $FASTMEMCPY
1395 then
1396 FILES="$FILES $ROBUSTROOT/Runtime/memcpy32.o $ROBUSTROOT/Runtime/instrset32.o"
1397 fi
1398
1399 if $DSMFLAG
1400 then
1401 if $DSMRECOVERY
1402 then
1403 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRECOVERYRUNTIME"
1404 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"
1405 else
1406 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
1407 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"
1408 fi
1409 fi
1410
1411 if $STM
1412 then
1413 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$STMRUNTIME"
1414 FILES="$FILES $STMRUNTIME/stmlock.c $STMRUNTIME/stm.c $STMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c $STMRUNTIME/stats.c $STMRUNTIME/commit.c $STMRUNTIME/objstr.c"
1415 fi
1416
1417 if $SANDBOX
1418 then
1419 if $DSMFLAG
1420 then
1421 FILES="$FILES $DSMRUNTIME/sandbox.c"
1422 else
1423 FILES="$FILES $STMRUNTIME/sandbox.c"
1424 fi
1425 fi
1426
1427 if $ABORTREADERS
1428 then
1429 FILES="$FILES $DSMRUNTIME/abortreaders.c"
1430 fi
1431
1432 if $FASTCHECK
1433 then
1434 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
1435 fi
1436
1437 if $COREPROF
1438 then
1439 FILES="$FILES $ROBUSTROOT/Runtime/coreprof/coreprof.c"
1440 fi
1441
1442 if $RCR
1443 then
1444 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"
1445 fi
1446
1447 if $MLP_ON
1448 then
1449 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
1450 FILES="$FILES $ROBUSTROOT/Runtime/psemaphore.c"
1451 FILES="$FILES $ROBUSTROOT/Runtime/workschedule.c"
1452 if ! $SQUEUE
1453 then
1454 FILES="$FILES $ROBUSTROOT/Runtime/deque.c"
1455 fi
1456 fi
1457
1458 if $RECOVERFLAG
1459 then
1460 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
1461 if $MULTICOREFLAG
1462 then
1463 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
1464 fi
1465 FILES="$FILES $tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
1466 if $RAWFLAG
1467 then
1468 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
1469 fi
1470 if $THREADSIMULATEFLAG
1471 then
1472 # -lpthread for pthread functions, -lrt for message queue functions
1473 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
1474 fi
1475 fi
1476
1477 if $OPTIONALFLAG
1478 then
1479 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
1480 FILES="$FILES $tmpbuilddirectory/optionalarrays.c"
1481 fi
1482
1483 if $THREADFLAG
1484 then
1485 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
1486 fi
1487
1488 if $CHECKFLAG
1489 then
1490 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
1491 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
1492 fi
1493
1494 if $USEDMALLOC
1495 then
1496 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
1497 fi
1498
1499 echo Compiling C...
1500 echo EXTRAOPTIONS=$EXTRAOPTIONS
1501
1502 if $ASSEMBLY
1503 then
1504 gcc -S $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
1505 -c $tmpbuilddirectory/methods.c -lm
1506 fi
1507
1508 if $MULTICOREFLAG
1509 then
1510 NONMULTICOREOPTS=
1511 else
1512 NONMULTICOREOPTS=-DPRECISE_GC
1513 fi
1514
1515 if $SRCAFTERPP
1516 then
1517 gcc -E $INCLUDES $EXTRAOPTIONS $NONMULTICOREOPTS \
1518 $tmpbuilddirectory/methods.c $FILES > tmp.c
1519 fi
1520
1521 gcc $INCLUDES $EXTRAOPTIONS $NONMULTICOREOPTS \
1522 $tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
1523
1524
1525 fi #!RAWFLAG
1526
1527
1528 exit
1529