about summary refs log tree commit diff stats
path: root/apps/mu.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-04-24 19:44:55 -0700
committerKartik Agaram <vc@akkartik.com>2020-05-18 00:44:47 -0700
commitc9ef2b3dc8357a1ddbc717944b1cc21f4ae9efea (patch)
tree587b67dca151d93d54ffb07c19c4d5c33f7b61f5 /apps/mu.subx
parent703b37763070b0d7a6407ed63cf7644dbfe31814 (diff)
downloadmu-c9ef2b3dc8357a1ddbc717944b1cc21f4ae9efea.tar.gz
mu.subx: append-to-block
I'm just cleaning up the final call to append-list, and it's internally
consistent if `block` can be an `addr`. I don't know yet if that makes
sense for callers.

I think I also found a bug in append-to-block: it was clobbering eax.
Diffstat (limited to 'apps/mu.subx')
-rw-r--r--apps/mu.subx9
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/mu.subx b/apps/mu.subx
index 7fa1042f..d66fd0d8 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -5951,19 +5951,22 @@ $append-stmt-var:end:
     5d/pop-to-ebp
     c3/return
 
-append-to-block:  # ad: (addr allocation-descriptor), block: (handle block), x: (handle stmt)
+append-to-block:  # ad: (addr allocation-descriptor), block: (addr block), x: (handle stmt)
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
     # . save registers
+    50/push-eax
     56/push-esi
     # esi = block
     8b/-> *(ebp+0xc) 6/r32/esi
-    (append-list *(ebp+8) *(ebp+0x10) *(esi+4))  # ad, x, Block-stmts
-    89/<- *(esi+4) 0/r32/eax  # Block-stmts
+    # block->stmts = append(x, block->stmts)
+    8d/copy-address *(esi+4) 0/r32/eax
+    (append-list *(ebp+8)  *(ebp+0x10) *(ebp+0x14)  *(esi+4) *(esi+8)  %eax)  # ad, x, x, Block-stmts, Block-stmts
 $append-to-block:end:
     # . restore registers
     5e/pop-to-esi
+    58/pop-to-eax
     # . epilogue
     89/<- %esp 5/r32/ebp
     5d/pop-to-ebp