about summary refs log tree commit diff stats
path: root/cpp/.traces/jump_can_skip_instructions
blob: b8bc85e9b083fe8c0922f96b851a2d945e10f16c (plain) (blame)
1
2
3
4
5
6
7
parse/0: instruction: 10
parse/0:   ingredient: {name: "1", type: 0}
parse/0: instruction: 1
parse/0:   ingredient: {name: "1", type: 0}
parse/0:   product: {name: "1", type: 1}
run/0: instruction main/0
run/0: ingredient 0 is 1
her */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#!/bin/sh
# Build minimal-size versions of all apps.
# Hacky; only intended for some stats at the moment.

set -e

[ ! -f tools/treeshake ] && {
  echo building tools/treeshake
  c++ -g -O3 tools/treeshake.cc -o tools/treeshake
}

export OS=${OS:-linux}

process() {
  app=$1
  tools/treeshake_translate init.$OS [012]*.subx apps/subx-params.subx apps/$app.subx
  echo "LoC $(cat apps/$app.subx |wc -l) => $(grep -vh '^\s*$\|^\s*#' apps/$app.subx |tools/treeshake |wc -l)"
  echo "LoC including common libraries: $(cat a.in |wc -l) => $(cat a.treeshake |wc -l)"
  echo "binary size: $(ls -lh apps/$app |column 5) => $(ls -lh a.elf |column 5)"
}

if [ $# -gt 0 ]
then
  process $1
  exit 0
fi

echo "== deleting dead code"
for app in factorial crenshaw2-1 crenshaw2-1b hex survey pack dquotes assort tests sigils calls braces
do
  echo "- $app"
  process $app
  mv a.in apps/$app.in
  mv a.treeshake apps/$app.treeshake
  mv a.elf apps/$app.treeshake.bin
done

echo "== testing treeshaken binaries"
for app in factorial crenshaw2-1 crenshaw2-1b
do
  echo $app
  tools/test_treeshake_translate init.$OS [01]*.subx apps/$app.subx
  diff apps/$app a.elf
done

for app in hex survey pack assort dquotes tests
do
  echo $app
  tools/test_treeshake_translate init.$OS [01]*.subx apps/subx-params.subx apps/$app.subx
  diff apps/$app a.elf
done

for app in sigils calls braces
do
  echo $app
  tools/test_treeshake_translate init.$OS [012]*.subx apps/subx-params.subx apps/$app.subx
  diff apps/$app a.elf
done

app=mu
echo $app
tools/test_treeshake_translate init.$OS [0-9]*.subx apps/$app.subx
diff apps/$app a.elf