diff --git a/build.sh b/build.sh index 6c952ce77..204de04b2 100755 --- a/build.sh +++ b/build.sh @@ -5,10 +5,13 @@ OBJECT_MODEL_DIRS="src/engine/objmodel" function exit_usage() { echo "Usage: build.sh [options] " echo "Options:" - echo " --nojit disable the JIT compiler" + echo " --O2 enable Virgil -O2 optimization level" + echo " --O3 enable Virgil -O3 optimization level" echo " --test-monitors include the test monitors" echo " --debug include the debug monitors" + echo " --nojit disable the JIT compiler (native targets)" echo " --debug-gc enable GC debugging (native targets)" + echo " --gc-stats enable GC statistics (native targets)" echo " --no-spec-test exclude the spec test mode" echo " --no-wasm-run exclude the Wasm run mode" echo " --cbd include the canonical bytecode description interpreter" @@ -92,8 +95,17 @@ OBJECT_MODEL=boxed while [[ $# -gt 0 ]]; do case "$1" in + --O2) + V3C_OPTS+="$V3C_OPTS -O2" + ;; + --O3) + V3C_OPTS+="$V3C_OPTS -O3" + ;; + --gc-stats) + GC_STATS=1 + ;; --nojit) - append_comma_sep REDEFS "SpcTuning.disable=true" + NO_JIT=1 ;; --test-monitors) MONITORS="$MONITORS $TEST_MONITORS" @@ -142,8 +154,17 @@ ENGINE="$ENGINE $OBJECT_MODEL_SRC" PROGRAM=$1 TARGET=$2 -if [[ "$TARGET" =~ x86 && $DEBUG_GC = 1 ]]; then - V3C_OPTS="$V3C_OPTS -redef-field=RiGc.debug=true" +if [ "$TARGET" =~ x86 ]; then + if [ "$DEBUG_GC" = 1 ]; then + append_comma_sep REDEFS "RiGc.debug=true" + fi + if [ "$GC_STATS" = 1 ]; then + append_comma_sep REDEFS "RiGc.stats=true" + append_comma_sep REDEFS "RiGc.verbose=true" + fi + if [ "$NO_JIT" = 1 ]; then + append_comma_sep REDEFS "SpcTuning.disable=true" + fi fi function make_build_file() { @@ -201,6 +222,8 @@ BUILD_FILE=$(make_build_file) PREGEN=${PREGEN:=1} LANG_OPTS="-lang:fun-exprs -lang:simple-bodies -lang:descriptors" + +# Add field redefinitions if [ "$REDEFS" != "" ]; then V3C_OPTS="$V3C_OPTS -redef-field=$REDEFS" fi