about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-10-25 22:13:31 -0700
committerKartik Agaram <vc@akkartik.com>2020-10-25 22:32:56 -0700
commit475da72c614ddee250c9542f23e81b6112b0efb8 (patch)
treed8b3825a1ffe4aff733e2cb83b779f18752e07cd
parent10d5b13af8cbafe9466426bddd248f6dafb08589 (diff)
downloadmu-475da72c614ddee250c9542f23e81b6112b0efb8.tar.gz
7109
Turns out I've been including some unnecessary files when building apps/mu!

Treeshaken stats before:
  LoC 26258 => 9717
  LoC including common libraries: 29736 => 12719
  binary size: 406K  => 79K

After:
  LoC 26258 => 9717
  LoC including common libraries: 28322 => 12370
  binary size: 406K  => 77K

So our treeshaking isn't perfect. No surprise there..

The treeshaken build also starts to fail without the one-liner change to
mu.subx, which looks like a bug in the treeshaker.
-rw-r--r--300.txt3
-rwxr-xr-xapps/mubin422182 -> 415008 bytes
-rw-r--r--apps/mu.subx2
-rwxr-xr-xtest_apps4
4 files changed, 4 insertions, 5 deletions
diff --git a/300.txt b/300.txt
index a151656f..62413330 100644
--- a/300.txt
+++ b/300.txt
@@ -1,6 +1,5 @@
 Layers in the 3xx series use all the available syntax sugar for SubX programs.
-They're used by the Mu translator (apps/mu.subx) and can also be called from
-Mu programs if they meet certain criteria:
+Functions here can be called from Mu programs if they meet certain criteria:
 
   - There's a signature for them in 400.mu
   - Inouts on the stack, outputs in registers
diff --git a/apps/mu b/apps/mu
index d3607682..4c564431 100755
--- a/apps/mu
+++ b/apps/mu
Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx
index 1103de23..db5c8b69 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -22565,7 +22565,7 @@ Int-var-in-eax:
     1/imm32/some-block-depth
     0/imm32/no-stack-offset
     0x11/imm32/alloc-id:fake
-    $Register-eax/imm32
+    $Mu-register-eax/imm32  # can't use Register-eax only to keep our buggy tools/treeshake.cc happy (TODO)
 
 Single-int-var-in-ecx:  # (payload list var)
     0x11/imm32/alloc-id:fake:payload
diff --git a/test_apps b/test_apps
index bcd61745..fc0d459c 100755
--- a/test_apps
+++ b/test_apps
@@ -287,7 +287,7 @@ test $NATIVE  &&  {
 }
 
 echo mu
-cat init.$OS [0-9]*.subx apps/mu.subx  |  apps/braces  |  apps/calls  |  apps/sigils  > a.sigils
+cat init.$OS [0-2]*.subx apps/mu.subx  |  apps/braces  |  apps/calls  |  apps/sigils  > a.sigils
 ./bootstrap translate a.sigils -o apps/mu
 test "$1" = 'record'  ||  git diff --exit-code apps/mu
 test $EMULATED  &&  {
@@ -338,7 +338,7 @@ done
 
 # Mu translator
 echo mu
-./translate_subx init.$OS [0-9]*.subx apps/mu.subx
+./translate_subx init.$OS [0-2]*.subx apps/mu.subx
 diff apps/mu a.elf
 
 # Mu programs