about summary refs log tree commit diff stats
path: root/mu_instructions
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-11-15 22:54:56 -0800
committerKartik Agaram <vc@akkartik.com>2020-11-15 22:54:56 -0800
commit2715d377b6108b0a607d9322d470bedd77c9c717 (patch)
tree34c13145f3d4e6a2a24520409a7e8334da734dea /mu_instructions
parentb6b94712a1cd01081c4faf914501e08771242ac6 (diff)
downloadmu-2715d377b6108b0a607d9322d470bedd77c9c717.tar.gz
7247
Diffstat (limited to 'mu_instructions')
-rw-r--r--mu_instructions6
1 files changed, 4 insertions, 2 deletions
diff --git a/mu_instructions b/mu_instructions
index 253ede30..629ba3d1 100644
--- a/mu_instructions
+++ b/mu_instructions
@@ -317,11 +317,11 @@ var/reg: (addr T) <- address var2: T
 var/reg <- index arr/rega: (addr array T), idx/regi: int
   | if size-of(T) is 4 or 8
       => "8d/copy-address *(" rega "+" regi "<<" log2(size-of(T)) "+4) " reg "/r32"
-var/reg <- index arr: (array T sz), idx/regi: int
+var/reg <- index arr: (array T len), idx/regi: int
   => "8d/copy-address *(ebp+" regi "<<" log2(size-of(T)) "+" (arr.stack-offset + 4) ") " reg "/r32"
 var/reg <- index arr/rega: (addr array T), n
   => "8d/copy-address *(" rega "+" (n*size-of(T)+4) ") " reg "/r32"
-var/reg <- index arr: (array T sz), n
+var/reg <- index arr: (array T len), n
   => "8d/copy-address *(ebp+" (arr.stack-offset+4+n*size-of(T)) ") " reg "/r32"
 
 var/reg: (offset T) <- compute-offset arr: (addr array T), idx/regi: int  # arr can be in reg or mem
@@ -382,6 +382,8 @@ populate in: (addr handle array T), num  # can be literal or variable on stack o
 populate-stream in: (addr handle stream T), num  # can be literal or variable on stack or register
   => "(new-stream Heap " size-of(T) " " num " " in ")"
 
+# Some miscellaneous helpers to avoid error-prone size computations
+
 read-from-stream s: (addr stream T), out: (addr T)
   => "(read-from-stream " s " " out " " size-of(T) ")"