about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-11-01 20:37:56 -0800
committerKartik Agaram <vc@akkartik.com>2020-11-01 20:37:56 -0800
commitcc7dcdc3b8bb6c133ecdbc97d1c134d30f1500f5 (patch)
treec41b7974e0fd0dc926bff67da0a6d6b57bc7fe55
parentccadc6e604c5cf3779ddc34eef5b075d1dc3cb62 (diff)
downloadmu-cc7dcdc3b8bb6c133ecdbc97d1c134d30f1500f5.tar.gz
7153
Bugfix in computing the label a return should jump to.
-rwxr-xr-xapps/mubin485605 -> 485639 bytes
-rw-r--r--apps/mu.subx10
2 files changed, 7 insertions, 3 deletions
diff --git a/apps/mu b/apps/mu
index dec12a22..e4f47f5e 100755
--- a/apps/mu
+++ b/apps/mu
Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx
index 28ea0201..f50579d0 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -18900,12 +18900,16 @@ $emit-subx-stmt-list:return:
             (emit-outputs *(ebp+8) %ecx *(ebp+0x14))
             (emit-cleanup-code-for-non-outputs *(ebp+8) *(ebp+0x10) *(ebp+0x14))
             # emit jump to end of function
+            # getting at the name of the label is challenging
             (emit-indent *(ebp+8) *Curr-block-depth)
-            (write-buffered *(ebp+8) "e9/jump $")
+            (write-buffered *(ebp+8) "e9/jump ")
+            # var b/eax: (addr array byte) = fn->body->var->name
             8b/-> *(ebp+0x14) 0/r32/eax
-            (lookup *eax *(eax+4))  # Function-name Function-name => eax
+            (lookup *(eax+0x18) *(eax+0x1c))  # Function-body Function-body => eax
+            (lookup *(eax+0xc) *(eax+0x10))  # Block-var Block-var => eax
+            (lookup *eax *(eax+4))  # Var-name Var-name => eax
             (write-buffered *(ebp+8) %eax)
-            (write-buffered *(ebp+8) ":0x00000001:break/disp32\n")
+            (write-buffered *(ebp+8) ":break/disp32\n")
             e9/jump $emit-subx-stmt-list:clean-up/disp32
           }
           # }}}