about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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