about summary refs log tree commit diff stats
path: root/069allocate.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-04-10 16:43:59 -0700
committerKartik Agaram <vc@akkartik.com>2020-05-18 00:44:46 -0700
commitf7360e493ac7e4d3fc27a1823db0ba62ef271433 (patch)
treeda9ed16befd8c0d54574ef054e04f2447fd15327 /069allocate.subx
parent0208505bdbd9dde7b78fb724040a35df260bb586 (diff)
downloadmu-f7360e493ac7e4d3fc27a1823db0ba62ef271433.tar.gz
support 'fake' handles allocated statically
Mystery solved of why the syntax sugar phases don't work even though they
don't use any functions whose signatures changed in the migration to handles.

The answer: they use the Registers table, and it needs to use handles rather
than raw strings.
Diffstat (limited to '069allocate.subx')
-rw-r--r--069allocate.subx10
1 files changed, 4 insertions, 6 deletions
diff --git a/069allocate.subx b/069allocate.subx
index 587e4bf7..6da9fb81 100644
--- a/069allocate.subx
+++ b/069allocate.subx
@@ -33,7 +33,7 @@ Heap-size:  # int
   0x400000/imm32/4MB
 
 Next-alloc-id:  # int
-  0x80000000/imm32
+  0x100/imm32  # save a few alloc ids for fake handles
 
 == code
 #   instruction                     effective address                                                   register    displacement    immediate
@@ -245,7 +245,7 @@ test-allocate-raw-success:
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
     # clean up
-    c7          0/subop/copy        0/mod/indirect  5/rm32/.disp32            .             .           .           Next-alloc-id/disp32  1/imm32     # copy to *Next-alloc-id
+    c7          0/subop/copy        0/mod/indirect  5/rm32/.disp32            .             .           .           Next-alloc-id/disp32  0x100/imm32 # copy to *Next-alloc-id
     # . epilogue
     89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
     5d/pop-to-ebp
@@ -340,8 +340,7 @@ test-lookup-success:
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
     # clean up
-    # . *Next-alloc-id = 1
-    c7          0/subop/copy        0/mod/indirect  5/rm32/.disp32            .             .           .     Next-alloc-id/disp32  1/imm32           # copy to *Next-alloc-id
+    c7          0/subop/copy        0/mod/indirect  5/rm32/.disp32            .             .           .           Next-alloc-id/disp32  0x100/imm32 # copy to *Next-alloc-id
     # . restore registers
     5a/pop-to-edx
     59/pop-to-ecx
@@ -417,8 +416,7 @@ _pending-test-lookup-failure:
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
     # clean up
-    # . *Next-alloc-id = 1
-    c7          0/subop/copy        0/mod/indirect  5/rm32/.disp32            .             .           .     Next-alloc-id/disp32  1/imm32           # copy to *Next-alloc-id
+    c7          0/subop/copy        0/mod/indirect  5/rm32/.disp32            .             .           .           Next-alloc-id/disp32  0x100/imm32 # copy to *Next-alloc-id
     # . epilogue
     89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
     5d/pop-to-ebp