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