changes
[IRC.git] / Robust / src / buildscript
index 3cd43eebd7861adfa7ae8d2d97c20f424f6cb517..dbef4861556d0d5572ae4376e58f0d821c817f81 100755 (executable)
@@ -32,6 +32,7 @@ echo -rcr_debug_verbose in addition to above, also prints out effects passed in,
 echo -squeue use single queue
 echo -corepin use core pinning
 echo -nostalltr turn off RCR traversers that only handle conflicts between task and stallsite
+echo -nolock turn off synchronization lock
 echo
 echo Disjoint Reachability Analysis options
 echo -disjoint enable analysis
@@ -49,6 +50,8 @@ echo -disjoint-dvisit-stack-callees-on-top alternate stack strat
 echo -disjoint-dvisit-pqueue use prio. q strat to visit descriptors
 echo -disjoint-desire-determinism set above interproc for determinism
 echo -disjoint-debug-scheduling debug when methods are scheduled for analysis
+echo
+echo -pointsto-check-v-runtime check allocation site of pointer targets at runtime to help verify heap analysis results
 echo 
 echo "-mlp <num cores> <max sese age> build mlp code"
 echo -mlpdebug if mlp, report progress and interim results
@@ -66,7 +69,6 @@ echo "-disall  execute to collect whole distribution"
 echo "-disstart specify the start number of distribution information collection"
 echo -multicore generate multi-core version binary
 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
-echo "-cacheflush enable cache flush in raw version binary (should be used togethere with -raw)"
 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
 echo "-rawpath print out execute path information for raw version (should be used together with -raw)"
 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
@@ -83,7 +85,9 @@ echo -profile_interrupt build with profile information of interrupts
 echo "-useio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
 echo
 echo Multicore GC options
+echo -perfcount performance counters
 echo -multicoregc generate multi-core binary with garbage collection
+echo -pmc parallel collector
 echo "-numcore4gc set the number of cores for gc (should be used together with -multicoregc), defaultly set as 0"
 echo "-gcmem_local set the gc shared memory allocation strategy as local (should be used together with -multicoregc)"
 echo "-gcmem_fixed set the gc shared memory allocation strategy as fixed (should be used together with -multicoregc)"
@@ -99,8 +103,15 @@ echo "-gclargesharedheap(2) set the gc shared memory as large (should be used to
 echo "-gccacheadapt setup as cacheadaptable mode (should be used together with -multicoregc)"
 echo -gcprofile build with gcprofile options
 echo -mgc generate Multicore GC binary without task stuff
+echo -objectlockdebug generate OBJECT_LOCK_DEBUG code
+echo -gctbldebug generate GC_TBL_DEBUG code
+echo
+echo SSJava options
+echo -ssjava enables SSJava
+echo -ssjavadebug reports interim results
 echo
 echo Other options
+echo -jni enable jni
 echo -abcclose turnoff array boundary checks
 echo -builddir setup different build directory
 echo -robustroot set up the ROBUSTROOT to directory other than default one
@@ -143,10 +154,14 @@ echo -recovery compile recovery code
 echo -dsmtask support work and task class library
 echo -recoverystats print out recovery record 
 echo -src-after-pp prints source code after preprocessor to tmp.c
+echo -capture-null-dereferences generates code to warn before derefencing null
+echo -printlinenum print out line numbers in generated C codes
 echo -help help
 }
 
 tmpbuilddirectory="tmpbuilddirectory"
+JNI=false
+SSJAVA=false
 SRCAFTERPP=false;
 COREPROF=false;
 NUMA=false;
@@ -181,7 +196,7 @@ TILERABMEFLAG=false
 TILERAZLINUXFLAG=false
 TILERAMEMPROFFLAG=false
 TILERACONFIG=''
-CACHEFLUSHFLAG=false
+TILERACORES=''
 RAWCONFIG=''
 DEBUGFLAG=false
 RAWPATHFLAG=false
@@ -194,6 +209,8 @@ USEIOFLAG=false
 INTERRUPTFLAG=false
 THREADSIMULATEFLAG=false;
 MULTICOREGCFLAG=false;
+PERFCOUNT=false;
+PMCFLAG=false;
 GCMEMLOCALFLAG=false;
 GCMEMFIXEDFLAG=false;
 GCMEMMIXEDFLAG=false;
@@ -213,6 +230,9 @@ GCCACHEADAPTPOLICYFLAG=false
 GCCACHEADAPTPOLICY=''
 GCCACHESAMPLINGFLAG=false
 MGCFLAG=false
+MGCINTELFLAG=false
+OBJECTLOCKDEBUGFLAG=false
+GCTBLDEBUGFLAG=false
 USEDMALLOC=false
 THREADFLAG=false
 FASTCHECK=false
@@ -241,15 +261,21 @@ if [[ $1 = '-help' ]]
 then
 printhelp
 exit
-
+elif [[ $1 = '-jni' ]]
+then
+JNI=true
+JAVAOPTS="$JAVAOPTS -jni"
+EXTRAOPTIONS="$EXTRAOPTIONS -DJNI -I$ROBUSTROOT/Runtime/jni"
 elif [[ $1 = '-justanalyze' ]]
 then
 EXITAFTERANALYSIS=true
-
+elif [[ $1 = '-capture-null-dereferences' ]]
+then
+JAVAOPTS="$JAVAOPTS -capture-null-dereferences"
+EXTRAOPTIONS="$EXTRAOPTIONS -DCAPTURE_NULL_DEREFERENCES"
 elif [[ $1 = '-src-after-pp' ]]
 then
 SRCAFTERPP=true
-
 elif [[ $1 = '-assembly' ]]
 then
 ASSEMBLY=true
@@ -414,6 +440,7 @@ JAVAOPTS="$JAVAOPTS -multicore"
 elif [[ $1 = '-numcore' ]]
 then
 JAVAOPTS="$JAVAOPTS -numcore $2"
+TILERACORES="$2"
 if [[ "$2" -gt "1" ]]
 then
 TILERAN1COREFLAG=true
@@ -447,9 +474,6 @@ elif [[ $1 = '-tileraconfig' ]]
 then
 TILERACONFIG="$2"
 shift
-elif [[ $1 = '-cacheflush' ]]
-then
-CACHEFLUSHFLAG=true
 elif [[ $1 = '-rawconfig' ]]
 then
 RAWCONFIG="$2"
@@ -468,6 +492,13 @@ elif [[ $1 = '-multicoregc' ]]
 then
 MULTICOREGCFLAG=true
 JAVAOPTS="$JAVAOPTS -multicoregc"
+elif [[ $1 = '-pmc' ]]
+then
+PMCFLAG=true
+JAVAOPTS="$JAVAOPTS -pmc"
+elif [[ $1 = '-perfcount' ]]
+then
+PERFCOUNT=true
 elif [[ $1 = '-gcmem_local' ]]
 then
 GCMEMLOCALFLAG=true
@@ -525,6 +556,16 @@ elif [[ $1 = '-mgc' ]]
 then
 MGCFLAG=true
 JAVAOPTS="$JAVAOPTS -mgc"
+elif [[ $1 = '-mgcintel' ]]
+then
+MGCINTELFLAG=true
+elif [[ $1 = '-objectlockdebug' ]]
+then
+OBJECTLOCKDEBUGFLAG=true
+JAVAOPTS="$JAVAOPTS -objectlockdebug"
+elif [[ $1 = '-gctbldebug' ]]
+then
+GCTBLDEBUGFLAG=true
 elif [[ $1 = '-dmalloc' ]]
 then
 USEDMALLOC=true
@@ -575,6 +616,15 @@ elif [[ $1 = '-ooodebug-disable-task-mem-pool' ]]
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -DOOO_DISABLE_TASKMEMPOOL"
 
+elif [[ $1 = '-ssjava' ]]
+then
+SSJAVA=true
+JAVAOPTS="$JAVAOPTS -ssjava"
+
+elif [[ $1 = '-ssjavadebug' ]]
+then
+JAVAOPTS="$JAVAOPTS -ssjavadebug"
+
 elif [[ $1 = '-mempool-detect-misuse' ]]
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -DMEMPOOL_DETECT_MISUSE"
@@ -588,6 +638,10 @@ elif [[ $1 = '-nostalltr' ]]
 then
 JAVAOPTS="$JAVAOPTS -nostalltr"
 
+elif [[ $1 = '-printlinenum' ]]
+then
+JAVAOPTS="$JAVAOPTS -printlinenum"
+
 elif [[ $1 = '-rcr' ]]
 then
 JAVAOPTS="$JAVAOPTS -rcr"
@@ -608,6 +662,10 @@ elif [[ $1 = '-debug-deque' ]]
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG_DEQUE"
 
+elif [[ $1 = '-nolock' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DNOLOCK"
+
 elif [[ $1 = '-coreprof' ]]
 then
 COREPROF=true
@@ -730,58 +788,98 @@ then
 JAVAOPTS="$JAVAOPTS -struct structfile"
 fi
 
+
+
+#########################
 # Setup class path
+#########################
+if $JNI
+  then
+  JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/classpath/ -classlibrary $ROBUSTROOT/classpath/vm/reference"
+
+elif $MGCINTELFLAG
+  then
+  JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/MGC/ -classlibrary $ROBUSTROOT/ClassLibrary/MGC/gnu/"
 
-if $RECOVERFLAG
-then
-if $FASTCHECK
-then
-#fast transactions
-JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
-else
-#base bristlecone files
-JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
-fi
-else
-if $DSMFLAG
-then
-#dsm stuff
-JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
-elif $STM
-then
-JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
-elif $THREADFLAG
-then
-#threading java stuff
-JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
 elif $MGCFLAG
-then
-#base multicore gc files
-JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/MGC -classlibrary $ROBUSTROOT/ClassLibrary/MGC/gnu"
+  then
+  #base multicore gc files
+  JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/MGC/ -classlibrary $ROBUSTROOT/ClassLibrary/MGC/gnu/"
+
+elif $SSJAVA
+  then
+  JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/SSJava"  
+
+else
+  if $RECOVERFLAG
+    then
+    if $FASTCHECK
+      then
+      #fast transactions
+      JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
+    else
+      #base bristlecone files
+      JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
+    fi
+
+  elif $DSMFLAG
+    then
+    #dsm stuff
+    JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
+
+  elif $STM
+    then
+    JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
+
+  elif $THREADFLAG
+    then
+    #threading java stuff
+    JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
+
+  else 
+    #base java stuff
+    JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
+  fi
 fi
-#base java stuff
-JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
+
+# everyone gets this except ssjava!
+if ! $SSJAVA
+  then
+  JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/"
 fi
+#########################
+# end classpath
+#########################
+
+
 
 # Build bristlecone/java sources
 
 if $MULTICOREFLAG
-then
-if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main \
--dir $BUILDDIR $JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/ \
--classlibrary $ROBUSTROOT/ClassLibrary/gnu/ $SRCFILES
-then exit $?
-fi
+  then
+  if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main \
+       -dir $BUILDDIR $JAVAOPTS $SRCFILES
+    then exit $?
+  fi
+
 else
-#if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
-if ! $NOJAVA
-then
-if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
-$ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
-$JAVAOPTS $SRCFILES
-then exit $?
-fi
-fi
+
+  if $MGCINTELFLAG
+    then
+    if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main $JAVAOPTS \
+         -dir $BUILDDIR -precise $SRCFILES
+      then exit $?
+    fi
+
+  else
+    if ! $NOJAVA
+      then
+      if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main \
+          -dir $BUILDDIR -precise $JAVAOPTS $SRCFILES
+        then exit $?
+      fi
+    fi
+  fi
 fi
 
 if $EXITAFTERANALYSIS
@@ -838,11 +936,6 @@ rm ./*
 
 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
 
-if $CACHEFLUSHFLAG
-then # print path
-RAWRGCCFLAGS="${RAWRGCCFLAGS} -DCACHEFLUSH"
-fi
-
 if $RAWPATHFLAG
 then # print path
 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
@@ -886,9 +979,6 @@ cp ../Runtime/*.c ./
 cp ../Runtime/*.h ./
 cp ../Runtime/*.S ./
 cp ../Runtime/*.s ./
-mkdir ./coreprof
-cp ../Runtime/coreprof/*.c ./coreprof/
-cp ../Runtime/coreprof/*.h ./coreprof/
 cp $BAMBOORUNTIME/*.c ./
 cp $BAMBOORUNTIME/*.h ./
 cp $BAMBOORUNTIME/RAW/*.c ./
@@ -906,9 +996,9 @@ TILERADIR="$CURDIR/tilera"
 if $TILERABMEFLAG
 then # TILERABMEFLAG
 TILERA_INDIR="BME"
-MAKEFILE="Makefile.tilera.$TILERACONFIG"
-SIMHVC="sim.hvc.$TILERACONFIG"
-PCIHVC="pci.hvc.$TILERACONFIG"
+MAKEFILE="Makefile.tilera.$TILERACORES"
+#SIMHVC="sim.hvc.$TILERACONFIG"
+PCIHVC="pci.hvc.$TILERACORES"
 if $TILERA56COREFLAG
 then
   PCIHVC="$PCIHVC.56"
@@ -931,6 +1021,16 @@ else
 export TILERACFLAGS="-DTASK -DMULTICORE -DCLOSE_PRINT -DTILERA"
 fi
 
+if $GCTBLDEBUGFLAG
+then
+TILERACFLAGS="${TILERACFLAGS} -DGC_TBL_DEBUG"
+fi
+
+if $OBJECTLOCKDEBUGFLAG
+then
+TILERACFLAGS="${TILERACFLAGS} -DOBJECT_LOCK_DEBUG"
+fi
+
 if $TILERAMEMPROFFLAG
 then # not only with 1 core
   PCIHVC="$PCIHVC.memprof"
@@ -945,11 +1045,6 @@ then # TILERAZLINUXFLAG
 TILERACFLAGS="${TILERACFLAGS} -DTILERA_ZLINUX"
 fi
 
-if $CACHEFLUSHFLAG
-then # print path
-TILERACFLAGS="${TILERACFLAGS} -DCACHEFLUSH"
-fi
-
 if $RAWPATHFLAG
 then # print path
 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
@@ -987,7 +1082,7 @@ fi #INTERRUPT version
 
 if $MGCFLAG
 then #MGCFLAG
-TILERACFLAGS="${TILERACFLAGS} -DMGC"
+TILERACFLAGS="${TILERACFLAGS} -DMGC -DMGC_SPEC"
 fi
 
 if $MULTICOREGCFLAG
@@ -995,6 +1090,16 @@ then #MULTICOREGC version
 TILERACFLAGS="${TILERACFLAGS} -DMULTICORE_GC -D${GCCORES}"
 fi
 
+if $PMCFLAG
+then #MULTICOREGC version
+TILERACFLAGS="${TILERACFLAGS} -DPMC_GC -D${GCCORES}"
+fi
+
+if $PERFCOUNT
+then #MULTICOREGC version
+TILERACFLAGS="${TILERACFLAGS} -DPERFCOUNT"
+fi
+
 if $GCPROFILEFLAG
 then # GC_PROFILE version
 TILERACFLAGS="${TILERACFLAGS} -DGC_PROFILE"
@@ -1090,7 +1195,10 @@ then # GC_CACHE_ADAPT version
 TILERACFLAGS="${TILERACFLAGS} -DGC_CACHE_SAMPLING"
 fi
 
-if $MGCFLAG
+if $PMCFLAG
+then
+cp $ROBUSTROOT/Tilera/Runtime/PMC/$MAKEFILE ./Makefile
+elif $MGCFLAG
 then
 cp $ROBUSTROOT/Tilera/Runtime/MGC/$MAKEFILE ./Makefile
 else
@@ -1098,7 +1206,7 @@ cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$MAKEFILE ./Makefile
 fi
 if $TILERABMEFLAG
 then # TILERABMEFLAG
-cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$SIMHVC ./sim.hvc
+#cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$SIMHVC ./sim.hvc
 cp $ROBUSTROOT/Tilera/Runtime/$TILERA_INDIR/$PCIHVC ./pci.hvc
 if $TILERA56COREFLAG
 then
@@ -1129,23 +1237,9 @@ cp ../Runtime/ObjectHash.h ./
 cp ../Runtime/Queue.h ./
 cp ../Runtime/runtime.h ./
 cp ../Runtime/SimpleHash.h ./
-mkdir ./coreprof
-cp ../Runtime/coreprof/coreprof.c ./coreprof/
-cp ../Runtime/coreprof/coreprof.h ./coreprof/
-cp $BAMBOORUNTIME/multicoretask.c ./
-cp $BAMBOORUNTIME/multicoreruntime.c ./
-cp $BAMBOORUNTIME/multicoremem.c ./
-cp $BAMBOORUNTIME/multicoregarbage.c ./
-cp $BAMBOORUNTIME/GCSharedHash.c ./
-cp $BAMBOORUNTIME/MGCHash.c ./
-cp $BAMBOORUNTIME/multicoreruntime.h ./
-cp $BAMBOORUNTIME/multicoremem.h ./
-cp $BAMBOORUNTIME/multicoregarbage.h ./
-cp $BAMBOORUNTIME/multicorecache.h ./
-cp $BAMBOORUNTIME/multicoregc.h ./
-cp $BAMBOORUNTIME/multicorehelper.h ./
-cp $BAMBOORUNTIME/GCSharedHash.h ./
-cp $BAMBOORUNTIME/MGCHash.h ./
+cp ../Runtime/objtypes.h ./
+cp $BAMBOORUNTIME/*.c ./
+cp $BAMBOORUNTIME/*.h ./
 cp ../Tilera/Runtime/*.c ./
 cp ../Tilera/Runtime/*.h ./
 cp ../Tilera/Runtime/$TILERA_INDIR/*.c ./
@@ -1167,6 +1261,8 @@ cp ../Tilera/lib/* ./
 cp ../$tmpbuilddirectory/*.c ./
 cp ../$tmpbuilddirectory/*.h ./
 
+echo $TILERA_CFLAGS
+
 make
 
 else #!RAWFLAG && !TILERABMEFLAG  && ! TILERAZLINUXFLAG
@@ -1188,9 +1284,15 @@ $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
 $ROBUSTROOT/Runtime/ObjectHash.c \
 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
+$ROBUSTROOT/Runtime/taskgarbage.c $ROBUSTROOT/Runtime/oojgarbage.c \
 $ROBUSTROOT/Runtime/math.c \
 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
 
+if $JNI
+then
+FILES="$FILES $ROBUSTROOT/Runtime/jni/jni.c $ROBUSTROOT/Runtime/jni/jni-stuff.c"
+fi
+
 if $NUMA
 then
 FILES="$FILES $ROBUSTROOT/Runtime/affinity.c"