From 3d1c4216ede8c628558c9fe700fb2be1aa08b473 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 2 Nov 2020 21:24:53 -0800 Subject: 7162 --- html/301array-equal.subx.html | 137 +++++++++++++++++++++++------------------- 1 file changed, 75 insertions(+), 62 deletions(-) (limited to 'html/301array-equal.subx.html') diff --git a/html/301array-equal.subx.html b/html/301array-equal.subx.html index b3e8d84f..b6b7db6b 100644 --- a/html/301array-equal.subx.html +++ b/html/301array-equal.subx.html @@ -22,6 +22,7 @@ a { color:inherit; } .subxS1Comment { color: #0000af; } .subxFunction { color: #af5f00; text-decoration: underline; } .Constant { color: #008787; } +.subxMinorFunction { color: #875f5f; } .subxH1Comment { color: #005faf; text-decoration: underline; } --> @@ -231,7 +232,7 @@ if ('onhashchange' in window) { 171 5d/pop-to-ebp 172 c3/return 173 -174 parse-array-of-ints: # ad: (addr allocation-descriptor), s: (addr string), out: (addr handle array int) +174 _parse-array-of-ints: # ad: (addr allocation-descriptor), s: (addr array byte), out: (addr handle array int) 175 # pseudocode 176 # end = &s->data[s->size] 177 # curr = s->data @@ -276,25 +277,25 @@ if ('onhashchange' in window) { 216 01/add-to %edx 1/r32/ecx 217 # var size/ebx: int = 0 218 31/xor-with %ebx 3/r32/ebx -219 $parse-array-of-ints:loop1: +219 $_parse-array-of-ints:loop1: 220 # if (curr >= end) break 221 39/compare %ecx 2/r32/edx -222 73/jump-if-addr>= $parse-array-of-ints:break1/disp8 +222 73/jump-if-addr>= $_parse-array-of-ints:break1/disp8 223 # curr = skip-chars-matching-in-slice(curr, end, ' ') 224 (skip-chars-matching-in-slice %ecx %edx 0x20) # => eax 225 89/<- %ecx 0/r32/eax 226 # if (curr >= end) break 227 39/compare %ecx 2/r32/edx -228 73/jump-if-addr>= $parse-array-of-ints:break1/disp8 +228 73/jump-if-addr>= $_parse-array-of-ints:break1/disp8 229 # curr = skip-chars-not-matching-in-slice(curr, end, ' ') 230 (skip-chars-not-matching-in-slice %ecx %edx 0x20) # => eax 231 89/<- %ecx 0/r32/eax 232 # size += 4 233 81 0/subop/add %ebx 4/imm32 -234 eb/jump $parse-array-of-ints:loop1/disp8 -235 $parse-array-of-ints:break1: +234 eb/jump $_parse-array-of-ints:loop1/disp8 +235 $_parse-array-of-ints:break1: 236 (allocate-array *(ebp+8) %ebx *(ebp+0x10)) -237 $parse-array-of-ints:pass2: +237 $_parse-array-of-ints:pass2: 238 # var slice/edi: slice = {s->data, 0} 239 68/push 0/imm32/end 240 8d/copy-address *(esi+4) 7/r32/edi @@ -304,16 +305,16 @@ if ('onhashchange' in window) { 244 8b/-> *(ebp+0x10) 0/r32/eax 245 (lookup *eax *(eax+4)) # => eax 246 8d/copy-address *(eax+4) 1/r32/ecx -247 $parse-array-of-ints:loop2: +247 $_parse-array-of-ints:loop2: 248 # if (slice->start >= end) break 249 39/compare *edi 2/r32/edx -250 73/jump-if-addr>= $parse-array-of-ints:end/disp8 +250 73/jump-if-addr>= $_parse-array-of-ints:end/disp8 251 # slice->start = skip-chars-matching-in-slice(slice->start, end, ' ') 252 (skip-chars-matching-in-slice *edi %edx 0x20) # => eax 253 89/<- *edi 0/r32/eax 254 # if (slice->start >= end) break 255 39/compare *edi 2/r32/edx -256 73/jump-if-addr>= $parse-array-of-ints:end/disp8 +256 73/jump-if-addr>= $_parse-array-of-ints:end/disp8 257 # slice->end = skip-chars-not-matching-in-slice(slice->start, end, ' ') 258 (skip-chars-not-matching-in-slice *edi %edx 0x20) # => eax 259 89/<- *(edi+4) 0/r32/eax @@ -325,8 +326,8 @@ if ('onhashchange' in window) { 265 # slice->start = slice->end 266 8b/-> *(edi+4) 0/r32/eax 267 89/<- *edi 0/r32/eax -268 eb/jump $parse-array-of-ints:loop2/disp8 -269 $parse-array-of-ints:end: +268 eb/jump $_parse-array-of-ints:loop2/disp8 +269 $_parse-array-of-ints:end: 270 # . reclaim locals 271 81 0/subop/add %esp 8/imm32 272 # . restore registers @@ -356,7 +357,7 @@ if ('onhashchange' in window) { 296 68/push 0xc/imm32/size 297 89/<- %ecx 4/r32/esp 298 # -299 (parse-array-of-ints Heap "1 2 3" %esi) +299 (_parse-array-of-ints Heap "1 2 3" %esi) 300 (lookup *esi *(esi+4)) # => eax 301 (array-equal? %ecx %eax) # => eax 302 (check-ints-equal %eax 1 "F - test-parse-array-of-ints") @@ -375,7 +376,7 @@ if ('onhashchange' in window) { 315 68/push 0/imm32 316 89/<- %esi 4/r32/esp 317 # -318 (parse-array-of-ints Heap "" %esi) +318 (_parse-array-of-ints Heap "" %esi) 319 (lookup *esi *(esi+4)) # => eax 320 (check-ints-equal *eax 0 "F - test-parse-array-of-ints-empty") 321 # . epilogue @@ -393,7 +394,7 @@ if ('onhashchange' in window) { 333 68/push 0/imm32 334 89/<- %esi 4/r32/esp 335 # -336 (parse-array-of-ints Heap Space %esi) +336 (_parse-array-of-ints Heap Space %esi) 337 (lookup *esi *(esi+4)) # => eax 338 (check-ints-equal *eax 0 "F - test-parse-array-of-ints-just-whitespace") 339 # . epilogue @@ -416,7 +417,7 @@ if ('onhashchange' in window) { 356 68/push 0xc/imm32/size 357 89/<- %ecx 4/r32/esp 358 # -359 (parse-array-of-ints Heap " 1 2 3 " %esi) +359 (_parse-array-of-ints Heap " 1 2 3 " %esi) 360 (lookup *esi *(esi+4)) # => eax 361 (array-equal? %ecx %eax) # => eax 362 (check-ints-equal %eax 1 "F - test-parse-array-of-ints-extra-whitespace") @@ -425,52 +426,64 @@ if ('onhashchange' in window) { 365 5d/pop-to-ebp 366 c3/return 367 -368 # helper for later tests -369 # compare an array with a string representation of an array literal -370 check-array-equal: # a: (addr array int), expected: (addr string), msg: (addr string) -371 # . prologue -372 55/push-ebp -373 89/<- %ebp 4/r32/esp -374 # . save registers -375 50/push-eax -376 56/push-esi -377 # var h/esi: handle -378 68/push 0/imm32 -379 68/push 0/imm32 -380 89/<- %esi 4/r32/esp -381 # var b/eax: (addr array int) = parse-array-of-ints(Heap, expected) -382 (parse-array-of-ints Heap *(ebp+0xc) %esi) -383 (lookup *esi *(esi+4)) # => eax -384 # -385 (array-equal? *(ebp+8) %eax) -386 (check-ints-equal %eax 1 *(ebp+0x10)) -387 $check-array-equal:end: -388 # . restore registers -389 5e/pop-to-esi -390 58/pop-to-eax -391 # . epilogue -392 89/<- %esp 5/r32/ebp -393 5d/pop-to-ebp -394 c3/return -395 -396 test-check-array-equal: -397 # . prologue -398 55/push-ebp -399 89/<- %ebp 4/r32/esp -400 # var ecx: (array int) = [1, 2, 3] -401 68/push 3/imm32 -402 68/push 2/imm32 -403 68/push 1/imm32 -404 68/push 0xc/imm32/size -405 89/<- %ecx 4/r32/esp -406 # -407 (check-array-equal %ecx "1 2 3" "F - test-check-array-equal") -408 # . epilogue -409 89/<- %esp 5/r32/ebp -410 5d/pop-to-ebp -411 c3/return -412 -413 # . . vim:nowrap:textwidth=0 +368 parse-array-of-ints: # s: (addr array byte), out: (addr handle array int) +369 # . prologue +370 55/push-ebp +371 89/<- %ebp 4/r32/esp +372 # +373 (_parse-array-of-ints Heap *(ebp+8) *(ebp+0xc)) +374 $parse-array-of-ints:end: +375 # . epilogue +376 89/<- %esp 5/r32/ebp +377 5d/pop-to-ebp +378 c3/return +379 +380 # helper for later tests +381 # compare an array with a string representation of an array literal +382 check-array-equal: # a: (addr array int), expected: (addr string), msg: (addr string) +383 # . prologue +384 55/push-ebp +385 89/<- %ebp 4/r32/esp +386 # . save registers +387 50/push-eax +388 56/push-esi +389 # var h/esi: handle +390 68/push 0/imm32 +391 68/push 0/imm32 +392 89/<- %esi 4/r32/esp +393 # var b/eax: (addr array int) = parse-array-of-ints(Heap, expected) +394 (parse-array-of-ints *(ebp+0xc) %esi) +395 (lookup *esi *(esi+4)) # => eax +396 # +397 (array-equal? *(ebp+8) %eax) +398 (check-ints-equal %eax 1 *(ebp+0x10)) +399 $check-array-equal:end: +400 # . restore registers +401 5e/pop-to-esi +402 58/pop-to-eax +403 # . epilogue +404 89/<- %esp 5/r32/ebp +405 5d/pop-to-ebp +406 c3/return +407 +408 test-check-array-equal: +409 # . prologue +410 55/push-ebp +411 89/<- %ebp 4/r32/esp +412 # var ecx: (array int) = [1, 2, 3] +413 68/push 3/imm32 +414 68/push 2/imm32 +415 68/push 1/imm32 +416 68/push 0xc/imm32/size +417 89/<- %ecx 4/r32/esp +418 # +419 (check-array-equal %ecx "1 2 3" "F - test-check-array-equal") +420 # . epilogue +421 89/<- %esp 5/r32/ebp +422 5d/pop-to-ebp +423 c3/return +424 +425 # . . vim:nowrap:textwidth=0 -- cgit 1.4.1-2-gfad0