about summary refs log tree commit diff stats
path: root/apps/mu.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-03-08 17:09:27 -0700
committerKartik Agaram <vc@akkartik.com>2020-03-08 17:09:27 -0700
commitc67b26bbcb5d57189bd4ab26ff38ad85d6c70106 (patch)
tree0bbf06967f9de5ea1cbf4bcaee3c499ffd3a9e91 /apps/mu.subx
parenta2a9d19f8948977d65513134c49aa7fb37a11857 (diff)
downloadmu-c67b26bbcb5d57189bd4ab26ff38ad85d6c70106.tar.gz
6108
Diffstat (limited to 'apps/mu.subx')
-rw-r--r--apps/mu.subx19
1 files changed, 6 insertions, 13 deletions
diff --git a/apps/mu.subx b/apps/mu.subx
index 40699cae..78c94855 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -7078,7 +7078,8 @@ translate-mu-get-stmt:  # out: (address buffered-file), stmt: (handle stmt)
     (write-buffered *(ebp+8) *(eax+0x10))  # Var-register => eax
     #
     (write-buffered *(ebp+8) " + ")
-    (print-mu-get-offset *(ebp+8) %ecx)
+    (mu-get-offset %ecx)  # => eax
+    (print-int32-buffered *(ebp+8) %eax)
     (write-buffered *(ebp+8) ") ")
     # outputs[0] "/r32"
     8b/-> *(ecx+0xc) 0/r32/eax  # Stmt1-outputs
@@ -7166,27 +7167,19 @@ $num-shift-rights:end:
     5d/pop-to-ebp
     c3/return
 
-print-mu-get-offset:  # out: (addr buffered-file), stmt: (handle stmt)
+mu-get-offset:  # stmt: (handle stmt) -> result/eax: int
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
-    # . save registers
-    50/push-eax
     # var second-inout/eax: (handle stmt-var) = stmt->inouts->next
-    8b/-> *(ebp+0xc) 0/r32/eax
+    8b/-> *(ebp+8) 0/r32/eax
     8b/-> *(eax+8) 0/r32/eax  # Stmt1-inouts
     8b/-> *(eax+4) 0/r32/eax  # Stmt-var-next
     # var output-var/eax: (handle var) = second-inout->value
     8b/-> *eax 0/r32/eax  # Stmt-var-value
-    # print offset
-#?     (write-buffered Stderr "emitting offset from output var ")
-#?     (print-int32-buffered Stderr %eax)
-#?     (write-buffered Stderr Newline)
-#?     (flush Stderr)
-    (print-int32-buffered *(ebp+8) *(eax+0xc))  # Var-offset
+    # return output-var->offset
+    8b/-> *(eax+0xc) 0/r32/eax  # Var-offset
 $emit-get-offset:end:
-    # . restore registers
-    58/pop-to-eax
     # . epilogue
     89/<- %esp 5/r32/ebp
     5d/pop-to-ebp