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