change the debug mode for capturing null dereference to a global compilar option
[IRC.git] / Robust / src / buildscript
index e36d9762c45ca1d2a1af34d390ed3b87da941ecd..e6fbc1d5172275d9597e3084a70c202e0e3e054c 100755 (executable)
@@ -25,7 +25,14 @@ echo   EVENTNAME can be: cpe_main, cpe_runmalloc, cpe_runfree, cpe_poolalloc, cp
 echo "-ooojava <numberofcores> <maxseseage>"
 echo -ooodebug general OOOJava debugging messages
 echo -ooodebug-disable-task-mem-pool this is a tricky module, disable for simpler runtime
+echo -mempool-detect-misuse turn on to find code misusing pool-allocated records
 echo -rcr turn on runtime conflict resolver
+echo -rcr_debug Shows weakly connected heaproots and which allocation sites were considered for traversal
+echo -rcr_debug_verbose in addition to above, also prints out effects passed in, internal representation of effects, and internal representation of reach graph
+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
@@ -93,8 +100,14 @@ 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
 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
@@ -137,10 +150,13 @@ 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
 SRCAFTERPP=false;
 COREPROF=false;
 NUMA=false;
@@ -152,6 +168,7 @@ STMRUNTIME=$ROBUSTROOT/Runtime/STM/
 DSMRECOVERYRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface_recovery/
 REPAIRROOT=~/research/Repair/RepairCompiler/
 CURDIR=`pwd`
+SQUEUE=false
 DSMFLAG=false
 DSMRECOVERY=false
 FASTMEMCPY=false
@@ -164,6 +181,8 @@ CHECKFLAG=false
 RECOVERFLAG=false
 MLP_ON=false
 RCR=false
+RCR_DEBUG=false
+RCR_DEBUG_VERBOSE=false
 MLPDEBUG=false
 MULTICOREFLAG=false
 RAWFLAG=false
@@ -172,6 +191,7 @@ TILERABMEFLAG=false
 TILERAZLINUXFLAG=false
 TILERAMEMPROFFLAG=false
 TILERACONFIG=''
+TILERACORES=''
 CACHEFLUSHFLAG=false
 RAWCONFIG=''
 DEBUGFLAG=false
@@ -204,6 +224,9 @@ GCCACHEADAPTPOLICYFLAG=false
 GCCACHEADAPTPOLICY=''
 GCCACHESAMPLINGFLAG=false
 MGCFLAG=false
+MGCINTELFLAG=false
+OBJECTLOCKDEBUGFLAG=false
+GCTBLDEBUGFLAG=false
 USEDMALLOC=false
 THREADFLAG=false
 FASTCHECK=false
@@ -232,15 +255,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
@@ -363,6 +392,13 @@ shift
 elif [[ $1 = '-mac' ]]
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
+elif [[ $1 = '-squeue' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DSQUEUE"
+elif [[ $1 = '-corepin' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DCOREPIN"
+SQUEUE=true
 elif [[ $1 = '-profile' ]]
 then
 PROFILEFLAG=true
@@ -398,6 +434,7 @@ JAVAOPTS="$JAVAOPTS -multicore"
 elif [[ $1 = '-numcore' ]]
 then
 JAVAOPTS="$JAVAOPTS -numcore $2"
+TILERACORES="$2"
 if [[ "$2" -gt "1" ]]
 then
 TILERAN1COREFLAG=true
@@ -509,6 +546,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
@@ -559,21 +606,52 @@ elif [[ $1 = '-ooodebug-disable-task-mem-pool' ]]
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -DOOO_DISABLE_TASKMEMPOOL"
 
+elif [[ $1 = '-ssjava' ]]
+then
+SSJAVA=true
+JAVAOPTS="$JAVAOPTS -ssjava"
+
+elif [[ $1 = '-mempool-detect-misuse' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DMEMPOOL_DETECT_MISUSE"
+
 elif [[ $1 = '-heapsize-mb' ]]
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -DINITIALHEAPSIZE_MB=($2)"
 shift
 
+elif [[ $1 = '-nostalltr' ]]
+then
+JAVAOPTS="$JAVAOPTS -nostalltr"
+
+elif [[ $1 = '-printlinenum' ]]
+then
+JAVAOPTS="$JAVAOPTS -printlinenum"
+
 elif [[ $1 = '-rcr' ]]
 then
 JAVAOPTS="$JAVAOPTS -rcr"
 RCR=true
 EXTRAOPTIONS="$EXTRAOPTIONS -DRCR -I$ROBUSTROOT/Runtime/oooJava"
 
+elif [[ $1 = '-rcr_debug' ]]
+then
+JAVAOPTS="$JAVAOPTS -rcr_debug"
+RCR_DEBUG=true
+
+elif [[ $1 = '-rcr_debug_verbose' ]]
+then
+JAVAOPTS="$JAVAOPTS -rcr_debug_verbose"
+RCR_DEBUG_VERBOSE=true
+
 elif [[ $1 = '-debug-deque' ]]
 then
 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG_DEQUE"
 
+elif [[ $1 = '-nolock' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DNOLOCK"
+
 elif [[ $1 = '-coreprof' ]]
 then
 COREPROF=true
@@ -697,7 +775,20 @@ 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/"
+elif $MGCFLAG
+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
@@ -708,8 +799,7 @@ else
 #base bristlecone files
 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
 fi
-else
-if $DSMFLAG
+elif $DSMFLAG
 then
 #dsm stuff
 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
@@ -720,10 +810,6 @@ 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"
 fi
 #base java stuff
 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
@@ -733,13 +819,27 @@ fi
 
 if $MULTICOREFLAG
 then
-if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
-$ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
--dir $BUILDDIR $JAVAOPTS $SRCFILES
+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
+elif $SSJAVA
+then
+if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -dir $BUILDDIR -precise \
+$JAVAOPTS $SRCFILES
 then exit $?
 fi
 else
 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
+if $MGCINTELFLAG
+then
+if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main $JAVAOPTS -classlibrary \
+$ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
+$SRCFILES
+then exit $?
+fi
+else
 if ! $NOJAVA
 then
 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx1500m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
@@ -749,6 +849,7 @@ then exit $?
 fi
 fi
 fi
+fi
 
 if $EXITAFTERANALYSIS
 then
@@ -852,9 +953,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 ./
@@ -872,9 +970,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"
@@ -897,6 +995,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"
@@ -953,7 +1061,7 @@ fi #INTERRUPT version
 
 if $MGCFLAG
 then #MGCFLAG
-TILERACFLAGS="${TILERACFLAGS} -DMGC"
+TILERACFLAGS="${TILERACFLAGS} -DMGC -DMGC_SPEC"
 fi
 
 if $MULTICOREGCFLAG
@@ -1064,7 +1172,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
@@ -1095,9 +1203,6 @@ 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 ./
@@ -1154,9 +1259,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"
@@ -1225,8 +1336,11 @@ then
 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
 FILES="$FILES $ROBUSTROOT/Runtime/psemaphore.c"
 FILES="$FILES $ROBUSTROOT/Runtime/workschedule.c"
+if ! $SQUEUE
+then
 FILES="$FILES $ROBUSTROOT/Runtime/deque.c"
 fi
+fi
 
 if $RECOVERFLAG
 then