about summary refs log tree commit diff stats
path: root/tools/treeshake_all
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-10-30 07:29:15 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-10-30 07:29:15 -0700
commit34f37b89447cfbffce7bd3e40164a35b13b5b347 (patch)
tree4cb9d38a86386c934e379c3558e0122ea7324e40 /tools/treeshake_all
parentfb50fb081ad55129712da97cac187471b8c87b91 (diff)
downloadmu-34f37b89447cfbffce7bd3e40164a35b13b5b347.tar.gz
clean up treeshaking support for baremetal
Check minified sizes by running:
  tools/translate_minified _files_
  ls -l a.bin
  qemu-system-i386 code.img

What I had before was for the linux/ version.
Diffstat (limited to 'tools/treeshake_all')
-rwxr-xr-xtools/treeshake_all63
1 files changed, 0 insertions, 63 deletions
diff --git a/tools/treeshake_all b/tools/treeshake_all
deleted file mode 100755
index b05de395..00000000
--- a/tools/treeshake_all
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/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