From: bdemsky Date: Wed, 7 Feb 2007 22:20:49 +0000 (+0000) Subject: new script file to run compiler...this one uses options and combines X-Git-Tag: preEdgeChange~722 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e98aab2e9242d0a4f18d24c2c36f053c34385237;p=IRC.git new script file to run compiler...this one uses options and combines the functionality of all previous ones --- diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 40ea96da..361c5da4 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -336,6 +336,8 @@ public class BuildCode { output.println(" "+arraytype+"_"+ state.getArrayNumber(fd.getType()) +" * "+fd.getSymbol()+";"); } else if (fd.getType().isClass()) output.println(" "+fd.getType().getRepairSymbol()+" * "+fd.getSymbol()+";"); + else if (fd.getType().isFloat()) + output.println(" int "+fd.getSymbol()+"; /* really float */"); else output.println(" "+fd.getType().getRepairSymbol()+" "+fd.getSymbol()+";"); } diff --git a/Robust/src/Tests/dotest b/Robust/src/Tests/dotest index c724ccf8..3681a920 100755 --- a/Robust/src/Tests/dotest +++ b/Robust/src/Tests/dotest @@ -5,7 +5,7 @@ shift shift echo Doing Test $ARG1 -../buildscript $ARG1 $ARG2 &>/dev/null +../buildscript -mainclass $ARG1 $ARG2 -o $ARG1 &>/dev/null $ARG1.bin $@ &> output/$ARG1.output diff output/$ARG1.output output/$ARG1.output.goal rm $ARG1.bin diff --git a/Robust/src/buildscript b/Robust/src/buildscript index 9a20f7db..5ddacc3c 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -1,9 +1,172 @@ #!/bin/bash + +printhelp() { +echo -check generate check code +echo -recover compile task code +echo -specdir directory +echo -debug generate debug symbols +echo -runtimedebug printout runtime debug messages +echo "-optimize call gcc with -O9 (optimize)" +echo "-nooptimize call gcc with -O0 (do not optimize)" +echo -curdir directory +echo -mainclass class with main method +echo -o binary +echo -instructionfailures inject code for instructionfailures +echo -help help +} + ROBUSTROOT=~/research/Robust/src -MAINFILE=$1 +REPAIRROOT=~/research/Repair/RepairCompiler/ +CURDIR=`pwd` +CHECKFLAG=false +RECOVERFLAG=false +SPECDIR=`pwd` +SRCFILES='' +EXTRAOPTIONS='' +MAINFILE='a' +JAVAOPTS='' + +if [[ -z $1 ]] +then +printhelp +exit +fi + +while [[ -n $1 ]] +do +if [[ $1 = '-help' ]] +then +printhelp +exit +elif [[ $1 = '-o' ]] +then +MAINFILE="$2" +shift +elif [[ $1 = '-mainclass' ]] +then +JAVAOPTS="$JAVAOPTS -mainclass $2" +shift +elif [[ $1 = '-recover' ]] +then +RECOVERFLAG=true +JAVAOPTS="$JAVAOPTS -task" +elif [[ $1 = '-instructionfailures' ]] +then +JAVAOPTS="$JAVAOPTS -instructionfailures" +elif [[ $1 = '-check' ]] +then +CHECKFLAG=true +JAVAOPTS="$JAVAOPTS -conscheck" +elif [[ $1 = '-specdir' ]] +then +cd $2 +SPECDIR=`pwd` +cd $CURDIR +shift +elif [[ $1 = '-debug' ]] +then +EXTRAOPTIONS="$EXTRAOPTIONS -g" +elif [[ $1 = '-runtimedebug' ]] +then +EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG" +elif [[ $1 = '-nooptimize' ]] +then +EXTRAOPTIONS="$EXTRAOPTIONS -O0" +elif [[ $1 = '-optimize' ]] +then +EXTRAOPTIONS="$EXTRAOPTIONS -O9" +elif [[ $1 = '-curdir' ]] +then +CURDIR=$2 +shift +else +SRCFILES="$SRCFILES $1" +fi shift -mkdir tmpbuilddirectory +done + +BUILDDIR="$CURDIR/tmpbuilddirectory" + +cd $1 +cd $CURDIR +shift + +mkdir $BUILDDIR + +if $CHECKFLAG #Generate structure files for repair tool +then +JAVAOPTS="$JAVAOPTS -struct structfile" +fi + +# Build bristlecone/java sources + +java -cp $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \ +$ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \ +$JAVAOPTS $SRCFILES + +# Build all of the consistency specs + +if $CHECKFLAG # CHECKFLAG +then +cd $SPECDIR +mkdir $BUILDDIR/specdir +cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir + +echo > $BUILDDIR/specs + +# compile specs into C code +for i in * # iterate over all directories +do +if [[ "$i" != "CVS" ]] # CVSDIR CHECK +then +cd $SPECDIR/$i +cat $BUILDDIR/structfile.struct $i.label > $i.struct +java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i +cp size.[c,h] $BUILDDIR/specdir +cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir +echo $i >> $BUILDDIR/specs +fi # CVSDIR CHECK +done # iterate over all directories + +#compile C code + +cd $BUILDDIR/specdir +./buildrobust +echo > $BUILDDIR/checkers.h +for i in `cat $BUILDDIR/specs` +do +gcc -O0 -g -c $i\_aux.c +echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h +done +fi # CHECKFLAG + +#build and link everything + +cd $CURDIR + + +INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \ +-I$BUILDDIR" + +FILES="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/file.c \ +$ROBUSTROOT/Runtime/Queue.c $ROBUSTROOT/Runtime/SimpleHash.c \ +$ROBUSTROOT/Runtime/option.c $ROBUSTROOT/Runtime/garbage.c \ +$ROBUSTROOT/Runtime/GenericHashtable.c" + +if $RECOVERFLAG +then +EXTRAOPTIONS="$EXTRAOPTIONS -DTASK" +FILES="$FILES $ROBUSTROOT/Runtime/socket.c tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c " +fi + +if $CHECKFLAG +then +EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o" +INCLUDES="$INCLUDES -I$BUILDDIR/specdir" +fi + +gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \ +tmpbuilddirectory/methods.c $FILES -o $MAINFILE.bin +exit -java -cp $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary $ROBUSTROOT/ClassLibrary/ -dir tmpbuilddirectory -precise -mainclass $MAINFILE $@ -gcc -I$ROBUSTROOT/Runtime -Itmpbuilddirectory -DPRECISE_GC -O0 -g tmpbuilddirectory/methods.c $ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/option.c -o $MAINFILE.bin diff --git a/Robust/src/buildscriptrepair b/Robust/src/buildscriptrepair deleted file mode 100755 index 6cb321d9..00000000 --- a/Robust/src/buildscriptrepair +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# arguments are: -# 1 Name of executable -# 2 Directory containing specs -# 3-n List of class files to compile - -ROBUSTROOT=~/research/Robust/src -REPAIRROOT=~/research/Repair/RepairCompiler/ -CURDIR=`pwd` -BUILDDIR=$CURDIR/tmpbuilddirectory -MAINFILE=$1 -shift - -cd $1 -SPECDIR=`pwd` -cd $CURDIR -shift - -mkdir $BUILDDIR -java -cp $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \ -$ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise -struct $MAINFILE -conscheck \ --struct structfile -task $@ - -# Build all of the consistency specs - -cd $SPECDIR -mkdir $BUILDDIR/specdir -cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir - -echo > $BUILDDIR/specs - -# compile specs into C code -for i in * -do -if [ "$i" != "CVS" ] -then -cd $SPECDIR/$i -cat $BUILDDIR/structfile.struct $i.label > $i.struct -java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i -ls -cp size.[c,h] $BUILDDIR/specdir -cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir -echo $i >> $BUILDDIR/specs -fi -done - -#compile C code - -cd $BUILDDIR/specdir -./buildrobust -echo > $BUILDDIR/checkers.h -for i in `cat $BUILDDIR/specs` -do -gcc -O0 -g -c $i\_aux.c -echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h -done - -#build and link everything - -cd $CURDIR -gcc -I$ROBUSTROOT/Runtime -I. -I$BUILDDIR/specdir \ --IRuntime/include -I$BUILDDIR -O0 -DPRECISE_GC -DCONSCHECK \ --LRuntime/lib/ -lgc -DTASK -g tmpbuilddirectory/methods.c \ -tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/runtime.c \ -$ROBUSTROOT/Runtime/file.c \ -$ROBUSTROOT/Runtime/socket.c \ -$ROBUSTROOT/Runtime/Queue.c $ROBUSTROOT/Runtime/SimpleHash.c \ -$ROBUSTROOT/Runtime/checkpoint.c \ -$ROBUSTROOT/Runtime/option.c \ -$ROBUSTROOT/Runtime/garbage.c \ -$ROBUSTROOT/Runtime/GenericHashtable.c $BUILDDIR/specdir/*.o -o \ -$MAINFILE.bin diff --git a/Robust/src/buildscripttask b/Robust/src/buildscripttask index 85dcbb44..c333f5ad 100755 --- a/Robust/src/buildscripttask +++ b/Robust/src/buildscripttask @@ -6,4 +6,4 @@ mkdir tmpbuilddirectory java -cp $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary $ROBUSTROOT/ClassLibrary/ -dir tmpbuilddirectory -precise -struct $MAINFILE -task $@ -gcc -DPRECISE_GC -I$ROBUSTROOT/Runtime -I. -IRuntime/include -Itmpbuilddirectory -O0 -LRuntime/lib/ -DTASK -DDEBUG -g tmpbuilddirectory/methods.c tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/socket.c $ROBUSTROOT/Runtime/Queue.c $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/option.c $ROBUSTROOT/Runtime/garbage.c -o $MAINFILE.bin \ No newline at end of file +gcc -DPRECISE_GC -I$ROBUSTROOT/Runtime -I. -IRuntime/include -Itmpbuilddirectory -O9 -g -LRuntime/lib/ -DTASK -DDEBUG tmpbuilddirectory/methods.c tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/socket.c $ROBUSTROOT/Runtime/Queue.c $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/option.c $ROBUSTROOT/Runtime/garbage.c -o $MAINFILE.bin \ No newline at end of file