about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-03-11 17:34:48 -0700
committerKartik Agaram <vc@akkartik.com>2020-03-11 17:34:48 -0700
commit39eb1e4963731816e28ffa910098e2de622d8de0 (patch)
treea531f4e37ea409fde1869a53ab095cfdc9bd98a5 /apps
parentf2d6bb1cb8dc95bfd2e268c94e3aec3855b7c81b (diff)
downloadmu-39eb1e4963731816e28ffa910098e2de622d8de0.tar.gz
6125
Diffstat (limited to 'apps')
-rwxr-xr-xapps/mubin187294 -> 187308 bytes
-rw-r--r--apps/mu.subx21
2 files changed, 15 insertions, 6 deletions
diff --git a/apps/mu b/apps/mu
index 86f19f7a..53ad29ff 100755
--- a/apps/mu
+++ b/apps/mu
Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx
index 34e5419c..138ff94e 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -5937,14 +5937,23 @@ compute-size-of-var:  # in: (handle var) -> result/eax: int
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
-    # eax: (handle var) = in
-    8b/-> *(ebp+8) 0/r32/eax
-    # eax: type-id = in->type
-    8b/-> *(eax+4) 0/r32/eax  # Var-type
-    # TODO: support non-atom type
+    # . push registers
+    51/push-ecx
+    # var t/ecx: (handle tree type-id) = v->type
+    8b/-> *(ebp+8) 1/r32/ecx
+    8b/-> *(ecx+4) 1/r32/ecx  # Var-type
+    # if (t->left >= *Max-type-id) t = t->left
+    {
+      8b/-> *Max-type-id 0/r32/eax
+      39/compare *ecx 0/r32/eax  # Tree-left
+      72/jump-if-addr< break/disp8
+      8b/-> *ecx 1/r32/ecx  # Tree-left
+    }
     # TODO: support arrays
-    (compute-size-of-type-id *eax)  # Atom-left => eax
+    (compute-size-of-type-id *ecx)  # Atom-left => eax
 $compute-size-of-var:end:
+    # . restore registers
+    59/pop-to-ecx
     # . epilogue
     89/<- %esp 5/r32/ebp
     5d/pop-to-ebp