about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-03-08 15:31:33 -0700
committerKartik Agaram <vc@akkartik.com>2020-03-08 15:31:33 -0700
commit8d8a0ba4e5cfbbe1cfcb7f44b00af89e8d1a55c2 (patch)
tree8bfaea732e9bba9f880df59ffd389ea5adc15989
parentd0dbfc83ccb116a179b3c11de644ac9a5a6ca75b (diff)
downloadmu-8d8a0ba4e5cfbbe1cfcb7f44b00af89e8d1a55c2.tar.gz
6100
Fix a bug with a live register being clobbered.
-rw-r--r--apps/mu.subx11
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/mu.subx b/apps/mu.subx
index 88fd0d21..d8cb1046 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -5618,6 +5618,7 @@ $populate-mu-type:line-loop:
       (slice-equal? %edx "}")
       3d/compare-eax-and 0/imm32
       0f 85/jump-if-!= break/disp32
+$populate-mu-type:parse-element:
       # var v/esi: (handle var) = parse-var-with-type(word-slice, first-line)
       (parse-var-with-type %edx %ecx)  # => eax
 #?       (write-buffered Stderr "populate-mu-type: ")
@@ -5627,28 +5628,34 @@ $populate-mu-type:line-loop:
 #?       (write-buffered Stderr Newline)
 #?       (flush Stderr)
       89/<- %esi 0/r32/eax
+$populate-mu-type:create-typeinfo-fields:
       # var r/eax: (addr {(handle var) (handle var)})
 #?       (write-buffered Stderr "populate-mu-type: typeinfo: ")
 #?       (print-int32-buffered Stderr %edi)
 #?       (write-buffered Stderr Newline)
 #?       (flush Stderr)
       (get-or-insert *(edi+4) *esi 0xc)  # Typeinfo-fields Var-name => eax
+$populate-mu-type:set-input-type:
       # r->first = v
       89/<- *eax 6/r32/esi
-      # if (r->second == 0) create a new var with some placeholder data
       {
+$populate-mu-type:create-output-type:
+        # if (r->second == 0) create a new var with some placeholder data
         81 7/subop/compare *(eax+4) 0/imm32
         75/jump-if-!= break/disp8
         # temporarily spill r to esi
+        56/push-esi
         89/<- %esi 0/r32/eax
         (new-literal Heap %edx)  # => eax
         89/<- *(esi+4) 0/r32/eax
         89/<- %eax 6/r32/esi
+        5e/pop-to-esi
 #?         (write-buffered Stderr "creating new output var ")
 #?         (print-int32-buffered Stderr %eax)
 #?         (write-buffered Stderr Newline)
 #?         (flush Stderr)
       }
+$populate-mu-type:set-output-offset:
       # r->second->offset = curr-offset
       8b/-> *(eax+4) 0/r32/eax
 #?       (write-buffered Stderr "writing offset ")
@@ -5657,7 +5664,7 @@ $populate-mu-type:line-loop:
 #?       (print-int32-buffered Stderr %eax)
 #?       (write-buffered Stderr Newline)
 #?       (flush Stderr)
-      89/<- *(eax+0xc) 3/r32/ebx
+      89/<- *(eax+0xc) 3/r32/ebx  # Var-offset
       # curr-offset += size-of(v)
 #?       (write-buffered Stderr "elem ")
 #?       (write-buffered Stderr *eax)  # Var-name
'n155' href='#n155'>155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235