From 2c56af2d8f791902f5ff59754c0277eddeb27a3e Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Wed, 11 Nov 2020 23:43:04 -0800 Subject: 7227 --- html/117write-int-hex.subx.html | 2 +- html/123slice.subx.html | 2 +- html/126write-int-decimal.subx.html | 2 +- html/130emit.subx.html | 2 +- html/134emit-hex-array.subx.html | 2 +- html/301array-equal.subx.html | 7 +- html/306files.subx.html | 289 +- html/312copy.subx.html | 129 + html/400.mu.html | 6 +- html/404stream.mu.html | 4 +- html/405screen.mu.html | 2227 +- .../407print-int32-decimal-right-justified.mu.html | 2 +- html/408print-float.mu.html | 16 +- html/apps/arith.mu.html | 2 +- html/apps/assort.subx.html | 34 +- html/apps/braces.subx.html | 6 +- html/apps/browse/main.mu.html | 36 +- html/apps/browse/paginated-screen.mu.html | 40 +- html/apps/calls.subx.html | 4 +- html/apps/dquotes.subx.html | 16 +- html/apps/mu.subx.html | 64061 ++++++++++--------- html/apps/pack.subx.html | 90 +- html/apps/raytracing/1.mu.html | 4 +- html/apps/raytracing/2.mu.html | 6 +- html/apps/raytracing/3.mu.html | 6 +- html/apps/raytracing/color.mu.html | 6 +- html/apps/rpn.mu.html | 2 +- html/apps/sigils.subx.html | 38 +- html/apps/survey.subx.html | 54 +- html/apps/texture.mu.html | 10 +- html/apps/tile/box.mu.html | 12 +- html/apps/tile/data.mu.html | 1309 +- html/apps/tile/environment.mu.html | 2716 +- html/apps/tile/main.mu.html | 129 +- html/apps/tile/rpn.mu.html | 1469 +- html/apps/tile/surface.mu.html | 42 +- html/apps/tile/table.mu.html | 257 +- html/apps/tile/value-stack.mu.html | 360 +- html/apps/tile/value.mu.html | 487 + html/apps/tui.mu.html | 12 +- 40 files changed, 37727 insertions(+), 36171 deletions(-) create mode 100644 html/312copy.subx.html create mode 100644 html/apps/tile/value.mu.html diff --git a/html/117write-int-hex.subx.html b/html/117write-int-hex.subx.html index 5f447dd1..5408a46f 100644 --- a/html/117write-int-hex.subx.html +++ b/html/117write-int-hex.subx.html @@ -458,7 +458,7 @@ if ('onhashchange' in window) { 397 e8/call flush/disp32 398 # . . discard args 399 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -400 +-- 18 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +400 +-- 18 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 418 # check-stream-equal(_test-stream, "0x008899aa", msg) 419 # . . push args 420 68/push "F - test-write-int32-hex-buffered"/imm32 diff --git a/html/123slice.subx.html b/html/123slice.subx.html index 676c9f86..f6b6c986 100644 --- a/html/123slice.subx.html +++ b/html/123slice.subx.html @@ -1228,7 +1228,7 @@ if ('onhashchange' in window) { 1167 8b/copy 1/mod/*+disp8 3/rm32/ebx . . . 0/r32/eax 4/disp8 . # copy *(ebx+4) to eax 1168 # skip payload->allocid 1169 05/add-to-eax 4/imm32 -1170 +-- 26 lines: #? # dump eax ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1170 +-- 26 lines: #? # dump eax ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 1196 # eax = string-equal?(eax, "Abc") 1197 # . . push args 1198 68/push "Abc"/imm32 diff --git a/html/126write-int-decimal.subx.html b/html/126write-int-decimal.subx.html index 4b7f862b..b547b60b 100644 --- a/html/126write-int-decimal.subx.html +++ b/html/126write-int-decimal.subx.html @@ -298,7 +298,7 @@ if ('onhashchange' in window) { 235 e8/call write-int32-decimal/disp32 236 # . . discard args 237 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -238 +-- 26 lines: #? # dump _test-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +238 +-- 26 lines: #? # dump _test-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 264 # check-stream-equal(_test-stream, "-9", msg) 265 # . . push args 266 68/push "F - test-write-int32-decimal-negative"/imm32 diff --git a/html/130emit.subx.html b/html/130emit.subx.html index 12094c24..adafd09b 100644 --- a/html/130emit.subx.html +++ b/html/130emit.subx.html @@ -493,7 +493,7 @@ if ('onhashchange' in window) { 432 e8/call flush/disp32 433 # . . discard args 434 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -435 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +435 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 461 # check-stream-equal(_test-output-stream, "abcd/xyz") 462 # . . push args 463 68/push "F - test-emit-non-number-with-all-hex-digits"/imm32 diff --git a/html/134emit-hex-array.subx.html b/html/134emit-hex-array.subx.html index 551e1124..6b059b7e 100644 --- a/html/134emit-hex-array.subx.html +++ b/html/134emit-hex-array.subx.html @@ -150,7 +150,7 @@ if ('onhashchange' in window) { 90 e8/call flush/disp32 91 # . . discard args 92 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - 93 +-- 33 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 93 +-- 33 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 126 # check-next-stream-line-equal(_test-output-stream, "01 02 03 ", msg) 127 # . . push args 128 68/push "F - test-emit-hex-array"/imm32 diff --git a/html/301array-equal.subx.html b/html/301array-equal.subx.html index b6b7db6b..5ba2e491 100644 --- a/html/301array-equal.subx.html +++ b/html/301array-equal.subx.html @@ -6,16 +6,15 @@ - + + + + + +https://github.com/akkartik/mu/blob/master/312copy.subx +
+ 1 == code
+ 2 
+ 3 copy-array-object:  # src: (addr array T), dest-ah: (addr handle array T)
+ 4     # . prologue
+ 5     55/push-ebp
+ 6     89/<- %ebp 4/r32/esp
+ 7     #
+ 8     (copy-array Heap *(ebp+8) *(ebp+0xc))
+ 9 $copy-array-object:end:
+10     # . epilogue
+11     89/<- %esp 5/r32/ebp
+12     5d/pop-to-ebp
+13     c3/return
+14 
+15 # create an independent copy of file src into dest
+16 # there's no way to do this without knowing the filename
+17 copy-file:  # src: (addr buffered-file), dest-ah: (addr handle buffered-file), filename: (addr array byte)
+18     # . prologue
+19     55/push-ebp
+20     89/<- %ebp 4/r32/esp
+21     # . save registers
+22     50/push-eax
+23     51/push-ecx
+24     52/push-edx
+25     53/push-ebx
+26     56/push-esi
+27     57/push-edi
+28     # esi = src
+29     8b/-> *(ebp+8) 6/r32/esi
+30     # var n/ecx: int = src->buffer->size + 16
+31     8b/-> *(esi+0xc) 0/r32/eax
+32     05/add-to-eax 0x10/imm32  # buffered-file fields before buffer contents
+33     89/<- %ecx 0/r32/eax
+34     #
+35     (allocate Heap %ecx *(ebp+0xc))
+36     # var dest/edi: (addr buffered-file) = lookup(*dest-ah)
+37     8b/-> *(ebp+0xc) 0/r32/eax
+38     (lookup *eax *(eax+4))  # => eax
+39     89/<- %edi 0/r32/eax
+40     #
+41     (copy-bytes %esi %edi %ecx)
+42     # var offset/ecx: int = lseek(src->fd, 0, SEEK_CUR)
+43     8b/-> *esi 3/r32/ebx
+44     b9/copy-to-ecx 0/imm32/offset
+45     ba/copy-to-edx 1/imm32/whence:SEEK_CUR
+46     (syscall_lseek)
+47     89/<- %ecx 0/r32/eax
+48     # at this point dest is identical to src, including file descriptor. Now
+49     # create an independent copy of the file descriptor
+50     (open-fd *(ebp+0x10) 0)  # false => eax
+51     89/<- *edi 0/r32/eax
+52     # replicate offset in the new fd
+53     89/<- %ebx 0/r32/eax  # fd
+54     51/push-ecx  # offset
+55     ba/copy-to-edx 0/imm32/whence:SEEK_SET
+56     (syscall_lseek)
+57 $copy-file:end:
+58     # . restore registers
+59     5f/pop-to-edi
+60     5e/pop-to-esi
+61     5b/pop-to-ebx
+62     5a/pop-to-edx
+63     59/pop-to-ecx
+64     58/pop-to-eax
+65     # . epilogue
+66     89/<- %esp 5/r32/ebp
+67     5d/pop-to-ebp
+68     c3/return
+
+ + + diff --git a/html/400.mu.html b/html/400.mu.html index 20d8bdf8..4eb1ffac 100644 --- a/html/400.mu.html +++ b/html/400.mu.html @@ -226,8 +226,8 @@ if ('onhashchange' in window) { 171 sig read-key-from-real-keyboard -> result/eax: grapheme 172 sig read-line-from-real-keyboard out: (addr stream byte) 173 sig open filename: (addr array byte), write?: boolean, out: (addr handle buffered-file) -174 sig populate-buffered-file-containing contents: (addr array byte), out: (addr handle buffered-file) -175 sig new-buffered-file out: (addr handle buffered-file) +174 sig populate-buffered-file-containing contents: (addr array byte), out: (addr handle buffered-file) +175 sig new-buffered-file out: (addr handle buffered-file) 176 #sig size in: (addr array _) -> result/eax: int 177 178 sig stream-empty? s: (addr stream _) -> result/eax: boolean @@ -238,6 +238,8 @@ if ('onhashchange' in window) { 183 sig stream-final s: (addr stream byte) -> result/eax: byte 184 185 #sig copy-bytes src: (addr byte), dest: (addr byte), n: int +186 sig copy-array-object src: (addr array _), dest-ah: (addr handle array _) +187 sig copy-file src: (addr buffered-file), dest-ah: (addr handle buffered-file), filename: (addr array byte) diff --git a/html/404stream.mu.html b/html/404stream.mu.html index 2f5da311..d57b8573 100644 --- a/html/404stream.mu.html +++ b/html/404stream.mu.html @@ -106,7 +106,7 @@ if ('onhashchange' in window) { 48 fn test-fake-input-buffered-file { 49 var foo: (handle buffered-file) 50 var foo-ah/eax: (addr handle buffered-file) <- address foo -51 populate-buffered-file-containing "abc", foo-ah +51 populate-buffered-file-containing "abc", foo-ah 52 var foo-addr/eax: (addr buffered-file) <- lookup foo 53 var s: (stream byte 0x100) 54 var result/ecx: (addr stream byte) <- address s @@ -117,7 +117,7 @@ if ('onhashchange' in window) { 59 fn test-fake-output-buffered-file { 60 var foo: (handle buffered-file) 61 var foo-ah/eax: (addr handle buffered-file) <- address foo -62 new-buffered-file foo-ah +62 new-buffered-file foo-ah 63 var foo-addr/eax: (addr buffered-file) <- lookup foo 64 write-buffered foo-addr, "abc" 65 var s: (stream byte 0x100) diff --git a/html/405screen.mu.html b/html/405screen.mu.html index c0c6e8ac..21f91871 100644 --- a/html/405screen.mu.html +++ b/html/405screen.mu.html @@ -261,7 +261,7 @@ if ('onhashchange' in window) { 201 print-string screen, " " 202 } 203 var x/ecx: (addr int) <- index a, i - 204 print-int32-decimal screen, *x + 204 print-int32-decimal screen, *x 205 i <- increment 206 loop 207 } @@ -376,1119 +376,1118 @@ if ('onhashchange' in window) { 316 var offset/ecx: (offset screen-cell) <- compute-offset data, idx 317 var cell/eax: (addr screen-cell) <- index data, offset 318 var src/eax: (addr grapheme) <- get cell, data - 319 var result/eax: grapheme <- copy *src - 320 return result - 321 } - 322 - 323 fn screen-color-at screen-on-stack: (addr screen), row: int, col: int -> _/eax: int { - 324 var screen-addr/esi: (addr screen) <- copy screen-on-stack - 325 var idx/ecx: int <- screen-cell-index screen-addr, row, col - 326 var result/eax: int <- screen-color-at-idx screen-addr, idx - 327 return result - 328 } - 329 - 330 fn screen-color-at-idx screen-on-stack: (addr screen), idx-on-stack: int -> _/eax: int { - 331 var screen-addr/esi: (addr screen) <- copy screen-on-stack - 332 var data-ah/eax: (addr handle array screen-cell) <- get screen-addr, data - 333 var data/eax: (addr array screen-cell) <- lookup *data-ah - 334 var idx/ecx: int <- copy idx-on-stack - 335 var offset/ecx: (offset screen-cell) <- compute-offset data, idx - 336 var cell/eax: (addr screen-cell) <- index data, offset - 337 var src/eax: (addr int) <- get cell, color - 338 var result/eax: int <- copy *src - 339 return result - 340 } - 341 - 342 fn screen-background-color-at screen-on-stack: (addr screen), row: int, col: int -> _/eax: int { - 343 var screen-addr/esi: (addr screen) <- copy screen-on-stack - 344 var idx/ecx: int <- screen-cell-index screen-addr, row, col - 345 var result/eax: int <- screen-background-color-at-idx screen-addr, idx - 346 return result - 347 } - 348 - 349 fn screen-background-color-at-idx screen-on-stack: (addr screen), idx-on-stack: int -> _/eax: int { - 350 var screen-addr/esi: (addr screen) <- copy screen-on-stack - 351 var data-ah/eax: (addr handle array screen-cell) <- get screen-addr, data - 352 var data/eax: (addr array screen-cell) <- lookup *data-ah - 353 var idx/ecx: int <- copy idx-on-stack - 354 var offset/ecx: (offset screen-cell) <- compute-offset data, idx - 355 var cell/eax: (addr screen-cell) <- index data, offset - 356 var src/eax: (addr int) <- get cell, background-color - 357 return *src - 358 } - 359 - 360 fn screen-bold-at? screen-on-stack: (addr screen), row: int, col: int -> _/eax: boolean { - 361 var screen-addr/esi: (addr screen) <- copy screen-on-stack - 362 var idx/ecx: int <- screen-cell-index screen-addr, row, col - 363 var result/eax: boolean <- screen-bold-at-idx? screen-addr, idx - 364 return result - 365 } - 366 - 367 fn screen-bold-at-idx? screen-on-stack: (addr screen), idx-on-stack: int -> _/eax: boolean { - 368 var screen-addr/esi: (addr screen) <- copy screen-on-stack - 369 var data-ah/eax: (addr handle array screen-cell) <- get screen-addr, data - 370 var data/eax: (addr array screen-cell) <- lookup *data-ah - 371 var idx/ecx: int <- copy idx-on-stack - 372 var offset/ecx: (offset screen-cell) <- compute-offset data, idx - 373 var cell/eax: (addr screen-cell) <- index data, offset - 374 var src/eax: (addr boolean) <- get cell, bold? - 375 return *src - 376 } - 377 - 378 fn screen-underline-at? screen-on-stack: (addr screen), row: int, col: int -> _/eax: boolean { - 379 var screen-addr/esi: (addr screen) <- copy screen-on-stack - 380 var idx/ecx: int <- screen-cell-index screen-addr, row, col - 381 var result/eax: boolean <- screen-underline-at-idx? screen-addr, idx - 382 return result - 383 } - 384 - 385 fn screen-underline-at-idx? screen-on-stack: (addr screen), idx-on-stack: int -> _/eax: boolean { - 386 var screen-addr/esi: (addr screen) <- copy screen-on-stack - 387 var data-ah/eax: (addr handle array screen-cell) <- get screen-addr, data - 388 var data/eax: (addr array screen-cell) <- lookup *data-ah - 389 var idx/ecx: int <- copy idx-on-stack - 390 var offset/ecx: (offset screen-cell) <- compute-offset data, idx - 391 var cell/eax: (addr screen-cell) <- index data, offset - 392 var src/eax: (addr boolean) <- get cell, underline? - 393 return *src - 394 } - 395 - 396 fn screen-reverse-at? screen-on-stack: (addr screen), row: int, col: int -> _/eax: boolean { - 397 var screen-addr/esi: (addr screen) <- copy screen-on-stack - 398 var idx/ecx: int <- screen-cell-index screen-addr, row, col - 399 var result/eax: boolean <- screen-reverse-at-idx? screen-addr, idx - 400 return result - 401 } - 402 - 403 fn screen-reverse-at-idx? screen-on-stack: (addr screen), idx-on-stack: int -> _/eax: boolean { - 404 var screen-addr/esi: (addr screen) <- copy screen-on-stack - 405 var data-ah/eax: (addr handle array screen-cell) <- get screen-addr, data - 406 var data/eax: (addr array screen-cell) <- lookup *data-ah - 407 var idx/ecx: int <- copy idx-on-stack - 408 var offset/ecx: (offset screen-cell) <- compute-offset data, idx - 409 var cell/eax: (addr screen-cell) <- index data, offset - 410 var src/eax: (addr boolean) <- get cell, reverse? - 411 return *src - 412 } - 413 - 414 fn screen-blink-at? screen-on-stack: (addr screen), row: int, col: int -> _/eax: boolean { - 415 var screen-addr/esi: (addr screen) <- copy screen-on-stack - 416 var idx/ecx: int <- screen-cell-index screen-addr, row, col - 417 var result/eax: boolean <- screen-blink-at-idx? screen-addr, idx - 418 return result - 419 } - 420 - 421 fn screen-blink-at-idx? screen-on-stack: (addr screen), idx-on-stack: int -> _/eax: boolean { - 422 var screen-addr/esi: (addr screen) <- copy screen-on-stack - 423 var data-ah/eax: (addr handle array screen-cell) <- get screen-addr, data - 424 var data/eax: (addr array screen-cell) <- lookup *data-ah - 425 var idx/ecx: int <- copy idx-on-stack - 426 var offset/ecx: (offset screen-cell) <- compute-offset data, idx - 427 var cell/eax: (addr screen-cell) <- index data, offset - 428 var src/eax: (addr boolean) <- get cell, blink? - 429 return *src - 430 } - 431 - 432 fn print-code-point screen: (addr screen), c: code-point { - 433 var g/eax: grapheme <- to-grapheme c - 434 print-grapheme screen, g - 435 } - 436 - 437 fn print-int32-hex screen: (addr screen), n: int { - 438 compare screen, 0 - 439 { - 440 break-if-!= - 441 print-int32-hex-to-real-screen n - 442 return - 443 } - 444 # fake screen - 445 var s2: (stream byte 0x100) - 446 var s2-addr/esi: (addr stream byte) <- address s2 - 447 write-int32-hex s2-addr, n - 448 var screen-addr/edi: (addr screen) <- copy screen - 449 { - 450 var done?/eax: boolean <- stream-empty? s2-addr - 451 compare done?, 0 - 452 break-if-!= - 453 var g/eax: grapheme <- read-grapheme s2-addr - 454 print-grapheme screen, g - 455 loop - 456 } - 457 } - 458 - 459 fn print-int32-hex-bits screen: (addr screen), n: int, bits: int { - 460 compare screen, 0 - 461 { - 462 break-if-!= - 463 print-int32-hex-bits-to-real-screen n, bits - 464 return - 465 } - 466 # fake screen - 467 var s2: (stream byte 0x100) - 468 var s2-addr/esi: (addr stream byte) <- address s2 - 469 write-int32-hex-bits s2-addr, n, bits - 470 var screen-addr/edi: (addr screen) <- copy screen - 471 { - 472 var done?/eax: boolean <- stream-empty? s2-addr - 473 compare done?, 0 - 474 break-if-!= - 475 var g/eax: grapheme <- read-grapheme s2-addr - 476 print-grapheme screen, g - 477 loop - 478 } - 479 } - 480 - 481 fn print-int32-decimal screen: (addr screen), n: int { - 482 compare screen, 0 - 483 { - 484 break-if-!= - 485 print-int32-decimal-to-real-screen n - 486 return - 487 } - 488 # fake screen - 489 # TODO - 490 } - 491 - 492 fn reset-formatting screen: (addr screen) { - 493 compare screen, 0 - 494 { - 495 break-if-!= - 496 reset-formatting-on-real-screen - 497 return - 498 } - 499 # fake screen - 500 var screen-addr/esi: (addr screen) <- copy screen - 501 var dest/ecx: (addr screen-cell) <- get screen-addr, curr-attributes - 502 var default-cell: screen-cell - 503 var bg/eax: (addr int) <- get default-cell, background-color - 504 copy-to *bg, 7 - 505 var default-cell-addr/eax: (addr screen-cell) <- address default-cell - 506 copy-object default-cell-addr, dest - 507 } - 508 - 509 fn start-color screen: (addr screen), fg: int, bg: int { - 510 compare screen, 0 - 511 { - 512 break-if-!= - 513 start-color-on-real-screen fg, bg - 514 return - 515 } - 516 # fake screen - 517 var screen-addr/esi: (addr screen) <- copy screen - 518 var attr/ecx: (addr screen-cell) <- get screen-addr, curr-attributes - 519 var dest/edx: (addr int) <- get attr, color - 520 var src/eax: int <- copy fg - 521 copy-to *dest, src - 522 var dest/edx: (addr int) <- get attr, background-color - 523 var src/eax: int <- copy bg - 524 copy-to *dest, src - 525 } - 526 - 527 fn start-bold screen: (addr screen) { - 528 compare screen, 0 - 529 { - 530 break-if-!= - 531 start-bold-on-real-screen - 532 return - 533 } - 534 # fake screen - 535 var screen-addr/esi: (addr screen) <- copy screen - 536 var attr/ecx: (addr screen-cell) <- get screen-addr, curr-attributes - 537 var dest/edx: (addr boolean) <- get attr, bold? - 538 copy-to *dest, 1 - 539 } - 540 - 541 fn start-underline screen: (addr screen) { - 542 compare screen, 0 - 543 { - 544 break-if-!= - 545 start-underline-on-real-screen - 546 return - 547 } - 548 # fake screen - 549 var screen-addr/esi: (addr screen) <- copy screen - 550 var attr/ecx: (addr screen-cell) <- get screen-addr, curr-attributes - 551 var dest/edx: (addr boolean) <- get attr, underline? - 552 copy-to *dest, 1 - 553 } - 554 - 555 fn start-reverse-video screen: (addr screen) { - 556 compare screen, 0 - 557 { - 558 break-if-!= - 559 start-reverse-video-on-real-screen - 560 return - 561 } - 562 # fake screen - 563 var screen-addr/esi: (addr screen) <- copy screen - 564 var attr/ecx: (addr screen-cell) <- get screen-addr, curr-attributes - 565 var dest/edx: (addr boolean) <- get attr, reverse? - 566 copy-to *dest, 1 - 567 } - 568 - 569 fn start-blinking screen: (addr screen) { - 570 compare screen, 0 - 571 { - 572 break-if-!= - 573 start-blinking-on-real-screen - 574 return - 575 } - 576 # fake screen - 577 var screen-addr/esi: (addr screen) <- copy screen - 578 var attr/ecx: (addr screen-cell) <- get screen-addr, curr-attributes - 579 var dest/edx: (addr boolean) <- get attr, blink? - 580 copy-to *dest, 1 - 581 } - 582 - 583 fn hide-cursor screen: (addr screen) { - 584 compare screen, 0 - 585 { - 586 break-if-!= - 587 hide-cursor-on-real-screen - 588 return - 589 } - 590 # fake screen - 591 var screen-addr/esi: (addr screen) <- copy screen - 592 var hide?/ecx: (addr boolean) <- get screen-addr, cursor-hide? - 593 copy-to *hide?, 1 - 594 } - 595 - 596 fn show-cursor screen: (addr screen) { - 597 compare screen, 0 - 598 { - 599 break-if-!= - 600 show-cursor-on-real-screen - 601 return - 602 } - 603 # fake screen - 604 var screen-addr/esi: (addr screen) <- copy screen - 605 var hide?/ecx: (addr boolean) <- get screen-addr, cursor-hide? - 606 copy-to *hide?, 0 - 607 } - 608 - 609 # validate data on screen regardless of attributes (color, bold, etc.) - 610 # Mu doesn't have multi-line strings, so we provide functions for rows or portions of rows. - 611 # Tab characters (that translate into multiple screen cells) not supported. - 612 - 613 fn check-screen-row screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { - 614 check-screen-row-from screen, row-idx, 1, expected, msg - 615 } - 616 - 617 fn check-screen-row-from screen-on-stack: (addr screen), row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { - 618 var screen/esi: (addr screen) <- copy screen-on-stack - 619 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx - 620 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme - 621 var e: (stream byte 0x100) - 622 var e-addr/edx: (addr stream byte) <- address e - 623 write e-addr, expected - 624 { - 625 var done?/eax: boolean <- stream-empty? e-addr - 626 compare done?, 0 - 627 break-if-!= - 628 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx - 629 var g/ebx: grapheme <- copy _g - 630 var expected-grapheme/eax: grapheme <- read-grapheme e-addr - 631 # compare graphemes - 632 $check-screen-row-from:compare-graphemes: { - 633 # if expected-grapheme is space, null grapheme is also ok - 634 { - 635 compare expected-grapheme, 0x20 - 636 break-if-!= - 637 compare g, 0 - 638 break-if-= $check-screen-row-from:compare-graphemes - 639 } - 640 # if (g == expected-grapheme) print "." - 641 compare g, expected-grapheme - 642 { - 643 break-if-!= - 644 print-string-to-real-screen "." - 645 break $check-screen-row-from:compare-graphemes - 646 } - 647 # otherwise print an error - 648 print-string-to-real-screen msg - 649 print-string-to-real-screen ": expected '" - 650 print-grapheme-to-real-screen expected-grapheme - 651 print-string-to-real-screen "' at (" - 652 print-int32-hex-to-real-screen row-idx - 653 print-string-to-real-screen ", " - 654 print-int32-hex-to-real-screen col-idx - 655 print-string-to-real-screen ") but observed '" - 656 print-grapheme-to-real-screen g - 657 print-string-to-real-screen "'\n" - 658 } - 659 idx <- increment - 660 increment col-idx - 661 loop - 662 } - 663 } - 664 - 665 # various variants by screen-cell attribute; spaces in the 'expected' data should not match the attribute - 666 - 667 fn check-screen-row-in-color screen: (addr screen), fg: int, row-idx: int, expected: (addr array byte), msg: (addr array byte) { - 668 check-screen-row-in-color-from screen, fg, row-idx, 1, expected, msg - 669 } - 670 - 671 fn check-screen-row-in-color-from screen-on-stack: (addr screen), fg: int, row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { - 672 var screen/esi: (addr screen) <- copy screen-on-stack - 673 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx - 674 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme - 675 var e: (stream byte 0x100) - 676 var e-addr/edx: (addr stream byte) <- address e - 677 write e-addr, expected - 678 { - 679 var done?/eax: boolean <- stream-empty? e-addr - 680 compare done?, 0 - 681 break-if-!= - 682 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx - 683 var g/ebx: grapheme <- copy _g - 684 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr - 685 var expected-grapheme/edi: grapheme <- copy _expected-grapheme - 686 $check-screen-row-in-color-from:compare-cells: { - 687 # if expected-grapheme is space, null grapheme is also ok - 688 { - 689 compare expected-grapheme, 0x20 - 690 break-if-!= - 691 compare g, 0 - 692 break-if-= $check-screen-row-in-color-from:compare-cells - 693 } - 694 # if expected-grapheme is space, a different color is ok - 695 { - 696 compare expected-grapheme, 0x20 - 697 break-if-!= - 698 var color/eax: int <- screen-color-at-idx screen, idx - 699 compare color, fg - 700 break-if-!= $check-screen-row-in-color-from:compare-cells - 701 } - 702 # compare graphemes - 703 $check-screen-row-in-color-from:compare-graphemes: { - 704 # if (g == expected-grapheme) print "." - 705 compare g, expected-grapheme - 706 { - 707 break-if-!= - 708 print-string-to-real-screen "." - 709 break $check-screen-row-in-color-from:compare-graphemes - 710 } - 711 # otherwise print an error - 712 print-string-to-real-screen msg - 713 print-string-to-real-screen ": expected '" - 714 print-grapheme-to-real-screen expected-grapheme - 715 print-string-to-real-screen "' at (" - 716 print-int32-hex-to-real-screen row-idx - 717 print-string-to-real-screen ", " - 718 print-int32-hex-to-real-screen col-idx - 719 print-string-to-real-screen ") but observed '" - 720 print-grapheme-to-real-screen g - 721 print-string-to-real-screen "'\n" - 722 } - 723 $check-screen-row-in-color-from:compare-colors: { - 724 var color/eax: int <- screen-color-at-idx screen, idx - 725 compare fg, color - 726 { - 727 break-if-!= - 728 print-string-to-real-screen "." - 729 break $check-screen-row-in-color-from:compare-colors - 730 } - 731 # otherwise print an error - 732 print-string-to-real-screen msg - 733 print-string-to-real-screen ": expected '" - 734 print-grapheme-to-real-screen expected-grapheme - 735 print-string-to-real-screen "' at (" - 736 print-int32-hex-to-real-screen row-idx - 737 print-string-to-real-screen ", " - 738 print-int32-hex-to-real-screen col-idx - 739 print-string-to-real-screen ") in color " - 740 print-int32-hex-to-real-screen fg - 741 print-string-to-real-screen " but observed color " - 742 print-int32-hex-to-real-screen color - 743 print-string-to-real-screen "\n" - 744 } - 745 } - 746 idx <- increment - 747 increment col-idx - 748 loop - 749 } - 750 } - 751 - 752 # background color is visible even for spaces, so 'expected' behaves as an array of booleans. - 753 # non-space = given background must match; space = background must not match - 754 fn check-screen-row-in-background-color screen: (addr screen), bg: int, row-idx: int, expected: (addr array byte), msg: (addr array byte) { - 755 check-screen-row-in-background-color-from screen, bg, row-idx, 1, expected, msg - 756 } - 757 - 758 fn check-screen-row-in-background-color-from screen-on-stack: (addr screen), bg: int, row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { - 759 var screen/esi: (addr screen) <- copy screen-on-stack - 760 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx - 761 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme - 762 var e: (stream byte 0x100) - 763 var e-addr/edx: (addr stream byte) <- address e - 764 write e-addr, expected - 765 { - 766 var done?/eax: boolean <- stream-empty? e-addr - 767 compare done?, 0 - 768 break-if-!= - 769 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx - 770 var g/ebx: grapheme <- copy _g - 771 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr - 772 var expected-grapheme/edx: grapheme <- copy _expected-grapheme - 773 $check-screen-row-in-background-color-from:compare-cells: { - 774 # if expected-grapheme is space, null grapheme is also ok - 775 { - 776 compare expected-grapheme, 0x20 - 777 break-if-!= - 778 compare g, 0 - 779 break-if-= $check-screen-row-in-background-color-from:compare-cells - 780 } - 781 # if expected-grapheme is space, a different color is ok - 782 { - 783 compare expected-grapheme, 0x20 - 784 break-if-!= - 785 var color/eax: int <- screen-background-color-at-idx screen, idx - 786 compare color, bg - 787 break-if-!= $check-screen-row-in-background-color-from:compare-cells - 788 } - 789 # compare graphemes - 790 $check-screen-row-in-background-color-from:compare-graphemes: { - 791 # if (g == expected-grapheme) print "." - 792 compare g, expected-grapheme - 793 { - 794 break-if-!= - 795 print-string-to-real-screen "." - 796 break $check-screen-row-in-background-color-from:compare-graphemes - 797 } - 798 # otherwise print an error - 799 print-string-to-real-screen msg - 800 print-string-to-real-screen ": expected '" - 801 print-grapheme-to-real-screen expected-grapheme - 802 print-string-to-real-screen "' at (" - 803 print-int32-hex-to-real-screen row-idx - 804 print-string-to-real-screen ", " - 805 print-int32-hex-to-real-screen col-idx - 806 print-string-to-real-screen ") but observed '" - 807 print-grapheme-to-real-screen g - 808 print-string-to-real-screen "'\n" - 809 } - 810 $check-screen-row-in-background-color-from:compare-colors: { - 811 var color/eax: int <- screen-background-color-at-idx screen, idx - 812 compare bg, color - 813 { - 814 break-if-!= - 815 print-string-to-real-screen "." - 816 break $check-screen-row-in-background-color-from:compare-colors - 817 } - 818 # otherwise print an error - 819 print-string-to-real-screen msg - 820 print-string-to-real-screen ": expected '" - 821 print-grapheme-to-real-screen expected-grapheme - 822 print-string-to-real-screen "' at (" - 823 print-int32-hex-to-real-screen row-idx - 824 print-string-to-real-screen ", " - 825 print-int32-hex-to-real-screen col-idx - 826 print-string-to-real-screen ") in background color " - 827 print-int32-hex-to-real-screen bg - 828 print-string-to-real-screen " but observed color " - 829 print-int32-hex-to-real-screen color - 830 print-string-to-real-screen "\n" - 831 } - 832 } - 833 idx <- increment - 834 increment col-idx - 835 loop - 836 } - 837 } - 838 - 839 fn check-screen-row-in-bold screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { - 840 check-screen-row-in-bold-from screen, row-idx, 1, expected, msg - 841 } - 842 - 843 fn check-screen-row-in-bold-from screen-on-stack: (addr screen), row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { - 844 var screen/esi: (addr screen) <- copy screen-on-stack - 845 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx - 846 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme - 847 var e: (stream byte 0x100) - 848 var e-addr/edx: (addr stream byte) <- address e - 849 write e-addr, expected - 850 { - 851 var done?/eax: boolean <- stream-empty? e-addr - 852 compare done?, 0 - 853 break-if-!= - 854 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx - 855 var g/ebx: grapheme <- copy _g - 856 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr - 857 var expected-grapheme/edx: grapheme <- copy _expected-grapheme - 858 $check-screen-row-in-bold-from:compare-cells: { - 859 # if expected-grapheme is space, null grapheme is also ok - 860 { - 861 compare expected-grapheme, 0x20 - 862 break-if-!= - 863 compare g, 0 - 864 break-if-= $check-screen-row-in-bold-from:compare-cells - 865 } - 866 # if expected-grapheme is space, non-bold is ok - 867 { - 868 compare expected-grapheme, 0x20 - 869 break-if-!= - 870 var bold?/eax: boolean <- screen-bold-at-idx? screen, idx - 871 compare bold?, 1 - 872 break-if-!= $check-screen-row-in-bold-from:compare-cells - 873 } - 874 # compare graphemes - 875 $check-screen-row-in-bold-from:compare-graphemes: { - 876 # if (g == expected-grapheme) print "." - 877 compare g, expected-grapheme - 878 { - 879 break-if-!= - 880 print-string-to-real-screen "." - 881 break $check-screen-row-in-bold-from:compare-graphemes - 882 } - 883 # otherwise print an error - 884 print-string-to-real-screen msg - 885 print-string-to-real-screen ": expected '" - 886 print-grapheme-to-real-screen expected-grapheme - 887 print-string-to-real-screen "' at (" - 888 print-int32-hex-to-real-screen row-idx - 889 print-string-to-real-screen ", " - 890 print-int32-hex-to-real-screen col-idx - 891 print-string-to-real-screen ") but observed '" - 892 print-grapheme-to-real-screen g - 893 print-string-to-real-screen "'\n" - 894 } - 895 $check-screen-row-in-bold-from:compare-bold: { - 896 var bold?/eax: boolean <- screen-bold-at-idx? screen, idx - 897 compare bold?, 1 - 898 { - 899 break-if-!= - 900 print-string-to-real-screen "." - 901 break $check-screen-row-in-bold-from:compare-bold - 902 } - 903 # otherwise print an error - 904 print-string-to-real-screen msg - 905 print-string-to-real-screen ": expected '" - 906 print-grapheme-to-real-screen expected-grapheme - 907 print-string-to-real-screen "' at (" - 908 print-int32-hex-to-real-screen row-idx - 909 print-string-to-real-screen ", " - 910 print-int32-hex-to-real-screen col-idx - 911 print-string-to-real-screen ") to be in bold\n" - 912 } - 913 } - 914 idx <- increment - 915 increment col-idx - 916 loop - 917 } - 918 } - 919 - 920 fn check-screen-row-in-underline screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { - 921 check-screen-row-in-underline-from screen, row-idx, 1, expected, msg - 922 } - 923 - 924 fn check-screen-row-in-underline-from screen-on-stack: (addr screen), row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { - 925 var screen/esi: (addr screen) <- copy screen-on-stack - 926 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx - 927 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme - 928 var e: (stream byte 0x100) - 929 var e-addr/edx: (addr stream byte) <- address e - 930 write e-addr, expected - 931 { - 932 var done?/eax: boolean <- stream-empty? e-addr - 933 compare done?, 0 - 934 break-if-!= - 935 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx - 936 var g/ebx: grapheme <- copy _g - 937 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr - 938 var expected-grapheme/edx: grapheme <- copy _expected-grapheme - 939 $check-screen-row-in-underline-from:compare-cells: { - 940 # if expected-grapheme is space, null grapheme is also ok - 941 { - 942 compare expected-grapheme, 0x20 - 943 break-if-!= - 944 compare g, 0 - 945 break-if-= $check-screen-row-in-underline-from:compare-cells - 946 } - 947 # if expected-grapheme is space, non-underline is ok - 948 { - 949 compare expected-grapheme, 0x20 - 950 break-if-!= - 951 var underline?/eax: boolean <- screen-underline-at-idx? screen, idx - 952 compare underline?, 1 - 953 break-if-!= $check-screen-row-in-underline-from:compare-cells - 954 } - 955 # compare graphemes - 956 $check-screen-row-in-underline-from:compare-graphemes: { - 957 # if (g == expected-grapheme) print "." - 958 compare g, expected-grapheme - 959 { - 960 break-if-!= - 961 print-string-to-real-screen "." - 962 break $check-screen-row-in-underline-from:compare-graphemes - 963 } - 964 # otherwise print an error - 965 print-string-to-real-screen msg - 966 print-string-to-real-screen ": expected '" - 967 print-grapheme-to-real-screen expected-grapheme - 968 print-string-to-real-screen "' at (" - 969 print-int32-hex-to-real-screen row-idx - 970 print-string-to-real-screen ", " - 971 print-int32-hex-to-real-screen col-idx - 972 print-string-to-real-screen ") but observed '" - 973 print-grapheme-to-real-screen g - 974 print-string-to-real-screen "'\n" - 975 } - 976 $check-screen-row-in-underline-from:compare-underline: { - 977 var underline?/eax: boolean <- screen-underline-at-idx? screen, idx - 978 compare underline?, 1 - 979 { - 980 break-if-!= - 981 print-string-to-real-screen "." - 982 break $check-screen-row-in-underline-from:compare-underline - 983 } - 984 # otherwise print an error - 985 print-string-to-real-screen msg - 986 print-string-to-real-screen ": expected '" - 987 print-grapheme-to-real-screen expected-grapheme - 988 print-string-to-real-screen "' at (" - 989 print-int32-hex-to-real-screen row-idx - 990 print-string-to-real-screen ", " - 991 print-int32-hex-to-real-screen col-idx - 992 print-string-to-real-screen ") to be underlined\n" - 993 } - 994 } - 995 idx <- increment - 996 increment col-idx - 997 loop - 998 } - 999 } -1000 -1001 fn check-screen-row-in-reverse screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { -1002 check-screen-row-in-reverse-from screen, row-idx, 1, expected, msg -1003 } -1004 -1005 fn check-screen-row-in-reverse-from screen-on-stack: (addr screen), row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { -1006 var screen/esi: (addr screen) <- copy screen-on-stack -1007 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx -1008 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme -1009 var e: (stream byte 0x100) -1010 var e-addr/edx: (addr stream byte) <- address e -1011 write e-addr, expected -1012 { -1013 var done?/eax: boolean <- stream-empty? e-addr -1014 compare done?, 0 -1015 break-if-!= -1016 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx -1017 var g/ebx: grapheme <- copy _g -1018 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr -1019 var expected-grapheme/edx: grapheme <- copy _expected-grapheme -1020 $check-screen-row-in-reverse-from:compare-cells: { -1021 # if expected-grapheme is space, null grapheme is also ok -1022 { -1023 compare expected-grapheme, 0x20 -1024 break-if-!= -1025 compare g, 0 -1026 break-if-= $check-screen-row-in-reverse-from:compare-cells -1027 } -1028 # if expected-grapheme is space, non-reverse is ok -1029 { -1030 compare expected-grapheme, 0x20 -1031 break-if-!= -1032 var reverse?/eax: boolean <- screen-reverse-at-idx? screen, idx -1033 compare reverse?, 1 -1034 break-if-!= $check-screen-row-in-reverse-from:compare-cells -1035 } -1036 # compare graphemes -1037 $check-screen-row-in-reverse-from:compare-graphemes: { -1038 # if (g == expected-grapheme) print "." -1039 compare g, expected-grapheme -1040 { -1041 break-if-!= -1042 print-string-to-real-screen "." -1043 break $check-screen-row-in-reverse-from:compare-graphemes -1044 } -1045 # otherwise print an error -1046 print-string-to-real-screen msg -1047 print-string-to-real-screen ": expected '" -1048 print-grapheme-to-real-screen expected-grapheme -1049 print-string-to-real-screen "' at (" -1050 print-int32-hex-to-real-screen row-idx -1051 print-string-to-real-screen ", " -1052 print-int32-hex-to-real-screen col-idx -1053 print-string-to-real-screen ") but observed '" -1054 print-grapheme-to-real-screen g -1055 print-string-to-real-screen "'\n" -1056 } -1057 $check-screen-row-in-reverse-from:compare-reverse: { -1058 var reverse?/eax: boolean <- screen-reverse-at-idx? screen, idx -1059 compare reverse?, 1 -1060 { -1061 break-if-!= -1062 print-string-to-real-screen "." -1063 break $check-screen-row-in-reverse-from:compare-reverse -1064 } -1065 # otherwise print an error -1066 print-string-to-real-screen msg -1067 print-string-to-real-screen ": expected '" -1068 print-grapheme-to-real-screen expected-grapheme -1069 print-string-to-real-screen "' at (" -1070 print-int32-hex-to-real-screen row-idx -1071 print-string-to-real-screen ", " -1072 print-int32-hex-to-real-screen col-idx -1073 print-string-to-real-screen ") to be in reverse-video\n" -1074 } -1075 } -1076 idx <- increment -1077 increment col-idx -1078 loop -1079 } -1080 } -1081 -1082 fn check-screen-row-in-blinking screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { -1083 check-screen-row-in-blinking-from screen, row-idx, 1, expected, msg -1084 } -1085 -1086 fn check-screen-row-in-blinking-from screen-on-stack: (addr screen), row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { -1087 var screen/esi: (addr screen) <- copy screen-on-stack -1088 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx -1089 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme -1090 var e: (stream byte 0x100) -1091 var e-addr/edx: (addr stream byte) <- address e -1092 write e-addr, expected -1093 { -1094 var done?/eax: boolean <- stream-empty? e-addr -1095 compare done?, 0 -1096 break-if-!= -1097 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx -1098 var g/ebx: grapheme <- copy _g -1099 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr -1100 var expected-grapheme/edx: grapheme <- copy _expected-grapheme -1101 $check-screen-row-in-blinking-from:compare-cells: { -1102 # if expected-grapheme is space, null grapheme is also ok -1103 { -1104 compare expected-grapheme, 0x20 -1105 break-if-!= -1106 compare g, 0 -1107 break-if-= $check-screen-row-in-blinking-from:compare-cells -1108 } -1109 # if expected-grapheme is space, non-blinking is ok -1110 { -1111 compare expected-grapheme, 0x20 -1112 break-if-!= -1113 var blinking?/eax: boolean <- screen-blink-at-idx? screen, idx -1114 compare blinking?, 1 -1115 break-if-!= $check-screen-row-in-blinking-from:compare-cells -1116 } -1117 # compare graphemes -1118 $check-screen-row-in-blinking-from:compare-graphemes: { -1119 # if (g == expected-grapheme) print "." -1120 compare g, expected-grapheme -1121 { -1122 break-if-!= -1123 print-string-to-real-screen "." -1124 break $check-screen-row-in-blinking-from:compare-graphemes -1125 } -1126 # otherwise print an error -1127 print-string-to-real-screen msg -1128 print-string-to-real-screen ": expected '" -1129 print-grapheme-to-real-screen expected-grapheme -1130 print-string-to-real-screen "' at (" -1131 print-int32-hex-to-real-screen row-idx -1132 print-string-to-real-screen ", " -1133 print-int32-hex-to-real-screen col-idx -1134 print-string-to-real-screen ") but observed '" -1135 print-grapheme-to-real-screen g -1136 print-string-to-real-screen "'\n" -1137 } -1138 $check-screen-row-in-blinking-from:compare-blinking: { -1139 var blinking?/eax: boolean <- screen-blink-at-idx? screen, idx -1140 compare blinking?, 1 -1141 { -1142 break-if-!= -1143 print-string-to-real-screen "." -1144 break $check-screen-row-in-blinking-from:compare-blinking -1145 } -1146 # otherwise print an error -1147 print-string-to-real-screen msg -1148 print-string-to-real-screen ": expected '" -1149 print-grapheme-to-real-screen expected-grapheme -1150 print-string-to-real-screen "' at (" -1151 print-int32-hex-to-real-screen row-idx -1152 print-string-to-real-screen ", " -1153 print-int32-hex-to-real-screen col-idx -1154 print-string-to-real-screen ") to be blinking\n" -1155 } -1156 } -1157 idx <- increment -1158 increment col-idx -1159 -1160 loop -1161 } -1162 } -1163 -1164 fn test-print-single-grapheme { -1165 var screen-on-stack: screen -1166 var screen/esi: (addr screen) <- address screen-on-stack -1167 initialize-screen screen, 5, 4 -1168 var c/eax: grapheme <- copy 0x61 # 'a' -1169 print-grapheme screen, c -1170 check-screen-row screen, 1, "a", "F - test-print-single-grapheme" # top-left corner of the screen -1171 } -1172 -1173 fn test-print-multiple-graphemes { -1174 var screen-on-stack: screen -1175 var screen/esi: (addr screen) <- address screen-on-stack -1176 initialize-screen screen, 5, 4 -1177 print-string screen, "Hello, 世界" -1178 check-screen-row screen, 1, "Hello, 世界", "F - test-print-multiple-graphemes" -1179 } -1180 -1181 fn test-move-cursor { -1182 var screen-on-stack: screen -1183 var screen/esi: (addr screen) <- address screen-on-stack -1184 initialize-screen screen, 5, 4 -1185 move-cursor screen, 1, 4 -1186 var c/eax: grapheme <- copy 0x61 # 'a' -1187 print-grapheme screen, c -1188 check-screen-row screen, 1, " a", "F - test-move-cursor" # top row -1189 } -1190 -1191 fn test-move-cursor-zeroes { -1192 var screen-on-stack: screen -1193 var screen/esi: (addr screen) <- address screen-on-stack -1194 initialize-screen screen, 5, 4 -1195 move-cursor screen, 0, 0 -1196 var c/eax: grapheme <- copy 0x61 # 'a' -1197 print-grapheme screen, c -1198 check-screen-row screen, 1, "a", "F - test-move-cursor-zeroes" # top-left corner of the screen -1199 } -1200 -1201 fn test-move-cursor-zero-row { -1202 var screen-on-stack: screen -1203 var screen/esi: (addr screen) <- address screen-on-stack -1204 initialize-screen screen, 5, 4 -1205 move-cursor screen, 0, 2 -1206 var c/eax: grapheme <- copy 0x61 # 'a' -1207 print-grapheme screen, c -1208 check-screen-row screen, 1, " a", "F - test-move-cursor-zero-row" # top row -1209 } -1210 -1211 fn test-move-cursor-zero-column { -1212 var screen-on-stack: screen -1213 var screen/esi: (addr screen) <- address screen-on-stack -1214 initialize-screen screen, 5, 4 -1215 move-cursor screen, 4, 0 -1216 var c/eax: grapheme <- copy 0x61 # 'a' -1217 print-grapheme screen, c -1218 check-screen-row screen, 4, "a", "F - test-move-cursor-zero-column" -1219 } -1220 -1221 fn test-move-cursor-negative-row { -1222 var screen-on-stack: screen -1223 var screen/esi: (addr screen) <- address screen-on-stack -1224 initialize-screen screen, 5, 3 -1225 move-cursor screen, -1, 2 # row -1 -1226 var c/eax: grapheme <- copy 0x61 # 'a' -1227 print-grapheme screen, c -1228 # no move -1229 check-screen-row screen, 1, "a", "F - test-move-cursor-negative-row" -1230 } -1231 -1232 fn test-move-cursor-negative-column { -1233 var screen-on-stack: screen -1234 var screen/esi: (addr screen) <- address screen-on-stack -1235 initialize-screen screen, 5, 3 -1236 move-cursor screen, 2, -1 # column -1 -1237 var c/eax: grapheme <- copy 0x61 # 'a' -1238 print-grapheme screen, c -1239 # no move -1240 check-screen-row screen, 1, "a", "F - test-move-cursor-negative-column" -1241 } -1242 -1243 fn test-move-cursor-column-too-large { -1244 var screen-on-stack: screen -1245 var screen/esi: (addr screen) <- address screen-on-stack -1246 initialize-screen screen, 5, 3 # 5 rows, 3 columns -1247 move-cursor screen, 1, 4 # row 1, column 4 (overflow) -1248 var c/eax: grapheme <- copy 0x61 # 'a' -1249 print-grapheme screen, c -1250 # top row is empty -1251 check-screen-row screen, 1, " ", "F - test-move-cursor-column-too-large" -1252 # character shows up on next row -1253 check-screen-row screen, 2, "a", "F - test-move-cursor-column-too-large" -1254 } -1255 -1256 fn test-move-cursor-column-too-large-saturates { -1257 var screen-on-stack: screen -1258 var screen/esi: (addr screen) <- address screen-on-stack -1259 initialize-screen screen, 5, 3 # 5 rows, 3 columns -1260 move-cursor screen, 1, 6 # row 1, column 6 (overflow) -1261 var c/eax: grapheme <- copy 0x61 # 'a' -1262 print-grapheme screen, c -1263 # top row is empty -1264 check-screen-row screen, 1, " ", "F - test-move-cursor-column-too-large-saturates" # top-left corner of the screen -1265 # character shows up at the start of next row -1266 check-screen-row screen, 2, "a", "F - test-move-cursor-column-too-large-saturates" # top-left corner of the screen -1267 } -1268 -1269 fn test-move-cursor-row-too-large { -1270 var screen-on-stack: screen -1271 var screen/esi: (addr screen) <- address screen-on-stack -1272 initialize-screen screen, 5, 3 # 5 rows -1273 move-cursor screen, 6, 2 # row 6 (overflow) -1274 var c/eax: grapheme <- copy 0x61 # 'a' -1275 print-grapheme screen, c -1276 # bottom row shows the character -1277 check-screen-row screen, 5, " a", "F - test-move-cursor-row-too-large" -1278 } -1279 -1280 fn test-move-cursor-row-too-large-saturates { -1281 var screen-on-stack: screen -1282 var screen/esi: (addr screen) <- address screen-on-stack -1283 initialize-screen screen, 5, 3 # 5 rows -1284 move-cursor screen, 9, 2 # row 9 (overflow) -1285 var c/eax: grapheme <- copy 0x61 # 'a' -1286 print-grapheme screen, c -1287 # bottom row shows the character -1288 check-screen-row screen, 5, " a", "F - test-move-cursor-row-too-large-saturates" -1289 } -1290 -1291 fn test-check-screen-row-from { -1292 var screen-on-stack: screen -1293 var screen/esi: (addr screen) <- address screen-on-stack -1294 initialize-screen screen, 5, 4 -1295 move-cursor screen, 1, 4 -1296 var c/eax: grapheme <- copy 0x61 # 'a' -1297 print-grapheme screen, c -1298 check-screen-row screen, 1, " a", "F - test-check-screen-row-from/baseline" -1299 check-screen-row-from screen, 1, 4, "a", "F - test-check-screen-row-from" -1300 } -1301 -1302 fn test-print-string-overflows-to-next-row { -1303 var screen-on-stack: screen -1304 var screen/esi: (addr screen) <- address screen-on-stack -1305 initialize-screen screen, 5, 4 # 5 rows, 4 columns -1306 print-string screen, "abcdefg" -1307 check-screen-row screen, 1, "abcd", "F - test-print-string-overflows-to-next-row" -1308 check-screen-row screen, 2, "efg", "F - test-print-string-overflows-to-next-row" -1309 } -1310 -1311 fn test-check-screen-scrolls-on-overflow { -1312 var screen-on-stack: screen -1313 var screen/esi: (addr screen) <- address screen-on-stack -1314 initialize-screen screen, 5, 4 -1315 # single character starting at bottom right -1316 move-cursor screen, 5, 4 -1317 var c/eax: grapheme <- copy 0x61 # 'a' -1318 print-grapheme screen, c -1319 check-screen-row-from screen, 5, 4, "a", "F - test-check-screen-scrolls-on-overflow/baseline" # bottom-right corner of the screen -1320 # multiple characters starting at bottom right -1321 move-cursor screen, 5, 4 -1322 print-string screen, "ab" -1323 # screen scrolled up one row -1324 #? check-screen-row screen, 1, " ", "F - test-check-screen-scrolls-on-overflow/x1" -1325 #? check-screen-row screen, 2, " ", "F - test-check-screen-scrolls-on-overflow/x2" -1326 #? check-screen-row screen, 3, " ", "F - test-check-screen-scrolls-on-overflow/x3" -1327 #? check-screen-row screen, 4, " a", "F - test-check-screen-scrolls-on-overflow/x4" -1328 #? check-screen-row screen, 5, "b ", "F - test-check-screen-scrolls-on-overflow/x5" -1329 check-screen-row-from screen, 4, 4, "a", "F - test-check-screen-scrolls-on-overflow/1" -1330 check-screen-row-from screen, 5, 1, "b", "F - test-check-screen-scrolls-on-overflow/2" -1331 } -1332 -1333 fn test-check-screen-color { -1334 var screen-on-stack: screen -1335 var screen/esi: (addr screen) <- address screen-on-stack -1336 initialize-screen screen, 5, 4 -1337 var c/eax: grapheme <- copy 0x61 # 'a' -1338 print-grapheme screen, c -1339 start-color screen, 1, 0 # foreground=1 -1340 c <- copy 0x62 # 'b' -1341 print-grapheme screen, c -1342 start-color screen, 0, 0 # back to default -1343 c <- copy 0x63 # 'c' -1344 print-grapheme screen, c -1345 check-screen-row-in-color screen, 0, 1, "a c", "F - test-check-screen-color" -1346 } -1347 -1348 fn test-check-screen-background-color { -1349 var screen-on-stack: screen -1350 var screen/esi: (addr screen) <- address screen-on-stack -1351 initialize-screen screen, 5, 4 -1352 var c/eax: grapheme <- copy 0x61 # 'a' -1353 print-grapheme screen, c -1354 start-color screen, 0, 1 # background=1 -1355 c <- copy 0x62 # 'b' -1356 print-grapheme screen, c -1357 start-color screen, 0, 7 # back to default -1358 c <- copy 0x63 # 'c' -1359 print-grapheme screen, c -1360 check-screen-row-in-background-color screen, 7, 1, "a c", "F - test-check-screen-background-color" -1361 } -1362 -1363 fn test-check-screen-bold { -1364 var screen-on-stack: screen -1365 var screen/esi: (addr screen) <- address screen-on-stack -1366 initialize-screen screen, 5, 4 -1367 start-bold screen -1368 var c/eax: grapheme <- copy 0x61 # 'a' -1369 print-grapheme screen, c -1370 reset-formatting screen -1371 c <- copy 0x62 # 'b' -1372 print-grapheme screen, c -1373 start-bold screen -1374 c <- copy 0x63 # 'c' -1375 print-grapheme screen, c -1376 check-screen-row-in-bold screen, 1, "a c", "F - test-check-screen-bold" -1377 } -1378 -1379 fn test-check-screen-underline { -1380 var screen-on-stack: screen -1381 var screen/esi: (addr screen) <- address screen-on-stack -1382 initialize-screen screen, 5, 4 -1383 start-underline screen -1384 var c/eax: grapheme <- copy 0x61 # 'a' -1385 print-grapheme screen, c -1386 reset-formatting screen -1387 c <- copy 0x62 # 'b' -1388 print-grapheme screen, c -1389 start-underline screen -1390 c <- copy 0x63 # 'c' -1391 print-grapheme screen, c -1392 check-screen-row-in-underline screen, 1, "a c", "F - test-check-screen-underline" -1393 } -1394 -1395 fn test-check-screen-reverse { -1396 var screen-on-stack: screen -1397 var screen/esi: (addr screen) <- address screen-on-stack -1398 initialize-screen screen, 5, 4 -1399 start-reverse-video screen -1400 var c/eax: grapheme <- copy 0x61 # 'a' -1401 print-grapheme screen, c -1402 reset-formatting screen -1403 c <- copy 0x62 # 'b' -1404 print-grapheme screen, c -1405 start-reverse-video screen -1406 c <- copy 0x63 # 'c' -1407 print-grapheme screen, c -1408 check-screen-row-in-reverse screen, 1, "a c", "F - test-check-screen-reverse" -1409 } -1410 -1411 fn test-check-screen-blinking { -1412 var screen-on-stack: screen -1413 var screen/esi: (addr screen) <- address screen-on-stack -1414 initialize-screen screen, 5, 4 -1415 start-blinking screen -1416 var c/eax: grapheme <- copy 0x61 # 'a' -1417 print-grapheme screen, c -1418 reset-formatting screen -1419 c <- copy 0x62 # 'b' -1420 print-grapheme screen, c -1421 start-blinking screen -1422 c <- copy 0x63 # 'c' -1423 print-grapheme screen, c -1424 check-screen-row-in-blinking screen, 1, "a c", "F - test-check-screen-blinking" -1425 } -1426 -1427 #? fn main -> _/ebx: int { -1428 #? #? test-check-screen-color -1429 #? run-tests -1430 #? return 0 -1431 #? } + 319 return *src + 320 } + 321 + 322 fn screen-color-at screen-on-stack: (addr screen), row: int, col: int -> _/eax: int { + 323 var screen-addr/esi: (addr screen) <- copy screen-on-stack + 324 var idx/ecx: int <- screen-cell-index screen-addr, row, col + 325 var result/eax: int <- screen-color-at-idx screen-addr, idx + 326 return result + 327 } + 328 + 329 fn screen-color-at-idx screen-on-stack: (addr screen), idx-on-stack: int -> _/eax: int { + 330 var screen-addr/esi: (addr screen) <- copy screen-on-stack + 331 var data-ah/eax: (addr handle array screen-cell) <- get screen-addr, data + 332 var data/eax: (addr array screen-cell) <- lookup *data-ah + 333 var idx/ecx: int <- copy idx-on-stack + 334 var offset/ecx: (offset screen-cell) <- compute-offset data, idx + 335 var cell/eax: (addr screen-cell) <- index data, offset + 336 var src/eax: (addr int) <- get cell, color + 337 var result/eax: int <- copy *src + 338 return result + 339 } + 340 + 341 fn screen-background-color-at screen-on-stack: (addr screen), row: int, col: int -> _/eax: int { + 342 var screen-addr/esi: (addr screen) <- copy screen-on-stack + 343 var idx/ecx: int <- screen-cell-index screen-addr, row, col + 344 var result/eax: int <- screen-background-color-at-idx screen-addr, idx + 345 return result + 346 } + 347 + 348 fn screen-background-color-at-idx screen-on-stack: (addr screen), idx-on-stack: int -> _/eax: int { + 349 var screen-addr/esi: (addr screen) <- copy screen-on-stack + 350 var data-ah/eax: (addr handle array screen-cell) <- get screen-addr, data + 351 var data/eax: (addr array screen-cell) <- lookup *data-ah + 352 var idx/ecx: int <- copy idx-on-stack + 353 var offset/ecx: (offset screen-cell) <- compute-offset data, idx + 354 var cell/eax: (addr screen-cell) <- index data, offset + 355 var src/eax: (addr int) <- get cell, background-color + 356 return *src + 357 } + 358 + 359 fn screen-bold-at? screen-on-stack: (addr screen), row: int, col: int -> _/eax: boolean { + 360 var screen-addr/esi: (addr screen) <- copy screen-on-stack + 361 var idx/ecx: int <- screen-cell-index screen-addr, row, col + 362 var result/eax: boolean <- screen-bold-at-idx? screen-addr, idx + 363 return result + 364 } + 365 + 366 fn screen-bold-at-idx? screen-on-stack: (addr screen), idx-on-stack: int -> _/eax: boolean { + 367 var screen-addr/esi: (addr screen) <- copy screen-on-stack + 368 var data-ah/eax: (addr handle array screen-cell) <- get screen-addr, data + 369 var data/eax: (addr array screen-cell) <- lookup *data-ah + 370 var idx/ecx: int <- copy idx-on-stack + 371 var offset/ecx: (offset screen-cell) <- compute-offset data, idx + 372 var cell/eax: (addr screen-cell) <- index data, offset + 373 var src/eax: (addr boolean) <- get cell, bold? + 374 return *src + 375 } + 376 + 377 fn screen-underline-at? screen-on-stack: (addr screen), row: int, col: int -> _/eax: boolean { + 378 var screen-addr/esi: (addr screen) <- copy screen-on-stack + 379 var idx/ecx: int <- screen-cell-index screen-addr, row, col + 380 var result/eax: boolean <- screen-underline-at-idx? screen-addr, idx + 381 return result + 382 } + 383 + 384 fn screen-underline-at-idx? screen-on-stack: (addr screen), idx-on-stack: int -> _/eax: boolean { + 385 var screen-addr/esi: (addr screen) <- copy screen-on-stack + 386 var data-ah/eax: (addr handle array screen-cell) <- get screen-addr, data + 387 var data/eax: (addr array screen-cell) <- lookup *data-ah + 388 var idx/ecx: int <- copy idx-on-stack + 389 var offset/ecx: (offset screen-cell) <- compute-offset data, idx + 390 var cell/eax: (addr screen-cell) <- index data, offset + 391 var src/eax: (addr boolean) <- get cell, underline? + 392 return *src + 393 } + 394 + 395 fn screen-reverse-at? screen-on-stack: (addr screen), row: int, col: int -> _/eax: boolean { + 396 var screen-addr/esi: (addr screen) <- copy screen-on-stack + 397 var idx/ecx: int <- screen-cell-index screen-addr, row, col + 398 var result/eax: boolean <- screen-reverse-at-idx? screen-addr, idx + 399 return result + 400 } + 401 + 402 fn screen-reverse-at-idx? screen-on-stack: (addr screen), idx-on-stack: int -> _/eax: boolean { + 403 var screen-addr/esi: (addr screen) <- copy screen-on-stack + 404 var data-ah/eax: (addr handle array screen-cell) <- get screen-addr, data + 405 var data/eax: (addr array screen-cell) <- lookup *data-ah + 406 var idx/ecx: int <- copy idx-on-stack + 407 var offset/ecx: (offset screen-cell) <- compute-offset data, idx + 408 var cell/eax: (addr screen-cell) <- index data, offset + 409 var src/eax: (addr boolean) <- get cell, reverse? + 410 return *src + 411 } + 412 + 413 fn screen-blink-at? screen-on-stack: (addr screen), row: int, col: int -> _/eax: boolean { + 414 var screen-addr/esi: (addr screen) <- copy screen-on-stack + 415 var idx/ecx: int <- screen-cell-index screen-addr, row, col + 416 var result/eax: boolean <- screen-blink-at-idx? screen-addr, idx + 417 return result + 418 } + 419 + 420 fn screen-blink-at-idx? screen-on-stack: (addr screen), idx-on-stack: int -> _/eax: boolean { + 421 var screen-addr/esi: (addr screen) <- copy screen-on-stack + 422 var data-ah/eax: (addr handle array screen-cell) <- get screen-addr, data + 423 var data/eax: (addr array screen-cell) <- lookup *data-ah + 424 var idx/ecx: int <- copy idx-on-stack + 425 var offset/ecx: (offset screen-cell) <- compute-offset data, idx + 426 var cell/eax: (addr screen-cell) <- index data, offset + 427 var src/eax: (addr boolean) <- get cell, blink? + 428 return *src + 429 } + 430 + 431 fn print-code-point screen: (addr screen), c: code-point { + 432 var g/eax: grapheme <- to-grapheme c + 433 print-grapheme screen, g + 434 } + 435 + 436 fn print-int32-hex screen: (addr screen), n: int { + 437 compare screen, 0 + 438 { + 439 break-if-!= + 440 print-int32-hex-to-real-screen n + 441 return + 442 } + 443 # fake screen + 444 var s2: (stream byte 0x100) + 445 var s2-addr/esi: (addr stream byte) <- address s2 + 446 write-int32-hex s2-addr, n + 447 var screen-addr/edi: (addr screen) <- copy screen + 448 { + 449 var done?/eax: boolean <- stream-empty? s2-addr + 450 compare done?, 0 + 451 break-if-!= + 452 var g/eax: grapheme <- read-grapheme s2-addr + 453 print-grapheme screen, g + 454 loop + 455 } + 456 } + 457 + 458 fn print-int32-hex-bits screen: (addr screen), n: int, bits: int { + 459 compare screen, 0 + 460 { + 461 break-if-!= + 462 print-int32-hex-bits-to-real-screen n, bits + 463 return + 464 } + 465 # fake screen + 466 var s2: (stream byte 0x100) + 467 var s2-addr/esi: (addr stream byte) <- address s2 + 468 write-int32-hex-bits s2-addr, n, bits + 469 var screen-addr/edi: (addr screen) <- copy screen + 470 { + 471 var done?/eax: boolean <- stream-empty? s2-addr + 472 compare done?, 0 + 473 break-if-!= + 474 var g/eax: grapheme <- read-grapheme s2-addr + 475 print-grapheme screen, g + 476 loop + 477 } + 478 } + 479 + 480 fn print-int32-decimal screen: (addr screen), n: int { + 481 compare screen, 0 + 482 { + 483 break-if-!= + 484 print-int32-decimal-to-real-screen n + 485 return + 486 } + 487 # fake screen + 488 # TODO + 489 } + 490 + 491 fn reset-formatting screen: (addr screen) { + 492 compare screen, 0 + 493 { + 494 break-if-!= + 495 reset-formatting-on-real-screen + 496 return + 497 } + 498 # fake screen + 499 var screen-addr/esi: (addr screen) <- copy screen + 500 var dest/ecx: (addr screen-cell) <- get screen-addr, curr-attributes + 501 var default-cell: screen-cell + 502 var bg/eax: (addr int) <- get default-cell, background-color + 503 copy-to *bg, 7 + 504 var default-cell-addr/eax: (addr screen-cell) <- address default-cell + 505 copy-object default-cell-addr, dest + 506 } + 507 + 508 fn start-color screen: (addr screen), fg: int, bg: int { + 509 compare screen, 0 + 510 { + 511 break-if-!= + 512 start-color-on-real-screen fg, bg + 513 return + 514 } + 515 # fake screen + 516 var screen-addr/esi: (addr screen) <- copy screen + 517 var attr/ecx: (addr screen-cell) <- get screen-addr, curr-attributes + 518 var dest/edx: (addr int) <- get attr, color + 519 var src/eax: int <- copy fg + 520 copy-to *dest, src + 521 var dest/edx: (addr int) <- get attr, background-color + 522 var src/eax: int <- copy bg + 523 copy-to *dest, src + 524 } + 525 + 526 fn start-bold screen: (addr screen) { + 527 compare screen, 0 + 528 { + 529 break-if-!= + 530 start-bold-on-real-screen + 531 return + 532 } + 533 # fake screen + 534 var screen-addr/esi: (addr screen) <- copy screen + 535 var attr/ecx: (addr screen-cell) <- get screen-addr, curr-attributes + 536 var dest/edx: (addr boolean) <- get attr, bold? + 537 copy-to *dest, 1 + 538 } + 539 + 540 fn start-underline screen: (addr screen) { + 541 compare screen, 0 + 542 { + 543 break-if-!= + 544 start-underline-on-real-screen + 545 return + 546 } + 547 # fake screen + 548 var screen-addr/esi: (addr screen) <- copy screen + 549 var attr/ecx: (addr screen-cell) <- get screen-addr, curr-attributes + 550 var dest/edx: (addr boolean) <- get attr, underline? + 551 copy-to *dest, 1 + 552 } + 553 + 554 fn start-reverse-video screen: (addr screen) { + 555 compare screen, 0 + 556 { + 557 break-if-!= + 558 start-reverse-video-on-real-screen + 559 return + 560 } + 561 # fake screen + 562 var screen-addr/esi: (addr screen) <- copy screen + 563 var attr/ecx: (addr screen-cell) <- get screen-addr, curr-attributes + 564 var dest/edx: (addr boolean) <- get attr, reverse? + 565 copy-to *dest, 1 + 566 } + 567 + 568 fn start-blinking screen: (addr screen) { + 569 compare screen, 0 + 570 { + 571 break-if-!= + 572 start-blinking-on-real-screen + 573 return + 574 } + 575 # fake screen + 576 var screen-addr/esi: (addr screen) <- copy screen + 577 var attr/ecx: (addr screen-cell) <- get screen-addr, curr-attributes + 578 var dest/edx: (addr boolean) <- get attr, blink? + 579 copy-to *dest, 1 + 580 } + 581 + 582 fn hide-cursor screen: (addr screen) { + 583 compare screen, 0 + 584 { + 585 break-if-!= + 586 hide-cursor-on-real-screen + 587 return + 588 } + 589 # fake screen + 590 var screen-addr/esi: (addr screen) <- copy screen + 591 var hide?/ecx: (addr boolean) <- get screen-addr, cursor-hide? + 592 copy-to *hide?, 1 + 593 } + 594 + 595 fn show-cursor screen: (addr screen) { + 596 compare screen, 0 + 597 { + 598 break-if-!= + 599 show-cursor-on-real-screen + 600 return + 601 } + 602 # fake screen + 603 var screen-addr/esi: (addr screen) <- copy screen + 604 var hide?/ecx: (addr boolean) <- get screen-addr, cursor-hide? + 605 copy-to *hide?, 0 + 606 } + 607 + 608 # validate data on screen regardless of attributes (color, bold, etc.) + 609 # Mu doesn't have multi-line strings, so we provide functions for rows or portions of rows. + 610 # Tab characters (that translate into multiple screen cells) not supported. + 611 + 612 fn check-screen-row screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { + 613 check-screen-row-from screen, row-idx, 1, expected, msg + 614 } + 615 + 616 fn check-screen-row-from screen-on-stack: (addr screen), row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { + 617 var screen/esi: (addr screen) <- copy screen-on-stack + 618 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx + 619 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme + 620 var e: (stream byte 0x100) + 621 var e-addr/edx: (addr stream byte) <- address e + 622 write e-addr, expected + 623 { + 624 var done?/eax: boolean <- stream-empty? e-addr + 625 compare done?, 0 + 626 break-if-!= + 627 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx + 628 var g/ebx: grapheme <- copy _g + 629 var expected-grapheme/eax: grapheme <- read-grapheme e-addr + 630 # compare graphemes + 631 $check-screen-row-from:compare-graphemes: { + 632 # if expected-grapheme is space, null grapheme is also ok + 633 { + 634 compare expected-grapheme, 0x20 + 635 break-if-!= + 636 compare g, 0 + 637 break-if-= $check-screen-row-from:compare-graphemes + 638 } + 639 # if (g == expected-grapheme) print "." + 640 compare g, expected-grapheme + 641 { + 642 break-if-!= + 643 print-string-to-real-screen "." + 644 break $check-screen-row-from:compare-graphemes + 645 } + 646 # otherwise print an error + 647 print-string-to-real-screen msg + 648 print-string-to-real-screen ": expected '" + 649 print-grapheme-to-real-screen expected-grapheme + 650 print-string-to-real-screen "' at (" + 651 print-int32-hex-to-real-screen row-idx + 652 print-string-to-real-screen ", " + 653 print-int32-hex-to-real-screen col-idx + 654 print-string-to-real-screen ") but observed '" + 655 print-grapheme-to-real-screen g + 656 print-string-to-real-screen "'\n" + 657 } + 658 idx <- increment + 659 increment col-idx + 660 loop + 661 } + 662 } + 663 + 664 # various variants by screen-cell attribute; spaces in the 'expected' data should not match the attribute + 665 + 666 fn check-screen-row-in-color screen: (addr screen), fg: int, row-idx: int, expected: (addr array byte), msg: (addr array byte) { + 667 check-screen-row-in-color-from screen, fg, row-idx, 1, expected, msg + 668 } + 669 + 670 fn check-screen-row-in-color-from screen-on-stack: (addr screen), fg: int, row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { + 671 var screen/esi: (addr screen) <- copy screen-on-stack + 672 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx + 673 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme + 674 var e: (stream byte 0x100) + 675 var e-addr/edx: (addr stream byte) <- address e + 676 write e-addr, expected + 677 { + 678 var done?/eax: boolean <- stream-empty? e-addr + 679 compare done?, 0 + 680 break-if-!= + 681 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx + 682 var g/ebx: grapheme <- copy _g + 683 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr + 684 var expected-grapheme/edi: grapheme <- copy _expected-grapheme + 685 $check-screen-row-in-color-from:compare-cells: { + 686 # if expected-grapheme is space, null grapheme is also ok + 687 { + 688 compare expected-grapheme, 0x20 + 689 break-if-!= + 690 compare g, 0 + 691 break-if-= $check-screen-row-in-color-from:compare-cells + 692 } + 693 # if expected-grapheme is space, a different color is ok + 694 { + 695 compare expected-grapheme, 0x20 + 696 break-if-!= + 697 var color/eax: int <- screen-color-at-idx screen, idx + 698 compare color, fg + 699 break-if-!= $check-screen-row-in-color-from:compare-cells + 700 } + 701 # compare graphemes + 702 $check-screen-row-in-color-from:compare-graphemes: { + 703 # if (g == expected-grapheme) print "." + 704 compare g, expected-grapheme + 705 { + 706 break-if-!= + 707 print-string-to-real-screen "." + 708 break $check-screen-row-in-color-from:compare-graphemes + 709 } + 710 # otherwise print an error + 711 print-string-to-real-screen msg + 712 print-string-to-real-screen ": expected '" + 713 print-grapheme-to-real-screen expected-grapheme + 714 print-string-to-real-screen "' at (" + 715 print-int32-hex-to-real-screen row-idx + 716 print-string-to-real-screen ", " + 717 print-int32-hex-to-real-screen col-idx + 718 print-string-to-real-screen ") but observed '" + 719 print-grapheme-to-real-screen g + 720 print-string-to-real-screen "'\n" + 721 } + 722 $check-screen-row-in-color-from:compare-colors: { + 723 var color/eax: int <- screen-color-at-idx screen, idx + 724 compare fg, color + 725 { + 726 break-if-!= + 727 print-string-to-real-screen "." + 728 break $check-screen-row-in-color-from:compare-colors + 729 } + 730 # otherwise print an error + 731 print-string-to-real-screen msg + 732 print-string-to-real-screen ": expected '" + 733 print-grapheme-to-real-screen expected-grapheme + 734 print-string-to-real-screen "' at (" + 735 print-int32-hex-to-real-screen row-idx + 736 print-string-to-real-screen ", " + 737 print-int32-hex-to-real-screen col-idx + 738 print-string-to-real-screen ") in color " + 739 print-int32-hex-to-real-screen fg + 740 print-string-to-real-screen " but observed color " + 741 print-int32-hex-to-real-screen color + 742 print-string-to-real-screen "\n" + 743 } + 744 } + 745 idx <- increment + 746 increment col-idx + 747 loop + 748 } + 749 } + 750 + 751 # background color is visible even for spaces, so 'expected' behaves as an array of booleans. + 752 # non-space = given background must match; space = background must not match + 753 fn check-screen-row-in-background-color screen: (addr screen), bg: int, row-idx: int, expected: (addr array byte), msg: (addr array byte) { + 754 check-screen-row-in-background-color-from screen, bg, row-idx, 1, expected, msg + 755 } + 756 + 757 fn check-screen-row-in-background-color-from screen-on-stack: (addr screen), bg: int, row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { + 758 var screen/esi: (addr screen) <- copy screen-on-stack + 759 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx + 760 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme + 761 var e: (stream byte 0x100) + 762 var e-addr/edx: (addr stream byte) <- address e + 763 write e-addr, expected + 764 { + 765 var done?/eax: boolean <- stream-empty? e-addr + 766 compare done?, 0 + 767 break-if-!= + 768 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx + 769 var g/ebx: grapheme <- copy _g + 770 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr + 771 var expected-grapheme/edx: grapheme <- copy _expected-grapheme + 772 $check-screen-row-in-background-color-from:compare-cells: { + 773 # if expected-grapheme is space, null grapheme is also ok + 774 { + 775 compare expected-grapheme, 0x20 + 776 break-if-!= + 777 compare g, 0 + 778 break-if-= $check-screen-row-in-background-color-from:compare-cells + 779 } + 780 # if expected-grapheme is space, a different color is ok + 781 { + 782 compare expected-grapheme, 0x20 + 783 break-if-!= + 784 var color/eax: int <- screen-background-color-at-idx screen, idx + 785 compare color, bg + 786 break-if-!= $check-screen-row-in-background-color-from:compare-cells + 787 } + 788 # compare graphemes + 789 $check-screen-row-in-background-color-from:compare-graphemes: { + 790 # if (g == expected-grapheme) print "." + 791 compare g, expected-grapheme + 792 { + 793 break-if-!= + 794 print-string-to-real-screen "." + 795 break $check-screen-row-in-background-color-from:compare-graphemes + 796 } + 797 # otherwise print an error + 798 print-string-to-real-screen msg + 799 print-string-to-real-screen ": expected '" + 800 print-grapheme-to-real-screen expected-grapheme + 801 print-string-to-real-screen "' at (" + 802 print-int32-hex-to-real-screen row-idx + 803 print-string-to-real-screen ", " + 804 print-int32-hex-to-real-screen col-idx + 805 print-string-to-real-screen ") but observed '" + 806 print-grapheme-to-real-screen g + 807 print-string-to-real-screen "'\n" + 808 } + 809 $check-screen-row-in-background-color-from:compare-colors: { + 810 var color/eax: int <- screen-background-color-at-idx screen, idx + 811 compare bg, color + 812 { + 813 break-if-!= + 814 print-string-to-real-screen "." + 815 break $check-screen-row-in-background-color-from:compare-colors + 816 } + 817 # otherwise print an error + 818 print-string-to-real-screen msg + 819 print-string-to-real-screen ": expected '" + 820 print-grapheme-to-real-screen expected-grapheme + 821 print-string-to-real-screen "' at (" + 822 print-int32-hex-to-real-screen row-idx + 823 print-string-to-real-screen ", " + 824 print-int32-hex-to-real-screen col-idx + 825 print-string-to-real-screen ") in background color " + 826 print-int32-hex-to-real-screen bg + 827 print-string-to-real-screen " but observed color " + 828 print-int32-hex-to-real-screen color + 829 print-string-to-real-screen "\n" + 830 } + 831 } + 832 idx <- increment + 833 increment col-idx + 834 loop + 835 } + 836 } + 837 + 838 fn check-screen-row-in-bold screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { + 839 check-screen-row-in-bold-from screen, row-idx, 1, expected, msg + 840 } + 841 + 842 fn check-screen-row-in-bold-from screen-on-stack: (addr screen), row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { + 843 var screen/esi: (addr screen) <- copy screen-on-stack + 844 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx + 845 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme + 846 var e: (stream byte 0x100) + 847 var e-addr/edx: (addr stream byte) <- address e + 848 write e-addr, expected + 849 { + 850 var done?/eax: boolean <- stream-empty? e-addr + 851 compare done?, 0 + 852 break-if-!= + 853 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx + 854 var g/ebx: grapheme <- copy _g + 855 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr + 856 var expected-grapheme/edx: grapheme <- copy _expected-grapheme + 857 $check-screen-row-in-bold-from:compare-cells: { + 858 # if expected-grapheme is space, null grapheme is also ok + 859 { + 860 compare expected-grapheme, 0x20 + 861 break-if-!= + 862 compare g, 0 + 863 break-if-= $check-screen-row-in-bold-from:compare-cells + 864 } + 865 # if expected-grapheme is space, non-bold is ok + 866 { + 867 compare expected-grapheme, 0x20 + 868 break-if-!= + 869 var bold?/eax: boolean <- screen-bold-at-idx? screen, idx + 870 compare bold?, 1 + 871 break-if-!= $check-screen-row-in-bold-from:compare-cells + 872 } + 873 # compare graphemes + 874 $check-screen-row-in-bold-from:compare-graphemes: { + 875 # if (g == expected-grapheme) print "." + 876 compare g, expected-grapheme + 877 { + 878 break-if-!= + 879 print-string-to-real-screen "." + 880 break $check-screen-row-in-bold-from:compare-graphemes + 881 } + 882 # otherwise print an error + 883 print-string-to-real-screen msg + 884 print-string-to-real-screen ": expected '" + 885 print-grapheme-to-real-screen expected-grapheme + 886 print-string-to-real-screen "' at (" + 887 print-int32-hex-to-real-screen row-idx + 888 print-string-to-real-screen ", " + 889 print-int32-hex-to-real-screen col-idx + 890 print-string-to-real-screen ") but observed '" + 891 print-grapheme-to-real-screen g + 892 print-string-to-real-screen "'\n" + 893 } + 894 $check-screen-row-in-bold-from:compare-bold: { + 895 var bold?/eax: boolean <- screen-bold-at-idx? screen, idx + 896 compare bold?, 1 + 897 { + 898 break-if-!= + 899 print-string-to-real-screen "." + 900 break $check-screen-row-in-bold-from:compare-bold + 901 } + 902 # otherwise print an error + 903 print-string-to-real-screen msg + 904 print-string-to-real-screen ": expected '" + 905 print-grapheme-to-real-screen expected-grapheme + 906 print-string-to-real-screen "' at (" + 907 print-int32-hex-to-real-screen row-idx + 908 print-string-to-real-screen ", " + 909 print-int32-hex-to-real-screen col-idx + 910 print-string-to-real-screen ") to be in bold\n" + 911 } + 912 } + 913 idx <- increment + 914 increment col-idx + 915 loop + 916 } + 917 } + 918 + 919 fn check-screen-row-in-underline screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { + 920 check-screen-row-in-underline-from screen, row-idx, 1, expected, msg + 921 } + 922 + 923 fn check-screen-row-in-underline-from screen-on-stack: (addr screen), row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { + 924 var screen/esi: (addr screen) <- copy screen-on-stack + 925 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx + 926 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme + 927 var e: (stream byte 0x100) + 928 var e-addr/edx: (addr stream byte) <- address e + 929 write e-addr, expected + 930 { + 931 var done?/eax: boolean <- stream-empty? e-addr + 932 compare done?, 0 + 933 break-if-!= + 934 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx + 935 var g/ebx: grapheme <- copy _g + 936 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr + 937 var expected-grapheme/edx: grapheme <- copy _expected-grapheme + 938 $check-screen-row-in-underline-from:compare-cells: { + 939 # if expected-grapheme is space, null grapheme is also ok + 940 { + 941 compare expected-grapheme, 0x20 + 942 break-if-!= + 943 compare g, 0 + 944 break-if-= $check-screen-row-in-underline-from:compare-cells + 945 } + 946 # if expected-grapheme is space, non-underline is ok + 947 { + 948 compare expected-grapheme, 0x20 + 949 break-if-!= + 950 var underline?/eax: boolean <- screen-underline-at-idx? screen, idx + 951 compare underline?, 1 + 952 break-if-!= $check-screen-row-in-underline-from:compare-cells + 953 } + 954 # compare graphemes + 955 $check-screen-row-in-underline-from:compare-graphemes: { + 956 # if (g == expected-grapheme) print "." + 957 compare g, expected-grapheme + 958 { + 959 break-if-!= + 960 print-string-to-real-screen "." + 961 break $check-screen-row-in-underline-from:compare-graphemes + 962 } + 963 # otherwise print an error + 964 print-string-to-real-screen msg + 965 print-string-to-real-screen ": expected '" + 966 print-grapheme-to-real-screen expected-grapheme + 967 print-string-to-real-screen "' at (" + 968 print-int32-hex-to-real-screen row-idx + 969 print-string-to-real-screen ", " + 970 print-int32-hex-to-real-screen col-idx + 971 print-string-to-real-screen ") but observed '" + 972 print-grapheme-to-real-screen g + 973 print-string-to-real-screen "'\n" + 974 } + 975 $check-screen-row-in-underline-from:compare-underline: { + 976 var underline?/eax: boolean <- screen-underline-at-idx? screen, idx + 977 compare underline?, 1 + 978 { + 979 break-if-!= + 980 print-string-to-real-screen "." + 981 break $check-screen-row-in-underline-from:compare-underline + 982 } + 983 # otherwise print an error + 984 print-string-to-real-screen msg + 985 print-string-to-real-screen ": expected '" + 986 print-grapheme-to-real-screen expected-grapheme + 987 print-string-to-real-screen "' at (" + 988 print-int32-hex-to-real-screen row-idx + 989 print-string-to-real-screen ", " + 990 print-int32-hex-to-real-screen col-idx + 991 print-string-to-real-screen ") to be underlined\n" + 992 } + 993 } + 994 idx <- increment + 995 increment col-idx + 996 loop + 997 } + 998 } + 999 +1000 fn check-screen-row-in-reverse screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { +1001 check-screen-row-in-reverse-from screen, row-idx, 1, expected, msg +1002 } +1003 +1004 fn check-screen-row-in-reverse-from screen-on-stack: (addr screen), row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { +1005 var screen/esi: (addr screen) <- copy screen-on-stack +1006 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx +1007 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme +1008 var e: (stream byte 0x100) +1009 var e-addr/edx: (addr stream byte) <- address e +1010 write e-addr, expected +1011 { +1012 var done?/eax: boolean <- stream-empty? e-addr +1013 compare done?, 0 +1014 break-if-!= +1015 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx +1016 var g/ebx: grapheme <- copy _g +1017 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr +1018 var expected-grapheme/edx: grapheme <- copy _expected-grapheme +1019 $check-screen-row-in-reverse-from:compare-cells: { +1020 # if expected-grapheme is space, null grapheme is also ok +1021 { +1022 compare expected-grapheme, 0x20 +1023 break-if-!= +1024 compare g, 0 +1025 break-if-= $check-screen-row-in-reverse-from:compare-cells +1026 } +1027 # if expected-grapheme is space, non-reverse is ok +1028 { +1029 compare expected-grapheme, 0x20 +1030 break-if-!= +1031 var reverse?/eax: boolean <- screen-reverse-at-idx? screen, idx +1032 compare reverse?, 1 +1033 break-if-!= $check-screen-row-in-reverse-from:compare-cells +1034 } +1035 # compare graphemes +1036 $check-screen-row-in-reverse-from:compare-graphemes: { +1037 # if (g == expected-grapheme) print "." +1038 compare g, expected-grapheme +1039 { +1040 break-if-!= +1041 print-string-to-real-screen "." +1042 break $check-screen-row-in-reverse-from:compare-graphemes +1043 } +1044 # otherwise print an error +1045 print-string-to-real-screen msg +1046 print-string-to-real-screen ": expected '" +1047 print-grapheme-to-real-screen expected-grapheme +1048 print-string-to-real-screen "' at (" +1049 print-int32-hex-to-real-screen row-idx +1050 print-string-to-real-screen ", " +1051 print-int32-hex-to-real-screen col-idx +1052 print-string-to-real-screen ") but observed '" +1053 print-grapheme-to-real-screen g +1054 print-string-to-real-screen "'\n" +1055 } +1056 $check-screen-row-in-reverse-from:compare-reverse: { +1057 var reverse?/eax: boolean <- screen-reverse-at-idx? screen, idx +1058 compare reverse?, 1 +1059 { +1060 break-if-!= +1061 print-string-to-real-screen "." +1062 break $check-screen-row-in-reverse-from:compare-reverse +1063 } +1064 # otherwise print an error +1065 print-string-to-real-screen msg +1066 print-string-to-real-screen ": expected '" +1067 print-grapheme-to-real-screen expected-grapheme +1068 print-string-to-real-screen "' at (" +1069 print-int32-hex-to-real-screen row-idx +1070 print-string-to-real-screen ", " +1071 print-int32-hex-to-real-screen col-idx +1072 print-string-to-real-screen ") to be in reverse-video\n" +1073 } +1074 } +1075 idx <- increment +1076 increment col-idx +1077 loop +1078 } +1079 } +1080 +1081 fn check-screen-row-in-blinking screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { +1082 check-screen-row-in-blinking-from screen, row-idx, 1, expected, msg +1083 } +1084 +1085 fn check-screen-row-in-blinking-from screen-on-stack: (addr screen), row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { +1086 var screen/esi: (addr screen) <- copy screen-on-stack +1087 var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx +1088 # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme +1089 var e: (stream byte 0x100) +1090 var e-addr/edx: (addr stream byte) <- address e +1091 write e-addr, expected +1092 { +1093 var done?/eax: boolean <- stream-empty? e-addr +1094 compare done?, 0 +1095 break-if-!= +1096 var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx +1097 var g/ebx: grapheme <- copy _g +1098 var _expected-grapheme/eax: grapheme <- read-grapheme e-addr +1099 var expected-grapheme/edx: grapheme <- copy _expected-grapheme +1100 $check-screen-row-in-blinking-from:compare-cells: { +1101 # if expected-grapheme is space, null grapheme is also ok +1102 { +1103 compare expected-grapheme, 0x20 +1104 break-if-!= +1105 compare g, 0 +1106 break-if-= $check-screen-row-in-blinking-from:compare-cells +1107 } +1108 # if expected-grapheme is space, non-blinking is ok +1109 { +1110 compare expected-grapheme, 0x20 +1111 break-if-!= +1112 var blinking?/eax: boolean <- screen-blink-at-idx? screen, idx +1113 compare blinking?, 1 +1114 break-if-!= $check-screen-row-in-blinking-from:compare-cells +1115 } +1116 # compare graphemes +1117 $check-screen-row-in-blinking-from:compare-graphemes: { +1118 # if (g == expected-grapheme) print "." +1119 compare g, expected-grapheme +1120 { +1121 break-if-!= +1122 print-string-to-real-screen "." +1123 break $check-screen-row-in-blinking-from:compare-graphemes +1124 } +1125 # otherwise print an error +1126 print-string-to-real-screen msg +1127 print-string-to-real-screen ": expected '" +1128 print-grapheme-to-real-screen expected-grapheme +1129 print-string-to-real-screen "' at (" +1130 print-int32-hex-to-real-screen row-idx +1131 print-string-to-real-screen ", " +1132 print-int32-hex-to-real-screen col-idx +1133 print-string-to-real-screen ") but observed '" +1134 print-grapheme-to-real-screen g +1135 print-string-to-real-screen "'\n" +1136 } +1137 $check-screen-row-in-blinking-from:compare-blinking: { +1138 var blinking?/eax: boolean <- screen-blink-at-idx? screen, idx +1139 compare blinking?, 1 +1140 { +1141 break-if-!= +1142 print-string-to-real-screen "." +1143 break $check-screen-row-in-blinking-from:compare-blinking +1144 } +1145 # otherwise print an error +1146 print-string-to-real-screen msg +1147 print-string-to-real-screen ": expected '" +1148 print-grapheme-to-real-screen expected-grapheme +1149 print-string-to-real-screen "' at (" +1150 print-int32-hex-to-real-screen row-idx +1151 print-string-to-real-screen ", " +1152 print-int32-hex-to-real-screen col-idx +1153 print-string-to-real-screen ") to be blinking\n" +1154 } +1155 } +1156 idx <- increment +1157 increment col-idx +1158 +1159 loop +1160 } +1161 } +1162 +1163 fn test-print-single-grapheme { +1164 var screen-on-stack: screen +1165 var screen/esi: (addr screen) <- address screen-on-stack +1166 initialize-screen screen, 5, 4 +1167 var c/eax: grapheme <- copy 0x61 # 'a' +1168 print-grapheme screen, c +1169 check-screen-row screen, 1, "a", "F - test-print-single-grapheme" # top-left corner of the screen +1170 } +1171 +1172 fn test-print-multiple-graphemes { +1173 var screen-on-stack: screen +1174 var screen/esi: (addr screen) <- address screen-on-stack +1175 initialize-screen screen, 5, 4 +1176 print-string screen, "Hello, 世界" +1177 check-screen-row screen, 1, "Hello, 世界", "F - test-print-multiple-graphemes" +1178 } +1179 +1180 fn test-move-cursor { +1181 var screen-on-stack: screen +1182 var screen/esi: (addr screen) <- address screen-on-stack +1183 initialize-screen screen, 5, 4 +1184 move-cursor screen, 1, 4 +1185 var c/eax: grapheme <- copy 0x61 # 'a' +1186 print-grapheme screen, c +1187 check-screen-row screen, 1, " a", "F - test-move-cursor" # top row +1188 } +1189 +1190 fn test-move-cursor-zeroes { +1191 var screen-on-stack: screen +1192 var screen/esi: (addr screen) <- address screen-on-stack +1193 initialize-screen screen, 5, 4 +1194 move-cursor screen, 0, 0 +1195 var c/eax: grapheme <- copy 0x61 # 'a' +1196 print-grapheme screen, c +1197 check-screen-row screen, 1, "a", "F - test-move-cursor-zeroes" # top-left corner of the screen +1198 } +1199 +1200 fn test-move-cursor-zero-row { +1201 var screen-on-stack: screen +1202 var screen/esi: (addr screen) <- address screen-on-stack +1203 initialize-screen screen, 5, 4 +1204 move-cursor screen, 0, 2 +1205 var c/eax: grapheme <- copy 0x61 # 'a' +1206 print-grapheme screen, c +1207 check-screen-row screen, 1, " a", "F - test-move-cursor-zero-row" # top row +1208 } +1209 +1210 fn test-move-cursor-zero-column { +1211 var screen-on-stack: screen +1212 var screen/esi: (addr screen) <- address screen-on-stack +1213 initialize-screen screen, 5, 4 +1214 move-cursor screen, 4, 0 +1215 var c/eax: grapheme <- copy 0x61 # 'a' +1216 print-grapheme screen, c +1217 check-screen-row screen, 4, "a", "F - test-move-cursor-zero-column" +1218 } +1219 +1220 fn test-move-cursor-negative-row { +1221 var screen-on-stack: screen +1222 var screen/esi: (addr screen) <- address screen-on-stack +1223 initialize-screen screen, 5, 3 +1224 move-cursor screen, -1, 2 # row -1 +1225 var c/eax: grapheme <- copy 0x61 # 'a' +1226 print-grapheme screen, c +1227 # no move +1228 check-screen-row screen, 1, "a", "F - test-move-cursor-negative-row" +1229 } +1230 +1231 fn test-move-cursor-negative-column { +1232 var screen-on-stack: screen +1233 var screen/esi: (addr screen) <- address screen-on-stack +1234 initialize-screen screen, 5, 3 +1235 move-cursor screen, 2, -1 # column -1 +1236 var c/eax: grapheme <- copy 0x61 # 'a' +1237 print-grapheme screen, c +1238 # no move +1239 check-screen-row screen, 1, "a", "F - test-move-cursor-negative-column" +1240 } +1241 +1242 fn test-move-cursor-column-too-large { +1243 var screen-on-stack: screen +1244 var screen/esi: (addr screen) <- address screen-on-stack +1245 initialize-screen screen, 5, 3 # 5 rows, 3 columns +1246 move-cursor screen, 1, 4 # row 1, column 4 (overflow) +1247 var c/eax: grapheme <- copy 0x61 # 'a' +1248 print-grapheme screen, c +1249 # top row is empty +1250 check-screen-row screen, 1, " ", "F - test-move-cursor-column-too-large" +1251 # character shows up on next row +1252 check-screen-row screen, 2, "a", "F - test-move-cursor-column-too-large" +1253 } +1254 +1255 fn test-move-cursor-column-too-large-saturates { +1256 var screen-on-stack: screen +1257 var screen/esi: (addr screen) <- address screen-on-stack +1258 initialize-screen screen, 5, 3 # 5 rows, 3 columns +1259 move-cursor screen, 1, 6 # row 1, column 6 (overflow) +1260 var c/eax: grapheme <- copy 0x61 # 'a' +1261 print-grapheme screen, c +1262 # top row is empty +1263 check-screen-row screen, 1, " ", "F - test-move-cursor-column-too-large-saturates" # top-left corner of the screen +1264 # character shows up at the start of next row +1265 check-screen-row screen, 2, "a", "F - test-move-cursor-column-too-large-saturates" # top-left corner of the screen +1266 } +1267 +1268 fn test-move-cursor-row-too-large { +1269 var screen-on-stack: screen +1270 var screen/esi: (addr screen) <- address screen-on-stack +1271 initialize-screen screen, 5, 3 # 5 rows +1272 move-cursor screen, 6, 2 # row 6 (overflow) +1273 var c/eax: grapheme <- copy 0x61 # 'a' +1274 print-grapheme screen, c +1275 # bottom row shows the character +1276 check-screen-row screen, 5, " a", "F - test-move-cursor-row-too-large" +1277 } +1278 +1279 fn test-move-cursor-row-too-large-saturates { +1280 var screen-on-stack: screen +1281 var screen/esi: (addr screen) <- address screen-on-stack +1282 initialize-screen screen, 5, 3 # 5 rows +1283 move-cursor screen, 9, 2 # row 9 (overflow) +1284 var c/eax: grapheme <- copy 0x61 # 'a' +1285 print-grapheme screen, c +1286 # bottom row shows the character +1287 check-screen-row screen, 5, " a", "F - test-move-cursor-row-too-large-saturates" +1288 } +1289 +1290 fn test-check-screen-row-from { +1291 var screen-on-stack: screen +1292 var screen/esi: (addr screen) <- address screen-on-stack +1293 initialize-screen screen, 5, 4 +1294 move-cursor screen, 1, 4 +1295 var c/eax: grapheme <- copy 0x61 # 'a' +1296 print-grapheme screen, c +1297 check-screen-row screen, 1, " a", "F - test-check-screen-row-from/baseline" +1298 check-screen-row-from screen, 1, 4, "a", "F - test-check-screen-row-from" +1299 } +1300 +1301 fn test-print-string-overflows-to-next-row { +1302 var screen-on-stack: screen +1303 var screen/esi: (addr screen) <- address screen-on-stack +1304 initialize-screen screen, 5, 4 # 5 rows, 4 columns +1305 print-string screen, "abcdefg" +1306 check-screen-row screen, 1, "abcd", "F - test-print-string-overflows-to-next-row" +1307 check-screen-row screen, 2, "efg", "F - test-print-string-overflows-to-next-row" +1308 } +1309 +1310 fn test-check-screen-scrolls-on-overflow { +1311 var screen-on-stack: screen +1312 var screen/esi: (addr screen) <- address screen-on-stack +1313 initialize-screen screen, 5, 4 +1314 # single character starting at bottom right +1315 move-cursor screen, 5, 4 +1316 var c/eax: grapheme <- copy 0x61 # 'a' +1317 print-grapheme screen, c +1318 check-screen-row-from screen, 5, 4, "a", "F - test-check-screen-scrolls-on-overflow/baseline" # bottom-right corner of the screen +1319 # multiple characters starting at bottom right +1320 move-cursor screen, 5, 4 +1321 print-string screen, "ab" +1322 # screen scrolled up one row +1323 #? check-screen-row screen, 1, " ", "F - test-check-screen-scrolls-on-overflow/x1" +1324 #? check-screen-row screen, 2, " ", "F - test-check-screen-scrolls-on-overflow/x2" +1325 #? check-screen-row screen, 3, " ", "F - test-check-screen-scrolls-on-overflow/x3" +1326 #? check-screen-row screen, 4, " a", "F - test-check-screen-scrolls-on-overflow/x4" +1327 #? check-screen-row screen, 5, "b ", "F - test-check-screen-scrolls-on-overflow/x5" +1328 check-screen-row-from screen, 4, 4, "a", "F - test-check-screen-scrolls-on-overflow/1" +1329 check-screen-row-from screen, 5, 1, "b", "F - test-check-screen-scrolls-on-overflow/2" +1330 } +1331 +1332 fn test-check-screen-color { +1333 var screen-on-stack: screen +1334 var screen/esi: (addr screen) <- address screen-on-stack +1335 initialize-screen screen, 5, 4 +1336 var c/eax: grapheme <- copy 0x61 # 'a' +1337 print-grapheme screen, c +1338 start-color screen, 1, 0 # foreground=1 +1339 c <- copy 0x62 # 'b' +1340 print-grapheme screen, c +1341 start-color screen, 0, 0 # back to default +1342 c <- copy 0x63 # 'c' +1343 print-grapheme screen, c +1344 check-screen-row-in-color screen, 0, 1, "a c", "F - test-check-screen-color" +1345 } +1346 +1347 fn test-check-screen-background-color { +1348 var screen-on-stack: screen +1349 var screen/esi: (addr screen) <- address screen-on-stack +1350 initialize-screen screen, 5, 4 +1351 var c/eax: grapheme <- copy 0x61 # 'a' +1352 print-grapheme screen, c +1353 start-color screen, 0, 1 # background=1 +1354 c <- copy 0x62 # 'b' +1355 print-grapheme screen, c +1356 start-color screen, 0, 7 # back to default +1357 c <- copy 0x63 # 'c' +1358 print-grapheme screen, c +1359 check-screen-row-in-background-color screen, 7, 1, "a c", "F - test-check-screen-background-color" +1360 } +1361 +1362 fn test-check-screen-bold { +1363 var screen-on-stack: screen +1364 var screen/esi: (addr screen) <- address screen-on-stack +1365 initialize-screen screen, 5, 4 +1366 start-bold screen +1367 var c/eax: grapheme <- copy 0x61 # 'a' +1368 print-grapheme screen, c +1369 reset-formatting screen +1370 c <- copy 0x62 # 'b' +1371 print-grapheme screen, c +1372 start-bold screen +1373 c <- copy 0x63 # 'c' +1374 print-grapheme screen, c +1375 check-screen-row-in-bold screen, 1, "a c", "F - test-check-screen-bold" +1376 } +1377 +1378 fn test-check-screen-underline { +1379 var screen-on-stack: screen +1380 var screen/esi: (addr screen) <- address screen-on-stack +1381 initialize-screen screen, 5, 4 +1382 start-underline screen +1383 var c/eax: grapheme <- copy 0x61 # 'a' +1384 print-grapheme screen, c +1385 reset-formatting screen +1386 c <- copy 0x62 # 'b' +1387 print-grapheme screen, c +1388 start-underline screen +1389 c <- copy 0x63 # 'c' +1390 print-grapheme screen, c +1391 check-screen-row-in-underline screen, 1, "a c", "F - test-check-screen-underline" +1392 } +1393 +1394 fn test-check-screen-reverse { +1395 var screen-on-stack: screen +1396 var screen/esi: (addr screen) <- address screen-on-stack +1397 initialize-screen screen, 5, 4 +1398 start-reverse-video screen +1399 var c/eax: grapheme <- copy 0x61 # 'a' +1400 print-grapheme screen, c +1401 reset-formatting screen +1402 c <- copy 0x62 # 'b' +1403 print-grapheme screen, c +1404 start-reverse-video screen +1405 c <- copy 0x63 # 'c' +1406 print-grapheme screen, c +1407 check-screen-row-in-reverse screen, 1, "a c", "F - test-check-screen-reverse" +1408 } +1409 +1410 fn test-check-screen-blinking { +1411 var screen-on-stack: screen +1412 var screen/esi: (addr screen) <- address screen-on-stack +1413 initialize-screen screen, 5, 4 +1414 start-blinking screen +1415 var c/eax: grapheme <- copy 0x61 # 'a' +1416 print-grapheme screen, c +1417 reset-formatting screen +1418 c <- copy 0x62 # 'b' +1419 print-grapheme screen, c +1420 start-blinking screen +1421 c <- copy 0x63 # 'c' +1422 print-grapheme screen, c +1423 check-screen-row-in-blinking screen, 1, "a c", "F - test-check-screen-blinking" +1424 } +1425 +1426 #? fn main -> _/ebx: int { +1427 #? #? test-check-screen-color +1428 #? run-tests +1429 #? return 0 +1430 #? } diff --git a/html/407print-int32-decimal-right-justified.mu.html b/html/407print-int32-decimal-right-justified.mu.html index 317d265a..55fd45c1 100644 --- a/html/407print-int32-decimal-right-justified.mu.html +++ b/html/407print-int32-decimal-right-justified.mu.html @@ -68,7 +68,7 @@ if ('onhashchange' in window) { 10 width <- decrement 11 loop 12 } -13 print-int32-decimal screen, n +13 print-int32-decimal screen, n 14 } diff --git a/html/408print-float.mu.html b/html/408print-float.mu.html index dfcdb894..dc459b68 100644 --- a/html/408print-float.mu.html +++ b/html/408print-float.mu.html @@ -81,7 +81,7 @@ if ('onhashchange' in window) { 21 half <- divide two-f 22 print-float screen, half 23 # - 24 check-screen-row screen, 1, "1.000000P-01 ", "F - test-print-float-normal" + 24 check-screen-row screen, 1, "1.000000P-01 ", "F - test-print-float-normal" 25 } 26 27 fn test-print-float-zero { @@ -92,7 +92,7 @@ if ('onhashchange' in window) { 32 var zero: float 33 print-float screen, zero 34 # - 35 check-screen-row screen, 1, "0 ", "F - test-print-float-zero" + 35 check-screen-row screen, 1, "0 ", "F - test-print-float-zero" 36 } 37 38 fn test-print-float-negative-zero { @@ -105,7 +105,7 @@ if ('onhashchange' in window) { 45 var negative-zero/xmm0: float <- reinterpret n 46 print-float screen, negative-zero 47 # - 48 check-screen-row screen, 1, "-0 ", "F - test-print-float-negative-zero" + 48 check-screen-row screen, 1, "-0 ", "F - test-print-float-negative-zero" 49 } 50 51 fn test-print-float-infinity { @@ -120,7 +120,7 @@ if ('onhashchange' in window) { 60 var infinity/xmm0: float <- reinterpret n 61 print-float screen, infinity 62 # - 63 check-screen-row screen, 1, "Inf ", "F - test-print-float-infinity" + 63 check-screen-row screen, 1, "Inf ", "F - test-print-float-infinity" 64 } 65 66 fn test-print-float-negative-infinity { @@ -133,7 +133,7 @@ if ('onhashchange' in window) { 73 var negative-infinity/xmm0: float <- reinterpret n 74 print-float screen, negative-infinity 75 # - 76 check-screen-row screen, 1, "-Inf ", "F - test-print-float-negative-infinity" + 76 check-screen-row screen, 1, "-Inf ", "F - test-print-float-negative-infinity" 77 } 78 79 fn test-print-float-not-a-number { @@ -146,7 +146,7 @@ if ('onhashchange' in window) { 86 var negative-infinity/xmm0: float <- reinterpret n 87 print-float screen, negative-infinity 88 # - 89 check-screen-row screen, 1, "Nan ", "F - test-print-float-not-a-number" + 89 check-screen-row screen, 1, "Nan ", "F - test-print-float-not-a-number" 90 } 91 92 fn print-float screen: (addr screen), n: float { @@ -208,7 +208,7 @@ if ('onhashchange' in window) { 148 } 149 var mantissa/ebx: int <- copy bits 150 mantissa <- and 0x7fffff -151 print-int32-hex-bits screen, mantissa, 0x18 +151 print-int32-hex-bits screen, mantissa, 0x18 152 # print exponent 153 print-string screen, "P" 154 exponent <- subtract 0x7f @@ -218,7 +218,7 @@ if ('onhashchange' in window) { 158 print-string screen, "-" 159 } 160 var exp-magnitude/eax: int <- abs exponent -161 print-int32-hex-bits screen, exp-magnitude, 8 +161 print-int32-hex-bits screen, exp-magnitude, 8 162 } 163 } 164 diff --git a/html/apps/arith.mu.html b/html/apps/arith.mu.html index 0c98c50a..0868da6e 100644 --- a/html/apps/arith.mu.html +++ b/html/apps/arith.mu.html @@ -105,7 +105,7 @@ if ('onhashchange' in window) { 46 compare look, 0 47 break-if-= 48 # print - 49 print-int32-decimal 0, n + 49 print-int32-decimal 0, n 50 print-string 0, "\n" 51 # 52 loop diff --git a/html/apps/assort.subx.html b/html/apps/assort.subx.html index a7d1385e..8f120666 100644 --- a/html/apps/assort.subx.html +++ b/html/apps/assort.subx.html @@ -172,7 +172,7 @@ if ('onhashchange' in window) { 110 # . . discard args 111 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp 112 $subx-assort:read: - 113 +-- 9 lines: #? # print("read\n") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 113 +-- 9 lines: #? # print("read\n") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 122 # read-segments(in, table) 123 # . . push args 124 51/push-ecx @@ -182,7 +182,7 @@ if ('onhashchange' in window) { 128 # . . discard args 129 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp 130 $subx-assort:write: - 131 +-- 9 lines: #? # print("write\n") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 131 +-- 9 lines: #? # print("write\n") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 140 # write-segments(out, table) 141 # . . push args 142 51/push-ecx @@ -385,7 +385,7 @@ if ('onhashchange' in window) { 339 # 10 11 340 # == data 0x0a000000 341 # 4 5/imm32 - 342 +-- 33 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 342 +-- 33 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 375 # . check-next-stream-line-equal(_test-output-stream, "== code 0x09000000", msg) 376 # . . push args 377 68/push "F - test-subx-assort/0"/imm32 @@ -537,7 +537,7 @@ if ('onhashchange' in window) { 523 # if (line->write == 0) break 524 81 7/subop/compare 0/mod/indirect 1/rm32/ecx . . . . . 0/imm32 # compare *ecx 525 0f 84/jump-if-= $read-segments:break/disp32 - 526 +-- 33 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 526 +-- 33 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 559 # next-word-or-string(line, word-slice) 560 # . . push args 561 52/push-edx @@ -547,7 +547,7 @@ if ('onhashchange' in window) { 565 # . . discard args 566 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp 567 $read-segments:check1: - 568 +-- 9 lines: #? # print("check1\n") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 568 +-- 9 lines: #? # print("check1\n") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 577 # if (slice-empty?(word-slice)) continue 578 # . eax = slice-empty?(word-slice) 579 # . . push args @@ -560,7 +560,7 @@ if ('onhashchange' in window) { 586 3d/compare-eax-and 0/imm32/false 587 0f 85/jump-if-!= $read-segments:loop/disp32 588 $read-segments:check-for-comment: - 589 +-- 9 lines: #? # print("check for comment\n") -------------------------------------------------------------------------------------------------------------------------------------------------------------- + 589 +-- 9 lines: #? # print("check for comment\n") ---------------------------------------------------------------------------------------------------------------------------------------------------------------- 598 # if (slice-starts-with?(word-slice, "#")) continue 599 # . var start/esi: (addr byte) = word-slice->start 600 8b/copy 0/mod/indirect 2/rm32/edx . . . 6/r32/esi . . # copy *ecx to esi @@ -571,8 +571,8 @@ if ('onhashchange' in window) { 605 3d/compare-eax-and 0x23/imm32/hash 606 0f 84/jump-if-= $read-segments:loop/disp32 607 $read-segments:check-for-segment-header: - 608 +-- 9 lines: #? # print("check for segment header\n") ------------------------------------------------------------------------------------------------------------------------------------------------------- - 617 +-- 40 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 608 +-- 9 lines: #? # print("check for segment header\n") --------------------------------------------------------------------------------------------------------------------------------------------------------- + 617 +-- 40 lines: #? # dump word-slice ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 657 # if !slice-equal?(word-slice, "==") goto next check 658 # . eax = slice-equal?(word-slice, "==") 659 # . . push args @@ -593,7 +593,7 @@ if ('onhashchange' in window) { 674 e8/call next-word-or-string/disp32 675 # . . discard args 676 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - 677 +-- 40 lines: #? # dump segment name ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 677 +-- 40 lines: #? # dump segment name --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 717 # var segment-slot/edi: (addr handle stream byte) = get-or-insert-slice(table, segment-name, row-size=16, Heap) 718 # . eax = get-or-insert-slice(table, segment-name, row-size=16, Heap) 719 # . . push args @@ -607,7 +607,7 @@ if ('onhashchange' in window) { 727 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32 # add to esp 728 # . edi = eax 729 89/copy 3/mod/direct 7/rm32/edi . . . 0/r32/eax . . # copy eax to edi - 730 +-- 33 lines: #? # print("slot: " segment-slot "\n") --------------------------------------------------------------------------------------------------------------------------------------------------------- + 730 +-- 33 lines: #? # print("slot: " segment-slot "\n") ----------------------------------------------------------------------------------------------------------------------------------------------------------- 763 # if (*segment-slot != 0) update curr-segment and continue 764 81 7/subop/compare 0/mod/indirect 7/rm32/edi . . . . . 0/imm32 # compare edi 765 0f 84/jump-if-= $read-segments:create-segment/disp32 @@ -648,11 +648,11 @@ if ('onhashchange' in window) { 800 89/copy 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . . # copy eax to ebx 801 # fall through 802 $read-segments:regular-line: - 803 +-- 9 lines: #? # print("regular line\n") ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 812 +-- 33 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 845 +-- 33 lines: #? # print("addr: " curr-segment->write "\n") -------------------------------------------------------------------------------------------------------------------------------------------------- - 878 +-- 33 lines: #? # print("write: " curr-segment->write "\n") ------------------------------------------------------------------------------------------------------------------------------------------------- - 911 +-- 33 lines: #? # print("size: " curr-segment->size "\n") --------------------------------------------------------------------------------------------------------------------------------------------------- + 803 +-- 9 lines: #? # print("regular line\n") --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 812 +-- 33 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 845 +-- 33 lines: #? # print("addr: " curr-segment->write "\n") ---------------------------------------------------------------------------------------------------------------------------------------------------- + 878 +-- 33 lines: #? # print("write: " curr-segment->write "\n") --------------------------------------------------------------------------------------------------------------------------------------------------- + 911 +-- 33 lines: #? # print("size: " curr-segment->size "\n") ----------------------------------------------------------------------------------------------------------------------------------------------------- 944 # rewind-stream(line) 945 # . . push args 946 51/push-ecx @@ -660,7 +660,7 @@ if ('onhashchange' in window) { 948 e8/call rewind-stream/disp32 949 # . . discard args 950 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - 951 +-- 9 lines: #? # print("write stream\n") ------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 951 +-- 9 lines: #? # print("write stream\n") --------------------------------------------------------------------------------------------------------------------------------------------------------------------- 960 # write-stream(curr-segment, line) 961 # . . push args 962 51/push-ecx @@ -670,7 +670,7 @@ if ('onhashchange' in window) { 966 # . . discard args 967 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp 968 # loop - 969 +-- 9 lines: #? # print("loop\n") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 969 +-- 9 lines: #? # print("loop\n") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 978 e9/jump $read-segments:loop/disp32 979 $read-segments:break: 980 $read-segments:end: diff --git a/html/apps/braces.subx.html b/html/apps/braces.subx.html index 720663d1..408c593d 100644 --- a/html/apps/braces.subx.html +++ b/html/apps/braces.subx.html @@ -328,7 +328,7 @@ if ('onhashchange' in window) { 269 (subx-braces _test-input-buffered-file _test-output-buffered-file) 270 # check that the line just passed through 271 (flush _test-output-buffered-file) -272 +-- 5 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ +272 +-- 5 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 277 (check-stream-equal _test-output-stream "== abcd 0x1 \n" "F - test-subx-braces-passes-most-words-through") 278 # . epilogue 279 89/<- %esp 5/r32/ebp @@ -361,7 +361,7 @@ if ('onhashchange' in window) { 306 (subx-braces _test-input-buffered-file _test-output-buffered-file) 307 # check that the line just passed through 308 (flush _test-output-buffered-file) -309 +-- 5 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ +309 +-- 5 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 314 (check-stream-equal _test-output-stream "_loop0x00000001:\nab _break0x00000001/imm32 \ncd _loop0x00000001/imm32 \n_break0x00000001:\n" "F - test-subx-braces-1") 315 # . epilogue 316 89/<- %esp 5/r32/ebp @@ -398,7 +398,7 @@ if ('onhashchange' in window) { 347 (subx-braces _test-input-buffered-file _test-output-buffered-file) 348 # check that the line just passed through 349 (flush _test-output-buffered-file) -350 +-- 5 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ +350 +-- 5 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 355 (check-stream-equal _test-output-stream "_loop0x00000001:\n_loop0x00000002:\nab _break0x00000002/imm32 \n_break0x00000002:\ncd _loop0x00000001/imm32 \n_break0x00000001:\n" "F - test-subx-braces-2") 356 # . epilogue 357 89/<- %esp 5/r32/ebp diff --git a/html/apps/browse/main.mu.html b/html/apps/browse/main.mu.html index 8059945e..3974fe09 100644 --- a/html/apps/browse/main.mu.html +++ b/html/apps/browse/main.mu.html @@ -128,7 +128,7 @@ if ('onhashchange' in window) { 69 # input text 70 var input-storage: (handle buffered-file) 71 var input-ah/eax: (addr handle buffered-file) <- address input-storage - 72 populate-buffered-file-containing "abcdefgh", input-ah + 72 populate-buffered-file-containing "abcdefgh", input-ah 73 var in/eax: (addr buffered-file) <- lookup input-storage 74 # output screen 75 var pg: paginated-screen @@ -138,16 +138,16 @@ if ('onhashchange' in window) { 79 render pg-addr, in 80 var screen-ah/eax: (addr handle screen) <- get pg, screen 81 var screen/eax: (addr screen) <- lookup *screen-ah - 82 check-screen-row screen, 1, " ", "F - test-render-multicolumn-text/row1" - 83 check-screen-row screen, 2, " ab ef", "F - test-render-multicolumn-text/row2" - 84 check-screen-row screen, 3, " cd gh", "F - test-render-multicolumn-text/row3" + 82 check-screen-row screen, 1, " ", "F - test-render-multicolumn-text/row1" + 83 check-screen-row screen, 2, " ab ef", "F - test-render-multicolumn-text/row2" + 84 check-screen-row screen, 3, " cd gh", "F - test-render-multicolumn-text/row3" 85 } 86 87 fn test-render-heading-text { 88 # input text 89 var input-storage: (handle buffered-file) 90 var input-ah/eax: (addr handle buffered-file) <- address input-storage - 91 populate-buffered-file-containing "# abc\n\ndef", input-ah + 91 populate-buffered-file-containing "# abc\n\ndef", input-ah 92 var in/eax: (addr buffered-file) <- lookup input-storage 93 # output screen 94 var pg: paginated-screen @@ -157,17 +157,17 @@ if ('onhashchange' in window) { 98 render pg-addr, in 99 var screen-ah/eax: (addr handle screen) <- get pg, screen 100 var screen/eax: (addr screen) <- lookup *screen-ah -101 check-screen-row screen, 1, " ", "F - test-render-heading-text/row1" -102 check-screen-row-in-color screen, 0xa0, 2, " abc ", "F - test-render-heading-text/heading" -103 check-screen-row screen, 3, " ", "F - test-render-heading-text/row3" -104 check-screen-row screen, 4, " def ", "F - test-render-heading-text/row4" +101 check-screen-row screen, 1, " ", "F - test-render-heading-text/row1" +102 check-screen-row-in-color screen, 0xa0, 2, " abc ", "F - test-render-heading-text/heading" +103 check-screen-row screen, 3, " ", "F - test-render-heading-text/row3" +104 check-screen-row screen, 4, " def ", "F - test-render-heading-text/row4" 105 } 106 107 fn test-render-bold-text { 108 # input text 109 var input-storage: (handle buffered-file) 110 var input-ah/eax: (addr handle buffered-file) <- address input-storage -111 populate-buffered-file-containing "a *b* c", input-ah +111 populate-buffered-file-containing "a *b* c", input-ah 112 var in/eax: (addr buffered-file) <- lookup input-storage 113 # output screen 114 var pg: paginated-screen @@ -177,8 +177,8 @@ if ('onhashchange' in window) { 118 render pg-addr, in 119 var screen-ah/eax: (addr handle screen) <- get pg, screen 120 var screen/eax: (addr screen) <- lookup *screen-ah -121 check-screen-row screen, 2, " a b c", "F - test-render-bold-text/text" -122 check-screen-row-in-bold screen, 2, " b ", "F - test-render-bold-text/bold" +121 check-screen-row screen, 2, " a b c", "F - test-render-bold-text/text" +122 check-screen-row-in-bold screen, 2, " b ", "F - test-render-bold-text/bold" 123 } 124 125 # terminals don't always support italics, so we'll just always render italics @@ -187,7 +187,7 @@ if ('onhashchange' in window) { 128 # input text 129 var input-storage: (handle buffered-file) 130 var input-ah/eax: (addr handle buffered-file) <- address input-storage -131 populate-buffered-file-containing "a _b_ c", input-ah +131 populate-buffered-file-containing "a _b_ c", input-ah 132 var in/eax: (addr buffered-file) <- lookup input-storage 133 # output screen 134 var pg: paginated-screen @@ -197,15 +197,15 @@ if ('onhashchange' in window) { 138 render pg-addr, in 139 var screen-ah/eax: (addr handle screen) <- get pg, screen 140 var screen/eax: (addr screen) <- lookup *screen-ah -141 check-screen-row screen, 2, " a b c", "F - test-render-pseudoitalic-text/text" -142 check-screen-row-in-bold screen, 2, " b ", "F - test-render-pseudoitalic-text/bold" +141 check-screen-row screen, 2, " a b c", "F - test-render-pseudoitalic-text/text" +142 check-screen-row-in-bold screen, 2, " b ", "F - test-render-pseudoitalic-text/bold" 143 } 144 145 fn test-render-asterisk-in-text { 146 # input text 147 var input-storage: (handle buffered-file) 148 var input-ah/eax: (addr handle buffered-file) <- address input-storage -149 populate-buffered-file-containing "a*b*c", input-ah +149 populate-buffered-file-containing "a*b*c", input-ah 150 var in/eax: (addr buffered-file) <- lookup input-storage 151 # output screen 152 var pg: paginated-screen @@ -215,8 +215,8 @@ if ('onhashchange' in window) { 156 render pg-addr, in 157 var screen-ah/eax: (addr handle screen) <- get pg, screen 158 var screen/eax: (addr screen) <- lookup *screen-ah -159 check-screen-row screen, 2, " a*b*c", "F - test-render-bold-text/text" -160 check-screen-row-in-bold screen, 2, " ", "F - test-render-bold-text/bold" +159 check-screen-row screen, 2, " a*b*c", "F - test-render-bold-text/text" +160 check-screen-row-in-bold screen, 2, " ", "F - test-render-bold-text/bold" 161 } 162 163 fn render-normal screen: (addr paginated-screen), fs: (addr buffered-file) { diff --git a/html/apps/browse/paginated-screen.mu.html b/html/apps/browse/paginated-screen.mu.html index 30e961ec..9f282de6 100644 --- a/html/apps/browse/paginated-screen.mu.html +++ b/html/apps/browse/paginated-screen.mu.html @@ -261,7 +261,7 @@ if ('onhashchange' in window) { 200 } 201 var screen-ah/eax: (addr handle screen) <- get pg, screen 202 var screen-addr/eax: (addr screen) <- lookup *screen-ah -203 check-screen-row screen-addr, 1, "a", "F - test-print-grapheme-on-paginated-screen" +203 check-screen-row screen-addr, 1, "a", "F - test-print-grapheme-on-paginated-screen" 204 } 205 206 fn test-print-single-page { @@ -300,8 +300,8 @@ if ('onhashchange' in window) { 239 } 240 var screen-ah/eax: (addr handle screen) <- get pg, screen 241 var screen-addr/eax: (addr screen) <- lookup *screen-ah -242 check-screen-row screen-addr, 1, "ab ", "F - test-print-single-page/row1" -243 check-screen-row screen-addr, 2, "cd ", "F - test-print-single-page/row2" +242 check-screen-row screen-addr, 1, "ab ", "F - test-print-single-page/row1" +243 check-screen-row screen-addr, 2, "cd ", "F - test-print-single-page/row2" 244 # currently it's hard-coded that we avoid printing to the bottom-most row of the screen 245 } 246 @@ -347,8 +347,8 @@ if ('onhashchange' in window) { 286 } 287 var screen-ah/eax: (addr handle screen) <- get pg, screen 288 var screen-addr/eax: (addr screen) <- lookup *screen-ah -289 check-screen-row screen-addr, 1, "abcd", "F - test-print-single-page-narrower-than-page-width/row1" -290 check-screen-row screen-addr, 2, "e ", "F - test-print-single-page-narrower-than-page-width/row2" +289 check-screen-row screen-addr, 1, "abcd", "F - test-print-single-page-narrower-than-page-width/row1" +290 check-screen-row screen-addr, 2, "e ", "F - test-print-single-page-narrower-than-page-width/row2" 291 # currently it's hard-coded that we avoid printing to the bottom-most row of the screen 292 } 293 @@ -394,8 +394,8 @@ if ('onhashchange' in window) { 333 } 334 var screen-ah/eax: (addr handle screen) <- get pg, screen 335 var screen-addr/eax: (addr screen) <- lookup *screen-ah -336 check-screen-row screen-addr, 1, " abc", "F - test-print-single-page-narrower-than-page-width-with-margin/row1" -337 check-screen-row screen-addr, 2, " de ", "F - test-print-single-page-narrower-than-page-width-with-margin/row2" +336 check-screen-row screen-addr, 1, " abc", "F - test-print-single-page-narrower-than-page-width-with-margin/row1" +337 check-screen-row screen-addr, 2, " de ", "F - test-print-single-page-narrower-than-page-width-with-margin/row2" 338 # currently it's hard-coded that we avoid printing to the bottom-most row of the screen 339 } 340 @@ -434,8 +434,8 @@ if ('onhashchange' in window) { 373 } 374 var screen-ah/eax: (addr handle screen) <- get pg, screen 375 var screen-addr/eax: (addr screen) <- lookup *screen-ah -376 check-screen-row screen-addr, 1, "ac", "F - test-print-multiple-pages/row1" -377 check-screen-row screen-addr, 2, "bd", "F - test-print-multiple-pages/row2" +376 check-screen-row screen-addr, 1, "ac", "F - test-print-multiple-pages/row1" +377 check-screen-row screen-addr, 2, "bd", "F - test-print-multiple-pages/row2" 378 # currently it's hard-coded that we avoid printing to the bottom-most row of the screen 379 } 380 @@ -502,8 +502,8 @@ if ('onhashchange' in window) { 441 } 442 var screen-ah/eax: (addr handle screen) <- get pg, screen 443 var screen-addr/eax: (addr screen) <- lookup *screen-ah -444 check-screen-row screen-addr, 1, "abef", "F - test-print-multiple-pages-2/row1" -445 check-screen-row screen-addr, 2, "cdgh", "F - test-print-multiple-pages-2/row2" +444 check-screen-row screen-addr, 1, "abef", "F - test-print-multiple-pages-2/row1" +445 check-screen-row screen-addr, 2, "cdgh", "F - test-print-multiple-pages-2/row2" 446 # currently it's hard-coded that we avoid printing to the bottom-most row of the screen 447 } 448 @@ -570,9 +570,9 @@ if ('onhashchange' in window) { 509 } 510 var screen-ah/eax: (addr handle screen) <- get pg, screen 511 var screen-addr/eax: (addr screen) <- lookup *screen-ah -512 check-screen-row screen-addr, 1, " ", "F - test-print-multiple-pages-with-margins/row1" -513 check-screen-row screen-addr, 2, " ab ef", "F - test-print-multiple-pages-with-margins/row2" -514 check-screen-row screen-addr, 3, " cd gh", "F - test-print-multiple-pages-with-margins/row3" +512 check-screen-row screen-addr, 1, " ", "F - test-print-multiple-pages-with-margins/row1" +513 check-screen-row screen-addr, 2, " ab ef", "F - test-print-multiple-pages-with-margins/row2" +514 check-screen-row screen-addr, 3, " cd gh", "F - test-print-multiple-pages-with-margins/row3" 515 # currently it's hard-coded that we avoid printing to the bottom-most row of the screen 516 } 517 @@ -612,42 +612,42 @@ if ('onhashchange' in window) { 551 var self/esi: (addr paginated-screen) <- copy _self 552 var screen-ah/eax: (addr handle screen) <- get self, screen 553 var screen-addr/eax: (addr screen) <- lookup *screen-ah -554 start-color screen-addr, fg, bg +554 start-color screen-addr, fg, bg 555 } 556 557 fn start-bold-on-paginated-screen _self: (addr paginated-screen) { 558 var self/esi: (addr paginated-screen) <- copy _self 559 var screen-ah/eax: (addr handle screen) <- get self, screen 560 var screen-addr/eax: (addr screen) <- lookup *screen-ah -561 start-bold screen-addr +561 start-bold screen-addr 562 } 563 564 fn start-underline-on-paginated-screen _self: (addr paginated-screen) { 565 var self/esi: (addr paginated-screen) <- copy _self 566 var screen-ah/eax: (addr handle screen) <- get self, screen 567 var screen-addr/eax: (addr screen) <- lookup *screen-ah -568 start-underline screen-addr +568 start-underline screen-addr 569 } 570 571 fn start-reverse-video-on-paginated-screen _self: (addr paginated-screen) { 572 var self/esi: (addr paginated-screen) <- copy _self 573 var screen-ah/eax: (addr handle screen) <- get self, screen 574 var screen-addr/eax: (addr screen) <- lookup *screen-ah -575 start-reverse-video screen-addr +575 start-reverse-video screen-addr 576 } 577 578 fn start-blinking-on-paginated-screen _self: (addr paginated-screen) { 579 var self/esi: (addr paginated-screen) <- copy _self 580 var screen-ah/eax: (addr handle screen) <- get self, screen 581 var screen-addr/eax: (addr screen) <- lookup *screen-ah -582 start-blinking screen-addr +582 start-blinking screen-addr 583 } 584 585 fn reset-formatting-on-paginated-screen _self: (addr paginated-screen) { 586 var self/esi: (addr paginated-screen) <- copy _self 587 var screen-ah/eax: (addr handle screen) <- get self, screen 588 var screen-addr/eax: (addr screen) <- lookup *screen-ah -589 reset-formatting screen-addr +589 reset-formatting screen-addr 590 } 591 592 ## helpers diff --git a/html/apps/calls.subx.html b/html/apps/calls.subx.html index ad403d3a..d7dd19b6 100644 --- a/html/apps/calls.subx.html +++ b/html/apps/calls.subx.html @@ -332,7 +332,7 @@ if ('onhashchange' in window) { 271 # . if (eax != false) break 272 3d/compare-eax-and 0/imm32/false 273 0f 85/jump-if-!= $parse-line:end/disp32 - 274 +-- 40 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 274 +-- 40 lines: #? # dump word-slice ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 314 $parse-line:write-word: 315 # write-int(words, word-slice->start) 316 # . . push args @@ -745,7 +745,7 @@ if ('onhashchange' in window) { 723 e8/call flush/disp32 724 # . . discard args 725 81 0/subop/add %esp 4/imm32 - 726 +-- 33 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 726 +-- 33 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 759 # . check-next-stream-line-equal(_test-output-stream, "# . (foo %eax)", msg) 760 # . . push args 761 68/push "F - test-subx-calls-processes-calls: comment"/imm32 diff --git a/html/apps/dquotes.subx.html b/html/apps/dquotes.subx.html index 117b4a55..2ecfa577 100644 --- a/html/apps/dquotes.subx.html +++ b/html/apps/dquotes.subx.html @@ -610,7 +610,7 @@ if ('onhashchange' in window) { 547 # == data 0x2 548 # 4 5/imm32 549 # We don't care right now what exactly happens to comments. Trailing spaces are also minor details. - 550 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 550 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 576 # . check-next-stream-line-equal(_test-output-stream, "", msg) 577 # . . push args 578 68/push "F - test-subx-dquotes-is-idempotent-by-default/0"/imm32 @@ -787,7 +787,7 @@ if ('onhashchange' in window) { 749 # called. We just want to make sure instructions using string literals 750 # switch to a string variable with the right value. 751 # (Modifying string literals completely off the radar for now.) - 752 +-- 33 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 752 +-- 33 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 785 # . check-next-stream-line-equal(_test-output-stream, "== code 0x1 ", msg) 786 # . . push args 787 68/push "F - test-subx-dquotes-processes-string-literals/0"/imm32 @@ -1101,7 +1101,7 @@ if ('onhashchange' in window) { 1095 e8/call emit-string-literal-data/disp32 1096 # . . discard args 1097 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -1098 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1098 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1124 # . check-stream-equal(_test-output-stream, "3/imm32 61/a 62/b 63/c ", msg) 1125 # . . push args 1126 68/push "F - test-emit-string-literal-data"/imm32 @@ -1140,7 +1140,7 @@ if ('onhashchange' in window) { 1159 e8/call emit-string-literal-data/disp32 1160 # . . discard args 1161 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -1162 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1162 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1188 # . check-stream-equal(_test-output-stream, "0/imm32 ", msg) 1189 # . . push args 1190 68/push "F - test-emit-string-literal-data-empty"/imm32 @@ -1180,7 +1180,7 @@ if ('onhashchange' in window) { 1224 e8/call emit-string-literal-data/disp32 1225 # . . discard args 1226 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -1227 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1227 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1253 # . check-stream-equal(_test-output-stream, "3/imm32 61/a 20 62/b ", msg) # ideally we'd like to say '20/space' but that requires managing names for codepoints 1254 # . . push args 1255 68/push "F - test-emit-string-literal-data-no-metadata-for-non-alphanumerics"/imm32 @@ -1219,7 +1219,7 @@ if ('onhashchange' in window) { 1288 e8/call emit-string-literal-data/disp32 1289 # . . discard args 1290 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -1291 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1291 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1317 # . check-stream-equal(_test-output-stream, "3/imm32 61/a 22 62/b ", msg) 1318 # . . push args 1319 68/push "F - test-emit-string-literal-data-handles-escape-sequences"/imm32 @@ -1258,7 +1258,7 @@ if ('onhashchange' in window) { 1352 e8/call emit-string-literal-data/disp32 1353 # . . discard args 1354 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -1355 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1355 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1381 # . check-stream-equal(_test-output-stream, "3/imm32 61/a 0a 62/b ", msg) 1382 # . . push args 1383 68/push "F - test-emit-string-literal-data-handles-newline-escape"/imm32 @@ -1633,7 +1633,7 @@ if ('onhashchange' in window) { 1752 e8/call flush/disp32 1753 # . . discard args 1754 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -1755 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1755 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1781 # check-stream-equal(_test-output-stream, "/ghi", msg) # important that there's no leading space 1782 # . . push args 1783 68/push "F - test-emit-metadata-in-string-literal"/imm32 diff --git a/html/apps/mu.subx.html b/html/apps/mu.subx.html index 39b92af2..27f7403b 100644 --- a/html/apps/mu.subx.html +++ b/html/apps/mu.subx.html @@ -482,1454 +482,1459 @@ if ('onhashchange' in window) { 420 # only 4-byte graphemes in utf-8 are currently supported; 421 # unclear how we should deal with larger clusters. 422 "float"/imm32 # 15 - 423 # Keep Primitive-type-ids in sync if you add types here. - 424 # 0x40 - 425 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 - 426 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 - 427 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 - 428 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 + 423 # 0x40 + 424 0/imm32 # 16 reserved for literal strings; value is just the name + 425 # Not to be used directly, so we don't include a name here. + 426 # TODO: move this up next to literal ints + 427 # Keep Primitive-type-ids in sync if you add types here. + 428 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 429 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 430 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 - 431 - 432 Primitive-type-ids: # (addr int) - 433 0x40 + 431 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 + 432 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 + 433 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 0/imm32 434 - 435 # == Type definitions - 436 # Program->types contains some typeinfo for each type definition. - 437 # Types contain vars with types, but can't specify registers. - 438 Typeinfo-id: # type-id - 439 0/imm32 - 440 Typeinfo-fields: # (handle table (handle array byte) (handle typeinfo-entry)) - 441 4/imm32 - 442 # Total size must be >= 0 - 443 # During parsing it may take on two additional values: - 444 # -2: not yet initialized - 445 # -1: in process of being computed - 446 # See populate-mu-type-sizes for details. - 447 Typeinfo-total-size-in-bytes: # int - 448 0xc/imm32 - 449 Typeinfo-next: # (handle typeinfo) - 450 0x10/imm32 - 451 Typeinfo-size: # (addr int) - 452 0x18/imm32 - 453 - 454 # Each entry in the typeinfo->fields table has a pointer to a string and a - 455 # pointer to a typeinfo-entry. - 456 Typeinfo-fields-row-size: # (addr int) - 457 0x10/imm32 - 458 - 459 # typeinfo-entry objects have information about a field in a single record type - 460 # - 461 # each field of a type is represented using two var's: - 462 # 1. the input var: expected type of the field; convenient for creating using parse-var-with-type - 463 # 2. the output var: a constant containing the byte offset; convenient for code-generation - 464 # computing the output happens after parsing; in the meantime we preserve the - 465 # order of fields in the 'index' field. - 466 Typeinfo-entry-input-var: # (handle var) - 467 0/imm32 - 468 Typeinfo-entry-index: # int - 469 8/imm32 - 470 Typeinfo-entry-output-var: # (handle var) - 471 0xc/imm32 - 472 Typeinfo-entry-size: # (addr int) - 473 0x14/imm32 - 474 - 475 == code - 476 - 477 Entry: - 478 # . prologue - 479 89/<- %ebp 4/r32/esp - 480 (new-segment *Heap-size Heap) - 481 # if (argv[1] == "test') run-tests() - 482 { - 483 # if (argc <= 1) break - 484 81 7/subop/compare *ebp 1/imm32 - 485 7e/jump-if-<= break/disp8 - 486 # if (argv[1] != "test") break - 487 (kernel-string-equal? *(ebp+8) "test") # => eax - 488 3d/compare-eax-and 0/imm32/false - 489 74/jump-if-= break/disp8 - 490 # - 491 (run-tests) - 492 # syscall(exit, *Num-test-failures) - 493 8b/-> *Num-test-failures 3/r32/ebx - 494 eb/jump $mu-main:end/disp8 - 495 } - 496 # otherwise convert Stdin - 497 (convert-mu Stdin Stdout Stderr 0) - 498 (flush Stdout) - 499 # syscall(exit, 0) - 500 bb/copy-to-ebx 0/imm32 - 501 $mu-main:end: - 502 e8/call syscall_exit/disp32 - 503 - 504 convert-mu: # in: (addr buffered-file), out: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) - 505 # . prologue - 506 55/push-ebp - 507 89/<- %ebp 4/r32/esp - 508 # . save registers - 509 50/push-eax - 510 # initialize global data structures - 511 c7 0/subop/copy *Next-block-index 1/imm32 - 512 8b/-> *Primitive-type-ids 0/r32/eax - 513 89/<- *Type-id 0/r32/eax # stream-write - 514 c7 0/subop/copy *_Program-functions 0/imm32 - 515 c7 0/subop/copy *_Program-functions->payload 0/imm32 - 516 c7 0/subop/copy *_Program-types 0/imm32 - 517 c7 0/subop/copy *_Program-types->payload 0/imm32 - 518 c7 0/subop/copy *_Program-signatures 0/imm32 - 519 c7 0/subop/copy *_Program-signatures->payload 0/imm32 - 520 # - 521 (parse-mu *(ebp+8) *(ebp+0x10) *(ebp+0x14)) - 522 (populate-mu-type-sizes *(ebp+0x10) *(ebp+0x14)) - 523 #? (dump-typeinfos "=== typeinfos\n") - 524 (check-mu-types *(ebp+0x10) *(ebp+0x14)) - 525 (emit-subx *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) - 526 $convert-mu:end: - 527 # . restore registers - 528 58/pop-to-eax - 529 # . epilogue - 530 89/<- %esp 5/r32/ebp - 531 5d/pop-to-ebp - 532 c3/return - 533 - 534 test-convert-empty-input: - 535 # empty input => empty output - 536 # . prologue - 537 55/push-ebp - 538 89/<- %ebp 4/r32/esp - 539 # setup - 540 (clear-stream _test-input-stream) - 541 (clear-stream $_test-input-buffered-file->buffer) - 542 (clear-stream _test-output-stream) - 543 (clear-stream $_test-output-buffered-file->buffer) - 544 # - 545 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 546 (flush _test-output-buffered-file) - 547 (check-stream-equal _test-output-stream "" "F - test-convert-empty-input") - 548 # . epilogue - 549 89/<- %esp 5/r32/ebp - 550 5d/pop-to-ebp - 551 c3/return - 552 - 553 test-convert-function-skeleton: - 554 # . prologue - 555 55/push-ebp - 556 89/<- %ebp 4/r32/esp - 557 # setup - 558 (clear-stream _test-input-stream) - 559 (clear-stream $_test-input-buffered-file->buffer) - 560 (clear-stream _test-output-stream) - 561 (clear-stream $_test-output-buffered-file->buffer) - 562 # - 563 (write _test-input-stream "fn foo {\n") - 564 (write _test-input-stream "}\n") - 565 # convert - 566 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 567 (flush _test-output-buffered-file) - 568 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 574 # check output - 575 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-skeleton/0") - 576 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-skeleton/1") - 577 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-skeleton/2") - 578 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-skeleton/3") - 579 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-skeleton/4") - 580 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-skeleton/5") - 581 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-skeleton/6") - 582 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-skeleton/7") - 583 # . epilogue - 584 89/<- %esp 5/r32/ebp - 585 5d/pop-to-ebp - 586 c3/return - 587 - 588 test-convert-multiple-function-skeletons: - 589 # . prologue - 590 55/push-ebp - 591 89/<- %ebp 4/r32/esp - 592 # setup - 593 (clear-stream _test-input-stream) - 594 (clear-stream $_test-input-buffered-file->buffer) - 595 (clear-stream _test-output-stream) - 596 (clear-stream $_test-output-buffered-file->buffer) - 597 # - 598 (write _test-input-stream "fn foo {\n") - 599 (write _test-input-stream "}\n") - 600 (write _test-input-stream "fn bar {\n") - 601 (write _test-input-stream "}\n") - 602 # convert - 603 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 604 (flush _test-output-buffered-file) - 605 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 611 # check first function - 612 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-multiple-function-skeletons/0") - 613 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/1") - 614 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/2") - 615 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/3") - 616 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/4") - 617 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/5") - 618 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/6") - 619 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/7") - 620 # check second function - 621 (check-next-stream-line-equal _test-output-stream "bar:" "F - test-convert-multiple-function-skeletons/10") - 622 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/11") - 623 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/12") - 624 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/13") - 625 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/14") - 626 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/15") - 627 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/16") - 628 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/17") - 629 # . epilogue - 630 89/<- %esp 5/r32/ebp - 631 5d/pop-to-ebp - 632 c3/return - 633 - 634 test-convert-function-with-arg: - 635 # . prologue - 636 55/push-ebp - 637 89/<- %ebp 4/r32/esp - 638 # setup - 639 (clear-stream _test-input-stream) - 640 (clear-stream $_test-input-buffered-file->buffer) - 641 (clear-stream _test-output-stream) - 642 (clear-stream $_test-output-buffered-file->buffer) - 643 # - 644 (write _test-input-stream "fn foo n: int {\n") - 645 (write _test-input-stream "}\n") - 646 # convert - 647 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 648 (flush _test-output-buffered-file) - 649 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 655 # check output - 656 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg/0") - 657 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg/1") - 658 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg/2") - 659 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg/3") - 660 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg/4") - 661 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg/5") - 662 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg/6") - 663 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg/7") - 664 # . epilogue - 665 89/<- %esp 5/r32/ebp - 666 5d/pop-to-ebp - 667 c3/return - 668 - 669 test-function-with-inout-in-register: - 670 # . prologue - 671 55/push-ebp - 672 89/<- %ebp 4/r32/esp - 673 # setup - 674 (clear-stream _test-input-stream) - 675 (clear-stream $_test-input-buffered-file->buffer) - 676 (clear-stream _test-output-stream) - 677 (clear-stream $_test-output-buffered-file->buffer) - 678 (clear-stream _test-error-stream) - 679 (clear-stream $_test-error-buffered-file->buffer) - 680 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 681 68/push 0/imm32 - 682 68/push 0/imm32 - 683 89/<- %edx 4/r32/esp - 684 (tailor-exit-descriptor %edx 0x10) - 685 # - 686 (write _test-input-stream "fn foo x/eax: int {\n") - 687 (write _test-input-stream "}\n") - 688 # convert - 689 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 690 # registers except esp clobbered at this point - 691 # restore ed - 692 89/<- %edx 4/r32/esp - 693 (flush _test-output-buffered-file) - 694 (flush _test-error-buffered-file) - 695 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 701 # check output - 702 (check-stream-equal _test-output-stream "" "F - test-function-with-inout-in-register: output should be empty") - 703 (check-next-stream-line-equal _test-error-stream "fn foo: function inout 'x' cannot be in a register" "F - test-function-with-inout-in-register: error message") - 704 # check that stop(1) was called - 705 (check-ints-equal *(edx+4) 2 "F - test-function-with-inout-in-register: exit status") - 706 # don't restore from ebp - 707 81 0/subop/add %esp 8/imm32 - 708 # . epilogue - 709 5d/pop-to-ebp - 710 c3/return - 711 - 712 test-convert-function-with-arg-and-body: - 713 # . prologue - 714 55/push-ebp - 715 89/<- %ebp 4/r32/esp - 716 # setup - 717 (clear-stream _test-input-stream) - 718 (clear-stream $_test-input-buffered-file->buffer) - 719 (clear-stream _test-output-stream) - 720 (clear-stream $_test-output-buffered-file->buffer) - 721 # - 722 (write _test-input-stream "fn foo n: int {\n") - 723 (write _test-input-stream " increment n\n") - 724 (write _test-input-stream "}\n") - 725 # convert - 726 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 727 (flush _test-output-buffered-file) - 728 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 734 # check output - 735 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg-and-body/0") - 736 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg-and-body/1") - 737 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg-and-body/2") - 738 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg-and-body/3") - 739 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-arg-and-body/4") - 740 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-arg-and-body/5") - 741 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-arg-and-body/6") - 742 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-arg-and-body/7") - 743 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-arg-and-body/8") - 744 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg-and-body/9") - 745 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg-and-body/10") - 746 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg-and-body/11") - 747 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg-and-body/12") - 748 # . epilogue - 749 89/<- %esp 5/r32/ebp - 750 5d/pop-to-ebp - 751 c3/return - 752 - 753 test-convert-function-distinguishes-args: - 754 # . prologue - 755 55/push-ebp - 756 89/<- %ebp 4/r32/esp - 757 # setup - 758 (clear-stream _test-input-stream) - 759 (clear-stream $_test-input-buffered-file->buffer) - 760 (clear-stream _test-output-stream) - 761 (clear-stream $_test-output-buffered-file->buffer) - 762 # - 763 (write _test-input-stream "fn foo a: int, b: int {\n") - 764 (write _test-input-stream " increment b\n") - 765 (write _test-input-stream "}\n") - 766 # convert - 767 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 768 (flush _test-output-buffered-file) - 769 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 775 # check output - 776 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-distinguishes-args/0") - 777 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-distinguishes-args/1") - 778 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-distinguishes-args/2") - 779 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-distinguishes-args/3") - 780 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-distinguishes-args/4") - 781 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-distinguishes-args/5") - 782 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x0000000c)" "F - test-convert-function-distinguishes-args/6") - 783 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-distinguishes-args/7") - 784 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-distinguishes-args/8") - 785 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-distinguishes-args/9") - 786 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-distinguishes-args/10") - 787 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-distinguishes-args/11") - 788 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-distinguishes-args/12") - 789 # . epilogue - 790 89/<- %esp 5/r32/ebp - 791 5d/pop-to-ebp - 792 c3/return - 793 - 794 test-convert-function-with-return-literal: - 795 # . prologue - 796 55/push-ebp - 797 89/<- %ebp 4/r32/esp - 798 # setup - 799 (clear-stream _test-input-stream) - 800 (clear-stream $_test-input-buffered-file->buffer) - 801 (clear-stream _test-output-stream) - 802 (clear-stream $_test-output-buffered-file->buffer) - 803 # - 804 (write _test-input-stream "fn foo -> _/eax: int {\n") - 805 (write _test-input-stream " return 0\n") - 806 (write _test-input-stream "}\n") - 807 # convert - 808 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 809 (flush _test-output-buffered-file) - 810 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 816 # check output - 817 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-literal/0") - 818 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-literal/1") - 819 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-literal/2") - 820 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-literal/3") - 821 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-literal/4") - 822 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-literal/5") - 823 (check-next-stream-line-equal _test-output-stream " c7 0/subop/copy %eax 0/imm32" "F - test-convert-function-with-return-literal/6") - 824 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-literal/7") - 825 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-literal/8") - 826 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-literal/9") - 827 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-literal/10") - 828 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-literal/11") - 829 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-literal/12") - 830 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-literal/13") - 831 # . epilogue - 832 89/<- %esp 5/r32/ebp - 833 5d/pop-to-ebp - 834 c3/return - 835 - 836 test-convert-function-with-return: - 837 # . prologue - 838 55/push-ebp - 839 89/<- %ebp 4/r32/esp - 840 # setup - 841 (clear-stream _test-input-stream) - 842 (clear-stream $_test-input-buffered-file->buffer) - 843 (clear-stream _test-output-stream) - 844 (clear-stream $_test-output-buffered-file->buffer) - 845 # - 846 (write _test-input-stream "fn foo -> _/eax: int {\n") - 847 (write _test-input-stream " var y: int\n") - 848 (write _test-input-stream " return y\n") - 849 (write _test-input-stream "}\n") - 850 # convert - 851 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 852 (flush _test-output-buffered-file) - 853 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 859 # check output - 860 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return/0") - 861 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return/1") - 862 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return/2") - 863 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return/3") - 864 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return/4") - 865 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return/5") - 866 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-return/6") # y - 867 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0xfffffffc) 0x00000000/r32" "F - test-convert-function-with-return/7") - 868 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-return/8") - 869 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return/9") - 870 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return/10") - 871 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return/11") - 872 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return/12") - 873 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return/13") - 874 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return/14") - 875 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return/15") - 876 # . epilogue - 877 89/<- %esp 5/r32/ebp - 878 5d/pop-to-ebp - 879 c3/return - 880 - 881 test-convert-function-with-return-register: - 882 # . prologue - 883 55/push-ebp - 884 89/<- %ebp 4/r32/esp - 885 # setup - 886 (clear-stream _test-input-stream) - 887 (clear-stream $_test-input-buffered-file->buffer) - 888 (clear-stream _test-output-stream) - 889 (clear-stream $_test-output-buffered-file->buffer) - 890 # - 891 (write _test-input-stream "fn foo -> _/eax: int {\n") - 892 (write _test-input-stream " var y/eax: int <- copy 3\n") - 893 (write _test-input-stream " return y\n") - 894 (write _test-input-stream "}\n") - 895 # convert - 896 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 897 (flush _test-output-buffered-file) - 898 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 904 # check output - 905 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-register/0") - 906 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-register/1") - 907 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-register/2") - 908 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-register/3") - 909 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-register/4") - 910 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-register/5") - 911 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-return-register/6") - 912 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-convert-function-with-return-register/7") - 913 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-with-return-register/8") - 914 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-return-register/9") - 915 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-register/10") - 916 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-register/11") - 917 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-register/12") - 918 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-register/13") - 919 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-register/14") - 920 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-register/15") - 921 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-register/16") - 922 # . epilogue - 923 89/<- %esp 5/r32/ebp - 924 5d/pop-to-ebp - 925 c3/return - 926 - 927 test-function-with-output-without-register: - 928 # . prologue - 929 55/push-ebp - 930 89/<- %ebp 4/r32/esp - 931 # setup - 932 (clear-stream _test-input-stream) - 933 (clear-stream $_test-input-buffered-file->buffer) - 934 (clear-stream _test-output-stream) - 935 (clear-stream $_test-output-buffered-file->buffer) - 936 (clear-stream _test-error-stream) - 937 (clear-stream $_test-error-buffered-file->buffer) - 938 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 939 68/push 0/imm32 - 940 68/push 0/imm32 - 941 89/<- %edx 4/r32/esp - 942 (tailor-exit-descriptor %edx 0x10) - 943 # - 944 (write _test-input-stream "fn foo -> _: int {\n") - 945 (write _test-input-stream "}\n") - 946 # convert - 947 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 948 # registers except esp clobbered at this point - 949 # restore ed - 950 89/<- %edx 4/r32/esp - 951 (flush _test-output-buffered-file) - 952 (flush _test-error-buffered-file) - 953 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 959 # check output - 960 (check-stream-equal _test-output-stream "" "F - test-function-with-output-without-register: output should be empty") - 961 (check-next-stream-line-equal _test-error-stream "fn foo: function output '_' must be in a register, in instruction 'fn foo -> _: int {" "F - test-function-with-output-without-register: error message") - 962 # check that stop(1) was called - 963 (check-ints-equal *(edx+4) 2 "F - test-function-with-output-without-register: exit status") - 964 # don't restore from ebp - 965 81 0/subop/add %esp 8/imm32 - 966 # . epilogue - 967 5d/pop-to-ebp - 968 c3/return - 969 - 970 test-function-with-outputs-in-conflicting-registers: - 971 # . prologue - 972 55/push-ebp - 973 89/<- %ebp 4/r32/esp - 974 # setup - 975 (clear-stream _test-input-stream) - 976 (clear-stream $_test-input-buffered-file->buffer) - 977 (clear-stream _test-output-stream) - 978 (clear-stream $_test-output-buffered-file->buffer) - 979 (clear-stream _test-error-stream) - 980 (clear-stream $_test-error-buffered-file->buffer) - 981 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 982 68/push 0/imm32 - 983 68/push 0/imm32 - 984 89/<- %edx 4/r32/esp - 985 (tailor-exit-descriptor %edx 0x10) - 986 # - 987 (write _test-input-stream "fn foo -> _/eax: int, _/eax: int {\n") - 988 (write _test-input-stream "}\n") - 989 # convert - 990 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 991 # registers except esp clobbered at this point - 992 # restore ed - 993 89/<- %edx 4/r32/esp - 994 (flush _test-output-buffered-file) - 995 (flush _test-error-buffered-file) - 996 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1002 # check output - 1003 (check-stream-equal _test-output-stream "" "F - test-function-with-outputs-in-conflicting-registers: output should be empty") - 1004 (check-next-stream-line-equal _test-error-stream "fn foo: outputs must be in unique registers" "F - test-function-with-outputs-in-conflicting-registers: error message") - 1005 # check that stop(1) was called - 1006 (check-ints-equal *(edx+4) 2 "F - test-function-with-outputs-in-conflicting-registers: exit status") - 1007 # don't restore from ebp - 1008 81 0/subop/add %esp 8/imm32 - 1009 # . epilogue - 1010 5d/pop-to-ebp - 1011 c3/return - 1012 - 1013 test-function-with-named-output: - 1014 # . prologue - 1015 55/push-ebp - 1016 89/<- %ebp 4/r32/esp - 1017 # setup - 1018 (clear-stream _test-input-stream) - 1019 (clear-stream $_test-input-buffered-file->buffer) - 1020 (clear-stream _test-output-stream) - 1021 (clear-stream $_test-output-buffered-file->buffer) - 1022 (clear-stream _test-error-stream) - 1023 (clear-stream $_test-error-buffered-file->buffer) - 1024 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1025 68/push 0/imm32 - 1026 68/push 0/imm32 - 1027 89/<- %edx 4/r32/esp - 1028 (tailor-exit-descriptor %edx 0x10) - 1029 # - 1030 (write _test-input-stream "fn foo -> x/eax: int {\n") - 1031 (write _test-input-stream " return 0\n") - 1032 (write _test-input-stream "}\n") - 1033 # convert - 1034 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1035 # registers except esp clobbered at this point - 1036 # restore ed - 1037 89/<- %edx 4/r32/esp - 1038 (flush _test-output-buffered-file) - 1039 (flush _test-error-buffered-file) - 1040 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1046 # check output - 1047 (check-stream-equal _test-output-stream "" "F - test-function-with-named-output: output should be empty") - 1048 (check-next-stream-line-equal _test-error-stream "fn foo: function outputs cannot be named; rename 'x' in the header to '_'" "F - test-function-with-named-output: error message") - 1049 # check that stop(1) was called - 1050 (check-ints-equal *(edx+4) 2 "F - test-function-with-named-output: exit status") - 1051 # don't restore from ebp - 1052 81 0/subop/add %esp 8/imm32 - 1053 # . epilogue - 1054 5d/pop-to-ebp - 1055 c3/return - 1056 - 1057 test-return-with-wrong-type: - 1058 # . prologue - 1059 55/push-ebp - 1060 89/<- %ebp 4/r32/esp - 1061 # setup - 1062 (clear-stream _test-input-stream) - 1063 (clear-stream $_test-input-buffered-file->buffer) - 1064 (clear-stream _test-output-stream) - 1065 (clear-stream $_test-output-buffered-file->buffer) - 1066 (clear-stream _test-error-stream) - 1067 (clear-stream $_test-error-buffered-file->buffer) - 1068 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1069 68/push 0/imm32 - 1070 68/push 0/imm32 - 1071 89/<- %edx 4/r32/esp - 1072 (tailor-exit-descriptor %edx 0x10) - 1073 # - 1074 (write _test-input-stream "fn foo -> _/eax: int {\n") - 1075 (write _test-input-stream " var x/eax: boolean <- copy 0\n") - 1076 (write _test-input-stream " return x\n") - 1077 (write _test-input-stream "}\n") - 1078 # convert - 1079 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1080 # registers except esp clobbered at this point - 1081 # restore ed - 1082 89/<- %edx 4/r32/esp - 1083 (flush _test-output-buffered-file) - 1084 (flush _test-error-buffered-file) - 1085 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1091 # check output - 1092 (check-stream-equal _test-output-stream "" "F - test-return-with-wrong-type: output should be empty") - 1093 (check-next-stream-line-equal _test-error-stream "fn foo: return: 'x' has the wrong type" "F - test-return-with-wrong-type: error message") - 1094 # check that stop(1) was called - 1095 (check-ints-equal *(edx+4) 2 "F - test-return-with-wrong-type: exit status") - 1096 # don't restore from ebp - 1097 81 0/subop/add %esp 8/imm32 - 1098 # . epilogue - 1099 5d/pop-to-ebp - 1100 c3/return - 1101 - 1102 test-missing-return: - 1103 # . prologue - 1104 55/push-ebp - 1105 89/<- %ebp 4/r32/esp - 1106 # setup - 1107 (clear-stream _test-input-stream) - 1108 (clear-stream $_test-input-buffered-file->buffer) - 1109 (clear-stream _test-output-stream) - 1110 (clear-stream $_test-output-buffered-file->buffer) - 1111 (clear-stream _test-error-stream) - 1112 (clear-stream $_test-error-buffered-file->buffer) - 1113 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1114 68/push 0/imm32 - 1115 68/push 0/imm32 - 1116 89/<- %edx 4/r32/esp - 1117 (tailor-exit-descriptor %edx 0x10) - 1118 # - 1119 (write _test-input-stream "fn foo -> _/eax: int {\n") - 1120 (write _test-input-stream " var x/eax: boolean <- copy 0\n") - 1121 (write _test-input-stream "}\n") - 1122 # convert - 1123 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1124 # registers except esp clobbered at this point - 1125 # restore ed - 1126 89/<- %edx 4/r32/esp - 1127 (flush _test-output-buffered-file) - 1128 (flush _test-error-buffered-file) - 1129 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1135 # check output - 1136 (check-stream-equal _test-output-stream "" "F - test-missing-return: output should be empty") - 1137 (check-next-stream-line-equal _test-error-stream "fn foo: final statement should be a 'return'" "F - test-missing-return: error message") - 1138 # check that stop(1) was called - 1139 (check-ints-equal *(edx+4) 2 "F - test-missing-return: exit status") - 1140 # don't restore from ebp - 1141 81 0/subop/add %esp 8/imm32 - 1142 # . epilogue - 1143 5d/pop-to-ebp - 1144 c3/return - 1145 - 1146 test-early-exit-without-return: - 1147 # . prologue - 1148 55/push-ebp - 1149 89/<- %ebp 4/r32/esp - 1150 # setup - 1151 (clear-stream _test-input-stream) - 1152 (clear-stream $_test-input-buffered-file->buffer) - 1153 (clear-stream _test-output-stream) - 1154 (clear-stream $_test-output-buffered-file->buffer) - 1155 (clear-stream _test-error-stream) - 1156 (clear-stream $_test-error-buffered-file->buffer) - 1157 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1158 68/push 0/imm32 - 1159 68/push 0/imm32 - 1160 89/<- %edx 4/r32/esp - 1161 (tailor-exit-descriptor %edx 0x10) - 1162 # - 1163 (write _test-input-stream "fn foo -> _/eax: int {\n") - 1164 (write _test-input-stream " break\n") - 1165 (write _test-input-stream " return 0\n") - 1166 (write _test-input-stream "}\n") - 1167 # convert - 1168 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1169 # registers except esp clobbered at this point - 1170 # restore ed - 1171 89/<- %edx 4/r32/esp - 1172 (flush _test-output-buffered-file) - 1173 (flush _test-error-buffered-file) - 1174 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1180 # check output - 1181 (check-stream-equal _test-output-stream "" "F - test-early-exit-without-return: output should be empty") - 1182 (check-next-stream-line-equal _test-error-stream "fn foo has outputs, so you cannot 'break' out of the outermost block. Use 'return'." "F - test-early-exit-without-return: error message") - 1183 # check that stop(1) was called - 1184 (check-ints-equal *(edx+4) 2 "F - test-early-exit-without-return: exit status") - 1185 # don't restore from ebp - 1186 81 0/subop/add %esp 8/imm32 - 1187 # . epilogue - 1188 5d/pop-to-ebp - 1189 c3/return - 1190 - 1191 test-return-with-too-few-inouts: - 1192 # . prologue - 1193 55/push-ebp - 1194 89/<- %ebp 4/r32/esp - 1195 # setup - 1196 (clear-stream _test-input-stream) - 1197 (clear-stream $_test-input-buffered-file->buffer) - 1198 (clear-stream _test-output-stream) - 1199 (clear-stream $_test-output-buffered-file->buffer) - 1200 (clear-stream _test-error-stream) - 1201 (clear-stream $_test-error-buffered-file->buffer) - 1202 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1203 68/push 0/imm32 - 1204 68/push 0/imm32 - 1205 89/<- %edx 4/r32/esp - 1206 (tailor-exit-descriptor %edx 0x10) - 1207 # - 1208 (write _test-input-stream "fn foo -> _/eax: int {\n") - 1209 (write _test-input-stream " return\n") - 1210 (write _test-input-stream "}\n") - 1211 # convert - 1212 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1213 # registers except esp clobbered at this point - 1214 # restore ed - 1215 89/<- %edx 4/r32/esp - 1216 (flush _test-output-buffered-file) - 1217 (flush _test-error-buffered-file) - 1218 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1224 # check output - 1225 (check-stream-equal _test-output-stream "" "F - test-return-with-too-few-inouts: output should be empty") - 1226 (check-next-stream-line-equal _test-error-stream "fn foo: return: too few inouts" "F - test-return-with-too-few-inouts: error message") - 1227 # check that stop(1) was called - 1228 (check-ints-equal *(edx+4) 2 "F - test-return-with-too-few-inouts: exit status") - 1229 # don't restore from ebp - 1230 81 0/subop/add %esp 8/imm32 - 1231 # . epilogue - 1232 5d/pop-to-ebp - 1233 c3/return - 1234 - 1235 test-return-with-too-many-inouts: - 1236 # . prologue - 1237 55/push-ebp - 1238 89/<- %ebp 4/r32/esp - 1239 # setup - 1240 (clear-stream _test-input-stream) - 1241 (clear-stream $_test-input-buffered-file->buffer) - 1242 (clear-stream _test-output-stream) - 1243 (clear-stream $_test-output-buffered-file->buffer) - 1244 (clear-stream _test-error-stream) - 1245 (clear-stream $_test-error-buffered-file->buffer) - 1246 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1247 68/push 0/imm32 - 1248 68/push 0/imm32 - 1249 89/<- %edx 4/r32/esp - 1250 (tailor-exit-descriptor %edx 0x10) - 1251 # - 1252 (write _test-input-stream "fn foo -> _/eax: int {\n") - 1253 (write _test-input-stream " return 0, 0\n") - 1254 (write _test-input-stream "}\n") - 1255 # convert - 1256 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1257 # registers except esp clobbered at this point - 1258 # restore ed - 1259 89/<- %edx 4/r32/esp - 1260 (flush _test-output-buffered-file) - 1261 (flush _test-error-buffered-file) - 1262 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1268 # check output - 1269 (check-stream-equal _test-output-stream "" "F - test-return-with-too-many-inouts: output should be empty") - 1270 (check-next-stream-line-equal _test-error-stream "fn foo: return: too many inouts" "F - test-return-with-too-many-inouts: error message") - 1271 # check that stop(1) was called - 1272 (check-ints-equal *(edx+4) 2 "F - test-return-with-too-many-inouts: exit status") - 1273 # don't restore from ebp - 1274 81 0/subop/add %esp 8/imm32 - 1275 # . epilogue - 1276 5d/pop-to-ebp - 1277 c3/return - 1278 - 1279 test-return-unavailable-value: - 1280 # . prologue - 1281 55/push-ebp - 1282 89/<- %ebp 4/r32/esp - 1283 # setup - 1284 (clear-stream _test-input-stream) - 1285 (clear-stream $_test-input-buffered-file->buffer) - 1286 (clear-stream _test-output-stream) - 1287 (clear-stream $_test-output-buffered-file->buffer) - 1288 (clear-stream _test-error-stream) - 1289 (clear-stream $_test-error-buffered-file->buffer) - 1290 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1291 68/push 0/imm32 - 1292 68/push 0/imm32 - 1293 89/<- %edx 4/r32/esp - 1294 (tailor-exit-descriptor %edx 0x10) - 1295 # - 1296 (write _test-input-stream "fn foo -> _/eax: int, _/ecx: int {\n") - 1297 (write _test-input-stream " var x/eax: int <- copy 0\n") - 1298 (write _test-input-stream " var y/ecx: int <- copy 0\n") - 1299 (write _test-input-stream " return y, x\n") - 1300 (write _test-input-stream "}\n") - 1301 # convert - 1302 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1303 # registers except esp clobbered at this point - 1304 # restore ed - 1305 89/<- %edx 4/r32/esp - 1306 (flush _test-output-buffered-file) - 1307 (flush _test-error-buffered-file) - 1308 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1314 # check output - 1315 (check-stream-equal _test-output-stream "" "F - test-return-unavailable-value: output should be empty") - 1316 (check-next-stream-line-equal _test-error-stream "fn foo: return: 'x' is no longer available" "F - test-return-unavailable-value: error message") - 1317 # check that stop(1) was called - 1318 (check-ints-equal *(edx+4) 2 "F - test-return-unavailable-value: exit status") - 1319 # don't restore from ebp - 1320 81 0/subop/add %esp 8/imm32 - 1321 # . epilogue - 1322 5d/pop-to-ebp - 1323 c3/return - 1324 - 1325 test-convert-return-with-duplicate-values: - 1326 # . prologue - 1327 55/push-ebp - 1328 89/<- %ebp 4/r32/esp - 1329 # setup - 1330 (clear-stream _test-input-stream) - 1331 (clear-stream $_test-input-buffered-file->buffer) - 1332 (clear-stream _test-output-stream) - 1333 (clear-stream $_test-output-buffered-file->buffer) - 1334 # - 1335 (write _test-input-stream "fn foo -> _/eax: int, _/ecx: int {\n") - 1336 (write _test-input-stream " var x/eax: int <- copy 0x34\n") - 1337 (write _test-input-stream " return x, x\n") - 1338 (write _test-input-stream "}\n") - 1339 # convert - 1340 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1341 (flush _test-output-buffered-file) - 1342 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 1348 # check output - 1349 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-return-with-duplicate-values/0") - 1350 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-return-with-duplicate-values/1") - 1351 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-return-with-duplicate-values/2") - 1352 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-return-with-duplicate-values/3") - 1353 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-return-with-duplicate-values/4") - 1354 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-return-with-duplicate-values/5") - 1355 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-return-with-duplicate-values/6") - 1356 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0x34/imm32" "F - test-convert-return-with-duplicate-values/7") - 1357 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-return-with-duplicate-values/8") - 1358 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000001/r32" "F - test-convert-return-with-duplicate-values/9") - 1359 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-return-with-duplicate-values/10") - 1360 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-return-with-duplicate-values/11") - 1361 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-return-with-duplicate-values/12") - 1362 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-return-with-duplicate-values/13") - 1363 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-return-with-duplicate-values/14") - 1364 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-return-with-duplicate-values/15") - 1365 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-return-with-duplicate-values/16") - 1366 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-return-with-duplicate-values/17") + 435 Primitive-type-ids: # (addr int) + 436 0x44 + 437 + 438 # == Type definitions + 439 # Program->types contains some typeinfo for each type definition. + 440 # Types contain vars with types, but can't specify registers. + 441 Typeinfo-id: # type-id + 442 0/imm32 + 443 Typeinfo-fields: # (handle table (handle array byte) (handle typeinfo-entry)) + 444 4/imm32 + 445 # Total size must be >= 0 + 446 # During parsing it may take on two additional values: + 447 # -2: not yet initialized + 448 # -1: in process of being computed + 449 # See populate-mu-type-sizes for details. + 450 Typeinfo-total-size-in-bytes: # int + 451 0xc/imm32 + 452 Typeinfo-next: # (handle typeinfo) + 453 0x10/imm32 + 454 Typeinfo-size: # (addr int) + 455 0x18/imm32 + 456 + 457 # Each entry in the typeinfo->fields table has a pointer to a string and a + 458 # pointer to a typeinfo-entry. + 459 Typeinfo-fields-row-size: # (addr int) + 460 0x10/imm32 + 461 + 462 # typeinfo-entry objects have information about a field in a single record type + 463 # + 464 # each field of a type is represented using two var's: + 465 # 1. the input var: expected type of the field; convenient for creating using parse-var-with-type + 466 # 2. the output var: a constant containing the byte offset; convenient for code-generation + 467 # computing the output happens after parsing; in the meantime we preserve the + 468 # order of fields in the 'index' field. + 469 Typeinfo-entry-input-var: # (handle var) + 470 0/imm32 + 471 Typeinfo-entry-index: # int + 472 8/imm32 + 473 Typeinfo-entry-output-var: # (handle var) + 474 0xc/imm32 + 475 Typeinfo-entry-size: # (addr int) + 476 0x14/imm32 + 477 + 478 == code + 479 + 480 Entry: + 481 # . prologue + 482 89/<- %ebp 4/r32/esp + 483 (new-segment *Heap-size Heap) + 484 # if (argv[1] == "test') run-tests() + 485 { + 486 # if (argc <= 1) break + 487 81 7/subop/compare *ebp 1/imm32 + 488 7e/jump-if-<= break/disp8 + 489 # if (argv[1] != "test") break + 490 (kernel-string-equal? *(ebp+8) "test") # => eax + 491 3d/compare-eax-and 0/imm32/false + 492 74/jump-if-= break/disp8 + 493 # + 494 (run-tests) + 495 # syscall(exit, *Num-test-failures) + 496 8b/-> *Num-test-failures 3/r32/ebx + 497 eb/jump $mu-main:end/disp8 + 498 } + 499 # otherwise convert Stdin + 500 (convert-mu Stdin Stdout Stderr 0) + 501 (flush Stdout) + 502 # syscall(exit, 0) + 503 bb/copy-to-ebx 0/imm32 + 504 $mu-main:end: + 505 e8/call syscall_exit/disp32 + 506 + 507 convert-mu: # in: (addr buffered-file), out: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) + 508 # . prologue + 509 55/push-ebp + 510 89/<- %ebp 4/r32/esp + 511 # . save registers + 512 50/push-eax + 513 # initialize global data structures + 514 c7 0/subop/copy *Next-block-index 1/imm32 + 515 8b/-> *Primitive-type-ids 0/r32/eax + 516 89/<- *Type-id 0/r32/eax # stream-write + 517 c7 0/subop/copy *_Program-functions 0/imm32 + 518 c7 0/subop/copy *_Program-functions->payload 0/imm32 + 519 c7 0/subop/copy *_Program-types 0/imm32 + 520 c7 0/subop/copy *_Program-types->payload 0/imm32 + 521 c7 0/subop/copy *_Program-signatures 0/imm32 + 522 c7 0/subop/copy *_Program-signatures->payload 0/imm32 + 523 # + 524 (parse-mu *(ebp+8) *(ebp+0x10) *(ebp+0x14)) + 525 (populate-mu-type-sizes *(ebp+0x10) *(ebp+0x14)) + 526 #? (dump-typeinfos "=== typeinfos\n") + 527 (check-mu-types *(ebp+0x10) *(ebp+0x14)) + 528 (emit-subx *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) + 529 $convert-mu:end: + 530 # . restore registers + 531 58/pop-to-eax + 532 # . epilogue + 533 89/<- %esp 5/r32/ebp + 534 5d/pop-to-ebp + 535 c3/return + 536 + 537 test-convert-empty-input: + 538 # empty input => empty output + 539 # . prologue + 540 55/push-ebp + 541 89/<- %ebp 4/r32/esp + 542 # setup + 543 (clear-stream _test-input-stream) + 544 (clear-stream $_test-input-buffered-file->buffer) + 545 (clear-stream _test-output-stream) + 546 (clear-stream $_test-output-buffered-file->buffer) + 547 # + 548 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 549 (flush _test-output-buffered-file) + 550 (check-stream-equal _test-output-stream "" "F - test-convert-empty-input") + 551 # . epilogue + 552 89/<- %esp 5/r32/ebp + 553 5d/pop-to-ebp + 554 c3/return + 555 + 556 test-convert-function-skeleton: + 557 # . prologue + 558 55/push-ebp + 559 89/<- %ebp 4/r32/esp + 560 # setup + 561 (clear-stream _test-input-stream) + 562 (clear-stream $_test-input-buffered-file->buffer) + 563 (clear-stream _test-output-stream) + 564 (clear-stream $_test-output-buffered-file->buffer) + 565 # + 566 (write _test-input-stream "fn foo {\n") + 567 (write _test-input-stream "}\n") + 568 # convert + 569 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 570 (flush _test-output-buffered-file) + 571 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 577 # check output + 578 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-skeleton/0") + 579 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-skeleton/1") + 580 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-skeleton/2") + 581 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-skeleton/3") + 582 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-skeleton/4") + 583 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-skeleton/5") + 584 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-skeleton/6") + 585 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-skeleton/7") + 586 # . epilogue + 587 89/<- %esp 5/r32/ebp + 588 5d/pop-to-ebp + 589 c3/return + 590 + 591 test-convert-multiple-function-skeletons: + 592 # . prologue + 593 55/push-ebp + 594 89/<- %ebp 4/r32/esp + 595 # setup + 596 (clear-stream _test-input-stream) + 597 (clear-stream $_test-input-buffered-file->buffer) + 598 (clear-stream _test-output-stream) + 599 (clear-stream $_test-output-buffered-file->buffer) + 600 # + 601 (write _test-input-stream "fn foo {\n") + 602 (write _test-input-stream "}\n") + 603 (write _test-input-stream "fn bar {\n") + 604 (write _test-input-stream "}\n") + 605 # convert + 606 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 607 (flush _test-output-buffered-file) + 608 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 614 # check first function + 615 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-multiple-function-skeletons/0") + 616 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/1") + 617 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/2") + 618 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/3") + 619 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/4") + 620 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/5") + 621 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/6") + 622 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/7") + 623 # check second function + 624 (check-next-stream-line-equal _test-output-stream "bar:" "F - test-convert-multiple-function-skeletons/10") + 625 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-multiple-function-skeletons/11") + 626 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-multiple-function-skeletons/12") + 627 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-multiple-function-skeletons/13") + 628 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-multiple-function-skeletons/14") + 629 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-multiple-function-skeletons/15") + 630 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-multiple-function-skeletons/16") + 631 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-multiple-function-skeletons/17") + 632 # . epilogue + 633 89/<- %esp 5/r32/ebp + 634 5d/pop-to-ebp + 635 c3/return + 636 + 637 test-convert-function-with-arg: + 638 # . prologue + 639 55/push-ebp + 640 89/<- %ebp 4/r32/esp + 641 # setup + 642 (clear-stream _test-input-stream) + 643 (clear-stream $_test-input-buffered-file->buffer) + 644 (clear-stream _test-output-stream) + 645 (clear-stream $_test-output-buffered-file->buffer) + 646 # + 647 (write _test-input-stream "fn foo n: int {\n") + 648 (write _test-input-stream "}\n") + 649 # convert + 650 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 651 (flush _test-output-buffered-file) + 652 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 658 # check output + 659 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg/0") + 660 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg/1") + 661 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg/2") + 662 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg/3") + 663 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg/4") + 664 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg/5") + 665 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg/6") + 666 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg/7") + 667 # . epilogue + 668 89/<- %esp 5/r32/ebp + 669 5d/pop-to-ebp + 670 c3/return + 671 + 672 test-function-with-redefined-name: + 673 # . prologue + 674 55/push-ebp + 675 89/<- %ebp 4/r32/esp + 676 # setup + 677 (clear-stream _test-input-stream) + 678 (clear-stream $_test-input-buffered-file->buffer) + 679 (clear-stream _test-output-stream) + 680 (clear-stream $_test-output-buffered-file->buffer) + 681 (clear-stream _test-error-stream) + 682 (clear-stream $_test-error-buffered-file->buffer) + 683 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 684 68/push 0/imm32 + 685 68/push 0/imm32 + 686 89/<- %edx 4/r32/esp + 687 (tailor-exit-descriptor %edx 0x10) + 688 # + 689 (write _test-input-stream "fn foo {\n") + 690 (write _test-input-stream "}\n") + 691 (write _test-input-stream "fn foo {\n") + 692 (write _test-input-stream "}\n") + 693 # convert + 694 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 695 # registers except esp clobbered at this point + 696 # restore ed + 697 89/<- %edx 4/r32/esp + 698 (flush _test-output-buffered-file) + 699 (flush _test-error-buffered-file) + 700 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 706 # check output + 707 (check-stream-equal _test-output-stream "" "F - test-function-with-redefined-name: output should be empty") + 708 (check-next-stream-line-equal _test-error-stream "fn foo defined more than once" "F - test-function-with-redefined-name: error message") + 709 # check that stop(1) was called + 710 (check-ints-equal *(edx+4) 2 "F - test-function-with-redefined-name: exit status") + 711 # don't restore from ebp + 712 81 0/subop/add %esp 8/imm32 + 713 # . epilogue + 714 5d/pop-to-ebp + 715 c3/return + 716 + 717 test-function-with-redefined-name-2: + 718 # . prologue + 719 55/push-ebp + 720 89/<- %ebp 4/r32/esp + 721 # setup + 722 (clear-stream _test-input-stream) + 723 (clear-stream $_test-input-buffered-file->buffer) + 724 (clear-stream _test-output-stream) + 725 (clear-stream $_test-output-buffered-file->buffer) + 726 (clear-stream _test-error-stream) + 727 (clear-stream $_test-error-buffered-file->buffer) + 728 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 729 68/push 0/imm32 + 730 68/push 0/imm32 + 731 89/<- %edx 4/r32/esp + 732 (tailor-exit-descriptor %edx 0x10) + 733 # + 734 (write _test-input-stream "fn foo {\n") + 735 (write _test-input-stream "}\n") + 736 (write _test-input-stream "sig foo\n") + 737 # convert + 738 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 739 # registers except esp clobbered at this point + 740 # restore ed + 741 89/<- %edx 4/r32/esp + 742 (flush _test-output-buffered-file) + 743 (flush _test-error-buffered-file) + 744 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 750 # check output + 751 (check-stream-equal _test-output-stream "" "F - test-function-with-redefined-name-2: output should be empty") + 752 (check-next-stream-line-equal _test-error-stream "fn foo defined more than once" "F - test-function-with-redefined-name-2: error message") + 753 # check that stop(1) was called + 754 (check-ints-equal *(edx+4) 2 "F - test-function-with-redefined-name-2: exit status") + 755 # don't restore from ebp + 756 81 0/subop/add %esp 8/imm32 + 757 # . epilogue + 758 5d/pop-to-ebp + 759 c3/return + 760 + 761 test-function-with-redefined-name-3: + 762 # . prologue + 763 55/push-ebp + 764 89/<- %ebp 4/r32/esp + 765 # setup + 766 (clear-stream _test-input-stream) + 767 (clear-stream $_test-input-buffered-file->buffer) + 768 (clear-stream _test-output-stream) + 769 (clear-stream $_test-output-buffered-file->buffer) + 770 (clear-stream _test-error-stream) + 771 (clear-stream $_test-error-buffered-file->buffer) + 772 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 773 68/push 0/imm32 + 774 68/push 0/imm32 + 775 89/<- %edx 4/r32/esp + 776 (tailor-exit-descriptor %edx 0x10) + 777 # + 778 (write _test-input-stream "sig foo\n") + 779 (write _test-input-stream "fn foo {\n") + 780 (write _test-input-stream "}\n") + 781 # convert + 782 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 783 # registers except esp clobbered at this point + 784 # restore ed + 785 89/<- %edx 4/r32/esp + 786 (flush _test-output-buffered-file) + 787 (flush _test-error-buffered-file) + 788 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 794 # check output + 795 (check-stream-equal _test-output-stream "" "F - test-function-with-redefined-name-3: output should be empty") + 796 (check-next-stream-line-equal _test-error-stream "fn foo defined more than once" "F - test-function-with-redefined-name-3: error message") + 797 # check that stop(1) was called + 798 (check-ints-equal *(edx+4) 2 "F - test-function-with-redefined-name-3: exit status") + 799 # don't restore from ebp + 800 81 0/subop/add %esp 8/imm32 + 801 # . epilogue + 802 5d/pop-to-ebp + 803 c3/return + 804 + 805 test-function-with-inout-in-register: + 806 # . prologue + 807 55/push-ebp + 808 89/<- %ebp 4/r32/esp + 809 # setup + 810 (clear-stream _test-input-stream) + 811 (clear-stream $_test-input-buffered-file->buffer) + 812 (clear-stream _test-output-stream) + 813 (clear-stream $_test-output-buffered-file->buffer) + 814 (clear-stream _test-error-stream) + 815 (clear-stream $_test-error-buffered-file->buffer) + 816 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 817 68/push 0/imm32 + 818 68/push 0/imm32 + 819 89/<- %edx 4/r32/esp + 820 (tailor-exit-descriptor %edx 0x10) + 821 # + 822 (write _test-input-stream "fn foo x/eax: int {\n") + 823 (write _test-input-stream "}\n") + 824 # convert + 825 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 826 # registers except esp clobbered at this point + 827 # restore ed + 828 89/<- %edx 4/r32/esp + 829 (flush _test-output-buffered-file) + 830 (flush _test-error-buffered-file) + 831 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 837 # check output + 838 (check-stream-equal _test-output-stream "" "F - test-function-with-inout-in-register: output should be empty") + 839 (check-next-stream-line-equal _test-error-stream "fn foo: function inout 'x' cannot be in a register" "F - test-function-with-inout-in-register: error message") + 840 # check that stop(1) was called + 841 (check-ints-equal *(edx+4) 2 "F - test-function-with-inout-in-register: exit status") + 842 # don't restore from ebp + 843 81 0/subop/add %esp 8/imm32 + 844 # . epilogue + 845 5d/pop-to-ebp + 846 c3/return + 847 + 848 test-convert-function-with-arg-and-body: + 849 # . prologue + 850 55/push-ebp + 851 89/<- %ebp 4/r32/esp + 852 # setup + 853 (clear-stream _test-input-stream) + 854 (clear-stream $_test-input-buffered-file->buffer) + 855 (clear-stream _test-output-stream) + 856 (clear-stream $_test-output-buffered-file->buffer) + 857 # + 858 (write _test-input-stream "fn foo n: int {\n") + 859 (write _test-input-stream " increment n\n") + 860 (write _test-input-stream "}\n") + 861 # convert + 862 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 863 (flush _test-output-buffered-file) + 864 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 870 # check output + 871 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-arg-and-body/0") + 872 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-arg-and-body/1") + 873 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-arg-and-body/2") + 874 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-arg-and-body/3") + 875 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-arg-and-body/4") + 876 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-arg-and-body/5") + 877 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-arg-and-body/6") + 878 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-arg-and-body/7") + 879 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-arg-and-body/8") + 880 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-arg-and-body/9") + 881 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-arg-and-body/10") + 882 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-arg-and-body/11") + 883 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-arg-and-body/12") + 884 # . epilogue + 885 89/<- %esp 5/r32/ebp + 886 5d/pop-to-ebp + 887 c3/return + 888 + 889 test-convert-function-distinguishes-args: + 890 # . prologue + 891 55/push-ebp + 892 89/<- %ebp 4/r32/esp + 893 # setup + 894 (clear-stream _test-input-stream) + 895 (clear-stream $_test-input-buffered-file->buffer) + 896 (clear-stream _test-output-stream) + 897 (clear-stream $_test-output-buffered-file->buffer) + 898 # + 899 (write _test-input-stream "fn foo a: int, b: int {\n") + 900 (write _test-input-stream " increment b\n") + 901 (write _test-input-stream "}\n") + 902 # convert + 903 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 904 (flush _test-output-buffered-file) + 905 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 911 # check output + 912 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-distinguishes-args/0") + 913 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-distinguishes-args/1") + 914 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-distinguishes-args/2") + 915 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-distinguishes-args/3") + 916 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-distinguishes-args/4") + 917 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-distinguishes-args/5") + 918 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x0000000c)" "F - test-convert-function-distinguishes-args/6") + 919 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-distinguishes-args/7") + 920 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-distinguishes-args/8") + 921 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-distinguishes-args/9") + 922 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-distinguishes-args/10") + 923 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-distinguishes-args/11") + 924 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-distinguishes-args/12") + 925 # . epilogue + 926 89/<- %esp 5/r32/ebp + 927 5d/pop-to-ebp + 928 c3/return + 929 + 930 test-convert-function-with-return-literal: + 931 # . prologue + 932 55/push-ebp + 933 89/<- %ebp 4/r32/esp + 934 # setup + 935 (clear-stream _test-input-stream) + 936 (clear-stream $_test-input-buffered-file->buffer) + 937 (clear-stream _test-output-stream) + 938 (clear-stream $_test-output-buffered-file->buffer) + 939 # + 940 (write _test-input-stream "fn foo -> _/eax: int {\n") + 941 (write _test-input-stream " return 0\n") + 942 (write _test-input-stream "}\n") + 943 # convert + 944 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 945 (flush _test-output-buffered-file) + 946 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 952 # check output + 953 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-literal/0") + 954 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-literal/1") + 955 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-literal/2") + 956 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-literal/3") + 957 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-literal/4") + 958 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-literal/5") + 959 (check-next-stream-line-equal _test-output-stream " c7 0/subop/copy %eax 0/imm32" "F - test-convert-function-with-return-literal/6") + 960 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-literal/7") + 961 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-literal/8") + 962 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-literal/9") + 963 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-literal/10") + 964 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-literal/11") + 965 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-literal/12") + 966 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-literal/13") + 967 # . epilogue + 968 89/<- %esp 5/r32/ebp + 969 5d/pop-to-ebp + 970 c3/return + 971 + 972 test-convert-function-with-return: + 973 # . prologue + 974 55/push-ebp + 975 89/<- %ebp 4/r32/esp + 976 # setup + 977 (clear-stream _test-input-stream) + 978 (clear-stream $_test-input-buffered-file->buffer) + 979 (clear-stream _test-output-stream) + 980 (clear-stream $_test-output-buffered-file->buffer) + 981 # + 982 (write _test-input-stream "fn foo -> _/eax: int {\n") + 983 (write _test-input-stream " var y: int\n") + 984 (write _test-input-stream " return y\n") + 985 (write _test-input-stream "}\n") + 986 # convert + 987 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 988 (flush _test-output-buffered-file) + 989 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 995 # check output + 996 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return/0") + 997 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return/1") + 998 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return/2") + 999 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return/3") + 1000 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return/4") + 1001 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return/5") + 1002 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-return/6") # y + 1003 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0xfffffffc) 0x00000000/r32" "F - test-convert-function-with-return/7") + 1004 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-return/8") + 1005 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return/9") + 1006 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return/10") + 1007 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return/11") + 1008 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return/12") + 1009 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return/13") + 1010 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return/14") + 1011 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return/15") + 1012 # . epilogue + 1013 89/<- %esp 5/r32/ebp + 1014 5d/pop-to-ebp + 1015 c3/return + 1016 + 1017 test-convert-function-with-return-register: + 1018 # . prologue + 1019 55/push-ebp + 1020 89/<- %ebp 4/r32/esp + 1021 # setup + 1022 (clear-stream _test-input-stream) + 1023 (clear-stream $_test-input-buffered-file->buffer) + 1024 (clear-stream _test-output-stream) + 1025 (clear-stream $_test-output-buffered-file->buffer) + 1026 # + 1027 (write _test-input-stream "fn foo -> _/eax: int {\n") + 1028 (write _test-input-stream " var y/eax: int <- copy 3\n") + 1029 (write _test-input-stream " return y\n") + 1030 (write _test-input-stream "}\n") + 1031 # convert + 1032 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1033 (flush _test-output-buffered-file) + 1034 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1040 # check output + 1041 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-register/0") + 1042 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-register/1") + 1043 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-register/2") + 1044 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-register/3") + 1045 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-register/4") + 1046 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-register/5") + 1047 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-return-register/6") + 1048 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-convert-function-with-return-register/7") + 1049 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-with-return-register/8") + 1050 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-return-register/9") + 1051 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-register/10") + 1052 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-register/11") + 1053 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-register/12") + 1054 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-register/13") + 1055 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-register/14") + 1056 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-register/15") + 1057 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-register/16") + 1058 # . epilogue + 1059 89/<- %esp 5/r32/ebp + 1060 5d/pop-to-ebp + 1061 c3/return + 1062 + 1063 test-function-with-output-without-register: + 1064 # . prologue + 1065 55/push-ebp + 1066 89/<- %ebp 4/r32/esp + 1067 # setup + 1068 (clear-stream _test-input-stream) + 1069 (clear-stream $_test-input-buffered-file->buffer) + 1070 (clear-stream _test-output-stream) + 1071 (clear-stream $_test-output-buffered-file->buffer) + 1072 (clear-stream _test-error-stream) + 1073 (clear-stream $_test-error-buffered-file->buffer) + 1074 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1075 68/push 0/imm32 + 1076 68/push 0/imm32 + 1077 89/<- %edx 4/r32/esp + 1078 (tailor-exit-descriptor %edx 0x10) + 1079 # + 1080 (write _test-input-stream "fn foo -> _: int {\n") + 1081 (write _test-input-stream "}\n") + 1082 # convert + 1083 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1084 # registers except esp clobbered at this point + 1085 # restore ed + 1086 89/<- %edx 4/r32/esp + 1087 (flush _test-output-buffered-file) + 1088 (flush _test-error-buffered-file) + 1089 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1095 # check output + 1096 (check-stream-equal _test-output-stream "" "F - test-function-with-output-without-register: output should be empty") + 1097 (check-next-stream-line-equal _test-error-stream "fn foo: function output '_' must be in a register, in instruction 'fn foo -> _: int {" "F - test-function-with-output-without-register: error message") + 1098 # check that stop(1) was called + 1099 (check-ints-equal *(edx+4) 2 "F - test-function-with-output-without-register: exit status") + 1100 # don't restore from ebp + 1101 81 0/subop/add %esp 8/imm32 + 1102 # . epilogue + 1103 5d/pop-to-ebp + 1104 c3/return + 1105 + 1106 test-function-with-outputs-in-conflicting-registers: + 1107 # . prologue + 1108 55/push-ebp + 1109 89/<- %ebp 4/r32/esp + 1110 # setup + 1111 (clear-stream _test-input-stream) + 1112 (clear-stream $_test-input-buffered-file->buffer) + 1113 (clear-stream _test-output-stream) + 1114 (clear-stream $_test-output-buffered-file->buffer) + 1115 (clear-stream _test-error-stream) + 1116 (clear-stream $_test-error-buffered-file->buffer) + 1117 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1118 68/push 0/imm32 + 1119 68/push 0/imm32 + 1120 89/<- %edx 4/r32/esp + 1121 (tailor-exit-descriptor %edx 0x10) + 1122 # + 1123 (write _test-input-stream "fn foo -> _/eax: int, _/eax: int {\n") + 1124 (write _test-input-stream "}\n") + 1125 # convert + 1126 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1127 # registers except esp clobbered at this point + 1128 # restore ed + 1129 89/<- %edx 4/r32/esp + 1130 (flush _test-output-buffered-file) + 1131 (flush _test-error-buffered-file) + 1132 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1138 # check output + 1139 (check-stream-equal _test-output-stream "" "F - test-function-with-outputs-in-conflicting-registers: output should be empty") + 1140 (check-next-stream-line-equal _test-error-stream "fn foo: outputs must be in unique registers" "F - test-function-with-outputs-in-conflicting-registers: error message") + 1141 # check that stop(1) was called + 1142 (check-ints-equal *(edx+4) 2 "F - test-function-with-outputs-in-conflicting-registers: exit status") + 1143 # don't restore from ebp + 1144 81 0/subop/add %esp 8/imm32 + 1145 # . epilogue + 1146 5d/pop-to-ebp + 1147 c3/return + 1148 + 1149 test-function-with-named-output: + 1150 # . prologue + 1151 55/push-ebp + 1152 89/<- %ebp 4/r32/esp + 1153 # setup + 1154 (clear-stream _test-input-stream) + 1155 (clear-stream $_test-input-buffered-file->buffer) + 1156 (clear-stream _test-output-stream) + 1157 (clear-stream $_test-output-buffered-file->buffer) + 1158 (clear-stream _test-error-stream) + 1159 (clear-stream $_test-error-buffered-file->buffer) + 1160 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1161 68/push 0/imm32 + 1162 68/push 0/imm32 + 1163 89/<- %edx 4/r32/esp + 1164 (tailor-exit-descriptor %edx 0x10) + 1165 # + 1166 (write _test-input-stream "fn foo -> x/eax: int {\n") + 1167 (write _test-input-stream " return 0\n") + 1168 (write _test-input-stream "}\n") + 1169 # convert + 1170 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1171 # registers except esp clobbered at this point + 1172 # restore ed + 1173 89/<- %edx 4/r32/esp + 1174 (flush _test-output-buffered-file) + 1175 (flush _test-error-buffered-file) + 1176 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1182 # check output + 1183 (check-stream-equal _test-output-stream "" "F - test-function-with-named-output: output should be empty") + 1184 (check-next-stream-line-equal _test-error-stream "fn foo: function outputs cannot be named; rename 'x' in the header to '_'" "F - test-function-with-named-output: error message") + 1185 # check that stop(1) was called + 1186 (check-ints-equal *(edx+4) 2 "F - test-function-with-named-output: exit status") + 1187 # don't restore from ebp + 1188 81 0/subop/add %esp 8/imm32 + 1189 # . epilogue + 1190 5d/pop-to-ebp + 1191 c3/return + 1192 + 1193 test-return-with-wrong-type: + 1194 # . prologue + 1195 55/push-ebp + 1196 89/<- %ebp 4/r32/esp + 1197 # setup + 1198 (clear-stream _test-input-stream) + 1199 (clear-stream $_test-input-buffered-file->buffer) + 1200 (clear-stream _test-output-stream) + 1201 (clear-stream $_test-output-buffered-file->buffer) + 1202 (clear-stream _test-error-stream) + 1203 (clear-stream $_test-error-buffered-file->buffer) + 1204 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1205 68/push 0/imm32 + 1206 68/push 0/imm32 + 1207 89/<- %edx 4/r32/esp + 1208 (tailor-exit-descriptor %edx 0x10) + 1209 # + 1210 (write _test-input-stream "fn foo -> _/eax: int {\n") + 1211 (write _test-input-stream " var x/eax: boolean <- copy 0\n") + 1212 (write _test-input-stream " return x\n") + 1213 (write _test-input-stream "}\n") + 1214 # convert + 1215 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1216 # registers except esp clobbered at this point + 1217 # restore ed + 1218 89/<- %edx 4/r32/esp + 1219 (flush _test-output-buffered-file) + 1220 (flush _test-error-buffered-file) + 1221 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1227 # check output + 1228 (check-stream-equal _test-output-stream "" "F - test-return-with-wrong-type: output should be empty") + 1229 (check-next-stream-line-equal _test-error-stream "fn foo: return: 'x' has the wrong type" "F - test-return-with-wrong-type: error message") + 1230 # check that stop(1) was called + 1231 (check-ints-equal *(edx+4) 2 "F - test-return-with-wrong-type: exit status") + 1232 # don't restore from ebp + 1233 81 0/subop/add %esp 8/imm32 + 1234 # . epilogue + 1235 5d/pop-to-ebp + 1236 c3/return + 1237 + 1238 test-missing-return: + 1239 # . prologue + 1240 55/push-ebp + 1241 89/<- %ebp 4/r32/esp + 1242 # setup + 1243 (clear-stream _test-input-stream) + 1244 (clear-stream $_test-input-buffered-file->buffer) + 1245 (clear-stream _test-output-stream) + 1246 (clear-stream $_test-output-buffered-file->buffer) + 1247 (clear-stream _test-error-stream) + 1248 (clear-stream $_test-error-buffered-file->buffer) + 1249 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1250 68/push 0/imm32 + 1251 68/push 0/imm32 + 1252 89/<- %edx 4/r32/esp + 1253 (tailor-exit-descriptor %edx 0x10) + 1254 # + 1255 (write _test-input-stream "fn foo -> _/eax: int {\n") + 1256 (write _test-input-stream " var x/eax: boolean <- copy 0\n") + 1257 (write _test-input-stream "}\n") + 1258 # convert + 1259 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1260 # registers except esp clobbered at this point + 1261 # restore ed + 1262 89/<- %edx 4/r32/esp + 1263 (flush _test-output-buffered-file) + 1264 (flush _test-error-buffered-file) + 1265 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1271 # check output + 1272 (check-stream-equal _test-output-stream "" "F - test-missing-return: output should be empty") + 1273 (check-next-stream-line-equal _test-error-stream "fn foo: final statement should be a 'return'" "F - test-missing-return: error message") + 1274 # check that stop(1) was called + 1275 (check-ints-equal *(edx+4) 2 "F - test-missing-return: exit status") + 1276 # don't restore from ebp + 1277 81 0/subop/add %esp 8/imm32 + 1278 # . epilogue + 1279 5d/pop-to-ebp + 1280 c3/return + 1281 + 1282 test-early-exit-without-return: + 1283 # . prologue + 1284 55/push-ebp + 1285 89/<- %ebp 4/r32/esp + 1286 # setup + 1287 (clear-stream _test-input-stream) + 1288 (clear-stream $_test-input-buffered-file->buffer) + 1289 (clear-stream _test-output-stream) + 1290 (clear-stream $_test-output-buffered-file->buffer) + 1291 (clear-stream _test-error-stream) + 1292 (clear-stream $_test-error-buffered-file->buffer) + 1293 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1294 68/push 0/imm32 + 1295 68/push 0/imm32 + 1296 89/<- %edx 4/r32/esp + 1297 (tailor-exit-descriptor %edx 0x10) + 1298 # + 1299 (write _test-input-stream "fn foo -> _/eax: int {\n") + 1300 (write _test-input-stream " break\n") + 1301 (write _test-input-stream " return 0\n") + 1302 (write _test-input-stream "}\n") + 1303 # convert + 1304 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1305 # registers except esp clobbered at this point + 1306 # restore ed + 1307 89/<- %edx 4/r32/esp + 1308 (flush _test-output-buffered-file) + 1309 (flush _test-error-buffered-file) + 1310 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1316 # check output + 1317 (check-stream-equal _test-output-stream "" "F - test-early-exit-without-return: output should be empty") + 1318 (check-next-stream-line-equal _test-error-stream "fn foo has outputs, so you cannot 'break' out of the outermost block. Use 'return'." "F - test-early-exit-without-return: error message") + 1319 # check that stop(1) was called + 1320 (check-ints-equal *(edx+4) 2 "F - test-early-exit-without-return: exit status") + 1321 # don't restore from ebp + 1322 81 0/subop/add %esp 8/imm32 + 1323 # . epilogue + 1324 5d/pop-to-ebp + 1325 c3/return + 1326 + 1327 test-return-with-too-few-inouts: + 1328 # . prologue + 1329 55/push-ebp + 1330 89/<- %ebp 4/r32/esp + 1331 # setup + 1332 (clear-stream _test-input-stream) + 1333 (clear-stream $_test-input-buffered-file->buffer) + 1334 (clear-stream _test-output-stream) + 1335 (clear-stream $_test-output-buffered-file->buffer) + 1336 (clear-stream _test-error-stream) + 1337 (clear-stream $_test-error-buffered-file->buffer) + 1338 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1339 68/push 0/imm32 + 1340 68/push 0/imm32 + 1341 89/<- %edx 4/r32/esp + 1342 (tailor-exit-descriptor %edx 0x10) + 1343 # + 1344 (write _test-input-stream "fn foo -> _/eax: int {\n") + 1345 (write _test-input-stream " return\n") + 1346 (write _test-input-stream "}\n") + 1347 # convert + 1348 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1349 # registers except esp clobbered at this point + 1350 # restore ed + 1351 89/<- %edx 4/r32/esp + 1352 (flush _test-output-buffered-file) + 1353 (flush _test-error-buffered-file) + 1354 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1360 # check output + 1361 (check-stream-equal _test-output-stream "" "F - test-return-with-too-few-inouts: output should be empty") + 1362 (check-next-stream-line-equal _test-error-stream "fn foo: return: too few inouts" "F - test-return-with-too-few-inouts: error message") + 1363 # check that stop(1) was called + 1364 (check-ints-equal *(edx+4) 2 "F - test-return-with-too-few-inouts: exit status") + 1365 # don't restore from ebp + 1366 81 0/subop/add %esp 8/imm32 1367 # . epilogue - 1368 89/<- %esp 5/r32/ebp - 1369 5d/pop-to-ebp - 1370 c3/return - 1371 - 1372 test-convert-return-with-duplicate-values-2: - 1373 # . prologue - 1374 55/push-ebp - 1375 89/<- %ebp 4/r32/esp - 1376 # setup - 1377 (clear-stream _test-input-stream) - 1378 (clear-stream $_test-input-buffered-file->buffer) - 1379 (clear-stream _test-output-stream) - 1380 (clear-stream $_test-output-buffered-file->buffer) - 1381 # - 1382 (write _test-input-stream "fn foo -> _/eax: int, _/ecx: int {\n") - 1383 (write _test-input-stream " var x/ecx: int <- copy 0x34\n") - 1384 (write _test-input-stream " return x, x\n") - 1385 (write _test-input-stream "}\n") - 1386 # convert - 1387 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1388 (flush _test-output-buffered-file) - 1389 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 1395 # check output - 1396 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-return-with-duplicate-values-2/0") - 1397 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-return-with-duplicate-values-2/1") - 1398 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-return-with-duplicate-values-2/2") - 1399 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-return-with-duplicate-values-2/3") - 1400 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-return-with-duplicate-values-2/4") - 1401 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-return-with-duplicate-values-2/5") - 1402 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-return-with-duplicate-values-2/6") - 1403 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x34/imm32" "F - test-convert-return-with-duplicate-values-2/7") - 1404 (check-next-stream-line-equal _test-output-stream " 8b/-> %ecx 0x00000000/r32" "F - test-convert-return-with-duplicate-values-2/8") - 1405 (check-next-stream-line-equal _test-output-stream " 8b/-> %ecx 0x00000001/r32" "F - test-convert-return-with-duplicate-values-2/9") - 1406 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-return-with-duplicate-values-2/10") - 1407 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-return-with-duplicate-values-2/11") - 1408 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-return-with-duplicate-values-2/12") - 1409 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-return-with-duplicate-values-2/13") - 1410 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-return-with-duplicate-values-2/14") - 1411 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-return-with-duplicate-values-2/15") - 1412 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-return-with-duplicate-values-2/16") - 1413 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-return-with-duplicate-values-2/17") - 1414 # . epilogue - 1415 89/<- %esp 5/r32/ebp - 1416 5d/pop-to-ebp - 1417 c3/return - 1418 - 1419 test-convert-function-with-literal-arg: - 1420 # . prologue - 1421 55/push-ebp - 1422 89/<- %ebp 4/r32/esp - 1423 # setup - 1424 (clear-stream _test-input-stream) - 1425 (clear-stream $_test-input-buffered-file->buffer) - 1426 (clear-stream _test-output-stream) - 1427 (clear-stream $_test-output-buffered-file->buffer) - 1428 # - 1429 (write _test-input-stream "fn foo a: int, b: int -> _/eax: int {\n") - 1430 (write _test-input-stream " var result/eax: int <- copy a\n") - 1431 (write _test-input-stream " result <- add 1\n") - 1432 (write _test-input-stream " return result\n") - 1433 (write _test-input-stream "}\n") - 1434 # convert - 1435 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1436 (flush _test-output-buffered-file) - 1437 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 1443 # check output - 1444 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg/0") - 1445 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg/1") - 1446 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg/2") - 1447 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg/3") - 1448 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg/4") - 1449 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg/5") - 1450 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-literal-arg/6") - 1451 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-with-literal-arg/7") - 1452 (check-next-stream-line-equal _test-output-stream " 05/add-to-eax 1/imm32" "F - test-convert-function-with-literal-arg/8") - 1453 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-with-literal-arg/9") - 1454 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-literal-arg/10") - 1455 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-literal-arg/11") - 1456 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg/12") - 1457 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg/13") - 1458 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg/14") - 1459 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg/15") - 1460 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg/16") - 1461 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg/17") - 1462 # . epilogue - 1463 89/<- %esp 5/r32/ebp - 1464 5d/pop-to-ebp - 1465 c3/return - 1466 - 1467 test-convert-function-with-literal-arg-2: - 1468 # . prologue - 1469 55/push-ebp - 1470 89/<- %ebp 4/r32/esp - 1471 # setup - 1472 (clear-stream _test-input-stream) - 1473 (clear-stream $_test-input-buffered-file->buffer) - 1474 (clear-stream _test-output-stream) - 1475 (clear-stream $_test-output-buffered-file->buffer) - 1476 # - 1477 (write _test-input-stream "fn foo a: int, b: int -> _/ebx: int {\n") - 1478 (write _test-input-stream " var result/ebx: int <- copy a\n") - 1479 (write _test-input-stream " result <- add 1\n") - 1480 (write _test-input-stream " return result\n") - 1481 (write _test-input-stream "}\n") - 1482 # convert - 1483 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1484 (flush _test-output-buffered-file) - 1485 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 1491 # check output - 1492 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg-2/0") - 1493 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg-2/1") - 1494 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg-2/2") - 1495 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg-2/3") - 1496 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg-2/4") - 1497 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg-2/5") - 1498 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-function-with-literal-arg-2/6") - 1499 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-with-literal-arg-2/7") - 1500 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %ebx 1/imm32" "F - test-convert-function-with-literal-arg-2/8") - 1501 (check-next-stream-line-equal _test-output-stream " 8b/-> %ebx 0x00000003/r32" "F - test-convert-function-with-literal-arg-2/9") - 1502 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-literal-arg-2/10") - 1503 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-literal-arg-2/11") - 1504 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg-2/12") - 1505 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg-2/13") - 1506 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg-2/14") - 1507 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg-2/15") - 1508 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg-2/16") - 1509 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg-2/17") - 1510 # . epilogue - 1511 89/<- %esp 5/r32/ebp - 1512 5d/pop-to-ebp - 1513 c3/return - 1514 - 1515 test-convert-function-call-with-literal-arg: - 1516 # . prologue - 1517 55/push-ebp - 1518 89/<- %ebp 4/r32/esp - 1519 # setup - 1520 (clear-stream _test-input-stream) - 1521 (clear-stream $_test-input-buffered-file->buffer) - 1522 (clear-stream _test-output-stream) - 1523 (clear-stream $_test-output-buffered-file->buffer) - 1524 # - 1525 (write _test-input-stream "fn main -> _/ebx: int {\n") - 1526 (write _test-input-stream " var result/eax: int <- do-add 3 4\n") - 1527 (write _test-input-stream " return result\n") - 1528 (write _test-input-stream "}\n") - 1529 (write _test-input-stream "fn do-add a: int, b: int -> _/eax: int {\n") - 1530 (write _test-input-stream " var result/eax: int <- copy a\n") - 1531 (write _test-input-stream " result <- add b\n") - 1532 (write _test-input-stream " return result\n") - 1533 (write _test-input-stream "}\n") - 1534 # convert - 1535 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1536 (flush _test-output-buffered-file) - 1537 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 1543 # check output - 1544 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-literal-arg/0") - 1545 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/1") - 1546 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/2") - 1547 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/3") - 1548 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/4") - 1549 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call-with-literal-arg/5") - 1550 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-literal-arg/6") - 1551 (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-literal-arg/7") - 1552 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") - 1553 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-local-var-in-reg/9") - 1554 (check-next-stream-line-equal _test-output-stream " e9/jump $main:0x00000001:break/disp32" "F - test-convert-function-call-with-literal-arg/10") - 1555 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/11") - 1556 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call-with-literal-arg/12") - 1557 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/13") - 1558 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/14") - 1559 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/15") - 1560 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/16") - 1561 (check-next-stream-line-equal _test-output-stream "do-add:" "F - test-convert-function-call-with-literal-arg/17") - 1562 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/18") - 1563 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/19") - 1564 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/20") - 1565 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/21") - 1566 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:loop:" "F - test-convert-function-call-with-literal-arg/22") - 1567 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-literal-arg/23") - 1568 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-call-with-literal-arg/24") - 1569 (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0x0000000c) 0x00000000/r32" "F - test-convert-function-call-with-literal-arg/25") - 1570 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-call-with-literal-arg/26") - 1571 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-call-with-literal-arg/27") - 1572 (check-next-stream-line-equal _test-output-stream " e9/jump $do-add:0x00000002:break/disp32" "F - test-convert-function-call-with-literal-arg/28") - 1573 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/29") - 1574 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:break:" "F - test-convert-function-call-with-literal-arg/30") - 1575 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/31") - 1576 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/32") - 1577 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/33") - 1578 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/34") - 1579 # . epilogue - 1580 89/<- %esp 5/r32/ebp - 1581 5d/pop-to-ebp - 1582 c3/return - 1583 - 1584 test-convert-function-call-with-signature: - 1585 # . prologue - 1586 55/push-ebp - 1587 89/<- %ebp 4/r32/esp - 1588 # setup - 1589 (clear-stream _test-input-stream) - 1590 (clear-stream $_test-input-buffered-file->buffer) - 1591 (clear-stream _test-output-stream) - 1592 (clear-stream $_test-output-buffered-file->buffer) - 1593 # - 1594 (write _test-input-stream "fn main -> _/ebx: int {\n") - 1595 (write _test-input-stream " var result/eax: int <- do-add 3 4\n") - 1596 (write _test-input-stream " return result\n") - 1597 (write _test-input-stream "}\n") - 1598 (write _test-input-stream "sig do-add a: int, b: int -> _/eax: int\n") - 1599 # convert - 1600 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1601 (flush _test-output-buffered-file) - 1602 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 1608 # check output - 1609 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-signature/0") - 1610 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-signature/1") - 1611 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-signature/2") - 1612 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-signature/3") - 1613 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-signature/4") - 1614 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call-with-signature/5") - 1615 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-literal-arg/6") - 1616 (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-signature/6") - 1617 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") - 1618 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-local-var-in-reg/9") - 1619 (check-next-stream-line-equal _test-output-stream " e9/jump $main:0x00000001:break/disp32" "F - test-convert-function-call-with-literal-arg/10") - 1620 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-signature/7") - 1621 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call-with-signature/8") - 1622 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-signature/9") - 1623 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-signature/10") - 1624 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-signature/11") - 1625 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-signature/12") - 1626 # . epilogue - 1627 89/<- %esp 5/r32/ebp - 1628 5d/pop-to-ebp - 1629 c3/return - 1630 - 1631 test-convert-function-with-local-var-in-mem: - 1632 # . prologue - 1633 55/push-ebp - 1634 89/<- %ebp 4/r32/esp - 1635 # setup - 1636 (clear-stream _test-input-stream) - 1637 (clear-stream $_test-input-buffered-file->buffer) - 1638 (clear-stream _test-output-stream) - 1639 (clear-stream $_test-output-buffered-file->buffer) - 1640 # - 1641 (write _test-input-stream "fn foo {\n") - 1642 (write _test-input-stream " var x: int\n") - 1643 (write _test-input-stream " increment x\n") - 1644 (write _test-input-stream "}\n") - 1645 # convert - 1646 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1647 (flush _test-output-buffered-file) - 1648 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 1654 # check output - 1655 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem/0") - 1656 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem/1") - 1657 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem/2") - 1658 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-mem/3") - 1659 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem/4") - 1660 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-mem/5") - 1661 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem/6") - 1662 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-mem/7") - 1663 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-mem/8") - 1664 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem/9") - 1665 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-mem/10") - 1666 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem/11") - 1667 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-mem/12") - 1668 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem/13") - 1669 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem/14") - 1670 # . epilogue - 1671 89/<- %esp 5/r32/ebp - 1672 5d/pop-to-ebp - 1673 c3/return - 1674 - 1675 test-convert-invalid-literal: - 1676 # . prologue - 1677 55/push-ebp - 1678 89/<- %ebp 4/r32/esp - 1679 # setup - 1680 (clear-stream _test-input-stream) - 1681 (clear-stream $_test-input-buffered-file->buffer) - 1682 (clear-stream _test-output-stream) - 1683 (clear-stream $_test-output-buffered-file->buffer) - 1684 (clear-stream _test-error-stream) - 1685 (clear-stream $_test-error-buffered-file->buffer) - 1686 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1687 68/push 0/imm32 - 1688 68/push 0/imm32 - 1689 89/<- %edx 4/r32/esp - 1690 (tailor-exit-descriptor %edx 0x10) - 1691 # - 1692 (write _test-input-stream "fn foo {\n") - 1693 (write _test-input-stream " increment 1n\n") - 1694 (write _test-input-stream "}\n") - 1695 # convert - 1696 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1697 # registers except esp clobbered at this point - 1698 # restore ed - 1699 89/<- %edx 4/r32/esp - 1700 (flush _test-output-buffered-file) - 1701 (flush _test-error-buffered-file) - 1702 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1708 # check output - 1709 (check-stream-equal _test-output-stream "" "F - test-convert-invalid-literal: output should be empty") - 1710 (check-next-stream-line-equal _test-error-stream "fn foo: variable '1n' cannot begin with a digit (or do you have a typo in a number?)" "F - test-convert-invalid-literal: error message") - 1711 # check that stop(1) was called - 1712 (check-ints-equal *(edx+4) 2 "F - test-convert-invalid-literal: exit status") - 1713 # don't restore from ebp - 1714 81 0/subop/add %esp 8/imm32 + 1368 5d/pop-to-ebp + 1369 c3/return + 1370 + 1371 test-return-with-too-many-inouts: + 1372 # . prologue + 1373 55/push-ebp + 1374 89/<- %ebp 4/r32/esp + 1375 # setup + 1376 (clear-stream _test-input-stream) + 1377 (clear-stream $_test-input-buffered-file->buffer) + 1378 (clear-stream _test-output-stream) + 1379 (clear-stream $_test-output-buffered-file->buffer) + 1380 (clear-stream _test-error-stream) + 1381 (clear-stream $_test-error-buffered-file->buffer) + 1382 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1383 68/push 0/imm32 + 1384 68/push 0/imm32 + 1385 89/<- %edx 4/r32/esp + 1386 (tailor-exit-descriptor %edx 0x10) + 1387 # + 1388 (write _test-input-stream "fn foo -> _/eax: int {\n") + 1389 (write _test-input-stream " return 0, 0\n") + 1390 (write _test-input-stream "}\n") + 1391 # convert + 1392 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1393 # registers except esp clobbered at this point + 1394 # restore ed + 1395 89/<- %edx 4/r32/esp + 1396 (flush _test-output-buffered-file) + 1397 (flush _test-error-buffered-file) + 1398 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1404 # check output + 1405 (check-stream-equal _test-output-stream "" "F - test-return-with-too-many-inouts: output should be empty") + 1406 (check-next-stream-line-equal _test-error-stream "fn foo: return: too many inouts" "F - test-return-with-too-many-inouts: error message") + 1407 # check that stop(1) was called + 1408 (check-ints-equal *(edx+4) 2 "F - test-return-with-too-many-inouts: exit status") + 1409 # don't restore from ebp + 1410 81 0/subop/add %esp 8/imm32 + 1411 # . epilogue + 1412 5d/pop-to-ebp + 1413 c3/return + 1414 + 1415 test-return-unavailable-value: + 1416 # . prologue + 1417 55/push-ebp + 1418 89/<- %ebp 4/r32/esp + 1419 # setup + 1420 (clear-stream _test-input-stream) + 1421 (clear-stream $_test-input-buffered-file->buffer) + 1422 (clear-stream _test-output-stream) + 1423 (clear-stream $_test-output-buffered-file->buffer) + 1424 (clear-stream _test-error-stream) + 1425 (clear-stream $_test-error-buffered-file->buffer) + 1426 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1427 68/push 0/imm32 + 1428 68/push 0/imm32 + 1429 89/<- %edx 4/r32/esp + 1430 (tailor-exit-descriptor %edx 0x10) + 1431 # + 1432 (write _test-input-stream "fn foo -> _/eax: int, _/ecx: int {\n") + 1433 (write _test-input-stream " var x/eax: int <- copy 0\n") + 1434 (write _test-input-stream " var y/ecx: int <- copy 0\n") + 1435 (write _test-input-stream " return y, x\n") + 1436 (write _test-input-stream "}\n") + 1437 # convert + 1438 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1439 # registers except esp clobbered at this point + 1440 # restore ed + 1441 89/<- %edx 4/r32/esp + 1442 (flush _test-output-buffered-file) + 1443 (flush _test-error-buffered-file) + 1444 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1450 # check output + 1451 (check-stream-equal _test-output-stream "" "F - test-return-unavailable-value: output should be empty") + 1452 (check-next-stream-line-equal _test-error-stream "fn foo: return: 'x' is no longer available" "F - test-return-unavailable-value: error message") + 1453 # check that stop(1) was called + 1454 (check-ints-equal *(edx+4) 2 "F - test-return-unavailable-value: exit status") + 1455 # don't restore from ebp + 1456 81 0/subop/add %esp 8/imm32 + 1457 # . epilogue + 1458 5d/pop-to-ebp + 1459 c3/return + 1460 + 1461 test-convert-return-with-duplicate-values: + 1462 # . prologue + 1463 55/push-ebp + 1464 89/<- %ebp 4/r32/esp + 1465 # setup + 1466 (clear-stream _test-input-stream) + 1467 (clear-stream $_test-input-buffered-file->buffer) + 1468 (clear-stream _test-output-stream) + 1469 (clear-stream $_test-output-buffered-file->buffer) + 1470 # + 1471 (write _test-input-stream "fn foo -> _/eax: int, _/ecx: int {\n") + 1472 (write _test-input-stream " var x/eax: int <- copy 0x34\n") + 1473 (write _test-input-stream " return x, x\n") + 1474 (write _test-input-stream "}\n") + 1475 # convert + 1476 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1477 (flush _test-output-buffered-file) + 1478 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1484 # check output + 1485 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-return-with-duplicate-values/0") + 1486 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-return-with-duplicate-values/1") + 1487 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-return-with-duplicate-values/2") + 1488 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-return-with-duplicate-values/3") + 1489 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-return-with-duplicate-values/4") + 1490 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-return-with-duplicate-values/5") + 1491 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-return-with-duplicate-values/6") + 1492 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0x34/imm32" "F - test-convert-return-with-duplicate-values/7") + 1493 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-return-with-duplicate-values/8") + 1494 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000001/r32" "F - test-convert-return-with-duplicate-values/9") + 1495 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-return-with-duplicate-values/10") + 1496 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-return-with-duplicate-values/11") + 1497 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-return-with-duplicate-values/12") + 1498 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-return-with-duplicate-values/13") + 1499 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-return-with-duplicate-values/14") + 1500 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-return-with-duplicate-values/15") + 1501 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-return-with-duplicate-values/16") + 1502 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-return-with-duplicate-values/17") + 1503 # . epilogue + 1504 89/<- %esp 5/r32/ebp + 1505 5d/pop-to-ebp + 1506 c3/return + 1507 + 1508 test-convert-return-with-duplicate-values-2: + 1509 # . prologue + 1510 55/push-ebp + 1511 89/<- %ebp 4/r32/esp + 1512 # setup + 1513 (clear-stream _test-input-stream) + 1514 (clear-stream $_test-input-buffered-file->buffer) + 1515 (clear-stream _test-output-stream) + 1516 (clear-stream $_test-output-buffered-file->buffer) + 1517 # + 1518 (write _test-input-stream "fn foo -> _/eax: int, _/ecx: int {\n") + 1519 (write _test-input-stream " var x/ecx: int <- copy 0x34\n") + 1520 (write _test-input-stream " return x, x\n") + 1521 (write _test-input-stream "}\n") + 1522 # convert + 1523 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1524 (flush _test-output-buffered-file) + 1525 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1531 # check output + 1532 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-return-with-duplicate-values-2/0") + 1533 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-return-with-duplicate-values-2/1") + 1534 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-return-with-duplicate-values-2/2") + 1535 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-return-with-duplicate-values-2/3") + 1536 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-return-with-duplicate-values-2/4") + 1537 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-return-with-duplicate-values-2/5") + 1538 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-return-with-duplicate-values-2/6") + 1539 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x34/imm32" "F - test-convert-return-with-duplicate-values-2/7") + 1540 (check-next-stream-line-equal _test-output-stream " 8b/-> %ecx 0x00000000/r32" "F - test-convert-return-with-duplicate-values-2/8") + 1541 (check-next-stream-line-equal _test-output-stream " 8b/-> %ecx 0x00000001/r32" "F - test-convert-return-with-duplicate-values-2/9") + 1542 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-return-with-duplicate-values-2/10") + 1543 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-return-with-duplicate-values-2/11") + 1544 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-return-with-duplicate-values-2/12") + 1545 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-return-with-duplicate-values-2/13") + 1546 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-return-with-duplicate-values-2/14") + 1547 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-return-with-duplicate-values-2/15") + 1548 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-return-with-duplicate-values-2/16") + 1549 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-return-with-duplicate-values-2/17") + 1550 # . epilogue + 1551 89/<- %esp 5/r32/ebp + 1552 5d/pop-to-ebp + 1553 c3/return + 1554 + 1555 test-convert-function-with-literal-arg: + 1556 # . prologue + 1557 55/push-ebp + 1558 89/<- %ebp 4/r32/esp + 1559 # setup + 1560 (clear-stream _test-input-stream) + 1561 (clear-stream $_test-input-buffered-file->buffer) + 1562 (clear-stream _test-output-stream) + 1563 (clear-stream $_test-output-buffered-file->buffer) + 1564 # + 1565 (write _test-input-stream "fn foo a: int, b: int -> _/eax: int {\n") + 1566 (write _test-input-stream " var result/eax: int <- copy a\n") + 1567 (write _test-input-stream " result <- add 1\n") + 1568 (write _test-input-stream " return result\n") + 1569 (write _test-input-stream "}\n") + 1570 # convert + 1571 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1572 (flush _test-output-buffered-file) + 1573 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1579 # check output + 1580 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg/0") + 1581 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg/1") + 1582 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg/2") + 1583 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg/3") + 1584 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg/4") + 1585 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg/5") + 1586 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-literal-arg/6") + 1587 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-with-literal-arg/7") + 1588 (check-next-stream-line-equal _test-output-stream " 05/add-to-eax 1/imm32" "F - test-convert-function-with-literal-arg/8") + 1589 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-with-literal-arg/9") + 1590 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-literal-arg/10") + 1591 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-literal-arg/11") + 1592 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg/12") + 1593 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg/13") + 1594 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg/14") + 1595 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg/15") + 1596 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg/16") + 1597 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg/17") + 1598 # . epilogue + 1599 89/<- %esp 5/r32/ebp + 1600 5d/pop-to-ebp + 1601 c3/return + 1602 + 1603 test-convert-function-with-literal-arg-2: + 1604 # . prologue + 1605 55/push-ebp + 1606 89/<- %ebp 4/r32/esp + 1607 # setup + 1608 (clear-stream _test-input-stream) + 1609 (clear-stream $_test-input-buffered-file->buffer) + 1610 (clear-stream _test-output-stream) + 1611 (clear-stream $_test-output-buffered-file->buffer) + 1612 # + 1613 (write _test-input-stream "fn foo a: int, b: int -> _/ebx: int {\n") + 1614 (write _test-input-stream " var result/ebx: int <- copy a\n") + 1615 (write _test-input-stream " result <- add 1\n") + 1616 (write _test-input-stream " return result\n") + 1617 (write _test-input-stream "}\n") + 1618 # convert + 1619 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1620 (flush _test-output-buffered-file) + 1621 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1627 # check output + 1628 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-literal-arg-2/0") + 1629 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-literal-arg-2/1") + 1630 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-literal-arg-2/2") + 1631 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-literal-arg-2/3") + 1632 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-literal-arg-2/4") + 1633 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-literal-arg-2/5") + 1634 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-function-with-literal-arg-2/6") + 1635 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000003/r32" "F - test-convert-function-with-literal-arg-2/7") + 1636 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %ebx 1/imm32" "F - test-convert-function-with-literal-arg-2/8") + 1637 (check-next-stream-line-equal _test-output-stream " 8b/-> %ebx 0x00000003/r32" "F - test-convert-function-with-literal-arg-2/9") + 1638 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-literal-arg-2/10") + 1639 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-literal-arg-2/11") + 1640 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-literal-arg-2/12") + 1641 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-literal-arg-2/13") + 1642 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-literal-arg-2/14") + 1643 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-literal-arg-2/15") + 1644 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-literal-arg-2/16") + 1645 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-literal-arg-2/17") + 1646 # . epilogue + 1647 89/<- %esp 5/r32/ebp + 1648 5d/pop-to-ebp + 1649 c3/return + 1650 + 1651 test-convert-function-call-with-literal-arg: + 1652 # . prologue + 1653 55/push-ebp + 1654 89/<- %ebp 4/r32/esp + 1655 # setup + 1656 (clear-stream _test-input-stream) + 1657 (clear-stream $_test-input-buffered-file->buffer) + 1658 (clear-stream _test-output-stream) + 1659 (clear-stream $_test-output-buffered-file->buffer) + 1660 # + 1661 (write _test-input-stream "fn main -> _/ebx: int {\n") + 1662 (write _test-input-stream " var result/eax: int <- do-add 3 4\n") + 1663 (write _test-input-stream " return result\n") + 1664 (write _test-input-stream "}\n") + 1665 (write _test-input-stream "fn do-add a: int, b: int -> _/eax: int {\n") + 1666 (write _test-input-stream " var result/eax: int <- copy a\n") + 1667 (write _test-input-stream " result <- add b\n") + 1668 (write _test-input-stream " return result\n") + 1669 (write _test-input-stream "}\n") + 1670 # convert + 1671 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1672 (flush _test-output-buffered-file) + 1673 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1679 # check output + 1680 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-literal-arg/0") + 1681 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/1") + 1682 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/2") + 1683 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/3") + 1684 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/4") + 1685 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call-with-literal-arg/5") + 1686 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-literal-arg/6") + 1687 (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-literal-arg/7") + 1688 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") + 1689 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-local-var-in-reg/9") + 1690 (check-next-stream-line-equal _test-output-stream " e9/jump $main:0x00000001:break/disp32" "F - test-convert-function-call-with-literal-arg/10") + 1691 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/11") + 1692 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call-with-literal-arg/12") + 1693 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/13") + 1694 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/14") + 1695 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/15") + 1696 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/16") + 1697 (check-next-stream-line-equal _test-output-stream "do-add:" "F - test-convert-function-call-with-literal-arg/17") + 1698 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-literal-arg/18") + 1699 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-literal-arg/19") + 1700 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-literal-arg/20") + 1701 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-literal-arg/21") + 1702 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:loop:" "F - test-convert-function-call-with-literal-arg/22") + 1703 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-literal-arg/23") + 1704 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-call-with-literal-arg/24") + 1705 (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0x0000000c) 0x00000000/r32" "F - test-convert-function-call-with-literal-arg/25") + 1706 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-call-with-literal-arg/26") + 1707 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-call-with-literal-arg/27") + 1708 (check-next-stream-line-equal _test-output-stream " e9/jump $do-add:0x00000002:break/disp32" "F - test-convert-function-call-with-literal-arg/28") + 1709 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-literal-arg/29") + 1710 (check-next-stream-line-equal _test-output-stream "$do-add:0x00000002:break:" "F - test-convert-function-call-with-literal-arg/30") + 1711 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-literal-arg/31") + 1712 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-literal-arg/32") + 1713 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-literal-arg/33") + 1714 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-literal-arg/34") 1715 # . epilogue - 1716 5d/pop-to-ebp - 1717 c3/return - 1718 - 1719 test-local-var-in-mem-has-no-initializer: - 1720 # . prologue - 1721 55/push-ebp - 1722 89/<- %ebp 4/r32/esp - 1723 # setup - 1724 (clear-stream _test-input-stream) - 1725 (clear-stream $_test-input-buffered-file->buffer) - 1726 (clear-stream _test-output-stream) - 1727 (clear-stream $_test-output-buffered-file->buffer) - 1728 (clear-stream _test-error-stream) - 1729 (clear-stream $_test-error-buffered-file->buffer) - 1730 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1731 68/push 0/imm32 - 1732 68/push 0/imm32 - 1733 89/<- %edx 4/r32/esp - 1734 (tailor-exit-descriptor %edx 0x10) - 1735 # - 1736 (write _test-input-stream "fn foo {\n") - 1737 (write _test-input-stream " var x: int <- copy 0\n") - 1738 (write _test-input-stream " increment x\n") - 1739 (write _test-input-stream "}\n") - 1740 # convert - 1741 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1742 # registers except esp clobbered at this point - 1743 # restore ed - 1744 89/<- %edx 4/r32/esp - 1745 (flush _test-output-buffered-file) - 1746 (flush _test-error-buffered-file) - 1747 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1753 # check output - 1754 (check-stream-equal _test-output-stream "" "F - test-var-in-mem-has-no-initializer: output should be empty") - 1755 (check-next-stream-line-equal _test-error-stream "fn foo: var x: variables on the stack can't take an initializer" "F - test-var-in-mem-has-no-initializer: error message") - 1756 # check that stop(1) was called - 1757 (check-ints-equal *(edx+4) 2 "F - test-var-in-mem-has-no-initializer: exit status") - 1758 # don't restore from ebp - 1759 81 0/subop/add %esp 8/imm32 - 1760 # . epilogue - 1761 5d/pop-to-ebp - 1762 c3/return - 1763 - 1764 test-convert-function-with-local-var-with-compound-type-in-mem: - 1765 # . prologue - 1766 55/push-ebp - 1767 89/<- %ebp 4/r32/esp - 1768 # setup - 1769 (clear-stream _test-input-stream) - 1770 (clear-stream $_test-input-buffered-file->buffer) - 1771 (clear-stream _test-output-stream) - 1772 (clear-stream $_test-output-buffered-file->buffer) - 1773 # - 1774 (write _test-input-stream "fn foo {\n") - 1775 (write _test-input-stream " var x: (addr int)\n") - 1776 (write _test-input-stream " copy-to x, 0\n") - 1777 (write _test-input-stream "}\n") - 1778 # convert - 1779 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1780 (flush _test-output-buffered-file) - 1781 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 1787 # check output - 1788 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/0") - 1789 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/1") - 1790 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/2") - 1791 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/3") - 1792 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-compound-type-in-mem/4") - 1793 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/5") - 1794 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-compound-type-in-mem/6") - 1795 (check-next-stream-line-equal _test-output-stream " c7 0/subop/copy *(ebp+0xfffffffc) 0/imm32" "F - test-convert-function-with-local-var-with-compound-type-in-mem/7") - 1796 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-with-compound-type-in-mem/8") - 1797 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-compound-type-in-mem/9") - 1798 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/10") - 1799 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/11") - 1800 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/12") - 1801 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/13") - 1802 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-compound-type-in-mem/14") - 1803 # . epilogue - 1804 89/<- %esp 5/r32/ebp - 1805 5d/pop-to-ebp - 1806 c3/return - 1807 - 1808 test-convert-function-with-local-var-in-reg: - 1809 # . prologue - 1810 55/push-ebp - 1811 89/<- %ebp 4/r32/esp - 1812 # setup - 1813 (clear-stream _test-input-stream) - 1814 (clear-stream $_test-input-buffered-file->buffer) - 1815 (clear-stream _test-output-stream) - 1816 (clear-stream $_test-output-buffered-file->buffer) - 1817 # - 1818 (write _test-input-stream "fn foo {\n") - 1819 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 1820 (write _test-input-stream " x <- increment\n") - 1821 (write _test-input-stream "}\n") - 1822 # convert - 1823 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1824 (flush _test-output-buffered-file) - 1825 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 1831 # check output - 1832 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-reg/0") - 1833 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-reg/1") - 1834 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-reg/2") - 1835 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-reg/3") - 1836 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-reg/4") - 1837 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-reg/5") - 1838 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-in-reg/6") - 1839 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-local-var-in-reg/7") - 1840 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-local-var-in-reg/8") - 1841 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-in-reg/9") - 1842 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-reg/10") - 1843 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-reg/11") - 1844 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-reg/12") - 1845 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-reg/13") - 1846 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-reg/14") - 1847 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-reg/15") - 1848 # . epilogue - 1849 89/<- %esp 5/r32/ebp - 1850 5d/pop-to-ebp - 1851 c3/return - 1852 - 1853 test-convert-function-with-allocate: - 1854 # . prologue - 1855 55/push-ebp - 1856 89/<- %ebp 4/r32/esp - 1857 # setup - 1858 (clear-stream _test-input-stream) - 1859 (clear-stream $_test-input-buffered-file->buffer) - 1860 (clear-stream _test-output-stream) - 1861 (clear-stream $_test-output-buffered-file->buffer) - 1862 # - 1863 (write _test-input-stream "fn foo {\n") - 1864 (write _test-input-stream " var x/ecx: (addr handle int) <- copy 0\n") - 1865 (write _test-input-stream " allocate x\n") - 1866 (write _test-input-stream "}\n") - 1867 # convert - 1868 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1869 (flush _test-output-buffered-file) - 1870 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 1876 # check output - 1877 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-allocate/0") - 1878 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-allocate/1") - 1879 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-allocate/2") - 1880 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-allocate/3") - 1881 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-allocate/4") - 1882 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-allocate/5") - 1883 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-allocate/6") - 1884 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-allocate/7") - 1885 (check-next-stream-line-equal _test-output-stream " (allocate Heap 0x00000004 %ecx)" "F - test-convert-function-with-allocate/8") # 4 = size-of(int) - 1886 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-allocate/9") - 1887 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-allocate/10") - 1888 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-allocate/11") - 1889 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-allocate/12") - 1890 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-allocate/13") - 1891 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-allocate/14") - 1892 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-allocate/15") - 1893 # . epilogue - 1894 89/<- %esp 5/r32/ebp - 1895 5d/pop-to-ebp - 1896 c3/return - 1897 - 1898 test-initializer-in-hex: - 1899 # . prologue - 1900 55/push-ebp - 1901 89/<- %ebp 4/r32/esp - 1902 # setup - 1903 (clear-stream _test-input-stream) - 1904 (clear-stream $_test-input-buffered-file->buffer) - 1905 (clear-stream _test-output-stream) - 1906 (clear-stream $_test-output-buffered-file->buffer) - 1907 (clear-stream _test-error-stream) - 1908 (clear-stream $_test-error-buffered-file->buffer) - 1909 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 1910 68/push 0/imm32 - 1911 68/push 0/imm32 - 1912 89/<- %edx 4/r32/esp - 1913 (tailor-exit-descriptor %edx 0x10) - 1914 # - 1915 (write _test-input-stream "fn foo {\n") - 1916 (write _test-input-stream " var x/ecx: int <- copy 10\n") - 1917 (write _test-input-stream "}\n") - 1918 # convert - 1919 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 1920 # registers except esp clobbered at this point - 1921 # restore ed - 1922 89/<- %edx 4/r32/esp - 1923 (flush _test-output-buffered-file) - 1924 (flush _test-error-buffered-file) - 1925 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 1931 # check output - 1932 (check-stream-equal _test-output-stream "" "F - test-initializer-in-hex: output should be empty") - 1933 (check-next-stream-line-equal _test-error-stream "literal integers are always hex in Mu; start '10' with a '0x' to be unambiguous, converting it to hexadecimal as necessary." "F - test-initializer-in-hex: error message") - 1934 # check that stop(1) was called - 1935 (check-ints-equal *(edx+4) 2 "F - test-initializer-in-hex: exit status") - 1936 # don't restore from ebp - 1937 81 0/subop/add %esp 8/imm32 - 1938 # . epilogue - 1939 5d/pop-to-ebp - 1940 c3/return - 1941 - 1942 test-convert-function-with-second-local-var-in-same-reg: - 1943 # . prologue - 1944 55/push-ebp - 1945 89/<- %ebp 4/r32/esp - 1946 # setup - 1947 (clear-stream _test-input-stream) - 1948 (clear-stream $_test-input-buffered-file->buffer) - 1949 (clear-stream _test-output-stream) - 1950 (clear-stream $_test-output-buffered-file->buffer) - 1951 # - 1952 (write _test-input-stream "fn foo {\n") - 1953 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 1954 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 1955 (write _test-input-stream " y <- increment\n") - 1956 (write _test-input-stream "}\n") - 1957 # convert - 1958 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 1959 (flush _test-output-buffered-file) - 1960 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 1966 # check output - 1967 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-second-local-var-in-same-reg/0") - 1968 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-second-local-var-in-same-reg/1") - 1969 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/2") - 1970 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-second-local-var-in-same-reg/3") - 1971 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-second-local-var-in-same-reg/4") - 1972 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-second-local-var-in-same-reg/5") - 1973 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-second-local-var-in-same-reg/6") - 1974 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-second-local-var-in-same-reg/7") - 1975 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-convert-function-with-second-local-var-in-same-reg/8") - 1976 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-second-local-var-in-same-reg/9") - 1977 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-second-local-var-in-same-reg/10") - 1978 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-second-local-var-in-same-reg/11") - 1979 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-second-local-var-in-same-reg/12") - 1980 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-second-local-var-in-same-reg/13") - 1981 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-second-local-var-in-same-reg/14") - 1982 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/15") - 1983 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-second-local-var-in-same-reg/16") - 1984 # . epilogue - 1985 89/<- %esp 5/r32/ebp - 1986 5d/pop-to-ebp - 1987 c3/return - 1988 - 1989 test-read-clobbered-reg-var: - 1990 # . prologue - 1991 55/push-ebp - 1992 89/<- %ebp 4/r32/esp - 1993 # setup - 1994 (clear-stream _test-input-stream) - 1995 (clear-stream $_test-input-buffered-file->buffer) - 1996 (clear-stream _test-output-stream) - 1997 (clear-stream $_test-output-buffered-file->buffer) - 1998 (clear-stream _test-error-stream) - 1999 (clear-stream $_test-error-buffered-file->buffer) - 2000 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) # bytes of args in call to convert-mu - 2001 68/push 0/imm32 - 2002 68/push 0/imm32 - 2003 89/<- %edx 4/r32/esp - 2004 (tailor-exit-descriptor %edx 0x10) - 2005 # - 2006 (write _test-input-stream "fn foo {\n") - 2007 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 2008 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 2009 (write _test-input-stream " x <- increment\n") - 2010 (write _test-input-stream "}\n") - 2011 # convert - 2012 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2013 # registers except esp clobbered at this point - 2014 # restore ed - 2015 89/<- %edx 4/r32/esp - 2016 (flush _test-output-buffered-file) - 2017 (flush _test-error-buffered-file) - 2018 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2024 # check output - 2025 (check-stream-equal _test-output-stream "" "F - test-read-clobbered-reg-var: output should be empty") - 2026 (check-next-stream-line-equal _test-error-stream "fn foo: register ecx reads var 'x' after writing var 'y'" "F - test-read-clobbered-reg-var: error message") - 2027 # check that stop(1) was called - 2028 (check-ints-equal *(edx+4) 2 "F - test-read-clobbered-reg-var: exit status") - 2029 # don't restore from ebp - 2030 81 0/subop/add %esp 8/imm32 - 2031 # . epilogue + 1716 89/<- %esp 5/r32/ebp + 1717 5d/pop-to-ebp + 1718 c3/return + 1719 + 1720 test-convert-function-call-with-literal-string-arg: + 1721 # . prologue + 1722 55/push-ebp + 1723 89/<- %ebp 4/r32/esp + 1724 # setup + 1725 (clear-stream _test-input-stream) + 1726 (clear-stream $_test-input-buffered-file->buffer) + 1727 (clear-stream _test-output-stream) + 1728 (clear-stream $_test-output-buffered-file->buffer) + 1729 # + 1730 (write _test-input-stream "fn foo {\n") + 1731 (write _test-input-stream " string-func \"abc\"\n") + 1732 (write _test-input-stream "}\n") + 1733 (write _test-input-stream "sig string-func in: (addr array byte)\n") + 1734 # convert + 1735 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1736 # no errors + 1737 # not bothering checking output + 1738 # . epilogue + 1739 89/<- %esp 5/r32/ebp + 1740 5d/pop-to-ebp + 1741 c3/return + 1742 + 1743 test-convert-function-call-with-null-addr: + 1744 # . prologue + 1745 55/push-ebp + 1746 89/<- %ebp 4/r32/esp + 1747 # setup + 1748 (clear-stream _test-input-stream) + 1749 (clear-stream $_test-input-buffered-file->buffer) + 1750 (clear-stream _test-output-stream) + 1751 (clear-stream $_test-output-buffered-file->buffer) + 1752 # + 1753 (write _test-input-stream "fn foo {\n") + 1754 (write _test-input-stream " bar 0\n") + 1755 (write _test-input-stream "}\n") + 1756 (write _test-input-stream "sig bar in: (addr int)\n") + 1757 # convert + 1758 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1759 # no errors + 1760 # not bothering checking output + 1761 # . epilogue + 1762 89/<- %esp 5/r32/ebp + 1763 5d/pop-to-ebp + 1764 c3/return + 1765 + 1766 test-convert-function-call-with-signature: + 1767 # . prologue + 1768 55/push-ebp + 1769 89/<- %ebp 4/r32/esp + 1770 # setup + 1771 (clear-stream _test-input-stream) + 1772 (clear-stream $_test-input-buffered-file->buffer) + 1773 (clear-stream _test-output-stream) + 1774 (clear-stream $_test-output-buffered-file->buffer) + 1775 # + 1776 (write _test-input-stream "fn main -> _/ebx: int {\n") + 1777 (write _test-input-stream " var result/eax: int <- do-add 3 4\n") + 1778 (write _test-input-stream " return result\n") + 1779 (write _test-input-stream "}\n") + 1780 (write _test-input-stream "sig do-add a: int, b: int -> _/eax: int\n") + 1781 # convert + 1782 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1783 (flush _test-output-buffered-file) + 1784 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1790 # check output + 1791 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call-with-signature/0") + 1792 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-signature/1") + 1793 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-signature/2") + 1794 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-signature/3") + 1795 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-signature/4") + 1796 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call-with-signature/5") + 1797 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-literal-arg/6") + 1798 (check-next-stream-line-equal _test-output-stream " (do-add 3 4)" "F - test-convert-function-call-with-signature/6") + 1799 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") + 1800 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-local-var-in-reg/9") + 1801 (check-next-stream-line-equal _test-output-stream " e9/jump $main:0x00000001:break/disp32" "F - test-convert-function-call-with-literal-arg/10") + 1802 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-signature/7") + 1803 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call-with-signature/8") + 1804 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-signature/9") + 1805 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-signature/10") + 1806 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-signature/11") + 1807 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-signature/12") + 1808 # . epilogue + 1809 89/<- %esp 5/r32/ebp + 1810 5d/pop-to-ebp + 1811 c3/return + 1812 + 1813 test-convert-function-with-local-var-in-mem: + 1814 # . prologue + 1815 55/push-ebp + 1816 89/<- %ebp 4/r32/esp + 1817 # setup + 1818 (clear-stream _test-input-stream) + 1819 (clear-stream $_test-input-buffered-file->buffer) + 1820 (clear-stream _test-output-stream) + 1821 (clear-stream $_test-output-buffered-file->buffer) + 1822 # + 1823 (write _test-input-stream "fn foo {\n") + 1824 (write _test-input-stream " var x: int\n") + 1825 (write _test-input-stream " increment x\n") + 1826 (write _test-input-stream "}\n") + 1827 # convert + 1828 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1829 (flush _test-output-buffered-file) + 1830 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1836 # check output + 1837 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem/0") + 1838 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem/1") + 1839 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem/2") + 1840 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-mem/3") + 1841 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem/4") + 1842 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-mem/5") + 1843 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem/6") + 1844 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-mem/7") + 1845 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-mem/8") + 1846 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem/9") + 1847 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-mem/10") + 1848 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem/11") + 1849 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-mem/12") + 1850 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem/13") + 1851 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem/14") + 1852 # . epilogue + 1853 89/<- %esp 5/r32/ebp + 1854 5d/pop-to-ebp + 1855 c3/return + 1856 + 1857 test-convert-invalid-literal: + 1858 # . prologue + 1859 55/push-ebp + 1860 89/<- %ebp 4/r32/esp + 1861 # setup + 1862 (clear-stream _test-input-stream) + 1863 (clear-stream $_test-input-buffered-file->buffer) + 1864 (clear-stream _test-output-stream) + 1865 (clear-stream $_test-output-buffered-file->buffer) + 1866 (clear-stream _test-error-stream) + 1867 (clear-stream $_test-error-buffered-file->buffer) + 1868 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1869 68/push 0/imm32 + 1870 68/push 0/imm32 + 1871 89/<- %edx 4/r32/esp + 1872 (tailor-exit-descriptor %edx 0x10) + 1873 # + 1874 (write _test-input-stream "fn foo {\n") + 1875 (write _test-input-stream " increment 1n\n") + 1876 (write _test-input-stream "}\n") + 1877 # convert + 1878 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1879 # registers except esp clobbered at this point + 1880 # restore ed + 1881 89/<- %edx 4/r32/esp + 1882 (flush _test-output-buffered-file) + 1883 (flush _test-error-buffered-file) + 1884 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1890 # check output + 1891 (check-stream-equal _test-output-stream "" "F - test-convert-invalid-literal: output should be empty") + 1892 (check-next-stream-line-equal _test-error-stream "fn foo: variable '1n' cannot begin with a digit (or do you have a typo in a number?)" "F - test-convert-invalid-literal: error message") + 1893 # check that stop(1) was called + 1894 (check-ints-equal *(edx+4) 2 "F - test-convert-invalid-literal: exit status") + 1895 # don't restore from ebp + 1896 81 0/subop/add %esp 8/imm32 + 1897 # . epilogue + 1898 5d/pop-to-ebp + 1899 c3/return + 1900 + 1901 test-local-var-in-mem-has-no-initializer: + 1902 # . prologue + 1903 55/push-ebp + 1904 89/<- %ebp 4/r32/esp + 1905 # setup + 1906 (clear-stream _test-input-stream) + 1907 (clear-stream $_test-input-buffered-file->buffer) + 1908 (clear-stream _test-output-stream) + 1909 (clear-stream $_test-output-buffered-file->buffer) + 1910 (clear-stream _test-error-stream) + 1911 (clear-stream $_test-error-buffered-file->buffer) + 1912 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 1913 68/push 0/imm32 + 1914 68/push 0/imm32 + 1915 89/<- %edx 4/r32/esp + 1916 (tailor-exit-descriptor %edx 0x10) + 1917 # + 1918 (write _test-input-stream "fn foo {\n") + 1919 (write _test-input-stream " var x: int <- copy 0\n") + 1920 (write _test-input-stream " increment x\n") + 1921 (write _test-input-stream "}\n") + 1922 # convert + 1923 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 1924 # registers except esp clobbered at this point + 1925 # restore ed + 1926 89/<- %edx 4/r32/esp + 1927 (flush _test-output-buffered-file) + 1928 (flush _test-error-buffered-file) + 1929 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1935 # check output + 1936 (check-stream-equal _test-output-stream "" "F - test-var-in-mem-has-no-initializer: output should be empty") + 1937 (check-next-stream-line-equal _test-error-stream "fn foo: var x: variables on the stack can't take an initializer" "F - test-var-in-mem-has-no-initializer: error message") + 1938 # check that stop(1) was called + 1939 (check-ints-equal *(edx+4) 2 "F - test-var-in-mem-has-no-initializer: exit status") + 1940 # don't restore from ebp + 1941 81 0/subop/add %esp 8/imm32 + 1942 # . epilogue + 1943 5d/pop-to-ebp + 1944 c3/return + 1945 + 1946 test-convert-function-with-local-var-with-compound-type-in-mem: + 1947 # . prologue + 1948 55/push-ebp + 1949 89/<- %ebp 4/r32/esp + 1950 # setup + 1951 (clear-stream _test-input-stream) + 1952 (clear-stream $_test-input-buffered-file->buffer) + 1953 (clear-stream _test-output-stream) + 1954 (clear-stream $_test-output-buffered-file->buffer) + 1955 # + 1956 (write _test-input-stream "fn foo {\n") + 1957 (write _test-input-stream " var x: (addr int)\n") + 1958 (write _test-input-stream " copy-to x, 0\n") + 1959 (write _test-input-stream "}\n") + 1960 # convert + 1961 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 1962 (flush _test-output-buffered-file) + 1963 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 1969 # check output + 1970 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/0") + 1971 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/1") + 1972 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/2") + 1973 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/3") + 1974 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-compound-type-in-mem/4") + 1975 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/5") + 1976 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-compound-type-in-mem/6") + 1977 (check-next-stream-line-equal _test-output-stream " c7 0/subop/copy *(ebp+0xfffffffc) 0/imm32" "F - test-convert-function-with-local-var-with-compound-type-in-mem/7") + 1978 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-with-compound-type-in-mem/8") + 1979 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-compound-type-in-mem/9") + 1980 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-compound-type-in-mem/10") + 1981 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-compound-type-in-mem/11") + 1982 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/12") + 1983 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-compound-type-in-mem/13") + 1984 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-compound-type-in-mem/14") + 1985 # . epilogue + 1986 89/<- %esp 5/r32/ebp + 1987 5d/pop-to-ebp + 1988 c3/return + 1989 + 1990 test-convert-function-with-local-var-in-reg: + 1991 # . prologue + 1992 55/push-ebp + 1993 89/<- %ebp 4/r32/esp + 1994 # setup + 1995 (clear-stream _test-input-stream) + 1996 (clear-stream $_test-input-buffered-file->buffer) + 1997 (clear-stream _test-output-stream) + 1998 (clear-stream $_test-output-buffered-file->buffer) + 1999 # + 2000 (write _test-input-stream "fn foo {\n") + 2001 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 2002 (write _test-input-stream " x <- increment\n") + 2003 (write _test-input-stream "}\n") + 2004 # convert + 2005 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2006 (flush _test-output-buffered-file) + 2007 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2013 # check output + 2014 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-reg/0") + 2015 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-reg/1") + 2016 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-reg/2") + 2017 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-reg/3") + 2018 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-reg/4") + 2019 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-reg/5") + 2020 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-in-reg/6") + 2021 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-local-var-in-reg/7") + 2022 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-local-var-in-reg/8") + 2023 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-in-reg/9") + 2024 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-reg/10") + 2025 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-reg/11") + 2026 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-reg/12") + 2027 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-reg/13") + 2028 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-reg/14") + 2029 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-reg/15") + 2030 # . epilogue + 2031 89/<- %esp 5/r32/ebp 2032 5d/pop-to-ebp 2033 c3/return 2034 - 2035 test-overlapping-int-fp-registers: + 2035 test-convert-function-with-allocate: 2036 # . prologue 2037 55/push-ebp 2038 89/<- %ebp 4/r32/esp @@ -1938,310 +1943,310 @@ if ('onhashchange' in window) { 2041 (clear-stream $_test-input-buffered-file->buffer) 2042 (clear-stream _test-output-stream) 2043 (clear-stream $_test-output-buffered-file->buffer) - 2044 (clear-stream _test-error-stream) - 2045 (clear-stream $_test-error-buffered-file->buffer) - 2046 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) # bytes of args in call to convert-mu - 2047 68/push 0/imm32 - 2048 68/push 0/imm32 - 2049 89/<- %edx 4/r32/esp - 2050 (tailor-exit-descriptor %edx 0x10) - 2051 # - 2052 (write _test-input-stream "fn foo {\n") - 2053 (write _test-input-stream " var x/eax: int <- copy 3\n") - 2054 (write _test-input-stream " var y/xmm0: float <- convert x\n") - 2055 (write _test-input-stream " x <- increment\n") - 2056 (write _test-input-stream "}\n") - 2057 # convert - 2058 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2059 # registers except esp clobbered at this point - 2060 # restore ed - 2061 89/<- %edx 4/r32/esp - 2062 (flush _test-output-buffered-file) - 2063 (flush _test-error-buffered-file) - 2064 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2070 # no errors - 2071 (check-next-stream-line-equal _test-error-stream "" "F - test-overlapping-int-fp-registers: error message") - 2072 # don't bother checking the generated code - 2073 # don't restore from ebp - 2074 81 0/subop/add %esp 8/imm32 + 2044 # + 2045 (write _test-input-stream "fn foo {\n") + 2046 (write _test-input-stream " var x/ecx: (addr handle int) <- copy 0\n") + 2047 (write _test-input-stream " allocate x\n") + 2048 (write _test-input-stream "}\n") + 2049 # convert + 2050 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2051 (flush _test-output-buffered-file) + 2052 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2058 # check output + 2059 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-allocate/0") + 2060 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-allocate/1") + 2061 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-allocate/2") + 2062 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-allocate/3") + 2063 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-allocate/4") + 2064 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-allocate/5") + 2065 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-allocate/6") + 2066 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-allocate/7") + 2067 (check-next-stream-line-equal _test-output-stream " (allocate Heap 0x00000004 %ecx)" "F - test-convert-function-with-allocate/8") # 4 = size-of(int) + 2068 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-allocate/9") + 2069 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-allocate/10") + 2070 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-allocate/11") + 2071 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-allocate/12") + 2072 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-allocate/13") + 2073 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-allocate/14") + 2074 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-allocate/15") 2075 # . epilogue - 2076 5d/pop-to-ebp - 2077 c3/return - 2078 - 2079 test-convert-function-call: - 2080 # . prologue - 2081 55/push-ebp - 2082 89/<- %ebp 4/r32/esp - 2083 # setup - 2084 (clear-stream _test-input-stream) - 2085 (clear-stream $_test-input-buffered-file->buffer) - 2086 (clear-stream _test-output-stream) - 2087 (clear-stream $_test-output-buffered-file->buffer) - 2088 # - 2089 (write _test-input-stream "fn main -> _/ebx: int {\n") - 2090 (write _test-input-stream " var result/ebx: int <- foo\n") - 2091 (write _test-input-stream " return result\n") - 2092 (write _test-input-stream "}\n") - 2093 (write _test-input-stream "fn foo -> _/ebx: int {\n") - 2094 (write _test-input-stream " var result/ebx: int <- copy 3\n") - 2095 (write _test-input-stream " return result\n") - 2096 (write _test-input-stream "}\n") - 2097 # convert - 2098 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2099 (flush _test-output-buffered-file) - 2100 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 2106 # check output - 2107 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call/0") - 2108 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call/1") - 2109 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call/2") - 2110 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call/3") - 2111 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call/4") - 2112 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call/5") - 2113 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-function-call-with-literal-arg/6") - 2114 (check-next-stream-line-equal _test-output-stream " (foo)" "F - test-convert-function-call/6") - 2115 (check-next-stream-line-equal _test-output-stream " 8b/-> %ebx 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") - 2116 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-call-with-literal-arg/27") - 2117 (check-next-stream-line-equal _test-output-stream " e9/jump $main:0x00000001:break/disp32" "F - test-convert-function-call-with-literal-arg/10") - 2118 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call/7") - 2119 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call/8") - 2120 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call/9") - 2121 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call/10") - 2122 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call/11") - 2123 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call/12") - 2124 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call/13") - 2125 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call/14") - 2126 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call/15") - 2127 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call/16") - 2128 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call/17") - 2129 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-call/18") - 2130 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-function-call-with-literal-arg/6") - 2131 (check-next-stream-line-equal _test-output-stream " bb/copy-to-ebx 3/imm32" "F - test-convert-function-call/19") - 2132 (check-next-stream-line-equal _test-output-stream " 8b/-> %ebx 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") - 2133 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-call-with-literal-arg/27") - 2134 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-call-with-literal-arg/10") - 2135 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call/20") - 2136 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-call/21") - 2137 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call/22") - 2138 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call/23") - 2139 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call/24") - 2140 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call/25") - 2141 # . epilogue - 2142 89/<- %esp 5/r32/ebp - 2143 5d/pop-to-ebp - 2144 c3/return - 2145 - 2146 test-convert-function-call-with-inout-with-compound-type: - 2147 # . prologue - 2148 55/push-ebp - 2149 89/<- %ebp 4/r32/esp - 2150 # setup - 2151 (clear-stream _test-input-stream) - 2152 (clear-stream $_test-input-buffered-file->buffer) - 2153 (clear-stream _test-output-stream) - 2154 (clear-stream $_test-output-buffered-file->buffer) - 2155 # - 2156 (write _test-input-stream "fn f {\n") - 2157 (write _test-input-stream " var x: (addr int)\n") - 2158 (write _test-input-stream " g x\n") - 2159 (write _test-input-stream "}\n") - 2160 (write _test-input-stream "fn g a: (addr int) {\n") - 2161 (write _test-input-stream "}\n") - 2162 # convert - 2163 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2164 (flush _test-output-buffered-file) - 2165 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 2171 # check output - 2172 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-inout-with-compound-type/0") - 2173 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-inout-with-compound-type/1") - 2174 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-inout-with-compound-type/2") - 2175 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-inout-with-compound-type/3") - 2176 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-inout-with-compound-type/4") - 2177 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-inout-with-compound-type/5") - 2178 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-inout-with-compound-type/6") - 2179 (check-next-stream-line-equal _test-output-stream " (g *(ebp+0xfffffffc))" "F - test-convert-function-call-with-inout-with-compound-type/7") - 2180 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-call-with-inout-with-compound-type/8") - 2181 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-inout-with-compound-type/9") - 2182 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-inout-with-compound-type/10") - 2183 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-inout-with-compound-type/11") - 2184 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-inout-with-compound-type/12") - 2185 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-inout-with-compound-type/13") - 2186 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-inout-with-compound-type/14") - 2187 (check-next-stream-line-equal _test-output-stream "g:" "F - test-convert-function-call-with-inout-with-compound-type/15") - 2188 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-inout-with-compound-type/16") - 2189 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-inout-with-compound-type/17") - 2190 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-inout-with-compound-type/18") - 2191 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-inout-with-compound-type/19") - 2192 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-inout-with-compound-type/20") - 2193 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-inout-with-compound-type/21") - 2194 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-inout-with-compound-type/22") - 2195 # . epilogue - 2196 89/<- %esp 5/r32/ebp - 2197 5d/pop-to-ebp - 2198 c3/return - 2199 - 2200 test-convert-function-call-with-inout-with-type-parameter: - 2201 # . prologue - 2202 55/push-ebp - 2203 89/<- %ebp 4/r32/esp - 2204 # setup - 2205 (clear-stream _test-input-stream) - 2206 (clear-stream $_test-input-buffered-file->buffer) - 2207 (clear-stream _test-output-stream) - 2208 (clear-stream $_test-output-buffered-file->buffer) - 2209 (clear-stream _test-error-stream) - 2210 (clear-stream $_test-error-buffered-file->buffer) - 2211 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 2212 68/push 0/imm32 - 2213 68/push 0/imm32 - 2214 89/<- %edx 4/r32/esp - 2215 (tailor-exit-descriptor %edx 0x10) - 2216 # - 2217 (write _test-input-stream "fn f {\n") - 2218 (write _test-input-stream " var x: (addr int)\n") - 2219 (write _test-input-stream " g x\n") - 2220 (write _test-input-stream "}\n") - 2221 (write _test-input-stream "fn g a: (addr _) {\n") - 2222 (write _test-input-stream "}\n") - 2223 # convert - 2224 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2225 # registers except esp clobbered at this point - 2226 # restore ed - 2227 89/<- %edx 4/r32/esp - 2228 (flush _test-output-buffered-file) - 2229 (flush _test-error-buffered-file) - 2230 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2236 # no error; types matched - 2237 (check-stream-equal _test-error-stream "" "F - test-convert-function-call-with-inout-with-type-parameter: error stream should be empty") - 2238 # don't bother checking the generated code; that's in the test 'test-local-clobbered-by-fn-output' below - 2239 # don't restore from ebp - 2240 81 0/subop/add %esp 8/imm32 - 2241 # . epilogue - 2242 5d/pop-to-ebp - 2243 c3/return - 2244 - 2245 test-convert-function-call-with-incorrect-inout-type: - 2246 # . prologue - 2247 55/push-ebp - 2248 89/<- %ebp 4/r32/esp - 2249 # setup - 2250 (clear-stream _test-input-stream) - 2251 (clear-stream $_test-input-buffered-file->buffer) - 2252 (clear-stream _test-output-stream) - 2253 (clear-stream $_test-output-buffered-file->buffer) - 2254 (clear-stream _test-error-stream) - 2255 (clear-stream $_test-error-buffered-file->buffer) - 2256 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 2257 68/push 0/imm32 - 2258 68/push 0/imm32 - 2259 89/<- %edx 4/r32/esp - 2260 (tailor-exit-descriptor %edx 0x10) - 2261 # - 2262 (write _test-input-stream "fn f {\n") - 2263 (write _test-input-stream " var x: int\n") - 2264 (write _test-input-stream " g x\n") - 2265 (write _test-input-stream "}\n") - 2266 (write _test-input-stream "fn g a: foo {\n") - 2267 (write _test-input-stream "}\n") - 2268 # convert - 2269 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2270 # registers except esp clobbered at this point - 2271 # restore ed - 2272 89/<- %edx 4/r32/esp - 2273 (flush _test-output-buffered-file) - 2274 (flush _test-error-buffered-file) - 2275 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2281 # check output - 2282 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-incorrect-inout-type: output should be empty") - 2283 (check-next-stream-line-equal _test-error-stream "fn f: call g: type for inout 'x' is not right" "F - test-convert-function-call-with-incorrect-inout-type: error message") - 2284 # check that stop(1) was called - 2285 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-incorrect-inout-type: exit status") - 2286 # don't restore from ebp - 2287 81 0/subop/add %esp 8/imm32 - 2288 5d/pop-to-ebp - 2289 c3/return - 2290 - 2291 test-convert-function-call-with-inout-with-incorrect-compound-type: - 2292 # . prologue - 2293 55/push-ebp - 2294 89/<- %ebp 4/r32/esp - 2295 # setup - 2296 (clear-stream _test-input-stream) - 2297 (clear-stream $_test-input-buffered-file->buffer) - 2298 (clear-stream _test-output-stream) - 2299 (clear-stream $_test-output-buffered-file->buffer) - 2300 (clear-stream _test-error-stream) - 2301 (clear-stream $_test-error-buffered-file->buffer) - 2302 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 2303 68/push 0/imm32 - 2304 68/push 0/imm32 - 2305 89/<- %edx 4/r32/esp - 2306 (tailor-exit-descriptor %edx 0x10) - 2307 # - 2308 (write _test-input-stream "fn f {\n") - 2309 (write _test-input-stream " var x: (addr int)\n") - 2310 (write _test-input-stream " g x\n") - 2311 (write _test-input-stream "}\n") - 2312 (write _test-input-stream "fn g a: (addr bool) {\n") - 2313 (write _test-input-stream "}\n") - 2314 # convert - 2315 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2316 # registers except esp clobbered at this point - 2317 # restore ed - 2318 89/<- %edx 4/r32/esp - 2319 (flush _test-output-buffered-file) - 2320 (flush _test-error-buffered-file) - 2321 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2327 # check output - 2328 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-inout-with-incorrect-compound-type: output should be empty") - 2329 (check-next-stream-line-equal _test-error-stream "fn f: call g: type for inout 'x' is not right" "F - test-convert-function-call-with-inout-with-incorrect-compound-type: error message") - 2330 # don't restore from ebp - 2331 81 0/subop/add %esp 8/imm32 - 2332 # . epilogue - 2333 5d/pop-to-ebp - 2334 c3/return - 2335 - 2336 test-convert-function-call-with-inout-with-multiple-type-parameters: - 2337 # . prologue - 2338 55/push-ebp - 2339 89/<- %ebp 4/r32/esp - 2340 # setup - 2341 (clear-stream _test-input-stream) - 2342 (clear-stream $_test-input-buffered-file->buffer) - 2343 (clear-stream _test-output-stream) - 2344 (clear-stream $_test-output-buffered-file->buffer) - 2345 (clear-stream _test-error-stream) - 2346 (clear-stream $_test-error-buffered-file->buffer) - 2347 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 2348 68/push 0/imm32 - 2349 68/push 0/imm32 - 2350 89/<- %edx 4/r32/esp - 2351 (tailor-exit-descriptor %edx 0x10) - 2352 # - 2353 (write _test-input-stream "fn f {\n") - 2354 (write _test-input-stream " var x: (addr int)\n") - 2355 (write _test-input-stream " var y: (addr int)\n") - 2356 (write _test-input-stream " g x, y\n") - 2357 (write _test-input-stream "}\n") - 2358 (write _test-input-stream "fn g a: (addr _), b: (addr _) {\n") - 2359 (write _test-input-stream "}\n") - 2360 # convert - 2361 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2362 # registers except esp clobbered at this point - 2363 # restore ed - 2364 89/<- %edx 4/r32/esp - 2365 (flush _test-output-buffered-file) - 2366 (flush _test-error-buffered-file) - 2367 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2373 # no errors - 2374 (check-stream-equal _test-error-stream "" "F - test-convert-function-call-with-inout-with-multiple-type-parameters: error stream should be empty") - 2375 # don't bother checking the generated code - 2376 # don't restore from ebp - 2377 81 0/subop/add %esp 8/imm32 - 2378 # . epilogue + 2076 89/<- %esp 5/r32/ebp + 2077 5d/pop-to-ebp + 2078 c3/return + 2079 + 2080 test-initializer-in-hex: + 2081 # . prologue + 2082 55/push-ebp + 2083 89/<- %ebp 4/r32/esp + 2084 # setup + 2085 (clear-stream _test-input-stream) + 2086 (clear-stream $_test-input-buffered-file->buffer) + 2087 (clear-stream _test-output-stream) + 2088 (clear-stream $_test-output-buffered-file->buffer) + 2089 (clear-stream _test-error-stream) + 2090 (clear-stream $_test-error-buffered-file->buffer) + 2091 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 2092 68/push 0/imm32 + 2093 68/push 0/imm32 + 2094 89/<- %edx 4/r32/esp + 2095 (tailor-exit-descriptor %edx 0x10) + 2096 # + 2097 (write _test-input-stream "fn foo {\n") + 2098 (write _test-input-stream " var x/ecx: int <- copy 10\n") + 2099 (write _test-input-stream "}\n") + 2100 # convert + 2101 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2102 # registers except esp clobbered at this point + 2103 # restore ed + 2104 89/<- %edx 4/r32/esp + 2105 (flush _test-output-buffered-file) + 2106 (flush _test-error-buffered-file) + 2107 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2113 # check output + 2114 (check-stream-equal _test-output-stream "" "F - test-initializer-in-hex: output should be empty") + 2115 (check-next-stream-line-equal _test-error-stream "literal integers are always hex in Mu; start '10' with a '0x' to be unambiguous, converting it to hexadecimal as necessary." "F - test-initializer-in-hex: error message") + 2116 # check that stop(1) was called + 2117 (check-ints-equal *(edx+4) 2 "F - test-initializer-in-hex: exit status") + 2118 # don't restore from ebp + 2119 81 0/subop/add %esp 8/imm32 + 2120 # . epilogue + 2121 5d/pop-to-ebp + 2122 c3/return + 2123 + 2124 test-convert-function-with-second-local-var-in-same-reg: + 2125 # . prologue + 2126 55/push-ebp + 2127 89/<- %ebp 4/r32/esp + 2128 # setup + 2129 (clear-stream _test-input-stream) + 2130 (clear-stream $_test-input-buffered-file->buffer) + 2131 (clear-stream _test-output-stream) + 2132 (clear-stream $_test-output-buffered-file->buffer) + 2133 # + 2134 (write _test-input-stream "fn foo {\n") + 2135 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 2136 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 2137 (write _test-input-stream " y <- increment\n") + 2138 (write _test-input-stream "}\n") + 2139 # convert + 2140 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2141 (flush _test-output-buffered-file) + 2142 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2148 # check output + 2149 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-second-local-var-in-same-reg/0") + 2150 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-second-local-var-in-same-reg/1") + 2151 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/2") + 2152 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-second-local-var-in-same-reg/3") + 2153 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-second-local-var-in-same-reg/4") + 2154 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-second-local-var-in-same-reg/5") + 2155 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-second-local-var-in-same-reg/6") + 2156 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-function-with-second-local-var-in-same-reg/7") + 2157 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-convert-function-with-second-local-var-in-same-reg/8") + 2158 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-convert-function-with-second-local-var-in-same-reg/9") + 2159 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-second-local-var-in-same-reg/10") + 2160 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-second-local-var-in-same-reg/11") + 2161 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-second-local-var-in-same-reg/12") + 2162 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-second-local-var-in-same-reg/13") + 2163 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-second-local-var-in-same-reg/14") + 2164 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-second-local-var-in-same-reg/15") + 2165 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-second-local-var-in-same-reg/16") + 2166 # . epilogue + 2167 89/<- %esp 5/r32/ebp + 2168 5d/pop-to-ebp + 2169 c3/return + 2170 + 2171 test-read-clobbered-reg-var: + 2172 # . prologue + 2173 55/push-ebp + 2174 89/<- %ebp 4/r32/esp + 2175 # setup + 2176 (clear-stream _test-input-stream) + 2177 (clear-stream $_test-input-buffered-file->buffer) + 2178 (clear-stream _test-output-stream) + 2179 (clear-stream $_test-output-buffered-file->buffer) + 2180 (clear-stream _test-error-stream) + 2181 (clear-stream $_test-error-buffered-file->buffer) + 2182 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) # bytes of args in call to convert-mu + 2183 68/push 0/imm32 + 2184 68/push 0/imm32 + 2185 89/<- %edx 4/r32/esp + 2186 (tailor-exit-descriptor %edx 0x10) + 2187 # + 2188 (write _test-input-stream "fn foo {\n") + 2189 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 2190 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 2191 (write _test-input-stream " x <- increment\n") + 2192 (write _test-input-stream "}\n") + 2193 # convert + 2194 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2195 # registers except esp clobbered at this point + 2196 # restore ed + 2197 89/<- %edx 4/r32/esp + 2198 (flush _test-output-buffered-file) + 2199 (flush _test-error-buffered-file) + 2200 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2206 # check output + 2207 (check-stream-equal _test-output-stream "" "F - test-read-clobbered-reg-var: output should be empty") + 2208 (check-next-stream-line-equal _test-error-stream "fn foo: register ecx reads var 'x' after writing var 'y'" "F - test-read-clobbered-reg-var: error message") + 2209 # check that stop(1) was called + 2210 (check-ints-equal *(edx+4) 2 "F - test-read-clobbered-reg-var: exit status") + 2211 # don't restore from ebp + 2212 81 0/subop/add %esp 8/imm32 + 2213 # . epilogue + 2214 5d/pop-to-ebp + 2215 c3/return + 2216 + 2217 test-overlapping-int-fp-registers: + 2218 # . prologue + 2219 55/push-ebp + 2220 89/<- %ebp 4/r32/esp + 2221 # setup + 2222 (clear-stream _test-input-stream) + 2223 (clear-stream $_test-input-buffered-file->buffer) + 2224 (clear-stream _test-output-stream) + 2225 (clear-stream $_test-output-buffered-file->buffer) + 2226 (clear-stream _test-error-stream) + 2227 (clear-stream $_test-error-buffered-file->buffer) + 2228 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) # bytes of args in call to convert-mu + 2229 68/push 0/imm32 + 2230 68/push 0/imm32 + 2231 89/<- %edx 4/r32/esp + 2232 (tailor-exit-descriptor %edx 0x10) + 2233 # + 2234 (write _test-input-stream "fn foo {\n") + 2235 (write _test-input-stream " var x/eax: int <- copy 3\n") + 2236 (write _test-input-stream " var y/xmm0: float <- convert x\n") + 2237 (write _test-input-stream " x <- increment\n") + 2238 (write _test-input-stream "}\n") + 2239 # convert + 2240 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2241 # registers except esp clobbered at this point + 2242 # restore ed + 2243 89/<- %edx 4/r32/esp + 2244 (flush _test-output-buffered-file) + 2245 (flush _test-error-buffered-file) + 2246 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2252 # no errors + 2253 (check-next-stream-line-equal _test-error-stream "" "F - test-overlapping-int-fp-registers: error message") + 2254 # don't bother checking the generated code + 2255 # don't restore from ebp + 2256 81 0/subop/add %esp 8/imm32 + 2257 # . epilogue + 2258 5d/pop-to-ebp + 2259 c3/return + 2260 + 2261 test-convert-function-call: + 2262 # . prologue + 2263 55/push-ebp + 2264 89/<- %ebp 4/r32/esp + 2265 # setup + 2266 (clear-stream _test-input-stream) + 2267 (clear-stream $_test-input-buffered-file->buffer) + 2268 (clear-stream _test-output-stream) + 2269 (clear-stream $_test-output-buffered-file->buffer) + 2270 # + 2271 (write _test-input-stream "fn main -> _/ebx: int {\n") + 2272 (write _test-input-stream " var result/ebx: int <- foo\n") + 2273 (write _test-input-stream " return result\n") + 2274 (write _test-input-stream "}\n") + 2275 (write _test-input-stream "fn foo -> _/ebx: int {\n") + 2276 (write _test-input-stream " var result/ebx: int <- copy 3\n") + 2277 (write _test-input-stream " return result\n") + 2278 (write _test-input-stream "}\n") + 2279 # convert + 2280 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2281 (flush _test-output-buffered-file) + 2282 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2288 # check output + 2289 (check-next-stream-line-equal _test-output-stream "main:" "F - test-convert-function-call/0") + 2290 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call/1") + 2291 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call/2") + 2292 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call/3") + 2293 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call/4") + 2294 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:loop:" "F - test-convert-function-call/5") + 2295 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-function-call-with-literal-arg/6") + 2296 (check-next-stream-line-equal _test-output-stream " (foo)" "F - test-convert-function-call/6") + 2297 (check-next-stream-line-equal _test-output-stream " 8b/-> %ebx 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") + 2298 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-call-with-literal-arg/27") + 2299 (check-next-stream-line-equal _test-output-stream " e9/jump $main:0x00000001:break/disp32" "F - test-convert-function-call-with-literal-arg/10") + 2300 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call/7") + 2301 (check-next-stream-line-equal _test-output-stream "$main:0x00000001:break:" "F - test-convert-function-call/8") + 2302 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call/9") + 2303 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call/10") + 2304 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call/11") + 2305 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call/12") + 2306 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call/13") + 2307 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call/14") + 2308 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call/15") + 2309 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call/16") + 2310 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call/17") + 2311 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-call/18") + 2312 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-function-call-with-literal-arg/6") + 2313 (check-next-stream-line-equal _test-output-stream " bb/copy-to-ebx 3/imm32" "F - test-convert-function-call/19") + 2314 (check-next-stream-line-equal _test-output-stream " 8b/-> %ebx 0x00000003/r32" "F - test-convert-function-call-with-literal-arg/8") + 2315 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-call-with-literal-arg/27") + 2316 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-call-with-literal-arg/10") + 2317 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call/20") + 2318 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-call/21") + 2319 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call/22") + 2320 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call/23") + 2321 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call/24") + 2322 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call/25") + 2323 # . epilogue + 2324 89/<- %esp 5/r32/ebp + 2325 5d/pop-to-ebp + 2326 c3/return + 2327 + 2328 test-convert-function-call-with-inout-with-compound-type: + 2329 # . prologue + 2330 55/push-ebp + 2331 89/<- %ebp 4/r32/esp + 2332 # setup + 2333 (clear-stream _test-input-stream) + 2334 (clear-stream $_test-input-buffered-file->buffer) + 2335 (clear-stream _test-output-stream) + 2336 (clear-stream $_test-output-buffered-file->buffer) + 2337 # + 2338 (write _test-input-stream "fn f {\n") + 2339 (write _test-input-stream " var x: (addr int)\n") + 2340 (write _test-input-stream " g x\n") + 2341 (write _test-input-stream "}\n") + 2342 (write _test-input-stream "fn g a: (addr int) {\n") + 2343 (write _test-input-stream "}\n") + 2344 # convert + 2345 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2346 (flush _test-output-buffered-file) + 2347 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2353 # check output + 2354 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-inout-with-compound-type/0") + 2355 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-inout-with-compound-type/1") + 2356 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-inout-with-compound-type/2") + 2357 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-inout-with-compound-type/3") + 2358 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-inout-with-compound-type/4") + 2359 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-inout-with-compound-type/5") + 2360 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-inout-with-compound-type/6") + 2361 (check-next-stream-line-equal _test-output-stream " (g *(ebp+0xfffffffc))" "F - test-convert-function-call-with-inout-with-compound-type/7") + 2362 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-call-with-inout-with-compound-type/8") + 2363 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-inout-with-compound-type/9") + 2364 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-inout-with-compound-type/10") + 2365 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-inout-with-compound-type/11") + 2366 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-inout-with-compound-type/12") + 2367 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-inout-with-compound-type/13") + 2368 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-inout-with-compound-type/14") + 2369 (check-next-stream-line-equal _test-output-stream "g:" "F - test-convert-function-call-with-inout-with-compound-type/15") + 2370 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-inout-with-compound-type/16") + 2371 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-inout-with-compound-type/17") + 2372 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-inout-with-compound-type/18") + 2373 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-inout-with-compound-type/19") + 2374 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-inout-with-compound-type/20") + 2375 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-inout-with-compound-type/21") + 2376 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-inout-with-compound-type/22") + 2377 # . epilogue + 2378 89/<- %esp 5/r32/ebp 2379 5d/pop-to-ebp 2380 c3/return 2381 - 2382 test-type-parameter-matches-rest-of-type: + 2382 test-convert-function-call-with-inout-with-type-parameter: 2383 # . prologue 2384 55/push-ebp 2385 89/<- %ebp 4/r32/esp @@ -2259,29 +2264,29 @@ if ('onhashchange' in window) { 2397 (tailor-exit-descriptor %edx 0x10) 2398 # 2399 (write _test-input-stream "fn f {\n") - 2400 (write _test-input-stream " var x: (addr array int)\n") + 2400 (write _test-input-stream " var x: (addr int)\n") 2401 (write _test-input-stream " g x\n") 2402 (write _test-input-stream "}\n") 2403 (write _test-input-stream "fn g a: (addr _) {\n") 2404 (write _test-input-stream "}\n") 2405 # convert - 2406 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2406 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) 2407 # registers except esp clobbered at this point 2408 # restore ed 2409 89/<- %edx 4/r32/esp 2410 (flush _test-output-buffered-file) 2411 (flush _test-error-buffered-file) - 2412 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2418 # no errors - 2419 (check-stream-equal _test-error-stream "" "F - test-type-parameter-matches-rest-of-type: error stream should be empty") - 2420 # don't bother checking the generated code + 2412 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2418 # no error; types matched + 2419 (check-stream-equal _test-error-stream "" "F - test-convert-function-call-with-inout-with-type-parameter: error stream should be empty") + 2420 # don't bother checking the generated code; that's in the test 'test-local-clobbered-by-fn-output' below 2421 # don't restore from ebp 2422 81 0/subop/add %esp 8/imm32 2423 # . epilogue 2424 5d/pop-to-ebp 2425 c3/return 2426 - 2427 test-convert-function-call-with-inout-with-incompatible-type-parameters: + 2427 test-convert-function-call-with-incorrect-inout-type: 2428 # . prologue 2429 55/push-ebp 2430 89/<- %ebp 4/r32/esp @@ -2299,30 +2304,30 @@ if ('onhashchange' in window) { 2442 (tailor-exit-descriptor %edx 0x10) 2443 # 2444 (write _test-input-stream "fn f {\n") - 2445 (write _test-input-stream " var x: (addr int)\n") - 2446 (write _test-input-stream " var y: (addr boolean)\n") - 2447 (write _test-input-stream " g x, y\n") - 2448 (write _test-input-stream "}\n") - 2449 (write _test-input-stream "fn g a: (addr _T), b: (addr _T) {\n") - 2450 (write _test-input-stream "}\n") - 2451 # convert - 2452 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2453 # registers except esp clobbered at this point - 2454 # restore ed - 2455 89/<- %edx 4/r32/esp - 2456 (flush _test-output-buffered-file) - 2457 (flush _test-error-buffered-file) - 2458 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2464 # check output - 2465 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-inout-with-incompatible-type-parameters: output should be empty") - 2466 (check-next-stream-line-equal _test-error-stream "fn f: call g: type for inout 'y' is not right" "F - test-convert-function-call-with-inout-with-incompatible-type-parameters: error message") - 2467 # don't restore from ebp - 2468 81 0/subop/add %esp 8/imm32 - 2469 # . epilogue + 2445 (write _test-input-stream " var x: int\n") + 2446 (write _test-input-stream " g x\n") + 2447 (write _test-input-stream "}\n") + 2448 (write _test-input-stream "fn g a: foo {\n") + 2449 (write _test-input-stream "}\n") + 2450 # convert + 2451 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2452 # registers except esp clobbered at this point + 2453 # restore ed + 2454 89/<- %edx 4/r32/esp + 2455 (flush _test-output-buffered-file) + 2456 (flush _test-error-buffered-file) + 2457 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2463 # check output + 2464 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-incorrect-inout-type: output should be empty") + 2465 (check-next-stream-line-equal _test-error-stream "fn f: call g: type for inout 'x' is not right" "F - test-convert-function-call-with-incorrect-inout-type: error message") + 2466 # check that stop(1) was called + 2467 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-incorrect-inout-type: exit status") + 2468 # don't restore from ebp + 2469 81 0/subop/add %esp 8/imm32 2470 5d/pop-to-ebp 2471 c3/return 2472 - 2473 test-convert-function-call-with-too-few-inouts: + 2473 test-convert-function-call-with-inout-with-incorrect-compound-type: 2474 # . prologue 2475 55/push-ebp 2476 89/<- %ebp 4/r32/esp @@ -2340,29 +2345,29 @@ if ('onhashchange' in window) { 2488 (tailor-exit-descriptor %edx 0x10) 2489 # 2490 (write _test-input-stream "fn f {\n") - 2491 (write _test-input-stream " g\n") - 2492 (write _test-input-stream "}\n") - 2493 (write _test-input-stream "fn g a: int {\n") - 2494 (write _test-input-stream "}\n") - 2495 # convert - 2496 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2497 # registers except esp clobbered at this point - 2498 # restore ed - 2499 89/<- %edx 4/r32/esp - 2500 (flush _test-output-buffered-file) - 2501 (flush _test-error-buffered-file) - 2502 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2508 # check output - 2509 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-few-inouts: output should be empty") - 2510 (check-next-stream-line-equal _test-error-stream "fn f: call g: too few inouts" "F - test-convert-function-call-with-too-few-inouts: error message") - 2511 # check that stop(1) was called - 2512 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-few-inouts: exit status") - 2513 # don't restore from ebp - 2514 81 0/subop/add %esp 8/imm32 + 2491 (write _test-input-stream " var x: (addr int)\n") + 2492 (write _test-input-stream " g x\n") + 2493 (write _test-input-stream "}\n") + 2494 (write _test-input-stream "fn g a: (addr bool) {\n") + 2495 (write _test-input-stream "}\n") + 2496 # convert + 2497 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2498 # registers except esp clobbered at this point + 2499 # restore ed + 2500 89/<- %edx 4/r32/esp + 2501 (flush _test-output-buffered-file) + 2502 (flush _test-error-buffered-file) + 2503 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2509 # check output + 2510 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-inout-with-incorrect-compound-type: output should be empty") + 2511 (check-next-stream-line-equal _test-error-stream "fn f: call g: type for inout 'x' is not right" "F - test-convert-function-call-with-inout-with-incorrect-compound-type: error message") + 2512 # don't restore from ebp + 2513 81 0/subop/add %esp 8/imm32 + 2514 # . epilogue 2515 5d/pop-to-ebp 2516 c3/return 2517 - 2518 test-convert-function-call-with-too-many-inouts: + 2518 test-convert-function-call-with-inout-with-multiple-type-parameters: 2519 # . prologue 2520 55/push-ebp 2521 89/<- %ebp 4/r32/esp @@ -2380,30 +2385,30 @@ if ('onhashchange' in window) { 2533 (tailor-exit-descriptor %edx 0x10) 2534 # 2535 (write _test-input-stream "fn f {\n") - 2536 (write _test-input-stream " var x: int\n") - 2537 (write _test-input-stream " g x\n") - 2538 (write _test-input-stream "}\n") - 2539 (write _test-input-stream "fn g {\n") - 2540 (write _test-input-stream "}\n") - 2541 # convert - 2542 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2543 # registers except esp clobbered at this point - 2544 # restore ed - 2545 89/<- %edx 4/r32/esp - 2546 (flush _test-output-buffered-file) - 2547 (flush _test-error-buffered-file) - 2548 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2554 # check output - 2555 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-many-inouts: output should be empty") - 2556 (check-next-stream-line-equal _test-error-stream "fn f: call g: too many inouts" "F - test-convert-function-call-with-too-many-inouts: error message") - 2557 # check that stop(1) was called - 2558 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-many-inouts: exit status") - 2559 # don't restore from ebp - 2560 81 0/subop/add %esp 8/imm32 + 2536 (write _test-input-stream " var x: (addr int)\n") + 2537 (write _test-input-stream " var y: (addr int)\n") + 2538 (write _test-input-stream " g x, y\n") + 2539 (write _test-input-stream "}\n") + 2540 (write _test-input-stream "fn g a: (addr _), b: (addr _) {\n") + 2541 (write _test-input-stream "}\n") + 2542 # convert + 2543 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2544 # registers except esp clobbered at this point + 2545 # restore ed + 2546 89/<- %edx 4/r32/esp + 2547 (flush _test-output-buffered-file) + 2548 (flush _test-error-buffered-file) + 2549 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2555 # no errors + 2556 (check-stream-equal _test-error-stream "" "F - test-convert-function-call-with-inout-with-multiple-type-parameters: error stream should be empty") + 2557 # don't bother checking the generated code + 2558 # don't restore from ebp + 2559 81 0/subop/add %esp 8/imm32 + 2560 # . epilogue 2561 5d/pop-to-ebp 2562 c3/return 2563 - 2564 test-convert-function-call-with-incorrect-output-type: + 2564 test-type-parameter-matches-rest-of-type: 2565 # . prologue 2566 55/push-ebp 2567 89/<- %ebp 4/r32/esp @@ -2421,29 +2426,29 @@ if ('onhashchange' in window) { 2579 (tailor-exit-descriptor %edx 0x10) 2580 # 2581 (write _test-input-stream "fn f {\n") - 2582 (write _test-input-stream " var x/eax: int <- g\n") - 2583 (write _test-input-stream "}\n") - 2584 (write _test-input-stream "fn g -> _/eax: foo {\n") - 2585 (write _test-input-stream "}\n") - 2586 # convert - 2587 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2588 # registers except esp clobbered at this point - 2589 # restore ed - 2590 89/<- %edx 4/r32/esp - 2591 (flush _test-output-buffered-file) - 2592 (flush _test-error-buffered-file) - 2593 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2599 # check output - 2600 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-incorrect-output-type: output should be empty") - 2601 (check-next-stream-line-equal _test-error-stream "fn f: call g: type for output 'x' is not right" "F - test-convert-function-call-with-incorrect-output-type: error message") - 2602 # check that stop(1) was called - 2603 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-incorrect-output-type: exit status") - 2604 # don't restore from ebp - 2605 81 0/subop/add %esp 8/imm32 + 2582 (write _test-input-stream " var x: (addr array int)\n") + 2583 (write _test-input-stream " g x\n") + 2584 (write _test-input-stream "}\n") + 2585 (write _test-input-stream "fn g a: (addr _) {\n") + 2586 (write _test-input-stream "}\n") + 2587 # convert + 2588 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2589 # registers except esp clobbered at this point + 2590 # restore ed + 2591 89/<- %edx 4/r32/esp + 2592 (flush _test-output-buffered-file) + 2593 (flush _test-error-buffered-file) + 2594 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2600 # no errors + 2601 (check-stream-equal _test-error-stream "" "F - test-type-parameter-matches-rest-of-type: error stream should be empty") + 2602 # don't bother checking the generated code + 2603 # don't restore from ebp + 2604 81 0/subop/add %esp 8/imm32 + 2605 # . epilogue 2606 5d/pop-to-ebp 2607 c3/return 2608 - 2609 test-convert-function-call-with-too-few-outputs: + 2609 test-convert-function-call-with-inout-with-incompatible-type-parameters: 2610 # . prologue 2611 55/push-ebp 2612 89/<- %ebp 4/r32/esp @@ -2461,191 +2466,191 @@ if ('onhashchange' in window) { 2624 (tailor-exit-descriptor %edx 0x10) 2625 # 2626 (write _test-input-stream "fn f {\n") - 2627 (write _test-input-stream " g\n") - 2628 (write _test-input-stream "}\n") - 2629 (write _test-input-stream "fn g -> _/eax: int {\n") + 2627 (write _test-input-stream " var x: (addr int)\n") + 2628 (write _test-input-stream " var y: (addr boolean)\n") + 2629 (write _test-input-stream " g x, y\n") 2630 (write _test-input-stream "}\n") - 2631 # convert - 2632 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2633 # registers except esp clobbered at this point - 2634 # restore ed - 2635 89/<- %edx 4/r32/esp - 2636 (flush _test-output-buffered-file) - 2637 (flush _test-error-buffered-file) - 2638 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2644 # check output - 2645 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-few-outputs: output should be empty") - 2646 (check-next-stream-line-equal _test-error-stream "fn f: call g: too few outputs" "F - test-convert-function-call-with-too-few-outputs: error message") - 2647 # check that stop(1) was called - 2648 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-few-outputs: exit status") + 2631 (write _test-input-stream "fn g a: (addr _T), b: (addr _T) {\n") + 2632 (write _test-input-stream "}\n") + 2633 # convert + 2634 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2635 # registers except esp clobbered at this point + 2636 # restore ed + 2637 89/<- %edx 4/r32/esp + 2638 (flush _test-output-buffered-file) + 2639 (flush _test-error-buffered-file) + 2640 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2646 # check output + 2647 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-inout-with-incompatible-type-parameters: output should be empty") + 2648 (check-next-stream-line-equal _test-error-stream "fn f: call g: type for inout 'y' is not right" "F - test-convert-function-call-with-inout-with-incompatible-type-parameters: error message") 2649 # don't restore from ebp 2650 81 0/subop/add %esp 8/imm32 - 2651 5d/pop-to-ebp - 2652 c3/return - 2653 - 2654 test-convert-function-call-with-too-many-outputs: - 2655 # . prologue - 2656 55/push-ebp - 2657 89/<- %ebp 4/r32/esp - 2658 # setup - 2659 (clear-stream _test-input-stream) - 2660 (clear-stream $_test-input-buffered-file->buffer) - 2661 (clear-stream _test-output-stream) - 2662 (clear-stream $_test-output-buffered-file->buffer) - 2663 (clear-stream _test-error-stream) - 2664 (clear-stream $_test-error-buffered-file->buffer) - 2665 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 2666 68/push 0/imm32 + 2651 # . epilogue + 2652 5d/pop-to-ebp + 2653 c3/return + 2654 + 2655 test-convert-function-call-with-too-few-inouts: + 2656 # . prologue + 2657 55/push-ebp + 2658 89/<- %ebp 4/r32/esp + 2659 # setup + 2660 (clear-stream _test-input-stream) + 2661 (clear-stream $_test-input-buffered-file->buffer) + 2662 (clear-stream _test-output-stream) + 2663 (clear-stream $_test-output-buffered-file->buffer) + 2664 (clear-stream _test-error-stream) + 2665 (clear-stream $_test-error-buffered-file->buffer) + 2666 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) 2667 68/push 0/imm32 - 2668 89/<- %edx 4/r32/esp - 2669 (tailor-exit-descriptor %edx 0x10) - 2670 # - 2671 (write _test-input-stream "fn f {\n") - 2672 (write _test-input-stream " var x/eax: int <- g\n") - 2673 (write _test-input-stream "}\n") - 2674 (write _test-input-stream "fn g {\n") - 2675 (write _test-input-stream "}\n") - 2676 # convert - 2677 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2678 # registers except esp clobbered at this point - 2679 # restore ed - 2680 89/<- %edx 4/r32/esp - 2681 (flush _test-output-buffered-file) - 2682 (flush _test-error-buffered-file) - 2683 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2689 # check output - 2690 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-many-outputs: output should be empty") - 2691 (check-next-stream-line-equal _test-error-stream "fn f: call g: too many outputs" "F - test-convert-function-call-with-too-many-outputs: error message") - 2692 # check that stop(1) was called - 2693 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-many-outputs: exit status") - 2694 # don't restore from ebp - 2695 81 0/subop/add %esp 8/imm32 - 2696 5d/pop-to-ebp - 2697 c3/return - 2698 - 2699 test-convert-function-call-with-missing-output-register: - 2700 # . prologue - 2701 55/push-ebp - 2702 89/<- %ebp 4/r32/esp - 2703 # setup - 2704 (clear-stream _test-input-stream) - 2705 (clear-stream $_test-input-buffered-file->buffer) - 2706 (clear-stream _test-output-stream) - 2707 (clear-stream $_test-output-buffered-file->buffer) - 2708 (clear-stream _test-error-stream) - 2709 (clear-stream $_test-error-buffered-file->buffer) - 2710 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 2711 68/push 0/imm32 + 2668 68/push 0/imm32 + 2669 89/<- %edx 4/r32/esp + 2670 (tailor-exit-descriptor %edx 0x10) + 2671 # + 2672 (write _test-input-stream "fn f {\n") + 2673 (write _test-input-stream " g\n") + 2674 (write _test-input-stream "}\n") + 2675 (write _test-input-stream "fn g a: int {\n") + 2676 (write _test-input-stream "}\n") + 2677 # convert + 2678 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2679 # registers except esp clobbered at this point + 2680 # restore ed + 2681 89/<- %edx 4/r32/esp + 2682 (flush _test-output-buffered-file) + 2683 (flush _test-error-buffered-file) + 2684 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2690 # check output + 2691 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-few-inouts: output should be empty") + 2692 (check-next-stream-line-equal _test-error-stream "fn f: call g: too few inouts" "F - test-convert-function-call-with-too-few-inouts: error message") + 2693 # check that stop(1) was called + 2694 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-few-inouts: exit status") + 2695 # don't restore from ebp + 2696 81 0/subop/add %esp 8/imm32 + 2697 5d/pop-to-ebp + 2698 c3/return + 2699 + 2700 test-convert-function-call-with-too-many-inouts: + 2701 # . prologue + 2702 55/push-ebp + 2703 89/<- %ebp 4/r32/esp + 2704 # setup + 2705 (clear-stream _test-input-stream) + 2706 (clear-stream $_test-input-buffered-file->buffer) + 2707 (clear-stream _test-output-stream) + 2708 (clear-stream $_test-output-buffered-file->buffer) + 2709 (clear-stream _test-error-stream) + 2710 (clear-stream $_test-error-buffered-file->buffer) + 2711 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) 2712 68/push 0/imm32 - 2713 89/<- %edx 4/r32/esp - 2714 (tailor-exit-descriptor %edx 0x10) - 2715 # - 2716 (write _test-input-stream "fn f {\n") - 2717 (write _test-input-stream " var x: int\n") - 2718 (write _test-input-stream " x <- g\n") - 2719 (write _test-input-stream "}\n") - 2720 (write _test-input-stream "fn g -> _/eax: int {\n") - 2721 (write _test-input-stream "}\n") - 2722 # convert - 2723 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2724 # registers except esp clobbered at this point - 2725 # restore ed - 2726 89/<- %edx 4/r32/esp - 2727 (flush _test-output-buffered-file) - 2728 (flush _test-error-buffered-file) - 2729 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2735 # check output - 2736 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-missing-output-register: output should be empty") - 2737 (check-next-stream-line-equal _test-error-stream "fn f: call g: output 'x' is not in a register" "F - test-convert-function-call-with-missing-output-register: error message") - 2738 # check that stop(1) was called - 2739 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-missing-output-register: exit status") - 2740 # don't restore from ebp - 2741 81 0/subop/add %esp 8/imm32 - 2742 5d/pop-to-ebp - 2743 c3/return - 2744 - 2745 test-convert-function-call-with-incorrect-output-register: - 2746 # . prologue - 2747 55/push-ebp - 2748 89/<- %ebp 4/r32/esp - 2749 # setup - 2750 (clear-stream _test-input-stream) - 2751 (clear-stream $_test-input-buffered-file->buffer) - 2752 (clear-stream _test-output-stream) - 2753 (clear-stream $_test-output-buffered-file->buffer) - 2754 (clear-stream _test-error-stream) - 2755 (clear-stream $_test-error-buffered-file->buffer) - 2756 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 2757 68/push 0/imm32 + 2713 68/push 0/imm32 + 2714 89/<- %edx 4/r32/esp + 2715 (tailor-exit-descriptor %edx 0x10) + 2716 # + 2717 (write _test-input-stream "fn f {\n") + 2718 (write _test-input-stream " var x: int\n") + 2719 (write _test-input-stream " g x\n") + 2720 (write _test-input-stream "}\n") + 2721 (write _test-input-stream "fn g {\n") + 2722 (write _test-input-stream "}\n") + 2723 # convert + 2724 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2725 # registers except esp clobbered at this point + 2726 # restore ed + 2727 89/<- %edx 4/r32/esp + 2728 (flush _test-output-buffered-file) + 2729 (flush _test-error-buffered-file) + 2730 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2736 # check output + 2737 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-many-inouts: output should be empty") + 2738 (check-next-stream-line-equal _test-error-stream "fn f: call g: too many inouts" "F - test-convert-function-call-with-too-many-inouts: error message") + 2739 # check that stop(1) was called + 2740 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-many-inouts: exit status") + 2741 # don't restore from ebp + 2742 81 0/subop/add %esp 8/imm32 + 2743 5d/pop-to-ebp + 2744 c3/return + 2745 + 2746 test-convert-function-call-with-incorrect-output-type: + 2747 # . prologue + 2748 55/push-ebp + 2749 89/<- %ebp 4/r32/esp + 2750 # setup + 2751 (clear-stream _test-input-stream) + 2752 (clear-stream $_test-input-buffered-file->buffer) + 2753 (clear-stream _test-output-stream) + 2754 (clear-stream $_test-output-buffered-file->buffer) + 2755 (clear-stream _test-error-stream) + 2756 (clear-stream $_test-error-buffered-file->buffer) + 2757 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) 2758 68/push 0/imm32 - 2759 89/<- %edx 4/r32/esp - 2760 (tailor-exit-descriptor %edx 0x10) - 2761 # - 2762 (write _test-input-stream "fn f {\n") - 2763 (write _test-input-stream " var x/ecx: int <- g\n") - 2764 (write _test-input-stream "}\n") - 2765 (write _test-input-stream "fn g -> _/eax: int {\n") - 2766 (write _test-input-stream "}\n") - 2767 # convert - 2768 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 2769 # registers except esp clobbered at this point - 2770 # restore ed - 2771 89/<- %edx 4/r32/esp - 2772 (flush _test-output-buffered-file) - 2773 (flush _test-error-buffered-file) - 2774 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 2780 # check output - 2781 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-incorrect-output-register: output should be empty") - 2782 (check-next-stream-line-equal _test-error-stream "fn f: call g: register for output 'x' is not right" "F - test-convert-function-call-with-incorrect-output-register: error message") - 2783 # check that stop(1) was called - 2784 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-incorrect-output-register: exit status") - 2785 # don't restore from ebp - 2786 81 0/subop/add %esp 8/imm32 - 2787 5d/pop-to-ebp - 2788 c3/return - 2789 - 2790 test-convert-function-with-local-var-dereferenced: - 2791 # . prologue - 2792 55/push-ebp - 2793 89/<- %ebp 4/r32/esp - 2794 # setup - 2795 (clear-stream _test-input-stream) - 2796 (clear-stream $_test-input-buffered-file->buffer) - 2797 (clear-stream _test-output-stream) - 2798 (clear-stream $_test-output-buffered-file->buffer) - 2799 # - 2800 (write _test-input-stream "fn foo {\n") - 2801 (write _test-input-stream " var x/ecx: (addr int) <- copy 0\n") - 2802 (write _test-input-stream " increment *x\n") - 2803 (write _test-input-stream "}\n") - 2804 # convert - 2805 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2806 (flush _test-output-buffered-file) - 2807 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 2813 # check output - 2814 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-dereferenced/0") - 2815 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-dereferenced/1") - 2816 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-dereferenced/2") - 2817 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-dereferenced/3") - 2818 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-dereferenced/4") - 2819 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-dereferenced/5") - 2820 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-dereferenced/6") - 2821 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-local-var-dereferenced/7") - 2822 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *ecx" "F - test-convert-function-with-local-var-dereferenced/8") - 2823 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-dereferenced/9") - 2824 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-dereferenced/10") - 2825 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-dereferenced/11") - 2826 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-dereferenced/12") - 2827 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-dereferenced/13") - 2828 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-dereferenced/14") - 2829 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-dereferenced/15") - 2830 # . epilogue - 2831 89/<- %esp 5/r32/ebp - 2832 5d/pop-to-ebp - 2833 c3/return - 2834 - 2835 # variables of type 'byte' are not allowed on the stack - 2836 test-convert-function-with-byte-operations: + 2759 68/push 0/imm32 + 2760 89/<- %edx 4/r32/esp + 2761 (tailor-exit-descriptor %edx 0x10) + 2762 # + 2763 (write _test-input-stream "fn f {\n") + 2764 (write _test-input-stream " var x/eax: int <- g\n") + 2765 (write _test-input-stream "}\n") + 2766 (write _test-input-stream "fn g -> _/eax: foo {\n") + 2767 (write _test-input-stream "}\n") + 2768 # convert + 2769 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2770 # registers except esp clobbered at this point + 2771 # restore ed + 2772 89/<- %edx 4/r32/esp + 2773 (flush _test-output-buffered-file) + 2774 (flush _test-error-buffered-file) + 2775 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2781 # check output + 2782 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-incorrect-output-type: output should be empty") + 2783 (check-next-stream-line-equal _test-error-stream "fn f: call g: type for output 'x' is not right" "F - test-convert-function-call-with-incorrect-output-type: error message") + 2784 # check that stop(1) was called + 2785 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-incorrect-output-type: exit status") + 2786 # don't restore from ebp + 2787 81 0/subop/add %esp 8/imm32 + 2788 5d/pop-to-ebp + 2789 c3/return + 2790 + 2791 test-convert-function-call-with-too-few-outputs: + 2792 # . prologue + 2793 55/push-ebp + 2794 89/<- %ebp 4/r32/esp + 2795 # setup + 2796 (clear-stream _test-input-stream) + 2797 (clear-stream $_test-input-buffered-file->buffer) + 2798 (clear-stream _test-output-stream) + 2799 (clear-stream $_test-output-buffered-file->buffer) + 2800 (clear-stream _test-error-stream) + 2801 (clear-stream $_test-error-buffered-file->buffer) + 2802 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 2803 68/push 0/imm32 + 2804 68/push 0/imm32 + 2805 89/<- %edx 4/r32/esp + 2806 (tailor-exit-descriptor %edx 0x10) + 2807 # + 2808 (write _test-input-stream "fn f {\n") + 2809 (write _test-input-stream " g\n") + 2810 (write _test-input-stream "}\n") + 2811 (write _test-input-stream "fn g -> _/eax: int {\n") + 2812 (write _test-input-stream "}\n") + 2813 # convert + 2814 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2815 # registers except esp clobbered at this point + 2816 # restore ed + 2817 89/<- %edx 4/r32/esp + 2818 (flush _test-output-buffered-file) + 2819 (flush _test-error-buffered-file) + 2820 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2826 # check output + 2827 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-few-outputs: output should be empty") + 2828 (check-next-stream-line-equal _test-error-stream "fn f: call g: too few outputs" "F - test-convert-function-call-with-too-few-outputs: error message") + 2829 # check that stop(1) was called + 2830 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-few-outputs: exit status") + 2831 # don't restore from ebp + 2832 81 0/subop/add %esp 8/imm32 + 2833 5d/pop-to-ebp + 2834 c3/return + 2835 + 2836 test-convert-function-call-with-too-many-outputs: 2837 # . prologue 2838 55/push-ebp 2839 89/<- %ebp 4/r32/esp @@ -2654,1538 +2659,1533 @@ if ('onhashchange' in window) { 2842 (clear-stream $_test-input-buffered-file->buffer) 2843 (clear-stream _test-output-stream) 2844 (clear-stream $_test-output-buffered-file->buffer) - 2845 # - 2846 (write _test-input-stream "fn foo {\n") - 2847 (write _test-input-stream " var x/eax: byte <- copy 0\n") - 2848 (write _test-input-stream " var y/ecx: byte <- copy 0\n") - 2849 (write _test-input-stream " y <- copy-byte x\n") - 2850 (write _test-input-stream " var z/edx: (addr byte) <- copy 0\n") - 2851 (write _test-input-stream " y <- copy-byte *z\n") - 2852 (write _test-input-stream " copy-byte-to *z, x\n") - 2853 (write _test-input-stream "}\n") - 2854 # convert - 2855 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2856 (flush _test-output-buffered-file) - 2857 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 2863 # check output - 2864 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-byte-operations/0") - 2865 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-byte-operations/1") - 2866 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-byte-operations/2") - 2867 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-byte-operations/3") - 2868 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-byte-operations/4") - 2869 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-byte-operations/5") - 2870 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-byte-operations/6") - 2871 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-function-with-byte-operations/7") - 2872 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-byte-operations/8") - 2873 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-byte-operations/9") - 2874 (check-next-stream-line-equal _test-output-stream " 8a/byte-> %eax 0x00000001/r32" "F - test-convert-function-with-byte-operations/10") - 2875 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-convert-function-with-byte-operations/11") - 2876 (check-next-stream-line-equal _test-output-stream " ba/copy-to-edx 0/imm32" "F - test-convert-function-with-byte-operations/12") - 2877 (check-next-stream-line-equal _test-output-stream " 8a/byte-> *edx 0x00000001/r32" "F - test-convert-function-with-byte-operations/13") - 2878 (check-next-stream-line-equal _test-output-stream " 88/byte<- *edx 0x00000000/r32" "F - test-convert-function-with-byte-operations/14") - 2879 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-convert-function-with-byte-operations/15") - 2880 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-byte-operations/16") - 2881 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-byte-operations/17") - 2882 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-byte-operations/18") - 2883 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-byte-operations/19") - 2884 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-byte-operations/20") - 2885 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-byte-operations/21") - 2886 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-byte-operations/22") - 2887 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-byte-operations/23") - 2888 # . epilogue - 2889 89/<- %esp 5/r32/ebp - 2890 5d/pop-to-ebp - 2891 c3/return - 2892 - 2893 # variables of type 'byte' _can_ be function args. They then occupy 4 bytes. - 2894 test-copy-byte-var-from-fn-arg: - 2895 # . prologue - 2896 55/push-ebp - 2897 89/<- %ebp 4/r32/esp - 2898 # setup - 2899 (clear-stream _test-input-stream) - 2900 (clear-stream $_test-input-buffered-file->buffer) - 2901 (clear-stream _test-output-stream) - 2902 (clear-stream $_test-output-buffered-file->buffer) - 2903 # - 2904 (write _test-input-stream "fn foo x: byte, y: int {\n") - 2905 (write _test-input-stream " var a/eax: byte <- copy x\n") - 2906 (write _test-input-stream " var b/eax: int <- copy y\n") - 2907 (write _test-input-stream "}\n") - 2908 # convert - 2909 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2910 (flush _test-output-buffered-file) - 2911 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 2845 (clear-stream _test-error-stream) + 2846 (clear-stream $_test-error-buffered-file->buffer) + 2847 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 2848 68/push 0/imm32 + 2849 68/push 0/imm32 + 2850 89/<- %edx 4/r32/esp + 2851 (tailor-exit-descriptor %edx 0x10) + 2852 # + 2853 (write _test-input-stream "fn f {\n") + 2854 (write _test-input-stream " var x/eax: int <- g\n") + 2855 (write _test-input-stream "}\n") + 2856 (write _test-input-stream "fn g {\n") + 2857 (write _test-input-stream "}\n") + 2858 # convert + 2859 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2860 # registers except esp clobbered at this point + 2861 # restore ed + 2862 89/<- %edx 4/r32/esp + 2863 (flush _test-output-buffered-file) + 2864 (flush _test-error-buffered-file) + 2865 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2871 # check output + 2872 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-too-many-outputs: output should be empty") + 2873 (check-next-stream-line-equal _test-error-stream "fn f: call g: too many outputs" "F - test-convert-function-call-with-too-many-outputs: error message") + 2874 # check that stop(1) was called + 2875 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-too-many-outputs: exit status") + 2876 # don't restore from ebp + 2877 81 0/subop/add %esp 8/imm32 + 2878 5d/pop-to-ebp + 2879 c3/return + 2880 + 2881 test-convert-function-call-with-missing-output-register: + 2882 # . prologue + 2883 55/push-ebp + 2884 89/<- %ebp 4/r32/esp + 2885 # setup + 2886 (clear-stream _test-input-stream) + 2887 (clear-stream $_test-input-buffered-file->buffer) + 2888 (clear-stream _test-output-stream) + 2889 (clear-stream $_test-output-buffered-file->buffer) + 2890 (clear-stream _test-error-stream) + 2891 (clear-stream $_test-error-buffered-file->buffer) + 2892 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 2893 68/push 0/imm32 + 2894 68/push 0/imm32 + 2895 89/<- %edx 4/r32/esp + 2896 (tailor-exit-descriptor %edx 0x10) + 2897 # + 2898 (write _test-input-stream "fn f {\n") + 2899 (write _test-input-stream " var x: int\n") + 2900 (write _test-input-stream " x <- g\n") + 2901 (write _test-input-stream "}\n") + 2902 (write _test-input-stream "fn g -> _/eax: int {\n") + 2903 (write _test-input-stream "}\n") + 2904 # convert + 2905 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2906 # registers except esp clobbered at this point + 2907 # restore ed + 2908 89/<- %edx 4/r32/esp + 2909 (flush _test-output-buffered-file) + 2910 (flush _test-error-buffered-file) + 2911 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2917 # check output - 2918 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-copy-byte-from-fn-arg/0") - 2919 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-copy-byte-from-fn-arg/1") - 2920 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-copy-byte-from-fn-arg/2") - 2921 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-copy-byte-from-fn-arg/3") - 2922 (check-next-stream-line-equal _test-output-stream " {" "F - test-copy-byte-from-fn-arg/4") - 2923 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-copy-byte-from-fn-arg/5") - 2924 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-copy-byte-from-fn-arg/6") - 2925 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-copy-byte-from-fn-arg/7") - 2926 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x0000000c) 0x00000000/r32" "F - test-copy-byte-from-fn-arg/8") - 2927 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-copy-byte-from-fn-arg/9") - 2928 (check-next-stream-line-equal _test-output-stream " }" "F - test-copy-byte-from-fn-arg/10") - 2929 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-copy-byte-from-fn-arg/11") - 2930 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-copy-byte-from-fn-arg/12") - 2931 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-copy-byte-from-fn-arg/13") - 2932 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-copy-byte-from-fn-arg/14") - 2933 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-copy-byte-from-fn-arg/15") - 2934 # . epilogue - 2935 89/<- %esp 5/r32/ebp - 2936 5d/pop-to-ebp - 2937 c3/return - 2938 - 2939 test-convert-compare-register-with-literal: - 2940 # . prologue - 2941 55/push-ebp - 2942 89/<- %ebp 4/r32/esp - 2943 # setup - 2944 (clear-stream _test-input-stream) - 2945 (clear-stream $_test-input-buffered-file->buffer) - 2946 (clear-stream _test-output-stream) - 2947 (clear-stream $_test-output-buffered-file->buffer) - 2948 # - 2949 (write _test-input-stream "fn foo {\n") - 2950 (write _test-input-stream " var x/ecx: int <- copy 0\n") - 2951 (write _test-input-stream " compare x, 0\n") - 2952 (write _test-input-stream "}\n") - 2953 # convert - 2954 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 2955 (flush _test-output-buffered-file) - 2956 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 2918 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-missing-output-register: output should be empty") + 2919 (check-next-stream-line-equal _test-error-stream "fn f: call g: output 'x' is not in a register" "F - test-convert-function-call-with-missing-output-register: error message") + 2920 # check that stop(1) was called + 2921 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-missing-output-register: exit status") + 2922 # don't restore from ebp + 2923 81 0/subop/add %esp 8/imm32 + 2924 5d/pop-to-ebp + 2925 c3/return + 2926 + 2927 test-convert-function-call-with-incorrect-output-register: + 2928 # . prologue + 2929 55/push-ebp + 2930 89/<- %ebp 4/r32/esp + 2931 # setup + 2932 (clear-stream _test-input-stream) + 2933 (clear-stream $_test-input-buffered-file->buffer) + 2934 (clear-stream _test-output-stream) + 2935 (clear-stream $_test-output-buffered-file->buffer) + 2936 (clear-stream _test-error-stream) + 2937 (clear-stream $_test-error-buffered-file->buffer) + 2938 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 2939 68/push 0/imm32 + 2940 68/push 0/imm32 + 2941 89/<- %edx 4/r32/esp + 2942 (tailor-exit-descriptor %edx 0x10) + 2943 # + 2944 (write _test-input-stream "fn f {\n") + 2945 (write _test-input-stream " var x/ecx: int <- g\n") + 2946 (write _test-input-stream "}\n") + 2947 (write _test-input-stream "fn g -> _/eax: int {\n") + 2948 (write _test-input-stream "}\n") + 2949 # convert + 2950 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 2951 # registers except esp clobbered at this point + 2952 # restore ed + 2953 89/<- %edx 4/r32/esp + 2954 (flush _test-output-buffered-file) + 2955 (flush _test-error-buffered-file) + 2956 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2962 # check output - 2963 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-compare-register-with-literal/0") - 2964 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-compare-register-with-literal/1") - 2965 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-compare-register-with-literal/2") - 2966 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-compare-register-with-literal/3") - 2967 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-compare-register-with-literal/4") - 2968 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-compare-register-with-literal/5") - 2969 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") - 2970 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-compare-register-with-literal/7") - 2971 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0/imm32" "F - test-convert-compare-register-with-literal/8") - 2972 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") - 2973 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-compare-register-with-literal/10") - 2974 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-compare-register-with-literal/11") - 2975 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-compare-register-with-literal/12") - 2976 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-compare-register-with-literal/13") - 2977 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-compare-register-with-literal/14") - 2978 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-compare-register-with-literal/15") - 2979 # . epilogue - 2980 89/<- %esp 5/r32/ebp - 2981 5d/pop-to-ebp - 2982 c3/return - 2983 - 2984 test-unknown-variable: - 2985 # . prologue - 2986 55/push-ebp - 2987 89/<- %ebp 4/r32/esp - 2988 # setup - 2989 (clear-stream _test-input-stream) - 2990 (clear-stream $_test-input-buffered-file->buffer) - 2991 (clear-stream _test-output-stream) - 2992 (clear-stream $_test-output-buffered-file->buffer) - 2993 (clear-stream _test-error-stream) - 2994 (clear-stream $_test-error-buffered-file->buffer) - 2995 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 2996 68/push 0/imm32 - 2997 68/push 0/imm32 - 2998 89/<- %edx 4/r32/esp - 2999 (tailor-exit-descriptor %edx 0x10) - 3000 # - 3001 (write _test-input-stream "fn foo {\n") - 3002 (write _test-input-stream " compare x, 0\n") - 3003 (write _test-input-stream "}\n") - 3004 # convert - 3005 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3006 # registers except esp clobbered at this point - 3007 # restore ed - 3008 89/<- %edx 4/r32/esp - 3009 (flush _test-output-buffered-file) - 3010 (flush _test-error-buffered-file) - 3011 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3017 # check output - 3018 (check-stream-equal _test-output-stream "" "F - test-unknown-variable: output should be empty") - 3019 (check-next-stream-line-equal _test-error-stream "fn foo: unknown variable 'x'" "F - test-unknown-variable: error message") - 3020 # check that stop(1) was called - 3021 (check-ints-equal *(edx+4) 2 "F - test-unknown-variable: exit status") - 3022 # don't restore from ebp - 3023 81 0/subop/add %esp 8/imm32 - 3024 # . epilogue - 3025 5d/pop-to-ebp - 3026 c3/return - 3027 - 3028 test-convert-function-with-local-var-in-block: - 3029 # . prologue - 3030 55/push-ebp - 3031 89/<- %ebp 4/r32/esp - 3032 # setup - 3033 (clear-stream _test-input-stream) - 3034 (clear-stream $_test-input-buffered-file->buffer) - 3035 (clear-stream _test-output-stream) - 3036 (clear-stream $_test-output-buffered-file->buffer) - 3037 # - 3038 (write _test-input-stream "fn foo {\n") - 3039 (write _test-input-stream " {\n") - 3040 (write _test-input-stream " var x: int\n") - 3041 (write _test-input-stream " increment x\n") - 3042 (write _test-input-stream " }\n") - 3043 (write _test-input-stream "}\n") - 3044 # convert - 3045 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3046 (flush _test-output-buffered-file) - 3047 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3053 # check output - 3054 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-block/0") - 3055 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-block/1") - 3056 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-block/2") - 3057 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-block/3") - 3058 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/4") - 3059 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-block/5") - 3060 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/6") - 3061 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-block/7") - 3062 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-block/8") - 3063 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-block/9") - 3064 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-block/10") - 3065 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/11") - 3066 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-block/12") - 3067 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/13") - 3068 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-block/14") - 3069 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-block/15") - 3070 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-block/16") - 3071 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-block/17") - 3072 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-block/18") - 3073 # . epilogue - 3074 89/<- %esp 5/r32/ebp - 3075 5d/pop-to-ebp - 3076 c3/return - 3077 - 3078 test-convert-function-with-local-var-in-mem-after-block: - 3079 # . prologue - 3080 55/push-ebp - 3081 89/<- %ebp 4/r32/esp - 3082 # setup - 3083 (clear-stream _test-input-stream) - 3084 (clear-stream $_test-input-buffered-file->buffer) - 3085 (clear-stream _test-output-stream) - 3086 (clear-stream $_test-output-buffered-file->buffer) - 3087 # - 3088 (write _test-input-stream "fn foo {\n") - 3089 (write _test-input-stream " {\n") - 3090 (write _test-input-stream " var y: int\n") - 3091 (write _test-input-stream " }\n") - 3092 (write _test-input-stream " var x: int\n") - 3093 (write _test-input-stream " increment x\n") - 3094 (write _test-input-stream "}\n") - 3095 # convert - 3096 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3097 (flush _test-output-buffered-file) - 3098 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3104 # check output - 3105 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem-after-block/0") - 3106 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem-after-block/1") - 3107 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem-after-block/2") - 3108 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-mem-after-block/3") - 3109 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem-after-block/4") - 3110 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-mem-after-block/5") - 3111 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem-after-block/6") - 3112 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-mem-after-block/7") - 3113 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem-after-block/8") - 3114 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-mem-after-block/9") - 3115 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem-after-block/10") - 3116 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-mem-after-block/11") - 3117 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem-after-block/12") - 3118 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-mem-after-block/13") - 3119 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-mem-after-block/14") - 3120 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem-after-block/15") - 3121 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-mem-after-block/16") - 3122 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem-after-block/17") - 3123 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-mem-after-block/18") - 3124 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem-after-block/19") - 3125 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem-after-block/20") - 3126 # . epilogue - 3127 89/<- %esp 5/r32/ebp - 3128 5d/pop-to-ebp - 3129 c3/return - 3130 - 3131 test-convert-function-with-local-var-in-named-block: - 3132 # . prologue - 3133 55/push-ebp - 3134 89/<- %ebp 4/r32/esp - 3135 # setup - 3136 (clear-stream _test-input-stream) - 3137 (clear-stream $_test-input-buffered-file->buffer) - 3138 (clear-stream _test-output-stream) - 3139 (clear-stream $_test-output-buffered-file->buffer) - 3140 # - 3141 (write _test-input-stream "fn foo {\n") - 3142 (write _test-input-stream " $bar: {\n") - 3143 (write _test-input-stream " var x: int\n") - 3144 (write _test-input-stream " increment x\n") - 3145 (write _test-input-stream " }\n") - 3146 (write _test-input-stream "}\n") - 3147 # convert - 3148 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3149 (flush _test-output-buffered-file) - 3150 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3156 # check output - 3157 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-named-block/0") - 3158 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-named-block/1") - 3159 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-named-block/2") - 3160 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-named-block/3") - 3161 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/4") - 3162 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-named-block/5") - 3163 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/6") - 3164 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-local-var-in-named-block/7") - 3165 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-named-block/8") - 3166 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-named-block/9") - 3167 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-named-block/10") - 3168 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/11") - 3169 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-local-var-in-named-block/12") - 3170 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/13") - 3171 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-named-block/14") - 3172 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-named-block/15") - 3173 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-named-block/16") - 3174 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-named-block/17") - 3175 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-named-block/18") - 3176 # . epilogue - 3177 89/<- %esp 5/r32/ebp - 3178 5d/pop-to-ebp - 3179 c3/return - 3180 - 3181 test-unknown-variable-in-named-block: - 3182 # . prologue - 3183 55/push-ebp - 3184 89/<- %ebp 4/r32/esp - 3185 # setup - 3186 (clear-stream _test-input-stream) - 3187 (clear-stream $_test-input-buffered-file->buffer) - 3188 (clear-stream _test-output-stream) - 3189 (clear-stream $_test-output-buffered-file->buffer) - 3190 (clear-stream _test-error-stream) - 3191 (clear-stream $_test-error-buffered-file->buffer) - 3192 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 3193 68/push 0/imm32 - 3194 68/push 0/imm32 - 3195 89/<- %edx 4/r32/esp - 3196 (tailor-exit-descriptor %edx 0x10) - 3197 # - 3198 (write _test-input-stream "fn foo {\n") - 3199 (write _test-input-stream " $a: {\n") - 3200 (write _test-input-stream " compare x, 0\n") - 3201 (write _test-input-stream " }\n") - 3202 (write _test-input-stream "}\n") - 3203 # convert - 3204 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 3205 # registers except esp clobbered at this point - 3206 # restore ed - 3207 89/<- %edx 4/r32/esp - 3208 (flush _test-output-buffered-file) - 3209 (flush _test-error-buffered-file) - 3210 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 3216 # check output - 3217 (check-stream-equal _test-output-stream "" "F - test-unknown-variable-in-named-block: output should be empty") - 3218 (check-next-stream-line-equal _test-error-stream "fn foo: unknown variable 'x'" "F - test-unknown-variable-in-named-block: error message") - 3219 # check that stop(1) was called - 3220 (check-ints-equal *(edx+4) 2 "F - test-unknown-variable-in-named-block: exit status") - 3221 # don't restore from ebp - 3222 81 0/subop/add %esp 8/imm32 - 3223 # . epilogue - 3224 5d/pop-to-ebp - 3225 c3/return - 3226 - 3227 test-always-shadow-outermost-reg-vars-in-function: - 3228 # . prologue - 3229 55/push-ebp - 3230 89/<- %ebp 4/r32/esp - 3231 # setup - 3232 (clear-stream _test-input-stream) - 3233 (clear-stream $_test-input-buffered-file->buffer) - 3234 (clear-stream _test-output-stream) - 3235 (clear-stream $_test-output-buffered-file->buffer) - 3236 # - 3237 (write _test-input-stream "fn foo {\n") - 3238 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 3239 (write _test-input-stream "}\n") - 3240 # convert - 3241 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3242 (flush _test-output-buffered-file) - 3243 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3249 # check output - 3250 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-always-shadow-outermost-reg-vars-in-function/0") - 3251 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-always-shadow-outermost-reg-vars-in-function/1") - 3252 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/2") - 3253 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-always-shadow-outermost-reg-vars-in-function/3") - 3254 (check-next-stream-line-equal _test-output-stream " {" "F - test-always-shadow-outermost-reg-vars-in-function/4") - 3255 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-always-shadow-outermost-reg-vars-in-function/5") - 3256 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") - 3257 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-always-shadow-outermost-reg-vars-in-function/8") - 3258 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") - 3259 (check-next-stream-line-equal _test-output-stream " }" "F - test-always-shadow-outermost-reg-vars-in-function/12") - 3260 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-always-shadow-outermost-reg-vars-in-function/13") - 3261 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-always-shadow-outermost-reg-vars-in-function/14") - 3262 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-always-shadow-outermost-reg-vars-in-function/15") - 3263 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/16") - 3264 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-always-shadow-outermost-reg-vars-in-function/17") - 3265 # . epilogue - 3266 89/<- %esp 5/r32/ebp - 3267 5d/pop-to-ebp - 3268 c3/return - 3269 - 3270 test-shadow-local: - 3271 # . prologue - 3272 55/push-ebp - 3273 89/<- %ebp 4/r32/esp - 3274 # setup - 3275 (clear-stream _test-input-stream) - 3276 (clear-stream $_test-input-buffered-file->buffer) - 3277 (clear-stream _test-output-stream) - 3278 (clear-stream $_test-output-buffered-file->buffer) - 3279 # - 3280 (write _test-input-stream "fn foo {\n") - 3281 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 3282 (write _test-input-stream " {\n") - 3283 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 3284 (write _test-input-stream " }\n") - 3285 (write _test-input-stream " x <- increment\n") - 3286 (write _test-input-stream "}\n") - 3287 # convert - 3288 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3289 (flush _test-output-buffered-file) - 3290 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3296 # check output - 3297 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-local/0") - 3298 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-local/1") - 3299 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-local/2") - 3300 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-local/3") - 3301 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-local/4") - 3302 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-local/5") - 3303 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-local/6") - 3304 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-local/7") - 3305 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-local/8") - 3306 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-local/9") - 3307 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-local/10") - 3308 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-local/11") - 3309 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-local/12") - 3310 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-local/13") - 3311 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-local/14") - 3312 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-local/15") - 3313 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-local/16") - 3314 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-local/17") - 3315 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-local/18") - 3316 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-local/19") - 3317 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-local/20") - 3318 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-local/21") - 3319 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-local/22") - 3320 # . epilogue - 3321 89/<- %esp 5/r32/ebp - 3322 5d/pop-to-ebp - 3323 c3/return - 3324 - 3325 test-shadow-name: - 3326 # . prologue - 3327 55/push-ebp - 3328 89/<- %ebp 4/r32/esp - 3329 # setup - 3330 (clear-stream _test-input-stream) - 3331 (clear-stream $_test-input-buffered-file->buffer) - 3332 (clear-stream _test-output-stream) - 3333 (clear-stream $_test-output-buffered-file->buffer) - 3334 # - 3335 (write _test-input-stream "fn foo {\n") - 3336 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 3337 (write _test-input-stream " {\n") - 3338 (write _test-input-stream " var x/edx: int <- copy 4\n") - 3339 (write _test-input-stream " }\n") - 3340 (write _test-input-stream " x <- increment\n") - 3341 (write _test-input-stream "}\n") - 3342 # convert - 3343 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3344 (flush _test-output-buffered-file) - 3345 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3351 # check output - 3352 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-name/0") - 3353 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-name/1") - 3354 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-name/2") - 3355 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-name/3") - 3356 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name/4") - 3357 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-name/5") - 3358 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-name/6") - 3359 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-name/7") - 3360 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name/8") - 3361 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-name/9") - 3362 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-shadow-name/10") - 3363 (check-next-stream-line-equal _test-output-stream " ba/copy-to-edx 4/imm32" "F - test-shadow-name/11") - 3364 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-shadow-name/12") - 3365 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name/13") - 3366 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-name/14") - 3367 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-name/15") - 3368 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-name/16") - 3369 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name/17") - 3370 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-name/18") - 3371 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-name/19") - 3372 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-name/20") - 3373 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-name/21") - 3374 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-name/22") - 3375 # . epilogue - 3376 89/<- %esp 5/r32/ebp - 3377 5d/pop-to-ebp - 3378 c3/return - 3379 - 3380 test-shadow-name-2: - 3381 # . prologue - 3382 55/push-ebp - 3383 89/<- %ebp 4/r32/esp - 3384 # setup - 3385 (clear-stream _test-input-stream) - 3386 (clear-stream $_test-input-buffered-file->buffer) - 3387 (clear-stream _test-output-stream) - 3388 (clear-stream $_test-output-buffered-file->buffer) - 3389 # - 3390 (write _test-input-stream "fn foo {\n") - 3391 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 3392 (write _test-input-stream " {\n") - 3393 (write _test-input-stream " var x/edx: int <- copy 4\n") - 3394 (write _test-input-stream " var y/ecx: int <- copy 5\n") - 3395 (write _test-input-stream " }\n") - 3396 (write _test-input-stream " x <- increment\n") - 3397 (write _test-input-stream "}\n") - 3398 # convert - 3399 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3400 (flush _test-output-buffered-file) - 3401 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3407 # check output - 3408 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-name-2/0") - 3409 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-name-2/1") - 3410 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-name-2/2") - 3411 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-name-2/3") - 3412 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name-2/4") - 3413 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-name-2/5") - 3414 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-name-2/6") - 3415 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-name-2/7") - 3416 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name-2/8") - 3417 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-name-2/9") - 3418 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-shadow-name-2/10") - 3419 (check-next-stream-line-equal _test-output-stream " ba/copy-to-edx 4/imm32" "F - test-shadow-name-2/11") - 3420 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-name-2/12") - 3421 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 5/imm32" "F - test-shadow-name-2/13") - 3422 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-name-2/14") - 3423 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-shadow-name-2/15") - 3424 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name-2/16") - 3425 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-name-2/17") - 3426 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-name-2/18") - 3427 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-name-2/19") - 3428 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name-2/20") - 3429 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-name-2/21") - 3430 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-name-2/22") - 3431 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-name-2/23") - 3432 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-name-2/24") - 3433 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-name-2/25") - 3434 # . epilogue - 3435 89/<- %esp 5/r32/ebp - 3436 5d/pop-to-ebp - 3437 c3/return - 3438 - 3439 test-do-not-spill-same-register-in-block: - 3440 # . prologue - 3441 55/push-ebp - 3442 89/<- %ebp 4/r32/esp - 3443 # setup - 3444 (clear-stream _test-input-stream) - 3445 (clear-stream $_test-input-buffered-file->buffer) - 3446 (clear-stream _test-output-stream) - 3447 (clear-stream $_test-output-buffered-file->buffer) - 3448 # - 3449 (write _test-input-stream "fn foo {\n") - 3450 (write _test-input-stream " var x/ecx: int <- copy 3\n") - 3451 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 3452 (write _test-input-stream " y <- increment\n") - 3453 (write _test-input-stream "}\n") - 3454 # convert - 3455 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3456 (flush _test-output-buffered-file) - 3457 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3463 # check output - 3464 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-do-not-spill-same-register-in-block/0") - 3465 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-do-not-spill-same-register-in-block/1") - 3466 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-do-not-spill-same-register-in-block/2") - 3467 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-do-not-spill-same-register-in-block/3") - 3468 (check-next-stream-line-equal _test-output-stream " {" "F - test-do-not-spill-same-register-in-block/4") - 3469 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-do-not-spill-same-register-in-block/5") - 3470 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-do-not-spill-same-register-in-block/6") - 3471 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-do-not-spill-same-register-in-block/7") - 3472 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-do-not-spill-same-register-in-block/8") - 3473 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-do-not-spill-same-register-in-block/9") - 3474 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-do-not-spill-same-register-in-block/10") - 3475 (check-next-stream-line-equal _test-output-stream " }" "F - test-do-not-spill-same-register-in-block/11") - 3476 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-do-not-spill-same-register-in-block/12") - 3477 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-do-not-spill-same-register-in-block/13") - 3478 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-do-not-spill-same-register-in-block/14") - 3479 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-do-not-spill-same-register-in-block/15") - 3480 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-do-not-spill-same-register-in-block/16") - 3481 # . epilogue - 3482 89/<- %esp 5/r32/ebp - 3483 5d/pop-to-ebp - 3484 c3/return - 3485 - 3486 test-spill-different-register-in-block: - 3487 # . prologue - 3488 55/push-ebp - 3489 89/<- %ebp 4/r32/esp - 3490 # setup - 3491 (clear-stream _test-input-stream) - 3492 (clear-stream $_test-input-buffered-file->buffer) - 3493 (clear-stream _test-output-stream) - 3494 (clear-stream $_test-output-buffered-file->buffer) - 3495 # - 3496 (write _test-input-stream "fn foo {\n") - 3497 (write _test-input-stream " var x/eax: int <- copy 3\n") - 3498 (write _test-input-stream " var y/ecx: int <- copy 4\n") - 3499 (write _test-input-stream " y <- increment\n") - 3500 (write _test-input-stream "}\n") - 3501 # convert - 3502 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3503 (flush _test-output-buffered-file) - 3504 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3510 # check output - 3511 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-spill-different-register-in-block/0") - 3512 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-spill-different-register-in-block/1") - 3513 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-spill-different-register-in-block/2") - 3514 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-spill-different-register-in-block/3") - 3515 (check-next-stream-line-equal _test-output-stream " {" "F - test-spill-different-register-in-block/4") - 3516 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-spill-different-register-in-block/5") - 3517 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-spill-different-register-in-block/6") - 3518 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-spill-different-register-in-block/7") - 3519 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-spill-different-register-in-block/8") - 3520 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-spill-different-register-in-block/9") - 3521 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-spill-different-register-in-block/10") - 3522 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-spill-different-register-in-block/11") - 3523 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-spill-different-register-in-block/12") - 3524 (check-next-stream-line-equal _test-output-stream " }" "F - test-spill-different-register-in-block/13") - 3525 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-spill-different-register-in-block/14") - 3526 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-spill-different-register-in-block/15") - 3527 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-spill-different-register-in-block/16") - 3528 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-spill-different-register-in-block/17") - 3529 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-spill-different-register-in-block/18") - 3530 # . epilogue - 3531 89/<- %esp 5/r32/ebp - 3532 5d/pop-to-ebp - 3533 c3/return - 3534 - 3535 test-convert-function-with-branches-in-block: - 3536 # . prologue - 3537 55/push-ebp - 3538 89/<- %ebp 4/r32/esp - 3539 # setup - 3540 (clear-stream _test-input-stream) - 3541 (clear-stream $_test-input-buffered-file->buffer) - 3542 (clear-stream _test-output-stream) - 3543 (clear-stream $_test-output-buffered-file->buffer) - 3544 # - 3545 (write _test-input-stream "fn foo x: int {\n") - 3546 (write _test-input-stream " {\n") - 3547 (write _test-input-stream " break-if->=\n") - 3548 (write _test-input-stream " loop-if-addr<\n") - 3549 (write _test-input-stream " increment x\n") - 3550 (write _test-input-stream " loop\n") - 3551 (write _test-input-stream " }\n") - 3552 (write _test-input-stream "}\n") - 3553 # convert - 3554 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3555 (flush _test-output-buffered-file) - 3556 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3562 # check output - 3563 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0") - 3564 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1") - 3565 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2") - 3566 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3") - 3567 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4") - 3568 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5") - 3569 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6") - 3570 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7") - 3571 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/8") - 3572 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-block/9") - 3573 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-in-block/10") - 3574 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/11") - 3575 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/12") - 3576 (check-next-stream-line-equal _test-output-stream " 0f 83/jump-if-addr>= break/disp32" "F - test-convert-function-with-branches-in-block/13") - 3577 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-branches-in-block/14") - 3578 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/15") - 3579 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/16") - 3580 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/17") - 3581 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/18") - 3582 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/19") - 3583 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/20") - 3584 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/21") - 3585 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/22") - 3586 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/23") - 3587 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/24") - 3588 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/25") - 3589 # . epilogue - 3590 89/<- %esp 5/r32/ebp - 3591 5d/pop-to-ebp - 3592 c3/return - 3593 - 3594 test-convert-function-with-branches-in-block-2: - 3595 # . prologue - 3596 55/push-ebp - 3597 89/<- %ebp 4/r32/esp - 3598 # setup - 3599 (clear-stream _test-input-stream) - 3600 (clear-stream $_test-input-buffered-file->buffer) - 3601 (clear-stream _test-output-stream) - 3602 (clear-stream $_test-output-buffered-file->buffer) - 3603 # - 3604 (write _test-input-stream "fn foo x: int {\n") - 3605 (write _test-input-stream " {\n") - 3606 (write _test-input-stream " break-if->=\n") - 3607 (write _test-input-stream " loop-if-float<\n") - 3608 (write _test-input-stream " increment x\n") - 3609 (write _test-input-stream " loop\n") - 3610 (write _test-input-stream " }\n") - 3611 (write _test-input-stream "}\n") - 3612 # convert - 3613 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3614 (flush _test-output-buffered-file) - 3615 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3621 # check output - 3622 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0") - 3623 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1") - 3624 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2") - 3625 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3") - 3626 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4") - 3627 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5") - 3628 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6") - 3629 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7") - 3630 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/8") - 3631 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-block/9") - 3632 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-in-block/10") - 3633 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/11") - 3634 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/12") - 3635 (check-next-stream-line-equal _test-output-stream " 0f 83/jump-if-addr>= break/disp32" "F - test-convert-function-with-branches-in-block/13") - 3636 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-branches-in-block/14") - 3637 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/15") - 3638 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/16") - 3639 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/17") - 3640 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/18") - 3641 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/19") - 3642 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/20") - 3643 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/21") - 3644 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/22") - 3645 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/23") - 3646 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/24") - 3647 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/25") - 3648 # . epilogue - 3649 89/<- %esp 5/r32/ebp - 3650 5d/pop-to-ebp - 3651 c3/return - 3652 - 3653 test-convert-function-with-branches-in-named-block: - 3654 # . prologue - 3655 55/push-ebp - 3656 89/<- %ebp 4/r32/esp - 3657 # setup - 3658 (clear-stream _test-input-stream) - 3659 (clear-stream $_test-input-buffered-file->buffer) - 3660 (clear-stream _test-output-stream) - 3661 (clear-stream $_test-output-buffered-file->buffer) - 3662 # - 3663 (write _test-input-stream "fn foo x: int {\n") - 3664 (write _test-input-stream " $bar: {\n") - 3665 (write _test-input-stream " break-if->= $bar\n") - 3666 (write _test-input-stream " loop-if-addr< $bar\n") - 3667 (write _test-input-stream " increment x\n") - 3668 (write _test-input-stream " loop\n") - 3669 (write _test-input-stream " }\n") - 3670 (write _test-input-stream "}\n") - 3671 # convert - 3672 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3673 (flush _test-output-buffered-file) - 3674 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3680 # check output - 3681 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-named-block/0") - 3682 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-named-block/1") - 3683 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-named-block/2") - 3684 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-named-block/3") - 3685 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/4") - 3686 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-named-block/5") - 3687 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/6") - 3688 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-branches-in-named-block/7") - 3689 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/8") - 3690 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-named-block/9") - 3691 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:break/disp32" "F - test-convert-function-with-branches-in-named-block/10") - 3692 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/11") - 3693 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/12") - 3694 (check-next-stream-line-equal _test-output-stream " 0f 83/jump-if-addr>= break/disp32" "F - test-convert-function-with-branches-in-named-block/13") - 3695 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:loop/disp32" "F - test-convert-function-with-branches-in-named-block/14") - 3696 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/15") - 3697 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-named-block/16") - 3698 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-named-block/17") - 3699 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/18") - 3700 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-branches-in-named-block/19") - 3701 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/20") - 3702 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-named-block/21") - 3703 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-named-block/22") - 3704 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-named-block/23") - 3705 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-named-block/24") - 3706 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-named-block/25") - 3707 # . epilogue - 3708 89/<- %esp 5/r32/ebp - 3709 5d/pop-to-ebp - 3710 c3/return - 3711 - 3712 test-convert-function-with-var-in-nested-block: - 3713 # . prologue - 3714 55/push-ebp - 3715 89/<- %ebp 4/r32/esp - 3716 # setup - 3717 (clear-stream _test-input-stream) - 3718 (clear-stream $_test-input-buffered-file->buffer) - 3719 (clear-stream _test-output-stream) - 3720 (clear-stream $_test-output-buffered-file->buffer) - 3721 # - 3722 (write _test-input-stream "fn foo x: int {\n") - 3723 (write _test-input-stream " {\n") - 3724 (write _test-input-stream " {\n") - 3725 (write _test-input-stream " var x: int\n") - 3726 (write _test-input-stream " increment x\n") - 3727 (write _test-input-stream " }\n") - 3728 (write _test-input-stream " }\n") - 3729 (write _test-input-stream "}\n") - 3730 # convert - 3731 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3732 (flush _test-output-buffered-file) - 3733 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3739 # check output - 3740 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0") - 3741 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-var-in-nested-block/1") - 3742 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2") - 3743 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3") - 3744 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/4") - 3745 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-var-in-nested-block/5") - 3746 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/6") - 3747 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-var-in-nested-block/7") - 3748 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/8") - 3749 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-var-in-nested-block/9") - 3750 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/10") - 3751 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-var-in-nested-block/11") - 3752 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-var-in-nested-block/12") - 3753 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/13") - 3754 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-var-in-nested-block/14") - 3755 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/15") - 3756 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-var-in-nested-block/16") - 3757 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/17") - 3758 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-var-in-nested-block/18") - 3759 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-var-in-nested-block/19") - 3760 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/20") - 3761 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/21") - 3762 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-var-in-nested-block/22") - 3763 # . epilogue - 3764 89/<- %esp 5/r32/ebp - 3765 5d/pop-to-ebp - 3766 c3/return - 3767 - 3768 test-convert-function-with-multiple-vars-in-nested-blocks: - 3769 # . prologue - 3770 55/push-ebp - 3771 89/<- %ebp 4/r32/esp - 3772 # setup - 3773 (clear-stream _test-input-stream) - 3774 (clear-stream $_test-input-buffered-file->buffer) - 3775 (clear-stream _test-output-stream) - 3776 (clear-stream $_test-output-buffered-file->buffer) - 3777 # - 3778 (write _test-input-stream "fn foo x: int {\n") - 3779 (write _test-input-stream " {\n") - 3780 (write _test-input-stream " var x/eax: int <- copy 0\n") - 3781 (write _test-input-stream " {\n") - 3782 (write _test-input-stream " var y: int\n") - 3783 (write _test-input-stream " x <- add y\n") - 3784 (write _test-input-stream " }\n") - 3785 (write _test-input-stream " }\n") - 3786 (write _test-input-stream "}\n") - 3787 # convert - 3788 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3789 (flush _test-output-buffered-file) - 3790 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3796 # check output - 3797 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/0") - 3798 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/1") - 3799 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/2") - 3800 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/3") - 3801 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/4") - 3802 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/5") - 3803 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/6") - 3804 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/7") - 3805 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/8") - 3806 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/9") - 3807 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/10") - 3808 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/11") - 3809 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/12") - 3810 (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0xfffffff8) 0x00000000/r32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/13") - 3811 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/14") - 3812 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/15") - 3813 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/16") - 3814 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/17") - 3815 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/18") - 3816 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/19") - 3817 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/20") - 3818 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/21") - 3819 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/22") - 3820 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/23") - 3821 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/24") - 3822 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-multiple-vars-in-nested-blocks/25") - 3823 # . epilogue - 3824 89/<- %esp 5/r32/ebp - 3825 5d/pop-to-ebp - 3826 c3/return - 3827 - 3828 test-convert-function-with-branches-and-local-vars: - 3829 # A conditional 'break' after a 'var' in a block is converted into a - 3830 # nested block that performs all necessary cleanup before jumping. This - 3831 # results in some ugly code duplication. - 3832 # . prologue - 3833 55/push-ebp - 3834 89/<- %ebp 4/r32/esp - 3835 # setup - 3836 (clear-stream _test-input-stream) - 3837 (clear-stream $_test-input-buffered-file->buffer) - 3838 (clear-stream _test-output-stream) - 3839 (clear-stream $_test-output-buffered-file->buffer) - 3840 # - 3841 (write _test-input-stream "fn foo {\n") - 3842 (write _test-input-stream " {\n") - 3843 (write _test-input-stream " var x: int\n") - 3844 (write _test-input-stream " break-if->=\n") - 3845 (write _test-input-stream " increment x\n") - 3846 (write _test-input-stream " }\n") - 3847 (write _test-input-stream "}\n") - 3848 # convert - 3849 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3850 (flush _test-output-buffered-file) - 3851 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3857 # check output - 3858 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-local-vars/0") - 3859 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-local-vars/1") - 3860 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-local-vars/2") - 3861 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-local-vars/3") - 3862 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/4") - 3863 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-local-vars/5") - 3864 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/6") - 3865 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-local-vars/7") - 3866 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-local-vars/8") - 3867 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/9") - 3868 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-local-vars/10") - 3869 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-local-vars/11") - 3870 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-local-vars/12") - 3871 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/13") - 3872 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-local-vars/14") - 3873 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-local-vars/15") - 3874 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/16") - 3875 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-local-vars/17") - 3876 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/18") - 3877 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-local-vars/19") - 3878 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-local-vars/20") - 3879 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-local-vars/21") - 3880 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-local-vars/22") - 3881 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-local-vars/23") - 3882 # . epilogue - 3883 89/<- %esp 5/r32/ebp - 3884 5d/pop-to-ebp - 3885 c3/return - 3886 - 3887 test-convert-function-with-conditional-loops-and-local-vars: - 3888 # A conditional 'loop' after a 'var' in a block is converted into a nested - 3889 # block that performs all necessary cleanup before jumping. This results - 3890 # in some ugly code duplication. - 3891 # . prologue - 3892 55/push-ebp - 3893 89/<- %ebp 4/r32/esp - 3894 # setup - 3895 (clear-stream _test-input-stream) - 3896 (clear-stream $_test-input-buffered-file->buffer) - 3897 (clear-stream _test-output-stream) - 3898 (clear-stream $_test-output-buffered-file->buffer) - 3899 # - 3900 (write _test-input-stream "fn foo {\n") - 3901 (write _test-input-stream " {\n") - 3902 (write _test-input-stream " var x: int\n") - 3903 (write _test-input-stream " loop-if->=\n") - 3904 (write _test-input-stream " increment x\n") - 3905 (write _test-input-stream " }\n") - 3906 (write _test-input-stream "}\n") - 3907 # convert - 3908 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3909 (flush _test-output-buffered-file) - 3910 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3916 # check output - 3917 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-conditional-loops-and-local-vars/0") - 3918 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-conditional-loops-and-local-vars/1") - 3919 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/2") - 3920 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-conditional-loops-and-local-vars/3") - 3921 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/4") - 3922 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/5") - 3923 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/6") - 3924 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/7") - 3925 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/8") - 3926 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/9") - 3927 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-conditional-loops-and-local-vars/10") - 3928 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/11") - 3929 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-conditional-loops-and-local-vars/12") - 3930 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/13") - 3931 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-conditional-loops-and-local-vars/14") - 3932 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/15") - 3933 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/16") - 3934 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/17") - 3935 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/18") - 3936 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/19") - 3937 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-conditional-loops-and-local-vars/20") - 3938 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/21") - 3939 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/22") - 3940 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-conditional-loops-and-local-vars/23") - 3941 # . epilogue - 3942 89/<- %esp 5/r32/ebp - 3943 5d/pop-to-ebp - 3944 c3/return - 3945 - 3946 test-convert-function-with-unconditional-loops-and-local-vars: - 3947 # An unconditional 'loop' after a 'var' in a block is emitted _after_ the - 3948 # regular block cleanup. Any instructions after 'loop' are dead and - 3949 # therefore skipped. - 3950 # . prologue - 3951 55/push-ebp - 3952 89/<- %ebp 4/r32/esp - 3953 # setup - 3954 (clear-stream _test-input-stream) - 3955 (clear-stream $_test-input-buffered-file->buffer) - 3956 (clear-stream _test-output-stream) - 3957 (clear-stream $_test-output-buffered-file->buffer) - 3958 # - 3959 (write _test-input-stream "fn foo {\n") - 3960 (write _test-input-stream " {\n") - 3961 (write _test-input-stream " var x: int\n") - 3962 (write _test-input-stream " loop\n") - 3963 (write _test-input-stream " increment x\n") - 3964 (write _test-input-stream " }\n") - 3965 (write _test-input-stream "}\n") - 3966 # convert - 3967 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 3968 (flush _test-output-buffered-file) - 3969 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 3975 # check output - 3976 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-loops-and-local-vars/0") - 3977 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-loops-and-local-vars/1") - 3978 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/2") - 3979 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-loops-and-local-vars/3") - 3980 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/4") - 3981 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/5") - 3982 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/6") - 3983 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/7") - 3984 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/8") - 3985 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/9") - 3986 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-unconditional-loops-and-local-vars/10") - 3987 # not emitted: ff 0/subop/increment *(ebp+0xfffffffc) - 3988 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/11") - 3989 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/12") - 3990 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/13") - 3991 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/14") - 3992 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-loops-and-local-vars/15") - 3993 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/16") - 3994 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/17") - 3995 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-loops-and-local-vars/18") - 3996 # . epilogue - 3997 89/<- %esp 5/r32/ebp - 3998 5d/pop-to-ebp - 3999 c3/return - 4000 - 4001 test-convert-function-with-branches-and-loops-and-local-vars: - 4002 # . prologue - 4003 55/push-ebp - 4004 89/<- %ebp 4/r32/esp - 4005 # setup - 4006 (clear-stream _test-input-stream) - 4007 (clear-stream $_test-input-buffered-file->buffer) - 4008 (clear-stream _test-output-stream) - 4009 (clear-stream $_test-output-buffered-file->buffer) - 4010 # - 4011 (write _test-input-stream "fn foo {\n") - 4012 (write _test-input-stream " {\n") - 4013 (write _test-input-stream " var x: int\n") - 4014 (write _test-input-stream " break-if->=\n") - 4015 (write _test-input-stream " increment x\n") - 4016 (write _test-input-stream " loop\n") - 4017 (write _test-input-stream " }\n") - 4018 (write _test-input-stream "}\n") - 4019 # convert - 4020 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4021 (flush _test-output-buffered-file) - 4022 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4028 # check output - 4029 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-loops-and-local-vars/0") - 4030 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-loops-and-local-vars/1") - 4031 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/2") - 4032 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-loops-and-local-vars/3") - 4033 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/4") - 4034 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/5") - 4035 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/6") - 4036 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/7") - 4037 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/8") - 4038 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/9") - 4039 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/10") - 4040 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/11") - 4041 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/12") - 4042 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/13") - 4043 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-loops-and-local-vars/14") - 4044 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/15") - 4045 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/16") - 4046 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/17") - 4047 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/18") - 4048 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/19") - 4049 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/20") - 4050 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-loops-and-local-vars/21") - 4051 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/22") - 4052 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/23") - 4053 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-loops-and-local-vars/24") - 4054 # . epilogue - 4055 89/<- %esp 5/r32/ebp - 4056 5d/pop-to-ebp - 4057 c3/return - 4058 - 4059 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars: - 4060 # . prologue - 4061 55/push-ebp - 4062 89/<- %ebp 4/r32/esp - 4063 # setup - 4064 (clear-stream _test-input-stream) - 4065 (clear-stream $_test-input-buffered-file->buffer) - 4066 (clear-stream _test-output-stream) - 4067 (clear-stream $_test-output-buffered-file->buffer) - 4068 # - 4069 (write _test-input-stream "fn foo {\n") - 4070 (write _test-input-stream " a: {\n") - 4071 (write _test-input-stream " var x: int\n") - 4072 (write _test-input-stream " {\n") - 4073 (write _test-input-stream " var y: int\n") - 4074 (write _test-input-stream " break-if->= a\n") - 4075 (write _test-input-stream " increment x\n") - 4076 (write _test-input-stream " loop\n") - 4077 (write _test-input-stream " }\n") - 4078 (write _test-input-stream " }\n") - 4079 (write _test-input-stream "}\n") - 4080 # convert - 4081 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4082 (flush _test-output-buffered-file) - 4083 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4089 # check output - 4090 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/0") - 4091 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/1") - 4092 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/2") - 4093 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/3") - 4094 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/4") - 4095 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/5") - 4096 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/6") - 4097 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/7") - 4098 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/8") - 4099 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/9") - 4100 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/10") - 4101 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/11") - 4102 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/12") - 4103 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/13") - 4104 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/14") - 4105 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/15") - 4106 (check-next-stream-line-equal _test-output-stream " e9/jump a:break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/16") - 4107 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/17") - 4108 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/18") - 4109 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/19") - 4110 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/20") - 4111 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/21") - 4112 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/22") - 4113 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/23") - 4114 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/24") - 4115 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/25") - 4116 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/26") - 4117 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/27") - 4118 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/28") - 4119 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/29") - 4120 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/30") - 4121 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/31") - 4122 # . epilogue - 4123 89/<- %esp 5/r32/ebp - 4124 5d/pop-to-ebp - 4125 c3/return - 4126 - 4127 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2: - 4128 # . prologue - 4129 55/push-ebp - 4130 89/<- %ebp 4/r32/esp - 4131 # setup - 4132 (clear-stream _test-input-stream) - 4133 (clear-stream $_test-input-buffered-file->buffer) - 4134 (clear-stream _test-output-stream) - 4135 (clear-stream $_test-output-buffered-file->buffer) - 4136 # non-local conditional branch from a block without a local variable, - 4137 # unwinding a local on the stack - 4138 (write _test-input-stream "fn foo {\n") - 4139 (write _test-input-stream " a: {\n") - 4140 (write _test-input-stream " var x: int\n") - 4141 (write _test-input-stream " {\n") - 4142 (write _test-input-stream " break-if->= a\n") - 4143 (write _test-input-stream " }\n") - 4144 (write _test-input-stream " }\n") - 4145 (write _test-input-stream "}\n") - 4146 # convert - 4147 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4148 (flush _test-output-buffered-file) - 4149 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4155 # check output - 4156 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/0") - 4157 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/1") - 4158 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/2") - 4159 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/3") - 4160 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/4") - 4161 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/5") - 4162 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/6") - 4163 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/7") - 4164 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/8") - 4165 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/9") - 4166 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/10") - 4167 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/11") - 4168 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/12") - 4169 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/13") - 4170 (check-next-stream-line-equal _test-output-stream " e9/jump a:break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/14") - 4171 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/15") - 4172 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/16") - 4173 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/17") - 4174 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/18") - 4175 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/19") - 4176 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/20") - 4177 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/21") - 4178 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/22") - 4179 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/23") - 4180 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/24") - 4181 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/25") - 4182 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/26") - 4183 # . epilogue - 4184 89/<- %esp 5/r32/ebp - 4185 5d/pop-to-ebp - 4186 c3/return - 4187 - 4188 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3: - 4189 # . prologue - 4190 55/push-ebp - 4191 89/<- %ebp 4/r32/esp - 4192 # setup - 4193 (clear-stream _test-input-stream) - 4194 (clear-stream $_test-input-buffered-file->buffer) - 4195 (clear-stream _test-output-stream) - 4196 (clear-stream $_test-output-buffered-file->buffer) - 4197 # non-local unconditional branch from a block without a local variable, - 4198 # unwinding a local on the stack - 4199 (write _test-input-stream "fn foo {\n") - 4200 (write _test-input-stream " a: {\n") - 4201 (write _test-input-stream " var x: int\n") - 4202 (write _test-input-stream " {\n") - 4203 (write _test-input-stream " break a\n") - 4204 (write _test-input-stream " }\n") - 4205 (write _test-input-stream " }\n") - 4206 (write _test-input-stream "}\n") - 4207 # convert - 4208 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4209 (flush _test-output-buffered-file) - 4210 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4216 # check output - 4217 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/0") - 4218 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/1") - 4219 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/2") - 4220 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/3") - 4221 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/4") - 4222 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/5") - 4223 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/6") - 4224 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/7") - 4225 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/8") - 4226 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/9") - 4227 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/10") - 4228 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/11") - 4229 (check-next-stream-line-equal _test-output-stream " e9/jump a:break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/12") - 4230 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/14") - 4231 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/15") - 4232 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/16") - 4233 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/17") - 4234 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/18") - 4235 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/19") - 4236 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/20") - 4237 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/21") - 4238 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/22") - 4239 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/23") - 4240 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/24") - 4241 # . epilogue - 4242 89/<- %esp 5/r32/ebp - 4243 5d/pop-to-ebp - 4244 c3/return - 4245 - 4246 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4: - 4247 # . prologue - 4248 55/push-ebp - 4249 89/<- %ebp 4/r32/esp - 4250 # setup - 4251 (clear-stream _test-input-stream) - 4252 (clear-stream $_test-input-buffered-file->buffer) - 4253 (clear-stream _test-output-stream) - 4254 (clear-stream $_test-output-buffered-file->buffer) - 4255 # - 4256 (write _test-input-stream "fn foo {\n") - 4257 (write _test-input-stream " a: {\n") - 4258 (write _test-input-stream " var x/esi: int <- copy 0\n") - 4259 (write _test-input-stream " {\n") - 4260 (write _test-input-stream " break a\n") - 4261 (write _test-input-stream " }\n") - 4262 (write _test-input-stream " }\n") - 4263 (write _test-input-stream "}\n") - 4264 # convert - 4265 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4266 (flush _test-output-buffered-file) - 4267 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4273 # check output - 4274 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/0") - 4275 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/1") - 4276 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/2") - 4277 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/3") - 4278 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/4") - 4279 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/5") - 4280 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/6") - 4281 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/7") - 4282 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/8") - 4283 (check-next-stream-line-equal _test-output-stream " be/copy-to-esi 0/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/9") - 4284 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/10") - 4285 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/11") - 4286 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/12") - 4287 (check-next-stream-line-equal _test-output-stream " e9/jump a:break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/13") - 4288 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/14") - 4289 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/15") - 4290 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/16") - 4291 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/17") - 4292 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/18") - 4293 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/19") - 4294 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/20") - 4295 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/21") - 4296 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/22") - 4297 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/23") - 4298 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/24") - 4299 # . epilogue - 4300 89/<- %esp 5/r32/ebp - 4301 5d/pop-to-ebp - 4302 c3/return - 4303 - 4304 test-convert-function-with-nonlocal-unconditional-break-and-local-vars: - 4305 # . prologue - 4306 55/push-ebp - 4307 89/<- %ebp 4/r32/esp - 4308 # setup - 4309 (clear-stream _test-input-stream) - 4310 (clear-stream $_test-input-buffered-file->buffer) - 4311 (clear-stream _test-output-stream) - 4312 (clear-stream $_test-output-buffered-file->buffer) - 4313 # - 4314 (write _test-input-stream "fn foo {\n") - 4315 (write _test-input-stream " a: {\n") - 4316 (write _test-input-stream " var x: int\n") - 4317 (write _test-input-stream " {\n") - 4318 (write _test-input-stream " var y: int\n") - 4319 (write _test-input-stream " break a\n") - 4320 (write _test-input-stream " increment x\n") - 4321 (write _test-input-stream " }\n") - 4322 (write _test-input-stream " }\n") - 4323 (write _test-input-stream "}\n") - 4324 # convert - 4325 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4326 (flush _test-output-buffered-file) - 4327 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4333 # check output - 4334 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/0") - 4335 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/1") - 4336 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/2") - 4337 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/3") - 4338 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/4") - 4339 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/5") - 4340 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/6") - 4341 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/7") - 4342 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/8") - 4343 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/9") - 4344 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/10") - 4345 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/11") - 4346 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/12") - 4347 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/13") - 4348 (check-next-stream-line-equal _test-output-stream " e9/jump a:break/disp32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/14") - 4349 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/15") - 4350 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/16") - 4351 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/17") - 4352 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/18") - 4353 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/19") - 4354 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/20") - 4355 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/21") - 4356 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/22") - 4357 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/23") - 4358 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/24") - 4359 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/25") - 4360 # . epilogue - 4361 89/<- %esp 5/r32/ebp - 4362 5d/pop-to-ebp - 4363 c3/return - 4364 - 4365 test-convert-function-with-unconditional-break-and-local-vars: - 4366 # . prologue - 4367 55/push-ebp - 4368 89/<- %ebp 4/r32/esp - 4369 # setup - 4370 (clear-stream _test-input-stream) - 4371 (clear-stream $_test-input-buffered-file->buffer) - 4372 (clear-stream _test-output-stream) - 4373 (clear-stream $_test-output-buffered-file->buffer) - 4374 # - 4375 (write _test-input-stream "fn foo {\n") - 4376 (write _test-input-stream " {\n") - 4377 (write _test-input-stream " var x: int\n") - 4378 (write _test-input-stream " {\n") - 4379 (write _test-input-stream " var y: int\n") - 4380 (write _test-input-stream " break\n") - 4381 (write _test-input-stream " increment x\n") - 4382 (write _test-input-stream " }\n") - 4383 (write _test-input-stream " }\n") - 4384 (write _test-input-stream "}\n") - 4385 # convert - 4386 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4387 (flush _test-output-buffered-file) - 4388 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4394 # check output - 4395 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-break-and-local-vars/0") - 4396 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-break-and-local-vars/1") - 4397 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/2") - 4398 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-break-and-local-vars/3") - 4399 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/4") - 4400 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/5") - 4401 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/6") - 4402 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/7") - 4403 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/8") - 4404 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/9") - 4405 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/10") - 4406 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/11") - 4407 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/12") - 4408 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/13") - 4409 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/14") - 4410 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/15") - 4411 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/16") - 4412 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/17") - 4413 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/18") - 4414 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/19") - 4415 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-break-and-local-vars/20") - 4416 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/21") - 4417 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/22") - 4418 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-break-and-local-vars/23") - 4419 # . epilogue - 4420 89/<- %esp 5/r32/ebp - 4421 5d/pop-to-ebp - 4422 c3/return - 4423 - 4424 test-convert-function-with-nonlocal-unconditional-loop-and-local-vars: - 4425 # . prologue - 4426 55/push-ebp - 4427 89/<- %ebp 4/r32/esp - 4428 # setup - 4429 (clear-stream _test-input-stream) - 4430 (clear-stream $_test-input-buffered-file->buffer) - 4431 (clear-stream _test-output-stream) - 4432 (clear-stream $_test-output-buffered-file->buffer) - 4433 # - 4434 (write _test-input-stream "fn foo {\n") - 4435 (write _test-input-stream " a: {\n") - 4436 (write _test-input-stream " var x: int\n") - 4437 (write _test-input-stream " {\n") - 4438 (write _test-input-stream " var y: int\n") - 4439 (write _test-input-stream " loop a\n") - 4440 (write _test-input-stream " increment x\n") - 4441 (write _test-input-stream " }\n") - 4442 (write _test-input-stream " }\n") - 4443 (write _test-input-stream "}\n") - 4444 # convert - 4445 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4446 (flush _test-output-buffered-file) - 4447 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4453 # check output - 4454 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/0") - 4455 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/1") - 4456 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/2") - 4457 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/3") - 4458 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/4") - 4459 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/5") - 4460 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/6") - 4461 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/7") - 4462 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/8") - 4463 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/9") - 4464 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/10") - 4465 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/11") - 4466 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/12") - 4467 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/13") - 4468 (check-next-stream-line-equal _test-output-stream " e9/jump a:loop/disp32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/14") - 4469 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/15") - 4470 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/16") - 4471 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/17") - 4472 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/18") - 4473 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/19") - 4474 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/20") - 4475 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/21") - 4476 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/22") - 4477 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/23") - 4478 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/24") - 4479 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/25") - 4480 # . epilogue - 4481 89/<- %esp 5/r32/ebp - 4482 5d/pop-to-ebp - 4483 c3/return - 4484 - 4485 test-convert-function-with-local-array-var-in-mem: - 4486 # . prologue - 4487 55/push-ebp - 4488 89/<- %ebp 4/r32/esp - 4489 # setup - 4490 (clear-stream _test-input-stream) - 4491 (clear-stream $_test-input-buffered-file->buffer) - 4492 (clear-stream _test-output-stream) - 4493 (clear-stream $_test-output-buffered-file->buffer) - 4494 # - 4495 (write _test-input-stream "fn foo {\n") - 4496 (write _test-input-stream " var x: (array int 3)\n") - 4497 (write _test-input-stream "}\n") - 4498 # convert - 4499 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4500 (flush _test-output-buffered-file) - 4501 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4507 # check output - 4508 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-var-in-mem/0") - 4509 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-var-in-mem/1") - 4510 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-var-in-mem/2") - 4511 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-array-var-in-mem/3") - 4512 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-var-in-mem/4") - 4513 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-var-in-mem/5") - 4514 # define x - 4515 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-function-with-local-array-var-in-mem/7") - 4516 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-function-with-local-array-var-in-mem/8") - 4517 # reclaim x - 4518 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-function-with-local-array-var-in-mem/9") - 4519 # - 4520 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-var-in-mem/10") - 4521 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-var-in-mem/11") - 4522 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-var-in-mem/12") - 4523 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-array-var-in-mem/13") - 4524 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-var-in-mem/14") - 4525 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-var-in-mem/15") + 2963 (check-stream-equal _test-output-stream "" "F - test-convert-function-call-with-incorrect-output-register: output should be empty") + 2964 (check-next-stream-line-equal _test-error-stream "fn f: call g: register for output 'x' is not right" "F - test-convert-function-call-with-incorrect-output-register: error message") + 2965 # check that stop(1) was called + 2966 (check-ints-equal *(edx+4) 2 "F - test-convert-function-call-with-incorrect-output-register: exit status") + 2967 # don't restore from ebp + 2968 81 0/subop/add %esp 8/imm32 + 2969 5d/pop-to-ebp + 2970 c3/return + 2971 + 2972 test-convert-function-with-local-var-dereferenced: + 2973 # . prologue + 2974 55/push-ebp + 2975 89/<- %ebp 4/r32/esp + 2976 # setup + 2977 (clear-stream _test-input-stream) + 2978 (clear-stream $_test-input-buffered-file->buffer) + 2979 (clear-stream _test-output-stream) + 2980 (clear-stream $_test-output-buffered-file->buffer) + 2981 # + 2982 (write _test-input-stream "fn foo {\n") + 2983 (write _test-input-stream " var x/ecx: (addr int) <- copy 0\n") + 2984 (write _test-input-stream " increment *x\n") + 2985 (write _test-input-stream "}\n") + 2986 # convert + 2987 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 2988 (flush _test-output-buffered-file) + 2989 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 2995 # check output + 2996 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-dereferenced/0") + 2997 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-dereferenced/1") + 2998 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-dereferenced/2") + 2999 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-dereferenced/3") + 3000 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-dereferenced/4") + 3001 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-dereferenced/5") + 3002 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-local-var-dereferenced/6") + 3003 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-local-var-dereferenced/7") + 3004 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *ecx" "F - test-convert-function-with-local-var-dereferenced/8") + 3005 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-local-var-dereferenced/9") + 3006 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-dereferenced/10") + 3007 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-dereferenced/11") + 3008 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-dereferenced/12") + 3009 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-dereferenced/13") + 3010 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-dereferenced/14") + 3011 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-dereferenced/15") + 3012 # . epilogue + 3013 89/<- %esp 5/r32/ebp + 3014 5d/pop-to-ebp + 3015 c3/return + 3016 + 3017 test-dereference-of-var-on-stack: + 3018 # . prologue + 3019 55/push-ebp + 3020 89/<- %ebp 4/r32/esp + 3021 # setup + 3022 (clear-stream _test-input-stream) + 3023 (clear-stream $_test-input-buffered-file->buffer) + 3024 (clear-stream _test-output-stream) + 3025 (clear-stream $_test-output-buffered-file->buffer) + 3026 (clear-stream _test-error-stream) + 3027 (clear-stream $_test-error-buffered-file->buffer) + 3028 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3029 68/push 0/imm32 + 3030 68/push 0/imm32 + 3031 89/<- %edx 4/r32/esp + 3032 (tailor-exit-descriptor %edx 0x10) + 3033 # + 3034 (write _test-input-stream "fn foo {\n") + 3035 (write _test-input-stream " var x: (addr int)\n") + 3036 (write _test-input-stream " increment *x\n") + 3037 (write _test-input-stream "}\n") + 3038 # convert + 3039 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3040 # registers except esp clobbered at this point + 3041 # restore ed + 3042 89/<- %edx 4/r32/esp + 3043 (flush _test-output-buffered-file) + 3044 (flush _test-error-buffered-file) + 3045 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3051 # check output + 3052 (check-stream-equal _test-output-stream "" "F - test-dereference-of-var-on-stack: output should be empty") + 3053 (check-next-stream-line-equal _test-error-stream "fn foo: cannot dereference var 'x' on stack" "F - test-dereference-of-var-on-stack: error message") + 3054 # check that stop(1) was called + 3055 (check-ints-equal *(edx+4) 2 "F - test-dereference-of-var-on-stack: exit status") + 3056 # don't restore from ebp + 3057 81 0/subop/add %esp 8/imm32 + 3058 # . epilogue + 3059 5d/pop-to-ebp + 3060 c3/return + 3061 + 3062 # variables of type 'byte' are not allowed on the stack + 3063 test-convert-function-with-byte-operations: + 3064 # . prologue + 3065 55/push-ebp + 3066 89/<- %ebp 4/r32/esp + 3067 # setup + 3068 (clear-stream _test-input-stream) + 3069 (clear-stream $_test-input-buffered-file->buffer) + 3070 (clear-stream _test-output-stream) + 3071 (clear-stream $_test-output-buffered-file->buffer) + 3072 # + 3073 (write _test-input-stream "fn foo {\n") + 3074 (write _test-input-stream " var x/eax: byte <- copy 0\n") + 3075 (write _test-input-stream " var y/ecx: byte <- copy 0\n") + 3076 (write _test-input-stream " y <- copy-byte x\n") + 3077 (write _test-input-stream " var z/edx: (addr byte) <- copy 0\n") + 3078 (write _test-input-stream " y <- copy-byte *z\n") + 3079 (write _test-input-stream " copy-byte-to *z, x\n") + 3080 (write _test-input-stream "}\n") + 3081 # convert + 3082 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3083 (flush _test-output-buffered-file) + 3084 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3090 # check output + 3091 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-byte-operations/0") + 3092 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-byte-operations/1") + 3093 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-byte-operations/2") + 3094 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-byte-operations/3") + 3095 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-byte-operations/4") + 3096 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-byte-operations/5") + 3097 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-byte-operations/6") + 3098 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-function-with-byte-operations/7") + 3099 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-byte-operations/8") + 3100 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-byte-operations/9") + 3101 (check-next-stream-line-equal _test-output-stream " 8a/byte-> %eax 0x00000001/r32" "F - test-convert-function-with-byte-operations/10") + 3102 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-convert-function-with-byte-operations/11") + 3103 (check-next-stream-line-equal _test-output-stream " ba/copy-to-edx 0/imm32" "F - test-convert-function-with-byte-operations/12") + 3104 (check-next-stream-line-equal _test-output-stream " 8a/byte-> *edx 0x00000001/r32" "F - test-convert-function-with-byte-operations/13") + 3105 (check-next-stream-line-equal _test-output-stream " 88/byte<- *edx 0x00000000/r32" "F - test-convert-function-with-byte-operations/14") + 3106 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-convert-function-with-byte-operations/15") + 3107 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-byte-operations/16") + 3108 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-byte-operations/17") + 3109 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-byte-operations/18") + 3110 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-byte-operations/19") + 3111 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-byte-operations/20") + 3112 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-byte-operations/21") + 3113 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-byte-operations/22") + 3114 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-byte-operations/23") + 3115 # . epilogue + 3116 89/<- %esp 5/r32/ebp + 3117 5d/pop-to-ebp + 3118 c3/return + 3119 + 3120 # variables of type 'byte' _can_ be function args. They then occupy 4 bytes. + 3121 test-copy-byte-var-from-fn-arg: + 3122 # . prologue + 3123 55/push-ebp + 3124 89/<- %ebp 4/r32/esp + 3125 # setup + 3126 (clear-stream _test-input-stream) + 3127 (clear-stream $_test-input-buffered-file->buffer) + 3128 (clear-stream _test-output-stream) + 3129 (clear-stream $_test-output-buffered-file->buffer) + 3130 # + 3131 (write _test-input-stream "fn foo x: byte, y: int {\n") + 3132 (write _test-input-stream " var a/eax: byte <- copy x\n") + 3133 (write _test-input-stream " var b/eax: int <- copy y\n") + 3134 (write _test-input-stream "}\n") + 3135 # convert + 3136 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3137 (flush _test-output-buffered-file) + 3138 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3144 # check output + 3145 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-copy-byte-from-fn-arg/0") + 3146 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-copy-byte-from-fn-arg/1") + 3147 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-copy-byte-from-fn-arg/2") + 3148 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-copy-byte-from-fn-arg/3") + 3149 (check-next-stream-line-equal _test-output-stream " {" "F - test-copy-byte-from-fn-arg/4") + 3150 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-copy-byte-from-fn-arg/5") + 3151 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-copy-byte-from-fn-arg/6") + 3152 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-copy-byte-from-fn-arg/7") + 3153 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x0000000c) 0x00000000/r32" "F - test-copy-byte-from-fn-arg/8") + 3154 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-copy-byte-from-fn-arg/9") + 3155 (check-next-stream-line-equal _test-output-stream " }" "F - test-copy-byte-from-fn-arg/10") + 3156 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-copy-byte-from-fn-arg/11") + 3157 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-copy-byte-from-fn-arg/12") + 3158 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-copy-byte-from-fn-arg/13") + 3159 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-copy-byte-from-fn-arg/14") + 3160 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-copy-byte-from-fn-arg/15") + 3161 # . epilogue + 3162 89/<- %esp 5/r32/ebp + 3163 5d/pop-to-ebp + 3164 c3/return + 3165 + 3166 test-convert-compare-register-with-literal: + 3167 # . prologue + 3168 55/push-ebp + 3169 89/<- %ebp 4/r32/esp + 3170 # setup + 3171 (clear-stream _test-input-stream) + 3172 (clear-stream $_test-input-buffered-file->buffer) + 3173 (clear-stream _test-output-stream) + 3174 (clear-stream $_test-output-buffered-file->buffer) + 3175 # + 3176 (write _test-input-stream "fn foo {\n") + 3177 (write _test-input-stream " var x/ecx: int <- copy 0\n") + 3178 (write _test-input-stream " compare x, 0\n") + 3179 (write _test-input-stream "}\n") + 3180 # convert + 3181 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3182 (flush _test-output-buffered-file) + 3183 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3189 # check output + 3190 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-compare-register-with-literal/0") + 3191 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-compare-register-with-literal/1") + 3192 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-compare-register-with-literal/2") + 3193 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-compare-register-with-literal/3") + 3194 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-compare-register-with-literal/4") + 3195 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-compare-register-with-literal/5") + 3196 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") + 3197 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-compare-register-with-literal/7") + 3198 (check-next-stream-line-equal _test-output-stream " 81 7/subop/compare %ecx 0/imm32" "F - test-convert-compare-register-with-literal/8") + 3199 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") + 3200 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-compare-register-with-literal/10") + 3201 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-compare-register-with-literal/11") + 3202 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-compare-register-with-literal/12") + 3203 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-compare-register-with-literal/13") + 3204 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-compare-register-with-literal/14") + 3205 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-compare-register-with-literal/15") + 3206 # . epilogue + 3207 89/<- %esp 5/r32/ebp + 3208 5d/pop-to-ebp + 3209 c3/return + 3210 + 3211 test-unknown-variable: + 3212 # . prologue + 3213 55/push-ebp + 3214 89/<- %ebp 4/r32/esp + 3215 # setup + 3216 (clear-stream _test-input-stream) + 3217 (clear-stream $_test-input-buffered-file->buffer) + 3218 (clear-stream _test-output-stream) + 3219 (clear-stream $_test-output-buffered-file->buffer) + 3220 (clear-stream _test-error-stream) + 3221 (clear-stream $_test-error-buffered-file->buffer) + 3222 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3223 68/push 0/imm32 + 3224 68/push 0/imm32 + 3225 89/<- %edx 4/r32/esp + 3226 (tailor-exit-descriptor %edx 0x10) + 3227 # + 3228 (write _test-input-stream "fn foo {\n") + 3229 (write _test-input-stream " compare x, 0\n") + 3230 (write _test-input-stream "}\n") + 3231 # convert + 3232 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3233 # registers except esp clobbered at this point + 3234 # restore ed + 3235 89/<- %edx 4/r32/esp + 3236 (flush _test-output-buffered-file) + 3237 (flush _test-error-buffered-file) + 3238 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3244 # check output + 3245 (check-stream-equal _test-output-stream "" "F - test-unknown-variable: output should be empty") + 3246 (check-next-stream-line-equal _test-error-stream "fn foo: unknown variable 'x'" "F - test-unknown-variable: error message") + 3247 # check that stop(1) was called + 3248 (check-ints-equal *(edx+4) 2 "F - test-unknown-variable: exit status") + 3249 # don't restore from ebp + 3250 81 0/subop/add %esp 8/imm32 + 3251 # . epilogue + 3252 5d/pop-to-ebp + 3253 c3/return + 3254 + 3255 test-convert-function-with-local-var-in-block: + 3256 # . prologue + 3257 55/push-ebp + 3258 89/<- %ebp 4/r32/esp + 3259 # setup + 3260 (clear-stream _test-input-stream) + 3261 (clear-stream $_test-input-buffered-file->buffer) + 3262 (clear-stream _test-output-stream) + 3263 (clear-stream $_test-output-buffered-file->buffer) + 3264 # + 3265 (write _test-input-stream "fn foo {\n") + 3266 (write _test-input-stream " {\n") + 3267 (write _test-input-stream " var x: int\n") + 3268 (write _test-input-stream " increment x\n") + 3269 (write _test-input-stream " }\n") + 3270 (write _test-input-stream "}\n") + 3271 # convert + 3272 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3273 (flush _test-output-buffered-file) + 3274 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3280 # check output + 3281 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-block/0") + 3282 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-block/1") + 3283 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-block/2") + 3284 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-block/3") + 3285 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/4") + 3286 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-block/5") + 3287 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-block/6") + 3288 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-block/7") + 3289 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-block/8") + 3290 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-block/9") + 3291 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-block/10") + 3292 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/11") + 3293 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-block/12") + 3294 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-block/13") + 3295 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-block/14") + 3296 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-block/15") + 3297 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-block/16") + 3298 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-block/17") + 3299 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-block/18") + 3300 # . epilogue + 3301 89/<- %esp 5/r32/ebp + 3302 5d/pop-to-ebp + 3303 c3/return + 3304 + 3305 test-convert-function-with-local-var-in-mem-after-block: + 3306 # . prologue + 3307 55/push-ebp + 3308 89/<- %ebp 4/r32/esp + 3309 # setup + 3310 (clear-stream _test-input-stream) + 3311 (clear-stream $_test-input-buffered-file->buffer) + 3312 (clear-stream _test-output-stream) + 3313 (clear-stream $_test-output-buffered-file->buffer) + 3314 # + 3315 (write _test-input-stream "fn foo {\n") + 3316 (write _test-input-stream " {\n") + 3317 (write _test-input-stream " var y: int\n") + 3318 (write _test-input-stream " }\n") + 3319 (write _test-input-stream " var x: int\n") + 3320 (write _test-input-stream " increment x\n") + 3321 (write _test-input-stream "}\n") + 3322 # convert + 3323 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3324 (flush _test-output-buffered-file) + 3325 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3331 # check output + 3332 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-mem-after-block/0") + 3333 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-mem-after-block/1") + 3334 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-mem-after-block/2") + 3335 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-mem-after-block/3") + 3336 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem-after-block/4") + 3337 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-mem-after-block/5") + 3338 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-mem-after-block/6") + 3339 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-local-var-in-mem-after-block/7") + 3340 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem-after-block/8") + 3341 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-mem-after-block/9") + 3342 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem-after-block/10") + 3343 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-local-var-in-mem-after-block/11") + 3344 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-mem-after-block/12") + 3345 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-mem-after-block/13") + 3346 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-mem-after-block/14") + 3347 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-mem-after-block/15") + 3348 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-mem-after-block/16") + 3349 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-mem-after-block/17") + 3350 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-mem-after-block/18") + 3351 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-mem-after-block/19") + 3352 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-mem-after-block/20") + 3353 # . epilogue + 3354 89/<- %esp 5/r32/ebp + 3355 5d/pop-to-ebp + 3356 c3/return + 3357 + 3358 test-convert-function-with-local-var-in-named-block: + 3359 # . prologue + 3360 55/push-ebp + 3361 89/<- %ebp 4/r32/esp + 3362 # setup + 3363 (clear-stream _test-input-stream) + 3364 (clear-stream $_test-input-buffered-file->buffer) + 3365 (clear-stream _test-output-stream) + 3366 (clear-stream $_test-output-buffered-file->buffer) + 3367 # + 3368 (write _test-input-stream "fn foo {\n") + 3369 (write _test-input-stream " $bar: {\n") + 3370 (write _test-input-stream " var x: int\n") + 3371 (write _test-input-stream " increment x\n") + 3372 (write _test-input-stream " }\n") + 3373 (write _test-input-stream "}\n") + 3374 # convert + 3375 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3376 (flush _test-output-buffered-file) + 3377 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3383 # check output + 3384 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-in-named-block/0") + 3385 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-in-named-block/1") + 3386 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-in-named-block/2") + 3387 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-in-named-block/3") + 3388 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/4") + 3389 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-in-named-block/5") + 3390 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-in-named-block/6") + 3391 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-local-var-in-named-block/7") + 3392 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-in-named-block/8") + 3393 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-local-var-in-named-block/9") + 3394 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-in-named-block/10") + 3395 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/11") + 3396 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-local-var-in-named-block/12") + 3397 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-in-named-block/13") + 3398 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-in-named-block/14") + 3399 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-in-named-block/15") + 3400 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-in-named-block/16") + 3401 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-in-named-block/17") + 3402 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-in-named-block/18") + 3403 # . epilogue + 3404 89/<- %esp 5/r32/ebp + 3405 5d/pop-to-ebp + 3406 c3/return + 3407 + 3408 test-unknown-variable-in-named-block: + 3409 # . prologue + 3410 55/push-ebp + 3411 89/<- %ebp 4/r32/esp + 3412 # setup + 3413 (clear-stream _test-input-stream) + 3414 (clear-stream $_test-input-buffered-file->buffer) + 3415 (clear-stream _test-output-stream) + 3416 (clear-stream $_test-output-buffered-file->buffer) + 3417 (clear-stream _test-error-stream) + 3418 (clear-stream $_test-error-buffered-file->buffer) + 3419 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 3420 68/push 0/imm32 + 3421 68/push 0/imm32 + 3422 89/<- %edx 4/r32/esp + 3423 (tailor-exit-descriptor %edx 0x10) + 3424 # + 3425 (write _test-input-stream "fn foo {\n") + 3426 (write _test-input-stream " $a: {\n") + 3427 (write _test-input-stream " compare x, 0\n") + 3428 (write _test-input-stream " }\n") + 3429 (write _test-input-stream "}\n") + 3430 # convert + 3431 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 3432 # registers except esp clobbered at this point + 3433 # restore ed + 3434 89/<- %edx 4/r32/esp + 3435 (flush _test-output-buffered-file) + 3436 (flush _test-error-buffered-file) + 3437 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3443 # check output + 3444 (check-stream-equal _test-output-stream "" "F - test-unknown-variable-in-named-block: output should be empty") + 3445 (check-next-stream-line-equal _test-error-stream "fn foo: unknown variable 'x'" "F - test-unknown-variable-in-named-block: error message") + 3446 # check that stop(1) was called + 3447 (check-ints-equal *(edx+4) 2 "F - test-unknown-variable-in-named-block: exit status") + 3448 # don't restore from ebp + 3449 81 0/subop/add %esp 8/imm32 + 3450 # . epilogue + 3451 5d/pop-to-ebp + 3452 c3/return + 3453 + 3454 test-always-shadow-outermost-reg-vars-in-function: + 3455 # . prologue + 3456 55/push-ebp + 3457 89/<- %ebp 4/r32/esp + 3458 # setup + 3459 (clear-stream _test-input-stream) + 3460 (clear-stream $_test-input-buffered-file->buffer) + 3461 (clear-stream _test-output-stream) + 3462 (clear-stream $_test-output-buffered-file->buffer) + 3463 # + 3464 (write _test-input-stream "fn foo {\n") + 3465 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 3466 (write _test-input-stream "}\n") + 3467 # convert + 3468 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3469 (flush _test-output-buffered-file) + 3470 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3476 # check output + 3477 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-always-shadow-outermost-reg-vars-in-function/0") + 3478 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-always-shadow-outermost-reg-vars-in-function/1") + 3479 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/2") + 3480 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-always-shadow-outermost-reg-vars-in-function/3") + 3481 (check-next-stream-line-equal _test-output-stream " {" "F - test-always-shadow-outermost-reg-vars-in-function/4") + 3482 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-always-shadow-outermost-reg-vars-in-function/5") + 3483 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-compare-register-with-literal/6") + 3484 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-always-shadow-outermost-reg-vars-in-function/8") + 3485 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-compare-register-with-literal/9") + 3486 (check-next-stream-line-equal _test-output-stream " }" "F - test-always-shadow-outermost-reg-vars-in-function/12") + 3487 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-always-shadow-outermost-reg-vars-in-function/13") + 3488 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-always-shadow-outermost-reg-vars-in-function/14") + 3489 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-always-shadow-outermost-reg-vars-in-function/15") + 3490 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-always-shadow-outermost-reg-vars-in-function/16") + 3491 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-always-shadow-outermost-reg-vars-in-function/17") + 3492 # . epilogue + 3493 89/<- %esp 5/r32/ebp + 3494 5d/pop-to-ebp + 3495 c3/return + 3496 + 3497 test-shadow-local: + 3498 # . prologue + 3499 55/push-ebp + 3500 89/<- %ebp 4/r32/esp + 3501 # setup + 3502 (clear-stream _test-input-stream) + 3503 (clear-stream $_test-input-buffered-file->buffer) + 3504 (clear-stream _test-output-stream) + 3505 (clear-stream $_test-output-buffered-file->buffer) + 3506 # + 3507 (write _test-input-stream "fn foo {\n") + 3508 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 3509 (write _test-input-stream " {\n") + 3510 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 3511 (write _test-input-stream " }\n") + 3512 (write _test-input-stream " x <- increment\n") + 3513 (write _test-input-stream "}\n") + 3514 # convert + 3515 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3516 (flush _test-output-buffered-file) + 3517 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3523 # check output + 3524 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-local/0") + 3525 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-local/1") + 3526 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-local/2") + 3527 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-local/3") + 3528 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-local/4") + 3529 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-local/5") + 3530 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-local/6") + 3531 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-local/7") + 3532 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-local/8") + 3533 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-local/9") + 3534 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-local/10") + 3535 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-shadow-local/11") + 3536 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-local/12") + 3537 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-local/13") + 3538 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-local/14") + 3539 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-local/15") + 3540 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-local/16") + 3541 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-local/17") + 3542 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-local/18") + 3543 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-local/19") + 3544 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-local/20") + 3545 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-local/21") + 3546 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-local/22") + 3547 # . epilogue + 3548 89/<- %esp 5/r32/ebp + 3549 5d/pop-to-ebp + 3550 c3/return + 3551 + 3552 test-shadow-name: + 3553 # . prologue + 3554 55/push-ebp + 3555 89/<- %ebp 4/r32/esp + 3556 # setup + 3557 (clear-stream _test-input-stream) + 3558 (clear-stream $_test-input-buffered-file->buffer) + 3559 (clear-stream _test-output-stream) + 3560 (clear-stream $_test-output-buffered-file->buffer) + 3561 # + 3562 (write _test-input-stream "fn foo {\n") + 3563 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 3564 (write _test-input-stream " {\n") + 3565 (write _test-input-stream " var x/edx: int <- copy 4\n") + 3566 (write _test-input-stream " }\n") + 3567 (write _test-input-stream " x <- increment\n") + 3568 (write _test-input-stream "}\n") + 3569 # convert + 3570 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3571 (flush _test-output-buffered-file) + 3572 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3578 # check output + 3579 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-name/0") + 3580 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-name/1") + 3581 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-name/2") + 3582 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-name/3") + 3583 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name/4") + 3584 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-name/5") + 3585 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-name/6") + 3586 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-name/7") + 3587 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name/8") + 3588 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-name/9") + 3589 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-shadow-name/10") + 3590 (check-next-stream-line-equal _test-output-stream " ba/copy-to-edx 4/imm32" "F - test-shadow-name/11") + 3591 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-shadow-name/12") + 3592 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name/13") + 3593 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-name/14") + 3594 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-name/15") + 3595 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-name/16") + 3596 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name/17") + 3597 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-name/18") + 3598 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-name/19") + 3599 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-name/20") + 3600 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-name/21") + 3601 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-name/22") + 3602 # . epilogue + 3603 89/<- %esp 5/r32/ebp + 3604 5d/pop-to-ebp + 3605 c3/return + 3606 + 3607 test-shadow-name-2: + 3608 # . prologue + 3609 55/push-ebp + 3610 89/<- %ebp 4/r32/esp + 3611 # setup + 3612 (clear-stream _test-input-stream) + 3613 (clear-stream $_test-input-buffered-file->buffer) + 3614 (clear-stream _test-output-stream) + 3615 (clear-stream $_test-output-buffered-file->buffer) + 3616 # + 3617 (write _test-input-stream "fn foo {\n") + 3618 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 3619 (write _test-input-stream " {\n") + 3620 (write _test-input-stream " var x/edx: int <- copy 4\n") + 3621 (write _test-input-stream " var y/ecx: int <- copy 5\n") + 3622 (write _test-input-stream " }\n") + 3623 (write _test-input-stream " x <- increment\n") + 3624 (write _test-input-stream "}\n") + 3625 # convert + 3626 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3627 (flush _test-output-buffered-file) + 3628 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3634 # check output + 3635 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-shadow-name-2/0") + 3636 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-shadow-name-2/1") + 3637 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-shadow-name-2/2") + 3638 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-shadow-name-2/3") + 3639 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name-2/4") + 3640 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-shadow-name-2/5") + 3641 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-name-2/6") + 3642 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-shadow-name-2/7") + 3643 (check-next-stream-line-equal _test-output-stream " {" "F - test-shadow-name-2/8") + 3644 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-shadow-name-2/9") + 3645 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-shadow-name-2/10") + 3646 (check-next-stream-line-equal _test-output-stream " ba/copy-to-edx 4/imm32" "F - test-shadow-name-2/11") + 3647 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-shadow-name-2/12") + 3648 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 5/imm32" "F - test-shadow-name-2/13") + 3649 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-name-2/14") + 3650 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-shadow-name-2/15") + 3651 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name-2/16") + 3652 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-shadow-name-2/17") + 3653 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-shadow-name-2/18") + 3654 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-shadow-name-2/19") + 3655 (check-next-stream-line-equal _test-output-stream " }" "F - test-shadow-name-2/20") + 3656 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-shadow-name-2/21") + 3657 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-shadow-name-2/22") + 3658 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-shadow-name-2/23") + 3659 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-shadow-name-2/24") + 3660 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-shadow-name-2/25") + 3661 # . epilogue + 3662 89/<- %esp 5/r32/ebp + 3663 5d/pop-to-ebp + 3664 c3/return + 3665 + 3666 test-do-not-spill-same-register-in-block: + 3667 # . prologue + 3668 55/push-ebp + 3669 89/<- %ebp 4/r32/esp + 3670 # setup + 3671 (clear-stream _test-input-stream) + 3672 (clear-stream $_test-input-buffered-file->buffer) + 3673 (clear-stream _test-output-stream) + 3674 (clear-stream $_test-output-buffered-file->buffer) + 3675 # + 3676 (write _test-input-stream "fn foo {\n") + 3677 (write _test-input-stream " var x/ecx: int <- copy 3\n") + 3678 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 3679 (write _test-input-stream " y <- increment\n") + 3680 (write _test-input-stream "}\n") + 3681 # convert + 3682 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3683 (flush _test-output-buffered-file) + 3684 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3690 # check output + 3691 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-do-not-spill-same-register-in-block/0") + 3692 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-do-not-spill-same-register-in-block/1") + 3693 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-do-not-spill-same-register-in-block/2") + 3694 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-do-not-spill-same-register-in-block/3") + 3695 (check-next-stream-line-equal _test-output-stream " {" "F - test-do-not-spill-same-register-in-block/4") + 3696 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-do-not-spill-same-register-in-block/5") + 3697 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-do-not-spill-same-register-in-block/6") + 3698 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-do-not-spill-same-register-in-block/7") + 3699 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-do-not-spill-same-register-in-block/8") + 3700 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-do-not-spill-same-register-in-block/9") + 3701 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-do-not-spill-same-register-in-block/10") + 3702 (check-next-stream-line-equal _test-output-stream " }" "F - test-do-not-spill-same-register-in-block/11") + 3703 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-do-not-spill-same-register-in-block/12") + 3704 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-do-not-spill-same-register-in-block/13") + 3705 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-do-not-spill-same-register-in-block/14") + 3706 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-do-not-spill-same-register-in-block/15") + 3707 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-do-not-spill-same-register-in-block/16") + 3708 # . epilogue + 3709 89/<- %esp 5/r32/ebp + 3710 5d/pop-to-ebp + 3711 c3/return + 3712 + 3713 test-spill-different-register-in-block: + 3714 # . prologue + 3715 55/push-ebp + 3716 89/<- %ebp 4/r32/esp + 3717 # setup + 3718 (clear-stream _test-input-stream) + 3719 (clear-stream $_test-input-buffered-file->buffer) + 3720 (clear-stream _test-output-stream) + 3721 (clear-stream $_test-output-buffered-file->buffer) + 3722 # + 3723 (write _test-input-stream "fn foo {\n") + 3724 (write _test-input-stream " var x/eax: int <- copy 3\n") + 3725 (write _test-input-stream " var y/ecx: int <- copy 4\n") + 3726 (write _test-input-stream " y <- increment\n") + 3727 (write _test-input-stream "}\n") + 3728 # convert + 3729 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3730 (flush _test-output-buffered-file) + 3731 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3737 # check output + 3738 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-spill-different-register-in-block/0") + 3739 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-spill-different-register-in-block/1") + 3740 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-spill-different-register-in-block/2") + 3741 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-spill-different-register-in-block/3") + 3742 (check-next-stream-line-equal _test-output-stream " {" "F - test-spill-different-register-in-block/4") + 3743 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-spill-different-register-in-block/5") + 3744 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-spill-different-register-in-block/6") + 3745 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-spill-different-register-in-block/7") + 3746 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-spill-different-register-in-block/8") + 3747 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-spill-different-register-in-block/9") + 3748 (check-next-stream-line-equal _test-output-stream " 41/increment-ecx" "F - test-spill-different-register-in-block/10") + 3749 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-spill-different-register-in-block/11") + 3750 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-spill-different-register-in-block/12") + 3751 (check-next-stream-line-equal _test-output-stream " }" "F - test-spill-different-register-in-block/13") + 3752 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-spill-different-register-in-block/14") + 3753 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-spill-different-register-in-block/15") + 3754 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-spill-different-register-in-block/16") + 3755 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-spill-different-register-in-block/17") + 3756 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-spill-different-register-in-block/18") + 3757 # . epilogue + 3758 89/<- %esp 5/r32/ebp + 3759 5d/pop-to-ebp + 3760 c3/return + 3761 + 3762 test-convert-function-with-branches-in-block: + 3763 # . prologue + 3764 55/push-ebp + 3765 89/<- %ebp 4/r32/esp + 3766 # setup + 3767 (clear-stream _test-input-stream) + 3768 (clear-stream $_test-input-buffered-file->buffer) + 3769 (clear-stream _test-output-stream) + 3770 (clear-stream $_test-output-buffered-file->buffer) + 3771 # + 3772 (write _test-input-stream "fn foo x: int {\n") + 3773 (write _test-input-stream " {\n") + 3774 (write _test-input-stream " break-if->=\n") + 3775 (write _test-input-stream " loop-if-addr<\n") + 3776 (write _test-input-stream " increment x\n") + 3777 (write _test-input-stream " loop\n") + 3778 (write _test-input-stream " }\n") + 3779 (write _test-input-stream "}\n") + 3780 # convert + 3781 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3782 (flush _test-output-buffered-file) + 3783 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3789 # check output + 3790 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0") + 3791 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1") + 3792 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2") + 3793 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3") + 3794 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4") + 3795 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5") + 3796 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6") + 3797 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7") + 3798 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/8") + 3799 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-block/9") + 3800 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-in-block/10") + 3801 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/11") + 3802 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/12") + 3803 (check-next-stream-line-equal _test-output-stream " 0f 83/jump-if-addr>= break/disp32" "F - test-convert-function-with-branches-in-block/13") + 3804 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-branches-in-block/14") + 3805 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/15") + 3806 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/16") + 3807 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/17") + 3808 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/18") + 3809 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/19") + 3810 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/20") + 3811 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/21") + 3812 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/22") + 3813 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/23") + 3814 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/24") + 3815 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/25") + 3816 # . epilogue + 3817 89/<- %esp 5/r32/ebp + 3818 5d/pop-to-ebp + 3819 c3/return + 3820 + 3821 test-convert-function-with-branches-in-block-2: + 3822 # . prologue + 3823 55/push-ebp + 3824 89/<- %ebp 4/r32/esp + 3825 # setup + 3826 (clear-stream _test-input-stream) + 3827 (clear-stream $_test-input-buffered-file->buffer) + 3828 (clear-stream _test-output-stream) + 3829 (clear-stream $_test-output-buffered-file->buffer) + 3830 # + 3831 (write _test-input-stream "fn foo x: int {\n") + 3832 (write _test-input-stream " {\n") + 3833 (write _test-input-stream " break-if->=\n") + 3834 (write _test-input-stream " loop-if-float<\n") + 3835 (write _test-input-stream " increment x\n") + 3836 (write _test-input-stream " loop\n") + 3837 (write _test-input-stream " }\n") + 3838 (write _test-input-stream "}\n") + 3839 # convert + 3840 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3841 (flush _test-output-buffered-file) + 3842 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3848 # check output + 3849 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-block/0") + 3850 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-block/1") + 3851 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-block/2") + 3852 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-block/3") + 3853 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/4") + 3854 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-block/5") + 3855 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/6") + 3856 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-in-block/7") + 3857 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/8") + 3858 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-block/9") + 3859 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-in-block/10") + 3860 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/11") + 3861 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-block/12") + 3862 (check-next-stream-line-equal _test-output-stream " 0f 83/jump-if-addr>= break/disp32" "F - test-convert-function-with-branches-in-block/13") + 3863 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-branches-in-block/14") + 3864 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/15") + 3865 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-block/16") + 3866 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-block/17") + 3867 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/18") + 3868 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-in-block/19") + 3869 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-block/20") + 3870 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-block/21") + 3871 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-block/22") + 3872 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-block/23") + 3873 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-block/24") + 3874 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-block/25") + 3875 # . epilogue + 3876 89/<- %esp 5/r32/ebp + 3877 5d/pop-to-ebp + 3878 c3/return + 3879 + 3880 test-convert-function-with-branches-in-named-block: + 3881 # . prologue + 3882 55/push-ebp + 3883 89/<- %ebp 4/r32/esp + 3884 # setup + 3885 (clear-stream _test-input-stream) + 3886 (clear-stream $_test-input-buffered-file->buffer) + 3887 (clear-stream _test-output-stream) + 3888 (clear-stream $_test-output-buffered-file->buffer) + 3889 # + 3890 (write _test-input-stream "fn foo x: int {\n") + 3891 (write _test-input-stream " $bar: {\n") + 3892 (write _test-input-stream " break-if->= $bar\n") + 3893 (write _test-input-stream " loop-if-addr< $bar\n") + 3894 (write _test-input-stream " increment x\n") + 3895 (write _test-input-stream " loop\n") + 3896 (write _test-input-stream " }\n") + 3897 (write _test-input-stream "}\n") + 3898 # convert + 3899 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3900 (flush _test-output-buffered-file) + 3901 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3907 # check output + 3908 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-in-named-block/0") + 3909 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-in-named-block/1") + 3910 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-in-named-block/2") + 3911 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-in-named-block/3") + 3912 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/4") + 3913 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-in-named-block/5") + 3914 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/6") + 3915 (check-next-stream-line-equal _test-output-stream "$bar:loop:" "F - test-convert-function-with-branches-in-named-block/7") + 3916 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/8") + 3917 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-in-named-block/9") + 3918 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:break/disp32" "F - test-convert-function-with-branches-in-named-block/10") + 3919 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/11") + 3920 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-in-named-block/12") + 3921 (check-next-stream-line-equal _test-output-stream " 0f 83/jump-if-addr>= break/disp32" "F - test-convert-function-with-branches-in-named-block/13") + 3922 (check-next-stream-line-equal _test-output-stream " e9/jump $bar:loop/disp32" "F - test-convert-function-with-branches-in-named-block/14") + 3923 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/15") + 3924 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0x00000008)" "F - test-convert-function-with-branches-in-named-block/16") + 3925 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-in-named-block/17") + 3926 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/18") + 3927 (check-next-stream-line-equal _test-output-stream "$bar:break:" "F - test-convert-function-with-branches-in-named-block/19") + 3928 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-in-named-block/20") + 3929 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-in-named-block/21") + 3930 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-in-named-block/22") + 3931 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-in-named-block/23") + 3932 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-in-named-block/24") + 3933 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-in-named-block/25") + 3934 # . epilogue + 3935 89/<- %esp 5/r32/ebp + 3936 5d/pop-to-ebp + 3937 c3/return + 3938 + 3939 test-convert-function-with-var-in-nested-block: + 3940 # . prologue + 3941 55/push-ebp + 3942 89/<- %ebp 4/r32/esp + 3943 # setup + 3944 (clear-stream _test-input-stream) + 3945 (clear-stream $_test-input-buffered-file->buffer) + 3946 (clear-stream _test-output-stream) + 3947 (clear-stream $_test-output-buffered-file->buffer) + 3948 # + 3949 (write _test-input-stream "fn foo x: int {\n") + 3950 (write _test-input-stream " {\n") + 3951 (write _test-input-stream " {\n") + 3952 (write _test-input-stream " var x: int\n") + 3953 (write _test-input-stream " increment x\n") + 3954 (write _test-input-stream " }\n") + 3955 (write _test-input-stream " }\n") + 3956 (write _test-input-stream "}\n") + 3957 # convert + 3958 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 3959 (flush _test-output-buffered-file) + 3960 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 3966 # check output + 3967 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-var-in-nested-block/0") + 3968 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-var-in-nested-block/1") + 3969 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-var-in-nested-block/2") + 3970 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-var-in-nested-block/3") + 3971 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/4") + 3972 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-var-in-nested-block/5") + 3973 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/6") + 3974 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-var-in-nested-block/7") + 3975 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-var-in-nested-block/8") + 3976 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-var-in-nested-block/9") + 3977 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-var-in-nested-block/10") + 3978 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-var-in-nested-block/11") + 3979 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-var-in-nested-block/12") + 3980 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/13") + 3981 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-var-in-nested-block/14") + 3982 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/15") + 3983 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-var-in-nested-block/16") + 3984 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-var-in-nested-block/17") + 3985 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-var-in-nested-block/18") + 3986 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-var-in-nested-block/19") + 3987 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-var-in-nested-block/20") + 3988 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-var-in-nested-block/21") + 3989 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-var-in-nested-block/22") + 3990 # . epilogue + 3991 89/<- %esp 5/r32/ebp + 3992 5d/pop-to-ebp + 3993 c3/return + 3994 + 3995 test-convert-function-with-multiple-vars-in-nested-blocks: + 3996 # . prologue + 3997 55/push-ebp + 3998 89/<- %ebp 4/r32/esp + 3999 # setup + 4000 (clear-stream _test-input-stream) + 4001 (clear-stream $_test-input-buffered-file->buffer) + 4002 (clear-stream _test-output-stream) + 4003 (clear-stream $_test-output-buffered-file->buffer) + 4004 # + 4005 (write _test-input-stream "fn foo x: int {\n") + 4006 (write _test-input-stream " {\n") + 4007 (write _test-input-stream " var x/eax: int <- copy 0\n") + 4008 (write _test-input-stream " {\n") + 4009 (write _test-input-stream " var y: int\n") + 4010 (write _test-input-stream " x <- add y\n") + 4011 (write _test-input-stream " }\n") + 4012 (write _test-input-stream " }\n") + 4013 (write _test-input-stream "}\n") + 4014 # convert + 4015 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4016 (flush _test-output-buffered-file) + 4017 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4023 # check output + 4024 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/0") + 4025 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/1") + 4026 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/2") + 4027 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/3") + 4028 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/4") + 4029 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/5") + 4030 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/6") + 4031 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/7") + 4032 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/8") + 4033 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/9") + 4034 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-multiple-vars-in-nested-blocks/10") + 4035 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/11") + 4036 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/12") + 4037 (check-next-stream-line-equal _test-output-stream " 03/add *(ebp+0xfffffff8) 0x00000000/r32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/13") + 4038 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-multiple-vars-in-nested-blocks/14") + 4039 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/15") + 4040 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/16") + 4041 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-multiple-vars-in-nested-blocks/17") + 4042 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/18") + 4043 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/19") + 4044 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-multiple-vars-in-nested-blocks/20") + 4045 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-multiple-vars-in-nested-blocks/21") + 4046 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-multiple-vars-in-nested-blocks/22") + 4047 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/23") + 4048 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-multiple-vars-in-nested-blocks/24") + 4049 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-multiple-vars-in-nested-blocks/25") + 4050 # . epilogue + 4051 89/<- %esp 5/r32/ebp + 4052 5d/pop-to-ebp + 4053 c3/return + 4054 + 4055 test-convert-function-with-branches-and-local-vars: + 4056 # A conditional 'break' after a 'var' in a block is converted into a + 4057 # nested block that performs all necessary cleanup before jumping. This + 4058 # results in some ugly code duplication. + 4059 # . prologue + 4060 55/push-ebp + 4061 89/<- %ebp 4/r32/esp + 4062 # setup + 4063 (clear-stream _test-input-stream) + 4064 (clear-stream $_test-input-buffered-file->buffer) + 4065 (clear-stream _test-output-stream) + 4066 (clear-stream $_test-output-buffered-file->buffer) + 4067 # + 4068 (write _test-input-stream "fn foo {\n") + 4069 (write _test-input-stream " {\n") + 4070 (write _test-input-stream " var x: int\n") + 4071 (write _test-input-stream " break-if->=\n") + 4072 (write _test-input-stream " increment x\n") + 4073 (write _test-input-stream " }\n") + 4074 (write _test-input-stream "}\n") + 4075 # convert + 4076 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4077 (flush _test-output-buffered-file) + 4078 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4084 # check output + 4085 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-local-vars/0") + 4086 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-local-vars/1") + 4087 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-local-vars/2") + 4088 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-local-vars/3") + 4089 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/4") + 4090 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-local-vars/5") + 4091 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/6") + 4092 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-local-vars/7") + 4093 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-local-vars/8") + 4094 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-local-vars/9") + 4095 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-local-vars/10") + 4096 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-local-vars/11") + 4097 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-local-vars/12") + 4098 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/13") + 4099 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-local-vars/14") + 4100 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-local-vars/15") + 4101 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/16") + 4102 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-local-vars/17") + 4103 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-local-vars/18") + 4104 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-local-vars/19") + 4105 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-local-vars/20") + 4106 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-local-vars/21") + 4107 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-local-vars/22") + 4108 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-local-vars/23") + 4109 # . epilogue + 4110 89/<- %esp 5/r32/ebp + 4111 5d/pop-to-ebp + 4112 c3/return + 4113 + 4114 test-convert-function-with-conditional-loops-and-local-vars: + 4115 # A conditional 'loop' after a 'var' in a block is converted into a nested + 4116 # block that performs all necessary cleanup before jumping. This results + 4117 # in some ugly code duplication. + 4118 # . prologue + 4119 55/push-ebp + 4120 89/<- %ebp 4/r32/esp + 4121 # setup + 4122 (clear-stream _test-input-stream) + 4123 (clear-stream $_test-input-buffered-file->buffer) + 4124 (clear-stream _test-output-stream) + 4125 (clear-stream $_test-output-buffered-file->buffer) + 4126 # + 4127 (write _test-input-stream "fn foo {\n") + 4128 (write _test-input-stream " {\n") + 4129 (write _test-input-stream " var x: int\n") + 4130 (write _test-input-stream " loop-if->=\n") + 4131 (write _test-input-stream " increment x\n") + 4132 (write _test-input-stream " }\n") + 4133 (write _test-input-stream "}\n") + 4134 # convert + 4135 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4136 (flush _test-output-buffered-file) + 4137 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4143 # check output + 4144 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-conditional-loops-and-local-vars/0") + 4145 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-conditional-loops-and-local-vars/1") + 4146 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/2") + 4147 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-conditional-loops-and-local-vars/3") + 4148 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/4") + 4149 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/5") + 4150 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/6") + 4151 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-conditional-loops-and-local-vars/7") + 4152 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/8") + 4153 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-conditional-loops-and-local-vars/9") + 4154 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-conditional-loops-and-local-vars/10") + 4155 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/11") + 4156 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:loop/disp32" "F - test-convert-function-with-conditional-loops-and-local-vars/12") + 4157 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/13") + 4158 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-conditional-loops-and-local-vars/14") + 4159 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-conditional-loops-and-local-vars/15") + 4160 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/16") + 4161 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/17") + 4162 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-conditional-loops-and-local-vars/18") + 4163 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-conditional-loops-and-local-vars/19") + 4164 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-conditional-loops-and-local-vars/20") + 4165 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/21") + 4166 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-conditional-loops-and-local-vars/22") + 4167 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-conditional-loops-and-local-vars/23") + 4168 # . epilogue + 4169 89/<- %esp 5/r32/ebp + 4170 5d/pop-to-ebp + 4171 c3/return + 4172 + 4173 test-convert-function-with-unconditional-loops-and-local-vars: + 4174 # An unconditional 'loop' after a 'var' in a block is emitted _after_ the + 4175 # regular block cleanup. Any instructions after 'loop' are dead and + 4176 # therefore skipped. + 4177 # . prologue + 4178 55/push-ebp + 4179 89/<- %ebp 4/r32/esp + 4180 # setup + 4181 (clear-stream _test-input-stream) + 4182 (clear-stream $_test-input-buffered-file->buffer) + 4183 (clear-stream _test-output-stream) + 4184 (clear-stream $_test-output-buffered-file->buffer) + 4185 # + 4186 (write _test-input-stream "fn foo {\n") + 4187 (write _test-input-stream " {\n") + 4188 (write _test-input-stream " var x: int\n") + 4189 (write _test-input-stream " loop\n") + 4190 (write _test-input-stream " increment x\n") + 4191 (write _test-input-stream " }\n") + 4192 (write _test-input-stream "}\n") + 4193 # convert + 4194 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4195 (flush _test-output-buffered-file) + 4196 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4202 # check output + 4203 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-loops-and-local-vars/0") + 4204 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-loops-and-local-vars/1") + 4205 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/2") + 4206 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-loops-and-local-vars/3") + 4207 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/4") + 4208 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/5") + 4209 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-loops-and-local-vars/6") + 4210 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-loops-and-local-vars/7") + 4211 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/8") + 4212 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-unconditional-loops-and-local-vars/9") + 4213 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-unconditional-loops-and-local-vars/10") + 4214 # not emitted: ff 0/subop/increment *(ebp+0xfffffffc) + 4215 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/11") + 4216 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/12") + 4217 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-loops-and-local-vars/13") + 4218 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-loops-and-local-vars/14") + 4219 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-loops-and-local-vars/15") + 4220 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/16") + 4221 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-loops-and-local-vars/17") + 4222 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-loops-and-local-vars/18") + 4223 # . epilogue + 4224 89/<- %esp 5/r32/ebp + 4225 5d/pop-to-ebp + 4226 c3/return + 4227 + 4228 test-convert-function-with-branches-and-loops-and-local-vars: + 4229 # . prologue + 4230 55/push-ebp + 4231 89/<- %ebp 4/r32/esp + 4232 # setup + 4233 (clear-stream _test-input-stream) + 4234 (clear-stream $_test-input-buffered-file->buffer) + 4235 (clear-stream _test-output-stream) + 4236 (clear-stream $_test-output-buffered-file->buffer) + 4237 # + 4238 (write _test-input-stream "fn foo {\n") + 4239 (write _test-input-stream " {\n") + 4240 (write _test-input-stream " var x: int\n") + 4241 (write _test-input-stream " break-if->=\n") + 4242 (write _test-input-stream " increment x\n") + 4243 (write _test-input-stream " loop\n") + 4244 (write _test-input-stream " }\n") + 4245 (write _test-input-stream "}\n") + 4246 # convert + 4247 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4248 (flush _test-output-buffered-file) + 4249 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4255 # check output + 4256 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-branches-and-loops-and-local-vars/0") + 4257 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-branches-and-loops-and-local-vars/1") + 4258 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/2") + 4259 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-branches-and-loops-and-local-vars/3") + 4260 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/4") + 4261 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/5") + 4262 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/6") + 4263 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-branches-and-loops-and-local-vars/7") + 4264 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/8") + 4265 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-branches-and-loops-and-local-vars/9") + 4266 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/10") + 4267 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/11") + 4268 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000002:break/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/12") + 4269 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/13") + 4270 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-branches-and-loops-and-local-vars/14") + 4271 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-branches-and-loops-and-local-vars/15") + 4272 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-branches-and-loops-and-local-vars/16") + 4273 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/17") + 4274 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/18") + 4275 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-branches-and-loops-and-local-vars/19") + 4276 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-branches-and-loops-and-local-vars/20") + 4277 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-branches-and-loops-and-local-vars/21") + 4278 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/22") + 4279 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-branches-and-loops-and-local-vars/23") + 4280 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-branches-and-loops-and-local-vars/24") + 4281 # . epilogue + 4282 89/<- %esp 5/r32/ebp + 4283 5d/pop-to-ebp + 4284 c3/return + 4285 + 4286 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars: + 4287 # . prologue + 4288 55/push-ebp + 4289 89/<- %ebp 4/r32/esp + 4290 # setup + 4291 (clear-stream _test-input-stream) + 4292 (clear-stream $_test-input-buffered-file->buffer) + 4293 (clear-stream _test-output-stream) + 4294 (clear-stream $_test-output-buffered-file->buffer) + 4295 # + 4296 (write _test-input-stream "fn foo {\n") + 4297 (write _test-input-stream " a: {\n") + 4298 (write _test-input-stream " var x: int\n") + 4299 (write _test-input-stream " {\n") + 4300 (write _test-input-stream " var y: int\n") + 4301 (write _test-input-stream " break-if->= a\n") + 4302 (write _test-input-stream " increment x\n") + 4303 (write _test-input-stream " loop\n") + 4304 (write _test-input-stream " }\n") + 4305 (write _test-input-stream " }\n") + 4306 (write _test-input-stream "}\n") + 4307 # convert + 4308 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4309 (flush _test-output-buffered-file) + 4310 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4316 # check output + 4317 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/0") + 4318 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/1") + 4319 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/2") + 4320 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/3") + 4321 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/4") + 4322 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/5") + 4323 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/6") + 4324 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/7") + 4325 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/8") + 4326 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/9") + 4327 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/10") + 4328 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/11") + 4329 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/12") + 4330 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/13") + 4331 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/14") + 4332 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/15") + 4333 (check-next-stream-line-equal _test-output-stream " e9/jump a:break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/16") + 4334 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/17") + 4335 (check-next-stream-line-equal _test-output-stream " ff 0/subop/increment *(ebp+0xfffffffc)" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/18") + 4336 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/19") + 4337 (check-next-stream-line-equal _test-output-stream " e9/jump loop/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/20") + 4338 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/21") + 4339 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/22") + 4340 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/23") + 4341 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/24") + 4342 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/25") + 4343 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/26") + 4344 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/27") + 4345 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/28") + 4346 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/29") + 4347 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/30") + 4348 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars/31") + 4349 # . epilogue + 4350 89/<- %esp 5/r32/ebp + 4351 5d/pop-to-ebp + 4352 c3/return + 4353 + 4354 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2: + 4355 # . prologue + 4356 55/push-ebp + 4357 89/<- %ebp 4/r32/esp + 4358 # setup + 4359 (clear-stream _test-input-stream) + 4360 (clear-stream $_test-input-buffered-file->buffer) + 4361 (clear-stream _test-output-stream) + 4362 (clear-stream $_test-output-buffered-file->buffer) + 4363 # non-local conditional branch from a block without a local variable, + 4364 # unwinding a local on the stack + 4365 (write _test-input-stream "fn foo {\n") + 4366 (write _test-input-stream " a: {\n") + 4367 (write _test-input-stream " var x: int\n") + 4368 (write _test-input-stream " {\n") + 4369 (write _test-input-stream " break-if->= a\n") + 4370 (write _test-input-stream " }\n") + 4371 (write _test-input-stream " }\n") + 4372 (write _test-input-stream "}\n") + 4373 # convert + 4374 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4375 (flush _test-output-buffered-file) + 4376 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4382 # check output + 4383 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/0") + 4384 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/1") + 4385 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/2") + 4386 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/3") + 4387 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/4") + 4388 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/5") + 4389 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/6") + 4390 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/7") + 4391 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/8") + 4392 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/9") + 4393 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/10") + 4394 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/11") + 4395 (check-next-stream-line-equal _test-output-stream " 0f 8c/jump-if-< break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/12") + 4396 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/13") + 4397 (check-next-stream-line-equal _test-output-stream " e9/jump a:break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/14") + 4398 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/15") + 4399 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/16") + 4400 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/17") + 4401 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/18") + 4402 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/19") + 4403 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/20") + 4404 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/21") + 4405 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/22") + 4406 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/23") + 4407 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/24") + 4408 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/25") + 4409 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-2/26") + 4410 # . epilogue + 4411 89/<- %esp 5/r32/ebp + 4412 5d/pop-to-ebp + 4413 c3/return + 4414 + 4415 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3: + 4416 # . prologue + 4417 55/push-ebp + 4418 89/<- %ebp 4/r32/esp + 4419 # setup + 4420 (clear-stream _test-input-stream) + 4421 (clear-stream $_test-input-buffered-file->buffer) + 4422 (clear-stream _test-output-stream) + 4423 (clear-stream $_test-output-buffered-file->buffer) + 4424 # non-local unconditional branch from a block without a local variable, + 4425 # unwinding a local on the stack + 4426 (write _test-input-stream "fn foo {\n") + 4427 (write _test-input-stream " a: {\n") + 4428 (write _test-input-stream " var x: int\n") + 4429 (write _test-input-stream " {\n") + 4430 (write _test-input-stream " break a\n") + 4431 (write _test-input-stream " }\n") + 4432 (write _test-input-stream " }\n") + 4433 (write _test-input-stream "}\n") + 4434 # convert + 4435 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4436 (flush _test-output-buffered-file) + 4437 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4443 # check output + 4444 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/0") + 4445 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/1") + 4446 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/2") + 4447 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/3") + 4448 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/4") + 4449 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/5") + 4450 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/6") + 4451 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/7") + 4452 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/8") + 4453 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/9") + 4454 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/10") + 4455 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/11") + 4456 (check-next-stream-line-equal _test-output-stream " e9/jump a:break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/12") + 4457 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/14") + 4458 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/15") + 4459 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/16") + 4460 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/17") + 4461 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/18") + 4462 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/19") + 4463 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/20") + 4464 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/21") + 4465 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/22") + 4466 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/23") + 4467 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-3/24") + 4468 # . epilogue + 4469 89/<- %esp 5/r32/ebp + 4470 5d/pop-to-ebp + 4471 c3/return + 4472 + 4473 test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4: + 4474 # . prologue + 4475 55/push-ebp + 4476 89/<- %ebp 4/r32/esp + 4477 # setup + 4478 (clear-stream _test-input-stream) + 4479 (clear-stream $_test-input-buffered-file->buffer) + 4480 (clear-stream _test-output-stream) + 4481 (clear-stream $_test-output-buffered-file->buffer) + 4482 # + 4483 (write _test-input-stream "fn foo {\n") + 4484 (write _test-input-stream " a: {\n") + 4485 (write _test-input-stream " var x/esi: int <- copy 0\n") + 4486 (write _test-input-stream " {\n") + 4487 (write _test-input-stream " break a\n") + 4488 (write _test-input-stream " }\n") + 4489 (write _test-input-stream " }\n") + 4490 (write _test-input-stream "}\n") + 4491 # convert + 4492 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4493 (flush _test-output-buffered-file) + 4494 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4500 # check output + 4501 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/0") + 4502 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/1") + 4503 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/2") + 4504 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/3") + 4505 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/4") + 4506 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/5") + 4507 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/6") + 4508 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/7") + 4509 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/8") + 4510 (check-next-stream-line-equal _test-output-stream " be/copy-to-esi 0/imm32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/9") + 4511 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/10") + 4512 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/11") + 4513 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/12") + 4514 (check-next-stream-line-equal _test-output-stream " e9/jump a:break/disp32" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/13") + 4515 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/14") + 4516 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/15") + 4517 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/16") + 4518 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/17") + 4519 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/18") + 4520 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/19") + 4521 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/20") + 4522 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/21") + 4523 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/22") + 4524 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/23") + 4525 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-branches-and-loops-and-local-vars-4/24") 4526 # . epilogue 4527 89/<- %esp 5/r32/ebp 4528 5d/pop-to-ebp 4529 c3/return 4530 - 4531 test-array-size-in-hex: + 4531 test-convert-function-with-nonlocal-unconditional-break-and-local-vars: 4532 # . prologue 4533 55/push-ebp 4534 89/<- %ebp 4/r32/esp @@ -4194,7492 +4194,7497 @@ if ('onhashchange' in window) { 4537 (clear-stream $_test-input-buffered-file->buffer) 4538 (clear-stream _test-output-stream) 4539 (clear-stream $_test-output-buffered-file->buffer) - 4540 (clear-stream _test-error-stream) - 4541 (clear-stream $_test-error-buffered-file->buffer) - 4542 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 4543 68/push 0/imm32 - 4544 68/push 0/imm32 - 4545 89/<- %edx 4/r32/esp - 4546 (tailor-exit-descriptor %edx 0x10) - 4547 # - 4548 (write _test-input-stream "fn foo {\n") - 4549 (write _test-input-stream " var x: (array int 10)\n") + 4540 # + 4541 (write _test-input-stream "fn foo {\n") + 4542 (write _test-input-stream " a: {\n") + 4543 (write _test-input-stream " var x: int\n") + 4544 (write _test-input-stream " {\n") + 4545 (write _test-input-stream " var y: int\n") + 4546 (write _test-input-stream " break a\n") + 4547 (write _test-input-stream " increment x\n") + 4548 (write _test-input-stream " }\n") + 4549 (write _test-input-stream " }\n") 4550 (write _test-input-stream "}\n") 4551 # convert - 4552 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 4553 # registers except esp clobbered at this point - 4554 # restore ed - 4555 89/<- %edx 4/r32/esp - 4556 (flush _test-output-buffered-file) - 4557 (flush _test-error-buffered-file) - 4558 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 4564 # check output - 4565 (check-stream-equal _test-output-stream "" "F - test-array-size-in-hex: output should be empty") - 4566 (check-next-stream-line-equal _test-error-stream "literal integers are always hex in Mu; start '10' with a '0x' to be unambiguous, converting it to hexadecimal as necessary." "F - test-array-size-in-hex: error message") - 4567 # check that stop(1) was called - 4568 (check-ints-equal *(edx+4) 2 "F - test-array-size-in-hex: exit status") - 4569 # don't restore from ebp - 4570 81 0/subop/add %esp 8/imm32 - 4571 # . epilogue - 4572 5d/pop-to-ebp - 4573 c3/return - 4574 - 4575 test-convert-function-with-populate: - 4576 # . prologue - 4577 55/push-ebp - 4578 89/<- %ebp 4/r32/esp - 4579 # setup - 4580 (clear-stream _test-input-stream) - 4581 (clear-stream $_test-input-buffered-file->buffer) - 4582 (clear-stream _test-output-stream) - 4583 (clear-stream $_test-output-buffered-file->buffer) - 4584 # - 4585 (write _test-input-stream "fn foo {\n") - 4586 (write _test-input-stream " var x/ecx: (addr handle array int) <- copy 0\n") - 4587 (write _test-input-stream " populate x, 7\n") - 4588 (write _test-input-stream "}\n") - 4589 # convert - 4590 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4591 (flush _test-output-buffered-file) - 4592 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4598 # check output - 4599 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-populate/0") - 4600 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-populate/1") - 4601 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-populate/2") - 4602 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-populate/3") - 4603 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-populate/4") - 4604 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-populate/5") - 4605 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-populate/6") - 4606 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-populate/7") - 4607 (check-next-stream-line-equal _test-output-stream " (allocate-array2 Heap 0x00000004 7 %ecx)" "F - test-convert-function-with-populate/8") # 4 = size-of(int) - 4608 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-populate/9") - 4609 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-populate/10") - 4610 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-populate/11") - 4611 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-populate/12") - 4612 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-populate/13") - 4613 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-populate/14") - 4614 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-populate/15") - 4615 # . epilogue - 4616 89/<- %esp 5/r32/ebp - 4617 5d/pop-to-ebp - 4618 c3/return - 4619 - 4620 # special-case for size(byte) when allocating array - 4621 test-convert-function-with-local-array-of-bytes-in-mem: - 4622 # . prologue - 4623 55/push-ebp - 4624 89/<- %ebp 4/r32/esp - 4625 # setup - 4626 (clear-stream _test-input-stream) - 4627 (clear-stream $_test-input-buffered-file->buffer) - 4628 (clear-stream _test-output-stream) - 4629 (clear-stream $_test-output-buffered-file->buffer) - 4630 # - 4631 (write _test-input-stream "fn foo {\n") - 4632 (write _test-input-stream " var x: (array byte 3)\n") - 4633 (write _test-input-stream "}\n") - 4634 # convert - 4635 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4636 (flush _test-output-buffered-file) - 4637 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4643 # check output - 4644 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-of-bytes-in-mem/0") - 4645 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-of-bytes-in-mem/1") - 4646 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/2") - 4647 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-array-of-bytes-in-mem/3") - 4648 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-of-bytes-in-mem/4") - 4649 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-of-bytes-in-mem/5") - 4650 # define x - 4651 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x00000003)" "F - test-convert-function-with-local-array-of-bytes-in-mem/7") - 4652 (check-next-stream-line-equal _test-output-stream " 68/push 0x00000003/imm32" "F - test-convert-function-with-local-array-of-bytes-in-mem/8") - 4653 # reclaim x - 4654 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000007/imm32" "F - test-convert-function-with-local-array-of-bytes-in-mem/9") - 4655 # - 4656 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-of-bytes-in-mem/10") - 4657 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-of-bytes-in-mem/11") - 4658 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-of-bytes-in-mem/12") - 4659 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/13") - 4660 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/14") - 4661 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-of-bytes-in-mem/15") - 4662 # . epilogue - 4663 89/<- %esp 5/r32/ebp - 4664 5d/pop-to-ebp - 4665 c3/return - 4666 - 4667 test-convert-address: - 4668 # . prologue - 4669 55/push-ebp - 4670 89/<- %ebp 4/r32/esp - 4671 # setup - 4672 (clear-stream _test-input-stream) - 4673 (clear-stream $_test-input-buffered-file->buffer) - 4674 (clear-stream _test-output-stream) - 4675 (clear-stream $_test-output-buffered-file->buffer) - 4676 # - 4677 (write _test-input-stream "fn foo {\n") - 4678 (write _test-input-stream " var a: int\n") - 4679 (write _test-input-stream " var b/eax: (addr int) <- address a\n") - 4680 (write _test-input-stream "}\n") - 4681 # convert - 4682 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4683 (flush _test-output-buffered-file) - 4684 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4690 # check output - 4691 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-address/0") - 4692 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-address/1") - 4693 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-address/2") - 4694 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-address/3") - 4695 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-address/4") - 4696 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-address/5") - 4697 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-address/6") - 4698 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-address/7") - 4699 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000000/r32" "F - test-convert-address/8") - 4700 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-address/9") - 4701 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-address/10") - 4702 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-address/11") - 4703 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-address/12") - 4704 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-address/13") - 4705 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-address/14") - 4706 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-address/15") - 4707 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-address/16") - 4708 # . epilogue - 4709 89/<- %esp 5/r32/ebp - 4710 5d/pop-to-ebp - 4711 c3/return - 4712 - 4713 test-convert-floating-point-convert: - 4714 # . prologue - 4715 55/push-ebp - 4716 89/<- %ebp 4/r32/esp - 4717 # setup - 4718 (clear-stream _test-input-stream) - 4719 (clear-stream $_test-input-buffered-file->buffer) - 4720 (clear-stream _test-output-stream) - 4721 (clear-stream $_test-output-buffered-file->buffer) - 4722 # - 4723 (write _test-input-stream "fn foo {\n") - 4724 (write _test-input-stream " var a/eax: int <- copy 0\n") - 4725 (write _test-input-stream " var b/xmm1: float <- convert a\n") - 4726 (write _test-input-stream "}\n") - 4727 # convert - 4728 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4729 (flush _test-output-buffered-file) - 4730 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4736 # check output - 4737 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-floating-point-convert/0") - 4738 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-convert/1") - 4739 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-convert/2") - 4740 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-convert/3") - 4741 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-convert/4") - 4742 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-floating-point-convert/5") - 4743 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-floating-point-convert/6") - 4744 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-floating-point-convert/7") - 4745 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-convert/8") - 4746 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-convert/9") - 4747 (check-next-stream-line-equal _test-output-stream " f3 0f 2a/convert-to-float %eax 0x00000001/x32" "F - test-convert-floating-point-convert/10") - 4748 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-convert/11") - 4749 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-floating-point-convert/12") - 4750 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-floating-point-convert/13") - 4751 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-convert/14") - 4752 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-floating-point-convert/15") - 4753 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-convert/16") - 4754 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-convert/17") - 4755 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-convert/18") - 4756 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-convert/19") - 4757 # . epilogue - 4758 89/<- %esp 5/r32/ebp - 4759 5d/pop-to-ebp - 4760 c3/return - 4761 - 4762 test-convert-floating-point-convert-2: - 4763 # . prologue - 4764 55/push-ebp - 4765 89/<- %ebp 4/r32/esp - 4766 # setup - 4767 (clear-stream _test-input-stream) - 4768 (clear-stream $_test-input-buffered-file->buffer) - 4769 (clear-stream _test-output-stream) - 4770 (clear-stream $_test-output-buffered-file->buffer) - 4771 # - 4772 (write _test-input-stream "fn foo {\n") - 4773 (write _test-input-stream " var a/eax: int <- copy 0\n") - 4774 (write _test-input-stream " var b/xmm1: float <- convert a\n") - 4775 (write _test-input-stream " a <- convert b\n") - 4776 (write _test-input-stream "}\n") - 4777 # convert - 4778 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4779 (flush _test-output-buffered-file) - 4780 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4786 # check output - 4787 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-floating-point-convert-2/0") - 4788 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-convert-2/1") - 4789 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-convert-2/2") - 4790 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-convert-2/3") - 4791 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-convert-2/4") - 4792 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-floating-point-convert-2/5") - 4793 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-floating-point-convert-2/6") - 4794 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-floating-point-convert-2/7") - 4795 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-convert-2/8") - 4796 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-convert-2/9") - 4797 (check-next-stream-line-equal _test-output-stream " f3 0f 2a/convert-to-float %eax 0x00000001/x32" "F - test-convert-floating-point-convert-2/10") - 4798 (check-next-stream-line-equal _test-output-stream " f3 0f 2d/convert-to-int %xmm1 0x00000000/r32" "F - test-convert-floating-point-convert-2/11") - 4799 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-convert-2/12") - 4800 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-floating-point-convert-2/13") - 4801 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-floating-point-convert-2/14") - 4802 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-convert-2/15") - 4803 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-floating-point-convert-2/16") - 4804 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-convert-2/17") - 4805 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-convert-2/18") - 4806 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-convert-2/19") - 4807 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-convert-2/20") - 4808 # . epilogue - 4809 89/<- %esp 5/r32/ebp - 4810 5d/pop-to-ebp - 4811 c3/return - 4812 - 4813 test-convert-floating-point-operation: - 4814 # . prologue - 4815 55/push-ebp - 4816 89/<- %ebp 4/r32/esp - 4817 # setup - 4818 (clear-stream _test-input-stream) - 4819 (clear-stream $_test-input-buffered-file->buffer) - 4820 (clear-stream _test-output-stream) - 4821 (clear-stream $_test-output-buffered-file->buffer) - 4822 # - 4823 (write _test-input-stream "fn f {\n") - 4824 (write _test-input-stream " var m: float\n") - 4825 (write _test-input-stream " var x/xmm1: float <- copy m\n") - 4826 (write _test-input-stream " var y/xmm5: float <- copy m\n") - 4827 (write _test-input-stream " x <- copy y\n") - 4828 (write _test-input-stream " copy-to m, y\n") - 4829 (write _test-input-stream " x <- add y\n") - 4830 (write _test-input-stream " x <- add m\n") - 4831 (write _test-input-stream " x <- subtract y\n") - 4832 (write _test-input-stream " x <- subtract m\n") - 4833 (write _test-input-stream " x <- multiply y\n") - 4834 (write _test-input-stream " x <- multiply m\n") - 4835 (write _test-input-stream " x <- divide y\n") - 4836 (write _test-input-stream " x <- divide m\n") - 4837 (write _test-input-stream " x <- reciprocal y\n") - 4838 (write _test-input-stream " x <- reciprocal m\n") - 4839 (write _test-input-stream " x <- square-root y\n") - 4840 (write _test-input-stream " x <- square-root m\n") - 4841 (write _test-input-stream " x <- inverse-square-root y\n") - 4842 (write _test-input-stream " x <- inverse-square-root m\n") - 4843 (write _test-input-stream " x <- max y\n") - 4844 (write _test-input-stream " x <- max m\n") - 4845 (write _test-input-stream " x <- min y\n") - 4846 (write _test-input-stream " x <- min m\n") - 4847 (write _test-input-stream " compare x, y\n") - 4848 (write _test-input-stream " compare x, m\n") - 4849 (write _test-input-stream "}\n") - 4850 # convert - 4851 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4852 (flush _test-output-buffered-file) - 4853 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4859 # check output - 4860 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-floating-point-operation/0") - 4861 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-operation/1") - 4862 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-operation/2") - 4863 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-operation/3") - 4864 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-operation/4") - 4865 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-floating-point-operation/5") - 4866 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-floating-point-operation/6") - 4867 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-operation/7") - 4868 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-operation/8") - 4869 (check-next-stream-line-equal _test-output-stream " f3 0f 10/copy *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/9") - 4870 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-operation/10") - 4871 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 5/x32" "F - test-convert-floating-point-operation/11") - 4872 (check-next-stream-line-equal _test-output-stream " f3 0f 10/copy *(ebp+0xfffffffc) 0x00000005/x32" "F - test-convert-floating-point-operation/12") - 4873 (check-next-stream-line-equal _test-output-stream " f3 0f 11/copy %xmm1 0x00000005/x32" "F - test-convert-floating-point-operation/13") - 4874 (check-next-stream-line-equal _test-output-stream " f3 0f 11/copy *(ebp+0xfffffffc) 0x00000005/x32" "F - test-convert-floating-point-operation/14") - 4875 (check-next-stream-line-equal _test-output-stream " f3 0f 58/add %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/15") - 4876 (check-next-stream-line-equal _test-output-stream " f3 0f 58/add *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/16") - 4877 (check-next-stream-line-equal _test-output-stream " f3 0f 5c/subtract %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/17") - 4878 (check-next-stream-line-equal _test-output-stream " f3 0f 5c/subtract *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/18") - 4879 (check-next-stream-line-equal _test-output-stream " f3 0f 59/multiply %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/19") - 4880 (check-next-stream-line-equal _test-output-stream " f3 0f 59/multiply *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/20") - 4881 (check-next-stream-line-equal _test-output-stream " f3 0f 5e/divide %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/21") - 4882 (check-next-stream-line-equal _test-output-stream " f3 0f 5e/divide *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/22") - 4883 (check-next-stream-line-equal _test-output-stream " f3 0f 53/reciprocal %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/23") - 4884 (check-next-stream-line-equal _test-output-stream " f3 0f 53/reciprocal *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/24") - 4885 (check-next-stream-line-equal _test-output-stream " f3 0f 51/square-root %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/25") - 4886 (check-next-stream-line-equal _test-output-stream " f3 0f 51/square-root *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/26") - 4887 (check-next-stream-line-equal _test-output-stream " f3 0f 52/inverse-square-root %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/27") - 4888 (check-next-stream-line-equal _test-output-stream " f3 0f 52/inverse-square-root *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/28") - 4889 (check-next-stream-line-equal _test-output-stream " f3 0f 5f/max %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/29") - 4890 (check-next-stream-line-equal _test-output-stream " f3 0f 5f/max *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/30") - 4891 (check-next-stream-line-equal _test-output-stream " f3 0f 5d/min %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/31") - 4892 (check-next-stream-line-equal _test-output-stream " f3 0f 5d/min *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/32") - 4893 (check-next-stream-line-equal _test-output-stream " 0f 2f/compare %xmm1 0x00000005/x32" "F - test-convert-floating-point-operation/33") - 4894 (check-next-stream-line-equal _test-output-stream " 0f 2f/compare *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/34") - 4895 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 5/x32" "F - test-convert-floating-point-operation/35") - 4896 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-operation/36") - 4897 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-operation/37") - 4898 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-operation/38") - 4899 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-floating-point-operation/39") - 4900 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-operation/40") - 4901 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-floating-point-operation/41") - 4902 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-operation/42") - 4903 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-operation/43") - 4904 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-operation/44") - 4905 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-operation/45") - 4906 # . epilogue - 4907 89/<- %esp 5/r32/ebp - 4908 5d/pop-to-ebp - 4909 c3/return - 4910 - 4911 test-convert-floating-point-dereferenced: - 4912 # . prologue - 4913 55/push-ebp - 4914 89/<- %ebp 4/r32/esp - 4915 # setup - 4916 (clear-stream _test-input-stream) - 4917 (clear-stream $_test-input-buffered-file->buffer) - 4918 (clear-stream _test-output-stream) - 4919 (clear-stream $_test-output-buffered-file->buffer) - 4920 # - 4921 (write _test-input-stream "fn f {\n") - 4922 (write _test-input-stream " var m: float\n") - 4923 (write _test-input-stream " var x/xmm1: float <- copy m\n") - 4924 (write _test-input-stream " var y/eax: (addr float) <- copy 0\n") - 4925 (write _test-input-stream " x <- multiply *y\n") - 4926 (write _test-input-stream "}\n") - 4927 # convert - 4928 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4929 (flush _test-output-buffered-file) - 4930 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4936 # check output - 4937 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-floating-point-dereferenced/0") - 4938 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-dereferenced/1") - 4939 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-dereferenced/2") - 4940 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-dereferenced/3") - 4941 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-dereferenced/4") - 4942 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-floating-point-dereferenced/5") - 4943 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-floating-point-dereferenced/6") - 4944 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-dereferenced/7") - 4945 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-dereferenced/8") - 4946 (check-next-stream-line-equal _test-output-stream " f3 0f 10/copy *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-dereferenced/9") - 4947 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-floating-point-dereferenced/10") - 4948 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-floating-point-dereferenced/11") - 4949 (check-next-stream-line-equal _test-output-stream " f3 0f 59/multiply *eax 0x00000001/x32" "F - test-convert-floating-point-dereferenced/12") - 4950 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-floating-point-dereferenced/13") - 4951 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-dereferenced/14") - 4952 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-dereferenced/15") - 4953 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-floating-point-dereferenced/16") - 4954 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-dereferenced/17") - 4955 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-floating-point-dereferenced/18") - 4956 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-dereferenced/19") - 4957 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-dereferenced/20") - 4958 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-dereferenced/21") - 4959 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-dereferenced/22") - 4960 # . epilogue - 4961 89/<- %esp 5/r32/ebp - 4962 5d/pop-to-ebp - 4963 c3/return - 4964 - 4965 test-convert-length-of-array: - 4966 # . prologue - 4967 55/push-ebp - 4968 89/<- %ebp 4/r32/esp - 4969 # setup - 4970 (clear-stream _test-input-stream) - 4971 (clear-stream $_test-input-buffered-file->buffer) - 4972 (clear-stream _test-output-stream) - 4973 (clear-stream $_test-output-buffered-file->buffer) - 4974 # - 4975 (write _test-input-stream "fn foo a: (addr array int) {\n") - 4976 (write _test-input-stream " var b/eax: (addr array int) <- copy a\n") - 4977 (write _test-input-stream " var c/eax: int <- length b\n") - 4978 (write _test-input-stream "}\n") - 4979 # convert - 4980 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 4981 (flush _test-output-buffered-file) - 4982 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 4988 # check output - 4989 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array/0") - 4990 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array/1") - 4991 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array/2") - 4992 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array/3") - 4993 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array/4") - 4994 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array/5") - 4995 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array/6") - 4996 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array/7") - 4997 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array/8") - 4998 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array/9") - 4999 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array/10") - 5000 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array/11") - 5001 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array/12") - 5002 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array/13") - 5003 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array/14") - 5004 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array/15") - 5005 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array/16") - 5006 # . epilogue - 5007 89/<- %esp 5/r32/ebp - 5008 5d/pop-to-ebp - 5009 c3/return - 5010 - 5011 # special-case for size(byte) when computing array length - 5012 test-convert-length-of-array-of-bytes: - 5013 # . prologue - 5014 55/push-ebp - 5015 89/<- %ebp 4/r32/esp - 5016 # setup - 5017 (clear-stream _test-input-stream) - 5018 (clear-stream $_test-input-buffered-file->buffer) - 5019 (clear-stream _test-output-stream) - 5020 (clear-stream $_test-output-buffered-file->buffer) - 5021 # - 5022 (write _test-input-stream "fn foo a: (addr array byte) {\n") - 5023 (write _test-input-stream " var b/eax: (addr array byte) <- copy a\n") - 5024 (write _test-input-stream " var c/eax: int <- length b\n") - 5025 (write _test-input-stream "}\n") - 5026 # convert - 5027 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5028 (flush _test-output-buffered-file) - 5029 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5035 # check output - 5036 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-bytes/0") - 5037 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-bytes/1") - 5038 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-bytes/2") - 5039 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-bytes/3") - 5040 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-bytes/4") - 5041 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-bytes/5") - 5042 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-bytes/6") - 5043 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array-of-bytes/7") - 5044 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-bytes/8") - 5045 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-bytes/9") - 5046 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-bytes/10") - 5047 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-bytes/11") - 5048 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-bytes/12") - 5049 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-bytes/13") - 5050 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-bytes/14") - 5051 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-bytes/15") - 5052 # . epilogue - 5053 89/<- %esp 5/r32/ebp - 5054 5d/pop-to-ebp - 5055 c3/return - 5056 - 5057 test-convert-length-of-array-on-stack: - 5058 # . prologue - 5059 55/push-ebp - 5060 89/<- %ebp 4/r32/esp - 5061 # setup - 5062 (clear-stream _test-input-stream) - 5063 (clear-stream $_test-input-buffered-file->buffer) - 5064 (clear-stream _test-output-stream) - 5065 (clear-stream $_test-output-buffered-file->buffer) - 5066 # - 5067 (write _test-input-stream "fn foo {\n") - 5068 (write _test-input-stream " var a: (array int 3)\n") - 5069 (write _test-input-stream " var b/eax: int <- length a\n") - 5070 (write _test-input-stream "}\n") - 5071 # convert - 5072 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5073 (flush _test-output-buffered-file) - 5074 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5080 # check output - 5081 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-on-stack/0") - 5082 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-on-stack/1") - 5083 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-on-stack/2") - 5084 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-on-stack/3") - 5085 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-on-stack/4") - 5086 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-on-stack/5") - 5087 # define x - 5088 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-length-of-array-on-stack/6") - 5089 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-length-of-array-on-stack/7") - 5090 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-on-stack/8") - 5091 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0xfffffff0) 0x00000000/r32" "F - test-convert-length-of-array-on-stack/9") - 5092 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array-on-stack/10") - 5093 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-on-stack/11") - 5094 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-length-of-array-on-stack/12") - 5095 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-on-stack/13") - 5096 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-on-stack/14") - 5097 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-on-stack/15") - 5098 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-on-stack/16") - 5099 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-on-stack/17") - 5100 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-on-stack/18") - 5101 # . epilogue - 5102 89/<- %esp 5/r32/ebp - 5103 5d/pop-to-ebp - 5104 c3/return - 5105 - 5106 test-reg-var-def-with-read-of-same-register: - 5107 # . prologue - 5108 55/push-ebp - 5109 89/<- %ebp 4/r32/esp - 5110 # setup - 5111 (clear-stream _test-input-stream) - 5112 (clear-stream $_test-input-buffered-file->buffer) - 5113 (clear-stream _test-output-stream) - 5114 (clear-stream $_test-output-buffered-file->buffer) - 5115 (clear-stream _test-error-stream) - 5116 (clear-stream $_test-error-buffered-file->buffer) - 5117 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) # bytes of args in call to convert-mu - 5118 68/push 0/imm32 - 5119 68/push 0/imm32 - 5120 89/<- %edx 4/r32/esp - 5121 (tailor-exit-descriptor %edx 0x10) - 5122 # - 5123 (write _test-input-stream "fn foo {\n") - 5124 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 5125 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 5126 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") - 5127 (write _test-input-stream "}\n") - 5128 # convert - 5129 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 5130 # registers except esp could be clobbered at this point (though they shouldn't be) - 5131 # restore ed - 5132 89/<- %edx 4/r32/esp - 5133 (flush _test-output-buffered-file) - 5134 (flush _test-error-buffered-file) - 5135 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5141 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 5147 (check-stream-equal _test-error-stream "" "F - test-reg-var-def-with-read-of-same-register: error stream should be empty") - 5148 # check output - 5149 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-reg-var-def-with-read-of-same-register/0") - 5150 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-reg-var-def-with-read-of-same-register/1") - 5151 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-reg-var-def-with-read-of-same-register/2") - 5152 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-reg-var-def-with-read-of-same-register/3") - 5153 (check-next-stream-line-equal _test-output-stream " {" "F - test-reg-var-def-with-read-of-same-register/4") - 5154 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-reg-var-def-with-read-of-same-register/5") - 5155 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-reg-var-def-with-read-of-same-register/6") - 5156 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-reg-var-def-with-read-of-same-register/7") - 5157 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-reg-var-def-with-read-of-same-register/8") - 5158 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-reg-var-def-with-read-of-same-register/9") - 5159 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000002 + 4) 0x00000000/r32" "F - test-reg-var-def-with-read-of-same-register/11") - 5160 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-reg-var-def-with-read-of-same-register/13") - 5161 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-reg-var-def-with-read-of-same-register/14") - 5162 (check-next-stream-line-equal _test-output-stream " }" "F - test-reg-var-def-with-read-of-same-register/15") - 5163 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-reg-var-def-with-read-of-same-register/16") - 5164 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-reg-var-def-with-read-of-same-register/17") - 5165 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-reg-var-def-with-read-of-same-register/18") - 5166 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-reg-var-def-with-read-of-same-register/19") - 5167 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-reg-var-def-with-read-of-same-register/20") - 5168 # don't restore from ebp - 5169 81 0/subop/add %esp 8/imm32 - 5170 # . epilogue - 5171 5d/pop-to-ebp - 5172 c3/return - 5173 - 5174 test-convert-index-into-array: - 5175 # . prologue - 5176 55/push-ebp - 5177 89/<- %ebp 4/r32/esp - 5178 # setup - 5179 (clear-stream _test-input-stream) - 5180 (clear-stream $_test-input-buffered-file->buffer) - 5181 (clear-stream _test-output-stream) - 5182 (clear-stream $_test-output-buffered-file->buffer) - 5183 # - 5184 (write _test-input-stream "fn foo {\n") - 5185 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 5186 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 5187 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") - 5188 (write _test-input-stream "}\n") - 5189 # convert - 5190 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5191 (flush _test-output-buffered-file) - 5192 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5198 # check output - 5199 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array/0") - 5200 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array/1") - 5201 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array/2") - 5202 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array/3") - 5203 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array/4") - 5204 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array/5") - 5205 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array/6") - 5206 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array/7") - 5207 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array/8") - 5208 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array/9") - 5209 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000002 + 4) 0x00000000/r32" "F - test-convert-index-into-array/10") - 5210 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array/11") - 5211 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array/12") - 5212 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array/13") - 5213 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array/14") - 5214 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array/15") - 5215 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array/16") - 5216 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array/17") - 5217 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array/18") - 5218 # . epilogue - 5219 89/<- %esp 5/r32/ebp - 5220 5d/pop-to-ebp - 5221 c3/return - 5222 - 5223 test-convert-index-into-array-of-bytes: - 5224 # . prologue - 5225 55/push-ebp - 5226 89/<- %ebp 4/r32/esp - 5227 # setup - 5228 (clear-stream _test-input-stream) - 5229 (clear-stream $_test-input-buffered-file->buffer) - 5230 (clear-stream _test-output-stream) - 5231 (clear-stream $_test-output-buffered-file->buffer) - 5232 # - 5233 (write _test-input-stream "fn foo {\n") - 5234 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") - 5235 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 5236 (write _test-input-stream " var x/eax: (addr byte) <- index arr, idx\n") - 5237 (write _test-input-stream "}\n") - 5238 # convert - 5239 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5240 (flush _test-output-buffered-file) - 5241 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5247 # check output - 5248 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes/0") - 5249 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes/1") - 5250 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes/2") - 5251 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes/3") - 5252 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes/4") - 5253 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes/5") - 5254 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes/6") - 5255 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes/7") - 5256 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes/8") - 5257 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-of-bytes/9") - 5258 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000000 + 4) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes/11") - 5259 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes/13") - 5260 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes/14") - 5261 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes/15") - 5262 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes/16") - 5263 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes/17") - 5264 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes/18") - 5265 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes/19") - 5266 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes/20") - 5267 # . epilogue - 5268 89/<- %esp 5/r32/ebp - 5269 5d/pop-to-ebp - 5270 c3/return - 5271 - 5272 test-convert-index-into-array-with-literal: - 5273 # . prologue - 5274 55/push-ebp - 5275 89/<- %ebp 4/r32/esp - 5276 # setup - 5277 (clear-stream _test-input-stream) - 5278 (clear-stream $_test-input-buffered-file->buffer) - 5279 (clear-stream _test-output-stream) - 5280 (clear-stream $_test-output-buffered-file->buffer) - 5281 # - 5282 (write _test-input-stream "fn foo {\n") - 5283 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 5284 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") - 5285 (write _test-input-stream "}\n") - 5286 # convert - 5287 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5288 (flush _test-output-buffered-file) - 5289 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5295 # check output - 5296 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-with-literal/0") - 5297 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-with-literal/1") - 5298 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-with-literal/2") - 5299 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-with-literal/3") - 5300 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-with-literal/4") - 5301 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-with-literal/5") - 5302 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-with-literal/6") - 5303 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-with-literal/7") - 5304 # 2 * 4 bytes/elem + 4 bytes for size = offset 12 - 5305 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x0000000c) 0x00000000/r32" "F - test-convert-index-into-array-with-literal/8") - 5306 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-with-literal/9") - 5307 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-with-literal/10") - 5308 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-with-literal/11") - 5309 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-with-literal/12") - 5310 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-with-literal/13") - 5311 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-with-literal/14") - 5312 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-with-literal/15") - 5313 # . epilogue - 5314 89/<- %esp 5/r32/ebp - 5315 5d/pop-to-ebp - 5316 c3/return - 5317 - 5318 test-convert-index-into-array-of-bytes-with-literal: - 5319 # . prologue - 5320 55/push-ebp - 5321 89/<- %ebp 4/r32/esp - 5322 # setup - 5323 (clear-stream _test-input-stream) - 5324 (clear-stream $_test-input-buffered-file->buffer) - 5325 (clear-stream _test-output-stream) - 5326 (clear-stream $_test-output-buffered-file->buffer) - 5327 # - 5328 (write _test-input-stream "fn foo {\n") - 5329 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") - 5330 (write _test-input-stream " var x/eax: (addr byte) <- index arr, 2\n") - 5331 (write _test-input-stream "}\n") - 5332 # convert - 5333 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5334 (flush _test-output-buffered-file) - 5335 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5341 # check output - 5342 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-with-literal/0") - 5343 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-with-literal/1") - 5344 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-with-literal/2") - 5345 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-with-literal/3") - 5346 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-with-literal/4") - 5347 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-with-literal/5") - 5348 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-with-literal/6") - 5349 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes-with-literal/7") - 5350 # 2 * 1 byte/elem + 4 bytes for size = offset 6 - 5351 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000006) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-with-literal/8") - 5352 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-with-literal/9") - 5353 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-with-literal/10") - 5354 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-with-literal/11") - 5355 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-with-literal/12") - 5356 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-with-literal/13") - 5357 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-with-literal/14") - 5358 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-with-literal/15") - 5359 # . epilogue - 5360 89/<- %esp 5/r32/ebp - 5361 5d/pop-to-ebp - 5362 c3/return - 5363 - 5364 test-convert-index-into-array-on-stack: - 5365 # . prologue - 5366 55/push-ebp - 5367 89/<- %ebp 4/r32/esp - 5368 # setup - 5369 (clear-stream _test-input-stream) - 5370 (clear-stream $_test-input-buffered-file->buffer) - 5371 (clear-stream _test-output-stream) - 5372 (clear-stream $_test-output-buffered-file->buffer) - 5373 # - 5374 (write _test-input-stream "fn foo {\n") - 5375 (write _test-input-stream " var arr: (array int 3)\n") - 5376 (write _test-input-stream " var idx/eax: int <- copy 2\n") - 5377 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") - 5378 (write _test-input-stream "}\n") - 5379 # convert - 5380 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5381 (flush _test-output-buffered-file) - 5382 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5388 # check output - 5389 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack/0") - 5390 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack/1") - 5391 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack/2") - 5392 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack/3") - 5393 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack/4") - 5394 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack/5") - 5395 # var arr - 5396 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack/6") - 5397 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack/7") - 5398 # var idx - 5399 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack/8") - 5400 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 2/imm32" "F - test-convert-index-into-array-on-stack/9") - 5401 # var x is at (ebp-0x10) + idx<<2 + 4 = ebp + idx<<2 - 0xc - 5402 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp + eax<<0x00000002 + 0xfffffff4) 0x00000000/r32" "F - test-convert-index-into-array-on-stack/10") - 5403 # reclaim idx - 5404 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack/11") - 5405 # reclaim arr - 5406 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack/12") - 5407 # - 5408 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack/13") - 5409 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack/14") - 5410 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack/15") - 5411 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack/16") - 5412 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack/17") - 5413 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack/18") - 5414 # . epilogue - 5415 89/<- %esp 5/r32/ebp - 5416 5d/pop-to-ebp - 5417 c3/return - 5418 - 5419 test-convert-index-into-array-on-stack-with-literal: - 5420 # . prologue - 5421 55/push-ebp - 5422 89/<- %ebp 4/r32/esp - 5423 # setup - 5424 (clear-stream _test-input-stream) - 5425 (clear-stream $_test-input-buffered-file->buffer) - 5426 (clear-stream _test-output-stream) - 5427 (clear-stream $_test-output-buffered-file->buffer) - 5428 # - 5429 (write _test-input-stream "fn foo {\n") - 5430 (write _test-input-stream " var arr: (array int 3)\n") - 5431 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") - 5432 (write _test-input-stream "}\n") - 5433 # convert - 5434 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5435 (flush _test-output-buffered-file) - 5436 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5442 # check output - 5443 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack-with-literal/0") - 5444 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack-with-literal/1") - 5445 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack-with-literal/2") - 5446 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack-with-literal/3") - 5447 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack-with-literal/4") - 5448 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack-with-literal/5") - 5449 # var arr - 5450 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack-with-literal/6") - 5451 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack-with-literal/7") - 5452 # var x - 5453 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack-with-literal/8") - 5454 # x is at (ebp-0x10) + 4 + 2*4 = ebp-4 - 5455 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp + 0xfffffffc) 0x00000000/r32" "F - test-convert-index-into-array-on-stack-with-literal/9") - 5456 # reclaim x - 5457 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack-with-literal/10") - 5458 # reclaim arr - 5459 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack-with-literal/11") - 5460 # - 5461 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack-with-literal/12") - 5462 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack-with-literal/13") - 5463 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack-with-literal/14") - 5464 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack-with-literal/15") - 5465 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack-with-literal/16") - 5466 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack-with-literal/17") - 5467 # . epilogue - 5468 89/<- %esp 5/r32/ebp - 5469 5d/pop-to-ebp - 5470 c3/return - 5471 - 5472 test-convert-index-into-array-of-bytes-on-stack-with-literal: - 5473 # . prologue - 5474 55/push-ebp - 5475 89/<- %ebp 4/r32/esp - 5476 # setup - 5477 (clear-stream _test-input-stream) - 5478 (clear-stream $_test-input-buffered-file->buffer) - 5479 (clear-stream _test-output-stream) - 5480 (clear-stream $_test-output-buffered-file->buffer) - 5481 # - 5482 (write _test-input-stream "fn foo {\n") - 5483 (write _test-input-stream " var arr: (array byte 3)\n") - 5484 (write _test-input-stream " var x/eax: (addr byte) <- index arr, 2\n") - 5485 (write _test-input-stream "}\n") - 5486 # convert - 5487 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5488 (flush _test-output-buffered-file) - 5489 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5495 # check output - 5496 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/0") - 5497 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/1") - 5498 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/2") - 5499 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/3") - 5500 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/4") - 5501 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/5") - 5502 # var arr - 5503 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x00000003)" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/6") - 5504 (check-next-stream-line-equal _test-output-stream " 68/push 0x00000003/imm32" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/7") - 5505 # var x - 5506 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/8") - 5507 # x is at (ebp-7) + 4 + 2 = ebp-1 - 5508 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp + 0xffffffff) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/9") - 5509 # reclaim x - 5510 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/10") - 5511 # reclaim arr - 5512 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000007/imm32" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/11") - 5513 # - 5514 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/12") - 5515 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/13") - 5516 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/14") - 5517 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/15") - 5518 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/16") - 5519 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/17") - 5520 # . epilogue - 5521 89/<- %esp 5/r32/ebp - 5522 5d/pop-to-ebp - 5523 c3/return - 5524 - 5525 test-convert-index-into-array-using-offset: - 5526 # . prologue - 5527 55/push-ebp - 5528 89/<- %ebp 4/r32/esp - 5529 # setup - 5530 (clear-stream _test-input-stream) - 5531 (clear-stream $_test-input-buffered-file->buffer) - 5532 (clear-stream _test-output-stream) - 5533 (clear-stream $_test-output-buffered-file->buffer) - 5534 # - 5535 (write _test-input-stream "fn foo {\n") - 5536 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 5537 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 5538 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") - 5539 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") - 5540 (write _test-input-stream "}\n") - 5541 # convert - 5542 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5543 (flush _test-output-buffered-file) - 5544 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5550 # check output - 5551 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset/0") - 5552 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset/1") - 5553 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset/2") - 5554 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset/3") - 5555 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset/4") - 5556 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset/5") - 5557 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset/6") - 5558 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-using-offset/7") - 5559 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset/8") - 5560 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-using-offset/9") - 5561 (check-next-stream-line-equal _test-output-stream " 69/multiply %ecx 0x00000004/imm32 0x00000001/r32" "F - test-convert-index-into-array-using-offset/10") - 5562 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-using-offset/11") - 5563 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset/12") - 5564 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset/13") - 5565 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset/14") - 5566 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset/15") - 5567 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset/16") - 5568 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset/17") - 5569 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset/18") - 5570 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset/19") - 5571 # . epilogue - 5572 89/<- %esp 5/r32/ebp - 5573 5d/pop-to-ebp - 5574 c3/return - 5575 - 5576 test-convert-index-into-array-of-bytes-using-offset: - 5577 # . prologue - 5578 55/push-ebp - 5579 89/<- %ebp 4/r32/esp - 5580 # setup - 5581 (clear-stream _test-input-stream) - 5582 (clear-stream $_test-input-buffered-file->buffer) - 5583 (clear-stream _test-output-stream) - 5584 (clear-stream $_test-output-buffered-file->buffer) - 5585 # - 5586 (write _test-input-stream "fn foo {\n") - 5587 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") - 5588 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 5589 (write _test-input-stream " var off/ecx: (offset byte) <- compute-offset arr, idx\n") - 5590 (write _test-input-stream " var x/eax: (addr byte) <- index arr, off\n") - 5591 (write _test-input-stream "}\n") - 5592 # convert - 5593 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5594 (flush _test-output-buffered-file) - 5595 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5601 # check output - 5602 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-using-offset/0") - 5603 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-using-offset/1") - 5604 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-using-offset/2") - 5605 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-using-offset/3") - 5606 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-using-offset/4") - 5607 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-using-offset/5") - 5608 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-using-offset/6") - 5609 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes-using-offset/7") - 5610 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes-using-offset/8") - 5611 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-of-bytes-using-offset/9") - 5612 (check-next-stream-line-equal _test-output-stream " 69/multiply %ecx 0x00000001/imm32 0x00000001/r32" "F - test-convert-index-into-array-of-bytes-using-offset/10") - 5613 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-using-offset/11") - 5614 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes-using-offset/12") - 5615 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-using-offset/13") - 5616 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-using-offset/14") - 5617 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-using-offset/15") - 5618 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-using-offset/16") - 5619 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-using-offset/17") - 5620 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-using-offset/18") - 5621 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-using-offset/19") - 5622 # . epilogue - 5623 89/<- %esp 5/r32/ebp - 5624 5d/pop-to-ebp - 5625 c3/return - 5626 - 5627 test-convert-index-into-array-using-offset-on-stack: - 5628 # . prologue - 5629 55/push-ebp - 5630 89/<- %ebp 4/r32/esp - 5631 # setup - 5632 (clear-stream _test-input-stream) - 5633 (clear-stream $_test-input-buffered-file->buffer) - 5634 (clear-stream _test-output-stream) - 5635 (clear-stream $_test-output-buffered-file->buffer) - 5636 # - 5637 (write _test-input-stream "fn foo {\n") - 5638 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") - 5639 (write _test-input-stream " var idx: int\n") - 5640 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") - 5641 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") - 5642 (write _test-input-stream "}\n") - 5643 # convert - 5644 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5645 (flush _test-output-buffered-file) - 5646 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5652 # check output - 5653 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset-on-stack/0") - 5654 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset-on-stack/1") - 5655 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset-on-stack/2") - 5656 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset-on-stack/3") - 5657 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset-on-stack/4") - 5658 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset-on-stack/5") - 5659 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset-on-stack/6") - 5660 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-using-offset-on-stack/7") - 5661 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-index-into-array-using-offset-on-stack/8") - 5662 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset-on-stack/9") - 5663 (check-next-stream-line-equal _test-output-stream " 69/multiply *(ebp+0xfffffff8) 0x00000004/imm32 0x00000001/r32" "F - test-convert-index-into-array-using-offset-on-stack/10") - 5664 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-using-offset-on-stack/11") - 5665 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset-on-stack/12") - 5666 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-index-into-array-using-offset-on-stack/13") - 5667 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset-on-stack/14") - 5668 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset-on-stack/15") - 5669 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset-on-stack/16") - 5670 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset-on-stack/17") - 5671 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset-on-stack/18") - 5672 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset-on-stack/19") - 5673 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset-on-stack/20") - 5674 # . epilogue - 5675 89/<- %esp 5/r32/ebp - 5676 5d/pop-to-ebp - 5677 c3/return - 5678 - 5679 test-convert-index-into-array-of-bytes-using-offset-on-stack: - 5680 # . prologue - 5681 55/push-ebp - 5682 89/<- %ebp 4/r32/esp - 5683 # setup - 5684 (clear-stream _test-input-stream) - 5685 (clear-stream $_test-input-buffered-file->buffer) - 5686 (clear-stream _test-output-stream) - 5687 (clear-stream $_test-output-buffered-file->buffer) - 5688 # - 5689 (write _test-input-stream "fn foo {\n") - 5690 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") - 5691 (write _test-input-stream " var idx: int\n") - 5692 (write _test-input-stream " var off/ecx: (offset byte) <- compute-offset arr, idx\n") - 5693 (write _test-input-stream " var x/eax: (addr byte) <- index arr, off\n") - 5694 (write _test-input-stream "}\n") - 5695 # convert - 5696 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5697 (flush _test-output-buffered-file) - 5698 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5704 # check output - 5705 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/0") - 5706 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/1") - 5707 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/2") - 5708 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/3") - 5709 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/4") - 5710 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/5") - 5711 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/6") - 5712 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/7") - 5713 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/8") - 5714 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/9") - 5715 (check-next-stream-line-equal _test-output-stream " 69/multiply *(ebp+0xfffffff8) 0x00000001/imm32 0x00000001/r32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/10") - 5716 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/11") - 5717 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/12") - 5718 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/13") - 5719 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/14") - 5720 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/15") - 5721 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/16") - 5722 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/17") - 5723 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/18") - 5724 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/19") - 5725 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/20") - 5726 # . epilogue - 5727 89/<- %esp 5/r32/ebp - 5728 5d/pop-to-ebp - 5729 c3/return - 5730 - 5731 test-convert-function-and-type-definition: - 5732 # . prologue - 5733 55/push-ebp - 5734 89/<- %ebp 4/r32/esp - 5735 # setup - 5736 (clear-stream _test-input-stream) - 5737 (clear-stream $_test-input-buffered-file->buffer) - 5738 (clear-stream _test-output-stream) - 5739 (clear-stream $_test-output-buffered-file->buffer) + 4552 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4553 (flush _test-output-buffered-file) + 4554 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4560 # check output + 4561 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/0") + 4562 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/1") + 4563 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/2") + 4564 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/3") + 4565 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/4") + 4566 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/5") + 4567 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/6") + 4568 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/7") + 4569 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/8") + 4570 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/9") + 4571 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/10") + 4572 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/11") + 4573 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/12") + 4574 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/13") + 4575 (check-next-stream-line-equal _test-output-stream " e9/jump a:break/disp32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/14") + 4576 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/15") + 4577 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/16") + 4578 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/17") + 4579 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/18") + 4580 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/19") + 4581 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/20") + 4582 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/21") + 4583 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/22") + 4584 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/23") + 4585 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/24") + 4586 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-break-and-local-vars/25") + 4587 # . epilogue + 4588 89/<- %esp 5/r32/ebp + 4589 5d/pop-to-ebp + 4590 c3/return + 4591 + 4592 test-convert-function-with-unconditional-break-and-local-vars: + 4593 # . prologue + 4594 55/push-ebp + 4595 89/<- %ebp 4/r32/esp + 4596 # setup + 4597 (clear-stream _test-input-stream) + 4598 (clear-stream $_test-input-buffered-file->buffer) + 4599 (clear-stream _test-output-stream) + 4600 (clear-stream $_test-output-buffered-file->buffer) + 4601 # + 4602 (write _test-input-stream "fn foo {\n") + 4603 (write _test-input-stream " {\n") + 4604 (write _test-input-stream " var x: int\n") + 4605 (write _test-input-stream " {\n") + 4606 (write _test-input-stream " var y: int\n") + 4607 (write _test-input-stream " break\n") + 4608 (write _test-input-stream " increment x\n") + 4609 (write _test-input-stream " }\n") + 4610 (write _test-input-stream " }\n") + 4611 (write _test-input-stream "}\n") + 4612 # convert + 4613 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4614 (flush _test-output-buffered-file) + 4615 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4621 # check output + 4622 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-unconditional-break-and-local-vars/0") + 4623 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-unconditional-break-and-local-vars/1") + 4624 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/2") + 4625 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-unconditional-break-and-local-vars/3") + 4626 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/4") + 4627 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/5") + 4628 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/6") + 4629 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/7") + 4630 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/8") + 4631 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-unconditional-break-and-local-vars/9") + 4632 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-unconditional-break-and-local-vars/10") + 4633 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/11") + 4634 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/12") + 4635 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/13") + 4636 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/14") + 4637 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-unconditional-break-and-local-vars/15") + 4638 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/16") + 4639 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/17") + 4640 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-unconditional-break-and-local-vars/18") + 4641 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-unconditional-break-and-local-vars/19") + 4642 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-unconditional-break-and-local-vars/20") + 4643 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/21") + 4644 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-unconditional-break-and-local-vars/22") + 4645 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-unconditional-break-and-local-vars/23") + 4646 # . epilogue + 4647 89/<- %esp 5/r32/ebp + 4648 5d/pop-to-ebp + 4649 c3/return + 4650 + 4651 test-convert-function-with-nonlocal-unconditional-loop-and-local-vars: + 4652 # . prologue + 4653 55/push-ebp + 4654 89/<- %ebp 4/r32/esp + 4655 # setup + 4656 (clear-stream _test-input-stream) + 4657 (clear-stream $_test-input-buffered-file->buffer) + 4658 (clear-stream _test-output-stream) + 4659 (clear-stream $_test-output-buffered-file->buffer) + 4660 # + 4661 (write _test-input-stream "fn foo {\n") + 4662 (write _test-input-stream " a: {\n") + 4663 (write _test-input-stream " var x: int\n") + 4664 (write _test-input-stream " {\n") + 4665 (write _test-input-stream " var y: int\n") + 4666 (write _test-input-stream " loop a\n") + 4667 (write _test-input-stream " increment x\n") + 4668 (write _test-input-stream " }\n") + 4669 (write _test-input-stream " }\n") + 4670 (write _test-input-stream "}\n") + 4671 # convert + 4672 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4673 (flush _test-output-buffered-file) + 4674 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4680 # check output + 4681 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/0") + 4682 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/1") + 4683 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/2") + 4684 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/3") + 4685 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/4") + 4686 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/5") + 4687 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/6") + 4688 (check-next-stream-line-equal _test-output-stream "a:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/7") + 4689 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/8") + 4690 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/9") + 4691 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/10") + 4692 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/11") + 4693 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/12") + 4694 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/13") + 4695 (check-next-stream-line-equal _test-output-stream " e9/jump a:loop/disp32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/14") + 4696 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/15") + 4697 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/16") + 4698 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/17") + 4699 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/18") + 4700 (check-next-stream-line-equal _test-output-stream "a:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/19") + 4701 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/20") + 4702 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/21") + 4703 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/22") + 4704 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/23") + 4705 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/24") + 4706 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-nonlocal-unconditional-loop-and-local-vars/25") + 4707 # . epilogue + 4708 89/<- %esp 5/r32/ebp + 4709 5d/pop-to-ebp + 4710 c3/return + 4711 + 4712 test-convert-function-with-local-array-var-in-mem: + 4713 # . prologue + 4714 55/push-ebp + 4715 89/<- %ebp 4/r32/esp + 4716 # setup + 4717 (clear-stream _test-input-stream) + 4718 (clear-stream $_test-input-buffered-file->buffer) + 4719 (clear-stream _test-output-stream) + 4720 (clear-stream $_test-output-buffered-file->buffer) + 4721 # + 4722 (write _test-input-stream "fn foo {\n") + 4723 (write _test-input-stream " var x: (array int 3)\n") + 4724 (write _test-input-stream "}\n") + 4725 # convert + 4726 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4727 (flush _test-output-buffered-file) + 4728 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4734 # check output + 4735 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-var-in-mem/0") + 4736 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-var-in-mem/1") + 4737 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-var-in-mem/2") + 4738 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-array-var-in-mem/3") + 4739 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-var-in-mem/4") + 4740 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-var-in-mem/5") + 4741 # define x + 4742 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-function-with-local-array-var-in-mem/7") + 4743 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-function-with-local-array-var-in-mem/8") + 4744 # reclaim x + 4745 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-function-with-local-array-var-in-mem/9") + 4746 # + 4747 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-var-in-mem/10") + 4748 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-var-in-mem/11") + 4749 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-var-in-mem/12") + 4750 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-array-var-in-mem/13") + 4751 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-var-in-mem/14") + 4752 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-var-in-mem/15") + 4753 # . epilogue + 4754 89/<- %esp 5/r32/ebp + 4755 5d/pop-to-ebp + 4756 c3/return + 4757 + 4758 test-array-size-in-hex: + 4759 # . prologue + 4760 55/push-ebp + 4761 89/<- %ebp 4/r32/esp + 4762 # setup + 4763 (clear-stream _test-input-stream) + 4764 (clear-stream $_test-input-buffered-file->buffer) + 4765 (clear-stream _test-output-stream) + 4766 (clear-stream $_test-output-buffered-file->buffer) + 4767 (clear-stream _test-error-stream) + 4768 (clear-stream $_test-error-buffered-file->buffer) + 4769 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 4770 68/push 0/imm32 + 4771 68/push 0/imm32 + 4772 89/<- %edx 4/r32/esp + 4773 (tailor-exit-descriptor %edx 0x10) + 4774 # + 4775 (write _test-input-stream "fn foo {\n") + 4776 (write _test-input-stream " var x: (array int 10)\n") + 4777 (write _test-input-stream "}\n") + 4778 # convert + 4779 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 4780 # registers except esp clobbered at this point + 4781 # restore ed + 4782 89/<- %edx 4/r32/esp + 4783 (flush _test-output-buffered-file) + 4784 (flush _test-error-buffered-file) + 4785 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4791 # check output + 4792 (check-stream-equal _test-output-stream "" "F - test-array-size-in-hex: output should be empty") + 4793 (check-next-stream-line-equal _test-error-stream "literal integers are always hex in Mu; start '10' with a '0x' to be unambiguous, converting it to hexadecimal as necessary." "F - test-array-size-in-hex: error message") + 4794 # check that stop(1) was called + 4795 (check-ints-equal *(edx+4) 2 "F - test-array-size-in-hex: exit status") + 4796 # don't restore from ebp + 4797 81 0/subop/add %esp 8/imm32 + 4798 # . epilogue + 4799 5d/pop-to-ebp + 4800 c3/return + 4801 + 4802 test-convert-function-with-populate: + 4803 # . prologue + 4804 55/push-ebp + 4805 89/<- %ebp 4/r32/esp + 4806 # setup + 4807 (clear-stream _test-input-stream) + 4808 (clear-stream $_test-input-buffered-file->buffer) + 4809 (clear-stream _test-output-stream) + 4810 (clear-stream $_test-output-buffered-file->buffer) + 4811 # + 4812 (write _test-input-stream "fn foo {\n") + 4813 (write _test-input-stream " var x/ecx: (addr handle array int) <- copy 0\n") + 4814 (write _test-input-stream " populate x, 7\n") + 4815 (write _test-input-stream "}\n") + 4816 # convert + 4817 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4818 (flush _test-output-buffered-file) + 4819 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4825 # check output + 4826 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-populate/0") + 4827 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-populate/1") + 4828 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-populate/2") + 4829 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-populate/3") + 4830 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-populate/4") + 4831 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-populate/5") + 4832 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-populate/6") + 4833 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-function-with-populate/7") + 4834 (check-next-stream-line-equal _test-output-stream " (allocate-array2 Heap 0x00000004 7 %ecx)" "F - test-convert-function-with-populate/8") # 4 = size-of(int) + 4835 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-populate/9") + 4836 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-populate/10") + 4837 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-populate/11") + 4838 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-populate/12") + 4839 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-populate/13") + 4840 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-populate/14") + 4841 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-populate/15") + 4842 # . epilogue + 4843 89/<- %esp 5/r32/ebp + 4844 5d/pop-to-ebp + 4845 c3/return + 4846 + 4847 # special-case for size(byte) when allocating array + 4848 test-convert-function-with-local-array-of-bytes-in-mem: + 4849 # . prologue + 4850 55/push-ebp + 4851 89/<- %ebp 4/r32/esp + 4852 # setup + 4853 (clear-stream _test-input-stream) + 4854 (clear-stream $_test-input-buffered-file->buffer) + 4855 (clear-stream _test-output-stream) + 4856 (clear-stream $_test-output-buffered-file->buffer) + 4857 # + 4858 (write _test-input-stream "fn foo {\n") + 4859 (write _test-input-stream " var x: (array byte 3)\n") + 4860 (write _test-input-stream "}\n") + 4861 # convert + 4862 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4863 (flush _test-output-buffered-file) + 4864 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4870 # check output + 4871 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-array-of-bytes-in-mem/0") + 4872 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-array-of-bytes-in-mem/1") + 4873 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/2") + 4874 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-array-of-bytes-in-mem/3") + 4875 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-array-of-bytes-in-mem/4") + 4876 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-array-of-bytes-in-mem/5") + 4877 # define x + 4878 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x00000003)" "F - test-convert-function-with-local-array-of-bytes-in-mem/7") + 4879 (check-next-stream-line-equal _test-output-stream " 68/push 0x00000003/imm32" "F - test-convert-function-with-local-array-of-bytes-in-mem/8") + 4880 # reclaim x + 4881 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000007/imm32" "F - test-convert-function-with-local-array-of-bytes-in-mem/9") + 4882 # + 4883 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-array-of-bytes-in-mem/10") + 4884 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-array-of-bytes-in-mem/11") + 4885 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-array-of-bytes-in-mem/12") + 4886 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/13") + 4887 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-array-of-bytes-in-mem/14") + 4888 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-array-of-bytes-in-mem/15") + 4889 # . epilogue + 4890 89/<- %esp 5/r32/ebp + 4891 5d/pop-to-ebp + 4892 c3/return + 4893 + 4894 test-convert-address: + 4895 # . prologue + 4896 55/push-ebp + 4897 89/<- %ebp 4/r32/esp + 4898 # setup + 4899 (clear-stream _test-input-stream) + 4900 (clear-stream $_test-input-buffered-file->buffer) + 4901 (clear-stream _test-output-stream) + 4902 (clear-stream $_test-output-buffered-file->buffer) + 4903 # + 4904 (write _test-input-stream "fn foo {\n") + 4905 (write _test-input-stream " var a: int\n") + 4906 (write _test-input-stream " var b/eax: (addr int) <- address a\n") + 4907 (write _test-input-stream "}\n") + 4908 # convert + 4909 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4910 (flush _test-output-buffered-file) + 4911 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4917 # check output + 4918 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-address/0") + 4919 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-address/1") + 4920 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-address/2") + 4921 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-address/3") + 4922 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-address/4") + 4923 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-address/5") + 4924 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-address/6") + 4925 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-address/7") + 4926 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000000/r32" "F - test-convert-address/8") + 4927 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-address/9") + 4928 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-address/10") + 4929 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-address/11") + 4930 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-address/12") + 4931 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-address/13") + 4932 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-address/14") + 4933 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-address/15") + 4934 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-address/16") + 4935 # . epilogue + 4936 89/<- %esp 5/r32/ebp + 4937 5d/pop-to-ebp + 4938 c3/return + 4939 + 4940 test-convert-floating-point-convert: + 4941 # . prologue + 4942 55/push-ebp + 4943 89/<- %ebp 4/r32/esp + 4944 # setup + 4945 (clear-stream _test-input-stream) + 4946 (clear-stream $_test-input-buffered-file->buffer) + 4947 (clear-stream _test-output-stream) + 4948 (clear-stream $_test-output-buffered-file->buffer) + 4949 # + 4950 (write _test-input-stream "fn foo {\n") + 4951 (write _test-input-stream " var a/eax: int <- copy 0\n") + 4952 (write _test-input-stream " var b/xmm1: float <- convert a\n") + 4953 (write _test-input-stream "}\n") + 4954 # convert + 4955 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 4956 (flush _test-output-buffered-file) + 4957 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 4963 # check output + 4964 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-floating-point-convert/0") + 4965 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-convert/1") + 4966 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-convert/2") + 4967 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-convert/3") + 4968 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-convert/4") + 4969 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-floating-point-convert/5") + 4970 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-floating-point-convert/6") + 4971 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-floating-point-convert/7") + 4972 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-convert/8") + 4973 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-convert/9") + 4974 (check-next-stream-line-equal _test-output-stream " f3 0f 2a/convert-to-float %eax 0x00000001/x32" "F - test-convert-floating-point-convert/10") + 4975 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-convert/11") + 4976 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-floating-point-convert/12") + 4977 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-floating-point-convert/13") + 4978 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-convert/14") + 4979 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-floating-point-convert/15") + 4980 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-convert/16") + 4981 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-convert/17") + 4982 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-convert/18") + 4983 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-convert/19") + 4984 # . epilogue + 4985 89/<- %esp 5/r32/ebp + 4986 5d/pop-to-ebp + 4987 c3/return + 4988 + 4989 test-convert-floating-point-convert-2: + 4990 # . prologue + 4991 55/push-ebp + 4992 89/<- %ebp 4/r32/esp + 4993 # setup + 4994 (clear-stream _test-input-stream) + 4995 (clear-stream $_test-input-buffered-file->buffer) + 4996 (clear-stream _test-output-stream) + 4997 (clear-stream $_test-output-buffered-file->buffer) + 4998 # + 4999 (write _test-input-stream "fn foo {\n") + 5000 (write _test-input-stream " var a/eax: int <- copy 0\n") + 5001 (write _test-input-stream " var b/xmm1: float <- convert a\n") + 5002 (write _test-input-stream " a <- convert b\n") + 5003 (write _test-input-stream "}\n") + 5004 # convert + 5005 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5006 (flush _test-output-buffered-file) + 5007 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5013 # check output + 5014 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-floating-point-convert-2/0") + 5015 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-convert-2/1") + 5016 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-convert-2/2") + 5017 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-convert-2/3") + 5018 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-convert-2/4") + 5019 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-floating-point-convert-2/5") + 5020 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-floating-point-convert-2/6") + 5021 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-floating-point-convert-2/7") + 5022 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-convert-2/8") + 5023 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-convert-2/9") + 5024 (check-next-stream-line-equal _test-output-stream " f3 0f 2a/convert-to-float %eax 0x00000001/x32" "F - test-convert-floating-point-convert-2/10") + 5025 (check-next-stream-line-equal _test-output-stream " f3 0f 2d/convert-to-int %xmm1 0x00000000/r32" "F - test-convert-floating-point-convert-2/11") + 5026 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-convert-2/12") + 5027 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-floating-point-convert-2/13") + 5028 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-floating-point-convert-2/14") + 5029 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-convert-2/15") + 5030 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-floating-point-convert-2/16") + 5031 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-convert-2/17") + 5032 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-convert-2/18") + 5033 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-convert-2/19") + 5034 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-convert-2/20") + 5035 # . epilogue + 5036 89/<- %esp 5/r32/ebp + 5037 5d/pop-to-ebp + 5038 c3/return + 5039 + 5040 test-convert-floating-point-operation: + 5041 # . prologue + 5042 55/push-ebp + 5043 89/<- %ebp 4/r32/esp + 5044 # setup + 5045 (clear-stream _test-input-stream) + 5046 (clear-stream $_test-input-buffered-file->buffer) + 5047 (clear-stream _test-output-stream) + 5048 (clear-stream $_test-output-buffered-file->buffer) + 5049 # + 5050 (write _test-input-stream "fn f {\n") + 5051 (write _test-input-stream " var m: float\n") + 5052 (write _test-input-stream " var x/xmm1: float <- copy m\n") + 5053 (write _test-input-stream " var y/xmm5: float <- copy m\n") + 5054 (write _test-input-stream " x <- copy y\n") + 5055 (write _test-input-stream " copy-to m, y\n") + 5056 (write _test-input-stream " x <- add y\n") + 5057 (write _test-input-stream " x <- add m\n") + 5058 (write _test-input-stream " x <- subtract y\n") + 5059 (write _test-input-stream " x <- subtract m\n") + 5060 (write _test-input-stream " x <- multiply y\n") + 5061 (write _test-input-stream " x <- multiply m\n") + 5062 (write _test-input-stream " x <- divide y\n") + 5063 (write _test-input-stream " x <- divide m\n") + 5064 (write _test-input-stream " x <- reciprocal y\n") + 5065 (write _test-input-stream " x <- reciprocal m\n") + 5066 (write _test-input-stream " x <- square-root y\n") + 5067 (write _test-input-stream " x <- square-root m\n") + 5068 (write _test-input-stream " x <- inverse-square-root y\n") + 5069 (write _test-input-stream " x <- inverse-square-root m\n") + 5070 (write _test-input-stream " x <- max y\n") + 5071 (write _test-input-stream " x <- max m\n") + 5072 (write _test-input-stream " x <- min y\n") + 5073 (write _test-input-stream " x <- min m\n") + 5074 (write _test-input-stream " compare x, y\n") + 5075 (write _test-input-stream " compare x, m\n") + 5076 (write _test-input-stream "}\n") + 5077 # convert + 5078 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5079 (flush _test-output-buffered-file) + 5080 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5086 # check output + 5087 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-floating-point-operation/0") + 5088 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-operation/1") + 5089 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-operation/2") + 5090 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-operation/3") + 5091 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-operation/4") + 5092 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-floating-point-operation/5") + 5093 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-floating-point-operation/6") + 5094 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-operation/7") + 5095 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-operation/8") + 5096 (check-next-stream-line-equal _test-output-stream " f3 0f 10/copy *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/9") + 5097 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-operation/10") + 5098 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 5/x32" "F - test-convert-floating-point-operation/11") + 5099 (check-next-stream-line-equal _test-output-stream " f3 0f 10/copy *(ebp+0xfffffffc) 0x00000005/x32" "F - test-convert-floating-point-operation/12") + 5100 (check-next-stream-line-equal _test-output-stream " f3 0f 11/copy %xmm1 0x00000005/x32" "F - test-convert-floating-point-operation/13") + 5101 (check-next-stream-line-equal _test-output-stream " f3 0f 11/copy *(ebp+0xfffffffc) 0x00000005/x32" "F - test-convert-floating-point-operation/14") + 5102 (check-next-stream-line-equal _test-output-stream " f3 0f 58/add %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/15") + 5103 (check-next-stream-line-equal _test-output-stream " f3 0f 58/add *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/16") + 5104 (check-next-stream-line-equal _test-output-stream " f3 0f 5c/subtract %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/17") + 5105 (check-next-stream-line-equal _test-output-stream " f3 0f 5c/subtract *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/18") + 5106 (check-next-stream-line-equal _test-output-stream " f3 0f 59/multiply %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/19") + 5107 (check-next-stream-line-equal _test-output-stream " f3 0f 59/multiply *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/20") + 5108 (check-next-stream-line-equal _test-output-stream " f3 0f 5e/divide %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/21") + 5109 (check-next-stream-line-equal _test-output-stream " f3 0f 5e/divide *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/22") + 5110 (check-next-stream-line-equal _test-output-stream " f3 0f 53/reciprocal %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/23") + 5111 (check-next-stream-line-equal _test-output-stream " f3 0f 53/reciprocal *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/24") + 5112 (check-next-stream-line-equal _test-output-stream " f3 0f 51/square-root %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/25") + 5113 (check-next-stream-line-equal _test-output-stream " f3 0f 51/square-root *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/26") + 5114 (check-next-stream-line-equal _test-output-stream " f3 0f 52/inverse-square-root %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/27") + 5115 (check-next-stream-line-equal _test-output-stream " f3 0f 52/inverse-square-root *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/28") + 5116 (check-next-stream-line-equal _test-output-stream " f3 0f 5f/max %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/29") + 5117 (check-next-stream-line-equal _test-output-stream " f3 0f 5f/max *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/30") + 5118 (check-next-stream-line-equal _test-output-stream " f3 0f 5d/min %xmm5 0x00000001/x32" "F - test-convert-floating-point-operation/31") + 5119 (check-next-stream-line-equal _test-output-stream " f3 0f 5d/min *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/32") + 5120 (check-next-stream-line-equal _test-output-stream " 0f 2f/compare %xmm1 0x00000005/x32" "F - test-convert-floating-point-operation/33") + 5121 (check-next-stream-line-equal _test-output-stream " 0f 2f/compare *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-operation/34") + 5122 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 5/x32" "F - test-convert-floating-point-operation/35") + 5123 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-operation/36") + 5124 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-operation/37") + 5125 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-operation/38") + 5126 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-floating-point-operation/39") + 5127 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-operation/40") + 5128 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-floating-point-operation/41") + 5129 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-operation/42") + 5130 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-operation/43") + 5131 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-operation/44") + 5132 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-operation/45") + 5133 # . epilogue + 5134 89/<- %esp 5/r32/ebp + 5135 5d/pop-to-ebp + 5136 c3/return + 5137 + 5138 test-convert-floating-point-dereferenced: + 5139 # . prologue + 5140 55/push-ebp + 5141 89/<- %ebp 4/r32/esp + 5142 # setup + 5143 (clear-stream _test-input-stream) + 5144 (clear-stream $_test-input-buffered-file->buffer) + 5145 (clear-stream _test-output-stream) + 5146 (clear-stream $_test-output-buffered-file->buffer) + 5147 # + 5148 (write _test-input-stream "fn f {\n") + 5149 (write _test-input-stream " var m: float\n") + 5150 (write _test-input-stream " var x/xmm1: float <- copy m\n") + 5151 (write _test-input-stream " var y/eax: (addr float) <- copy 0\n") + 5152 (write _test-input-stream " x <- multiply *y\n") + 5153 (write _test-input-stream "}\n") + 5154 # convert + 5155 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5156 (flush _test-output-buffered-file) + 5157 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5163 # check output + 5164 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-floating-point-dereferenced/0") + 5165 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-floating-point-dereferenced/1") + 5166 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-floating-point-dereferenced/2") + 5167 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-floating-point-dereferenced/3") + 5168 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-floating-point-dereferenced/4") + 5169 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-floating-point-dereferenced/5") + 5170 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-floating-point-dereferenced/6") + 5171 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-floating-point-dereferenced/7") + 5172 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-floating-point-dereferenced/8") + 5173 (check-next-stream-line-equal _test-output-stream " f3 0f 10/copy *(ebp+0xfffffffc) 0x00000001/x32" "F - test-convert-floating-point-dereferenced/9") + 5174 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-floating-point-dereferenced/10") + 5175 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-floating-point-dereferenced/11") + 5176 (check-next-stream-line-equal _test-output-stream " f3 0f 59/multiply *eax 0x00000001/x32" "F - test-convert-floating-point-dereferenced/12") + 5177 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-floating-point-dereferenced/13") + 5178 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 1/x32" "F - test-convert-floating-point-dereferenced/14") + 5179 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-dereferenced/15") + 5180 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-floating-point-dereferenced/16") + 5181 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-floating-point-dereferenced/17") + 5182 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-floating-point-dereferenced/18") + 5183 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-floating-point-dereferenced/19") + 5184 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-floating-point-dereferenced/20") + 5185 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-floating-point-dereferenced/21") + 5186 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-floating-point-dereferenced/22") + 5187 # . epilogue + 5188 89/<- %esp 5/r32/ebp + 5189 5d/pop-to-ebp + 5190 c3/return + 5191 + 5192 test-convert-length-of-array: + 5193 # . prologue + 5194 55/push-ebp + 5195 89/<- %ebp 4/r32/esp + 5196 # setup + 5197 (clear-stream _test-input-stream) + 5198 (clear-stream $_test-input-buffered-file->buffer) + 5199 (clear-stream _test-output-stream) + 5200 (clear-stream $_test-output-buffered-file->buffer) + 5201 # + 5202 (write _test-input-stream "fn foo a: (addr array int) {\n") + 5203 (write _test-input-stream " var b/eax: (addr array int) <- copy a\n") + 5204 (write _test-input-stream " var c/eax: int <- length b\n") + 5205 (write _test-input-stream "}\n") + 5206 # convert + 5207 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5208 (flush _test-output-buffered-file) + 5209 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5215 # check output + 5216 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array/0") + 5217 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array/1") + 5218 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array/2") + 5219 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array/3") + 5220 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array/4") + 5221 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array/5") + 5222 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array/6") + 5223 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array/7") + 5224 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array/8") + 5225 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array/9") + 5226 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array/10") + 5227 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array/11") + 5228 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array/12") + 5229 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array/13") + 5230 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array/14") + 5231 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array/15") + 5232 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array/16") + 5233 # . epilogue + 5234 89/<- %esp 5/r32/ebp + 5235 5d/pop-to-ebp + 5236 c3/return + 5237 + 5238 # special-case for size(byte) when computing array length + 5239 test-convert-length-of-array-of-bytes: + 5240 # . prologue + 5241 55/push-ebp + 5242 89/<- %ebp 4/r32/esp + 5243 # setup + 5244 (clear-stream _test-input-stream) + 5245 (clear-stream $_test-input-buffered-file->buffer) + 5246 (clear-stream _test-output-stream) + 5247 (clear-stream $_test-output-buffered-file->buffer) + 5248 # + 5249 (write _test-input-stream "fn foo a: (addr array byte) {\n") + 5250 (write _test-input-stream " var b/eax: (addr array byte) <- copy a\n") + 5251 (write _test-input-stream " var c/eax: int <- length b\n") + 5252 (write _test-input-stream "}\n") + 5253 # convert + 5254 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5255 (flush _test-output-buffered-file) + 5256 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5262 # check output + 5263 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-bytes/0") + 5264 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-bytes/1") + 5265 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-bytes/2") + 5266 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-bytes/3") + 5267 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-bytes/4") + 5268 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-bytes/5") + 5269 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-bytes/6") + 5270 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-length-of-array-of-bytes/7") + 5271 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-bytes/8") + 5272 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-bytes/9") + 5273 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-bytes/10") + 5274 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-bytes/11") + 5275 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-bytes/12") + 5276 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-bytes/13") + 5277 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-bytes/14") + 5278 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-bytes/15") + 5279 # . epilogue + 5280 89/<- %esp 5/r32/ebp + 5281 5d/pop-to-ebp + 5282 c3/return + 5283 + 5284 test-convert-length-of-array-on-stack: + 5285 # . prologue + 5286 55/push-ebp + 5287 89/<- %ebp 4/r32/esp + 5288 # setup + 5289 (clear-stream _test-input-stream) + 5290 (clear-stream $_test-input-buffered-file->buffer) + 5291 (clear-stream _test-output-stream) + 5292 (clear-stream $_test-output-buffered-file->buffer) + 5293 # + 5294 (write _test-input-stream "fn foo {\n") + 5295 (write _test-input-stream " var a: (array int 3)\n") + 5296 (write _test-input-stream " var b/eax: int <- length a\n") + 5297 (write _test-input-stream "}\n") + 5298 # convert + 5299 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5300 (flush _test-output-buffered-file) + 5301 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5307 # check output + 5308 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-on-stack/0") + 5309 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-on-stack/1") + 5310 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-on-stack/2") + 5311 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-on-stack/3") + 5312 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-on-stack/4") + 5313 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-on-stack/5") + 5314 # define x + 5315 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-length-of-array-on-stack/6") + 5316 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-length-of-array-on-stack/7") + 5317 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-on-stack/8") + 5318 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0xfffffff0) 0x00000000/r32" "F - test-convert-length-of-array-on-stack/9") + 5319 (check-next-stream-line-equal _test-output-stream " c1/shift 5/subop/>> %eax 0x00000002/imm8" "F - test-convert-length-of-array-on-stack/10") + 5320 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-on-stack/11") + 5321 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-length-of-array-on-stack/12") + 5322 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-on-stack/13") + 5323 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-on-stack/14") + 5324 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-on-stack/15") + 5325 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-on-stack/16") + 5326 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-on-stack/17") + 5327 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-on-stack/18") + 5328 # . epilogue + 5329 89/<- %esp 5/r32/ebp + 5330 5d/pop-to-ebp + 5331 c3/return + 5332 + 5333 test-reg-var-def-with-read-of-same-register: + 5334 # . prologue + 5335 55/push-ebp + 5336 89/<- %ebp 4/r32/esp + 5337 # setup + 5338 (clear-stream _test-input-stream) + 5339 (clear-stream $_test-input-buffered-file->buffer) + 5340 (clear-stream _test-output-stream) + 5341 (clear-stream $_test-output-buffered-file->buffer) + 5342 (clear-stream _test-error-stream) + 5343 (clear-stream $_test-error-buffered-file->buffer) + 5344 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) # bytes of args in call to convert-mu + 5345 68/push 0/imm32 + 5346 68/push 0/imm32 + 5347 89/<- %edx 4/r32/esp + 5348 (tailor-exit-descriptor %edx 0x10) + 5349 # + 5350 (write _test-input-stream "fn foo {\n") + 5351 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 5352 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 5353 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") + 5354 (write _test-input-stream "}\n") + 5355 # convert + 5356 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 5357 # registers except esp could be clobbered at this point (though they shouldn't be) + 5358 # restore ed + 5359 89/<- %edx 4/r32/esp + 5360 (flush _test-output-buffered-file) + 5361 (flush _test-error-buffered-file) + 5362 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5368 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5374 (check-stream-equal _test-error-stream "" "F - test-reg-var-def-with-read-of-same-register: error stream should be empty") + 5375 # check output + 5376 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-reg-var-def-with-read-of-same-register/0") + 5377 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-reg-var-def-with-read-of-same-register/1") + 5378 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-reg-var-def-with-read-of-same-register/2") + 5379 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-reg-var-def-with-read-of-same-register/3") + 5380 (check-next-stream-line-equal _test-output-stream " {" "F - test-reg-var-def-with-read-of-same-register/4") + 5381 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-reg-var-def-with-read-of-same-register/5") + 5382 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-reg-var-def-with-read-of-same-register/6") + 5383 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-reg-var-def-with-read-of-same-register/7") + 5384 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-reg-var-def-with-read-of-same-register/8") + 5385 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-reg-var-def-with-read-of-same-register/9") + 5386 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000002 + 4) 0x00000000/r32" "F - test-reg-var-def-with-read-of-same-register/11") + 5387 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-reg-var-def-with-read-of-same-register/13") + 5388 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-reg-var-def-with-read-of-same-register/14") + 5389 (check-next-stream-line-equal _test-output-stream " }" "F - test-reg-var-def-with-read-of-same-register/15") + 5390 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-reg-var-def-with-read-of-same-register/16") + 5391 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-reg-var-def-with-read-of-same-register/17") + 5392 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-reg-var-def-with-read-of-same-register/18") + 5393 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-reg-var-def-with-read-of-same-register/19") + 5394 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-reg-var-def-with-read-of-same-register/20") + 5395 # don't restore from ebp + 5396 81 0/subop/add %esp 8/imm32 + 5397 # . epilogue + 5398 5d/pop-to-ebp + 5399 c3/return + 5400 + 5401 test-convert-index-into-array: + 5402 # . prologue + 5403 55/push-ebp + 5404 89/<- %ebp 4/r32/esp + 5405 # setup + 5406 (clear-stream _test-input-stream) + 5407 (clear-stream $_test-input-buffered-file->buffer) + 5408 (clear-stream _test-output-stream) + 5409 (clear-stream $_test-output-buffered-file->buffer) + 5410 # + 5411 (write _test-input-stream "fn foo {\n") + 5412 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 5413 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 5414 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") + 5415 (write _test-input-stream "}\n") + 5416 # convert + 5417 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5418 (flush _test-output-buffered-file) + 5419 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5425 # check output + 5426 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array/0") + 5427 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array/1") + 5428 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array/2") + 5429 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array/3") + 5430 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array/4") + 5431 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array/5") + 5432 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array/6") + 5433 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array/7") + 5434 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array/8") + 5435 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array/9") + 5436 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000002 + 4) 0x00000000/r32" "F - test-convert-index-into-array/10") + 5437 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array/11") + 5438 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array/12") + 5439 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array/13") + 5440 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array/14") + 5441 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array/15") + 5442 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array/16") + 5443 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array/17") + 5444 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array/18") + 5445 # . epilogue + 5446 89/<- %esp 5/r32/ebp + 5447 5d/pop-to-ebp + 5448 c3/return + 5449 + 5450 test-convert-index-into-array-of-bytes: + 5451 # . prologue + 5452 55/push-ebp + 5453 89/<- %ebp 4/r32/esp + 5454 # setup + 5455 (clear-stream _test-input-stream) + 5456 (clear-stream $_test-input-buffered-file->buffer) + 5457 (clear-stream _test-output-stream) + 5458 (clear-stream $_test-output-buffered-file->buffer) + 5459 # + 5460 (write _test-input-stream "fn foo {\n") + 5461 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") + 5462 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 5463 (write _test-input-stream " var x/eax: (addr byte) <- index arr, idx\n") + 5464 (write _test-input-stream "}\n") + 5465 # convert + 5466 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5467 (flush _test-output-buffered-file) + 5468 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5474 # check output + 5475 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes/0") + 5476 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes/1") + 5477 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes/2") + 5478 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes/3") + 5479 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes/4") + 5480 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes/5") + 5481 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes/6") + 5482 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes/7") + 5483 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes/8") + 5484 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-of-bytes/9") + 5485 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000000 + 4) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes/11") + 5486 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes/13") + 5487 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes/14") + 5488 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes/15") + 5489 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes/16") + 5490 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes/17") + 5491 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes/18") + 5492 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes/19") + 5493 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes/20") + 5494 # . epilogue + 5495 89/<- %esp 5/r32/ebp + 5496 5d/pop-to-ebp + 5497 c3/return + 5498 + 5499 test-convert-index-into-array-with-literal: + 5500 # . prologue + 5501 55/push-ebp + 5502 89/<- %ebp 4/r32/esp + 5503 # setup + 5504 (clear-stream _test-input-stream) + 5505 (clear-stream $_test-input-buffered-file->buffer) + 5506 (clear-stream _test-output-stream) + 5507 (clear-stream $_test-output-buffered-file->buffer) + 5508 # + 5509 (write _test-input-stream "fn foo {\n") + 5510 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 5511 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") + 5512 (write _test-input-stream "}\n") + 5513 # convert + 5514 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5515 (flush _test-output-buffered-file) + 5516 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5522 # check output + 5523 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-with-literal/0") + 5524 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-with-literal/1") + 5525 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-with-literal/2") + 5526 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-with-literal/3") + 5527 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-with-literal/4") + 5528 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-with-literal/5") + 5529 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-with-literal/6") + 5530 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-with-literal/7") + 5531 # 2 * 4 bytes/elem + 4 bytes for size = offset 12 + 5532 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x0000000c) 0x00000000/r32" "F - test-convert-index-into-array-with-literal/8") + 5533 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-with-literal/9") + 5534 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-with-literal/10") + 5535 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-with-literal/11") + 5536 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-with-literal/12") + 5537 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-with-literal/13") + 5538 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-with-literal/14") + 5539 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-with-literal/15") + 5540 # . epilogue + 5541 89/<- %esp 5/r32/ebp + 5542 5d/pop-to-ebp + 5543 c3/return + 5544 + 5545 test-convert-index-into-array-of-bytes-with-literal: + 5546 # . prologue + 5547 55/push-ebp + 5548 89/<- %ebp 4/r32/esp + 5549 # setup + 5550 (clear-stream _test-input-stream) + 5551 (clear-stream $_test-input-buffered-file->buffer) + 5552 (clear-stream _test-output-stream) + 5553 (clear-stream $_test-output-buffered-file->buffer) + 5554 # + 5555 (write _test-input-stream "fn foo {\n") + 5556 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") + 5557 (write _test-input-stream " var x/eax: (addr byte) <- index arr, 2\n") + 5558 (write _test-input-stream "}\n") + 5559 # convert + 5560 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5561 (flush _test-output-buffered-file) + 5562 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5568 # check output + 5569 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-with-literal/0") + 5570 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-with-literal/1") + 5571 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-with-literal/2") + 5572 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-with-literal/3") + 5573 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-with-literal/4") + 5574 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-with-literal/5") + 5575 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-with-literal/6") + 5576 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes-with-literal/7") + 5577 # 2 * 1 byte/elem + 4 bytes for size = offset 6 + 5578 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000006) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-with-literal/8") + 5579 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-with-literal/9") + 5580 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-with-literal/10") + 5581 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-with-literal/11") + 5582 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-with-literal/12") + 5583 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-with-literal/13") + 5584 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-with-literal/14") + 5585 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-with-literal/15") + 5586 # . epilogue + 5587 89/<- %esp 5/r32/ebp + 5588 5d/pop-to-ebp + 5589 c3/return + 5590 + 5591 test-convert-index-into-array-on-stack: + 5592 # . prologue + 5593 55/push-ebp + 5594 89/<- %ebp 4/r32/esp + 5595 # setup + 5596 (clear-stream _test-input-stream) + 5597 (clear-stream $_test-input-buffered-file->buffer) + 5598 (clear-stream _test-output-stream) + 5599 (clear-stream $_test-output-buffered-file->buffer) + 5600 # + 5601 (write _test-input-stream "fn foo {\n") + 5602 (write _test-input-stream " var arr: (array int 3)\n") + 5603 (write _test-input-stream " var idx/eax: int <- copy 2\n") + 5604 (write _test-input-stream " var x/eax: (addr int) <- index arr, idx\n") + 5605 (write _test-input-stream "}\n") + 5606 # convert + 5607 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5608 (flush _test-output-buffered-file) + 5609 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5615 # check output + 5616 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack/0") + 5617 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack/1") + 5618 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack/2") + 5619 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack/3") + 5620 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack/4") + 5621 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack/5") + 5622 # var arr + 5623 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack/6") + 5624 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack/7") + 5625 # var idx + 5626 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack/8") + 5627 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 2/imm32" "F - test-convert-index-into-array-on-stack/9") + 5628 # var x is at (ebp-0x10) + idx<<2 + 4 = ebp + idx<<2 - 0xc + 5629 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp + eax<<0x00000002 + 0xfffffff4) 0x00000000/r32" "F - test-convert-index-into-array-on-stack/10") + 5630 # reclaim idx + 5631 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack/11") + 5632 # reclaim arr + 5633 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack/12") + 5634 # + 5635 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack/13") + 5636 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack/14") + 5637 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack/15") + 5638 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack/16") + 5639 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack/17") + 5640 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack/18") + 5641 # . epilogue + 5642 89/<- %esp 5/r32/ebp + 5643 5d/pop-to-ebp + 5644 c3/return + 5645 + 5646 test-convert-index-into-array-on-stack-with-literal: + 5647 # . prologue + 5648 55/push-ebp + 5649 89/<- %ebp 4/r32/esp + 5650 # setup + 5651 (clear-stream _test-input-stream) + 5652 (clear-stream $_test-input-buffered-file->buffer) + 5653 (clear-stream _test-output-stream) + 5654 (clear-stream $_test-output-buffered-file->buffer) + 5655 # + 5656 (write _test-input-stream "fn foo {\n") + 5657 (write _test-input-stream " var arr: (array int 3)\n") + 5658 (write _test-input-stream " var x/eax: (addr int) <- index arr, 2\n") + 5659 (write _test-input-stream "}\n") + 5660 # convert + 5661 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5662 (flush _test-output-buffered-file) + 5663 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5669 # check output + 5670 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-on-stack-with-literal/0") + 5671 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-on-stack-with-literal/1") + 5672 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-on-stack-with-literal/2") + 5673 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-on-stack-with-literal/3") + 5674 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-on-stack-with-literal/4") + 5675 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-on-stack-with-literal/5") + 5676 # var arr + 5677 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x0000000c)" "F - test-convert-index-into-array-on-stack-with-literal/6") + 5678 (check-next-stream-line-equal _test-output-stream " 68/push 0x0000000c/imm32" "F - test-convert-index-into-array-on-stack-with-literal/7") + 5679 # var x + 5680 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-on-stack-with-literal/8") + 5681 # x is at (ebp-0x10) + 4 + 2*4 = ebp-4 + 5682 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp + 0xfffffffc) 0x00000000/r32" "F - test-convert-index-into-array-on-stack-with-literal/9") + 5683 # reclaim x + 5684 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-on-stack-with-literal/10") + 5685 # reclaim arr + 5686 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000010/imm32" "F - test-convert-index-into-array-on-stack-with-literal/11") + 5687 # + 5688 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-on-stack-with-literal/12") + 5689 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-on-stack-with-literal/13") + 5690 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-on-stack-with-literal/14") + 5691 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-on-stack-with-literal/15") + 5692 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-on-stack-with-literal/16") + 5693 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-on-stack-with-literal/17") + 5694 # . epilogue + 5695 89/<- %esp 5/r32/ebp + 5696 5d/pop-to-ebp + 5697 c3/return + 5698 + 5699 test-convert-index-into-array-of-bytes-on-stack-with-literal: + 5700 # . prologue + 5701 55/push-ebp + 5702 89/<- %ebp 4/r32/esp + 5703 # setup + 5704 (clear-stream _test-input-stream) + 5705 (clear-stream $_test-input-buffered-file->buffer) + 5706 (clear-stream _test-output-stream) + 5707 (clear-stream $_test-output-buffered-file->buffer) + 5708 # + 5709 (write _test-input-stream "fn foo {\n") + 5710 (write _test-input-stream " var arr: (array byte 3)\n") + 5711 (write _test-input-stream " var x/eax: (addr byte) <- index arr, 2\n") + 5712 (write _test-input-stream "}\n") + 5713 # convert + 5714 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5715 (flush _test-output-buffered-file) + 5716 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5722 # check output + 5723 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/0") + 5724 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/1") + 5725 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/2") + 5726 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/3") + 5727 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/4") + 5728 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/5") + 5729 # var arr + 5730 (check-next-stream-line-equal _test-output-stream " (push-n-zero-bytes 0x00000003)" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/6") + 5731 (check-next-stream-line-equal _test-output-stream " 68/push 0x00000003/imm32" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/7") + 5732 # var x + 5733 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/8") + 5734 # x is at (ebp-7) + 4 + 2 = ebp-1 + 5735 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp + 0xffffffff) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/9") + 5736 # reclaim x + 5737 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/10") + 5738 # reclaim arr + 5739 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000007/imm32" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/11") 5740 # - 5741 (write _test-input-stream "fn foo a: (addr t) {\n") - 5742 (write _test-input-stream " var _a/eax: (addr t) <- copy a\n") - 5743 (write _test-input-stream " var b/ecx: (addr int) <- get _a, x\n") - 5744 (write _test-input-stream " var c/ecx: (addr int) <- get _a, y\n") - 5745 (write _test-input-stream "}\n") - 5746 (write _test-input-stream "type t {\n") - 5747 (write _test-input-stream " x: int\n") - 5748 (write _test-input-stream " y: int\n") - 5749 (write _test-input-stream "}\n") - 5750 # convert - 5751 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5752 (flush _test-output-buffered-file) - 5753 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5759 # check output - 5760 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-and-type-definition/0") - 5761 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-and-type-definition/1") - 5762 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-and-type-definition/2") - 5763 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-and-type-definition/3") - 5764 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-and-type-definition/4") - 5765 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-and-type-definition/5") - 5766 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-and-type-definition/6") - 5767 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-and-type-definition/7") - 5768 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-and-type-definition/8") - 5769 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000000) 0x00000001/r32" "F - test-convert-function-and-type-definition/9") - 5770 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000004) 0x00000001/r32" "F - test-convert-function-and-type-definition/11") - 5771 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-and-type-definition/13") - 5772 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-and-type-definition/14") - 5773 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-and-type-definition/15") - 5774 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-and-type-definition/16") - 5775 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-and-type-definition/17") - 5776 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-and-type-definition/18") - 5777 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-and-type-definition/19") - 5778 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-and-type-definition/20") - 5779 # . epilogue - 5780 89/<- %esp 5/r32/ebp - 5781 5d/pop-to-ebp - 5782 c3/return - 5783 - 5784 test-type-definition-with-array: - 5785 # . prologue - 5786 55/push-ebp - 5787 89/<- %ebp 4/r32/esp - 5788 # setup - 5789 (clear-stream _test-input-stream) - 5790 (clear-stream $_test-input-buffered-file->buffer) - 5791 (clear-stream _test-output-stream) - 5792 (clear-stream $_test-output-buffered-file->buffer) - 5793 (clear-stream _test-error-stream) - 5794 (clear-stream $_test-error-buffered-file->buffer) - 5795 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 5796 68/push 0/imm32 - 5797 68/push 0/imm32 - 5798 89/<- %edx 4/r32/esp - 5799 (tailor-exit-descriptor %edx 0x10) - 5800 # - 5801 (write _test-input-stream "type t {\n") - 5802 (write _test-input-stream " a: (array int 3)\n") - 5803 (write _test-input-stream "}\n") - 5804 # convert - 5805 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 5806 # registers except esp clobbered at this point - 5807 # restore ed - 5808 89/<- %edx 4/r32/esp - 5809 (flush _test-output-buffered-file) - 5810 (flush _test-error-buffered-file) - 5811 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 5817 # check output - 5818 (check-stream-equal _test-output-stream "" "F - test-type-definition-with-array: output should be empty") - 5819 (check-next-stream-line-equal _test-error-stream "type t: 'array' elements not allowed for now" "F - test-type-definition-with-array: error message") - 5820 # check that stop(1) was called - 5821 (check-ints-equal *(edx+4) 2 "F - test-type-definition-with-array: exit status") - 5822 # don't restore from ebp - 5823 81 0/subop/add %esp 8/imm32 - 5824 # . epilogue - 5825 5d/pop-to-ebp - 5826 c3/return - 5827 - 5828 test-type-definition-with-addr: - 5829 # . prologue - 5830 55/push-ebp - 5831 89/<- %ebp 4/r32/esp - 5832 # setup - 5833 (clear-stream _test-input-stream) - 5834 (clear-stream $_test-input-buffered-file->buffer) - 5835 (clear-stream _test-output-stream) - 5836 (clear-stream $_test-output-buffered-file->buffer) - 5837 (clear-stream _test-error-stream) - 5838 (clear-stream $_test-error-buffered-file->buffer) - 5839 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 5840 68/push 0/imm32 - 5841 68/push 0/imm32 - 5842 89/<- %edx 4/r32/esp - 5843 (tailor-exit-descriptor %edx 0x10) - 5844 # - 5845 (write _test-input-stream "type t {\n") - 5846 (write _test-input-stream " a: (addr int)\n") - 5847 (write _test-input-stream "}\n") - 5848 # convert - 5849 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 5850 # registers except esp clobbered at this point - 5851 # restore ed - 5852 89/<- %edx 4/r32/esp - 5853 (flush _test-output-buffered-file) - 5854 (flush _test-error-buffered-file) - 5855 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 5861 # check output - 5862 (check-stream-equal _test-output-stream "" "F - test-type-definition-with-addr: output should be empty") - 5863 (check-next-stream-line-equal _test-error-stream "type t: 'addr' elements not allowed" "F - test-type-definition-with-addr: error message") - 5864 # check that stop(1) was called - 5865 (check-ints-equal *(edx+4) 2 "F - test-type-definition-with-addr: exit status") - 5866 # don't restore from ebp - 5867 81 0/subop/add %esp 8/imm32 - 5868 # . epilogue - 5869 5d/pop-to-ebp - 5870 c3/return - 5871 - 5872 test-convert-function-with-local-var-with-user-defined-type: - 5873 # . prologue - 5874 55/push-ebp - 5875 89/<- %ebp 4/r32/esp - 5876 # setup - 5877 (clear-stream _test-input-stream) - 5878 (clear-stream $_test-input-buffered-file->buffer) - 5879 (clear-stream _test-output-stream) - 5880 (clear-stream $_test-output-buffered-file->buffer) - 5881 # - 5882 (write _test-input-stream "fn foo {\n") - 5883 (write _test-input-stream " var a: t\n") - 5884 (write _test-input-stream "}\n") - 5885 (write _test-input-stream "type t {\n") - 5886 (write _test-input-stream " x: int\n") - 5887 (write _test-input-stream " y: int\n") - 5888 (write _test-input-stream "}\n") - 5889 # convert - 5890 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5891 (flush _test-output-buffered-file) - 5892 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5898 # check output - 5899 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-user-defined-type/0") - 5900 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-user-defined-type/1") - 5901 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/2") - 5902 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-with-user-defined-type/3") - 5903 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type/4") - 5904 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-user-defined-type/5") - 5905 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/6") - 5906 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/7") - 5907 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/8") - 5908 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type/9") - 5909 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-user-defined-type/10") - 5910 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-user-defined-type/11") - 5911 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-with-user-defined-type/12") - 5912 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/13") - 5913 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-user-defined-type/14") - 5914 # . epilogue - 5915 89/<- %esp 5/r32/ebp - 5916 5d/pop-to-ebp - 5917 c3/return - 5918 - 5919 test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type: - 5920 # . prologue - 5921 55/push-ebp - 5922 89/<- %ebp 4/r32/esp - 5923 # setup - 5924 (clear-stream _test-input-stream) - 5925 (clear-stream $_test-input-buffered-file->buffer) - 5926 (clear-stream _test-output-stream) - 5927 (clear-stream $_test-output-buffered-file->buffer) - 5928 # - 5929 (write _test-input-stream "fn foo {\n") - 5930 (write _test-input-stream " var a: t\n") - 5931 (write _test-input-stream "}\n") - 5932 (write _test-input-stream "type t {\n") - 5933 (write _test-input-stream " x: s\n") - 5934 (write _test-input-stream "}\n") - 5935 (write _test-input-stream "type s {\n") - 5936 (write _test-input-stream " z: int\n") - 5937 (write _test-input-stream "}\n") - 5938 # convert - 5939 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5940 (flush _test-output-buffered-file) - 5941 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5947 # check output - 5948 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/0") - 5949 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/1") - 5950 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/2") - 5951 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/3") - 5952 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/4") - 5953 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/5") - 5954 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/7") - 5955 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/8") - 5956 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/9") - 5957 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/10") - 5958 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/11") - 5959 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/12") - 5960 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/13") - 5961 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/14") - 5962 # . epilogue - 5963 89/<- %esp 5/r32/ebp - 5964 5d/pop-to-ebp - 5965 c3/return - 5966 - 5967 test-convert-function-call-with-arg-of-user-defined-type: - 5968 # . prologue - 5969 55/push-ebp - 5970 89/<- %ebp 4/r32/esp - 5971 # setup - 5972 (clear-stream _test-input-stream) - 5973 (clear-stream $_test-input-buffered-file->buffer) - 5974 (clear-stream _test-output-stream) - 5975 (clear-stream $_test-output-buffered-file->buffer) - 5976 # - 5977 (write _test-input-stream "fn f {\n") - 5978 (write _test-input-stream " var a: t\n") - 5979 (write _test-input-stream " foo a\n") - 5980 (write _test-input-stream "}\n") - 5981 (write _test-input-stream "fn foo x: t {\n") - 5982 (write _test-input-stream "}\n") - 5983 (write _test-input-stream "type t {\n") - 5984 (write _test-input-stream " x: int\n") - 5985 (write _test-input-stream " y: int\n") - 5986 (write _test-input-stream "}\n") - 5987 # convert - 5988 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 5989 (flush _test-output-buffered-file) - 5990 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 5996 # check output - 5997 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") - 5998 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") - 5999 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") - 6000 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type/3") - 6001 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") - 6002 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") - 6003 # var a: t - 6004 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/6") - 6005 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/7") - 6006 # foo a - 6007 (check-next-stream-line-equal _test-output-stream " (foo *(ebp+0xfffffff8) *(ebp+0xfffffffc))" "F - test-convert-function-call-with-arg-of-user-defined-type/8") - 6008 # - 6009 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/9") - 6010 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") - 6011 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") - 6012 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") - 6013 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/13") - 6014 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") - 6015 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") - 6016 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") - 6017 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") - 6018 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") - 6019 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type/19") - 6020 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") - 6021 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/21") - 6022 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") - 6023 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") - 6024 # . epilogue - 6025 89/<- %esp 5/r32/ebp - 6026 5d/pop-to-ebp - 6027 c3/return - 6028 - 6029 test-convert-function-call-with-arg-of-user-defined-type-register-indirect: - 6030 # . prologue - 6031 55/push-ebp - 6032 89/<- %ebp 4/r32/esp - 6033 # setup - 6034 (clear-stream _test-input-stream) - 6035 (clear-stream $_test-input-buffered-file->buffer) - 6036 (clear-stream _test-output-stream) - 6037 (clear-stream $_test-output-buffered-file->buffer) - 6038 # - 6039 (write _test-input-stream "fn f {\n") - 6040 (write _test-input-stream " var a/eax: (addr t) <- copy 0\n") - 6041 (write _test-input-stream " foo *a\n") - 6042 (write _test-input-stream "}\n") - 6043 (write _test-input-stream "fn foo x: t {\n") - 6044 (write _test-input-stream "}\n") - 6045 (write _test-input-stream "type t {\n") - 6046 (write _test-input-stream " x: int\n") - 6047 (write _test-input-stream " y: int\n") - 6048 (write _test-input-stream "}\n") - 6049 # convert - 6050 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6051 (flush _test-output-buffered-file) - 6052 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 6058 # check output - 6059 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") - 6060 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") - 6061 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") - 6062 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type/3") - 6063 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") - 6064 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") - 6065 # var a - 6066 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-arg-of-user-defined-type/6") - 6067 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/7") - 6068 # foo a - 6069 (check-next-stream-line-equal _test-output-stream " (foo *(eax+0x00000000) *(eax+0x00000004))" "F - test-convert-function-call-with-arg-of-user-defined-type/8") - 6070 # - 6071 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-call-with-arg-of-user-defined-type/9") - 6072 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") - 6073 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") - 6074 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") - 6075 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/13") - 6076 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") - 6077 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") - 6078 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") - 6079 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") - 6080 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") - 6081 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type/19") - 6082 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") - 6083 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/21") - 6084 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") - 6085 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") - 6086 # . epilogue - 6087 89/<- %esp 5/r32/ebp - 6088 5d/pop-to-ebp - 6089 c3/return - 6090 - 6091 # we don't have special support for call-by-reference; just explicitly create - 6092 # a new variable with the address of the arg - 6093 test-convert-function-call-with-arg-of-user-defined-type-by-reference: - 6094 # . prologue - 6095 55/push-ebp - 6096 89/<- %ebp 4/r32/esp - 6097 # setup - 6098 (clear-stream _test-input-stream) - 6099 (clear-stream $_test-input-buffered-file->buffer) - 6100 (clear-stream _test-output-stream) - 6101 (clear-stream $_test-output-buffered-file->buffer) - 6102 # - 6103 (write _test-input-stream "fn f {\n") - 6104 (write _test-input-stream " var a: t\n") - 6105 (write _test-input-stream " var b/eax: (addr t) <- address a\n") - 6106 (write _test-input-stream " foo b\n") - 6107 (write _test-input-stream "}\n") - 6108 (write _test-input-stream "fn foo x: (addr t) {\n") - 6109 (write _test-input-stream " var x/ecx: (addr t) <- copy x\n") - 6110 (write _test-input-stream "}\n") - 6111 (write _test-input-stream "type t {\n") - 6112 (write _test-input-stream " x: int\n") - 6113 (write _test-input-stream " y: int\n") - 6114 (write _test-input-stream "}\n") - 6115 # convert - 6116 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6117 (flush _test-output-buffered-file) - 6118 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 6124 # check output - 6125 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/0") - 6126 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/1") - 6127 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/2") - 6128 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/3") - 6129 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/4") - 6130 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/5") - 6131 # var a: t - 6132 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/6") - 6133 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/7") - 6134 # var b/eax: (addr t) - 6135 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/8") - 6136 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffff8) 0x00000000/r32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/9") - 6137 # foo a - 6138 (check-next-stream-line-equal _test-output-stream " (foo %eax)" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/10") - 6139 # - 6140 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/11") - 6141 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/12") - 6142 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/13") - 6143 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/14") - 6144 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/15") - 6145 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/16") - 6146 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/17") - 6147 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/18") - 6148 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/19") - 6149 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/20") - 6150 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/21") - 6151 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/22") - 6152 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/23") - 6153 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/24") - 6154 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/25") - 6155 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000001/r32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/26") - 6156 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/27") - 6157 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/28") - 6158 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/29") - 6159 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/30") - 6160 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/31") - 6161 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/32") - 6162 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/33") - 6163 # . epilogue - 6164 89/<- %esp 5/r32/ebp - 6165 5d/pop-to-ebp - 6166 c3/return - 6167 - 6168 test-convert-get-on-local-variable: - 6169 # . prologue - 6170 55/push-ebp - 6171 89/<- %ebp 4/r32/esp - 6172 # setup - 6173 (clear-stream _test-input-stream) - 6174 (clear-stream $_test-input-buffered-file->buffer) - 6175 (clear-stream _test-output-stream) - 6176 (clear-stream $_test-output-buffered-file->buffer) - 6177 # - 6178 (write _test-input-stream "fn foo {\n") - 6179 (write _test-input-stream " var a: t\n") - 6180 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 6181 (write _test-input-stream "}\n") - 6182 (write _test-input-stream "type t {\n") - 6183 (write _test-input-stream " x: int\n") - 6184 (write _test-input-stream " y: int\n") - 6185 (write _test-input-stream "}\n") - 6186 # convert - 6187 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6188 (flush _test-output-buffered-file) - 6189 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 6195 # check output - 6196 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-local-variable/0") - 6197 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-local-variable/1") - 6198 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-local-variable/2") - 6199 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-local-variable/3") - 6200 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-local-variable/4") - 6201 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-local-variable/5") - 6202 # var a - 6203 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/6") - 6204 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/7") - 6205 # var c - 6206 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-local-variable/8") - 6207 # get - 6208 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000001/r32" "F - test-convert-get-on-local-variable/9") - 6209 # reclaim c - 6210 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-local-variable/10") - 6211 # reclaim a - 6212 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-get-on-local-variable/11") - 6213 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-local-variable/12") - 6214 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-local-variable/13") - 6215 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-local-variable/14") - 6216 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-local-variable/15") - 6217 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-local-variable/16") - 6218 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-local-variable/17") - 6219 # . epilogue - 6220 89/<- %esp 5/r32/ebp - 6221 5d/pop-to-ebp - 6222 c3/return - 6223 - 6224 test-convert-get-on-function-argument: - 6225 # . prologue - 6226 55/push-ebp - 6227 89/<- %ebp 4/r32/esp - 6228 # setup - 6229 (clear-stream _test-input-stream) - 6230 (clear-stream $_test-input-buffered-file->buffer) - 6231 (clear-stream _test-output-stream) - 6232 (clear-stream $_test-output-buffered-file->buffer) - 6233 # - 6234 (write _test-input-stream "fn foo a: t {\n") - 6235 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 6236 (write _test-input-stream "}\n") - 6237 (write _test-input-stream "type t {\n") - 6238 (write _test-input-stream " x: int\n") - 6239 (write _test-input-stream " y: int\n") - 6240 (write _test-input-stream "}\n") - 6241 # convert - 6242 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6243 (flush _test-output-buffered-file) - 6244 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 6250 # check output - 6251 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument/0") - 6252 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument/1") - 6253 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument/2") - 6254 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument/3") - 6255 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument/4") - 6256 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument/5") - 6257 # var c - 6258 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument/6") - 6259 # get - 6260 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0x0000000c) 0x00000001/r32" "F - test-convert-get-on-function-argument/7") - 6261 # reclaim c - 6262 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument/8") - 6263 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument/9") - 6264 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument/10") - 6265 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument/11") - 6266 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument/12") - 6267 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument/13") - 6268 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument/14") - 6269 # . epilogue - 6270 89/<- %esp 5/r32/ebp - 6271 5d/pop-to-ebp - 6272 c3/return - 6273 - 6274 test-convert-get-on-function-argument-with-known-type: - 6275 # . prologue - 6276 55/push-ebp - 6277 89/<- %ebp 4/r32/esp - 6278 # setup - 6279 (clear-stream _test-input-stream) - 6280 (clear-stream $_test-input-buffered-file->buffer) - 6281 (clear-stream _test-output-stream) - 6282 (clear-stream $_test-output-buffered-file->buffer) - 6283 # - 6284 (write _test-input-stream "type t {\n") - 6285 (write _test-input-stream " x: int\n") - 6286 (write _test-input-stream " y: int\n") - 6287 (write _test-input-stream "}\n") - 6288 (write _test-input-stream "fn foo a: t {\n") - 6289 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 6290 (write _test-input-stream "}\n") - 6291 # convert - 6292 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6293 (flush _test-output-buffered-file) - 6294 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 6300 # check output - 6301 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument-with-known-type/0") - 6302 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument-with-known-type/1") - 6303 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument-with-known-type/2") - 6304 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument-with-known-type/3") - 6305 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument-with-known-type/4") - 6306 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument-with-known-type/5") - 6307 # var c - 6308 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument-with-known-type/6") - 6309 # get - 6310 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0x0000000c) 0x00000001/r32" "F - test-convert-get-on-function-argument-with-known-type/7") - 6311 # reclaim c - 6312 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument-with-known-type/8") - 6313 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument-with-known-type/9") - 6314 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument-with-known-type/10") - 6315 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument-with-known-type/11") - 6316 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument-with-known-type/12") - 6317 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument-with-known-type/13") - 6318 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument-with-known-type/14") - 6319 # . epilogue - 6320 89/<- %esp 5/r32/ebp - 6321 5d/pop-to-ebp - 6322 c3/return - 6323 - 6324 test-add-with-too-many-inouts: - 6325 # . prologue - 6326 55/push-ebp - 6327 89/<- %ebp 4/r32/esp - 6328 # setup - 6329 (clear-stream _test-input-stream) - 6330 (clear-stream $_test-input-buffered-file->buffer) - 6331 (clear-stream _test-output-stream) - 6332 (clear-stream $_test-output-buffered-file->buffer) - 6333 (clear-stream _test-error-stream) - 6334 (clear-stream $_test-error-buffered-file->buffer) - 6335 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6336 68/push 0/imm32 - 6337 68/push 0/imm32 - 6338 89/<- %edx 4/r32/esp - 6339 (tailor-exit-descriptor %edx 0x10) - 6340 # - 6341 (write _test-input-stream "fn foo {\n") - 6342 (write _test-input-stream " var a: int\n") - 6343 (write _test-input-stream " var b/ecx: int <- add a, 0\n") - 6344 (write _test-input-stream "}\n") - 6345 # convert - 6346 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6347 # registers except esp clobbered at this point - 6348 # restore ed - 6349 89/<- %edx 4/r32/esp - 6350 (flush _test-output-buffered-file) - 6351 (flush _test-error-buffered-file) - 6352 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 6358 # check output - 6359 (check-stream-equal _test-output-stream "" "F - test-add-with-too-many-inouts: output should be empty") - 6360 (check-next-stream-line-equal _test-error-stream "fn foo: stmt add: too many inouts; most primitives support at most two arguments, across inouts and outputs" "F - test-add-with-too-many-inouts: error message") - 6361 # check that stop(1) was called - 6362 (check-ints-equal *(edx+4) 2 "F - test-add-with-too-many-inouts: exit status") - 6363 # don't restore from ebp - 6364 81 0/subop/add %esp 8/imm32 - 6365 # . epilogue - 6366 5d/pop-to-ebp - 6367 c3/return - 6368 - 6369 test-add-with-too-many-inouts-2: - 6370 # . prologue - 6371 55/push-ebp - 6372 89/<- %ebp 4/r32/esp - 6373 # setup - 6374 (clear-stream _test-input-stream) - 6375 (clear-stream $_test-input-buffered-file->buffer) - 6376 (clear-stream _test-output-stream) - 6377 (clear-stream $_test-output-buffered-file->buffer) - 6378 (clear-stream _test-error-stream) - 6379 (clear-stream $_test-error-buffered-file->buffer) - 6380 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6381 68/push 0/imm32 - 6382 68/push 0/imm32 - 6383 89/<- %edx 4/r32/esp - 6384 (tailor-exit-descriptor %edx 0x10) - 6385 # - 6386 (write _test-input-stream "fn foo {\n") - 6387 (write _test-input-stream " var a: int\n") - 6388 (write _test-input-stream " add-to a, 0, 1\n") - 6389 (write _test-input-stream "}\n") - 6390 # convert - 6391 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6392 # registers except esp clobbered at this point - 6393 # restore ed - 6394 89/<- %edx 4/r32/esp - 6395 (flush _test-output-buffered-file) - 6396 (flush _test-error-buffered-file) - 6397 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 6403 # check output - 6404 (check-stream-equal _test-output-stream "" "F - test-add-with-too-many-inouts-2: output should be empty") - 6405 (check-next-stream-line-equal _test-error-stream "fn foo: stmt add-to: too many inouts; most primitives support at most two arguments, across inouts and outputs" "F - test-add-with-too-many-inouts-2: error message") - 6406 # check that stop(1) was called - 6407 (check-ints-equal *(edx+4) 2 "F - test-add-with-too-many-inouts-2: exit status") - 6408 # don't restore from ebp - 6409 81 0/subop/add %esp 8/imm32 - 6410 # . epilogue - 6411 5d/pop-to-ebp - 6412 c3/return - 6413 - 6414 test-add-with-too-many-outputs: - 6415 # . prologue - 6416 55/push-ebp - 6417 89/<- %ebp 4/r32/esp - 6418 # setup - 6419 (clear-stream _test-input-stream) - 6420 (clear-stream $_test-input-buffered-file->buffer) - 6421 (clear-stream _test-output-stream) - 6422 (clear-stream $_test-output-buffered-file->buffer) - 6423 (clear-stream _test-error-stream) - 6424 (clear-stream $_test-error-buffered-file->buffer) - 6425 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6426 68/push 0/imm32 - 6427 68/push 0/imm32 - 6428 89/<- %edx 4/r32/esp - 6429 (tailor-exit-descriptor %edx 0x10) - 6430 # - 6431 (write _test-input-stream "fn foo {\n") - 6432 (write _test-input-stream " var a/eax: int <- copy 0\n") - 6433 (write _test-input-stream " var b/ebx: int <- copy 0\n") - 6434 (write _test-input-stream " var c/ecx: int <- copy 0\n") - 6435 (write _test-input-stream " c, b <- add a\n") - 6436 (write _test-input-stream "}\n") - 6437 # convert - 6438 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6439 # registers except esp clobbered at this point - 6440 # restore ed - 6441 89/<- %edx 4/r32/esp - 6442 (flush _test-output-buffered-file) - 6443 (flush _test-error-buffered-file) - 6444 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 6450 # check output - 6451 (check-stream-equal _test-output-stream "" "F - test-add-with-too-many-outputs: output should be empty") - 6452 (check-next-stream-line-equal _test-error-stream "fn foo: stmt add: too many outputs; most primitives support at most one output" "F - test-add-with-too-many-outputs: error message") - 6453 # check that stop(1) was called - 6454 (check-ints-equal *(edx+4) 2 "F - test-add-with-too-many-outputs: exit status") - 6455 # don't restore from ebp - 6456 81 0/subop/add %esp 8/imm32 - 6457 # . epilogue - 6458 5d/pop-to-ebp - 6459 c3/return - 6460 - 6461 test-add-with-non-number: - 6462 # . prologue - 6463 55/push-ebp - 6464 89/<- %ebp 4/r32/esp - 6465 # setup - 6466 (clear-stream _test-input-stream) - 6467 (clear-stream $_test-input-buffered-file->buffer) - 6468 (clear-stream _test-output-stream) - 6469 (clear-stream $_test-output-buffered-file->buffer) - 6470 (clear-stream _test-error-stream) - 6471 (clear-stream $_test-error-buffered-file->buffer) - 6472 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6473 68/push 0/imm32 - 6474 68/push 0/imm32 - 6475 89/<- %edx 4/r32/esp - 6476 (tailor-exit-descriptor %edx 0x10) - 6477 # - 6478 (write _test-input-stream "fn foo {\n") - 6479 (write _test-input-stream " var a: int\n") - 6480 (write _test-input-stream " var b/ecx: (addr int) <- add a\n") - 6481 (write _test-input-stream "}\n") - 6482 # convert - 6483 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6484 # registers except esp clobbered at this point - 6485 # restore ed - 6486 89/<- %edx 4/r32/esp - 6487 (flush _test-output-buffered-file) - 6488 (flush _test-error-buffered-file) - 6489 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 6495 # check output - 6496 (check-stream-equal _test-output-stream "" "F - test-add-with-non-number: output should be empty") - 6497 (check-next-stream-line-equal _test-error-stream "fn foo: stmt add: 'b' must be a non-addr scalar" "F - test-add-with-non-number: error message") - 6498 # check that stop(1) was called - 6499 (check-ints-equal *(edx+4) 2 "F - test-add-with-non-number: exit status") - 6500 # don't restore from ebp - 6501 81 0/subop/add %esp 8/imm32 - 6502 # . epilogue - 6503 5d/pop-to-ebp - 6504 c3/return - 6505 - 6506 test-add-with-addr-dereferenced: - 6507 # . prologue - 6508 55/push-ebp - 6509 89/<- %ebp 4/r32/esp - 6510 # setup - 6511 (clear-stream _test-input-stream) - 6512 (clear-stream $_test-input-buffered-file->buffer) - 6513 (clear-stream _test-output-stream) - 6514 (clear-stream $_test-output-buffered-file->buffer) - 6515 # - 6516 (write _test-input-stream "fn foo {\n") - 6517 (write _test-input-stream " var a/eax: (addr int) <- copy 0\n") - 6518 (write _test-input-stream " add-to *a, 1\n") - 6519 (write _test-input-stream "}\n") - 6520 # convert - 6521 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6522 (flush _test-output-buffered-file) - 6523 # no error - 6524 # . epilogue - 6525 89/<- %esp 5/r32/ebp - 6526 5d/pop-to-ebp - 6527 c3/return - 6528 - 6529 test-copy-with-no-inout: - 6530 # . prologue - 6531 55/push-ebp - 6532 89/<- %ebp 4/r32/esp - 6533 # setup - 6534 (clear-stream _test-input-stream) - 6535 (clear-stream $_test-input-buffered-file->buffer) - 6536 (clear-stream _test-output-stream) - 6537 (clear-stream $_test-output-buffered-file->buffer) - 6538 (clear-stream _test-error-stream) - 6539 (clear-stream $_test-error-buffered-file->buffer) - 6540 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6541 68/push 0/imm32 - 6542 68/push 0/imm32 - 6543 89/<- %edx 4/r32/esp - 6544 (tailor-exit-descriptor %edx 0x10) - 6545 # - 6546 (write _test-input-stream "fn foo {\n") - 6547 (write _test-input-stream " var x/eax: boolean <- copy\n") - 6548 (write _test-input-stream "}\n") - 6549 # convert - 6550 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6551 # registers except esp clobbered at this point - 6552 # restore ed - 6553 89/<- %edx 4/r32/esp - 6554 (flush _test-output-buffered-file) - 6555 (flush _test-error-buffered-file) - 6556 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 6562 # check output - 6563 (check-stream-equal _test-output-stream "" "F - test-copy-with-no-inout: output should be empty") - 6564 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy' expects an inout" "F - test-copy-with-no-inout: error message") - 6565 # check that stop(1) was called - 6566 (check-ints-equal *(edx+4) 2 "F - test-copy-with-no-inout: exit status") - 6567 # don't restore from ebp - 6568 81 0/subop/add %esp 8/imm32 - 6569 # . epilogue - 6570 5d/pop-to-ebp - 6571 c3/return - 6572 - 6573 test-copy-with-multiple-inouts: - 6574 # . prologue - 6575 55/push-ebp - 6576 89/<- %ebp 4/r32/esp - 6577 # setup - 6578 (clear-stream _test-input-stream) - 6579 (clear-stream $_test-input-buffered-file->buffer) - 6580 (clear-stream _test-output-stream) - 6581 (clear-stream $_test-output-buffered-file->buffer) - 6582 (clear-stream _test-error-stream) - 6583 (clear-stream $_test-error-buffered-file->buffer) - 6584 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6585 68/push 0/imm32 - 6586 68/push 0/imm32 - 6587 89/<- %edx 4/r32/esp - 6588 (tailor-exit-descriptor %edx 0x10) - 6589 # - 6590 (write _test-input-stream "fn foo {\n") - 6591 (write _test-input-stream " var x/eax: boolean <- copy 0, 0\n") - 6592 (write _test-input-stream "}\n") - 6593 # convert - 6594 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6595 # registers except esp clobbered at this point - 6596 # restore ed - 6597 89/<- %edx 4/r32/esp - 6598 (flush _test-output-buffered-file) - 6599 (flush _test-error-buffered-file) - 6600 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 6606 # check output - 6607 (check-stream-equal _test-output-stream "" "F - test-copy-with-multiple-inouts: output should be empty") - 6608 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy' must have just one inout" "F - test-copy-with-multiple-inouts: error message") - 6609 # check that stop(1) was called - 6610 (check-ints-equal *(edx+4) 2 "F - test-copy-with-multiple-inouts: exit status") - 6611 # don't restore from ebp - 6612 81 0/subop/add %esp 8/imm32 - 6613 # . epilogue - 6614 5d/pop-to-ebp - 6615 c3/return - 6616 - 6617 test-copy-with-no-output: - 6618 # . prologue - 6619 55/push-ebp - 6620 89/<- %ebp 4/r32/esp - 6621 # setup - 6622 (clear-stream _test-input-stream) - 6623 (clear-stream $_test-input-buffered-file->buffer) - 6624 (clear-stream _test-output-stream) - 6625 (clear-stream $_test-output-buffered-file->buffer) - 6626 (clear-stream _test-error-stream) - 6627 (clear-stream $_test-error-buffered-file->buffer) - 6628 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6629 68/push 0/imm32 - 6630 68/push 0/imm32 - 6631 89/<- %edx 4/r32/esp - 6632 (tailor-exit-descriptor %edx 0x10) - 6633 # - 6634 (write _test-input-stream "fn foo {\n") - 6635 (write _test-input-stream " copy 0\n") - 6636 (write _test-input-stream "}\n") - 6637 # convert - 6638 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6639 # registers except esp clobbered at this point - 6640 # restore ed - 6641 89/<- %edx 4/r32/esp - 6642 (flush _test-output-buffered-file) - 6643 (flush _test-error-buffered-file) - 6644 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 6650 # check output - 6651 (check-stream-equal _test-output-stream "" "F - test-copy-with-no-output: output should be empty") - 6652 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy' expects an output" "F - test-copy-with-no-output: error message") - 6653 # check that stop(1) was called - 6654 (check-ints-equal *(edx+4) 2 "F - test-copy-with-no-output: exit status") - 6655 # don't restore from ebp - 6656 81 0/subop/add %esp 8/imm32 - 6657 # . epilogue - 6658 5d/pop-to-ebp - 6659 c3/return - 6660 - 6661 test-copy-with-multiple-outputs: - 6662 # . prologue - 6663 55/push-ebp - 6664 89/<- %ebp 4/r32/esp - 6665 # setup - 6666 (clear-stream _test-input-stream) - 6667 (clear-stream $_test-input-buffered-file->buffer) - 6668 (clear-stream _test-output-stream) - 6669 (clear-stream $_test-output-buffered-file->buffer) - 6670 (clear-stream _test-error-stream) - 6671 (clear-stream $_test-error-buffered-file->buffer) - 6672 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6673 68/push 0/imm32 - 6674 68/push 0/imm32 - 6675 89/<- %edx 4/r32/esp - 6676 (tailor-exit-descriptor %edx 0x10) - 6677 # - 6678 (write _test-input-stream "fn foo {\n") - 6679 (write _test-input-stream " var x/eax: boolean <- copy 0\n") - 6680 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") - 6681 (write _test-input-stream " x, y <- copy 0\n") - 6682 (write _test-input-stream "}\n") - 6683 # convert - 6684 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6685 # registers except esp clobbered at this point - 6686 # restore ed - 6687 89/<- %edx 4/r32/esp - 6688 (flush _test-output-buffered-file) - 6689 (flush _test-error-buffered-file) - 6690 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 6696 # check output - 6697 (check-stream-equal _test-output-stream "" "F - test-copy-with-multiple-outputs: output should be empty") - 6698 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy' must have just one output" "F - test-copy-with-multiple-outputs: error message") - 6699 # check that stop(1) was called - 6700 (check-ints-equal *(edx+4) 2 "F - test-copy-with-multiple-outputs: exit status") - 6701 # don't restore from ebp - 6702 81 0/subop/add %esp 8/imm32 - 6703 # . epilogue - 6704 5d/pop-to-ebp - 6705 c3/return - 6706 - 6707 test-copy-invalid-value-to-address: - 6708 # . prologue - 6709 55/push-ebp - 6710 89/<- %ebp 4/r32/esp - 6711 # setup - 6712 (clear-stream _test-input-stream) - 6713 (clear-stream $_test-input-buffered-file->buffer) - 6714 (clear-stream _test-output-stream) - 6715 (clear-stream $_test-output-buffered-file->buffer) - 6716 (clear-stream _test-error-stream) - 6717 (clear-stream $_test-error-buffered-file->buffer) - 6718 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6719 68/push 0/imm32 - 6720 68/push 0/imm32 - 6721 89/<- %edx 4/r32/esp - 6722 (tailor-exit-descriptor %edx 0x10) - 6723 # - 6724 (write _test-input-stream "fn foo {\n") - 6725 (write _test-input-stream " var x/eax: int <- copy 0\n") - 6726 (write _test-input-stream " var y/ecx: (addr int) <- copy x\n") - 6727 (write _test-input-stream "}\n") - 6728 # convert - 6729 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6730 # registers except esp clobbered at this point - 6731 # restore ed - 6732 89/<- %edx 4/r32/esp - 6733 (flush _test-output-buffered-file) - 6734 (flush _test-error-buffered-file) - 6735 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 6741 # check output - 6742 (check-stream-equal _test-output-stream "" "F - test-copy-invalid-value-to-address: output should be empty") - 6743 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy: 'y' must be a non-addr scalar" "F - test-copy-invalid-value-to-address: error message") - 6744 # check that stop(1) was called - 6745 (check-ints-equal *(edx+4) 2 "F - test-copy-invalid-value-to-address: exit status") - 6746 # don't restore from ebp - 6747 81 0/subop/add %esp 8/imm32 - 6748 # . epilogue - 6749 5d/pop-to-ebp - 6750 c3/return - 6751 - 6752 test-copy-deref-address: - 6753 # . prologue - 6754 55/push-ebp - 6755 89/<- %ebp 4/r32/esp - 6756 # setup - 6757 (clear-stream _test-input-stream) - 6758 (clear-stream $_test-input-buffered-file->buffer) - 6759 (clear-stream _test-output-stream) - 6760 (clear-stream $_test-output-buffered-file->buffer) - 6761 # - 6762 (write _test-input-stream "fn foo {\n") - 6763 (write _test-input-stream " var x/eax: (addr addr int) <- copy 0\n") - 6764 (write _test-input-stream " var y/ecx: (addr int) <- copy *x\n") - 6765 (write _test-input-stream "}\n") - 6766 # convert - 6767 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 6768 (flush _test-output-buffered-file) - 6769 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 6775 # not bothering checking output - 6776 (check-next-stream-line-equal _test-error-stream "" "F - test-copy-deref-address: error message") - 6777 # . epilogue - 6778 5d/pop-to-ebp - 6779 c3/return - 6780 - 6781 test-copy-to-non-register: - 6782 # . prologue - 6783 55/push-ebp - 6784 89/<- %ebp 4/r32/esp - 6785 # setup - 6786 (clear-stream _test-input-stream) - 6787 (clear-stream $_test-input-buffered-file->buffer) - 6788 (clear-stream _test-output-stream) - 6789 (clear-stream $_test-output-buffered-file->buffer) - 6790 (clear-stream _test-error-stream) - 6791 (clear-stream $_test-error-buffered-file->buffer) - 6792 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6793 68/push 0/imm32 - 6794 68/push 0/imm32 - 6795 89/<- %edx 4/r32/esp - 6796 (tailor-exit-descriptor %edx 0x10) - 6797 # - 6798 (write _test-input-stream "fn foo {\n") - 6799 (write _test-input-stream " var x: int\n") - 6800 (write _test-input-stream " x <- copy 0\n") - 6801 (write _test-input-stream "}\n") - 6802 # convert - 6803 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6804 # registers except esp clobbered at this point - 6805 # restore ed - 6806 89/<- %edx 4/r32/esp - 6807 (flush _test-output-buffered-file) - 6808 (flush _test-error-buffered-file) - 6809 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 6815 # check output - 6816 (check-stream-equal _test-output-stream "" "F - test-copy-to-non-register: output should be empty") - 6817 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy: output 'x' not in a register" "F - test-copy-to-non-register: error message") - 6818 # check that stop(1) was called - 6819 (check-ints-equal *(edx+4) 2 "F - test-copy-to-non-register: exit status") - 6820 # don't restore from ebp - 6821 81 0/subop/add %esp 8/imm32 - 6822 # . epilogue - 6823 5d/pop-to-ebp - 6824 c3/return - 6825 - 6826 test-copy-non-scalar: - 6827 # . prologue - 6828 55/push-ebp - 6829 89/<- %ebp 4/r32/esp - 6830 # setup - 6831 (clear-stream _test-input-stream) - 6832 (clear-stream $_test-input-buffered-file->buffer) - 6833 (clear-stream _test-output-stream) - 6834 (clear-stream $_test-output-buffered-file->buffer) - 6835 (clear-stream _test-error-stream) - 6836 (clear-stream $_test-error-buffered-file->buffer) - 6837 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6838 68/push 0/imm32 - 6839 68/push 0/imm32 - 6840 89/<- %edx 4/r32/esp - 6841 (tailor-exit-descriptor %edx 0x10) - 6842 # - 6843 (write _test-input-stream "fn foo {\n") - 6844 (write _test-input-stream " var x: (handle int)\n") - 6845 (write _test-input-stream " var y/eax: int <- copy x\n") - 6846 (write _test-input-stream "}\n") - 6847 # convert - 6848 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6849 # registers except esp clobbered at this point - 6850 # restore ed - 6851 89/<- %edx 4/r32/esp - 6852 (flush _test-output-buffered-file) - 6853 (flush _test-error-buffered-file) - 6854 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 6860 # check output - 6861 (check-stream-equal _test-output-stream "" "F - test-copy-non-scalar: output should be empty") - 6862 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy: 'x' is too large to fit in a register" "F - test-copy-non-scalar: error message") - 6863 # check that stop(1) was called - 6864 (check-ints-equal *(edx+4) 2 "F - test-copy-non-scalar: exit status") - 6865 # don't restore from ebp - 6866 81 0/subop/add %esp 8/imm32 - 6867 # . epilogue - 6868 5d/pop-to-ebp - 6869 c3/return - 6870 - 6871 test-copy-to-with-no-inout: - 6872 # . prologue - 6873 55/push-ebp - 6874 89/<- %ebp 4/r32/esp - 6875 # setup - 6876 (clear-stream _test-input-stream) - 6877 (clear-stream $_test-input-buffered-file->buffer) - 6878 (clear-stream _test-output-stream) - 6879 (clear-stream $_test-output-buffered-file->buffer) - 6880 (clear-stream _test-error-stream) - 6881 (clear-stream $_test-error-buffered-file->buffer) - 6882 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6883 68/push 0/imm32 - 6884 68/push 0/imm32 - 6885 89/<- %edx 4/r32/esp - 6886 (tailor-exit-descriptor %edx 0x10) - 6887 # - 6888 (write _test-input-stream "fn foo {\n") - 6889 (write _test-input-stream " copy-to\n") - 6890 (write _test-input-stream "}\n") - 6891 # convert - 6892 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6893 # registers except esp clobbered at this point - 6894 # restore ed - 6895 89/<- %edx 4/r32/esp - 6896 (flush _test-output-buffered-file) - 6897 (flush _test-error-buffered-file) - 6898 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 6904 # check output - 6905 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-no-inout: output should be empty") - 6906 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-to' must have two inouts" "F - test-copy-to-with-no-inout: error message") - 6907 # check that stop(1) was called - 6908 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-no-inout: exit status") - 6909 # don't restore from ebp - 6910 81 0/subop/add %esp 8/imm32 - 6911 # . epilogue - 6912 5d/pop-to-ebp - 6913 c3/return - 6914 - 6915 test-copy-to-with-no-input: - 6916 # . prologue - 6917 55/push-ebp - 6918 89/<- %ebp 4/r32/esp - 6919 # setup - 6920 (clear-stream _test-input-stream) - 6921 (clear-stream $_test-input-buffered-file->buffer) - 6922 (clear-stream _test-output-stream) - 6923 (clear-stream $_test-output-buffered-file->buffer) - 6924 (clear-stream _test-error-stream) - 6925 (clear-stream $_test-error-buffered-file->buffer) - 6926 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6927 68/push 0/imm32 - 6928 68/push 0/imm32 - 6929 89/<- %edx 4/r32/esp - 6930 (tailor-exit-descriptor %edx 0x10) - 6931 # - 6932 (write _test-input-stream "fn foo {\n") - 6933 (write _test-input-stream " var x: boolean\n") - 6934 (write _test-input-stream " copy-to x\n") - 6935 (write _test-input-stream "}\n") - 6936 # convert - 6937 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6938 # registers except esp clobbered at this point - 6939 # restore ed - 6940 89/<- %edx 4/r32/esp - 6941 (flush _test-output-buffered-file) - 6942 (flush _test-error-buffered-file) - 6943 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 6949 # check output - 6950 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-no-input: output should be empty") - 6951 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-to' must have two inouts" "F - test-copy-to-with-no-input: error message") - 6952 # check that stop(1) was called - 6953 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-no-input: exit status") - 6954 # don't restore from ebp - 6955 81 0/subop/add %esp 8/imm32 - 6956 # . epilogue - 6957 5d/pop-to-ebp - 6958 c3/return - 6959 - 6960 test-copy-to-with-no-register: - 6961 # . prologue - 6962 55/push-ebp - 6963 89/<- %ebp 4/r32/esp - 6964 # setup - 6965 (clear-stream _test-input-stream) - 6966 (clear-stream $_test-input-buffered-file->buffer) - 6967 (clear-stream _test-output-stream) - 6968 (clear-stream $_test-output-buffered-file->buffer) - 6969 (clear-stream _test-error-stream) - 6970 (clear-stream $_test-error-buffered-file->buffer) - 6971 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 6972 68/push 0/imm32 - 6973 68/push 0/imm32 - 6974 89/<- %edx 4/r32/esp - 6975 (tailor-exit-descriptor %edx 0x10) - 6976 # - 6977 (write _test-input-stream "fn foo {\n") - 6978 (write _test-input-stream " var x: boolean\n") - 6979 (write _test-input-stream " copy-to x, x\n") - 6980 (write _test-input-stream "}\n") - 6981 # convert - 6982 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 6983 # registers except esp clobbered at this point - 6984 # restore ed - 6985 89/<- %edx 4/r32/esp - 6986 (flush _test-output-buffered-file) - 6987 (flush _test-error-buffered-file) - 6988 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 6994 # check output - 6995 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-no-register: output should be empty") - 6996 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-to: source (second inout) is in memory" "F - test-copy-to-with-no-register: error message") - 6997 # check that stop(1) was called - 6998 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-no-register: exit status") - 6999 # don't restore from ebp - 7000 81 0/subop/add %esp 8/imm32 - 7001 # . epilogue - 7002 5d/pop-to-ebp - 7003 c3/return - 7004 - 7005 test-copy-to-with-too-many-inouts: - 7006 # . prologue - 7007 55/push-ebp - 7008 89/<- %ebp 4/r32/esp - 7009 # setup - 7010 (clear-stream _test-input-stream) - 7011 (clear-stream $_test-input-buffered-file->buffer) - 7012 (clear-stream _test-output-stream) - 7013 (clear-stream $_test-output-buffered-file->buffer) - 7014 (clear-stream _test-error-stream) - 7015 (clear-stream $_test-error-buffered-file->buffer) - 7016 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7017 68/push 0/imm32 - 7018 68/push 0/imm32 - 7019 89/<- %edx 4/r32/esp - 7020 (tailor-exit-descriptor %edx 0x10) - 7021 # - 7022 (write _test-input-stream "fn foo {\n") - 7023 (write _test-input-stream " var x: boolean\n") - 7024 (write _test-input-stream " copy-to x, 0, 0\n") - 7025 (write _test-input-stream "}\n") - 7026 # convert - 7027 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7028 # registers except esp clobbered at this point - 7029 # restore ed - 7030 89/<- %edx 4/r32/esp - 7031 (flush _test-output-buffered-file) - 7032 (flush _test-error-buffered-file) - 7033 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7039 # check output - 7040 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-too-many-inouts: output should be empty") - 7041 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-to' must have two inouts" "F - test-copy-to-with-too-many-inouts: error message") - 7042 # check that stop(1) was called - 7043 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-too-many-inouts: exit status") - 7044 # don't restore from ebp - 7045 81 0/subop/add %esp 8/imm32 - 7046 # . epilogue - 7047 5d/pop-to-ebp - 7048 c3/return - 7049 - 7050 test-copy-to-with-output: - 7051 # . prologue - 7052 55/push-ebp - 7053 89/<- %ebp 4/r32/esp - 7054 # setup - 7055 (clear-stream _test-input-stream) - 7056 (clear-stream $_test-input-buffered-file->buffer) - 7057 (clear-stream _test-output-stream) - 7058 (clear-stream $_test-output-buffered-file->buffer) - 7059 (clear-stream _test-error-stream) - 7060 (clear-stream $_test-error-buffered-file->buffer) - 7061 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7062 68/push 0/imm32 - 7063 68/push 0/imm32 - 7064 89/<- %edx 4/r32/esp - 7065 (tailor-exit-descriptor %edx 0x10) - 7066 # - 7067 (write _test-input-stream "fn foo {\n") - 7068 (write _test-input-stream " var x/eax: boolean <- copy 0\n") - 7069 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") - 7070 (write _test-input-stream " x <- copy-to y, 0\n") - 7071 (write _test-input-stream "}\n") - 7072 # convert - 7073 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7074 # registers except esp clobbered at this point - 7075 # restore ed - 7076 89/<- %edx 4/r32/esp - 7077 (flush _test-output-buffered-file) - 7078 (flush _test-error-buffered-file) - 7079 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7085 # check output - 7086 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-output: output should be empty") - 7087 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-to' must not have any outputs" "F - test-copy-to-with-output: error message") - 7088 # check that stop(1) was called - 7089 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-output: exit status") - 7090 # don't restore from ebp - 7091 81 0/subop/add %esp 8/imm32 - 7092 # . epilogue - 7093 5d/pop-to-ebp - 7094 c3/return - 7095 - 7096 test-copy-to-invalid-value-to-address: - 7097 # . prologue - 7098 55/push-ebp - 7099 89/<- %ebp 4/r32/esp - 7100 # setup - 7101 (clear-stream _test-input-stream) - 7102 (clear-stream $_test-input-buffered-file->buffer) - 7103 (clear-stream _test-output-stream) - 7104 (clear-stream $_test-output-buffered-file->buffer) - 7105 (clear-stream _test-error-stream) - 7106 (clear-stream $_test-error-buffered-file->buffer) - 7107 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7108 68/push 0/imm32 - 7109 68/push 0/imm32 - 7110 89/<- %edx 4/r32/esp - 7111 (tailor-exit-descriptor %edx 0x10) - 7112 # - 7113 (write _test-input-stream "fn foo {\n") - 7114 (write _test-input-stream " var x/eax: int <- copy 0\n") - 7115 (write _test-input-stream " var y: (addr int)\n") - 7116 (write _test-input-stream " copy-to y, x\n") - 7117 (write _test-input-stream "}\n") - 7118 # convert - 7119 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7120 # registers except esp clobbered at this point - 7121 # restore ed - 7122 89/<- %edx 4/r32/esp - 7123 (flush _test-output-buffered-file) - 7124 (flush _test-error-buffered-file) - 7125 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7131 # check output - 7132 (check-stream-equal _test-output-stream "" "F - test-copy-to-invalid-value-to-address: output should be empty") - 7133 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-to: 'y' must be a non-addr scalar" "F - test-copy-to-invalid-value-to-address: error message") - 7134 # check that stop(1) was called - 7135 (check-ints-equal *(edx+4) 2 "F - test-copy-to-invalid-value-to-address: exit status") - 7136 # don't restore from ebp - 7137 81 0/subop/add %esp 8/imm32 - 7138 # . epilogue - 7139 5d/pop-to-ebp - 7140 c3/return - 7141 - 7142 test-copy-to-deref-address: - 7143 # . prologue - 7144 55/push-ebp - 7145 89/<- %ebp 4/r32/esp - 7146 # setup - 7147 (clear-stream _test-input-stream) - 7148 (clear-stream $_test-input-buffered-file->buffer) - 7149 (clear-stream _test-output-stream) - 7150 (clear-stream $_test-output-buffered-file->buffer) - 7151 # - 7152 (write _test-input-stream "fn foo {\n") - 7153 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") - 7154 (write _test-input-stream " var y/ecx: (addr addr int) <- copy 0\n") - 7155 (write _test-input-stream " copy-to *y, x\n") - 7156 (write _test-input-stream "}\n") - 7157 # convert - 7158 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 7159 (flush _test-output-buffered-file) - 7160 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7166 # not bothering checking output - 7167 (check-next-stream-line-equal _test-error-stream "" "F - test-copy-to-deref-address: error message") - 7168 # . epilogue - 7169 5d/pop-to-ebp - 7170 c3/return - 7171 - 7172 test-copy-to-non-scalar: - 7173 # . prologue - 7174 55/push-ebp - 7175 89/<- %ebp 4/r32/esp - 7176 # setup - 7177 (clear-stream _test-input-stream) - 7178 (clear-stream $_test-input-buffered-file->buffer) - 7179 (clear-stream _test-output-stream) - 7180 (clear-stream $_test-output-buffered-file->buffer) - 7181 (clear-stream _test-error-stream) - 7182 (clear-stream $_test-error-buffered-file->buffer) - 7183 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7184 68/push 0/imm32 - 7185 68/push 0/imm32 - 7186 89/<- %edx 4/r32/esp - 7187 (tailor-exit-descriptor %edx 0x10) - 7188 # - 7189 (write _test-input-stream "fn foo {\n") - 7190 (write _test-input-stream " var x: (handle int)\n") - 7191 (write _test-input-stream " var y: int\n") - 7192 (write _test-input-stream " copy-to y, x\n") - 7193 (write _test-input-stream "}\n") - 7194 # convert - 7195 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7196 # registers except esp clobbered at this point - 7197 # restore ed - 7198 89/<- %edx 4/r32/esp - 7199 (flush _test-output-buffered-file) - 7200 (flush _test-error-buffered-file) - 7201 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7207 # check output - 7208 (check-stream-equal _test-output-stream "" "F - test-copy-to-non-scalar: output should be empty") - 7209 #? (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-to: 'x' is too large to copy" "F - test-copy-to-non-scalar: error message") - 7210 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-to: source (second inout) is in memory" "F - test-copy-to-non-scalar: error message") - 7211 # check that stop(1) was called - 7212 (check-ints-equal *(edx+4) 2 "F - test-copy-to-non-scalar: exit status") - 7213 # don't restore from ebp - 7214 81 0/subop/add %esp 8/imm32 - 7215 # . epilogue - 7216 5d/pop-to-ebp - 7217 c3/return - 7218 - 7219 test-compare-with-no-inout: - 7220 # . prologue - 7221 55/push-ebp - 7222 89/<- %ebp 4/r32/esp - 7223 # setup - 7224 (clear-stream _test-input-stream) - 7225 (clear-stream $_test-input-buffered-file->buffer) - 7226 (clear-stream _test-output-stream) - 7227 (clear-stream $_test-output-buffered-file->buffer) - 7228 (clear-stream _test-error-stream) - 7229 (clear-stream $_test-error-buffered-file->buffer) - 7230 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7231 68/push 0/imm32 - 7232 68/push 0/imm32 - 7233 89/<- %edx 4/r32/esp - 7234 (tailor-exit-descriptor %edx 0x10) - 7235 # - 7236 (write _test-input-stream "fn foo {\n") - 7237 (write _test-input-stream " var x: boolean\n") - 7238 (write _test-input-stream " compare\n") - 7239 (write _test-input-stream "}\n") - 7240 # convert - 7241 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7242 # registers except esp clobbered at this point - 7243 # restore ed - 7244 89/<- %edx 4/r32/esp - 7245 (flush _test-output-buffered-file) - 7246 (flush _test-error-buffered-file) - 7247 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7253 # check output - 7254 (check-stream-equal _test-output-stream "" "F - test-compare-with-no-inout: output should be empty") - 7255 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'compare' must have two inouts" "F - test-compare-with-no-inout: error message") - 7256 # check that stop(1) was called - 7257 (check-ints-equal *(edx+4) 2 "F - test-compare-with-no-inout: exit status") - 7258 # don't restore from ebp - 7259 81 0/subop/add %esp 8/imm32 - 7260 # . epilogue - 7261 5d/pop-to-ebp - 7262 c3/return - 7263 - 7264 test-compare-with-no-input: - 7265 # . prologue - 7266 55/push-ebp - 7267 89/<- %ebp 4/r32/esp - 7268 # setup - 7269 (clear-stream _test-input-stream) - 7270 (clear-stream $_test-input-buffered-file->buffer) - 7271 (clear-stream _test-output-stream) - 7272 (clear-stream $_test-output-buffered-file->buffer) - 7273 (clear-stream _test-error-stream) - 7274 (clear-stream $_test-error-buffered-file->buffer) - 7275 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7276 68/push 0/imm32 - 7277 68/push 0/imm32 - 7278 89/<- %edx 4/r32/esp - 7279 (tailor-exit-descriptor %edx 0x10) - 7280 # - 7281 (write _test-input-stream "fn foo {\n") - 7282 (write _test-input-stream " var x: boolean\n") - 7283 (write _test-input-stream " compare x\n") - 7284 (write _test-input-stream "}\n") - 7285 # convert - 7286 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7287 # registers except esp clobbered at this point - 7288 # restore ed - 7289 89/<- %edx 4/r32/esp - 7290 (flush _test-output-buffered-file) - 7291 (flush _test-error-buffered-file) - 7292 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7298 # check output - 7299 (check-stream-equal _test-output-stream "" "F - test-compare-with-no-input: output should be empty") - 7300 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'compare' must have two inouts" "F - test-compare-with-no-input: error message") - 7301 # check that stop(1) was called - 7302 (check-ints-equal *(edx+4) 2 "F - test-compare-with-no-input: exit status") - 7303 # don't restore from ebp - 7304 81 0/subop/add %esp 8/imm32 - 7305 # . epilogue - 7306 5d/pop-to-ebp - 7307 c3/return - 7308 - 7309 test-compare-with-too-many-inouts: - 7310 # . prologue - 7311 55/push-ebp - 7312 89/<- %ebp 4/r32/esp - 7313 # setup - 7314 (clear-stream _test-input-stream) - 7315 (clear-stream $_test-input-buffered-file->buffer) - 7316 (clear-stream _test-output-stream) - 7317 (clear-stream $_test-output-buffered-file->buffer) - 7318 (clear-stream _test-error-stream) - 7319 (clear-stream $_test-error-buffered-file->buffer) - 7320 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7321 68/push 0/imm32 - 7322 68/push 0/imm32 - 7323 89/<- %edx 4/r32/esp - 7324 (tailor-exit-descriptor %edx 0x10) - 7325 # - 7326 (write _test-input-stream "fn foo {\n") - 7327 (write _test-input-stream " var x: boolean\n") - 7328 (write _test-input-stream " compare x, 0, 0\n") - 7329 (write _test-input-stream "}\n") - 7330 # convert - 7331 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7332 # registers except esp clobbered at this point - 7333 # restore ed - 7334 89/<- %edx 4/r32/esp - 7335 (flush _test-output-buffered-file) - 7336 (flush _test-error-buffered-file) - 7337 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7343 # check output - 7344 (check-stream-equal _test-output-stream "" "F - test-compare-with-too-many-inouts: output should be empty") - 7345 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'compare' must have two inouts" "F - test-compare-with-too-many-inouts: error message") - 7346 # check that stop(1) was called - 7347 (check-ints-equal *(edx+4) 2 "F - test-compare-with-too-many-inouts: exit status") - 7348 # don't restore from ebp - 7349 81 0/subop/add %esp 8/imm32 - 7350 # . epilogue - 7351 5d/pop-to-ebp - 7352 c3/return - 7353 - 7354 test-compare-with-output: - 7355 # . prologue - 7356 55/push-ebp - 7357 89/<- %ebp 4/r32/esp - 7358 # setup - 7359 (clear-stream _test-input-stream) - 7360 (clear-stream $_test-input-buffered-file->buffer) - 7361 (clear-stream _test-output-stream) - 7362 (clear-stream $_test-output-buffered-file->buffer) - 7363 (clear-stream _test-error-stream) - 7364 (clear-stream $_test-error-buffered-file->buffer) - 7365 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7366 68/push 0/imm32 - 7367 68/push 0/imm32 - 7368 89/<- %edx 4/r32/esp - 7369 (tailor-exit-descriptor %edx 0x10) - 7370 # - 7371 (write _test-input-stream "fn foo {\n") - 7372 (write _test-input-stream " var x/eax: boolean <- copy 0\n") - 7373 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") - 7374 (write _test-input-stream " x <- compare y, 0\n") - 7375 (write _test-input-stream "}\n") - 7376 # convert - 7377 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7378 # registers except esp clobbered at this point - 7379 # restore ed - 7380 89/<- %edx 4/r32/esp - 7381 (flush _test-output-buffered-file) - 7382 (flush _test-error-buffered-file) - 7383 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7389 # check output - 7390 (check-stream-equal _test-output-stream "" "F - test-compare-with-output: output should be empty") - 7391 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'compare' must not have any outputs" "F - test-compare-with-output: error message") - 7392 # check that stop(1) was called - 7393 (check-ints-equal *(edx+4) 2 "F - test-compare-with-output: exit status") - 7394 # don't restore from ebp - 7395 81 0/subop/add %esp 8/imm32 - 7396 # . epilogue - 7397 5d/pop-to-ebp - 7398 c3/return - 7399 - 7400 test-compare-invalid-value-to-address: - 7401 # . prologue - 7402 55/push-ebp - 7403 89/<- %ebp 4/r32/esp - 7404 # setup - 7405 (clear-stream _test-input-stream) - 7406 (clear-stream $_test-input-buffered-file->buffer) - 7407 (clear-stream _test-output-stream) - 7408 (clear-stream $_test-output-buffered-file->buffer) - 7409 (clear-stream _test-error-stream) - 7410 (clear-stream $_test-error-buffered-file->buffer) - 7411 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7412 68/push 0/imm32 - 7413 68/push 0/imm32 - 7414 89/<- %edx 4/r32/esp - 7415 (tailor-exit-descriptor %edx 0x10) - 7416 # - 7417 (write _test-input-stream "fn foo {\n") - 7418 (write _test-input-stream " var x/eax: int <- copy 0\n") - 7419 (write _test-input-stream " var y: (addr int)\n") - 7420 (write _test-input-stream " compare y, x\n") - 7421 (write _test-input-stream "}\n") - 7422 # convert - 7423 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7424 # registers except esp clobbered at this point - 7425 # restore ed - 7426 89/<- %edx 4/r32/esp - 7427 (flush _test-output-buffered-file) - 7428 (flush _test-error-buffered-file) - 7429 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7435 # check output - 7436 (check-stream-equal _test-output-stream "" "F - test-compare-invalid-value-to-address: output should be empty") - 7437 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compare: 'y' must be a non-addr scalar" "F - test-compare-invalid-value-to-address: error message") - 7438 # check that stop(1) was called - 7439 (check-ints-equal *(edx+4) 2 "F - test-compare-invalid-value-to-address: exit status") - 7440 # don't restore from ebp - 7441 81 0/subop/add %esp 8/imm32 - 7442 # . epilogue - 7443 5d/pop-to-ebp - 7444 c3/return - 7445 - 7446 test-compare-address: - 7447 # . prologue - 7448 55/push-ebp - 7449 89/<- %ebp 4/r32/esp - 7450 # setup - 7451 (clear-stream _test-input-stream) - 7452 (clear-stream $_test-input-buffered-file->buffer) - 7453 (clear-stream _test-output-stream) - 7454 (clear-stream $_test-output-buffered-file->buffer) - 7455 # - 7456 (write _test-input-stream "fn foo {\n") - 7457 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") - 7458 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") - 7459 (write _test-input-stream " compare y, x\n") - 7460 (write _test-input-stream "}\n") - 7461 # convert - 7462 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 7463 (flush _test-output-buffered-file) - 7464 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7470 # not bothering checking output - 7471 (check-next-stream-line-equal _test-error-stream "" "F - test-compare-address: error message") - 7472 # . epilogue - 7473 5d/pop-to-ebp - 7474 c3/return - 7475 - 7476 test-compare-deref-address: - 7477 # . prologue - 7478 55/push-ebp - 7479 89/<- %ebp 4/r32/esp - 7480 # setup - 7481 (clear-stream _test-input-stream) - 7482 (clear-stream $_test-input-buffered-file->buffer) - 7483 (clear-stream _test-output-stream) - 7484 (clear-stream $_test-output-buffered-file->buffer) - 7485 # - 7486 (write _test-input-stream "fn foo {\n") - 7487 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") - 7488 (write _test-input-stream " var y/ecx: (addr addr int) <- copy 0\n") - 7489 (write _test-input-stream " compare *y, x\n") - 7490 (write _test-input-stream "}\n") - 7491 # convert - 7492 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 7493 (flush _test-output-buffered-file) - 7494 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7500 # not bothering checking output - 7501 (check-next-stream-line-equal _test-error-stream "" "F - test-compare-deref-address: error message") - 7502 # . epilogue - 7503 5d/pop-to-ebp - 7504 c3/return - 7505 - 7506 test-compare-two-vars-in-memory: - 7507 # . prologue - 7508 55/push-ebp - 7509 89/<- %ebp 4/r32/esp - 7510 # setup - 7511 (clear-stream _test-input-stream) - 7512 (clear-stream $_test-input-buffered-file->buffer) - 7513 (clear-stream _test-output-stream) - 7514 (clear-stream $_test-output-buffered-file->buffer) - 7515 (clear-stream _test-error-stream) - 7516 (clear-stream $_test-error-buffered-file->buffer) - 7517 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7518 68/push 0/imm32 - 7519 68/push 0/imm32 - 7520 89/<- %edx 4/r32/esp - 7521 (tailor-exit-descriptor %edx 0x10) - 7522 # - 7523 (write _test-input-stream "fn foo {\n") - 7524 (write _test-input-stream " var x: boolean\n") - 7525 (write _test-input-stream " compare x, x\n") - 7526 (write _test-input-stream "}\n") - 7527 # convert - 7528 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7529 # registers except esp clobbered at this point - 7530 # restore ed - 7531 89/<- %edx 4/r32/esp - 7532 (flush _test-output-buffered-file) - 7533 (flush _test-error-buffered-file) - 7534 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7540 # check output - 7541 (check-stream-equal _test-output-stream "" "F - test-compare-two-vars-in-memory: output should be empty") - 7542 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compare: both inouts are in memory" "F - test-compare-two-vars-in-memory: error message") - 7543 # check that stop(1) was called - 7544 (check-ints-equal *(edx+4) 2 "F - test-compare-two-vars-in-memory: exit status") - 7545 # don't restore from ebp - 7546 81 0/subop/add %esp 8/imm32 - 7547 # . epilogue - 7548 5d/pop-to-ebp - 7549 c3/return - 7550 - 7551 test-compare-non-scalar: - 7552 # . prologue - 7553 55/push-ebp - 7554 89/<- %ebp 4/r32/esp - 7555 # setup - 7556 (clear-stream _test-input-stream) - 7557 (clear-stream $_test-input-buffered-file->buffer) - 7558 (clear-stream _test-output-stream) - 7559 (clear-stream $_test-output-buffered-file->buffer) - 7560 (clear-stream _test-error-stream) - 7561 (clear-stream $_test-error-buffered-file->buffer) - 7562 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7563 68/push 0/imm32 - 7564 68/push 0/imm32 - 7565 89/<- %edx 4/r32/esp - 7566 (tailor-exit-descriptor %edx 0x10) - 7567 # - 7568 (write _test-input-stream "fn foo {\n") - 7569 (write _test-input-stream " var x: (handle int)\n") - 7570 (write _test-input-stream " var y: int\n") - 7571 (write _test-input-stream " compare y, x\n") - 7572 (write _test-input-stream "}\n") - 7573 # convert - 7574 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7575 # registers except esp clobbered at this point - 7576 # restore ed - 7577 89/<- %edx 4/r32/esp - 7578 (flush _test-output-buffered-file) - 7579 (flush _test-error-buffered-file) - 7580 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7586 # check output - 7587 (check-stream-equal _test-output-stream "" "F - test-compare-non-scalar: output should be empty") - 7588 #? (check-next-stream-line-equal _test-error-stream "fn foo: stmt compare: 'x' is too large to compare" "F - test-compare-non-scalar: error message") - 7589 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compare: both inouts are in memory" "F - test-compare-non-scalar: error message") - 7590 # check that stop(1) was called - 7591 (check-ints-equal *(edx+4) 2 "F - test-compare-non-scalar: exit status") - 7592 # don't restore from ebp - 7593 81 0/subop/add %esp 8/imm32 - 7594 # . epilogue - 7595 5d/pop-to-ebp - 7596 c3/return - 7597 - 7598 test-address-with-no-inout: - 7599 # . prologue - 7600 55/push-ebp - 7601 89/<- %ebp 4/r32/esp - 7602 # setup - 7603 (clear-stream _test-input-stream) - 7604 (clear-stream $_test-input-buffered-file->buffer) - 7605 (clear-stream _test-output-stream) - 7606 (clear-stream $_test-output-buffered-file->buffer) - 7607 (clear-stream _test-error-stream) - 7608 (clear-stream $_test-error-buffered-file->buffer) - 7609 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7610 68/push 0/imm32 - 7611 68/push 0/imm32 - 7612 89/<- %edx 4/r32/esp - 7613 (tailor-exit-descriptor %edx 0x10) - 7614 # - 7615 (write _test-input-stream "fn foo {\n") - 7616 (write _test-input-stream " var x/eax: boolean <- address\n") - 7617 (write _test-input-stream "}\n") - 7618 # convert - 7619 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7620 # registers except esp clobbered at this point - 7621 # restore ed - 7622 89/<- %edx 4/r32/esp - 7623 (flush _test-output-buffered-file) - 7624 (flush _test-error-buffered-file) - 7625 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7631 # check output - 7632 (check-stream-equal _test-output-stream "" "F - test-address-with-no-inout: output should be empty") - 7633 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'address' expects an inout" "F - test-address-with-no-inout: error message") - 7634 # check that stop(1) was called - 7635 (check-ints-equal *(edx+4) 2 "F - test-address-with-no-inout: exit status") - 7636 # don't restore from ebp - 7637 81 0/subop/add %esp 8/imm32 - 7638 # . epilogue - 7639 5d/pop-to-ebp - 7640 c3/return - 7641 - 7642 test-address-with-multiple-inouts: - 7643 # . prologue - 7644 55/push-ebp - 7645 89/<- %ebp 4/r32/esp - 7646 # setup - 7647 (clear-stream _test-input-stream) - 7648 (clear-stream $_test-input-buffered-file->buffer) - 7649 (clear-stream _test-output-stream) - 7650 (clear-stream $_test-output-buffered-file->buffer) - 7651 (clear-stream _test-error-stream) - 7652 (clear-stream $_test-error-buffered-file->buffer) - 7653 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7654 68/push 0/imm32 - 7655 68/push 0/imm32 - 7656 89/<- %edx 4/r32/esp - 7657 (tailor-exit-descriptor %edx 0x10) - 7658 # - 7659 (write _test-input-stream "fn foo {\n") - 7660 (write _test-input-stream " var x/eax: boolean <- address 0, 0\n") - 7661 (write _test-input-stream "}\n") - 7662 # convert - 7663 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7664 # registers except esp clobbered at this point - 7665 # restore ed - 7666 89/<- %edx 4/r32/esp - 7667 (flush _test-output-buffered-file) - 7668 (flush _test-error-buffered-file) - 7669 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7675 # check output - 7676 (check-stream-equal _test-output-stream "" "F - test-address-with-multiple-inouts: output should be empty") - 7677 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'address' must have just one inout" "F - test-address-with-multiple-inouts: error message") - 7678 # check that stop(1) was called - 7679 (check-ints-equal *(edx+4) 2 "F - test-address-with-multiple-inouts: exit status") - 7680 # don't restore from ebp - 7681 81 0/subop/add %esp 8/imm32 - 7682 # . epilogue - 7683 5d/pop-to-ebp - 7684 c3/return - 7685 - 7686 test-address-with-no-output: - 7687 # . prologue - 7688 55/push-ebp - 7689 89/<- %ebp 4/r32/esp - 7690 # setup - 7691 (clear-stream _test-input-stream) - 7692 (clear-stream $_test-input-buffered-file->buffer) - 7693 (clear-stream _test-output-stream) - 7694 (clear-stream $_test-output-buffered-file->buffer) - 7695 (clear-stream _test-error-stream) - 7696 (clear-stream $_test-error-buffered-file->buffer) - 7697 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7698 68/push 0/imm32 - 7699 68/push 0/imm32 - 7700 89/<- %edx 4/r32/esp - 7701 (tailor-exit-descriptor %edx 0x10) - 7702 # - 7703 (write _test-input-stream "fn foo {\n") - 7704 (write _test-input-stream " address 0\n") - 7705 (write _test-input-stream "}\n") - 7706 # convert - 7707 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7708 # registers except esp clobbered at this point - 7709 # restore ed - 7710 89/<- %edx 4/r32/esp - 7711 (flush _test-output-buffered-file) - 7712 (flush _test-error-buffered-file) - 7713 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7719 # check output - 7720 (check-stream-equal _test-output-stream "" "F - test-address-with-no-output: output should be empty") - 7721 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'address' expects an output" "F - test-address-with-no-output: error message") - 7722 # check that stop(1) was called - 7723 (check-ints-equal *(edx+4) 2 "F - test-address-with-no-output: exit status") - 7724 # don't restore from ebp - 7725 81 0/subop/add %esp 8/imm32 - 7726 # . epilogue - 7727 5d/pop-to-ebp - 7728 c3/return - 7729 - 7730 test-address-with-multiple-outputs: - 7731 # . prologue - 7732 55/push-ebp - 7733 89/<- %ebp 4/r32/esp - 7734 # setup - 7735 (clear-stream _test-input-stream) - 7736 (clear-stream $_test-input-buffered-file->buffer) - 7737 (clear-stream _test-output-stream) - 7738 (clear-stream $_test-output-buffered-file->buffer) - 7739 (clear-stream _test-error-stream) - 7740 (clear-stream $_test-error-buffered-file->buffer) - 7741 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7742 68/push 0/imm32 - 7743 68/push 0/imm32 - 7744 89/<- %edx 4/r32/esp - 7745 (tailor-exit-descriptor %edx 0x10) - 7746 # - 7747 (write _test-input-stream "fn foo {\n") - 7748 (write _test-input-stream " var x/eax: boolean <- copy 0\n") - 7749 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") - 7750 (write _test-input-stream " x, y <- address 0\n") - 7751 (write _test-input-stream "}\n") - 7752 # convert - 7753 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7754 # registers except esp clobbered at this point - 7755 # restore ed - 7756 89/<- %edx 4/r32/esp - 7757 (flush _test-output-buffered-file) - 7758 (flush _test-error-buffered-file) - 7759 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7765 # check output - 7766 (check-stream-equal _test-output-stream "" "F - test-address-with-multiple-outputs: output should be empty") - 7767 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'address' must have just one output" "F - test-address-with-multiple-outputs: error message") - 7768 # check that stop(1) was called - 7769 (check-ints-equal *(edx+4) 2 "F - test-address-with-multiple-outputs: exit status") - 7770 # don't restore from ebp - 7771 81 0/subop/add %esp 8/imm32 - 7772 # . epilogue - 7773 5d/pop-to-ebp - 7774 c3/return - 7775 - 7776 # silly but it works - 7777 test-address-of-deref: - 7778 # . prologue - 7779 55/push-ebp - 7780 89/<- %ebp 4/r32/esp - 7781 # setup - 7782 (clear-stream _test-input-stream) - 7783 (clear-stream $_test-input-buffered-file->buffer) - 7784 (clear-stream _test-output-stream) - 7785 (clear-stream $_test-output-buffered-file->buffer) - 7786 # - 7787 (write _test-input-stream "fn foo {\n") - 7788 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") - 7789 (write _test-input-stream " var y/ecx: (addr int) <- address *x\n") - 7790 (write _test-input-stream "}\n") - 7791 # convert - 7792 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 7793 (flush _test-output-buffered-file) - 7794 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7800 # not bothering checking output - 7801 (check-next-stream-line-equal _test-error-stream "" "F - test-address-of-deref: error message") - 7802 # . epilogue - 7803 5d/pop-to-ebp - 7804 c3/return - 7805 - 7806 test-address-to-non-register: - 7807 # . prologue - 7808 55/push-ebp - 7809 89/<- %ebp 4/r32/esp - 7810 # setup - 7811 (clear-stream _test-input-stream) - 7812 (clear-stream $_test-input-buffered-file->buffer) - 7813 (clear-stream _test-output-stream) - 7814 (clear-stream $_test-output-buffered-file->buffer) - 7815 (clear-stream _test-error-stream) - 7816 (clear-stream $_test-error-buffered-file->buffer) - 7817 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7818 68/push 0/imm32 - 7819 68/push 0/imm32 - 7820 89/<- %edx 4/r32/esp - 7821 (tailor-exit-descriptor %edx 0x10) - 7822 # - 7823 (write _test-input-stream "fn foo {\n") - 7824 (write _test-input-stream " var x: (addr int)\n") - 7825 (write _test-input-stream " x <- address 0\n") - 7826 (write _test-input-stream "}\n") - 7827 # convert - 7828 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7829 # registers except esp clobbered at this point - 7830 # restore ed - 7831 89/<- %edx 4/r32/esp - 7832 (flush _test-output-buffered-file) - 7833 (flush _test-error-buffered-file) - 7834 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7840 # check output - 7841 (check-stream-equal _test-output-stream "" "F - test-address-to-non-register: output should be empty") - 7842 (check-next-stream-line-equal _test-error-stream "fn foo: stmt address: output 'x' not in a register" "F - test-address-to-non-register: error message") - 7843 # check that stop(1) was called - 7844 (check-ints-equal *(edx+4) 2 "F - test-address-to-non-register: exit status") - 7845 # don't restore from ebp - 7846 81 0/subop/add %esp 8/imm32 - 7847 # . epilogue - 7848 5d/pop-to-ebp - 7849 c3/return - 7850 - 7851 test-address-with-wrong-type: - 7852 # . prologue - 7853 55/push-ebp - 7854 89/<- %ebp 4/r32/esp - 7855 # setup - 7856 (clear-stream _test-input-stream) - 7857 (clear-stream $_test-input-buffered-file->buffer) - 7858 (clear-stream _test-output-stream) - 7859 (clear-stream $_test-output-buffered-file->buffer) - 7860 (clear-stream _test-error-stream) - 7861 (clear-stream $_test-error-buffered-file->buffer) - 7862 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7863 68/push 0/imm32 - 7864 68/push 0/imm32 - 7865 89/<- %edx 4/r32/esp - 7866 (tailor-exit-descriptor %edx 0x10) - 7867 # - 7868 (write _test-input-stream "fn foo {\n") - 7869 (write _test-input-stream " var x: int\n") - 7870 (write _test-input-stream " var y/eax: (addr boolean) <- address x\n") - 7871 (write _test-input-stream "}\n") - 7872 # convert - 7873 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7874 # registers except esp clobbered at this point - 7875 # restore ed - 7876 89/<- %edx 4/r32/esp - 7877 (flush _test-output-buffered-file) - 7878 (flush _test-error-buffered-file) - 7879 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7885 # check output - 7886 (check-stream-equal _test-output-stream "" "F - test-address-with-wrong-type: output should be empty") - 7887 (check-next-stream-line-equal _test-error-stream "fn foo: stmt address: output 'y' cannot hold address of 'x'" "F - test-address-with-wrong-type: error message") - 7888 # check that stop(1) was called - 7889 (check-ints-equal *(edx+4) 2 "F - test-address-with-wrong-type: exit status") - 7890 # don't restore from ebp - 7891 81 0/subop/add %esp 8/imm32 - 7892 # . epilogue - 7893 5d/pop-to-ebp - 7894 c3/return - 7895 - 7896 test-address-with-right-type-for-array: - 7897 # . prologue - 7898 55/push-ebp - 7899 89/<- %ebp 4/r32/esp - 7900 # setup - 7901 (clear-stream _test-input-stream) - 7902 (clear-stream $_test-input-buffered-file->buffer) - 7903 (clear-stream _test-output-stream) - 7904 (clear-stream $_test-output-buffered-file->buffer) - 7905 # - 7906 (write _test-input-stream "fn foo {\n") - 7907 (write _test-input-stream " var x: (array int 3)\n") - 7908 (write _test-input-stream " var y/eax: (addr array int) <- address x\n") - 7909 (write _test-input-stream "}\n") - 7910 # convert - 7911 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 7912 (flush _test-output-buffered-file) - 7913 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7919 # no error - 7920 (check-next-stream-line-equal _test-error-stream "" "F - test-address-with-right-type-for-array: error message") - 7921 # don't bother checking output + 5741 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/12") + 5742 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/13") + 5743 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/14") + 5744 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/15") + 5745 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/16") + 5746 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-on-stack-with-literal/17") + 5747 # . epilogue + 5748 89/<- %esp 5/r32/ebp + 5749 5d/pop-to-ebp + 5750 c3/return + 5751 + 5752 test-convert-index-into-array-using-offset: + 5753 # . prologue + 5754 55/push-ebp + 5755 89/<- %ebp 4/r32/esp + 5756 # setup + 5757 (clear-stream _test-input-stream) + 5758 (clear-stream $_test-input-buffered-file->buffer) + 5759 (clear-stream _test-output-stream) + 5760 (clear-stream $_test-output-buffered-file->buffer) + 5761 # + 5762 (write _test-input-stream "fn foo {\n") + 5763 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 5764 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 5765 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") + 5766 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") + 5767 (write _test-input-stream "}\n") + 5768 # convert + 5769 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5770 (flush _test-output-buffered-file) + 5771 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5777 # check output + 5778 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset/0") + 5779 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset/1") + 5780 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset/2") + 5781 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset/3") + 5782 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset/4") + 5783 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset/5") + 5784 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset/6") + 5785 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-using-offset/7") + 5786 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset/8") + 5787 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-using-offset/9") + 5788 (check-next-stream-line-equal _test-output-stream " 69/multiply %ecx 0x00000004/imm32 0x00000001/r32" "F - test-convert-index-into-array-using-offset/10") + 5789 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-using-offset/11") + 5790 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset/12") + 5791 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset/13") + 5792 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset/14") + 5793 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset/15") + 5794 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset/16") + 5795 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset/17") + 5796 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset/18") + 5797 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset/19") + 5798 # . epilogue + 5799 89/<- %esp 5/r32/ebp + 5800 5d/pop-to-ebp + 5801 c3/return + 5802 + 5803 test-convert-index-into-array-of-bytes-using-offset: + 5804 # . prologue + 5805 55/push-ebp + 5806 89/<- %ebp 4/r32/esp + 5807 # setup + 5808 (clear-stream _test-input-stream) + 5809 (clear-stream $_test-input-buffered-file->buffer) + 5810 (clear-stream _test-output-stream) + 5811 (clear-stream $_test-output-buffered-file->buffer) + 5812 # + 5813 (write _test-input-stream "fn foo {\n") + 5814 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") + 5815 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 5816 (write _test-input-stream " var off/ecx: (offset byte) <- compute-offset arr, idx\n") + 5817 (write _test-input-stream " var x/eax: (addr byte) <- index arr, off\n") + 5818 (write _test-input-stream "}\n") + 5819 # convert + 5820 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5821 (flush _test-output-buffered-file) + 5822 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5828 # check output + 5829 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-using-offset/0") + 5830 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-using-offset/1") + 5831 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-using-offset/2") + 5832 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-using-offset/3") + 5833 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-using-offset/4") + 5834 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-using-offset/5") + 5835 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-using-offset/6") + 5836 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes-using-offset/7") + 5837 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes-using-offset/8") + 5838 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-index-into-array-of-bytes-using-offset/9") + 5839 (check-next-stream-line-equal _test-output-stream " 69/multiply %ecx 0x00000001/imm32 0x00000001/r32" "F - test-convert-index-into-array-of-bytes-using-offset/10") + 5840 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-using-offset/11") + 5841 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes-using-offset/12") + 5842 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-using-offset/13") + 5843 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-using-offset/14") + 5844 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-using-offset/15") + 5845 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-using-offset/16") + 5846 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-using-offset/17") + 5847 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-using-offset/18") + 5848 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-using-offset/19") + 5849 # . epilogue + 5850 89/<- %esp 5/r32/ebp + 5851 5d/pop-to-ebp + 5852 c3/return + 5853 + 5854 test-convert-index-into-array-using-offset-on-stack: + 5855 # . prologue + 5856 55/push-ebp + 5857 89/<- %ebp 4/r32/esp + 5858 # setup + 5859 (clear-stream _test-input-stream) + 5860 (clear-stream $_test-input-buffered-file->buffer) + 5861 (clear-stream _test-output-stream) + 5862 (clear-stream $_test-output-buffered-file->buffer) + 5863 # + 5864 (write _test-input-stream "fn foo {\n") + 5865 (write _test-input-stream " var arr/eax: (addr array int) <- copy 0\n") + 5866 (write _test-input-stream " var idx: int\n") + 5867 (write _test-input-stream " var off/ecx: (offset int) <- compute-offset arr, idx\n") + 5868 (write _test-input-stream " var x/eax: (addr int) <- index arr, off\n") + 5869 (write _test-input-stream "}\n") + 5870 # convert + 5871 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5872 (flush _test-output-buffered-file) + 5873 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5879 # check output + 5880 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-using-offset-on-stack/0") + 5881 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-using-offset-on-stack/1") + 5882 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-using-offset-on-stack/2") + 5883 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-using-offset-on-stack/3") + 5884 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-using-offset-on-stack/4") + 5885 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-using-offset-on-stack/5") + 5886 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-using-offset-on-stack/6") + 5887 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-using-offset-on-stack/7") + 5888 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-index-into-array-using-offset-on-stack/8") + 5889 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-using-offset-on-stack/9") + 5890 (check-next-stream-line-equal _test-output-stream " 69/multiply *(ebp+0xfffffff8) 0x00000004/imm32 0x00000001/r32" "F - test-convert-index-into-array-using-offset-on-stack/10") + 5891 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-using-offset-on-stack/11") + 5892 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-using-offset-on-stack/12") + 5893 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-index-into-array-using-offset-on-stack/13") + 5894 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-using-offset-on-stack/14") + 5895 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-using-offset-on-stack/15") + 5896 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-using-offset-on-stack/16") + 5897 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-using-offset-on-stack/17") + 5898 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-using-offset-on-stack/18") + 5899 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-using-offset-on-stack/19") + 5900 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-using-offset-on-stack/20") + 5901 # . epilogue + 5902 89/<- %esp 5/r32/ebp + 5903 5d/pop-to-ebp + 5904 c3/return + 5905 + 5906 test-convert-index-into-array-of-bytes-using-offset-on-stack: + 5907 # . prologue + 5908 55/push-ebp + 5909 89/<- %ebp 4/r32/esp + 5910 # setup + 5911 (clear-stream _test-input-stream) + 5912 (clear-stream $_test-input-buffered-file->buffer) + 5913 (clear-stream _test-output-stream) + 5914 (clear-stream $_test-output-buffered-file->buffer) + 5915 # + 5916 (write _test-input-stream "fn foo {\n") + 5917 (write _test-input-stream " var arr/eax: (addr array byte) <- copy 0\n") + 5918 (write _test-input-stream " var idx: int\n") + 5919 (write _test-input-stream " var off/ecx: (offset byte) <- compute-offset arr, idx\n") + 5920 (write _test-input-stream " var x/eax: (addr byte) <- index arr, off\n") + 5921 (write _test-input-stream "}\n") + 5922 # convert + 5923 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5924 (flush _test-output-buffered-file) + 5925 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5931 # check output + 5932 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/0") + 5933 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/1") + 5934 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/2") + 5935 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/3") + 5936 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/4") + 5937 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/5") + 5938 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/6") + 5939 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/7") + 5940 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/8") + 5941 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/9") + 5942 (check-next-stream-line-equal _test-output-stream " 69/multiply *(ebp+0xfffffff8) 0x00000001/imm32 0x00000001/r32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/10") + 5943 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx + 4) 0x00000000/r32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/11") + 5944 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/12") + 5945 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/13") + 5946 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/14") + 5947 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/15") + 5948 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/16") + 5949 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/17") + 5950 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/18") + 5951 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/19") + 5952 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-index-into-array-of-bytes-using-offset-on-stack/20") + 5953 # . epilogue + 5954 89/<- %esp 5/r32/ebp + 5955 5d/pop-to-ebp + 5956 c3/return + 5957 + 5958 test-convert-function-and-type-definition: + 5959 # . prologue + 5960 55/push-ebp + 5961 89/<- %ebp 4/r32/esp + 5962 # setup + 5963 (clear-stream _test-input-stream) + 5964 (clear-stream $_test-input-buffered-file->buffer) + 5965 (clear-stream _test-output-stream) + 5966 (clear-stream $_test-output-buffered-file->buffer) + 5967 # + 5968 (write _test-input-stream "fn foo a: (addr t) {\n") + 5969 (write _test-input-stream " var _a/eax: (addr t) <- copy a\n") + 5970 (write _test-input-stream " var b/ecx: (addr int) <- get _a, x\n") + 5971 (write _test-input-stream " var c/ecx: (addr int) <- get _a, y\n") + 5972 (write _test-input-stream "}\n") + 5973 (write _test-input-stream "type t {\n") + 5974 (write _test-input-stream " x: int\n") + 5975 (write _test-input-stream " y: int\n") + 5976 (write _test-input-stream "}\n") + 5977 # convert + 5978 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 5979 (flush _test-output-buffered-file) + 5980 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 5986 # check output + 5987 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-and-type-definition/0") + 5988 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-and-type-definition/1") + 5989 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-and-type-definition/2") + 5990 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-and-type-definition/3") + 5991 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-and-type-definition/4") + 5992 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-and-type-definition/5") + 5993 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-and-type-definition/6") + 5994 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000000/r32" "F - test-convert-function-and-type-definition/7") + 5995 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-and-type-definition/8") + 5996 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000000) 0x00000001/r32" "F - test-convert-function-and-type-definition/9") + 5997 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x00000004) 0x00000001/r32" "F - test-convert-function-and-type-definition/11") + 5998 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-and-type-definition/13") + 5999 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-and-type-definition/14") + 6000 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-and-type-definition/15") + 6001 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-and-type-definition/16") + 6002 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-and-type-definition/17") + 6003 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-and-type-definition/18") + 6004 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-and-type-definition/19") + 6005 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-and-type-definition/20") + 6006 # . epilogue + 6007 89/<- %esp 5/r32/ebp + 6008 5d/pop-to-ebp + 6009 c3/return + 6010 + 6011 test-type-definition-with-array: + 6012 # . prologue + 6013 55/push-ebp + 6014 89/<- %ebp 4/r32/esp + 6015 # setup + 6016 (clear-stream _test-input-stream) + 6017 (clear-stream $_test-input-buffered-file->buffer) + 6018 (clear-stream _test-output-stream) + 6019 (clear-stream $_test-output-buffered-file->buffer) + 6020 (clear-stream _test-error-stream) + 6021 (clear-stream $_test-error-buffered-file->buffer) + 6022 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 6023 68/push 0/imm32 + 6024 68/push 0/imm32 + 6025 89/<- %edx 4/r32/esp + 6026 (tailor-exit-descriptor %edx 0x10) + 6027 # + 6028 (write _test-input-stream "type t {\n") + 6029 (write _test-input-stream " a: (array int 3)\n") + 6030 (write _test-input-stream "}\n") + 6031 # convert + 6032 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 6033 # registers except esp clobbered at this point + 6034 # restore ed + 6035 89/<- %edx 4/r32/esp + 6036 (flush _test-output-buffered-file) + 6037 (flush _test-error-buffered-file) + 6038 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6044 # check output + 6045 (check-stream-equal _test-output-stream "" "F - test-type-definition-with-array: output should be empty") + 6046 (check-next-stream-line-equal _test-error-stream "type t: 'array' elements not allowed for now" "F - test-type-definition-with-array: error message") + 6047 # check that stop(1) was called + 6048 (check-ints-equal *(edx+4) 2 "F - test-type-definition-with-array: exit status") + 6049 # don't restore from ebp + 6050 81 0/subop/add %esp 8/imm32 + 6051 # . epilogue + 6052 5d/pop-to-ebp + 6053 c3/return + 6054 + 6055 test-type-definition-with-addr: + 6056 # . prologue + 6057 55/push-ebp + 6058 89/<- %ebp 4/r32/esp + 6059 # setup + 6060 (clear-stream _test-input-stream) + 6061 (clear-stream $_test-input-buffered-file->buffer) + 6062 (clear-stream _test-output-stream) + 6063 (clear-stream $_test-output-buffered-file->buffer) + 6064 (clear-stream _test-error-stream) + 6065 (clear-stream $_test-error-buffered-file->buffer) + 6066 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 6067 68/push 0/imm32 + 6068 68/push 0/imm32 + 6069 89/<- %edx 4/r32/esp + 6070 (tailor-exit-descriptor %edx 0x10) + 6071 # + 6072 (write _test-input-stream "type t {\n") + 6073 (write _test-input-stream " a: (addr int)\n") + 6074 (write _test-input-stream "}\n") + 6075 # convert + 6076 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 6077 # registers except esp clobbered at this point + 6078 # restore ed + 6079 89/<- %edx 4/r32/esp + 6080 (flush _test-output-buffered-file) + 6081 (flush _test-error-buffered-file) + 6082 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6088 # check output + 6089 (check-stream-equal _test-output-stream "" "F - test-type-definition-with-addr: output should be empty") + 6090 (check-next-stream-line-equal _test-error-stream "type t: 'addr' elements not allowed" "F - test-type-definition-with-addr: error message") + 6091 # check that stop(1) was called + 6092 (check-ints-equal *(edx+4) 2 "F - test-type-definition-with-addr: exit status") + 6093 # don't restore from ebp + 6094 81 0/subop/add %esp 8/imm32 + 6095 # . epilogue + 6096 5d/pop-to-ebp + 6097 c3/return + 6098 + 6099 test-convert-function-with-local-var-with-user-defined-type: + 6100 # . prologue + 6101 55/push-ebp + 6102 89/<- %ebp 4/r32/esp + 6103 # setup + 6104 (clear-stream _test-input-stream) + 6105 (clear-stream $_test-input-buffered-file->buffer) + 6106 (clear-stream _test-output-stream) + 6107 (clear-stream $_test-output-buffered-file->buffer) + 6108 # + 6109 (write _test-input-stream "fn foo {\n") + 6110 (write _test-input-stream " var a: t\n") + 6111 (write _test-input-stream "}\n") + 6112 (write _test-input-stream "type t {\n") + 6113 (write _test-input-stream " x: int\n") + 6114 (write _test-input-stream " y: int\n") + 6115 (write _test-input-stream "}\n") + 6116 # convert + 6117 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6118 (flush _test-output-buffered-file) + 6119 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6125 # check output + 6126 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-user-defined-type/0") + 6127 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-user-defined-type/1") + 6128 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/2") + 6129 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-with-user-defined-type/3") + 6130 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type/4") + 6131 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-user-defined-type/5") + 6132 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/6") + 6133 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/7") + 6134 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-function-with-local-var-with-user-defined-type/8") + 6135 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type/9") + 6136 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-user-defined-type/10") + 6137 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-user-defined-type/11") + 6138 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-with-user-defined-type/12") + 6139 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-user-defined-type/13") + 6140 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-user-defined-type/14") + 6141 # . epilogue + 6142 89/<- %esp 5/r32/ebp + 6143 5d/pop-to-ebp + 6144 c3/return + 6145 + 6146 test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type: + 6147 # . prologue + 6148 55/push-ebp + 6149 89/<- %ebp 4/r32/esp + 6150 # setup + 6151 (clear-stream _test-input-stream) + 6152 (clear-stream $_test-input-buffered-file->buffer) + 6153 (clear-stream _test-output-stream) + 6154 (clear-stream $_test-output-buffered-file->buffer) + 6155 # + 6156 (write _test-input-stream "fn foo {\n") + 6157 (write _test-input-stream " var a: t\n") + 6158 (write _test-input-stream "}\n") + 6159 (write _test-input-stream "type t {\n") + 6160 (write _test-input-stream " x: s\n") + 6161 (write _test-input-stream "}\n") + 6162 (write _test-input-stream "type s {\n") + 6163 (write _test-input-stream " z: int\n") + 6164 (write _test-input-stream "}\n") + 6165 # convert + 6166 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6167 (flush _test-output-buffered-file) + 6168 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6174 # check output + 6175 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/0") + 6176 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/1") + 6177 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/2") + 6178 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/3") + 6179 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/4") + 6180 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/5") + 6181 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/7") + 6182 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/8") + 6183 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/9") + 6184 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/10") + 6185 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/11") + 6186 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/12") + 6187 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/13") + 6188 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-local-var-with-user-defined-type-containing-user-defined-type/14") + 6189 # . epilogue + 6190 89/<- %esp 5/r32/ebp + 6191 5d/pop-to-ebp + 6192 c3/return + 6193 + 6194 test-convert-function-call-with-arg-of-user-defined-type: + 6195 # . prologue + 6196 55/push-ebp + 6197 89/<- %ebp 4/r32/esp + 6198 # setup + 6199 (clear-stream _test-input-stream) + 6200 (clear-stream $_test-input-buffered-file->buffer) + 6201 (clear-stream _test-output-stream) + 6202 (clear-stream $_test-output-buffered-file->buffer) + 6203 # + 6204 (write _test-input-stream "fn f {\n") + 6205 (write _test-input-stream " var a: t\n") + 6206 (write _test-input-stream " foo a\n") + 6207 (write _test-input-stream "}\n") + 6208 (write _test-input-stream "fn foo x: t {\n") + 6209 (write _test-input-stream "}\n") + 6210 (write _test-input-stream "type t {\n") + 6211 (write _test-input-stream " x: int\n") + 6212 (write _test-input-stream " y: int\n") + 6213 (write _test-input-stream "}\n") + 6214 # convert + 6215 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6216 (flush _test-output-buffered-file) + 6217 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6223 # check output + 6224 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") + 6225 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") + 6226 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") + 6227 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type/3") + 6228 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") + 6229 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") + 6230 # var a: t + 6231 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/6") + 6232 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/7") + 6233 # foo a + 6234 (check-next-stream-line-equal _test-output-stream " (foo *(ebp+0xfffffff8) *(ebp+0xfffffffc))" "F - test-convert-function-call-with-arg-of-user-defined-type/8") + 6235 # + 6236 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/9") + 6237 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") + 6238 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") + 6239 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") + 6240 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/13") + 6241 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") + 6242 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") + 6243 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") + 6244 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") + 6245 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") + 6246 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type/19") + 6247 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") + 6248 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/21") + 6249 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") + 6250 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") + 6251 # . epilogue + 6252 89/<- %esp 5/r32/ebp + 6253 5d/pop-to-ebp + 6254 c3/return + 6255 + 6256 test-convert-function-call-with-arg-of-user-defined-type-register-indirect: + 6257 # . prologue + 6258 55/push-ebp + 6259 89/<- %ebp 4/r32/esp + 6260 # setup + 6261 (clear-stream _test-input-stream) + 6262 (clear-stream $_test-input-buffered-file->buffer) + 6263 (clear-stream _test-output-stream) + 6264 (clear-stream $_test-output-buffered-file->buffer) + 6265 # + 6266 (write _test-input-stream "fn f {\n") + 6267 (write _test-input-stream " var a/eax: (addr t) <- copy 0\n") + 6268 (write _test-input-stream " foo *a\n") + 6269 (write _test-input-stream "}\n") + 6270 (write _test-input-stream "fn foo x: t {\n") + 6271 (write _test-input-stream "}\n") + 6272 (write _test-input-stream "type t {\n") + 6273 (write _test-input-stream " x: int\n") + 6274 (write _test-input-stream " y: int\n") + 6275 (write _test-input-stream "}\n") + 6276 # convert + 6277 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6278 (flush _test-output-buffered-file) + 6279 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6285 # check output + 6286 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type/0") + 6287 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/1") + 6288 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/2") + 6289 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type/3") + 6290 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type/4") + 6291 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type/5") + 6292 # var a + 6293 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-arg-of-user-defined-type/6") + 6294 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type/7") + 6295 # foo a + 6296 (check-next-stream-line-equal _test-output-stream " (foo *(eax+0x00000000) *(eax+0x00000004))" "F - test-convert-function-call-with-arg-of-user-defined-type/8") + 6297 # + 6298 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-call-with-arg-of-user-defined-type/9") + 6299 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type/10") + 6300 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type/11") + 6301 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/12") + 6302 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/13") + 6303 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/14") + 6304 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/15") + 6305 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type/16") + 6306 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type/17") + 6307 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/18") + 6308 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type/19") + 6309 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type/20") + 6310 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/21") + 6311 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type/22") + 6312 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type/23") + 6313 # . epilogue + 6314 89/<- %esp 5/r32/ebp + 6315 5d/pop-to-ebp + 6316 c3/return + 6317 + 6318 # we don't have special support for call-by-reference; just explicitly create + 6319 # a new variable with the address of the arg + 6320 test-convert-function-call-with-arg-of-user-defined-type-by-reference: + 6321 # . prologue + 6322 55/push-ebp + 6323 89/<- %ebp 4/r32/esp + 6324 # setup + 6325 (clear-stream _test-input-stream) + 6326 (clear-stream $_test-input-buffered-file->buffer) + 6327 (clear-stream _test-output-stream) + 6328 (clear-stream $_test-output-buffered-file->buffer) + 6329 # + 6330 (write _test-input-stream "fn f {\n") + 6331 (write _test-input-stream " var a: t\n") + 6332 (write _test-input-stream " var b/eax: (addr t) <- address a\n") + 6333 (write _test-input-stream " foo b\n") + 6334 (write _test-input-stream "}\n") + 6335 (write _test-input-stream "fn foo x: (addr t) {\n") + 6336 (write _test-input-stream " var x/ecx: (addr t) <- copy x\n") + 6337 (write _test-input-stream "}\n") + 6338 (write _test-input-stream "type t {\n") + 6339 (write _test-input-stream " x: int\n") + 6340 (write _test-input-stream " y: int\n") + 6341 (write _test-input-stream "}\n") + 6342 # convert + 6343 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6344 (flush _test-output-buffered-file) + 6345 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6351 # check output + 6352 (check-next-stream-line-equal _test-output-stream "f:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/0") + 6353 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/1") + 6354 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/2") + 6355 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/3") + 6356 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/4") + 6357 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/5") + 6358 # var a: t + 6359 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/6") + 6360 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/7") + 6361 # var b/eax: (addr t) + 6362 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/8") + 6363 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffff8) 0x00000000/r32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/9") + 6364 # foo a + 6365 (check-next-stream-line-equal _test-output-stream " (foo %eax)" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/10") + 6366 # + 6367 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/11") + 6368 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/12") + 6369 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/13") + 6370 (check-next-stream-line-equal _test-output-stream "$f:0x00000001:break:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/14") + 6371 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/15") + 6372 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/16") + 6373 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/17") + 6374 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/18") + 6375 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/19") + 6376 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/20") + 6377 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/21") + 6378 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/22") + 6379 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/23") + 6380 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/24") + 6381 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/25") + 6382 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0x00000008) 0x00000001/r32" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/26") + 6383 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/27") + 6384 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/28") + 6385 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/29") + 6386 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/30") + 6387 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/31") + 6388 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/32") + 6389 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-call-with-arg-of-user-defined-type-by-reference/33") + 6390 # . epilogue + 6391 89/<- %esp 5/r32/ebp + 6392 5d/pop-to-ebp + 6393 c3/return + 6394 + 6395 test-convert-get-on-local-variable: + 6396 # . prologue + 6397 55/push-ebp + 6398 89/<- %ebp 4/r32/esp + 6399 # setup + 6400 (clear-stream _test-input-stream) + 6401 (clear-stream $_test-input-buffered-file->buffer) + 6402 (clear-stream _test-output-stream) + 6403 (clear-stream $_test-output-buffered-file->buffer) + 6404 # + 6405 (write _test-input-stream "fn foo {\n") + 6406 (write _test-input-stream " var a: t\n") + 6407 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 6408 (write _test-input-stream "}\n") + 6409 (write _test-input-stream "type t {\n") + 6410 (write _test-input-stream " x: int\n") + 6411 (write _test-input-stream " y: int\n") + 6412 (write _test-input-stream "}\n") + 6413 # convert + 6414 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6415 (flush _test-output-buffered-file) + 6416 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6422 # check output + 6423 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-local-variable/0") + 6424 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-local-variable/1") + 6425 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-local-variable/2") + 6426 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-local-variable/3") + 6427 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-local-variable/4") + 6428 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-local-variable/5") + 6429 # var a + 6430 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/6") + 6431 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-get-on-local-variable/7") + 6432 # var c + 6433 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-local-variable/8") + 6434 # get + 6435 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0xfffffffc) 0x00000001/r32" "F - test-convert-get-on-local-variable/9") + 6436 # reclaim c + 6437 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-local-variable/10") + 6438 # reclaim a + 6439 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000008/imm32" "F - test-convert-get-on-local-variable/11") + 6440 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-local-variable/12") + 6441 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-local-variable/13") + 6442 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-local-variable/14") + 6443 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-local-variable/15") + 6444 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-local-variable/16") + 6445 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-local-variable/17") + 6446 # . epilogue + 6447 89/<- %esp 5/r32/ebp + 6448 5d/pop-to-ebp + 6449 c3/return + 6450 + 6451 test-convert-get-on-function-argument: + 6452 # . prologue + 6453 55/push-ebp + 6454 89/<- %ebp 4/r32/esp + 6455 # setup + 6456 (clear-stream _test-input-stream) + 6457 (clear-stream $_test-input-buffered-file->buffer) + 6458 (clear-stream _test-output-stream) + 6459 (clear-stream $_test-output-buffered-file->buffer) + 6460 # + 6461 (write _test-input-stream "fn foo a: t {\n") + 6462 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 6463 (write _test-input-stream "}\n") + 6464 (write _test-input-stream "type t {\n") + 6465 (write _test-input-stream " x: int\n") + 6466 (write _test-input-stream " y: int\n") + 6467 (write _test-input-stream "}\n") + 6468 # convert + 6469 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6470 (flush _test-output-buffered-file) + 6471 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6477 # check output + 6478 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument/0") + 6479 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument/1") + 6480 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument/2") + 6481 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument/3") + 6482 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument/4") + 6483 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument/5") + 6484 # var c + 6485 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument/6") + 6486 # get + 6487 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0x0000000c) 0x00000001/r32" "F - test-convert-get-on-function-argument/7") + 6488 # reclaim c + 6489 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument/8") + 6490 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument/9") + 6491 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument/10") + 6492 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument/11") + 6493 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument/12") + 6494 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument/13") + 6495 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument/14") + 6496 # . epilogue + 6497 89/<- %esp 5/r32/ebp + 6498 5d/pop-to-ebp + 6499 c3/return + 6500 + 6501 test-convert-get-on-function-argument-with-known-type: + 6502 # . prologue + 6503 55/push-ebp + 6504 89/<- %ebp 4/r32/esp + 6505 # setup + 6506 (clear-stream _test-input-stream) + 6507 (clear-stream $_test-input-buffered-file->buffer) + 6508 (clear-stream _test-output-stream) + 6509 (clear-stream $_test-output-buffered-file->buffer) + 6510 # + 6511 (write _test-input-stream "type t {\n") + 6512 (write _test-input-stream " x: int\n") + 6513 (write _test-input-stream " y: int\n") + 6514 (write _test-input-stream "}\n") + 6515 (write _test-input-stream "fn foo a: t {\n") + 6516 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 6517 (write _test-input-stream "}\n") + 6518 # convert + 6519 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6520 (flush _test-output-buffered-file) + 6521 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6527 # check output + 6528 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-get-on-function-argument-with-known-type/0") + 6529 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-get-on-function-argument-with-known-type/1") + 6530 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-get-on-function-argument-with-known-type/2") + 6531 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-get-on-function-argument-with-known-type/3") + 6532 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-get-on-function-argument-with-known-type/4") + 6533 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-get-on-function-argument-with-known-type/5") + 6534 # var c + 6535 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-get-on-function-argument-with-known-type/6") + 6536 # get + 6537 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(ebp+0x0000000c) 0x00000001/r32" "F - test-convert-get-on-function-argument-with-known-type/7") + 6538 # reclaim c + 6539 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-get-on-function-argument-with-known-type/8") + 6540 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-get-on-function-argument-with-known-type/9") + 6541 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-get-on-function-argument-with-known-type/10") + 6542 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-get-on-function-argument-with-known-type/11") + 6543 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-get-on-function-argument-with-known-type/12") + 6544 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-get-on-function-argument-with-known-type/13") + 6545 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-get-on-function-argument-with-known-type/14") + 6546 # . epilogue + 6547 89/<- %esp 5/r32/ebp + 6548 5d/pop-to-ebp + 6549 c3/return + 6550 + 6551 test-add-with-too-many-inouts: + 6552 # . prologue + 6553 55/push-ebp + 6554 89/<- %ebp 4/r32/esp + 6555 # setup + 6556 (clear-stream _test-input-stream) + 6557 (clear-stream $_test-input-buffered-file->buffer) + 6558 (clear-stream _test-output-stream) + 6559 (clear-stream $_test-output-buffered-file->buffer) + 6560 (clear-stream _test-error-stream) + 6561 (clear-stream $_test-error-buffered-file->buffer) + 6562 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 6563 68/push 0/imm32 + 6564 68/push 0/imm32 + 6565 89/<- %edx 4/r32/esp + 6566 (tailor-exit-descriptor %edx 0x10) + 6567 # + 6568 (write _test-input-stream "fn foo {\n") + 6569 (write _test-input-stream " var a: int\n") + 6570 (write _test-input-stream " var b/ecx: int <- add a, 0\n") + 6571 (write _test-input-stream "}\n") + 6572 # convert + 6573 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 6574 # registers except esp clobbered at this point + 6575 # restore ed + 6576 89/<- %edx 4/r32/esp + 6577 (flush _test-output-buffered-file) + 6578 (flush _test-error-buffered-file) + 6579 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6585 # check output + 6586 (check-stream-equal _test-output-stream "" "F - test-add-with-too-many-inouts: output should be empty") + 6587 (check-next-stream-line-equal _test-error-stream "fn foo: stmt add: too many inouts; most primitives support at most two arguments, across inouts and outputs" "F - test-add-with-too-many-inouts: error message") + 6588 # check that stop(1) was called + 6589 (check-ints-equal *(edx+4) 2 "F - test-add-with-too-many-inouts: exit status") + 6590 # don't restore from ebp + 6591 81 0/subop/add %esp 8/imm32 + 6592 # . epilogue + 6593 5d/pop-to-ebp + 6594 c3/return + 6595 + 6596 test-add-with-too-many-inouts-2: + 6597 # . prologue + 6598 55/push-ebp + 6599 89/<- %ebp 4/r32/esp + 6600 # setup + 6601 (clear-stream _test-input-stream) + 6602 (clear-stream $_test-input-buffered-file->buffer) + 6603 (clear-stream _test-output-stream) + 6604 (clear-stream $_test-output-buffered-file->buffer) + 6605 (clear-stream _test-error-stream) + 6606 (clear-stream $_test-error-buffered-file->buffer) + 6607 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 6608 68/push 0/imm32 + 6609 68/push 0/imm32 + 6610 89/<- %edx 4/r32/esp + 6611 (tailor-exit-descriptor %edx 0x10) + 6612 # + 6613 (write _test-input-stream "fn foo {\n") + 6614 (write _test-input-stream " var a: int\n") + 6615 (write _test-input-stream " add-to a, 0, 1\n") + 6616 (write _test-input-stream "}\n") + 6617 # convert + 6618 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 6619 # registers except esp clobbered at this point + 6620 # restore ed + 6621 89/<- %edx 4/r32/esp + 6622 (flush _test-output-buffered-file) + 6623 (flush _test-error-buffered-file) + 6624 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6630 # check output + 6631 (check-stream-equal _test-output-stream "" "F - test-add-with-too-many-inouts-2: output should be empty") + 6632 (check-next-stream-line-equal _test-error-stream "fn foo: stmt add-to: too many inouts; most primitives support at most two arguments, across inouts and outputs" "F - test-add-with-too-many-inouts-2: error message") + 6633 # check that stop(1) was called + 6634 (check-ints-equal *(edx+4) 2 "F - test-add-with-too-many-inouts-2: exit status") + 6635 # don't restore from ebp + 6636 81 0/subop/add %esp 8/imm32 + 6637 # . epilogue + 6638 5d/pop-to-ebp + 6639 c3/return + 6640 + 6641 test-add-with-too-many-outputs: + 6642 # . prologue + 6643 55/push-ebp + 6644 89/<- %ebp 4/r32/esp + 6645 # setup + 6646 (clear-stream _test-input-stream) + 6647 (clear-stream $_test-input-buffered-file->buffer) + 6648 (clear-stream _test-output-stream) + 6649 (clear-stream $_test-output-buffered-file->buffer) + 6650 (clear-stream _test-error-stream) + 6651 (clear-stream $_test-error-buffered-file->buffer) + 6652 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 6653 68/push 0/imm32 + 6654 68/push 0/imm32 + 6655 89/<- %edx 4/r32/esp + 6656 (tailor-exit-descriptor %edx 0x10) + 6657 # + 6658 (write _test-input-stream "fn foo {\n") + 6659 (write _test-input-stream " var a/eax: int <- copy 0\n") + 6660 (write _test-input-stream " var b/ebx: int <- copy 0\n") + 6661 (write _test-input-stream " var c/ecx: int <- copy 0\n") + 6662 (write _test-input-stream " c, b <- add a\n") + 6663 (write _test-input-stream "}\n") + 6664 # convert + 6665 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 6666 # registers except esp clobbered at this point + 6667 # restore ed + 6668 89/<- %edx 4/r32/esp + 6669 (flush _test-output-buffered-file) + 6670 (flush _test-error-buffered-file) + 6671 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6677 # check output + 6678 (check-stream-equal _test-output-stream "" "F - test-add-with-too-many-outputs: output should be empty") + 6679 (check-next-stream-line-equal _test-error-stream "fn foo: stmt add: too many outputs; most primitives support at most one output" "F - test-add-with-too-many-outputs: error message") + 6680 # check that stop(1) was called + 6681 (check-ints-equal *(edx+4) 2 "F - test-add-with-too-many-outputs: exit status") + 6682 # don't restore from ebp + 6683 81 0/subop/add %esp 8/imm32 + 6684 # . epilogue + 6685 5d/pop-to-ebp + 6686 c3/return + 6687 + 6688 test-add-with-non-number: + 6689 # . prologue + 6690 55/push-ebp + 6691 89/<- %ebp 4/r32/esp + 6692 # setup + 6693 (clear-stream _test-input-stream) + 6694 (clear-stream $_test-input-buffered-file->buffer) + 6695 (clear-stream _test-output-stream) + 6696 (clear-stream $_test-output-buffered-file->buffer) + 6697 (clear-stream _test-error-stream) + 6698 (clear-stream $_test-error-buffered-file->buffer) + 6699 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 6700 68/push 0/imm32 + 6701 68/push 0/imm32 + 6702 89/<- %edx 4/r32/esp + 6703 (tailor-exit-descriptor %edx 0x10) + 6704 # + 6705 (write _test-input-stream "fn foo {\n") + 6706 (write _test-input-stream " var a: int\n") + 6707 (write _test-input-stream " var b/ecx: (addr int) <- add a\n") + 6708 (write _test-input-stream "}\n") + 6709 # convert + 6710 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 6711 # registers except esp clobbered at this point + 6712 # restore ed + 6713 89/<- %edx 4/r32/esp + 6714 (flush _test-output-buffered-file) + 6715 (flush _test-error-buffered-file) + 6716 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6722 # check output + 6723 (check-stream-equal _test-output-stream "" "F - test-add-with-non-number: output should be empty") + 6724 (check-next-stream-line-equal _test-error-stream "fn foo: stmt add: 'b' must be a non-addr non-offset scalar" "F - test-add-with-non-number: error message") + 6725 # check that stop(1) was called + 6726 (check-ints-equal *(edx+4) 2 "F - test-add-with-non-number: exit status") + 6727 # don't restore from ebp + 6728 81 0/subop/add %esp 8/imm32 + 6729 # . epilogue + 6730 5d/pop-to-ebp + 6731 c3/return + 6732 + 6733 test-add-with-addr-dereferenced: + 6734 # . prologue + 6735 55/push-ebp + 6736 89/<- %ebp 4/r32/esp + 6737 # setup + 6738 (clear-stream _test-input-stream) + 6739 (clear-stream $_test-input-buffered-file->buffer) + 6740 (clear-stream _test-output-stream) + 6741 (clear-stream $_test-output-buffered-file->buffer) + 6742 # + 6743 (write _test-input-stream "fn foo {\n") + 6744 (write _test-input-stream " var a/eax: (addr int) <- copy 0\n") + 6745 (write _test-input-stream " add-to *a, 1\n") + 6746 (write _test-input-stream "}\n") + 6747 # convert + 6748 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6749 (flush _test-output-buffered-file) + 6750 # no error + 6751 # . epilogue + 6752 89/<- %esp 5/r32/ebp + 6753 5d/pop-to-ebp + 6754 c3/return + 6755 + 6756 test-copy-with-no-inout: + 6757 # . prologue + 6758 55/push-ebp + 6759 89/<- %ebp 4/r32/esp + 6760 # setup + 6761 (clear-stream _test-input-stream) + 6762 (clear-stream $_test-input-buffered-file->buffer) + 6763 (clear-stream _test-output-stream) + 6764 (clear-stream $_test-output-buffered-file->buffer) + 6765 (clear-stream _test-error-stream) + 6766 (clear-stream $_test-error-buffered-file->buffer) + 6767 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 6768 68/push 0/imm32 + 6769 68/push 0/imm32 + 6770 89/<- %edx 4/r32/esp + 6771 (tailor-exit-descriptor %edx 0x10) + 6772 # + 6773 (write _test-input-stream "fn foo {\n") + 6774 (write _test-input-stream " var x/eax: boolean <- copy\n") + 6775 (write _test-input-stream "}\n") + 6776 # convert + 6777 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 6778 # registers except esp clobbered at this point + 6779 # restore ed + 6780 89/<- %edx 4/r32/esp + 6781 (flush _test-output-buffered-file) + 6782 (flush _test-error-buffered-file) + 6783 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6789 # check output + 6790 (check-stream-equal _test-output-stream "" "F - test-copy-with-no-inout: output should be empty") + 6791 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy' expects an inout" "F - test-copy-with-no-inout: error message") + 6792 # check that stop(1) was called + 6793 (check-ints-equal *(edx+4) 2 "F - test-copy-with-no-inout: exit status") + 6794 # don't restore from ebp + 6795 81 0/subop/add %esp 8/imm32 + 6796 # . epilogue + 6797 5d/pop-to-ebp + 6798 c3/return + 6799 + 6800 test-copy-with-multiple-inouts: + 6801 # . prologue + 6802 55/push-ebp + 6803 89/<- %ebp 4/r32/esp + 6804 # setup + 6805 (clear-stream _test-input-stream) + 6806 (clear-stream $_test-input-buffered-file->buffer) + 6807 (clear-stream _test-output-stream) + 6808 (clear-stream $_test-output-buffered-file->buffer) + 6809 (clear-stream _test-error-stream) + 6810 (clear-stream $_test-error-buffered-file->buffer) + 6811 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 6812 68/push 0/imm32 + 6813 68/push 0/imm32 + 6814 89/<- %edx 4/r32/esp + 6815 (tailor-exit-descriptor %edx 0x10) + 6816 # + 6817 (write _test-input-stream "fn foo {\n") + 6818 (write _test-input-stream " var x/eax: boolean <- copy 0, 0\n") + 6819 (write _test-input-stream "}\n") + 6820 # convert + 6821 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 6822 # registers except esp clobbered at this point + 6823 # restore ed + 6824 89/<- %edx 4/r32/esp + 6825 (flush _test-output-buffered-file) + 6826 (flush _test-error-buffered-file) + 6827 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6833 # check output + 6834 (check-stream-equal _test-output-stream "" "F - test-copy-with-multiple-inouts: output should be empty") + 6835 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy' must have just one inout" "F - test-copy-with-multiple-inouts: error message") + 6836 # check that stop(1) was called + 6837 (check-ints-equal *(edx+4) 2 "F - test-copy-with-multiple-inouts: exit status") + 6838 # don't restore from ebp + 6839 81 0/subop/add %esp 8/imm32 + 6840 # . epilogue + 6841 5d/pop-to-ebp + 6842 c3/return + 6843 + 6844 test-copy-with-no-output: + 6845 # . prologue + 6846 55/push-ebp + 6847 89/<- %ebp 4/r32/esp + 6848 # setup + 6849 (clear-stream _test-input-stream) + 6850 (clear-stream $_test-input-buffered-file->buffer) + 6851 (clear-stream _test-output-stream) + 6852 (clear-stream $_test-output-buffered-file->buffer) + 6853 (clear-stream _test-error-stream) + 6854 (clear-stream $_test-error-buffered-file->buffer) + 6855 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 6856 68/push 0/imm32 + 6857 68/push 0/imm32 + 6858 89/<- %edx 4/r32/esp + 6859 (tailor-exit-descriptor %edx 0x10) + 6860 # + 6861 (write _test-input-stream "fn foo {\n") + 6862 (write _test-input-stream " copy 0\n") + 6863 (write _test-input-stream "}\n") + 6864 # convert + 6865 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 6866 # registers except esp clobbered at this point + 6867 # restore ed + 6868 89/<- %edx 4/r32/esp + 6869 (flush _test-output-buffered-file) + 6870 (flush _test-error-buffered-file) + 6871 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6877 # check output + 6878 (check-stream-equal _test-output-stream "" "F - test-copy-with-no-output: output should be empty") + 6879 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy' expects an output" "F - test-copy-with-no-output: error message") + 6880 # check that stop(1) was called + 6881 (check-ints-equal *(edx+4) 2 "F - test-copy-with-no-output: exit status") + 6882 # don't restore from ebp + 6883 81 0/subop/add %esp 8/imm32 + 6884 # . epilogue + 6885 5d/pop-to-ebp + 6886 c3/return + 6887 + 6888 test-copy-with-multiple-outputs: + 6889 # . prologue + 6890 55/push-ebp + 6891 89/<- %ebp 4/r32/esp + 6892 # setup + 6893 (clear-stream _test-input-stream) + 6894 (clear-stream $_test-input-buffered-file->buffer) + 6895 (clear-stream _test-output-stream) + 6896 (clear-stream $_test-output-buffered-file->buffer) + 6897 (clear-stream _test-error-stream) + 6898 (clear-stream $_test-error-buffered-file->buffer) + 6899 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 6900 68/push 0/imm32 + 6901 68/push 0/imm32 + 6902 89/<- %edx 4/r32/esp + 6903 (tailor-exit-descriptor %edx 0x10) + 6904 # + 6905 (write _test-input-stream "fn foo {\n") + 6906 (write _test-input-stream " var x/eax: boolean <- copy 0\n") + 6907 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") + 6908 (write _test-input-stream " x, y <- copy 0\n") + 6909 (write _test-input-stream "}\n") + 6910 # convert + 6911 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 6912 # registers except esp clobbered at this point + 6913 # restore ed + 6914 89/<- %edx 4/r32/esp + 6915 (flush _test-output-buffered-file) + 6916 (flush _test-error-buffered-file) + 6917 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6923 # check output + 6924 (check-stream-equal _test-output-stream "" "F - test-copy-with-multiple-outputs: output should be empty") + 6925 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy' must have just one output" "F - test-copy-with-multiple-outputs: error message") + 6926 # check that stop(1) was called + 6927 (check-ints-equal *(edx+4) 2 "F - test-copy-with-multiple-outputs: exit status") + 6928 # don't restore from ebp + 6929 81 0/subop/add %esp 8/imm32 + 6930 # . epilogue + 6931 5d/pop-to-ebp + 6932 c3/return + 6933 + 6934 test-copy-invalid-value-to-address: + 6935 # . prologue + 6936 55/push-ebp + 6937 89/<- %ebp 4/r32/esp + 6938 # setup + 6939 (clear-stream _test-input-stream) + 6940 (clear-stream $_test-input-buffered-file->buffer) + 6941 (clear-stream _test-output-stream) + 6942 (clear-stream $_test-output-buffered-file->buffer) + 6943 (clear-stream _test-error-stream) + 6944 (clear-stream $_test-error-buffered-file->buffer) + 6945 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 6946 68/push 0/imm32 + 6947 68/push 0/imm32 + 6948 89/<- %edx 4/r32/esp + 6949 (tailor-exit-descriptor %edx 0x10) + 6950 # + 6951 (write _test-input-stream "fn foo {\n") + 6952 (write _test-input-stream " var x/eax: int <- copy 0\n") + 6953 (write _test-input-stream " var y/ecx: (addr int) <- copy x\n") + 6954 (write _test-input-stream "}\n") + 6955 # convert + 6956 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 6957 # registers except esp clobbered at this point + 6958 # restore ed + 6959 89/<- %edx 4/r32/esp + 6960 (flush _test-output-buffered-file) + 6961 (flush _test-error-buffered-file) + 6962 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 6968 # check output + 6969 (check-stream-equal _test-output-stream "" "F - test-copy-invalid-value-to-address: output should be empty") + 6970 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy: 'y' must be a non-addr non-offset scalar" "F - test-copy-invalid-value-to-address: error message") + 6971 # check that stop(1) was called + 6972 (check-ints-equal *(edx+4) 2 "F - test-copy-invalid-value-to-address: exit status") + 6973 # don't restore from ebp + 6974 81 0/subop/add %esp 8/imm32 + 6975 # . epilogue + 6976 5d/pop-to-ebp + 6977 c3/return + 6978 + 6979 test-copy-null-value-to-addr: + 6980 # . prologue + 6981 55/push-ebp + 6982 89/<- %ebp 4/r32/esp + 6983 # setup + 6984 (clear-stream _test-input-stream) + 6985 (clear-stream $_test-input-buffered-file->buffer) + 6986 (clear-stream _test-output-stream) + 6987 (clear-stream $_test-output-buffered-file->buffer) + 6988 # + 6989 (write _test-input-stream "fn foo {\n") + 6990 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") + 6991 (write _test-input-stream "}\n") + 6992 # convert + 6993 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 6994 (flush _test-output-buffered-file) + 6995 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7001 # no errors + 7002 # . epilogue + 7003 89/<- %esp 5/r32/ebp + 7004 5d/pop-to-ebp + 7005 c3/return + 7006 + 7007 test-copy-invalid-value-to-offset: + 7008 # . prologue + 7009 55/push-ebp + 7010 89/<- %ebp 4/r32/esp + 7011 # setup + 7012 (clear-stream _test-input-stream) + 7013 (clear-stream $_test-input-buffered-file->buffer) + 7014 (clear-stream _test-output-stream) + 7015 (clear-stream $_test-output-buffered-file->buffer) + 7016 (clear-stream _test-error-stream) + 7017 (clear-stream $_test-error-buffered-file->buffer) + 7018 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7019 68/push 0/imm32 + 7020 68/push 0/imm32 + 7021 89/<- %edx 4/r32/esp + 7022 (tailor-exit-descriptor %edx 0x10) + 7023 # + 7024 (write _test-input-stream "fn foo {\n") + 7025 (write _test-input-stream " var x/eax: int <- copy 0\n") + 7026 (write _test-input-stream " var y/ecx: (offset int) <- copy x\n") + 7027 (write _test-input-stream "}\n") + 7028 # convert + 7029 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7030 # registers except esp clobbered at this point + 7031 # restore ed + 7032 89/<- %edx 4/r32/esp + 7033 (flush _test-output-buffered-file) + 7034 (flush _test-error-buffered-file) + 7035 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7041 # check output + 7042 (check-stream-equal _test-output-stream "" "F - test-copy-invalid-value-to-address: output should be empty") + 7043 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy: 'y' must be a non-addr non-offset scalar" "F - test-copy-invalid-value-to-address: error message") + 7044 # check that stop(1) was called + 7045 (check-ints-equal *(edx+4) 2 "F - test-copy-invalid-value-to-offset: exit status") + 7046 # don't restore from ebp + 7047 81 0/subop/add %esp 8/imm32 + 7048 # . epilogue + 7049 5d/pop-to-ebp + 7050 c3/return + 7051 + 7052 test-copy-null-value-to-offset: + 7053 # . prologue + 7054 55/push-ebp + 7055 89/<- %ebp 4/r32/esp + 7056 # setup + 7057 (clear-stream _test-input-stream) + 7058 (clear-stream $_test-input-buffered-file->buffer) + 7059 (clear-stream _test-output-stream) + 7060 (clear-stream $_test-output-buffered-file->buffer) + 7061 # + 7062 (write _test-input-stream "fn foo {\n") + 7063 (write _test-input-stream " var y/ecx: (offset int) <- copy 0\n") + 7064 (write _test-input-stream "}\n") + 7065 # convert + 7066 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 7067 (flush _test-output-buffered-file) + 7068 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7074 # no errors + 7075 # . epilogue + 7076 89/<- %esp 5/r32/ebp + 7077 5d/pop-to-ebp + 7078 c3/return + 7079 + 7080 test-copy-deref-address: + 7081 # . prologue + 7082 55/push-ebp + 7083 89/<- %ebp 4/r32/esp + 7084 # setup + 7085 (clear-stream _test-input-stream) + 7086 (clear-stream $_test-input-buffered-file->buffer) + 7087 (clear-stream _test-output-stream) + 7088 (clear-stream $_test-output-buffered-file->buffer) + 7089 # + 7090 (write _test-input-stream "fn foo {\n") + 7091 (write _test-input-stream " var x/eax: (addr addr int) <- copy 0\n") + 7092 (write _test-input-stream " var y/ecx: (addr int) <- copy *x\n") + 7093 (write _test-input-stream "}\n") + 7094 # convert + 7095 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 7096 (flush _test-output-buffered-file) + 7097 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7103 # not bothering checking output + 7104 (check-next-stream-line-equal _test-error-stream "" "F - test-copy-deref-address: error message") + 7105 # . epilogue + 7106 5d/pop-to-ebp + 7107 c3/return + 7108 + 7109 test-copy-to-non-register: + 7110 # . prologue + 7111 55/push-ebp + 7112 89/<- %ebp 4/r32/esp + 7113 # setup + 7114 (clear-stream _test-input-stream) + 7115 (clear-stream $_test-input-buffered-file->buffer) + 7116 (clear-stream _test-output-stream) + 7117 (clear-stream $_test-output-buffered-file->buffer) + 7118 (clear-stream _test-error-stream) + 7119 (clear-stream $_test-error-buffered-file->buffer) + 7120 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7121 68/push 0/imm32 + 7122 68/push 0/imm32 + 7123 89/<- %edx 4/r32/esp + 7124 (tailor-exit-descriptor %edx 0x10) + 7125 # + 7126 (write _test-input-stream "fn foo {\n") + 7127 (write _test-input-stream " var x: int\n") + 7128 (write _test-input-stream " x <- copy 0\n") + 7129 (write _test-input-stream "}\n") + 7130 # convert + 7131 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7132 # registers except esp clobbered at this point + 7133 # restore ed + 7134 89/<- %edx 4/r32/esp + 7135 (flush _test-output-buffered-file) + 7136 (flush _test-error-buffered-file) + 7137 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7143 # check output + 7144 (check-stream-equal _test-output-stream "" "F - test-copy-to-non-register: output should be empty") + 7145 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy: output 'x' not in a register" "F - test-copy-to-non-register: error message") + 7146 # check that stop(1) was called + 7147 (check-ints-equal *(edx+4) 2 "F - test-copy-to-non-register: exit status") + 7148 # don't restore from ebp + 7149 81 0/subop/add %esp 8/imm32 + 7150 # . epilogue + 7151 5d/pop-to-ebp + 7152 c3/return + 7153 + 7154 test-copy-non-scalar: + 7155 # . prologue + 7156 55/push-ebp + 7157 89/<- %ebp 4/r32/esp + 7158 # setup + 7159 (clear-stream _test-input-stream) + 7160 (clear-stream $_test-input-buffered-file->buffer) + 7161 (clear-stream _test-output-stream) + 7162 (clear-stream $_test-output-buffered-file->buffer) + 7163 (clear-stream _test-error-stream) + 7164 (clear-stream $_test-error-buffered-file->buffer) + 7165 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7166 68/push 0/imm32 + 7167 68/push 0/imm32 + 7168 89/<- %edx 4/r32/esp + 7169 (tailor-exit-descriptor %edx 0x10) + 7170 # + 7171 (write _test-input-stream "fn foo {\n") + 7172 (write _test-input-stream " var x: (handle int)\n") + 7173 (write _test-input-stream " var y/eax: int <- copy x\n") + 7174 (write _test-input-stream "}\n") + 7175 # convert + 7176 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7177 # registers except esp clobbered at this point + 7178 # restore ed + 7179 89/<- %edx 4/r32/esp + 7180 (flush _test-output-buffered-file) + 7181 (flush _test-error-buffered-file) + 7182 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7188 # check output + 7189 (check-stream-equal _test-output-stream "" "F - test-copy-non-scalar: output should be empty") + 7190 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy: 'x' is too large to fit in a register" "F - test-copy-non-scalar: error message") + 7191 # check that stop(1) was called + 7192 (check-ints-equal *(edx+4) 2 "F - test-copy-non-scalar: exit status") + 7193 # don't restore from ebp + 7194 81 0/subop/add %esp 8/imm32 + 7195 # . epilogue + 7196 5d/pop-to-ebp + 7197 c3/return + 7198 + 7199 test-copy-to-with-no-inout: + 7200 # . prologue + 7201 55/push-ebp + 7202 89/<- %ebp 4/r32/esp + 7203 # setup + 7204 (clear-stream _test-input-stream) + 7205 (clear-stream $_test-input-buffered-file->buffer) + 7206 (clear-stream _test-output-stream) + 7207 (clear-stream $_test-output-buffered-file->buffer) + 7208 (clear-stream _test-error-stream) + 7209 (clear-stream $_test-error-buffered-file->buffer) + 7210 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7211 68/push 0/imm32 + 7212 68/push 0/imm32 + 7213 89/<- %edx 4/r32/esp + 7214 (tailor-exit-descriptor %edx 0x10) + 7215 # + 7216 (write _test-input-stream "fn foo {\n") + 7217 (write _test-input-stream " copy-to\n") + 7218 (write _test-input-stream "}\n") + 7219 # convert + 7220 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7221 # registers except esp clobbered at this point + 7222 # restore ed + 7223 89/<- %edx 4/r32/esp + 7224 (flush _test-output-buffered-file) + 7225 (flush _test-error-buffered-file) + 7226 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7232 # check output + 7233 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-no-inout: output should be empty") + 7234 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-to' must have two inouts" "F - test-copy-to-with-no-inout: error message") + 7235 # check that stop(1) was called + 7236 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-no-inout: exit status") + 7237 # don't restore from ebp + 7238 81 0/subop/add %esp 8/imm32 + 7239 # . epilogue + 7240 5d/pop-to-ebp + 7241 c3/return + 7242 + 7243 test-copy-to-with-no-input: + 7244 # . prologue + 7245 55/push-ebp + 7246 89/<- %ebp 4/r32/esp + 7247 # setup + 7248 (clear-stream _test-input-stream) + 7249 (clear-stream $_test-input-buffered-file->buffer) + 7250 (clear-stream _test-output-stream) + 7251 (clear-stream $_test-output-buffered-file->buffer) + 7252 (clear-stream _test-error-stream) + 7253 (clear-stream $_test-error-buffered-file->buffer) + 7254 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7255 68/push 0/imm32 + 7256 68/push 0/imm32 + 7257 89/<- %edx 4/r32/esp + 7258 (tailor-exit-descriptor %edx 0x10) + 7259 # + 7260 (write _test-input-stream "fn foo {\n") + 7261 (write _test-input-stream " var x: boolean\n") + 7262 (write _test-input-stream " copy-to x\n") + 7263 (write _test-input-stream "}\n") + 7264 # convert + 7265 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7266 # registers except esp clobbered at this point + 7267 # restore ed + 7268 89/<- %edx 4/r32/esp + 7269 (flush _test-output-buffered-file) + 7270 (flush _test-error-buffered-file) + 7271 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7277 # check output + 7278 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-no-input: output should be empty") + 7279 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-to' must have two inouts" "F - test-copy-to-with-no-input: error message") + 7280 # check that stop(1) was called + 7281 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-no-input: exit status") + 7282 # don't restore from ebp + 7283 81 0/subop/add %esp 8/imm32 + 7284 # . epilogue + 7285 5d/pop-to-ebp + 7286 c3/return + 7287 + 7288 test-copy-to-with-no-register: + 7289 # . prologue + 7290 55/push-ebp + 7291 89/<- %ebp 4/r32/esp + 7292 # setup + 7293 (clear-stream _test-input-stream) + 7294 (clear-stream $_test-input-buffered-file->buffer) + 7295 (clear-stream _test-output-stream) + 7296 (clear-stream $_test-output-buffered-file->buffer) + 7297 (clear-stream _test-error-stream) + 7298 (clear-stream $_test-error-buffered-file->buffer) + 7299 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7300 68/push 0/imm32 + 7301 68/push 0/imm32 + 7302 89/<- %edx 4/r32/esp + 7303 (tailor-exit-descriptor %edx 0x10) + 7304 # + 7305 (write _test-input-stream "fn foo {\n") + 7306 (write _test-input-stream " var x: boolean\n") + 7307 (write _test-input-stream " copy-to x, x\n") + 7308 (write _test-input-stream "}\n") + 7309 # convert + 7310 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7311 # registers except esp clobbered at this point + 7312 # restore ed + 7313 89/<- %edx 4/r32/esp + 7314 (flush _test-output-buffered-file) + 7315 (flush _test-error-buffered-file) + 7316 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7322 # check output + 7323 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-no-register: output should be empty") + 7324 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-to: source (second inout) is in memory" "F - test-copy-to-with-no-register: error message") + 7325 # check that stop(1) was called + 7326 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-no-register: exit status") + 7327 # don't restore from ebp + 7328 81 0/subop/add %esp 8/imm32 + 7329 # . epilogue + 7330 5d/pop-to-ebp + 7331 c3/return + 7332 + 7333 test-copy-to-with-too-many-inouts: + 7334 # . prologue + 7335 55/push-ebp + 7336 89/<- %ebp 4/r32/esp + 7337 # setup + 7338 (clear-stream _test-input-stream) + 7339 (clear-stream $_test-input-buffered-file->buffer) + 7340 (clear-stream _test-output-stream) + 7341 (clear-stream $_test-output-buffered-file->buffer) + 7342 (clear-stream _test-error-stream) + 7343 (clear-stream $_test-error-buffered-file->buffer) + 7344 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7345 68/push 0/imm32 + 7346 68/push 0/imm32 + 7347 89/<- %edx 4/r32/esp + 7348 (tailor-exit-descriptor %edx 0x10) + 7349 # + 7350 (write _test-input-stream "fn foo {\n") + 7351 (write _test-input-stream " var x: boolean\n") + 7352 (write _test-input-stream " copy-to x, 0, 0\n") + 7353 (write _test-input-stream "}\n") + 7354 # convert + 7355 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7356 # registers except esp clobbered at this point + 7357 # restore ed + 7358 89/<- %edx 4/r32/esp + 7359 (flush _test-output-buffered-file) + 7360 (flush _test-error-buffered-file) + 7361 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7367 # check output + 7368 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-too-many-inouts: output should be empty") + 7369 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-to' must have two inouts" "F - test-copy-to-with-too-many-inouts: error message") + 7370 # check that stop(1) was called + 7371 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-too-many-inouts: exit status") + 7372 # don't restore from ebp + 7373 81 0/subop/add %esp 8/imm32 + 7374 # . epilogue + 7375 5d/pop-to-ebp + 7376 c3/return + 7377 + 7378 test-copy-to-with-output: + 7379 # . prologue + 7380 55/push-ebp + 7381 89/<- %ebp 4/r32/esp + 7382 # setup + 7383 (clear-stream _test-input-stream) + 7384 (clear-stream $_test-input-buffered-file->buffer) + 7385 (clear-stream _test-output-stream) + 7386 (clear-stream $_test-output-buffered-file->buffer) + 7387 (clear-stream _test-error-stream) + 7388 (clear-stream $_test-error-buffered-file->buffer) + 7389 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7390 68/push 0/imm32 + 7391 68/push 0/imm32 + 7392 89/<- %edx 4/r32/esp + 7393 (tailor-exit-descriptor %edx 0x10) + 7394 # + 7395 (write _test-input-stream "fn foo {\n") + 7396 (write _test-input-stream " var x/eax: boolean <- copy 0\n") + 7397 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") + 7398 (write _test-input-stream " x <- copy-to y, 0\n") + 7399 (write _test-input-stream "}\n") + 7400 # convert + 7401 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7402 # registers except esp clobbered at this point + 7403 # restore ed + 7404 89/<- %edx 4/r32/esp + 7405 (flush _test-output-buffered-file) + 7406 (flush _test-error-buffered-file) + 7407 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7413 # check output + 7414 (check-stream-equal _test-output-stream "" "F - test-copy-to-with-output: output should be empty") + 7415 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-to' must not have any outputs" "F - test-copy-to-with-output: error message") + 7416 # check that stop(1) was called + 7417 (check-ints-equal *(edx+4) 2 "F - test-copy-to-with-output: exit status") + 7418 # don't restore from ebp + 7419 81 0/subop/add %esp 8/imm32 + 7420 # . epilogue + 7421 5d/pop-to-ebp + 7422 c3/return + 7423 + 7424 test-copy-to-invalid-value-to-address: + 7425 # . prologue + 7426 55/push-ebp + 7427 89/<- %ebp 4/r32/esp + 7428 # setup + 7429 (clear-stream _test-input-stream) + 7430 (clear-stream $_test-input-buffered-file->buffer) + 7431 (clear-stream _test-output-stream) + 7432 (clear-stream $_test-output-buffered-file->buffer) + 7433 (clear-stream _test-error-stream) + 7434 (clear-stream $_test-error-buffered-file->buffer) + 7435 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7436 68/push 0/imm32 + 7437 68/push 0/imm32 + 7438 89/<- %edx 4/r32/esp + 7439 (tailor-exit-descriptor %edx 0x10) + 7440 # + 7441 (write _test-input-stream "fn foo {\n") + 7442 (write _test-input-stream " var x/eax: int <- copy 0\n") + 7443 (write _test-input-stream " var y: (addr int)\n") + 7444 (write _test-input-stream " copy-to y, x\n") + 7445 (write _test-input-stream "}\n") + 7446 # convert + 7447 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7448 # registers except esp clobbered at this point + 7449 # restore ed + 7450 89/<- %edx 4/r32/esp + 7451 (flush _test-output-buffered-file) + 7452 (flush _test-error-buffered-file) + 7453 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7459 # check output + 7460 (check-stream-equal _test-output-stream "" "F - test-copy-to-invalid-value-to-address: output should be empty") + 7461 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-to: 'y' must be a non-addr non-offset scalar" "F - test-copy-to-invalid-value-to-address: error message") + 7462 # check that stop(1) was called + 7463 (check-ints-equal *(edx+4) 2 "F - test-copy-to-invalid-value-to-address: exit status") + 7464 # don't restore from ebp + 7465 81 0/subop/add %esp 8/imm32 + 7466 # . epilogue + 7467 5d/pop-to-ebp + 7468 c3/return + 7469 + 7470 test-copy-to-deref-address: + 7471 # . prologue + 7472 55/push-ebp + 7473 89/<- %ebp 4/r32/esp + 7474 # setup + 7475 (clear-stream _test-input-stream) + 7476 (clear-stream $_test-input-buffered-file->buffer) + 7477 (clear-stream _test-output-stream) + 7478 (clear-stream $_test-output-buffered-file->buffer) + 7479 # + 7480 (write _test-input-stream "fn foo {\n") + 7481 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") + 7482 (write _test-input-stream " var y/ecx: (addr addr int) <- copy 0\n") + 7483 (write _test-input-stream " copy-to *y, x\n") + 7484 (write _test-input-stream "}\n") + 7485 # convert + 7486 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 7487 (flush _test-output-buffered-file) + 7488 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7494 # not bothering checking output + 7495 (check-next-stream-line-equal _test-error-stream "" "F - test-copy-to-deref-address: error message") + 7496 # . epilogue + 7497 5d/pop-to-ebp + 7498 c3/return + 7499 + 7500 test-copy-to-non-scalar: + 7501 # . prologue + 7502 55/push-ebp + 7503 89/<- %ebp 4/r32/esp + 7504 # setup + 7505 (clear-stream _test-input-stream) + 7506 (clear-stream $_test-input-buffered-file->buffer) + 7507 (clear-stream _test-output-stream) + 7508 (clear-stream $_test-output-buffered-file->buffer) + 7509 (clear-stream _test-error-stream) + 7510 (clear-stream $_test-error-buffered-file->buffer) + 7511 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7512 68/push 0/imm32 + 7513 68/push 0/imm32 + 7514 89/<- %edx 4/r32/esp + 7515 (tailor-exit-descriptor %edx 0x10) + 7516 # + 7517 (write _test-input-stream "fn foo {\n") + 7518 (write _test-input-stream " var x: (handle int)\n") + 7519 (write _test-input-stream " var y: int\n") + 7520 (write _test-input-stream " copy-to y, x\n") + 7521 (write _test-input-stream "}\n") + 7522 # convert + 7523 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7524 # registers except esp clobbered at this point + 7525 # restore ed + 7526 89/<- %edx 4/r32/esp + 7527 (flush _test-output-buffered-file) + 7528 (flush _test-error-buffered-file) + 7529 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7535 # check output + 7536 (check-stream-equal _test-output-stream "" "F - test-copy-to-non-scalar: output should be empty") + 7537 #? (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-to: 'x' is too large to copy" "F - test-copy-to-non-scalar: error message") + 7538 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-to: source (second inout) is in memory" "F - test-copy-to-non-scalar: error message") + 7539 # check that stop(1) was called + 7540 (check-ints-equal *(edx+4) 2 "F - test-copy-to-non-scalar: exit status") + 7541 # don't restore from ebp + 7542 81 0/subop/add %esp 8/imm32 + 7543 # . epilogue + 7544 5d/pop-to-ebp + 7545 c3/return + 7546 + 7547 test-compare-with-no-inout: + 7548 # . prologue + 7549 55/push-ebp + 7550 89/<- %ebp 4/r32/esp + 7551 # setup + 7552 (clear-stream _test-input-stream) + 7553 (clear-stream $_test-input-buffered-file->buffer) + 7554 (clear-stream _test-output-stream) + 7555 (clear-stream $_test-output-buffered-file->buffer) + 7556 (clear-stream _test-error-stream) + 7557 (clear-stream $_test-error-buffered-file->buffer) + 7558 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7559 68/push 0/imm32 + 7560 68/push 0/imm32 + 7561 89/<- %edx 4/r32/esp + 7562 (tailor-exit-descriptor %edx 0x10) + 7563 # + 7564 (write _test-input-stream "fn foo {\n") + 7565 (write _test-input-stream " var x: boolean\n") + 7566 (write _test-input-stream " compare\n") + 7567 (write _test-input-stream "}\n") + 7568 # convert + 7569 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7570 # registers except esp clobbered at this point + 7571 # restore ed + 7572 89/<- %edx 4/r32/esp + 7573 (flush _test-output-buffered-file) + 7574 (flush _test-error-buffered-file) + 7575 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7581 # check output + 7582 (check-stream-equal _test-output-stream "" "F - test-compare-with-no-inout: output should be empty") + 7583 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'compare' must have two inouts" "F - test-compare-with-no-inout: error message") + 7584 # check that stop(1) was called + 7585 (check-ints-equal *(edx+4) 2 "F - test-compare-with-no-inout: exit status") + 7586 # don't restore from ebp + 7587 81 0/subop/add %esp 8/imm32 + 7588 # . epilogue + 7589 5d/pop-to-ebp + 7590 c3/return + 7591 + 7592 test-compare-with-no-input: + 7593 # . prologue + 7594 55/push-ebp + 7595 89/<- %ebp 4/r32/esp + 7596 # setup + 7597 (clear-stream _test-input-stream) + 7598 (clear-stream $_test-input-buffered-file->buffer) + 7599 (clear-stream _test-output-stream) + 7600 (clear-stream $_test-output-buffered-file->buffer) + 7601 (clear-stream _test-error-stream) + 7602 (clear-stream $_test-error-buffered-file->buffer) + 7603 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7604 68/push 0/imm32 + 7605 68/push 0/imm32 + 7606 89/<- %edx 4/r32/esp + 7607 (tailor-exit-descriptor %edx 0x10) + 7608 # + 7609 (write _test-input-stream "fn foo {\n") + 7610 (write _test-input-stream " var x: boolean\n") + 7611 (write _test-input-stream " compare x\n") + 7612 (write _test-input-stream "}\n") + 7613 # convert + 7614 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7615 # registers except esp clobbered at this point + 7616 # restore ed + 7617 89/<- %edx 4/r32/esp + 7618 (flush _test-output-buffered-file) + 7619 (flush _test-error-buffered-file) + 7620 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7626 # check output + 7627 (check-stream-equal _test-output-stream "" "F - test-compare-with-no-input: output should be empty") + 7628 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'compare' must have two inouts" "F - test-compare-with-no-input: error message") + 7629 # check that stop(1) was called + 7630 (check-ints-equal *(edx+4) 2 "F - test-compare-with-no-input: exit status") + 7631 # don't restore from ebp + 7632 81 0/subop/add %esp 8/imm32 + 7633 # . epilogue + 7634 5d/pop-to-ebp + 7635 c3/return + 7636 + 7637 test-compare-with-too-many-inouts: + 7638 # . prologue + 7639 55/push-ebp + 7640 89/<- %ebp 4/r32/esp + 7641 # setup + 7642 (clear-stream _test-input-stream) + 7643 (clear-stream $_test-input-buffered-file->buffer) + 7644 (clear-stream _test-output-stream) + 7645 (clear-stream $_test-output-buffered-file->buffer) + 7646 (clear-stream _test-error-stream) + 7647 (clear-stream $_test-error-buffered-file->buffer) + 7648 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7649 68/push 0/imm32 + 7650 68/push 0/imm32 + 7651 89/<- %edx 4/r32/esp + 7652 (tailor-exit-descriptor %edx 0x10) + 7653 # + 7654 (write _test-input-stream "fn foo {\n") + 7655 (write _test-input-stream " var x: boolean\n") + 7656 (write _test-input-stream " compare x, 0, 0\n") + 7657 (write _test-input-stream "}\n") + 7658 # convert + 7659 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7660 # registers except esp clobbered at this point + 7661 # restore ed + 7662 89/<- %edx 4/r32/esp + 7663 (flush _test-output-buffered-file) + 7664 (flush _test-error-buffered-file) + 7665 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7671 # check output + 7672 (check-stream-equal _test-output-stream "" "F - test-compare-with-too-many-inouts: output should be empty") + 7673 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'compare' must have two inouts" "F - test-compare-with-too-many-inouts: error message") + 7674 # check that stop(1) was called + 7675 (check-ints-equal *(edx+4) 2 "F - test-compare-with-too-many-inouts: exit status") + 7676 # don't restore from ebp + 7677 81 0/subop/add %esp 8/imm32 + 7678 # . epilogue + 7679 5d/pop-to-ebp + 7680 c3/return + 7681 + 7682 test-compare-with-output: + 7683 # . prologue + 7684 55/push-ebp + 7685 89/<- %ebp 4/r32/esp + 7686 # setup + 7687 (clear-stream _test-input-stream) + 7688 (clear-stream $_test-input-buffered-file->buffer) + 7689 (clear-stream _test-output-stream) + 7690 (clear-stream $_test-output-buffered-file->buffer) + 7691 (clear-stream _test-error-stream) + 7692 (clear-stream $_test-error-buffered-file->buffer) + 7693 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7694 68/push 0/imm32 + 7695 68/push 0/imm32 + 7696 89/<- %edx 4/r32/esp + 7697 (tailor-exit-descriptor %edx 0x10) + 7698 # + 7699 (write _test-input-stream "fn foo {\n") + 7700 (write _test-input-stream " var x/eax: boolean <- copy 0\n") + 7701 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") + 7702 (write _test-input-stream " x <- compare y, 0\n") + 7703 (write _test-input-stream "}\n") + 7704 # convert + 7705 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7706 # registers except esp clobbered at this point + 7707 # restore ed + 7708 89/<- %edx 4/r32/esp + 7709 (flush _test-output-buffered-file) + 7710 (flush _test-error-buffered-file) + 7711 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7717 # check output + 7718 (check-stream-equal _test-output-stream "" "F - test-compare-with-output: output should be empty") + 7719 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'compare' must not have any outputs" "F - test-compare-with-output: error message") + 7720 # check that stop(1) was called + 7721 (check-ints-equal *(edx+4) 2 "F - test-compare-with-output: exit status") + 7722 # don't restore from ebp + 7723 81 0/subop/add %esp 8/imm32 + 7724 # . epilogue + 7725 5d/pop-to-ebp + 7726 c3/return + 7727 + 7728 test-compare-invalid-value-to-address: + 7729 # . prologue + 7730 55/push-ebp + 7731 89/<- %ebp 4/r32/esp + 7732 # setup + 7733 (clear-stream _test-input-stream) + 7734 (clear-stream $_test-input-buffered-file->buffer) + 7735 (clear-stream _test-output-stream) + 7736 (clear-stream $_test-output-buffered-file->buffer) + 7737 (clear-stream _test-error-stream) + 7738 (clear-stream $_test-error-buffered-file->buffer) + 7739 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7740 68/push 0/imm32 + 7741 68/push 0/imm32 + 7742 89/<- %edx 4/r32/esp + 7743 (tailor-exit-descriptor %edx 0x10) + 7744 # + 7745 (write _test-input-stream "fn foo {\n") + 7746 (write _test-input-stream " var x/eax: int <- copy 0\n") + 7747 (write _test-input-stream " var y: (addr int)\n") + 7748 (write _test-input-stream " compare y, x\n") + 7749 (write _test-input-stream "}\n") + 7750 # convert + 7751 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7752 # registers except esp clobbered at this point + 7753 # restore ed + 7754 89/<- %edx 4/r32/esp + 7755 (flush _test-output-buffered-file) + 7756 (flush _test-error-buffered-file) + 7757 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7763 # check output + 7764 (check-stream-equal _test-output-stream "" "F - test-compare-invalid-value-to-address: output should be empty") + 7765 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compare: 'y' must be a non-addr non-offset scalar" "F - test-compare-invalid-value-to-address: error message") + 7766 # check that stop(1) was called + 7767 (check-ints-equal *(edx+4) 2 "F - test-compare-invalid-value-to-address: exit status") + 7768 # don't restore from ebp + 7769 81 0/subop/add %esp 8/imm32 + 7770 # . epilogue + 7771 5d/pop-to-ebp + 7772 c3/return + 7773 + 7774 test-compare-address: + 7775 # . prologue + 7776 55/push-ebp + 7777 89/<- %ebp 4/r32/esp + 7778 # setup + 7779 (clear-stream _test-input-stream) + 7780 (clear-stream $_test-input-buffered-file->buffer) + 7781 (clear-stream _test-output-stream) + 7782 (clear-stream $_test-output-buffered-file->buffer) + 7783 # + 7784 (write _test-input-stream "fn foo {\n") + 7785 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") + 7786 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") + 7787 (write _test-input-stream " compare y, x\n") + 7788 (write _test-input-stream "}\n") + 7789 # convert + 7790 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 7791 (flush _test-output-buffered-file) + 7792 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7798 # not bothering checking output + 7799 (check-next-stream-line-equal _test-error-stream "" "F - test-compare-address: error message") + 7800 # . epilogue + 7801 5d/pop-to-ebp + 7802 c3/return + 7803 + 7804 test-compare-deref-address: + 7805 # . prologue + 7806 55/push-ebp + 7807 89/<- %ebp 4/r32/esp + 7808 # setup + 7809 (clear-stream _test-input-stream) + 7810 (clear-stream $_test-input-buffered-file->buffer) + 7811 (clear-stream _test-output-stream) + 7812 (clear-stream $_test-output-buffered-file->buffer) + 7813 # + 7814 (write _test-input-stream "fn foo {\n") + 7815 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") + 7816 (write _test-input-stream " var y/ecx: (addr addr int) <- copy 0\n") + 7817 (write _test-input-stream " compare *y, x\n") + 7818 (write _test-input-stream "}\n") + 7819 # convert + 7820 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 7821 (flush _test-output-buffered-file) + 7822 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7828 # not bothering checking output + 7829 (check-next-stream-line-equal _test-error-stream "" "F - test-compare-deref-address: error message") + 7830 # . epilogue + 7831 5d/pop-to-ebp + 7832 c3/return + 7833 + 7834 test-compare-two-vars-in-memory: + 7835 # . prologue + 7836 55/push-ebp + 7837 89/<- %ebp 4/r32/esp + 7838 # setup + 7839 (clear-stream _test-input-stream) + 7840 (clear-stream $_test-input-buffered-file->buffer) + 7841 (clear-stream _test-output-stream) + 7842 (clear-stream $_test-output-buffered-file->buffer) + 7843 (clear-stream _test-error-stream) + 7844 (clear-stream $_test-error-buffered-file->buffer) + 7845 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7846 68/push 0/imm32 + 7847 68/push 0/imm32 + 7848 89/<- %edx 4/r32/esp + 7849 (tailor-exit-descriptor %edx 0x10) + 7850 # + 7851 (write _test-input-stream "fn foo {\n") + 7852 (write _test-input-stream " var x: boolean\n") + 7853 (write _test-input-stream " compare x, x\n") + 7854 (write _test-input-stream "}\n") + 7855 # convert + 7856 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7857 # registers except esp clobbered at this point + 7858 # restore ed + 7859 89/<- %edx 4/r32/esp + 7860 (flush _test-output-buffered-file) + 7861 (flush _test-error-buffered-file) + 7862 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7868 # check output + 7869 (check-stream-equal _test-output-stream "" "F - test-compare-two-vars-in-memory: output should be empty") + 7870 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compare: both inouts are in memory" "F - test-compare-two-vars-in-memory: error message") + 7871 # check that stop(1) was called + 7872 (check-ints-equal *(edx+4) 2 "F - test-compare-two-vars-in-memory: exit status") + 7873 # don't restore from ebp + 7874 81 0/subop/add %esp 8/imm32 + 7875 # . epilogue + 7876 5d/pop-to-ebp + 7877 c3/return + 7878 + 7879 test-compare-non-scalar: + 7880 # . prologue + 7881 55/push-ebp + 7882 89/<- %ebp 4/r32/esp + 7883 # setup + 7884 (clear-stream _test-input-stream) + 7885 (clear-stream $_test-input-buffered-file->buffer) + 7886 (clear-stream _test-output-stream) + 7887 (clear-stream $_test-output-buffered-file->buffer) + 7888 (clear-stream _test-error-stream) + 7889 (clear-stream $_test-error-buffered-file->buffer) + 7890 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7891 68/push 0/imm32 + 7892 68/push 0/imm32 + 7893 89/<- %edx 4/r32/esp + 7894 (tailor-exit-descriptor %edx 0x10) + 7895 # + 7896 (write _test-input-stream "fn foo {\n") + 7897 (write _test-input-stream " var x: (handle int)\n") + 7898 (write _test-input-stream " var y: int\n") + 7899 (write _test-input-stream " compare y, x\n") + 7900 (write _test-input-stream "}\n") + 7901 # convert + 7902 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7903 # registers except esp clobbered at this point + 7904 # restore ed + 7905 89/<- %edx 4/r32/esp + 7906 (flush _test-output-buffered-file) + 7907 (flush _test-error-buffered-file) + 7908 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7914 # check output + 7915 (check-stream-equal _test-output-stream "" "F - test-compare-non-scalar: output should be empty") + 7916 #? (check-next-stream-line-equal _test-error-stream "fn foo: stmt compare: 'x' is too large to compare" "F - test-compare-non-scalar: error message") + 7917 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compare: both inouts are in memory" "F - test-compare-non-scalar: error message") + 7918 # check that stop(1) was called + 7919 (check-ints-equal *(edx+4) 2 "F - test-compare-non-scalar: exit status") + 7920 # don't restore from ebp + 7921 81 0/subop/add %esp 8/imm32 7922 # . epilogue - 7923 89/<- %esp 5/r32/ebp - 7924 5d/pop-to-ebp - 7925 c3/return - 7926 - 7927 test-address-with-right-type-for-stream: - 7928 # . prologue - 7929 55/push-ebp - 7930 89/<- %ebp 4/r32/esp - 7931 # setup - 7932 (clear-stream _test-input-stream) - 7933 (clear-stream $_test-input-buffered-file->buffer) - 7934 (clear-stream _test-output-stream) - 7935 (clear-stream $_test-output-buffered-file->buffer) - 7936 # - 7937 (write _test-input-stream "fn foo {\n") - 7938 (write _test-input-stream " var x: (stream int 3)\n") - 7939 (write _test-input-stream " var y/eax: (addr stream int) <- address x\n") - 7940 (write _test-input-stream "}\n") - 7941 # convert - 7942 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 7943 (flush _test-output-buffered-file) - 7944 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7950 # no error - 7951 (check-next-stream-line-equal _test-error-stream "" "F - test-address-with-right-type-for-stream: error message") - 7952 # don't bother checking output - 7953 # . epilogue - 7954 89/<- %esp 5/r32/ebp - 7955 5d/pop-to-ebp - 7956 c3/return - 7957 - 7958 test-get-with-wrong-field: - 7959 # . prologue - 7960 55/push-ebp - 7961 89/<- %ebp 4/r32/esp - 7962 # setup - 7963 (clear-stream _test-input-stream) - 7964 (clear-stream $_test-input-buffered-file->buffer) - 7965 (clear-stream _test-output-stream) - 7966 (clear-stream $_test-output-buffered-file->buffer) - 7967 (clear-stream _test-error-stream) - 7968 (clear-stream $_test-error-buffered-file->buffer) - 7969 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 7970 68/push 0/imm32 - 7971 68/push 0/imm32 - 7972 89/<- %edx 4/r32/esp - 7973 (tailor-exit-descriptor %edx 0x10) - 7974 # - 7975 (write _test-input-stream "fn foo {\n") - 7976 (write _test-input-stream " var a: t\n") - 7977 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 7978 (write _test-input-stream "}\n") - 7979 (write _test-input-stream "type t {\n") - 7980 (write _test-input-stream " x: int\n") - 7981 (write _test-input-stream "}\n") - 7982 # convert - 7983 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 7984 # registers except esp clobbered at this point - 7985 # restore ed - 7986 89/<- %edx 4/r32/esp - 7987 (flush _test-output-buffered-file) - 7988 (flush _test-error-buffered-file) - 7989 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 7995 # check output - 7996 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-field: output should be empty") - 7997 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: type 't' has no member called 'y'" "F - test-get-with-wrong-field: error message") - 7998 # check that stop(1) was called - 7999 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-field: exit status") - 8000 # don't restore from ebp - 8001 81 0/subop/add %esp 8/imm32 - 8002 # . epilogue - 8003 5d/pop-to-ebp - 8004 c3/return - 8005 - 8006 test-get-with-wrong-base-type: - 8007 # . prologue - 8008 55/push-ebp - 8009 89/<- %ebp 4/r32/esp - 8010 # setup - 8011 (clear-stream _test-input-stream) - 8012 (clear-stream $_test-input-buffered-file->buffer) - 8013 (clear-stream _test-output-stream) - 8014 (clear-stream $_test-output-buffered-file->buffer) - 8015 (clear-stream _test-error-stream) - 8016 (clear-stream $_test-error-buffered-file->buffer) - 8017 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8018 68/push 0/imm32 - 8019 68/push 0/imm32 - 8020 89/<- %edx 4/r32/esp - 8021 (tailor-exit-descriptor %edx 0x10) - 8022 # - 8023 (write _test-input-stream "fn foo {\n") - 8024 (write _test-input-stream " var a: int\n") - 8025 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 8026 (write _test-input-stream "}\n") - 8027 # convert - 8028 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8029 # registers except esp clobbered at this point - 8030 # restore ed - 8031 89/<- %edx 4/r32/esp - 8032 (flush _test-output-buffered-file) - 8033 (flush _test-error-buffered-file) - 8034 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8040 # check output - 8041 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-base-type: output should be empty") - 8042 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: var 'a' must have a 'type' definition" "F - test-get-with-wrong-base-type: error message") - 8043 # check that stop(1) was called - 8044 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-base-type: exit status") - 8045 # don't restore from ebp - 8046 81 0/subop/add %esp 8/imm32 - 8047 # . epilogue - 8048 5d/pop-to-ebp - 8049 c3/return - 8050 - 8051 test-get-with-wrong-base-type-2: - 8052 # . prologue - 8053 55/push-ebp - 8054 89/<- %ebp 4/r32/esp - 8055 # setup - 8056 (clear-stream _test-input-stream) - 8057 (clear-stream $_test-input-buffered-file->buffer) - 8058 (clear-stream _test-output-stream) - 8059 (clear-stream $_test-output-buffered-file->buffer) - 8060 (clear-stream _test-error-stream) - 8061 (clear-stream $_test-error-buffered-file->buffer) - 8062 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8063 68/push 0/imm32 - 8064 68/push 0/imm32 - 8065 89/<- %edx 4/r32/esp - 8066 (tailor-exit-descriptor %edx 0x10) - 8067 # - 8068 (write _test-input-stream "fn foo {\n") - 8069 (write _test-input-stream " var a: (addr t)\n") - 8070 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") - 8071 (write _test-input-stream "}\n") - 8072 (write _test-input-stream "type t {\n") - 8073 (write _test-input-stream " x: int\n") - 8074 (write _test-input-stream "}\n") - 8075 # convert - 8076 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8077 # registers except esp clobbered at this point - 8078 # restore ed - 8079 89/<- %edx 4/r32/esp - 8080 (flush _test-output-buffered-file) - 8081 (flush _test-error-buffered-file) - 8082 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8088 # check output - 8089 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-base-type-2: output should be empty") - 8090 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: var 'a' is an 'addr' type, and so must live in a register" "F - test-get-with-wrong-base-type-2: error message") - 8091 # check that stop(1) was called - 8092 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-base-type-2: exit status") - 8093 # don't restore from ebp - 8094 81 0/subop/add %esp 8/imm32 - 8095 # . epilogue - 8096 5d/pop-to-ebp - 8097 c3/return - 8098 - 8099 test-get-with-wrong-offset-type: - 8100 # . prologue - 8101 55/push-ebp - 8102 89/<- %ebp 4/r32/esp - 8103 # setup - 8104 (clear-stream _test-input-stream) - 8105 (clear-stream $_test-input-buffered-file->buffer) - 8106 (clear-stream _test-output-stream) - 8107 (clear-stream $_test-output-buffered-file->buffer) - 8108 (clear-stream _test-error-stream) - 8109 (clear-stream $_test-error-buffered-file->buffer) - 8110 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8111 68/push 0/imm32 - 8112 68/push 0/imm32 - 8113 89/<- %edx 4/r32/esp - 8114 (tailor-exit-descriptor %edx 0x10) - 8115 # - 8116 (write _test-input-stream "fn foo {\n") - 8117 (write _test-input-stream " var a: t\n") - 8118 (write _test-input-stream " var b: int\n") - 8119 (write _test-input-stream " var c/ecx: (addr int) <- get a, b\n") - 8120 (write _test-input-stream "}\n") - 8121 (write _test-input-stream "type t {\n") - 8122 (write _test-input-stream " x: int\n") - 8123 (write _test-input-stream "}\n") - 8124 # convert - 8125 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8126 # registers except esp clobbered at this point - 8127 # restore ed - 8128 89/<- %edx 4/r32/esp - 8129 (flush _test-output-buffered-file) - 8130 (flush _test-error-buffered-file) - 8131 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8137 # check output - 8138 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-offset-type: output should be empty") - 8139 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: type 't' has no member called 'b'" "F - test-get-with-wrong-offset-type: error message") - 8140 # check that stop(1) was called - 8141 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-offset-type: exit status") - 8142 # don't restore from ebp - 8143 81 0/subop/add %esp 8/imm32 - 8144 # . epilogue - 8145 5d/pop-to-ebp - 8146 c3/return - 8147 - 8148 test-get-with-wrong-output-type: - 8149 # . prologue - 8150 55/push-ebp - 8151 89/<- %ebp 4/r32/esp - 8152 # setup - 8153 (clear-stream _test-input-stream) - 8154 (clear-stream $_test-input-buffered-file->buffer) - 8155 (clear-stream _test-output-stream) - 8156 (clear-stream $_test-output-buffered-file->buffer) - 8157 (clear-stream _test-error-stream) - 8158 (clear-stream $_test-error-buffered-file->buffer) - 8159 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8160 68/push 0/imm32 - 8161 68/push 0/imm32 - 8162 89/<- %edx 4/r32/esp - 8163 (tailor-exit-descriptor %edx 0x10) - 8164 # - 8165 (write _test-input-stream "fn foo {\n") - 8166 (write _test-input-stream " var a: t\n") - 8167 (write _test-input-stream " var c: (addr int)\n") - 8168 (write _test-input-stream " c <- get a, x\n") - 8169 (write _test-input-stream "}\n") - 8170 (write _test-input-stream "type t {\n") - 8171 (write _test-input-stream " x: int\n") - 8172 (write _test-input-stream "}\n") - 8173 # convert - 8174 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8175 # registers except esp clobbered at this point - 8176 # restore ed - 8177 89/<- %edx 4/r32/esp - 8178 (flush _test-output-buffered-file) - 8179 (flush _test-error-buffered-file) - 8180 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8186 # check output - 8187 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type: output should be empty") - 8188 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: output 'c' is not in a register" "F - test-get-with-wrong-output-type: error message") - 8189 # check that stop(1) was called - 8190 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type: exit status") - 8191 # don't restore from ebp - 8192 81 0/subop/add %esp 8/imm32 - 8193 # . epilogue - 8194 5d/pop-to-ebp - 8195 c3/return - 8196 - 8197 test-get-with-wrong-output-type-2: - 8198 # . prologue - 8199 55/push-ebp - 8200 89/<- %ebp 4/r32/esp - 8201 # setup - 8202 (clear-stream _test-input-stream) - 8203 (clear-stream $_test-input-buffered-file->buffer) - 8204 (clear-stream _test-output-stream) - 8205 (clear-stream $_test-output-buffered-file->buffer) - 8206 (clear-stream _test-error-stream) - 8207 (clear-stream $_test-error-buffered-file->buffer) - 8208 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8209 68/push 0/imm32 - 8210 68/push 0/imm32 - 8211 89/<- %edx 4/r32/esp - 8212 (tailor-exit-descriptor %edx 0x10) - 8213 # - 8214 (write _test-input-stream "fn foo {\n") - 8215 (write _test-input-stream " var a: t\n") - 8216 (write _test-input-stream " var c/ecx: int <- get a, x\n") - 8217 (write _test-input-stream "}\n") - 8218 (write _test-input-stream "type t {\n") - 8219 (write _test-input-stream " x: int\n") - 8220 (write _test-input-stream "}\n") - 8221 # convert - 8222 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8223 # registers except esp clobbered at this point - 8224 # restore ed - 8225 89/<- %edx 4/r32/esp - 8226 (flush _test-output-buffered-file) - 8227 (flush _test-error-buffered-file) - 8228 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8234 # check output - 8235 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type-2: output should be empty") - 8236 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: output must be an addr" "F - test-get-with-wrong-output-type-2: error message") - 8237 # check that stop(1) was called - 8238 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type-2: exit status") - 8239 # don't restore from ebp - 8240 81 0/subop/add %esp 8/imm32 - 8241 # . epilogue - 8242 5d/pop-to-ebp - 8243 c3/return - 8244 - 8245 test-get-with-wrong-output-type-3: - 8246 # . prologue - 8247 55/push-ebp - 8248 89/<- %ebp 4/r32/esp - 8249 # setup - 8250 (clear-stream _test-input-stream) - 8251 (clear-stream $_test-input-buffered-file->buffer) - 8252 (clear-stream _test-output-stream) - 8253 (clear-stream $_test-output-buffered-file->buffer) - 8254 (clear-stream _test-error-stream) - 8255 (clear-stream $_test-error-buffered-file->buffer) - 8256 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8257 68/push 0/imm32 - 8258 68/push 0/imm32 - 8259 89/<- %edx 4/r32/esp - 8260 (tailor-exit-descriptor %edx 0x10) - 8261 # - 8262 (write _test-input-stream "fn foo {\n") - 8263 (write _test-input-stream " var a: t\n") - 8264 (write _test-input-stream " var c/ecx: (array int) <- get a, x\n") - 8265 (write _test-input-stream "}\n") - 8266 (write _test-input-stream "type t {\n") - 8267 (write _test-input-stream " x: int\n") + 7923 5d/pop-to-ebp + 7924 c3/return + 7925 + 7926 test-address-with-no-inout: + 7927 # . prologue + 7928 55/push-ebp + 7929 89/<- %ebp 4/r32/esp + 7930 # setup + 7931 (clear-stream _test-input-stream) + 7932 (clear-stream $_test-input-buffered-file->buffer) + 7933 (clear-stream _test-output-stream) + 7934 (clear-stream $_test-output-buffered-file->buffer) + 7935 (clear-stream _test-error-stream) + 7936 (clear-stream $_test-error-buffered-file->buffer) + 7937 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7938 68/push 0/imm32 + 7939 68/push 0/imm32 + 7940 89/<- %edx 4/r32/esp + 7941 (tailor-exit-descriptor %edx 0x10) + 7942 # + 7943 (write _test-input-stream "fn foo {\n") + 7944 (write _test-input-stream " var x/eax: boolean <- address\n") + 7945 (write _test-input-stream "}\n") + 7946 # convert + 7947 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7948 # registers except esp clobbered at this point + 7949 # restore ed + 7950 89/<- %edx 4/r32/esp + 7951 (flush _test-output-buffered-file) + 7952 (flush _test-error-buffered-file) + 7953 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 7959 # check output + 7960 (check-stream-equal _test-output-stream "" "F - test-address-with-no-inout: output should be empty") + 7961 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'address' expects an inout" "F - test-address-with-no-inout: error message") + 7962 # check that stop(1) was called + 7963 (check-ints-equal *(edx+4) 2 "F - test-address-with-no-inout: exit status") + 7964 # don't restore from ebp + 7965 81 0/subop/add %esp 8/imm32 + 7966 # . epilogue + 7967 5d/pop-to-ebp + 7968 c3/return + 7969 + 7970 test-address-with-multiple-inouts: + 7971 # . prologue + 7972 55/push-ebp + 7973 89/<- %ebp 4/r32/esp + 7974 # setup + 7975 (clear-stream _test-input-stream) + 7976 (clear-stream $_test-input-buffered-file->buffer) + 7977 (clear-stream _test-output-stream) + 7978 (clear-stream $_test-output-buffered-file->buffer) + 7979 (clear-stream _test-error-stream) + 7980 (clear-stream $_test-error-buffered-file->buffer) + 7981 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 7982 68/push 0/imm32 + 7983 68/push 0/imm32 + 7984 89/<- %edx 4/r32/esp + 7985 (tailor-exit-descriptor %edx 0x10) + 7986 # + 7987 (write _test-input-stream "fn foo {\n") + 7988 (write _test-input-stream " var x/eax: boolean <- address 0, 0\n") + 7989 (write _test-input-stream "}\n") + 7990 # convert + 7991 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 7992 # registers except esp clobbered at this point + 7993 # restore ed + 7994 89/<- %edx 4/r32/esp + 7995 (flush _test-output-buffered-file) + 7996 (flush _test-error-buffered-file) + 7997 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8003 # check output + 8004 (check-stream-equal _test-output-stream "" "F - test-address-with-multiple-inouts: output should be empty") + 8005 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'address' must have just one inout" "F - test-address-with-multiple-inouts: error message") + 8006 # check that stop(1) was called + 8007 (check-ints-equal *(edx+4) 2 "F - test-address-with-multiple-inouts: exit status") + 8008 # don't restore from ebp + 8009 81 0/subop/add %esp 8/imm32 + 8010 # . epilogue + 8011 5d/pop-to-ebp + 8012 c3/return + 8013 + 8014 test-address-with-no-output: + 8015 # . prologue + 8016 55/push-ebp + 8017 89/<- %ebp 4/r32/esp + 8018 # setup + 8019 (clear-stream _test-input-stream) + 8020 (clear-stream $_test-input-buffered-file->buffer) + 8021 (clear-stream _test-output-stream) + 8022 (clear-stream $_test-output-buffered-file->buffer) + 8023 (clear-stream _test-error-stream) + 8024 (clear-stream $_test-error-buffered-file->buffer) + 8025 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8026 68/push 0/imm32 + 8027 68/push 0/imm32 + 8028 89/<- %edx 4/r32/esp + 8029 (tailor-exit-descriptor %edx 0x10) + 8030 # + 8031 (write _test-input-stream "fn foo {\n") + 8032 (write _test-input-stream " address 0\n") + 8033 (write _test-input-stream "}\n") + 8034 # convert + 8035 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8036 # registers except esp clobbered at this point + 8037 # restore ed + 8038 89/<- %edx 4/r32/esp + 8039 (flush _test-output-buffered-file) + 8040 (flush _test-error-buffered-file) + 8041 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8047 # check output + 8048 (check-stream-equal _test-output-stream "" "F - test-address-with-no-output: output should be empty") + 8049 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'address' expects an output" "F - test-address-with-no-output: error message") + 8050 # check that stop(1) was called + 8051 (check-ints-equal *(edx+4) 2 "F - test-address-with-no-output: exit status") + 8052 # don't restore from ebp + 8053 81 0/subop/add %esp 8/imm32 + 8054 # . epilogue + 8055 5d/pop-to-ebp + 8056 c3/return + 8057 + 8058 test-address-with-multiple-outputs: + 8059 # . prologue + 8060 55/push-ebp + 8061 89/<- %ebp 4/r32/esp + 8062 # setup + 8063 (clear-stream _test-input-stream) + 8064 (clear-stream $_test-input-buffered-file->buffer) + 8065 (clear-stream _test-output-stream) + 8066 (clear-stream $_test-output-buffered-file->buffer) + 8067 (clear-stream _test-error-stream) + 8068 (clear-stream $_test-error-buffered-file->buffer) + 8069 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8070 68/push 0/imm32 + 8071 68/push 0/imm32 + 8072 89/<- %edx 4/r32/esp + 8073 (tailor-exit-descriptor %edx 0x10) + 8074 # + 8075 (write _test-input-stream "fn foo {\n") + 8076 (write _test-input-stream " var x/eax: boolean <- copy 0\n") + 8077 (write _test-input-stream " var y/ecx: boolean <- copy 0\n") + 8078 (write _test-input-stream " x, y <- address 0\n") + 8079 (write _test-input-stream "}\n") + 8080 # convert + 8081 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8082 # registers except esp clobbered at this point + 8083 # restore ed + 8084 89/<- %edx 4/r32/esp + 8085 (flush _test-output-buffered-file) + 8086 (flush _test-error-buffered-file) + 8087 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8093 # check output + 8094 (check-stream-equal _test-output-stream "" "F - test-address-with-multiple-outputs: output should be empty") + 8095 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'address' must have just one output" "F - test-address-with-multiple-outputs: error message") + 8096 # check that stop(1) was called + 8097 (check-ints-equal *(edx+4) 2 "F - test-address-with-multiple-outputs: exit status") + 8098 # don't restore from ebp + 8099 81 0/subop/add %esp 8/imm32 + 8100 # . epilogue + 8101 5d/pop-to-ebp + 8102 c3/return + 8103 + 8104 # silly but it works + 8105 test-address-of-deref: + 8106 # . prologue + 8107 55/push-ebp + 8108 89/<- %ebp 4/r32/esp + 8109 # setup + 8110 (clear-stream _test-input-stream) + 8111 (clear-stream $_test-input-buffered-file->buffer) + 8112 (clear-stream _test-output-stream) + 8113 (clear-stream $_test-output-buffered-file->buffer) + 8114 # + 8115 (write _test-input-stream "fn foo {\n") + 8116 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") + 8117 (write _test-input-stream " var y/ecx: (addr int) <- address *x\n") + 8118 (write _test-input-stream "}\n") + 8119 # convert + 8120 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 8121 (flush _test-output-buffered-file) + 8122 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8128 # not bothering checking output + 8129 (check-next-stream-line-equal _test-error-stream "" "F - test-address-of-deref: error message") + 8130 # . epilogue + 8131 5d/pop-to-ebp + 8132 c3/return + 8133 + 8134 test-address-to-non-register: + 8135 # . prologue + 8136 55/push-ebp + 8137 89/<- %ebp 4/r32/esp + 8138 # setup + 8139 (clear-stream _test-input-stream) + 8140 (clear-stream $_test-input-buffered-file->buffer) + 8141 (clear-stream _test-output-stream) + 8142 (clear-stream $_test-output-buffered-file->buffer) + 8143 (clear-stream _test-error-stream) + 8144 (clear-stream $_test-error-buffered-file->buffer) + 8145 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8146 68/push 0/imm32 + 8147 68/push 0/imm32 + 8148 89/<- %edx 4/r32/esp + 8149 (tailor-exit-descriptor %edx 0x10) + 8150 # + 8151 (write _test-input-stream "fn foo {\n") + 8152 (write _test-input-stream " var x: (addr int)\n") + 8153 (write _test-input-stream " x <- address 0\n") + 8154 (write _test-input-stream "}\n") + 8155 # convert + 8156 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8157 # registers except esp clobbered at this point + 8158 # restore ed + 8159 89/<- %edx 4/r32/esp + 8160 (flush _test-output-buffered-file) + 8161 (flush _test-error-buffered-file) + 8162 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8168 # check output + 8169 (check-stream-equal _test-output-stream "" "F - test-address-to-non-register: output should be empty") + 8170 (check-next-stream-line-equal _test-error-stream "fn foo: stmt address: output 'x' not in a register" "F - test-address-to-non-register: error message") + 8171 # check that stop(1) was called + 8172 (check-ints-equal *(edx+4) 2 "F - test-address-to-non-register: exit status") + 8173 # don't restore from ebp + 8174 81 0/subop/add %esp 8/imm32 + 8175 # . epilogue + 8176 5d/pop-to-ebp + 8177 c3/return + 8178 + 8179 test-address-with-wrong-type: + 8180 # . prologue + 8181 55/push-ebp + 8182 89/<- %ebp 4/r32/esp + 8183 # setup + 8184 (clear-stream _test-input-stream) + 8185 (clear-stream $_test-input-buffered-file->buffer) + 8186 (clear-stream _test-output-stream) + 8187 (clear-stream $_test-output-buffered-file->buffer) + 8188 (clear-stream _test-error-stream) + 8189 (clear-stream $_test-error-buffered-file->buffer) + 8190 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8191 68/push 0/imm32 + 8192 68/push 0/imm32 + 8193 89/<- %edx 4/r32/esp + 8194 (tailor-exit-descriptor %edx 0x10) + 8195 # + 8196 (write _test-input-stream "fn foo {\n") + 8197 (write _test-input-stream " var x: int\n") + 8198 (write _test-input-stream " var y/eax: (addr boolean) <- address x\n") + 8199 (write _test-input-stream "}\n") + 8200 # convert + 8201 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8202 # registers except esp clobbered at this point + 8203 # restore ed + 8204 89/<- %edx 4/r32/esp + 8205 (flush _test-output-buffered-file) + 8206 (flush _test-error-buffered-file) + 8207 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8213 # check output + 8214 (check-stream-equal _test-output-stream "" "F - test-address-with-wrong-type: output should be empty") + 8215 (check-next-stream-line-equal _test-error-stream "fn foo: stmt address: output 'y' cannot hold address of 'x'" "F - test-address-with-wrong-type: error message") + 8216 # check that stop(1) was called + 8217 (check-ints-equal *(edx+4) 2 "F - test-address-with-wrong-type: exit status") + 8218 # don't restore from ebp + 8219 81 0/subop/add %esp 8/imm32 + 8220 # . epilogue + 8221 5d/pop-to-ebp + 8222 c3/return + 8223 + 8224 test-address-with-right-type-for-array: + 8225 # . prologue + 8226 55/push-ebp + 8227 89/<- %ebp 4/r32/esp + 8228 # setup + 8229 (clear-stream _test-input-stream) + 8230 (clear-stream $_test-input-buffered-file->buffer) + 8231 (clear-stream _test-output-stream) + 8232 (clear-stream $_test-output-buffered-file->buffer) + 8233 # + 8234 (write _test-input-stream "fn foo {\n") + 8235 (write _test-input-stream " var x: (array int 3)\n") + 8236 (write _test-input-stream " var y/eax: (addr array int) <- address x\n") + 8237 (write _test-input-stream "}\n") + 8238 # convert + 8239 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 8240 (flush _test-output-buffered-file) + 8241 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8247 # no error + 8248 (check-next-stream-line-equal _test-error-stream "" "F - test-address-with-right-type-for-array: error message") + 8249 # don't bother checking output + 8250 # . epilogue + 8251 89/<- %esp 5/r32/ebp + 8252 5d/pop-to-ebp + 8253 c3/return + 8254 + 8255 test-address-with-right-type-for-stream: + 8256 # . prologue + 8257 55/push-ebp + 8258 89/<- %ebp 4/r32/esp + 8259 # setup + 8260 (clear-stream _test-input-stream) + 8261 (clear-stream $_test-input-buffered-file->buffer) + 8262 (clear-stream _test-output-stream) + 8263 (clear-stream $_test-output-buffered-file->buffer) + 8264 # + 8265 (write _test-input-stream "fn foo {\n") + 8266 (write _test-input-stream " var x: (stream int 3)\n") + 8267 (write _test-input-stream " var y/eax: (addr stream int) <- address x\n") 8268 (write _test-input-stream "}\n") 8269 # convert - 8270 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8271 # registers except esp clobbered at this point - 8272 # restore ed - 8273 89/<- %edx 4/r32/esp - 8274 (flush _test-output-buffered-file) - 8275 (flush _test-error-buffered-file) - 8276 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8282 # check output - 8283 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type-3: output should be empty") - 8284 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: output must be an addr" "F - test-get-with-wrong-output-type-3: error message") - 8285 # check that stop(1) was called - 8286 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type-3: exit status") - 8287 # don't restore from ebp - 8288 81 0/subop/add %esp 8/imm32 - 8289 # . epilogue - 8290 5d/pop-to-ebp - 8291 c3/return - 8292 - 8293 test-get-with-wrong-output-type-4: - 8294 # . prologue - 8295 55/push-ebp - 8296 89/<- %ebp 4/r32/esp - 8297 # setup - 8298 (clear-stream _test-input-stream) - 8299 (clear-stream $_test-input-buffered-file->buffer) - 8300 (clear-stream _test-output-stream) - 8301 (clear-stream $_test-output-buffered-file->buffer) - 8302 (clear-stream _test-error-stream) - 8303 (clear-stream $_test-error-buffered-file->buffer) - 8304 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8305 68/push 0/imm32 - 8306 68/push 0/imm32 - 8307 89/<- %edx 4/r32/esp - 8308 (tailor-exit-descriptor %edx 0x10) - 8309 # - 8310 (write _test-input-stream "fn foo {\n") - 8311 (write _test-input-stream " var a: t\n") - 8312 (write _test-input-stream " var c/ecx: (addr boolean) <- get a, x\n") - 8313 (write _test-input-stream "}\n") - 8314 (write _test-input-stream "type t {\n") - 8315 (write _test-input-stream " x: int\n") - 8316 (write _test-input-stream "}\n") - 8317 # convert - 8318 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8319 # registers except esp clobbered at this point - 8320 # restore ed - 8321 89/<- %edx 4/r32/esp - 8322 (flush _test-output-buffered-file) - 8323 (flush _test-error-buffered-file) - 8324 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8330 # check output - 8331 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type-4: output should be empty") - 8332 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: wrong output type for member 'x' of type 't'" "F - test-get-with-wrong-output-type-4: error message") - 8333 # check that stop(1) was called - 8334 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type-4: exit status") - 8335 # don't restore from ebp - 8336 81 0/subop/add %esp 8/imm32 - 8337 # . epilogue - 8338 5d/pop-to-ebp - 8339 c3/return - 8340 - 8341 test-get-with-wrong-output-type-5: - 8342 # . prologue - 8343 55/push-ebp - 8344 89/<- %ebp 4/r32/esp - 8345 # setup - 8346 (clear-stream _test-input-stream) - 8347 (clear-stream $_test-input-buffered-file->buffer) - 8348 (clear-stream _test-output-stream) - 8349 (clear-stream $_test-output-buffered-file->buffer) + 8270 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 8271 (flush _test-output-buffered-file) + 8272 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8278 # no error + 8279 (check-next-stream-line-equal _test-error-stream "" "F - test-address-with-right-type-for-stream: error message") + 8280 # don't bother checking output + 8281 # . epilogue + 8282 89/<- %esp 5/r32/ebp + 8283 5d/pop-to-ebp + 8284 c3/return + 8285 + 8286 test-get-with-wrong-field: + 8287 # . prologue + 8288 55/push-ebp + 8289 89/<- %ebp 4/r32/esp + 8290 # setup + 8291 (clear-stream _test-input-stream) + 8292 (clear-stream $_test-input-buffered-file->buffer) + 8293 (clear-stream _test-output-stream) + 8294 (clear-stream $_test-output-buffered-file->buffer) + 8295 (clear-stream _test-error-stream) + 8296 (clear-stream $_test-error-buffered-file->buffer) + 8297 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8298 68/push 0/imm32 + 8299 68/push 0/imm32 + 8300 89/<- %edx 4/r32/esp + 8301 (tailor-exit-descriptor %edx 0x10) + 8302 # + 8303 (write _test-input-stream "fn foo {\n") + 8304 (write _test-input-stream " var a: t\n") + 8305 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 8306 (write _test-input-stream "}\n") + 8307 (write _test-input-stream "type t {\n") + 8308 (write _test-input-stream " x: int\n") + 8309 (write _test-input-stream "}\n") + 8310 # convert + 8311 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8312 # registers except esp clobbered at this point + 8313 # restore ed + 8314 89/<- %edx 4/r32/esp + 8315 (flush _test-output-buffered-file) + 8316 (flush _test-error-buffered-file) + 8317 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8323 # check output + 8324 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-field: output should be empty") + 8325 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: type 't' has no member called 'y'" "F - test-get-with-wrong-field: error message") + 8326 # check that stop(1) was called + 8327 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-field: exit status") + 8328 # don't restore from ebp + 8329 81 0/subop/add %esp 8/imm32 + 8330 # . epilogue + 8331 5d/pop-to-ebp + 8332 c3/return + 8333 + 8334 test-get-with-wrong-base-type: + 8335 # . prologue + 8336 55/push-ebp + 8337 89/<- %ebp 4/r32/esp + 8338 # setup + 8339 (clear-stream _test-input-stream) + 8340 (clear-stream $_test-input-buffered-file->buffer) + 8341 (clear-stream _test-output-stream) + 8342 (clear-stream $_test-output-buffered-file->buffer) + 8343 (clear-stream _test-error-stream) + 8344 (clear-stream $_test-error-buffered-file->buffer) + 8345 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8346 68/push 0/imm32 + 8347 68/push 0/imm32 + 8348 89/<- %edx 4/r32/esp + 8349 (tailor-exit-descriptor %edx 0x10) 8350 # 8351 (write _test-input-stream "fn foo {\n") - 8352 (write _test-input-stream " var a: t\n") - 8353 (write _test-input-stream " var c/ecx: (addr handle int) <- get a, x\n") + 8352 (write _test-input-stream " var a: int\n") + 8353 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") 8354 (write _test-input-stream "}\n") - 8355 (write _test-input-stream "type t {\n") - 8356 (write _test-input-stream " x: (handle int)\n") - 8357 (write _test-input-stream "}\n") - 8358 # convert - 8359 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 8355 # convert + 8356 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8357 # registers except esp clobbered at this point + 8358 # restore ed + 8359 89/<- %edx 4/r32/esp 8360 (flush _test-output-buffered-file) - 8361 # no errors - 8362 # . epilogue - 8363 89/<- %esp 5/r32/ebp - 8364 5d/pop-to-ebp - 8365 c3/return - 8366 - 8367 test-get-with-too-few-inouts: - 8368 # . prologue - 8369 55/push-ebp - 8370 89/<- %ebp 4/r32/esp - 8371 # setup - 8372 (clear-stream _test-input-stream) - 8373 (clear-stream $_test-input-buffered-file->buffer) - 8374 (clear-stream _test-output-stream) - 8375 (clear-stream $_test-output-buffered-file->buffer) - 8376 (clear-stream _test-error-stream) - 8377 (clear-stream $_test-error-buffered-file->buffer) - 8378 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8379 68/push 0/imm32 - 8380 68/push 0/imm32 - 8381 89/<- %edx 4/r32/esp - 8382 (tailor-exit-descriptor %edx 0x10) - 8383 # - 8384 (write _test-input-stream "fn foo {\n") - 8385 (write _test-input-stream " var a: t\n") - 8386 (write _test-input-stream " var c/ecx: (addr int) <- get a\n") - 8387 (write _test-input-stream "}\n") - 8388 (write _test-input-stream "type t {\n") - 8389 (write _test-input-stream " x: int\n") - 8390 (write _test-input-stream "}\n") - 8391 # convert - 8392 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8393 # registers except esp clobbered at this point - 8394 # restore ed - 8395 89/<- %edx 4/r32/esp - 8396 (flush _test-output-buffered-file) - 8397 (flush _test-error-buffered-file) - 8398 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8404 # check output - 8405 (check-stream-equal _test-output-stream "" "F - test-get-with-too-few-inouts: output should be empty") - 8406 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: too few inouts (2 required)" "F - test-get-with-too-few-inouts: error message") - 8407 # check that stop(1) was called - 8408 (check-ints-equal *(edx+4) 2 "F - test-get-with-too-few-inouts: exit status") - 8409 # don't restore from ebp - 8410 81 0/subop/add %esp 8/imm32 - 8411 # . epilogue - 8412 5d/pop-to-ebp - 8413 c3/return - 8414 - 8415 test-get-with-too-many-inouts: - 8416 # . prologue - 8417 55/push-ebp - 8418 89/<- %ebp 4/r32/esp - 8419 # setup - 8420 (clear-stream _test-input-stream) - 8421 (clear-stream $_test-input-buffered-file->buffer) - 8422 (clear-stream _test-output-stream) - 8423 (clear-stream $_test-output-buffered-file->buffer) - 8424 (clear-stream _test-error-stream) - 8425 (clear-stream $_test-error-buffered-file->buffer) - 8426 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8427 68/push 0/imm32 - 8428 68/push 0/imm32 - 8429 89/<- %edx 4/r32/esp - 8430 (tailor-exit-descriptor %edx 0x10) - 8431 # - 8432 (write _test-input-stream "fn foo {\n") - 8433 (write _test-input-stream " var a: t\n") - 8434 (write _test-input-stream " var c/ecx: (addr int) <- get a, x, 0\n") - 8435 (write _test-input-stream "}\n") - 8436 (write _test-input-stream "type t {\n") - 8437 (write _test-input-stream " x: int\n") - 8438 (write _test-input-stream "}\n") - 8439 # convert - 8440 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8441 # registers except esp clobbered at this point - 8442 # restore ed - 8443 89/<- %edx 4/r32/esp - 8444 (flush _test-output-buffered-file) - 8445 (flush _test-error-buffered-file) - 8446 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8452 # check output - 8453 (check-stream-equal _test-output-stream "" "F - test-get-with-too-many-inouts: output should be empty") - 8454 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: too many inouts (2 required)" "F - test-get-with-too-many-inouts: error message") - 8455 # check that stop(1) was called - 8456 (check-ints-equal *(edx+4) 2 "F - test-get-with-too-many-inouts: exit status") - 8457 # don't restore from ebp - 8458 81 0/subop/add %esp 8/imm32 - 8459 # . epilogue - 8460 5d/pop-to-ebp - 8461 c3/return - 8462 - 8463 test-get-with-no-output: - 8464 # . prologue - 8465 55/push-ebp - 8466 89/<- %ebp 4/r32/esp - 8467 # setup - 8468 (clear-stream _test-input-stream) - 8469 (clear-stream $_test-input-buffered-file->buffer) - 8470 (clear-stream _test-output-stream) - 8471 (clear-stream $_test-output-buffered-file->buffer) - 8472 (clear-stream _test-error-stream) - 8473 (clear-stream $_test-error-buffered-file->buffer) - 8474 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8475 68/push 0/imm32 - 8476 68/push 0/imm32 - 8477 89/<- %edx 4/r32/esp - 8478 (tailor-exit-descriptor %edx 0x10) - 8479 # - 8480 (write _test-input-stream "fn foo {\n") - 8481 (write _test-input-stream " var a: t\n") - 8482 (write _test-input-stream " get a, x\n") - 8483 (write _test-input-stream "}\n") - 8484 (write _test-input-stream "type t {\n") - 8485 (write _test-input-stream " x: int\n") - 8486 (write _test-input-stream "}\n") - 8487 # convert - 8488 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8489 # registers except esp clobbered at this point - 8490 # restore ed - 8491 89/<- %edx 4/r32/esp - 8492 (flush _test-output-buffered-file) - 8493 (flush _test-error-buffered-file) - 8494 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8500 # check output - 8501 (check-stream-equal _test-output-stream "" "F - test-get-with-no-output: output should be empty") - 8502 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: must have an output" "F - test-get-with-no-output: error message") - 8503 # check that stop(1) was called - 8504 (check-ints-equal *(edx+4) 2 "F - test-get-with-no-output: exit status") - 8505 # don't restore from ebp - 8506 81 0/subop/add %esp 8/imm32 - 8507 # . epilogue - 8508 5d/pop-to-ebp - 8509 c3/return - 8510 - 8511 test-get-with-too-many-outputs: - 8512 # . prologue - 8513 55/push-ebp - 8514 89/<- %ebp 4/r32/esp - 8515 # setup - 8516 (clear-stream _test-input-stream) - 8517 (clear-stream $_test-input-buffered-file->buffer) - 8518 (clear-stream _test-output-stream) - 8519 (clear-stream $_test-output-buffered-file->buffer) - 8520 (clear-stream _test-error-stream) - 8521 (clear-stream $_test-error-buffered-file->buffer) - 8522 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8523 68/push 0/imm32 - 8524 68/push 0/imm32 - 8525 89/<- %edx 4/r32/esp - 8526 (tailor-exit-descriptor %edx 0x10) - 8527 # - 8528 (write _test-input-stream "fn foo {\n") - 8529 (write _test-input-stream " var a: t\n") - 8530 (write _test-input-stream " var b: int\n") - 8531 (write _test-input-stream " var c/eax: (addr int) <- copy 0\n") - 8532 (write _test-input-stream " c, b <- get a, x\n") - 8533 (write _test-input-stream "}\n") - 8534 (write _test-input-stream "type t {\n") - 8535 (write _test-input-stream " x: int\n") - 8536 (write _test-input-stream "}\n") - 8537 # convert - 8538 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8539 # registers except esp clobbered at this point - 8540 # restore ed - 8541 89/<- %edx 4/r32/esp - 8542 (flush _test-output-buffered-file) - 8543 (flush _test-error-buffered-file) - 8544 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8550 # check output - 8551 (check-stream-equal _test-output-stream "" "F - test-get-with-too-many-outputs: output should be empty") - 8552 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: too many outputs (1 required)" "F - test-get-with-too-many-outputs: error message") - 8553 # check that stop(1) was called - 8554 (check-ints-equal *(edx+4) 2 "F - test-get-with-too-many-outputs: exit status") - 8555 # don't restore from ebp - 8556 81 0/subop/add %esp 8/imm32 - 8557 # . epilogue - 8558 5d/pop-to-ebp - 8559 c3/return - 8560 - 8561 test-convert-array-of-user-defined-types: - 8562 # . prologue - 8563 55/push-ebp - 8564 89/<- %ebp 4/r32/esp - 8565 # setup - 8566 (clear-stream _test-input-stream) - 8567 (clear-stream $_test-input-buffered-file->buffer) - 8568 (clear-stream _test-output-stream) - 8569 (clear-stream $_test-output-buffered-file->buffer) - 8570 # - 8571 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 - 8572 (write _test-input-stream " x: int\n") - 8573 (write _test-input-stream " y: int\n") - 8574 (write _test-input-stream "}\n") - 8575 (write _test-input-stream "fn foo {\n") - 8576 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 8577 (write _test-input-stream " var idx/ecx: int <- copy 3\n") - 8578 (write _test-input-stream " var x/eax: (addr t) <- index arr, idx\n") - 8579 (write _test-input-stream "}\n") - 8580 # convert - 8581 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 8582 (flush _test-output-buffered-file) - 8583 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 8589 # check output - 8590 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-array-of-user-defined-types/0") - 8591 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-array-of-user-defined-types/1") - 8592 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-array-of-user-defined-types/2") - 8593 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-array-of-user-defined-types/3") - 8594 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-array-of-user-defined-types/4") - 8595 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-array-of-user-defined-types/5") - 8596 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-array-of-user-defined-types/6") - 8597 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-array-of-user-defined-types/7") - 8598 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-array-of-user-defined-types/8") - 8599 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-array-of-user-defined-types/9") - 8600 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000003 + 4) 0x00000000/r32" "F - test-convert-array-of-user-defined-types/11") - 8601 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-array-of-user-defined-types/13") - 8602 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-array-of-user-defined-types/14") - 8603 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-array-of-user-defined-types/15") - 8604 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-array-of-user-defined-types/16") - 8605 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-array-of-user-defined-types/17") - 8606 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-array-of-user-defined-types/18") - 8607 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-array-of-user-defined-types/19") - 8608 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-array-of-user-defined-types/20") - 8609 # . epilogue - 8610 89/<- %esp 5/r32/ebp - 8611 5d/pop-to-ebp - 8612 c3/return - 8613 - 8614 test-convert-length-of-array-of-user-defined-types-to-eax: - 8615 # . prologue - 8616 55/push-ebp - 8617 89/<- %ebp 4/r32/esp - 8618 # setup - 8619 (clear-stream _test-input-stream) - 8620 (clear-stream $_test-input-buffered-file->buffer) - 8621 (clear-stream _test-output-stream) - 8622 (clear-stream $_test-output-buffered-file->buffer) - 8623 # - 8624 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 - 8625 (write _test-input-stream " x: int\n") - 8626 (write _test-input-stream " y: int\n") - 8627 (write _test-input-stream " z: int\n") - 8628 (write _test-input-stream "}\n") - 8629 (write _test-input-stream "fn foo {\n") - 8630 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 8631 (write _test-input-stream " var x/eax: int <- length arr\n") - 8632 (write _test-input-stream "}\n") - 8633 # convert - 8634 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 8635 (flush _test-output-buffered-file) - 8636 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 8642 # check output - 8643 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/0") - 8644 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/1") - 8645 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-eax/2") - 8646 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-user-defined-types-to-eax/3") - 8647 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-eax/4") - 8648 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/5") - 8649 # var arr - 8650 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-user-defined-types-to-eax/6") - 8651 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-length-of-array-of-user-defined-types-to-eax/7") - 8652 # length instruction - 8653 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/8") - 8654 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/9") - 8655 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-user-defined-types-to-eax/10") - 8656 (check-next-stream-line-equal _test-output-stream " 31/xor %edx 2/r32/edx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/11") - 8657 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x0000000c/imm32" "F - test-convert-length-of-array-of-user-defined-types-to-eax/12") - 8658 (check-next-stream-line-equal _test-output-stream " f7 7/subop/idiv-eax-edx-by %ecx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/13") - 8659 (check-next-stream-line-equal _test-output-stream " 5a/pop-to-edx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/14") - 8660 (check-next-stream-line-equal _test-output-stream " 59/pop-to-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/15") - 8661 # reclaim arr - 8662 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-user-defined-types-to-eax/16") - 8663 # - 8664 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-eax/17") - 8665 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/18") - 8666 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/19") - 8667 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-user-defined-types-to-eax/20") - 8668 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-eax/21") - 8669 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-eax/22") - 8670 # . epilogue - 8671 89/<- %esp 5/r32/ebp - 8672 5d/pop-to-ebp - 8673 c3/return - 8674 - 8675 test-convert-length-of-array-of-user-defined-types-to-ecx: - 8676 # . prologue - 8677 55/push-ebp - 8678 89/<- %ebp 4/r32/esp - 8679 # setup - 8680 (clear-stream _test-input-stream) - 8681 (clear-stream $_test-input-buffered-file->buffer) - 8682 (clear-stream _test-output-stream) - 8683 (clear-stream $_test-output-buffered-file->buffer) - 8684 # - 8685 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 - 8686 (write _test-input-stream " x: int\n") - 8687 (write _test-input-stream " y: int\n") - 8688 (write _test-input-stream " z: int\n") + 8361 (flush _test-error-buffered-file) + 8362 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8368 # check output + 8369 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-base-type: output should be empty") + 8370 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: var 'a' must have a 'type' definition" "F - test-get-with-wrong-base-type: error message") + 8371 # check that stop(1) was called + 8372 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-base-type: exit status") + 8373 # don't restore from ebp + 8374 81 0/subop/add %esp 8/imm32 + 8375 # . epilogue + 8376 5d/pop-to-ebp + 8377 c3/return + 8378 + 8379 test-get-with-wrong-base-type-2: + 8380 # . prologue + 8381 55/push-ebp + 8382 89/<- %ebp 4/r32/esp + 8383 # setup + 8384 (clear-stream _test-input-stream) + 8385 (clear-stream $_test-input-buffered-file->buffer) + 8386 (clear-stream _test-output-stream) + 8387 (clear-stream $_test-output-buffered-file->buffer) + 8388 (clear-stream _test-error-stream) + 8389 (clear-stream $_test-error-buffered-file->buffer) + 8390 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8391 68/push 0/imm32 + 8392 68/push 0/imm32 + 8393 89/<- %edx 4/r32/esp + 8394 (tailor-exit-descriptor %edx 0x10) + 8395 # + 8396 (write _test-input-stream "fn foo {\n") + 8397 (write _test-input-stream " var a: (addr t)\n") + 8398 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 8399 (write _test-input-stream "}\n") + 8400 (write _test-input-stream "type t {\n") + 8401 (write _test-input-stream " x: int\n") + 8402 (write _test-input-stream "}\n") + 8403 # convert + 8404 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8405 # registers except esp clobbered at this point + 8406 # restore ed + 8407 89/<- %edx 4/r32/esp + 8408 (flush _test-output-buffered-file) + 8409 (flush _test-error-buffered-file) + 8410 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8416 # check output + 8417 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-base-type-2: output should be empty") + 8418 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: var 'a' is an 'addr' type, and so must live in a register" "F - test-get-with-wrong-base-type-2: error message") + 8419 # check that stop(1) was called + 8420 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-base-type-2: exit status") + 8421 # don't restore from ebp + 8422 81 0/subop/add %esp 8/imm32 + 8423 # . epilogue + 8424 5d/pop-to-ebp + 8425 c3/return + 8426 + 8427 test-get-with-wrong-base-type-3: + 8428 # . prologue + 8429 55/push-ebp + 8430 89/<- %ebp 4/r32/esp + 8431 # setup + 8432 (clear-stream _test-input-stream) + 8433 (clear-stream $_test-input-buffered-file->buffer) + 8434 (clear-stream _test-output-stream) + 8435 (clear-stream $_test-output-buffered-file->buffer) + 8436 (clear-stream _test-error-stream) + 8437 (clear-stream $_test-error-buffered-file->buffer) + 8438 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8439 68/push 0/imm32 + 8440 68/push 0/imm32 + 8441 89/<- %edx 4/r32/esp + 8442 (tailor-exit-descriptor %edx 0x10) + 8443 # + 8444 (write _test-input-stream "fn foo {\n") + 8445 (write _test-input-stream " var a: (handle int)\n") + 8446 (write _test-input-stream " var c/ecx: (addr int) <- get a, y\n") + 8447 (write _test-input-stream "}\n") + 8448 # convert + 8449 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8450 # registers except esp clobbered at this point + 8451 # restore ed + 8452 89/<- %edx 4/r32/esp + 8453 (flush _test-output-buffered-file) + 8454 (flush _test-error-buffered-file) + 8455 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8461 # check output + 8462 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-base-type-3: output should be empty") + 8463 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: var 'a' must have a 'type' definition" "F - test-get-with-wrong-base-type-3: error message") + 8464 # check that stop(1) was called + 8465 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-base-type-3: exit status") + 8466 # don't restore from ebp + 8467 81 0/subop/add %esp 8/imm32 + 8468 # . epilogue + 8469 5d/pop-to-ebp + 8470 c3/return + 8471 + 8472 test-get-with-wrong-offset-type: + 8473 # . prologue + 8474 55/push-ebp + 8475 89/<- %ebp 4/r32/esp + 8476 # setup + 8477 (clear-stream _test-input-stream) + 8478 (clear-stream $_test-input-buffered-file->buffer) + 8479 (clear-stream _test-output-stream) + 8480 (clear-stream $_test-output-buffered-file->buffer) + 8481 (clear-stream _test-error-stream) + 8482 (clear-stream $_test-error-buffered-file->buffer) + 8483 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8484 68/push 0/imm32 + 8485 68/push 0/imm32 + 8486 89/<- %edx 4/r32/esp + 8487 (tailor-exit-descriptor %edx 0x10) + 8488 # + 8489 (write _test-input-stream "fn foo {\n") + 8490 (write _test-input-stream " var a: t\n") + 8491 (write _test-input-stream " var b: int\n") + 8492 (write _test-input-stream " var c/ecx: (addr int) <- get a, b\n") + 8493 (write _test-input-stream "}\n") + 8494 (write _test-input-stream "type t {\n") + 8495 (write _test-input-stream " x: int\n") + 8496 (write _test-input-stream "}\n") + 8497 # convert + 8498 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8499 # registers except esp clobbered at this point + 8500 # restore ed + 8501 89/<- %edx 4/r32/esp + 8502 (flush _test-output-buffered-file) + 8503 (flush _test-error-buffered-file) + 8504 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8510 # check output + 8511 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-offset-type: output should be empty") + 8512 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: type 't' has no member called 'b'" "F - test-get-with-wrong-offset-type: error message") + 8513 # check that stop(1) was called + 8514 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-offset-type: exit status") + 8515 # don't restore from ebp + 8516 81 0/subop/add %esp 8/imm32 + 8517 # . epilogue + 8518 5d/pop-to-ebp + 8519 c3/return + 8520 + 8521 test-get-with-wrong-output-type: + 8522 # . prologue + 8523 55/push-ebp + 8524 89/<- %ebp 4/r32/esp + 8525 # setup + 8526 (clear-stream _test-input-stream) + 8527 (clear-stream $_test-input-buffered-file->buffer) + 8528 (clear-stream _test-output-stream) + 8529 (clear-stream $_test-output-buffered-file->buffer) + 8530 (clear-stream _test-error-stream) + 8531 (clear-stream $_test-error-buffered-file->buffer) + 8532 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8533 68/push 0/imm32 + 8534 68/push 0/imm32 + 8535 89/<- %edx 4/r32/esp + 8536 (tailor-exit-descriptor %edx 0x10) + 8537 # + 8538 (write _test-input-stream "fn foo {\n") + 8539 (write _test-input-stream " var a: t\n") + 8540 (write _test-input-stream " var c: (addr int)\n") + 8541 (write _test-input-stream " c <- get a, x\n") + 8542 (write _test-input-stream "}\n") + 8543 (write _test-input-stream "type t {\n") + 8544 (write _test-input-stream " x: int\n") + 8545 (write _test-input-stream "}\n") + 8546 # convert + 8547 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8548 # registers except esp clobbered at this point + 8549 # restore ed + 8550 89/<- %edx 4/r32/esp + 8551 (flush _test-output-buffered-file) + 8552 (flush _test-error-buffered-file) + 8553 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8559 # check output + 8560 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type: output should be empty") + 8561 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: output 'c' is not in a register" "F - test-get-with-wrong-output-type: error message") + 8562 # check that stop(1) was called + 8563 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type: exit status") + 8564 # don't restore from ebp + 8565 81 0/subop/add %esp 8/imm32 + 8566 # . epilogue + 8567 5d/pop-to-ebp + 8568 c3/return + 8569 + 8570 test-get-with-wrong-output-type-2: + 8571 # . prologue + 8572 55/push-ebp + 8573 89/<- %ebp 4/r32/esp + 8574 # setup + 8575 (clear-stream _test-input-stream) + 8576 (clear-stream $_test-input-buffered-file->buffer) + 8577 (clear-stream _test-output-stream) + 8578 (clear-stream $_test-output-buffered-file->buffer) + 8579 (clear-stream _test-error-stream) + 8580 (clear-stream $_test-error-buffered-file->buffer) + 8581 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8582 68/push 0/imm32 + 8583 68/push 0/imm32 + 8584 89/<- %edx 4/r32/esp + 8585 (tailor-exit-descriptor %edx 0x10) + 8586 # + 8587 (write _test-input-stream "fn foo {\n") + 8588 (write _test-input-stream " var a: t\n") + 8589 (write _test-input-stream " var c/ecx: int <- get a, x\n") + 8590 (write _test-input-stream "}\n") + 8591 (write _test-input-stream "type t {\n") + 8592 (write _test-input-stream " x: int\n") + 8593 (write _test-input-stream "}\n") + 8594 # convert + 8595 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8596 # registers except esp clobbered at this point + 8597 # restore ed + 8598 89/<- %edx 4/r32/esp + 8599 (flush _test-output-buffered-file) + 8600 (flush _test-error-buffered-file) + 8601 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8607 # check output + 8608 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type-2: output should be empty") + 8609 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: output must be an addr" "F - test-get-with-wrong-output-type-2: error message") + 8610 # check that stop(1) was called + 8611 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type-2: exit status") + 8612 # don't restore from ebp + 8613 81 0/subop/add %esp 8/imm32 + 8614 # . epilogue + 8615 5d/pop-to-ebp + 8616 c3/return + 8617 + 8618 test-get-with-wrong-output-type-3: + 8619 # . prologue + 8620 55/push-ebp + 8621 89/<- %ebp 4/r32/esp + 8622 # setup + 8623 (clear-stream _test-input-stream) + 8624 (clear-stream $_test-input-buffered-file->buffer) + 8625 (clear-stream _test-output-stream) + 8626 (clear-stream $_test-output-buffered-file->buffer) + 8627 (clear-stream _test-error-stream) + 8628 (clear-stream $_test-error-buffered-file->buffer) + 8629 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8630 68/push 0/imm32 + 8631 68/push 0/imm32 + 8632 89/<- %edx 4/r32/esp + 8633 (tailor-exit-descriptor %edx 0x10) + 8634 # + 8635 (write _test-input-stream "fn foo {\n") + 8636 (write _test-input-stream " var a: t\n") + 8637 (write _test-input-stream " var c/ecx: (array int) <- get a, x\n") + 8638 (write _test-input-stream "}\n") + 8639 (write _test-input-stream "type t {\n") + 8640 (write _test-input-stream " x: int\n") + 8641 (write _test-input-stream "}\n") + 8642 # convert + 8643 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8644 # registers except esp clobbered at this point + 8645 # restore ed + 8646 89/<- %edx 4/r32/esp + 8647 (flush _test-output-buffered-file) + 8648 (flush _test-error-buffered-file) + 8649 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8655 # check output + 8656 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type-3: output should be empty") + 8657 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: output must be an addr" "F - test-get-with-wrong-output-type-3: error message") + 8658 # check that stop(1) was called + 8659 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type-3: exit status") + 8660 # don't restore from ebp + 8661 81 0/subop/add %esp 8/imm32 + 8662 # . epilogue + 8663 5d/pop-to-ebp + 8664 c3/return + 8665 + 8666 test-get-with-wrong-output-type-4: + 8667 # . prologue + 8668 55/push-ebp + 8669 89/<- %ebp 4/r32/esp + 8670 # setup + 8671 (clear-stream _test-input-stream) + 8672 (clear-stream $_test-input-buffered-file->buffer) + 8673 (clear-stream _test-output-stream) + 8674 (clear-stream $_test-output-buffered-file->buffer) + 8675 (clear-stream _test-error-stream) + 8676 (clear-stream $_test-error-buffered-file->buffer) + 8677 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8678 68/push 0/imm32 + 8679 68/push 0/imm32 + 8680 89/<- %edx 4/r32/esp + 8681 (tailor-exit-descriptor %edx 0x10) + 8682 # + 8683 (write _test-input-stream "fn foo {\n") + 8684 (write _test-input-stream " var a: t\n") + 8685 (write _test-input-stream " var c/ecx: (addr boolean) <- get a, x\n") + 8686 (write _test-input-stream "}\n") + 8687 (write _test-input-stream "type t {\n") + 8688 (write _test-input-stream " x: int\n") 8689 (write _test-input-stream "}\n") - 8690 (write _test-input-stream "fn foo {\n") - 8691 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 8692 (write _test-input-stream " var x/ecx: int <- length arr\n") - 8693 (write _test-input-stream "}\n") - 8694 # convert - 8695 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 8696 (flush _test-output-buffered-file) - 8697 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 8690 # convert + 8691 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8692 # registers except esp clobbered at this point + 8693 # restore ed + 8694 89/<- %edx 4/r32/esp + 8695 (flush _test-output-buffered-file) + 8696 (flush _test-error-buffered-file) + 8697 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- 8703 # check output - 8704 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/0") - 8705 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/1") - 8706 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/2") - 8707 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/3") - 8708 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/4") - 8709 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/5") - 8710 # var a - 8711 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/6") - 8712 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/7") - 8713 # var x - 8714 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/8") - 8715 # length instruction - 8716 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/9") - 8717 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/10") - 8718 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/11") - 8719 (check-next-stream-line-equal _test-output-stream " 31/xor %edx 2/r32/edx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/12") - 8720 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x0000000c/imm32" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/13") - 8721 (check-next-stream-line-equal _test-output-stream " f7 7/subop/idiv-eax-edx-by %ecx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/14") - 8722 (check-next-stream-line-equal _test-output-stream " 89/<- %ecx 0/r32/eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/15") - 8723 (check-next-stream-line-equal _test-output-stream " 5a/pop-to-edx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/16") - 8724 (check-next-stream-line-equal _test-output-stream " 58/pop-to-eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/17") - 8725 # reclaim x - 8726 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/18") - 8727 # reclaim a - 8728 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/19") - 8729 # - 8730 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/20") - 8731 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/21") - 8732 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/22") - 8733 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/23") - 8734 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/24") - 8735 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/25") - 8736 # . epilogue - 8737 89/<- %esp 5/r32/ebp - 8738 5d/pop-to-ebp - 8739 c3/return - 8740 - 8741 test-convert-length-of-array-of-user-defined-types-to-edx: - 8742 # . prologue - 8743 55/push-ebp - 8744 89/<- %ebp 4/r32/esp - 8745 # setup - 8746 (clear-stream _test-input-stream) - 8747 (clear-stream $_test-input-buffered-file->buffer) - 8748 (clear-stream _test-output-stream) - 8749 (clear-stream $_test-output-buffered-file->buffer) - 8750 # - 8751 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 - 8752 (write _test-input-stream " x: int\n") - 8753 (write _test-input-stream " y: int\n") - 8754 (write _test-input-stream " z: int\n") - 8755 (write _test-input-stream "}\n") - 8756 (write _test-input-stream "fn foo {\n") - 8757 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 8758 (write _test-input-stream " var x/edx: int <- length arr\n") - 8759 (write _test-input-stream "}\n") - 8760 # convert - 8761 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 8762 (flush _test-output-buffered-file) - 8763 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 8769 # check output - 8770 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/0") - 8771 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/1") - 8772 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-edx/2") - 8773 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-user-defined-types-to-edx/3") - 8774 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-edx/4") - 8775 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/5") - 8776 # var a - 8777 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/6") - 8778 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-length-of-array-of-user-defined-types-to-edx/7") - 8779 # var x - 8780 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/8") - 8781 # length instruction - 8782 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/9") - 8783 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/10") - 8784 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-user-defined-types-to-edx/11") - 8785 (check-next-stream-line-equal _test-output-stream " 31/xor %edx 2/r32/edx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/12") - 8786 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x0000000c/imm32" "F - test-convert-length-of-array-of-user-defined-types-to-edx/13") - 8787 (check-next-stream-line-equal _test-output-stream " f7 7/subop/idiv-eax-edx-by %ecx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/14") - 8788 (check-next-stream-line-equal _test-output-stream " 89/<- %edx 0/r32/eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/15") - 8789 (check-next-stream-line-equal _test-output-stream " 59/pop-to-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/16") - 8790 (check-next-stream-line-equal _test-output-stream " 58/pop-to-eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/17") - 8791 # reclaim x - 8792 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/18") - 8793 # reclaim a - 8794 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/19") - 8795 # - 8796 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-edx/20") - 8797 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/21") - 8798 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/22") - 8799 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-user-defined-types-to-edx/23") - 8800 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-edx/24") - 8801 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-edx/25") - 8802 # . epilogue - 8803 89/<- %esp 5/r32/ebp - 8804 5d/pop-to-ebp - 8805 c3/return - 8806 - 8807 test-convert-length-of-array-of-user-defined-types: - 8808 # . prologue - 8809 55/push-ebp - 8810 89/<- %ebp 4/r32/esp - 8811 # setup - 8812 (clear-stream _test-input-stream) - 8813 (clear-stream $_test-input-buffered-file->buffer) - 8814 (clear-stream _test-output-stream) - 8815 (clear-stream $_test-output-buffered-file->buffer) - 8816 # - 8817 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 - 8818 (write _test-input-stream " x: int\n") - 8819 (write _test-input-stream " y: int\n") - 8820 (write _test-input-stream " z: int\n") - 8821 (write _test-input-stream "}\n") - 8822 (write _test-input-stream "fn foo {\n") - 8823 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") - 8824 (write _test-input-stream " var x/ebx: int <- length arr\n") - 8825 (write _test-input-stream "}\n") - 8826 # convert - 8827 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) - 8828 (flush _test-output-buffered-file) - 8829 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ - 8835 # check output - 8836 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types/0") - 8837 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types/1") - 8838 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types/2") - 8839 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-user-defined-types/3") - 8840 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types/4") - 8841 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types/5") - 8842 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-user-defined-types/6") - 8843 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-length-of-array-of-user-defined-types/7") - 8844 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-length-of-array-of-user-defined-types/8") - 8845 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types/9") - 8846 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types/10") - 8847 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types/11") - 8848 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-user-defined-types/12") - 8849 (check-next-stream-line-equal _test-output-stream " 31/xor %edx 2/r32/edx" "F - test-convert-length-of-array-of-user-defined-types/13") - 8850 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x0000000c/imm32" "F - test-convert-length-of-array-of-user-defined-types/14") - 8851 (check-next-stream-line-equal _test-output-stream " f7 7/subop/idiv-eax-edx-by %ecx" "F - test-convert-length-of-array-of-user-defined-types/15") - 8852 (check-next-stream-line-equal _test-output-stream " 89/<- %ebx 0/r32/eax" "F - test-convert-length-of-array-of-user-defined-types/16") - 8853 (check-next-stream-line-equal _test-output-stream " 5a/pop-to-edx" "F - test-convert-length-of-array-of-user-defined-types/17") - 8854 (check-next-stream-line-equal _test-output-stream " 59/pop-to-ecx" "F - test-convert-length-of-array-of-user-defined-types/18") - 8855 (check-next-stream-line-equal _test-output-stream " 58/pop-to-eax" "F - test-convert-length-of-array-of-user-defined-types/19") - 8856 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ebx" "F - test-convert-length-of-array-of-user-defined-types/20") - 8857 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-user-defined-types/21") - 8858 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types/22") - 8859 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types/23") - 8860 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types/24") - 8861 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-user-defined-types/25") - 8862 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-user-defined-types/26") - 8863 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types/27") - 8864 # . epilogue - 8865 89/<- %esp 5/r32/ebp - 8866 5d/pop-to-ebp - 8867 c3/return - 8868 - 8869 test-index-with-non-array-atom-base-type: - 8870 # . prologue - 8871 55/push-ebp - 8872 89/<- %ebp 4/r32/esp - 8873 # setup - 8874 (clear-stream _test-input-stream) - 8875 (clear-stream $_test-input-buffered-file->buffer) - 8876 (clear-stream _test-output-stream) - 8877 (clear-stream $_test-output-buffered-file->buffer) - 8878 (clear-stream _test-error-stream) - 8879 (clear-stream $_test-error-buffered-file->buffer) - 8880 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8881 68/push 0/imm32 - 8882 68/push 0/imm32 - 8883 89/<- %edx 4/r32/esp - 8884 (tailor-exit-descriptor %edx 0x10) - 8885 # - 8886 (write _test-input-stream "fn foo {\n") - 8887 (write _test-input-stream " var a: int\n") - 8888 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") - 8889 (write _test-input-stream "}\n") - 8890 # convert - 8891 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8892 # registers except esp clobbered at this point - 8893 # restore ed - 8894 89/<- %edx 4/r32/esp - 8895 (flush _test-output-buffered-file) - 8896 (flush _test-error-buffered-file) - 8897 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8903 # check output - 8904 (check-stream-equal _test-output-stream "" "F - test-index-with-non-array-atom-base-type: output should be empty") - 8905 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: var 'a' is not an array" "F - test-index-with-non-array-atom-base-type: error message") - 8906 # check that stop(1) was called - 8907 (check-ints-equal *(edx+4) 2 "F - test-index-with-non-array-atom-base-type: exit status") - 8908 # don't restore from ebp - 8909 81 0/subop/add %esp 8/imm32 - 8910 # . epilogue - 8911 5d/pop-to-ebp - 8912 c3/return - 8913 - 8914 test-index-with-non-array-compound-base-type: - 8915 # . prologue - 8916 55/push-ebp - 8917 89/<- %ebp 4/r32/esp - 8918 # setup - 8919 (clear-stream _test-input-stream) - 8920 (clear-stream $_test-input-buffered-file->buffer) - 8921 (clear-stream _test-output-stream) - 8922 (clear-stream $_test-output-buffered-file->buffer) - 8923 (clear-stream _test-error-stream) - 8924 (clear-stream $_test-error-buffered-file->buffer) - 8925 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8926 68/push 0/imm32 - 8927 68/push 0/imm32 - 8928 89/<- %edx 4/r32/esp - 8929 (tailor-exit-descriptor %edx 0x10) - 8930 # - 8931 (write _test-input-stream "fn foo {\n") - 8932 (write _test-input-stream " var a: (handle int)\n") - 8933 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") - 8934 (write _test-input-stream "}\n") - 8935 # convert - 8936 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8937 # registers except esp clobbered at this point - 8938 # restore ed - 8939 89/<- %edx 4/r32/esp - 8940 (flush _test-output-buffered-file) - 8941 (flush _test-error-buffered-file) - 8942 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8948 # check output - 8949 (check-stream-equal _test-output-stream "" "F - test-index-with-non-array-compound-base-type: output should be empty") - 8950 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: var 'a' is not an array" "F - test-index-with-non-array-compound-base-type: error message") - 8951 # check that stop(1) was called - 8952 (check-ints-equal *(edx+4) 2 "F - test-index-with-non-array-compound-base-type: exit status") - 8953 # don't restore from ebp - 8954 81 0/subop/add %esp 8/imm32 - 8955 # . epilogue - 8956 5d/pop-to-ebp - 8957 c3/return - 8958 - 8959 test-index-with-non-array-compound-base-type-2: - 8960 # . prologue - 8961 55/push-ebp - 8962 89/<- %ebp 4/r32/esp - 8963 # setup - 8964 (clear-stream _test-input-stream) - 8965 (clear-stream $_test-input-buffered-file->buffer) - 8966 (clear-stream _test-output-stream) - 8967 (clear-stream $_test-output-buffered-file->buffer) - 8968 (clear-stream _test-error-stream) - 8969 (clear-stream $_test-error-buffered-file->buffer) - 8970 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 8971 68/push 0/imm32 - 8972 68/push 0/imm32 - 8973 89/<- %edx 4/r32/esp - 8974 (tailor-exit-descriptor %edx 0x10) - 8975 # - 8976 (write _test-input-stream "fn foo {\n") - 8977 (write _test-input-stream " var a: (addr int)\n") - 8978 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") - 8979 (write _test-input-stream "}\n") - 8980 # convert - 8981 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 8982 # registers except esp clobbered at this point - 8983 # restore ed - 8984 89/<- %edx 4/r32/esp - 8985 (flush _test-output-buffered-file) - 8986 (flush _test-error-buffered-file) - 8987 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 8993 # check output - 8994 (check-stream-equal _test-output-stream "" "F - test-index-with-non-array-compound-base-type-2: output should be empty") - 8995 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: var 'a' is not an array" "F - test-index-with-non-array-compound-base-type-2: error message") - 8996 # check that stop(1) was called - 8997 (check-ints-equal *(edx+4) 2 "F - test-index-with-non-array-compound-base-type-2: exit status") - 8998 # don't restore from ebp - 8999 81 0/subop/add %esp 8/imm32 - 9000 # . epilogue - 9001 5d/pop-to-ebp - 9002 c3/return - 9003 - 9004 test-index-with-array-atom-base-type: - 9005 # . prologue - 9006 55/push-ebp - 9007 89/<- %ebp 4/r32/esp - 9008 # setup - 9009 (clear-stream _test-input-stream) - 9010 (clear-stream $_test-input-buffered-file->buffer) - 9011 (clear-stream _test-output-stream) - 9012 (clear-stream $_test-output-buffered-file->buffer) - 9013 (clear-stream _test-error-stream) - 9014 (clear-stream $_test-error-buffered-file->buffer) - 9015 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9016 68/push 0/imm32 - 9017 68/push 0/imm32 - 9018 89/<- %edx 4/r32/esp - 9019 (tailor-exit-descriptor %edx 0x10) - 9020 # - 9021 (write _test-input-stream "fn foo {\n") - 9022 (write _test-input-stream " var a: array\n") - 9023 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") - 9024 (write _test-input-stream "}\n") - 9025 # convert - 9026 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9027 # registers except esp clobbered at this point - 9028 # restore ed - 9029 89/<- %edx 4/r32/esp - 9030 (flush _test-output-buffered-file) - 9031 (flush _test-error-buffered-file) - 9032 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9038 # check output - 9039 (check-stream-equal _test-output-stream "" "F - test-index-with-array-atom-base-type: output should be empty") - 9040 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: array 'a' must specify the type of its elements" "F - test-index-with-array-atom-base-type: error message") - 9041 # check that stop(1) was called - 9042 (check-ints-equal *(edx+4) 2 "F - test-index-with-array-atom-base-type: exit status") - 9043 # don't restore from ebp - 9044 81 0/subop/add %esp 8/imm32 - 9045 # . epilogue - 9046 5d/pop-to-ebp - 9047 c3/return - 9048 - 9049 test-index-with-addr-base-on-stack: - 9050 # . prologue - 9051 55/push-ebp - 9052 89/<- %ebp 4/r32/esp - 9053 # setup - 9054 (clear-stream _test-input-stream) - 9055 (clear-stream $_test-input-buffered-file->buffer) - 9056 (clear-stream _test-output-stream) - 9057 (clear-stream $_test-output-buffered-file->buffer) - 9058 (clear-stream _test-error-stream) - 9059 (clear-stream $_test-error-buffered-file->buffer) - 9060 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9061 68/push 0/imm32 - 9062 68/push 0/imm32 - 9063 89/<- %edx 4/r32/esp - 9064 (tailor-exit-descriptor %edx 0x10) - 9065 # - 9066 (write _test-input-stream "fn foo {\n") - 9067 (write _test-input-stream " var a: (addr array int)\n") - 9068 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") - 9069 (write _test-input-stream "}\n") - 9070 # convert - 9071 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9072 # registers except esp clobbered at this point - 9073 # restore ed - 9074 89/<- %edx 4/r32/esp - 9075 (flush _test-output-buffered-file) - 9076 (flush _test-error-buffered-file) - 9077 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9083 # check output - 9084 (check-stream-equal _test-output-stream "" "F - test-index-with-addr-base-on-stack: output should be empty") - 9085 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: var 'a' is an addr to an array, and so must live in a register" "F - test-index-with-addr-base-on-stack: error message") - 9086 # check that stop(1) was called - 9087 (check-ints-equal *(edx+4) 2 "F - test-index-with-addr-base-on-stack: exit status") - 9088 # don't restore from ebp - 9089 81 0/subop/add %esp 8/imm32 - 9090 # . epilogue - 9091 5d/pop-to-ebp - 9092 c3/return - 9093 - 9094 test-index-with-wrong-index-type: - 9095 # . prologue - 9096 55/push-ebp - 9097 89/<- %ebp 4/r32/esp - 9098 # setup - 9099 (clear-stream _test-input-stream) - 9100 (clear-stream $_test-input-buffered-file->buffer) - 9101 (clear-stream _test-output-stream) - 9102 (clear-stream $_test-output-buffered-file->buffer) - 9103 (clear-stream _test-error-stream) - 9104 (clear-stream $_test-error-buffered-file->buffer) - 9105 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9106 68/push 0/imm32 - 9107 68/push 0/imm32 - 9108 89/<- %edx 4/r32/esp - 9109 (tailor-exit-descriptor %edx 0x10) - 9110 # - 9111 (write _test-input-stream "fn foo {\n") - 9112 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") - 9113 (write _test-input-stream " var b: boolean\n") - 9114 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") - 9115 (write _test-input-stream "}\n") - 9116 # convert - 9117 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9118 # registers except esp clobbered at this point - 9119 # restore ed - 9120 89/<- %edx 4/r32/esp - 9121 (flush _test-output-buffered-file) - 9122 (flush _test-error-buffered-file) - 9123 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9129 # check output - 9130 (check-stream-equal _test-output-stream "" "F - test-index-with-wrong-index-type: output should be empty") - 9131 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: second argument 'b' must be an int or offset" "F - test-index-with-wrong-index-type: error message") - 9132 # check that stop(1) was called - 9133 (check-ints-equal *(edx+4) 2 "F - test-index-with-wrong-index-type: exit status") - 9134 # don't restore from ebp - 9135 81 0/subop/add %esp 8/imm32 - 9136 # . epilogue - 9137 5d/pop-to-ebp - 9138 c3/return - 9139 - 9140 test-index-with-offset-atom-index-type: - 9141 # . prologue - 9142 55/push-ebp - 9143 89/<- %ebp 4/r32/esp - 9144 # setup - 9145 (clear-stream _test-input-stream) - 9146 (clear-stream $_test-input-buffered-file->buffer) - 9147 (clear-stream _test-output-stream) - 9148 (clear-stream $_test-output-buffered-file->buffer) - 9149 (clear-stream _test-error-stream) - 9150 (clear-stream $_test-error-buffered-file->buffer) - 9151 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9152 68/push 0/imm32 - 9153 68/push 0/imm32 - 9154 89/<- %edx 4/r32/esp - 9155 (tailor-exit-descriptor %edx 0x10) - 9156 # - 9157 (write _test-input-stream "fn foo {\n") - 9158 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") - 9159 (write _test-input-stream " var b: offset\n") - 9160 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") - 9161 (write _test-input-stream "}\n") - 9162 # convert - 9163 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9164 # registers except esp clobbered at this point - 9165 # restore ed - 9166 89/<- %edx 4/r32/esp - 9167 (flush _test-output-buffered-file) - 9168 (flush _test-error-buffered-file) - 9169 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9175 # check output - 9176 (check-stream-equal _test-output-stream "" "F - test-index-with-offset-atom-index-type: output should be empty") - 9177 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: offset 'b' must specify the type of array elements" "F - test-index-with-offset-atom-index-type: error message") - 9178 # check that stop(1) was called - 9179 (check-ints-equal *(edx+4) 2 "F - test-index-with-offset-atom-index-type: exit status") - 9180 # don't restore from ebp - 9181 81 0/subop/add %esp 8/imm32 - 9182 # . epilogue - 9183 5d/pop-to-ebp - 9184 c3/return - 9185 - 9186 test-index-with-offset-on-stack: - 9187 # . prologue - 9188 55/push-ebp - 9189 89/<- %ebp 4/r32/esp - 9190 # setup - 9191 (clear-stream _test-input-stream) - 9192 (clear-stream $_test-input-buffered-file->buffer) - 9193 (clear-stream _test-output-stream) - 9194 (clear-stream $_test-output-buffered-file->buffer) - 9195 (clear-stream _test-error-stream) - 9196 (clear-stream $_test-error-buffered-file->buffer) - 9197 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9198 68/push 0/imm32 - 9199 68/push 0/imm32 - 9200 89/<- %edx 4/r32/esp - 9201 (tailor-exit-descriptor %edx 0x10) - 9202 # - 9203 (write _test-input-stream "fn foo {\n") - 9204 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") - 9205 (write _test-input-stream " var b: int\n") - 9206 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") - 9207 (write _test-input-stream "}\n") - 9208 # convert - 9209 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9210 # registers except esp clobbered at this point - 9211 # restore ed - 9212 89/<- %edx 4/r32/esp - 9213 (flush _test-output-buffered-file) - 9214 (flush _test-error-buffered-file) - 9215 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9221 # check output - 9222 (check-stream-equal _test-output-stream "" "F - test-index-with-offset-on-stack: output should be empty") - 9223 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: second argument 'b' must be in a register" "F - test-index-with-offset-on-stack: error message") - 9224 # check that stop(1) was called - 9225 (check-ints-equal *(edx+4) 2 "F - test-index-with-offset-on-stack: exit status") - 9226 # don't restore from ebp - 9227 81 0/subop/add %esp 8/imm32 - 9228 # . epilogue - 9229 5d/pop-to-ebp - 9230 c3/return - 9231 - 9232 test-index-needs-offset-type: - 9233 # . prologue - 9234 55/push-ebp - 9235 89/<- %ebp 4/r32/esp - 9236 # setup - 9237 (clear-stream _test-input-stream) - 9238 (clear-stream $_test-input-buffered-file->buffer) - 9239 (clear-stream _test-output-stream) - 9240 (clear-stream $_test-output-buffered-file->buffer) - 9241 (clear-stream _test-error-stream) - 9242 (clear-stream $_test-error-buffered-file->buffer) - 9243 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9244 68/push 0/imm32 - 9245 68/push 0/imm32 - 9246 89/<- %edx 4/r32/esp - 9247 (tailor-exit-descriptor %edx 0x10) - 9248 # - 9249 (write _test-input-stream "fn foo {\n") - 9250 (write _test-input-stream " var a/eax: (addr array t) <- copy 0\n") - 9251 (write _test-input-stream " var b/ebx: int <- copy 0\n") - 9252 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") - 9253 (write _test-input-stream "}\n") - 9254 (write _test-input-stream "type t {\n") # size 12 is not a power of two - 9255 (write _test-input-stream " x: int\n") - 9256 (write _test-input-stream " y: int\n") - 9257 (write _test-input-stream " z: int\n") - 9258 (write _test-input-stream "}\n") - 9259 # convert - 9260 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9261 # registers except esp clobbered at this point - 9262 # restore ed - 9263 89/<- %edx 4/r32/esp - 9264 (flush _test-output-buffered-file) - 9265 (flush _test-error-buffered-file) - 9266 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9272 # check output - 9273 (check-stream-equal _test-output-stream "" "F - test-index-needs-offset-type: output should be empty") - 9274 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: cannot take an int for array 'a'; create an offset instead. See mu.md for details." "F - test-index-needs-offset-type: error message") - 9275 # check that stop(1) was called - 9276 (check-ints-equal *(edx+4) 2 "F - test-index-needs-offset-type: exit status") - 9277 # don't restore from ebp - 9278 81 0/subop/add %esp 8/imm32 - 9279 # . epilogue - 9280 5d/pop-to-ebp - 9281 c3/return - 9282 - 9283 test-index-with-output-not-address: - 9284 # . prologue - 9285 55/push-ebp - 9286 89/<- %ebp 4/r32/esp - 9287 # setup - 9288 (clear-stream _test-input-stream) - 9289 (clear-stream $_test-input-buffered-file->buffer) - 9290 (clear-stream _test-output-stream) - 9291 (clear-stream $_test-output-buffered-file->buffer) - 9292 (clear-stream _test-error-stream) - 9293 (clear-stream $_test-error-buffered-file->buffer) - 9294 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9295 68/push 0/imm32 - 9296 68/push 0/imm32 - 9297 89/<- %edx 4/r32/esp - 9298 (tailor-exit-descriptor %edx 0x10) - 9299 # - 9300 (write _test-input-stream "fn foo {\n") - 9301 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") - 9302 (write _test-input-stream " var o/edi: int <- index a, 0\n") - 9303 (write _test-input-stream "}\n") - 9304 # convert - 9305 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9306 # registers except esp clobbered at this point - 9307 # restore ed - 9308 89/<- %edx 4/r32/esp - 9309 (flush _test-output-buffered-file) - 9310 (flush _test-error-buffered-file) - 9311 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9317 # check output - 9318 (check-stream-equal _test-output-stream "" "F - test-index-with-output-not-address: output should be empty") - 9319 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: output 'o' must be an addr" "F - test-index-with-output-not-address: error message") - 9320 # check that stop(1) was called - 9321 (check-ints-equal *(edx+4) 2 "F - test-index-with-output-not-address: exit status") - 9322 # don't restore from ebp - 9323 81 0/subop/add %esp 8/imm32 - 9324 # . epilogue - 9325 5d/pop-to-ebp - 9326 c3/return - 9327 - 9328 test-index-with-output-not-address-2: - 9329 # . prologue - 9330 55/push-ebp - 9331 89/<- %ebp 4/r32/esp - 9332 # setup - 9333 (clear-stream _test-input-stream) - 9334 (clear-stream $_test-input-buffered-file->buffer) - 9335 (clear-stream _test-output-stream) - 9336 (clear-stream $_test-output-buffered-file->buffer) - 9337 (clear-stream _test-error-stream) - 9338 (clear-stream $_test-error-buffered-file->buffer) - 9339 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9340 68/push 0/imm32 - 9341 68/push 0/imm32 - 9342 89/<- %edx 4/r32/esp - 9343 (tailor-exit-descriptor %edx 0x10) - 9344 # - 9345 (write _test-input-stream "fn foo {\n") - 9346 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") - 9347 (write _test-input-stream " var o/edi: (int) <- index a, 0\n") - 9348 (write _test-input-stream "}\n") - 9349 # convert - 9350 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9351 # registers except esp clobbered at this point - 9352 # restore ed - 9353 89/<- %edx 4/r32/esp - 9354 (flush _test-output-buffered-file) - 9355 (flush _test-error-buffered-file) - 9356 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9362 # check output - 9363 (check-stream-equal _test-output-stream "" "F - test-index-with-output-not-address-2: output should be empty") - 9364 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: output 'o' must be an addr" "F - test-index-with-output-not-address-2: error message") - 9365 # check that stop(1) was called - 9366 (check-ints-equal *(edx+4) 2 "F - test-index-with-output-not-address-2: exit status") - 9367 # don't restore from ebp - 9368 81 0/subop/add %esp 8/imm32 - 9369 # . epilogue - 9370 5d/pop-to-ebp - 9371 c3/return - 9372 - 9373 test-index-with-wrong-output-type: - 9374 # . prologue - 9375 55/push-ebp - 9376 89/<- %ebp 4/r32/esp - 9377 # setup - 9378 (clear-stream _test-input-stream) - 9379 (clear-stream $_test-input-buffered-file->buffer) - 9380 (clear-stream _test-output-stream) - 9381 (clear-stream $_test-output-buffered-file->buffer) - 9382 (clear-stream _test-error-stream) - 9383 (clear-stream $_test-error-buffered-file->buffer) - 9384 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9385 68/push 0/imm32 - 9386 68/push 0/imm32 - 9387 89/<- %edx 4/r32/esp - 9388 (tailor-exit-descriptor %edx 0x10) - 9389 # - 9390 (write _test-input-stream "fn foo {\n") - 9391 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") - 9392 (write _test-input-stream " var o/edi: (addr int) <- index a, 0\n") - 9393 (write _test-input-stream "}\n") - 9394 # convert - 9395 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9396 # registers except esp clobbered at this point - 9397 # restore ed - 9398 89/<- %edx 4/r32/esp - 9399 (flush _test-output-buffered-file) - 9400 (flush _test-error-buffered-file) - 9401 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9407 # check output - 9408 (check-stream-equal _test-output-stream "" "F - test-index-with-wrong-output-type: output should be empty") - 9409 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: output 'o' does not have the right type" "F - test-index-with-wrong-output-type: error message") - 9410 # check that stop(1) was called - 9411 (check-ints-equal *(edx+4) 2 "F - test-index-with-wrong-output-type: exit status") - 9412 # don't restore from ebp - 9413 81 0/subop/add %esp 8/imm32 - 9414 # . epilogue - 9415 5d/pop-to-ebp - 9416 c3/return - 9417 - 9418 test-index-with-wrong-output-compound-type: - 9419 # . prologue - 9420 55/push-ebp - 9421 89/<- %ebp 4/r32/esp - 9422 # setup - 9423 (clear-stream _test-input-stream) - 9424 (clear-stream $_test-input-buffered-file->buffer) - 9425 (clear-stream _test-output-stream) - 9426 (clear-stream $_test-output-buffered-file->buffer) - 9427 (clear-stream _test-error-stream) - 9428 (clear-stream $_test-error-buffered-file->buffer) - 9429 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9430 68/push 0/imm32 - 9431 68/push 0/imm32 - 9432 89/<- %edx 4/r32/esp - 9433 (tailor-exit-descriptor %edx 0x10) - 9434 # - 9435 (write _test-input-stream "fn foo {\n") - 9436 (write _test-input-stream " var a/ebx: (addr array handle boolean) <- copy 0\n") - 9437 (write _test-input-stream " var o/edi: (addr handle int) <- index a, 0\n") - 9438 (write _test-input-stream "}\n") - 9439 # convert - 9440 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9441 # registers except esp clobbered at this point - 9442 # restore ed - 9443 89/<- %edx 4/r32/esp - 9444 (flush _test-output-buffered-file) - 9445 (flush _test-error-buffered-file) - 9446 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9452 # check output - 9453 (check-stream-equal _test-output-stream "" "F - test-index-with-wrong-output-compound-type: output should be empty") - 9454 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: output 'o' does not have the right type" "F - test-index-with-wrong-output-compound-type: error message") - 9455 # check that stop(1) was called - 9456 (check-ints-equal *(edx+4) 2 "F - test-index-with-wrong-output-compound-type: exit status") - 9457 # don't restore from ebp - 9458 81 0/subop/add %esp 8/imm32 - 9459 # . epilogue - 9460 5d/pop-to-ebp - 9461 c3/return - 9462 - 9463 test-index-with-no-inouts: - 9464 # . prologue - 9465 55/push-ebp - 9466 89/<- %ebp 4/r32/esp - 9467 # setup - 9468 (clear-stream _test-input-stream) - 9469 (clear-stream $_test-input-buffered-file->buffer) - 9470 (clear-stream _test-output-stream) - 9471 (clear-stream $_test-output-buffered-file->buffer) - 9472 (clear-stream _test-error-stream) - 9473 (clear-stream $_test-error-buffered-file->buffer) - 9474 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9475 68/push 0/imm32 - 9476 68/push 0/imm32 - 9477 89/<- %edx 4/r32/esp - 9478 (tailor-exit-descriptor %edx 0x10) - 9479 # - 9480 (write _test-input-stream "fn foo {\n") - 9481 (write _test-input-stream " var c/ecx: (addr int) <- index\n") - 9482 (write _test-input-stream "}\n") - 9483 # convert - 9484 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9485 # registers except esp clobbered at this point - 9486 # restore ed - 9487 89/<- %edx 4/r32/esp - 9488 (flush _test-output-buffered-file) - 9489 (flush _test-error-buffered-file) - 9490 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9496 # check output - 9497 (check-stream-equal _test-output-stream "" "F - test-index-with-no-inouts: output should be empty") - 9498 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: too few inouts (2 required)" "F - test-index-with-no-inouts: error message") - 9499 # check that stop(1) was called - 9500 (check-ints-equal *(edx+4) 2 "F - test-index-with-no-inouts: exit status") - 9501 # don't restore from ebp - 9502 81 0/subop/add %esp 8/imm32 - 9503 # . epilogue - 9504 5d/pop-to-ebp - 9505 c3/return - 9506 - 9507 test-index-with-too-few-inouts: - 9508 # . prologue - 9509 55/push-ebp - 9510 89/<- %ebp 4/r32/esp - 9511 # setup - 9512 (clear-stream _test-input-stream) - 9513 (clear-stream $_test-input-buffered-file->buffer) - 9514 (clear-stream _test-output-stream) - 9515 (clear-stream $_test-output-buffered-file->buffer) - 9516 (clear-stream _test-error-stream) - 9517 (clear-stream $_test-error-buffered-file->buffer) - 9518 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9519 68/push 0/imm32 - 9520 68/push 0/imm32 - 9521 89/<- %edx 4/r32/esp - 9522 (tailor-exit-descriptor %edx 0x10) - 9523 # - 9524 (write _test-input-stream "fn foo {\n") - 9525 (write _test-input-stream " var a: (array int 3)\n") - 9526 (write _test-input-stream " var c/ecx: (addr int) <- index a\n") - 9527 (write _test-input-stream "}\n") - 9528 # convert - 9529 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9530 # registers except esp clobbered at this point - 9531 # restore ed - 9532 89/<- %edx 4/r32/esp - 9533 (flush _test-output-buffered-file) - 9534 (flush _test-error-buffered-file) - 9535 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9541 # check output - 9542 (check-stream-equal _test-output-stream "" "F - test-index-with-too-few-inouts: output should be empty") - 9543 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: too few inouts (2 required)" "F - test-index-with-too-few-inouts: error message") - 9544 # check that stop(1) was called - 9545 (check-ints-equal *(edx+4) 2 "F - test-index-with-too-few-inouts: exit status") - 9546 # don't restore from ebp - 9547 81 0/subop/add %esp 8/imm32 - 9548 # . epilogue - 9549 5d/pop-to-ebp - 9550 c3/return - 9551 - 9552 test-index-with-too-many-inouts: - 9553 # . prologue - 9554 55/push-ebp - 9555 89/<- %ebp 4/r32/esp - 9556 # setup - 9557 (clear-stream _test-input-stream) - 9558 (clear-stream $_test-input-buffered-file->buffer) - 9559 (clear-stream _test-output-stream) - 9560 (clear-stream $_test-output-buffered-file->buffer) - 9561 (clear-stream _test-error-stream) - 9562 (clear-stream $_test-error-buffered-file->buffer) - 9563 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9564 68/push 0/imm32 - 9565 68/push 0/imm32 - 9566 89/<- %edx 4/r32/esp - 9567 (tailor-exit-descriptor %edx 0x10) - 9568 # - 9569 (write _test-input-stream "fn foo {\n") - 9570 (write _test-input-stream " var a: (array int 3)\n") - 9571 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0, 0\n") - 9572 (write _test-input-stream "}\n") - 9573 # convert - 9574 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9575 # registers except esp clobbered at this point - 9576 # restore ed - 9577 89/<- %edx 4/r32/esp - 9578 (flush _test-output-buffered-file) - 9579 (flush _test-error-buffered-file) - 9580 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9586 # check output - 9587 (check-stream-equal _test-output-stream "" "F - test-index-with-too-many-inouts: output should be empty") - 9588 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: too many inouts (2 required)" "F - test-index-with-too-many-inouts: error message") - 9589 # check that stop(1) was called - 9590 (check-ints-equal *(edx+4) 2 "F - test-index-with-too-many-inouts: exit status") - 9591 # don't restore from ebp - 9592 81 0/subop/add %esp 8/imm32 - 9593 # . epilogue - 9594 5d/pop-to-ebp - 9595 c3/return - 9596 - 9597 test-index-with-no-output: - 9598 # . prologue - 9599 55/push-ebp - 9600 89/<- %ebp 4/r32/esp - 9601 # setup - 9602 (clear-stream _test-input-stream) - 9603 (clear-stream $_test-input-buffered-file->buffer) - 9604 (clear-stream _test-output-stream) - 9605 (clear-stream $_test-output-buffered-file->buffer) - 9606 (clear-stream _test-error-stream) - 9607 (clear-stream $_test-error-buffered-file->buffer) - 9608 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9609 68/push 0/imm32 - 9610 68/push 0/imm32 - 9611 89/<- %edx 4/r32/esp - 9612 (tailor-exit-descriptor %edx 0x10) - 9613 # - 9614 (write _test-input-stream "fn foo {\n") - 9615 (write _test-input-stream " var a: (array int 3)\n") - 9616 (write _test-input-stream " index a, 0\n") - 9617 (write _test-input-stream "}\n") - 9618 # convert - 9619 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9620 # registers except esp clobbered at this point - 9621 # restore ed - 9622 89/<- %edx 4/r32/esp - 9623 (flush _test-output-buffered-file) - 9624 (flush _test-error-buffered-file) - 9625 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9631 # check output - 9632 (check-stream-equal _test-output-stream "" "F - test-index-with-no-output: output should be empty") - 9633 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: must have an output" "F - test-index-with-no-output: error message") - 9634 # check that stop(1) was called - 9635 (check-ints-equal *(edx+4) 2 "F - test-index-with-no-output: exit status") - 9636 # don't restore from ebp - 9637 81 0/subop/add %esp 8/imm32 - 9638 # . epilogue - 9639 5d/pop-to-ebp - 9640 c3/return - 9641 - 9642 test-index-with-too-many-outputs: - 9643 # . prologue - 9644 55/push-ebp - 9645 89/<- %ebp 4/r32/esp - 9646 # setup - 9647 (clear-stream _test-input-stream) - 9648 (clear-stream $_test-input-buffered-file->buffer) - 9649 (clear-stream _test-output-stream) - 9650 (clear-stream $_test-output-buffered-file->buffer) - 9651 (clear-stream _test-error-stream) - 9652 (clear-stream $_test-error-buffered-file->buffer) - 9653 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9654 68/push 0/imm32 - 9655 68/push 0/imm32 - 9656 89/<- %edx 4/r32/esp - 9657 (tailor-exit-descriptor %edx 0x10) - 9658 # - 9659 (write _test-input-stream "fn foo {\n") - 9660 (write _test-input-stream " var a: (array int 3)\n") - 9661 (write _test-input-stream " var b/eax: (addr int) <- copy 0\n") - 9662 (write _test-input-stream " var c/ecx: (addr int) <- copy 0\n") - 9663 (write _test-input-stream " b, c <- index a, 0\n") - 9664 (write _test-input-stream "}\n") - 9665 # convert - 9666 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9667 # registers except esp clobbered at this point - 9668 # restore ed - 9669 89/<- %edx 4/r32/esp - 9670 (flush _test-output-buffered-file) - 9671 (flush _test-error-buffered-file) - 9672 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9678 # check output - 9679 (check-stream-equal _test-output-stream "" "F - test-index-with-too-many-outputs: output should be empty") - 9680 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: too many outputs (1 required)" "F - test-index-with-too-many-outputs: error message") - 9681 # check that stop(1) was called - 9682 (check-ints-equal *(edx+4) 2 "F - test-index-with-too-many-outputs: exit status") - 9683 # don't restore from ebp - 9684 81 0/subop/add %esp 8/imm32 - 9685 # . epilogue - 9686 5d/pop-to-ebp - 9687 c3/return - 9688 - 9689 test-compute-offset-with-non-array-atom-base-type: - 9690 # . prologue - 9691 55/push-ebp - 9692 89/<- %ebp 4/r32/esp - 9693 # setup - 9694 (clear-stream _test-input-stream) - 9695 (clear-stream $_test-input-buffered-file->buffer) - 9696 (clear-stream _test-output-stream) - 9697 (clear-stream $_test-output-buffered-file->buffer) - 9698 (clear-stream _test-error-stream) - 9699 (clear-stream $_test-error-buffered-file->buffer) - 9700 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9701 68/push 0/imm32 - 9702 68/push 0/imm32 - 9703 89/<- %edx 4/r32/esp - 9704 (tailor-exit-descriptor %edx 0x10) - 9705 # - 9706 (write _test-input-stream "fn foo {\n") - 9707 (write _test-input-stream " var a: int\n") - 9708 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") - 9709 (write _test-input-stream "}\n") - 9710 # convert - 9711 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9712 # registers except esp clobbered at this point - 9713 # restore ed - 9714 89/<- %edx 4/r32/esp - 9715 (flush _test-output-buffered-file) - 9716 (flush _test-error-buffered-file) - 9717 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9723 # check output - 9724 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-non-array-atom-base-type: output should be empty") - 9725 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: var 'a' is not an array" "F - test-compute-offset-with-non-array-atom-base-type: error message") - 9726 # check that stop(1) was called - 9727 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-non-array-atom-base-type: exit status") - 9728 # don't restore from ebp - 9729 81 0/subop/add %esp 8/imm32 - 9730 # . epilogue - 9731 5d/pop-to-ebp - 9732 c3/return - 9733 - 9734 test-compute-offset-with-non-array-compound-base-type: - 9735 # . prologue - 9736 55/push-ebp - 9737 89/<- %ebp 4/r32/esp - 9738 # setup - 9739 (clear-stream _test-input-stream) - 9740 (clear-stream $_test-input-buffered-file->buffer) - 9741 (clear-stream _test-output-stream) - 9742 (clear-stream $_test-output-buffered-file->buffer) - 9743 (clear-stream _test-error-stream) - 9744 (clear-stream $_test-error-buffered-file->buffer) - 9745 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9746 68/push 0/imm32 - 9747 68/push 0/imm32 - 9748 89/<- %edx 4/r32/esp - 9749 (tailor-exit-descriptor %edx 0x10) - 9750 # - 9751 (write _test-input-stream "fn foo {\n") - 9752 (write _test-input-stream " var a: (handle int)\n") - 9753 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") - 9754 (write _test-input-stream "}\n") - 9755 # convert - 9756 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9757 # registers except esp clobbered at this point - 9758 # restore ed - 9759 89/<- %edx 4/r32/esp - 9760 (flush _test-output-buffered-file) - 9761 (flush _test-error-buffered-file) - 9762 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9768 # check output - 9769 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-non-array-compound-base-type: output should be empty") - 9770 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: var 'a' is not an array" "F - test-compute-offset-with-non-array-compound-base-type: error message") - 9771 # check that stop(1) was called - 9772 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-non-array-compound-base-type: exit status") - 9773 # don't restore from ebp - 9774 81 0/subop/add %esp 8/imm32 - 9775 # . epilogue - 9776 5d/pop-to-ebp - 9777 c3/return - 9778 - 9779 test-compute-offset-with-non-array-compound-base-type-2: - 9780 # . prologue - 9781 55/push-ebp - 9782 89/<- %ebp 4/r32/esp - 9783 # setup - 9784 (clear-stream _test-input-stream) - 9785 (clear-stream $_test-input-buffered-file->buffer) - 9786 (clear-stream _test-output-stream) - 9787 (clear-stream $_test-output-buffered-file->buffer) - 9788 (clear-stream _test-error-stream) - 9789 (clear-stream $_test-error-buffered-file->buffer) - 9790 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9791 68/push 0/imm32 - 9792 68/push 0/imm32 - 9793 89/<- %edx 4/r32/esp - 9794 (tailor-exit-descriptor %edx 0x10) - 9795 # - 9796 (write _test-input-stream "fn foo {\n") - 9797 (write _test-input-stream " var a: (addr int)\n") - 9798 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") - 9799 (write _test-input-stream "}\n") - 9800 # convert - 9801 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9802 # registers except esp clobbered at this point - 9803 # restore ed - 9804 89/<- %edx 4/r32/esp - 9805 (flush _test-output-buffered-file) - 9806 (flush _test-error-buffered-file) - 9807 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9813 # check output - 9814 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-non-array-compound-base-type-2: output should be empty") - 9815 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: var 'a' is not an array" "F - test-compute-offset-with-non-array-compound-base-type-2: error message") - 9816 # check that stop(1) was called - 9817 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-non-array-compound-base-type-2: exit status") - 9818 # don't restore from ebp - 9819 81 0/subop/add %esp 8/imm32 - 9820 # . epilogue - 9821 5d/pop-to-ebp - 9822 c3/return - 9823 - 9824 test-compute-offset-with-array-atom-base-type: - 9825 # . prologue - 9826 55/push-ebp - 9827 89/<- %ebp 4/r32/esp - 9828 # setup - 9829 (clear-stream _test-input-stream) - 9830 (clear-stream $_test-input-buffered-file->buffer) - 9831 (clear-stream _test-output-stream) - 9832 (clear-stream $_test-output-buffered-file->buffer) - 9833 (clear-stream _test-error-stream) - 9834 (clear-stream $_test-error-buffered-file->buffer) - 9835 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9836 68/push 0/imm32 - 9837 68/push 0/imm32 - 9838 89/<- %edx 4/r32/esp - 9839 (tailor-exit-descriptor %edx 0x10) - 9840 # - 9841 (write _test-input-stream "fn foo {\n") - 9842 (write _test-input-stream " var a: array\n") - 9843 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") - 9844 (write _test-input-stream "}\n") - 9845 # convert - 9846 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9847 # registers except esp clobbered at this point - 9848 # restore ed - 9849 89/<- %edx 4/r32/esp - 9850 (flush _test-output-buffered-file) - 9851 (flush _test-error-buffered-file) - 9852 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9858 # check output - 9859 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-array-atom-base-type: output should be empty") - 9860 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: array 'a' must specify the type of its elements" "F - test-compute-offset-with-array-atom-base-type: error message") - 9861 # check that stop(1) was called - 9862 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-array-atom-base-type: exit status") - 9863 # don't restore from ebp - 9864 81 0/subop/add %esp 8/imm32 - 9865 # . epilogue - 9866 5d/pop-to-ebp - 9867 c3/return - 9868 - 9869 test-compute-offset-with-wrong-index-type: - 9870 # . prologue - 9871 55/push-ebp - 9872 89/<- %ebp 4/r32/esp - 9873 # setup - 9874 (clear-stream _test-input-stream) - 9875 (clear-stream $_test-input-buffered-file->buffer) - 9876 (clear-stream _test-output-stream) - 9877 (clear-stream $_test-output-buffered-file->buffer) - 9878 (clear-stream _test-error-stream) - 9879 (clear-stream $_test-error-buffered-file->buffer) - 9880 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9881 68/push 0/imm32 - 9882 68/push 0/imm32 - 9883 89/<- %edx 4/r32/esp - 9884 (tailor-exit-descriptor %edx 0x10) - 9885 # - 9886 (write _test-input-stream "fn foo {\n") - 9887 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") - 9888 (write _test-input-stream " var b: boolean\n") - 9889 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, b\n") - 9890 (write _test-input-stream "}\n") - 9891 # convert - 9892 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9893 # registers except esp clobbered at this point - 9894 # restore ed - 9895 89/<- %edx 4/r32/esp - 9896 (flush _test-output-buffered-file) - 9897 (flush _test-error-buffered-file) - 9898 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9904 # check output - 9905 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-wrong-index-type: output should be empty") - 9906 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: second argument 'b' must be an int" "F - test-compute-offset-with-wrong-index-type: error message") - 9907 # check that stop(1) was called - 9908 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-wrong-index-type: exit status") - 9909 # don't restore from ebp - 9910 81 0/subop/add %esp 8/imm32 - 9911 # . epilogue - 9912 5d/pop-to-ebp - 9913 c3/return - 9914 - 9915 test-compute-offset-with-output-not-offset: - 9916 # . prologue - 9917 55/push-ebp - 9918 89/<- %ebp 4/r32/esp - 9919 # setup - 9920 (clear-stream _test-input-stream) - 9921 (clear-stream $_test-input-buffered-file->buffer) - 9922 (clear-stream _test-output-stream) - 9923 (clear-stream $_test-output-buffered-file->buffer) - 9924 (clear-stream _test-error-stream) - 9925 (clear-stream $_test-error-buffered-file->buffer) - 9926 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9927 68/push 0/imm32 - 9928 68/push 0/imm32 - 9929 89/<- %edx 4/r32/esp - 9930 (tailor-exit-descriptor %edx 0x10) - 9931 # - 9932 (write _test-input-stream "fn foo {\n") - 9933 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") - 9934 (write _test-input-stream " var o/edi: int <- compute-offset a, 0\n") - 9935 (write _test-input-stream "}\n") - 9936 # convert - 9937 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9938 # registers except esp clobbered at this point - 9939 # restore ed - 9940 89/<- %edx 4/r32/esp - 9941 (flush _test-output-buffered-file) - 9942 (flush _test-error-buffered-file) - 9943 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9949 # check output - 9950 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-output-not-offset: output should be empty") - 9951 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: output 'o' must be an offset" "F - test-compute-offset-with-output-not-offset: error message") - 9952 # check that stop(1) was called - 9953 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-output-not-offset: exit status") - 9954 # don't restore from ebp - 9955 81 0/subop/add %esp 8/imm32 - 9956 # . epilogue - 9957 5d/pop-to-ebp - 9958 c3/return - 9959 - 9960 test-compute-offset-with-output-not-address-2: - 9961 # . prologue - 9962 55/push-ebp - 9963 89/<- %ebp 4/r32/esp - 9964 # setup - 9965 (clear-stream _test-input-stream) - 9966 (clear-stream $_test-input-buffered-file->buffer) - 9967 (clear-stream _test-output-stream) - 9968 (clear-stream $_test-output-buffered-file->buffer) - 9969 (clear-stream _test-error-stream) - 9970 (clear-stream $_test-error-buffered-file->buffer) - 9971 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) - 9972 68/push 0/imm32 - 9973 68/push 0/imm32 - 9974 89/<- %edx 4/r32/esp - 9975 (tailor-exit-descriptor %edx 0x10) - 9976 # - 9977 (write _test-input-stream "fn foo {\n") - 9978 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") - 9979 (write _test-input-stream " var o/edi: (int) <- compute-offset a, 0\n") - 9980 (write _test-input-stream "}\n") - 9981 # convert - 9982 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) - 9983 # registers except esp clobbered at this point - 9984 # restore ed - 9985 89/<- %edx 4/r32/esp - 9986 (flush _test-output-buffered-file) - 9987 (flush _test-error-buffered-file) - 9988 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 9994 # check output - 9995 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-output-not-address-2: output should be empty") - 9996 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: output 'o' must be an offset" "F - test-compute-offset-with-output-not-address-2: error message") - 9997 # check that stop(1) was called - 9998 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-output-not-address-2: exit status") - 9999 # don't restore from ebp -10000 81 0/subop/add %esp 8/imm32 -10001 # . epilogue -10002 5d/pop-to-ebp -10003 c3/return -10004 -10005 test-compute-offset-with-wrong-output-type: -10006 # . prologue -10007 55/push-ebp -10008 89/<- %ebp 4/r32/esp -10009 # setup -10010 (clear-stream _test-input-stream) -10011 (clear-stream $_test-input-buffered-file->buffer) -10012 (clear-stream _test-output-stream) -10013 (clear-stream $_test-output-buffered-file->buffer) -10014 (clear-stream _test-error-stream) -10015 (clear-stream $_test-error-buffered-file->buffer) -10016 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10017 68/push 0/imm32 -10018 68/push 0/imm32 -10019 89/<- %edx 4/r32/esp -10020 (tailor-exit-descriptor %edx 0x10) -10021 # -10022 (write _test-input-stream "fn foo {\n") -10023 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") -10024 (write _test-input-stream " var o/edi: (offset int) <- compute-offset a, 0\n") -10025 (write _test-input-stream "}\n") -10026 # convert -10027 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10028 # registers except esp clobbered at this point -10029 # restore ed -10030 89/<- %edx 4/r32/esp -10031 (flush _test-output-buffered-file) -10032 (flush _test-error-buffered-file) -10033 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10039 # check output -10040 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-wrong-output-type: output should be empty") -10041 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: output 'o' does not have the right type" "F - test-compute-offset-with-wrong-output-type: error message") -10042 # check that stop(1) was called -10043 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-wrong-output-type: exit status") -10044 # don't restore from ebp -10045 81 0/subop/add %esp 8/imm32 -10046 # . epilogue -10047 5d/pop-to-ebp -10048 c3/return -10049 -10050 test-compute-offset-with-wrong-output-compound-type: -10051 # . prologue -10052 55/push-ebp -10053 89/<- %ebp 4/r32/esp -10054 # setup -10055 (clear-stream _test-input-stream) -10056 (clear-stream $_test-input-buffered-file->buffer) -10057 (clear-stream _test-output-stream) -10058 (clear-stream $_test-output-buffered-file->buffer) -10059 (clear-stream _test-error-stream) -10060 (clear-stream $_test-error-buffered-file->buffer) -10061 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10062 68/push 0/imm32 -10063 68/push 0/imm32 -10064 89/<- %edx 4/r32/esp -10065 (tailor-exit-descriptor %edx 0x10) -10066 # -10067 (write _test-input-stream "fn foo {\n") -10068 (write _test-input-stream " var a/ebx: (addr array handle boolean) <- copy 0\n") -10069 (write _test-input-stream " var o/edi: (offset handle int) <- compute-offset a, 0\n") -10070 (write _test-input-stream "}\n") -10071 # convert -10072 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10073 # registers except esp clobbered at this point -10074 # restore ed -10075 89/<- %edx 4/r32/esp -10076 (flush _test-output-buffered-file) -10077 (flush _test-error-buffered-file) -10078 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10084 # check output -10085 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-wrong-output-compound-type: output should be empty") -10086 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: output 'o' does not have the right type" "F - test-compute-offset-with-wrong-output-compound-type: error message") -10087 # check that stop(1) was called -10088 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-wrong-output-compound-type: exit status") -10089 # don't restore from ebp -10090 81 0/subop/add %esp 8/imm32 -10091 # . epilogue -10092 5d/pop-to-ebp -10093 c3/return -10094 -10095 test-compute-offset-with-no-inouts: -10096 # . prologue -10097 55/push-ebp -10098 89/<- %ebp 4/r32/esp -10099 # setup -10100 (clear-stream _test-input-stream) -10101 (clear-stream $_test-input-buffered-file->buffer) -10102 (clear-stream _test-output-stream) -10103 (clear-stream $_test-output-buffered-file->buffer) -10104 (clear-stream _test-error-stream) -10105 (clear-stream $_test-error-buffered-file->buffer) -10106 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10107 68/push 0/imm32 -10108 68/push 0/imm32 -10109 89/<- %edx 4/r32/esp -10110 (tailor-exit-descriptor %edx 0x10) -10111 # -10112 (write _test-input-stream "fn foo {\n") -10113 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset\n") -10114 (write _test-input-stream "}\n") -10115 # convert -10116 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10117 # registers except esp clobbered at this point -10118 # restore ed -10119 89/<- %edx 4/r32/esp -10120 (flush _test-output-buffered-file) -10121 (flush _test-error-buffered-file) -10122 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10128 # check output -10129 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-no-inouts: output should be empty") -10130 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: too few inouts (2 required)" "F - test-compute-offset-with-no-inouts: error message") -10131 # check that stop(1) was called -10132 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-no-inouts: exit status") -10133 # don't restore from ebp -10134 81 0/subop/add %esp 8/imm32 -10135 # . epilogue -10136 5d/pop-to-ebp -10137 c3/return -10138 -10139 test-compute-offset-with-too-few-inouts: -10140 # . prologue -10141 55/push-ebp -10142 89/<- %ebp 4/r32/esp -10143 # setup -10144 (clear-stream _test-input-stream) -10145 (clear-stream $_test-input-buffered-file->buffer) -10146 (clear-stream _test-output-stream) -10147 (clear-stream $_test-output-buffered-file->buffer) -10148 (clear-stream _test-error-stream) -10149 (clear-stream $_test-error-buffered-file->buffer) -10150 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10151 68/push 0/imm32 -10152 68/push 0/imm32 -10153 89/<- %edx 4/r32/esp -10154 (tailor-exit-descriptor %edx 0x10) -10155 # -10156 (write _test-input-stream "fn foo {\n") -10157 (write _test-input-stream " var a: (array int 3)\n") -10158 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a\n") -10159 (write _test-input-stream "}\n") -10160 # convert -10161 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10162 # registers except esp clobbered at this point -10163 # restore ed -10164 89/<- %edx 4/r32/esp -10165 (flush _test-output-buffered-file) -10166 (flush _test-error-buffered-file) -10167 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10173 # check output -10174 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-too-few-inouts: output should be empty") -10175 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: too few inouts (2 required)" "F - test-compute-offset-with-too-few-inouts: error message") -10176 # check that stop(1) was called -10177 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-too-few-inouts: exit status") -10178 # don't restore from ebp -10179 81 0/subop/add %esp 8/imm32 -10180 # . epilogue -10181 5d/pop-to-ebp -10182 c3/return -10183 -10184 test-compute-offset-with-too-many-inouts: -10185 # . prologue -10186 55/push-ebp -10187 89/<- %ebp 4/r32/esp -10188 # setup -10189 (clear-stream _test-input-stream) -10190 (clear-stream $_test-input-buffered-file->buffer) -10191 (clear-stream _test-output-stream) -10192 (clear-stream $_test-output-buffered-file->buffer) -10193 (clear-stream _test-error-stream) -10194 (clear-stream $_test-error-buffered-file->buffer) -10195 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10196 68/push 0/imm32 -10197 68/push 0/imm32 -10198 89/<- %edx 4/r32/esp -10199 (tailor-exit-descriptor %edx 0x10) -10200 # -10201 (write _test-input-stream "fn foo {\n") -10202 (write _test-input-stream " var a: (array int 3)\n") -10203 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0, 0\n") -10204 (write _test-input-stream "}\n") -10205 # convert -10206 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10207 # registers except esp clobbered at this point -10208 # restore ed -10209 89/<- %edx 4/r32/esp -10210 (flush _test-output-buffered-file) -10211 (flush _test-error-buffered-file) -10212 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10218 # check output -10219 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-too-many-inouts: output should be empty") -10220 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: too many inouts (2 required)" "F - test-compute-offset-with-too-many-inouts: error message") -10221 # check that stop(1) was called -10222 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-too-many-inouts: exit status") -10223 # don't restore from ebp -10224 81 0/subop/add %esp 8/imm32 -10225 # . epilogue -10226 5d/pop-to-ebp -10227 c3/return -10228 -10229 test-compute-offset-with-no-output: -10230 # . prologue -10231 55/push-ebp -10232 89/<- %ebp 4/r32/esp -10233 # setup -10234 (clear-stream _test-input-stream) -10235 (clear-stream $_test-input-buffered-file->buffer) -10236 (clear-stream _test-output-stream) -10237 (clear-stream $_test-output-buffered-file->buffer) -10238 (clear-stream _test-error-stream) -10239 (clear-stream $_test-error-buffered-file->buffer) -10240 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10241 68/push 0/imm32 -10242 68/push 0/imm32 -10243 89/<- %edx 4/r32/esp -10244 (tailor-exit-descriptor %edx 0x10) -10245 # -10246 (write _test-input-stream "fn foo {\n") -10247 (write _test-input-stream " var a: (array int 3)\n") -10248 (write _test-input-stream " compute-offset a, 0\n") -10249 (write _test-input-stream "}\n") -10250 # convert -10251 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10252 # registers except esp clobbered at this point -10253 # restore ed -10254 89/<- %edx 4/r32/esp -10255 (flush _test-output-buffered-file) -10256 (flush _test-error-buffered-file) -10257 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10263 # check output -10264 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-no-output: output should be empty") -10265 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: must have an output" "F - test-compute-offset-with-no-output: error message") -10266 # check that stop(1) was called -10267 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-no-output: exit status") -10268 # don't restore from ebp -10269 81 0/subop/add %esp 8/imm32 -10270 # . epilogue -10271 5d/pop-to-ebp -10272 c3/return -10273 -10274 test-compute-offset-with-too-many-outputs: -10275 # . prologue -10276 55/push-ebp -10277 89/<- %ebp 4/r32/esp -10278 # setup -10279 (clear-stream _test-input-stream) -10280 (clear-stream $_test-input-buffered-file->buffer) -10281 (clear-stream _test-output-stream) -10282 (clear-stream $_test-output-buffered-file->buffer) -10283 (clear-stream _test-error-stream) -10284 (clear-stream $_test-error-buffered-file->buffer) -10285 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10286 68/push 0/imm32 -10287 68/push 0/imm32 -10288 89/<- %edx 4/r32/esp -10289 (tailor-exit-descriptor %edx 0x10) -10290 # -10291 (write _test-input-stream "fn foo {\n") -10292 (write _test-input-stream " var a: (array int 3)\n") -10293 (write _test-input-stream " var b/eax: (offset int) <- compute-offset a, 0\n") -10294 (write _test-input-stream " var c/ecx: (addr int) <- copy 0\n") -10295 (write _test-input-stream " b, c <- compute-offset a, 0\n") -10296 (write _test-input-stream "}\n") -10297 # convert -10298 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10299 # registers except esp clobbered at this point -10300 # restore ed -10301 89/<- %edx 4/r32/esp -10302 (flush _test-output-buffered-file) -10303 (flush _test-error-buffered-file) -10304 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10310 # check output -10311 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-too-many-outputs: output should be empty") -10312 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: too many outputs (1 required)" "F - test-compute-offset-with-too-many-outputs: error message") -10313 # check that stop(1) was called -10314 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-too-many-outputs: exit status") -10315 # don't restore from ebp -10316 81 0/subop/add %esp 8/imm32 -10317 # . epilogue -10318 5d/pop-to-ebp -10319 c3/return -10320 -10321 test-convert-read-from-stream: -10322 # . prologue -10323 55/push-ebp -10324 89/<- %ebp 4/r32/esp -10325 # setup -10326 (clear-stream _test-input-stream) -10327 (clear-stream $_test-input-buffered-file->buffer) -10328 (clear-stream _test-output-stream) -10329 (clear-stream $_test-output-buffered-file->buffer) -10330 # -10331 (write _test-input-stream "fn foo {\n") -10332 (write _test-input-stream " var s/esi: (addr stream int) <- copy 0\n") -10333 (write _test-input-stream " var o/ecx: (addr int) <- copy 0\n") -10334 (write _test-input-stream " read-from-stream s, o\n") -10335 (write _test-input-stream "}\n") -10336 # convert -10337 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -10338 # registers except esp clobbered at this point -10339 # restore ed -10340 89/<- %edx 4/r32/esp -10341 (flush _test-output-buffered-file) -10342 (flush _test-error-buffered-file) -10343 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -10349 # check output -10350 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-read-from-stream/0") -10351 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-read-from-stream/1") -10352 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-read-from-stream/2") -10353 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-read-from-stream/3") -10354 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-read-from-stream/4") -10355 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-read-from-stream/5") -10356 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-read-from-stream/6") -10357 (check-next-stream-line-equal _test-output-stream " be/copy-to-esi 0/imm32" "F - test-convert-read-from-stream/7") -10358 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-read-from-stream/8") -10359 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-read-from-stream/9") -10360 (check-next-stream-line-equal _test-output-stream " (read-from-stream %esi %ecx 0x00000004)" "F - test-convert-read-from-stream/10") -10361 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-read-from-stream/11") -10362 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-read-from-stream/12") -10363 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-read-from-stream/13") -10364 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-read-from-stream/14") -10365 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-read-from-stream/15") -10366 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-read-from-stream/16") -10367 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-read-from-stream/17") -10368 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-read-from-stream/18") -10369 # . epilogue -10370 89/<- %esp 5/r32/ebp -10371 5d/pop-to-ebp -10372 c3/return -10373 -10374 test-convert-read-from-stream-with-correct-payload-size: -10375 # . prologue -10376 55/push-ebp -10377 89/<- %ebp 4/r32/esp -10378 # setup -10379 (clear-stream _test-input-stream) -10380 (clear-stream $_test-input-buffered-file->buffer) -10381 (clear-stream _test-output-stream) -10382 (clear-stream $_test-output-buffered-file->buffer) -10383 # -10384 (write _test-input-stream "fn foo {\n") -10385 (write _test-input-stream " var s/esi: (addr stream handle int) <- copy 0\n") -10386 (write _test-input-stream " var o/ecx: (addr handle int) <- copy 0\n") -10387 (write _test-input-stream " read-from-stream s, o\n") -10388 (write _test-input-stream "}\n") -10389 # convert -10390 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -10391 # registers except esp clobbered at this point -10392 # restore ed -10393 89/<- %edx 4/r32/esp -10394 (flush _test-output-buffered-file) -10395 (flush _test-error-buffered-file) -10396 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -10402 # check output -10403 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-read-from-stream-with-correct-payload-size/0") -10404 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-read-from-stream-with-correct-payload-size/1") -10405 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-read-from-stream-with-correct-payload-size/2") -10406 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-read-from-stream-with-correct-payload-size/3") -10407 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-read-from-stream-with-correct-payload-size/4") -10408 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-read-from-stream-with-correct-payload-size/5") -10409 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-read-from-stream-with-correct-payload-size/6") -10410 (check-next-stream-line-equal _test-output-stream " be/copy-to-esi 0/imm32" "F - test-convert-read-from-stream-with-correct-payload-size/7") -10411 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-read-from-stream-with-correct-payload-size/8") -10412 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-read-from-stream-with-correct-payload-size/9") -10413 (check-next-stream-line-equal _test-output-stream " (read-from-stream %esi %ecx 0x00000008)" "F - test-convert-read-from-stream-with-correct-payload-size/10") -10414 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-read-from-stream-with-correct-payload-size/11") -10415 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-read-from-stream-with-correct-payload-size/12") -10416 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-read-from-stream-with-correct-payload-size/13") -10417 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-read-from-stream-with-correct-payload-size/14") -10418 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-read-from-stream-with-correct-payload-size/15") -10419 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-read-from-stream-with-correct-payload-size/16") -10420 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-read-from-stream-with-correct-payload-size/17") -10421 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-read-from-stream-with-correct-payload-size/18") -10422 # . epilogue -10423 89/<- %esp 5/r32/ebp -10424 5d/pop-to-ebp -10425 c3/return -10426 -10427 test-read-from-stream-with-non-stream-atom-base-type: -10428 # . prologue -10429 55/push-ebp -10430 89/<- %ebp 4/r32/esp -10431 # setup -10432 (clear-stream _test-input-stream) -10433 (clear-stream $_test-input-buffered-file->buffer) -10434 (clear-stream _test-output-stream) -10435 (clear-stream $_test-output-buffered-file->buffer) -10436 (clear-stream _test-error-stream) -10437 (clear-stream $_test-error-buffered-file->buffer) -10438 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10439 68/push 0/imm32 -10440 68/push 0/imm32 -10441 89/<- %edx 4/r32/esp -10442 (tailor-exit-descriptor %edx 0x10) -10443 # -10444 (write _test-input-stream "fn foo {\n") -10445 (write _test-input-stream " var a: int\n") -10446 (write _test-input-stream " read-from-stream a, 0\n") -10447 (write _test-input-stream "}\n") -10448 # convert -10449 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10450 # registers except esp clobbered at this point -10451 # restore ed -10452 89/<- %edx 4/r32/esp -10453 (flush _test-output-buffered-file) -10454 (flush _test-error-buffered-file) -10455 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10461 # check output -10462 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-non-stream-atom-base-type: output should be empty") -10463 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: var 'a' must be an addr to a stream" "F - test-read-from-stream-with-non-stream-atom-base-type: error message") -10464 # check that stop(1) was called -10465 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-non-stream-atom-base-type: exit status") -10466 # don't restore from ebp -10467 81 0/subop/add %esp 8/imm32 -10468 # . epilogue -10469 5d/pop-to-ebp -10470 c3/return -10471 -10472 test-read-from-stream-with-non-stream-compound-base-type: -10473 # . prologue -10474 55/push-ebp -10475 89/<- %ebp 4/r32/esp -10476 # setup -10477 (clear-stream _test-input-stream) -10478 (clear-stream $_test-input-buffered-file->buffer) -10479 (clear-stream _test-output-stream) -10480 (clear-stream $_test-output-buffered-file->buffer) -10481 (clear-stream _test-error-stream) -10482 (clear-stream $_test-error-buffered-file->buffer) -10483 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10484 68/push 0/imm32 -10485 68/push 0/imm32 -10486 89/<- %edx 4/r32/esp -10487 (tailor-exit-descriptor %edx 0x10) -10488 # -10489 (write _test-input-stream "fn foo {\n") -10490 (write _test-input-stream " var a: (handle int)\n") -10491 (write _test-input-stream " read-from-stream a, 0\n") -10492 (write _test-input-stream "}\n") -10493 # convert -10494 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10495 # registers except esp clobbered at this point -10496 # restore ed -10497 89/<- %edx 4/r32/esp -10498 (flush _test-output-buffered-file) -10499 (flush _test-error-buffered-file) -10500 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10506 # check output -10507 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-non-stream-compound-base-type: output should be empty") -10508 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: var 'a' must be an addr to a stream" "F - test-read-from-stream-with-non-stream-compound-base-type: error message") -10509 # check that stop(1) was called -10510 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-non-stream-compound-base-type: exit status") -10511 # don't restore from ebp -10512 81 0/subop/add %esp 8/imm32 -10513 # . epilogue -10514 5d/pop-to-ebp -10515 c3/return -10516 -10517 test-read-from-stream-with-non-stream-compound-base-type-2: -10518 # . prologue -10519 55/push-ebp -10520 89/<- %ebp 4/r32/esp -10521 # setup -10522 (clear-stream _test-input-stream) -10523 (clear-stream $_test-input-buffered-file->buffer) -10524 (clear-stream _test-output-stream) -10525 (clear-stream $_test-output-buffered-file->buffer) -10526 (clear-stream _test-error-stream) -10527 (clear-stream $_test-error-buffered-file->buffer) -10528 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10529 68/push 0/imm32 -10530 68/push 0/imm32 -10531 89/<- %edx 4/r32/esp -10532 (tailor-exit-descriptor %edx 0x10) -10533 # -10534 (write _test-input-stream "fn foo {\n") -10535 (write _test-input-stream " var a: (addr int)\n") -10536 (write _test-input-stream " read-from-stream a, 0\n") -10537 (write _test-input-stream "}\n") -10538 # convert -10539 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10540 # registers except esp clobbered at this point -10541 # restore ed -10542 89/<- %edx 4/r32/esp -10543 (flush _test-output-buffered-file) -10544 (flush _test-error-buffered-file) -10545 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10551 # check output -10552 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-non-stream-compound-base-type-2: output should be empty") -10553 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: var 'a' must be an addr to a stream" "F - test-read-from-stream-with-non-stream-compound-base-type-2: error message") -10554 # check that stop(1) was called -10555 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-non-stream-compound-base-type-2: exit status") -10556 # don't restore from ebp -10557 81 0/subop/add %esp 8/imm32 -10558 # . epilogue -10559 5d/pop-to-ebp -10560 c3/return -10561 -10562 test-read-from-stream-with-stream-atom-base-type: -10563 # . prologue -10564 55/push-ebp -10565 89/<- %ebp 4/r32/esp -10566 # setup -10567 (clear-stream _test-input-stream) -10568 (clear-stream $_test-input-buffered-file->buffer) -10569 (clear-stream _test-output-stream) -10570 (clear-stream $_test-output-buffered-file->buffer) -10571 (clear-stream _test-error-stream) -10572 (clear-stream $_test-error-buffered-file->buffer) -10573 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10574 68/push 0/imm32 -10575 68/push 0/imm32 -10576 89/<- %edx 4/r32/esp -10577 (tailor-exit-descriptor %edx 0x10) -10578 # -10579 (write _test-input-stream "fn foo {\n") -10580 (write _test-input-stream " var a: stream\n") -10581 (write _test-input-stream " read-from-stream a, 0\n") -10582 (write _test-input-stream "}\n") -10583 # convert -10584 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10585 # registers except esp clobbered at this point -10586 # restore ed -10587 89/<- %edx 4/r32/esp -10588 (flush _test-output-buffered-file) -10589 (flush _test-error-buffered-file) -10590 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10596 # check output -10597 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-stream-atom-base-type: output should be empty") -10598 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: var 'a' must be an addr to a stream" "F - test-read-from-stream-with-stream-atom-base-type: error message") -10599 # check that stop(1) was called -10600 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-stream-atom-base-type: exit status") -10601 # don't restore from ebp -10602 81 0/subop/add %esp 8/imm32 -10603 # . epilogue -10604 5d/pop-to-ebp -10605 c3/return -10606 -10607 test-read-from-stream-with-wrong-index-type: -10608 # . prologue -10609 55/push-ebp -10610 89/<- %ebp 4/r32/esp -10611 # setup -10612 (clear-stream _test-input-stream) -10613 (clear-stream $_test-input-buffered-file->buffer) -10614 (clear-stream _test-output-stream) -10615 (clear-stream $_test-output-buffered-file->buffer) -10616 (clear-stream _test-error-stream) -10617 (clear-stream $_test-error-buffered-file->buffer) -10618 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10619 68/push 0/imm32 -10620 68/push 0/imm32 -10621 89/<- %edx 4/r32/esp -10622 (tailor-exit-descriptor %edx 0x10) -10623 # -10624 (write _test-input-stream "fn foo {\n") -10625 (write _test-input-stream " var a/eax: (addr stream int) <- copy 0\n") -10626 (write _test-input-stream " var b: boolean\n") -10627 (write _test-input-stream " read-from-stream a, b\n") -10628 (write _test-input-stream "}\n") -10629 # convert -10630 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10631 # registers except esp clobbered at this point -10632 # restore ed -10633 89/<- %edx 4/r32/esp -10634 (flush _test-output-buffered-file) -10635 (flush _test-error-buffered-file) -10636 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10642 # check output -10643 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-wrong-index-type: output should be empty") -10644 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: target 'b' must be an addr" "F - test-read-from-stream-with-wrong-index-type: error message") -10645 # check that stop(1) was called -10646 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-wrong-index-type: exit status") -10647 # don't restore from ebp -10648 81 0/subop/add %esp 8/imm32 -10649 # . epilogue -10650 5d/pop-to-ebp -10651 c3/return -10652 -10653 test-read-from-stream-with-no-inouts: -10654 # . prologue -10655 55/push-ebp -10656 89/<- %ebp 4/r32/esp -10657 # setup -10658 (clear-stream _test-input-stream) -10659 (clear-stream $_test-input-buffered-file->buffer) -10660 (clear-stream _test-output-stream) -10661 (clear-stream $_test-output-buffered-file->buffer) -10662 (clear-stream _test-error-stream) -10663 (clear-stream $_test-error-buffered-file->buffer) -10664 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10665 68/push 0/imm32 -10666 68/push 0/imm32 -10667 89/<- %edx 4/r32/esp -10668 (tailor-exit-descriptor %edx 0x10) -10669 # -10670 (write _test-input-stream "fn foo {\n") -10671 (write _test-input-stream " read-from-stream\n") -10672 (write _test-input-stream "}\n") -10673 # convert -10674 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10675 # registers except esp clobbered at this point -10676 # restore ed -10677 89/<- %edx 4/r32/esp -10678 (flush _test-output-buffered-file) -10679 (flush _test-error-buffered-file) -10680 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10686 # check output -10687 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-no-inouts: output should be empty") -10688 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: too few inouts (2 required)" "F - test-read-from-stream-with-no-inouts: error message") -10689 # check that stop(1) was called -10690 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-no-inouts: exit status") -10691 # don't restore from ebp -10692 81 0/subop/add %esp 8/imm32 -10693 # . epilogue -10694 5d/pop-to-ebp -10695 c3/return -10696 -10697 test-read-from-stream-with-too-few-inouts: -10698 # . prologue -10699 55/push-ebp -10700 89/<- %ebp 4/r32/esp -10701 # setup -10702 (clear-stream _test-input-stream) -10703 (clear-stream $_test-input-buffered-file->buffer) -10704 (clear-stream _test-output-stream) -10705 (clear-stream $_test-output-buffered-file->buffer) -10706 (clear-stream _test-error-stream) -10707 (clear-stream $_test-error-buffered-file->buffer) -10708 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10709 68/push 0/imm32 -10710 68/push 0/imm32 -10711 89/<- %edx 4/r32/esp -10712 (tailor-exit-descriptor %edx 0x10) -10713 # -10714 (write _test-input-stream "fn foo {\n") -10715 (write _test-input-stream " var a: (addr stream int)\n") -10716 (write _test-input-stream " read-from-stream a\n") -10717 (write _test-input-stream "}\n") -10718 # convert -10719 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10720 # registers except esp clobbered at this point -10721 # restore ed -10722 89/<- %edx 4/r32/esp -10723 (flush _test-output-buffered-file) -10724 (flush _test-error-buffered-file) -10725 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10731 # check output -10732 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-too-few-inouts: output should be empty") -10733 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: too few inouts (2 required)" "F - test-read-from-stream-with-too-few-inouts: error message") -10734 # check that stop(1) was called -10735 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-too-few-inouts: exit status") -10736 # don't restore from ebp -10737 81 0/subop/add %esp 8/imm32 -10738 # . epilogue -10739 5d/pop-to-ebp -10740 c3/return -10741 -10742 test-read-from-stream-with-too-many-inouts: -10743 # . prologue -10744 55/push-ebp -10745 89/<- %ebp 4/r32/esp -10746 # setup -10747 (clear-stream _test-input-stream) -10748 (clear-stream $_test-input-buffered-file->buffer) -10749 (clear-stream _test-output-stream) -10750 (clear-stream $_test-output-buffered-file->buffer) -10751 (clear-stream _test-error-stream) -10752 (clear-stream $_test-error-buffered-file->buffer) -10753 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10754 68/push 0/imm32 -10755 68/push 0/imm32 -10756 89/<- %edx 4/r32/esp -10757 (tailor-exit-descriptor %edx 0x10) -10758 # -10759 (write _test-input-stream "fn foo {\n") -10760 (write _test-input-stream " var a: (addr stream int)\n") -10761 (write _test-input-stream " var b: (addr int)\n") -10762 (write _test-input-stream " read-from-stream a, b, 0\n") -10763 (write _test-input-stream "}\n") -10764 # convert -10765 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10766 # registers except esp clobbered at this point -10767 # restore ed -10768 89/<- %edx 4/r32/esp -10769 (flush _test-output-buffered-file) -10770 (flush _test-error-buffered-file) -10771 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10777 # check output -10778 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-too-many-inouts: output should be empty") -10779 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: too many inouts (2 required)" "F - test-read-from-stream-with-too-many-inouts: error message") -10780 # check that stop(1) was called -10781 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-too-many-inouts: exit status") -10782 # don't restore from ebp -10783 81 0/subop/add %esp 8/imm32 -10784 # . epilogue -10785 5d/pop-to-ebp -10786 c3/return -10787 -10788 test-read-from-stream-with-output: -10789 # . prologue -10790 55/push-ebp -10791 89/<- %ebp 4/r32/esp -10792 # setup -10793 (clear-stream _test-input-stream) -10794 (clear-stream $_test-input-buffered-file->buffer) -10795 (clear-stream _test-output-stream) -10796 (clear-stream $_test-output-buffered-file->buffer) -10797 (clear-stream _test-error-stream) -10798 (clear-stream $_test-error-buffered-file->buffer) -10799 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10800 68/push 0/imm32 -10801 68/push 0/imm32 -10802 89/<- %edx 4/r32/esp -10803 (tailor-exit-descriptor %edx 0x10) -10804 # -10805 (write _test-input-stream "fn foo {\n") -10806 (write _test-input-stream " var a: (addr stream int)\n") -10807 (write _test-input-stream " var b/eax: (addr int) <- copy 0\n") -10808 (write _test-input-stream " b <- read-from-stream a, b\n") -10809 (write _test-input-stream "}\n") -10810 # convert -10811 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10812 # registers except esp clobbered at this point -10813 # restore ed + 8704 (check-stream-equal _test-output-stream "" "F - test-get-with-wrong-output-type-4: output should be empty") + 8705 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: wrong output type for member 'x' of type 't'" "F - test-get-with-wrong-output-type-4: error message") + 8706 # check that stop(1) was called + 8707 (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type-4: exit status") + 8708 # don't restore from ebp + 8709 81 0/subop/add %esp 8/imm32 + 8710 # . epilogue + 8711 5d/pop-to-ebp + 8712 c3/return + 8713 + 8714 test-get-with-wrong-output-type-5: + 8715 # . prologue + 8716 55/push-ebp + 8717 89/<- %ebp 4/r32/esp + 8718 # setup + 8719 (clear-stream _test-input-stream) + 8720 (clear-stream $_test-input-buffered-file->buffer) + 8721 (clear-stream _test-output-stream) + 8722 (clear-stream $_test-output-buffered-file->buffer) + 8723 # + 8724 (write _test-input-stream "fn foo {\n") + 8725 (write _test-input-stream " var a: t\n") + 8726 (write _test-input-stream " var c/ecx: (addr handle int) <- get a, x\n") + 8727 (write _test-input-stream "}\n") + 8728 (write _test-input-stream "type t {\n") + 8729 (write _test-input-stream " x: (handle int)\n") + 8730 (write _test-input-stream "}\n") + 8731 # convert + 8732 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 8733 (flush _test-output-buffered-file) + 8734 # no errors + 8735 # . epilogue + 8736 89/<- %esp 5/r32/ebp + 8737 5d/pop-to-ebp + 8738 c3/return + 8739 + 8740 test-get-with-too-few-inouts: + 8741 # . prologue + 8742 55/push-ebp + 8743 89/<- %ebp 4/r32/esp + 8744 # setup + 8745 (clear-stream _test-input-stream) + 8746 (clear-stream $_test-input-buffered-file->buffer) + 8747 (clear-stream _test-output-stream) + 8748 (clear-stream $_test-output-buffered-file->buffer) + 8749 (clear-stream _test-error-stream) + 8750 (clear-stream $_test-error-buffered-file->buffer) + 8751 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8752 68/push 0/imm32 + 8753 68/push 0/imm32 + 8754 89/<- %edx 4/r32/esp + 8755 (tailor-exit-descriptor %edx 0x10) + 8756 # + 8757 (write _test-input-stream "fn foo {\n") + 8758 (write _test-input-stream " var a: t\n") + 8759 (write _test-input-stream " var c/ecx: (addr int) <- get a\n") + 8760 (write _test-input-stream "}\n") + 8761 (write _test-input-stream "type t {\n") + 8762 (write _test-input-stream " x: int\n") + 8763 (write _test-input-stream "}\n") + 8764 # convert + 8765 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8766 # registers except esp clobbered at this point + 8767 # restore ed + 8768 89/<- %edx 4/r32/esp + 8769 (flush _test-output-buffered-file) + 8770 (flush _test-error-buffered-file) + 8771 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8777 # check output + 8778 (check-stream-equal _test-output-stream "" "F - test-get-with-too-few-inouts: output should be empty") + 8779 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: too few inouts (2 required)" "F - test-get-with-too-few-inouts: error message") + 8780 # check that stop(1) was called + 8781 (check-ints-equal *(edx+4) 2 "F - test-get-with-too-few-inouts: exit status") + 8782 # don't restore from ebp + 8783 81 0/subop/add %esp 8/imm32 + 8784 # . epilogue + 8785 5d/pop-to-ebp + 8786 c3/return + 8787 + 8788 test-get-with-too-many-inouts: + 8789 # . prologue + 8790 55/push-ebp + 8791 89/<- %ebp 4/r32/esp + 8792 # setup + 8793 (clear-stream _test-input-stream) + 8794 (clear-stream $_test-input-buffered-file->buffer) + 8795 (clear-stream _test-output-stream) + 8796 (clear-stream $_test-output-buffered-file->buffer) + 8797 (clear-stream _test-error-stream) + 8798 (clear-stream $_test-error-buffered-file->buffer) + 8799 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8800 68/push 0/imm32 + 8801 68/push 0/imm32 + 8802 89/<- %edx 4/r32/esp + 8803 (tailor-exit-descriptor %edx 0x10) + 8804 # + 8805 (write _test-input-stream "fn foo {\n") + 8806 (write _test-input-stream " var a: t\n") + 8807 (write _test-input-stream " var c/ecx: (addr int) <- get a, x, 0\n") + 8808 (write _test-input-stream "}\n") + 8809 (write _test-input-stream "type t {\n") + 8810 (write _test-input-stream " x: int\n") + 8811 (write _test-input-stream "}\n") + 8812 # convert + 8813 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8814 # registers except esp clobbered at this point + 8815 # restore ed + 8816 89/<- %edx 4/r32/esp + 8817 (flush _test-output-buffered-file) + 8818 (flush _test-error-buffered-file) + 8819 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8825 # check output + 8826 (check-stream-equal _test-output-stream "" "F - test-get-with-too-many-inouts: output should be empty") + 8827 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: too many inouts (2 required)" "F - test-get-with-too-many-inouts: error message") + 8828 # check that stop(1) was called + 8829 (check-ints-equal *(edx+4) 2 "F - test-get-with-too-many-inouts: exit status") + 8830 # don't restore from ebp + 8831 81 0/subop/add %esp 8/imm32 + 8832 # . epilogue + 8833 5d/pop-to-ebp + 8834 c3/return + 8835 + 8836 test-get-with-no-output: + 8837 # . prologue + 8838 55/push-ebp + 8839 89/<- %ebp 4/r32/esp + 8840 # setup + 8841 (clear-stream _test-input-stream) + 8842 (clear-stream $_test-input-buffered-file->buffer) + 8843 (clear-stream _test-output-stream) + 8844 (clear-stream $_test-output-buffered-file->buffer) + 8845 (clear-stream _test-error-stream) + 8846 (clear-stream $_test-error-buffered-file->buffer) + 8847 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8848 68/push 0/imm32 + 8849 68/push 0/imm32 + 8850 89/<- %edx 4/r32/esp + 8851 (tailor-exit-descriptor %edx 0x10) + 8852 # + 8853 (write _test-input-stream "fn foo {\n") + 8854 (write _test-input-stream " var a: t\n") + 8855 (write _test-input-stream " get a, x\n") + 8856 (write _test-input-stream "}\n") + 8857 (write _test-input-stream "type t {\n") + 8858 (write _test-input-stream " x: int\n") + 8859 (write _test-input-stream "}\n") + 8860 # convert + 8861 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8862 # registers except esp clobbered at this point + 8863 # restore ed + 8864 89/<- %edx 4/r32/esp + 8865 (flush _test-output-buffered-file) + 8866 (flush _test-error-buffered-file) + 8867 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8873 # check output + 8874 (check-stream-equal _test-output-stream "" "F - test-get-with-no-output: output should be empty") + 8875 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: must have an output" "F - test-get-with-no-output: error message") + 8876 # check that stop(1) was called + 8877 (check-ints-equal *(edx+4) 2 "F - test-get-with-no-output: exit status") + 8878 # don't restore from ebp + 8879 81 0/subop/add %esp 8/imm32 + 8880 # . epilogue + 8881 5d/pop-to-ebp + 8882 c3/return + 8883 + 8884 test-get-with-too-many-outputs: + 8885 # . prologue + 8886 55/push-ebp + 8887 89/<- %ebp 4/r32/esp + 8888 # setup + 8889 (clear-stream _test-input-stream) + 8890 (clear-stream $_test-input-buffered-file->buffer) + 8891 (clear-stream _test-output-stream) + 8892 (clear-stream $_test-output-buffered-file->buffer) + 8893 (clear-stream _test-error-stream) + 8894 (clear-stream $_test-error-buffered-file->buffer) + 8895 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 8896 68/push 0/imm32 + 8897 68/push 0/imm32 + 8898 89/<- %edx 4/r32/esp + 8899 (tailor-exit-descriptor %edx 0x10) + 8900 # + 8901 (write _test-input-stream "fn foo {\n") + 8902 (write _test-input-stream " var a: t\n") + 8903 (write _test-input-stream " var b: int\n") + 8904 (write _test-input-stream " var c/eax: (addr int) <- copy 0\n") + 8905 (write _test-input-stream " c, b <- get a, x\n") + 8906 (write _test-input-stream "}\n") + 8907 (write _test-input-stream "type t {\n") + 8908 (write _test-input-stream " x: int\n") + 8909 (write _test-input-stream "}\n") + 8910 # convert + 8911 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 8912 # registers except esp clobbered at this point + 8913 # restore ed + 8914 89/<- %edx 4/r32/esp + 8915 (flush _test-output-buffered-file) + 8916 (flush _test-error-buffered-file) + 8917 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8923 # check output + 8924 (check-stream-equal _test-output-stream "" "F - test-get-with-too-many-outputs: output should be empty") + 8925 (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: too many outputs (1 required)" "F - test-get-with-too-many-outputs: error message") + 8926 # check that stop(1) was called + 8927 (check-ints-equal *(edx+4) 2 "F - test-get-with-too-many-outputs: exit status") + 8928 # don't restore from ebp + 8929 81 0/subop/add %esp 8/imm32 + 8930 # . epilogue + 8931 5d/pop-to-ebp + 8932 c3/return + 8933 + 8934 test-convert-array-of-user-defined-types: + 8935 # . prologue + 8936 55/push-ebp + 8937 89/<- %ebp 4/r32/esp + 8938 # setup + 8939 (clear-stream _test-input-stream) + 8940 (clear-stream $_test-input-buffered-file->buffer) + 8941 (clear-stream _test-output-stream) + 8942 (clear-stream $_test-output-buffered-file->buffer) + 8943 # + 8944 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 + 8945 (write _test-input-stream " x: int\n") + 8946 (write _test-input-stream " y: int\n") + 8947 (write _test-input-stream "}\n") + 8948 (write _test-input-stream "fn foo {\n") + 8949 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") + 8950 (write _test-input-stream " var idx/ecx: int <- copy 3\n") + 8951 (write _test-input-stream " var x/eax: (addr t) <- index arr, idx\n") + 8952 (write _test-input-stream "}\n") + 8953 # convert + 8954 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 8955 (flush _test-output-buffered-file) + 8956 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 8962 # check output + 8963 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-array-of-user-defined-types/0") + 8964 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-array-of-user-defined-types/1") + 8965 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-array-of-user-defined-types/2") + 8966 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-array-of-user-defined-types/3") + 8967 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-array-of-user-defined-types/4") + 8968 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-array-of-user-defined-types/5") + 8969 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-array-of-user-defined-types/6") + 8970 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-array-of-user-defined-types/7") + 8971 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-array-of-user-defined-types/8") + 8972 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 3/imm32" "F - test-convert-array-of-user-defined-types/9") + 8973 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + ecx<<0x00000003 + 4) 0x00000000/r32" "F - test-convert-array-of-user-defined-types/11") + 8974 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-array-of-user-defined-types/13") + 8975 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-array-of-user-defined-types/14") + 8976 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-array-of-user-defined-types/15") + 8977 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-array-of-user-defined-types/16") + 8978 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-array-of-user-defined-types/17") + 8979 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-array-of-user-defined-types/18") + 8980 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-array-of-user-defined-types/19") + 8981 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-array-of-user-defined-types/20") + 8982 # . epilogue + 8983 89/<- %esp 5/r32/ebp + 8984 5d/pop-to-ebp + 8985 c3/return + 8986 + 8987 test-convert-length-of-array-of-user-defined-types-to-eax: + 8988 # . prologue + 8989 55/push-ebp + 8990 89/<- %ebp 4/r32/esp + 8991 # setup + 8992 (clear-stream _test-input-stream) + 8993 (clear-stream $_test-input-buffered-file->buffer) + 8994 (clear-stream _test-output-stream) + 8995 (clear-stream $_test-output-buffered-file->buffer) + 8996 # + 8997 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 + 8998 (write _test-input-stream " x: int\n") + 8999 (write _test-input-stream " y: int\n") + 9000 (write _test-input-stream " z: int\n") + 9001 (write _test-input-stream "}\n") + 9002 (write _test-input-stream "fn foo {\n") + 9003 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") + 9004 (write _test-input-stream " var x/eax: int <- length arr\n") + 9005 (write _test-input-stream "}\n") + 9006 # convert + 9007 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 9008 (flush _test-output-buffered-file) + 9009 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9015 # check output + 9016 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/0") + 9017 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/1") + 9018 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-eax/2") + 9019 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-user-defined-types-to-eax/3") + 9020 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-eax/4") + 9021 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/5") + 9022 # var arr + 9023 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-user-defined-types-to-eax/6") + 9024 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-length-of-array-of-user-defined-types-to-eax/7") + 9025 # length instruction + 9026 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/8") + 9027 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/9") + 9028 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-user-defined-types-to-eax/10") + 9029 (check-next-stream-line-equal _test-output-stream " 31/xor %edx 2/r32/edx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/11") + 9030 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x0000000c/imm32" "F - test-convert-length-of-array-of-user-defined-types-to-eax/12") + 9031 (check-next-stream-line-equal _test-output-stream " f7 7/subop/idiv-eax-edx-by %ecx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/13") + 9032 (check-next-stream-line-equal _test-output-stream " 5a/pop-to-edx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/14") + 9033 (check-next-stream-line-equal _test-output-stream " 59/pop-to-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-eax/15") + 9034 # reclaim arr + 9035 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-user-defined-types-to-eax/16") + 9036 # + 9037 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-eax/17") + 9038 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-eax/18") + 9039 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-eax/19") + 9040 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-user-defined-types-to-eax/20") + 9041 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-eax/21") + 9042 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-eax/22") + 9043 # . epilogue + 9044 89/<- %esp 5/r32/ebp + 9045 5d/pop-to-ebp + 9046 c3/return + 9047 + 9048 test-convert-length-of-array-of-user-defined-types-to-ecx: + 9049 # . prologue + 9050 55/push-ebp + 9051 89/<- %ebp 4/r32/esp + 9052 # setup + 9053 (clear-stream _test-input-stream) + 9054 (clear-stream $_test-input-buffered-file->buffer) + 9055 (clear-stream _test-output-stream) + 9056 (clear-stream $_test-output-buffered-file->buffer) + 9057 # + 9058 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 + 9059 (write _test-input-stream " x: int\n") + 9060 (write _test-input-stream " y: int\n") + 9061 (write _test-input-stream " z: int\n") + 9062 (write _test-input-stream "}\n") + 9063 (write _test-input-stream "fn foo {\n") + 9064 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") + 9065 (write _test-input-stream " var x/ecx: int <- length arr\n") + 9066 (write _test-input-stream "}\n") + 9067 # convert + 9068 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 9069 (flush _test-output-buffered-file) + 9070 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9076 # check output + 9077 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/0") + 9078 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/1") + 9079 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/2") + 9080 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/3") + 9081 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/4") + 9082 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/5") + 9083 # var a + 9084 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/6") + 9085 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/7") + 9086 # var x + 9087 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/8") + 9088 # length instruction + 9089 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/9") + 9090 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/10") + 9091 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/11") + 9092 (check-next-stream-line-equal _test-output-stream " 31/xor %edx 2/r32/edx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/12") + 9093 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x0000000c/imm32" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/13") + 9094 (check-next-stream-line-equal _test-output-stream " f7 7/subop/idiv-eax-edx-by %ecx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/14") + 9095 (check-next-stream-line-equal _test-output-stream " 89/<- %ecx 0/r32/eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/15") + 9096 (check-next-stream-line-equal _test-output-stream " 5a/pop-to-edx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/16") + 9097 (check-next-stream-line-equal _test-output-stream " 58/pop-to-eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/17") + 9098 # reclaim x + 9099 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/18") + 9100 # reclaim a + 9101 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/19") + 9102 # + 9103 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/20") + 9104 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/21") + 9105 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/22") + 9106 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/23") + 9107 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/24") + 9108 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-ecx/25") + 9109 # . epilogue + 9110 89/<- %esp 5/r32/ebp + 9111 5d/pop-to-ebp + 9112 c3/return + 9113 + 9114 test-convert-length-of-array-of-user-defined-types-to-edx: + 9115 # . prologue + 9116 55/push-ebp + 9117 89/<- %ebp 4/r32/esp + 9118 # setup + 9119 (clear-stream _test-input-stream) + 9120 (clear-stream $_test-input-buffered-file->buffer) + 9121 (clear-stream _test-output-stream) + 9122 (clear-stream $_test-output-buffered-file->buffer) + 9123 # + 9124 (write _test-input-stream "type t {\n") # size = 12, which is not a power of 2 + 9125 (write _test-input-stream " x: int\n") + 9126 (write _test-input-stream " y: int\n") + 9127 (write _test-input-stream " z: int\n") + 9128 (write _test-input-stream "}\n") + 9129 (write _test-input-stream "fn foo {\n") + 9130 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") + 9131 (write _test-input-stream " var x/edx: int <- length arr\n") + 9132 (write _test-input-stream "}\n") + 9133 # convert + 9134 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 9135 (flush _test-output-buffered-file) + 9136 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9142 # check output + 9143 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/0") + 9144 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/1") + 9145 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-edx/2") + 9146 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-user-defined-types-to-edx/3") + 9147 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types-to-edx/4") + 9148 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/5") + 9149 # var a + 9150 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/6") + 9151 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-length-of-array-of-user-defined-types-to-edx/7") + 9152 # var x + 9153 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %edx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/8") + 9154 # length instruction + 9155 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/9") + 9156 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/10") + 9157 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-user-defined-types-to-edx/11") + 9158 (check-next-stream-line-equal _test-output-stream " 31/xor %edx 2/r32/edx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/12") + 9159 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x0000000c/imm32" "F - test-convert-length-of-array-of-user-defined-types-to-edx/13") + 9160 (check-next-stream-line-equal _test-output-stream " f7 7/subop/idiv-eax-edx-by %ecx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/14") + 9161 (check-next-stream-line-equal _test-output-stream " 89/<- %edx 0/r32/eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/15") + 9162 (check-next-stream-line-equal _test-output-stream " 59/pop-to-ecx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/16") + 9163 (check-next-stream-line-equal _test-output-stream " 58/pop-to-eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/17") + 9164 # reclaim x + 9165 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %edx" "F - test-convert-length-of-array-of-user-defined-types-to-edx/18") + 9166 # reclaim a + 9167 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-user-defined-types-to-edx/19") + 9168 # + 9169 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types-to-edx/20") + 9170 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types-to-edx/21") + 9171 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types-to-edx/22") + 9172 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-user-defined-types-to-edx/23") + 9173 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-user-defined-types-to-edx/24") + 9174 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types-to-edx/25") + 9175 # . epilogue + 9176 89/<- %esp 5/r32/ebp + 9177 5d/pop-to-ebp + 9178 c3/return + 9179 + 9180 test-convert-length-of-array-of-user-defined-types: + 9181 # . prologue + 9182 55/push-ebp + 9183 89/<- %ebp 4/r32/esp + 9184 # setup + 9185 (clear-stream _test-input-stream) + 9186 (clear-stream $_test-input-buffered-file->buffer) + 9187 (clear-stream _test-output-stream) + 9188 (clear-stream $_test-output-buffered-file->buffer) + 9189 # + 9190 (write _test-input-stream "type t {\n") # each t is 8 bytes, which is a power of 2 + 9191 (write _test-input-stream " x: int\n") + 9192 (write _test-input-stream " y: int\n") + 9193 (write _test-input-stream " z: int\n") + 9194 (write _test-input-stream "}\n") + 9195 (write _test-input-stream "fn foo {\n") + 9196 (write _test-input-stream " var arr/eax: (addr array t) <- copy 0\n") + 9197 (write _test-input-stream " var x/ebx: int <- length arr\n") + 9198 (write _test-input-stream "}\n") + 9199 # convert + 9200 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) + 9201 (flush _test-output-buffered-file) + 9202 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9208 # check output + 9209 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-length-of-array-of-user-defined-types/0") + 9210 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-length-of-array-of-user-defined-types/1") + 9211 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-length-of-array-of-user-defined-types/2") + 9212 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-length-of-array-of-user-defined-types/3") + 9213 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-length-of-array-of-user-defined-types/4") + 9214 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-length-of-array-of-user-defined-types/5") + 9215 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-length-of-array-of-user-defined-types/6") + 9216 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-length-of-array-of-user-defined-types/7") + 9217 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ebx" "F - test-convert-length-of-array-of-user-defined-types/8") + 9218 (check-next-stream-line-equal _test-output-stream " 50/push-eax" "F - test-convert-length-of-array-of-user-defined-types/9") + 9219 (check-next-stream-line-equal _test-output-stream " 51/push-ecx" "F - test-convert-length-of-array-of-user-defined-types/10") + 9220 (check-next-stream-line-equal _test-output-stream " 52/push-edx" "F - test-convert-length-of-array-of-user-defined-types/11") + 9221 (check-next-stream-line-equal _test-output-stream " 8b/-> *eax 0x00000000/r32" "F - test-convert-length-of-array-of-user-defined-types/12") + 9222 (check-next-stream-line-equal _test-output-stream " 31/xor %edx 2/r32/edx" "F - test-convert-length-of-array-of-user-defined-types/13") + 9223 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0x0000000c/imm32" "F - test-convert-length-of-array-of-user-defined-types/14") + 9224 (check-next-stream-line-equal _test-output-stream " f7 7/subop/idiv-eax-edx-by %ecx" "F - test-convert-length-of-array-of-user-defined-types/15") + 9225 (check-next-stream-line-equal _test-output-stream " 89/<- %ebx 0/r32/eax" "F - test-convert-length-of-array-of-user-defined-types/16") + 9226 (check-next-stream-line-equal _test-output-stream " 5a/pop-to-edx" "F - test-convert-length-of-array-of-user-defined-types/17") + 9227 (check-next-stream-line-equal _test-output-stream " 59/pop-to-ecx" "F - test-convert-length-of-array-of-user-defined-types/18") + 9228 (check-next-stream-line-equal _test-output-stream " 58/pop-to-eax" "F - test-convert-length-of-array-of-user-defined-types/19") + 9229 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ebx" "F - test-convert-length-of-array-of-user-defined-types/20") + 9230 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-length-of-array-of-user-defined-types/21") + 9231 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-length-of-array-of-user-defined-types/22") + 9232 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-length-of-array-of-user-defined-types/23") + 9233 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-length-of-array-of-user-defined-types/24") + 9234 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-length-of-array-of-user-defined-types/25") + 9235 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-length-of-array-of-user-defined-types/26") + 9236 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-length-of-array-of-user-defined-types/27") + 9237 # . epilogue + 9238 89/<- %esp 5/r32/ebp + 9239 5d/pop-to-ebp + 9240 c3/return + 9241 + 9242 test-index-with-non-array-atom-base-type: + 9243 # . prologue + 9244 55/push-ebp + 9245 89/<- %ebp 4/r32/esp + 9246 # setup + 9247 (clear-stream _test-input-stream) + 9248 (clear-stream $_test-input-buffered-file->buffer) + 9249 (clear-stream _test-output-stream) + 9250 (clear-stream $_test-output-buffered-file->buffer) + 9251 (clear-stream _test-error-stream) + 9252 (clear-stream $_test-error-buffered-file->buffer) + 9253 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9254 68/push 0/imm32 + 9255 68/push 0/imm32 + 9256 89/<- %edx 4/r32/esp + 9257 (tailor-exit-descriptor %edx 0x10) + 9258 # + 9259 (write _test-input-stream "fn foo {\n") + 9260 (write _test-input-stream " var a: int\n") + 9261 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") + 9262 (write _test-input-stream "}\n") + 9263 # convert + 9264 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9265 # registers except esp clobbered at this point + 9266 # restore ed + 9267 89/<- %edx 4/r32/esp + 9268 (flush _test-output-buffered-file) + 9269 (flush _test-error-buffered-file) + 9270 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9276 # check output + 9277 (check-stream-equal _test-output-stream "" "F - test-index-with-non-array-atom-base-type: output should be empty") + 9278 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: var 'a' is not an array" "F - test-index-with-non-array-atom-base-type: error message") + 9279 # check that stop(1) was called + 9280 (check-ints-equal *(edx+4) 2 "F - test-index-with-non-array-atom-base-type: exit status") + 9281 # don't restore from ebp + 9282 81 0/subop/add %esp 8/imm32 + 9283 # . epilogue + 9284 5d/pop-to-ebp + 9285 c3/return + 9286 + 9287 test-index-with-non-array-compound-base-type: + 9288 # . prologue + 9289 55/push-ebp + 9290 89/<- %ebp 4/r32/esp + 9291 # setup + 9292 (clear-stream _test-input-stream) + 9293 (clear-stream $_test-input-buffered-file->buffer) + 9294 (clear-stream _test-output-stream) + 9295 (clear-stream $_test-output-buffered-file->buffer) + 9296 (clear-stream _test-error-stream) + 9297 (clear-stream $_test-error-buffered-file->buffer) + 9298 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9299 68/push 0/imm32 + 9300 68/push 0/imm32 + 9301 89/<- %edx 4/r32/esp + 9302 (tailor-exit-descriptor %edx 0x10) + 9303 # + 9304 (write _test-input-stream "fn foo {\n") + 9305 (write _test-input-stream " var a: (handle int)\n") + 9306 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") + 9307 (write _test-input-stream "}\n") + 9308 # convert + 9309 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9310 # registers except esp clobbered at this point + 9311 # restore ed + 9312 89/<- %edx 4/r32/esp + 9313 (flush _test-output-buffered-file) + 9314 (flush _test-error-buffered-file) + 9315 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9321 # check output + 9322 (check-stream-equal _test-output-stream "" "F - test-index-with-non-array-compound-base-type: output should be empty") + 9323 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: var 'a' is not an array" "F - test-index-with-non-array-compound-base-type: error message") + 9324 # check that stop(1) was called + 9325 (check-ints-equal *(edx+4) 2 "F - test-index-with-non-array-compound-base-type: exit status") + 9326 # don't restore from ebp + 9327 81 0/subop/add %esp 8/imm32 + 9328 # . epilogue + 9329 5d/pop-to-ebp + 9330 c3/return + 9331 + 9332 test-index-with-non-array-compound-base-type-2: + 9333 # . prologue + 9334 55/push-ebp + 9335 89/<- %ebp 4/r32/esp + 9336 # setup + 9337 (clear-stream _test-input-stream) + 9338 (clear-stream $_test-input-buffered-file->buffer) + 9339 (clear-stream _test-output-stream) + 9340 (clear-stream $_test-output-buffered-file->buffer) + 9341 (clear-stream _test-error-stream) + 9342 (clear-stream $_test-error-buffered-file->buffer) + 9343 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9344 68/push 0/imm32 + 9345 68/push 0/imm32 + 9346 89/<- %edx 4/r32/esp + 9347 (tailor-exit-descriptor %edx 0x10) + 9348 # + 9349 (write _test-input-stream "fn foo {\n") + 9350 (write _test-input-stream " var a: (addr int)\n") + 9351 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") + 9352 (write _test-input-stream "}\n") + 9353 # convert + 9354 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9355 # registers except esp clobbered at this point + 9356 # restore ed + 9357 89/<- %edx 4/r32/esp + 9358 (flush _test-output-buffered-file) + 9359 (flush _test-error-buffered-file) + 9360 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9366 # check output + 9367 (check-stream-equal _test-output-stream "" "F - test-index-with-non-array-compound-base-type-2: output should be empty") + 9368 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: var 'a' is not an array" "F - test-index-with-non-array-compound-base-type-2: error message") + 9369 # check that stop(1) was called + 9370 (check-ints-equal *(edx+4) 2 "F - test-index-with-non-array-compound-base-type-2: exit status") + 9371 # don't restore from ebp + 9372 81 0/subop/add %esp 8/imm32 + 9373 # . epilogue + 9374 5d/pop-to-ebp + 9375 c3/return + 9376 + 9377 test-index-with-array-atom-base-type: + 9378 # . prologue + 9379 55/push-ebp + 9380 89/<- %ebp 4/r32/esp + 9381 # setup + 9382 (clear-stream _test-input-stream) + 9383 (clear-stream $_test-input-buffered-file->buffer) + 9384 (clear-stream _test-output-stream) + 9385 (clear-stream $_test-output-buffered-file->buffer) + 9386 (clear-stream _test-error-stream) + 9387 (clear-stream $_test-error-buffered-file->buffer) + 9388 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9389 68/push 0/imm32 + 9390 68/push 0/imm32 + 9391 89/<- %edx 4/r32/esp + 9392 (tailor-exit-descriptor %edx 0x10) + 9393 # + 9394 (write _test-input-stream "fn foo {\n") + 9395 (write _test-input-stream " var a: array\n") + 9396 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") + 9397 (write _test-input-stream "}\n") + 9398 # convert + 9399 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9400 # registers except esp clobbered at this point + 9401 # restore ed + 9402 89/<- %edx 4/r32/esp + 9403 (flush _test-output-buffered-file) + 9404 (flush _test-error-buffered-file) + 9405 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9411 # check output + 9412 (check-stream-equal _test-output-stream "" "F - test-index-with-array-atom-base-type: output should be empty") + 9413 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: array 'a' must specify the type of its elements" "F - test-index-with-array-atom-base-type: error message") + 9414 # check that stop(1) was called + 9415 (check-ints-equal *(edx+4) 2 "F - test-index-with-array-atom-base-type: exit status") + 9416 # don't restore from ebp + 9417 81 0/subop/add %esp 8/imm32 + 9418 # . epilogue + 9419 5d/pop-to-ebp + 9420 c3/return + 9421 + 9422 test-index-with-addr-base-on-stack: + 9423 # . prologue + 9424 55/push-ebp + 9425 89/<- %ebp 4/r32/esp + 9426 # setup + 9427 (clear-stream _test-input-stream) + 9428 (clear-stream $_test-input-buffered-file->buffer) + 9429 (clear-stream _test-output-stream) + 9430 (clear-stream $_test-output-buffered-file->buffer) + 9431 (clear-stream _test-error-stream) + 9432 (clear-stream $_test-error-buffered-file->buffer) + 9433 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9434 68/push 0/imm32 + 9435 68/push 0/imm32 + 9436 89/<- %edx 4/r32/esp + 9437 (tailor-exit-descriptor %edx 0x10) + 9438 # + 9439 (write _test-input-stream "fn foo {\n") + 9440 (write _test-input-stream " var a: (addr array int)\n") + 9441 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0\n") + 9442 (write _test-input-stream "}\n") + 9443 # convert + 9444 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9445 # registers except esp clobbered at this point + 9446 # restore ed + 9447 89/<- %edx 4/r32/esp + 9448 (flush _test-output-buffered-file) + 9449 (flush _test-error-buffered-file) + 9450 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9456 # check output + 9457 (check-stream-equal _test-output-stream "" "F - test-index-with-addr-base-on-stack: output should be empty") + 9458 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: var 'a' is an addr to an array, and so must live in a register" "F - test-index-with-addr-base-on-stack: error message") + 9459 # check that stop(1) was called + 9460 (check-ints-equal *(edx+4) 2 "F - test-index-with-addr-base-on-stack: exit status") + 9461 # don't restore from ebp + 9462 81 0/subop/add %esp 8/imm32 + 9463 # . epilogue + 9464 5d/pop-to-ebp + 9465 c3/return + 9466 + 9467 test-index-with-wrong-index-type: + 9468 # . prologue + 9469 55/push-ebp + 9470 89/<- %ebp 4/r32/esp + 9471 # setup + 9472 (clear-stream _test-input-stream) + 9473 (clear-stream $_test-input-buffered-file->buffer) + 9474 (clear-stream _test-output-stream) + 9475 (clear-stream $_test-output-buffered-file->buffer) + 9476 (clear-stream _test-error-stream) + 9477 (clear-stream $_test-error-buffered-file->buffer) + 9478 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9479 68/push 0/imm32 + 9480 68/push 0/imm32 + 9481 89/<- %edx 4/r32/esp + 9482 (tailor-exit-descriptor %edx 0x10) + 9483 # + 9484 (write _test-input-stream "fn foo {\n") + 9485 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") + 9486 (write _test-input-stream " var b: boolean\n") + 9487 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") + 9488 (write _test-input-stream "}\n") + 9489 # convert + 9490 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9491 # registers except esp clobbered at this point + 9492 # restore ed + 9493 89/<- %edx 4/r32/esp + 9494 (flush _test-output-buffered-file) + 9495 (flush _test-error-buffered-file) + 9496 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9502 # check output + 9503 (check-stream-equal _test-output-stream "" "F - test-index-with-wrong-index-type: output should be empty") + 9504 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: second argument 'b' must be an int or offset" "F - test-index-with-wrong-index-type: error message") + 9505 # check that stop(1) was called + 9506 (check-ints-equal *(edx+4) 2 "F - test-index-with-wrong-index-type: exit status") + 9507 # don't restore from ebp + 9508 81 0/subop/add %esp 8/imm32 + 9509 # . epilogue + 9510 5d/pop-to-ebp + 9511 c3/return + 9512 + 9513 test-index-with-offset-atom-index-type: + 9514 # . prologue + 9515 55/push-ebp + 9516 89/<- %ebp 4/r32/esp + 9517 # setup + 9518 (clear-stream _test-input-stream) + 9519 (clear-stream $_test-input-buffered-file->buffer) + 9520 (clear-stream _test-output-stream) + 9521 (clear-stream $_test-output-buffered-file->buffer) + 9522 (clear-stream _test-error-stream) + 9523 (clear-stream $_test-error-buffered-file->buffer) + 9524 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9525 68/push 0/imm32 + 9526 68/push 0/imm32 + 9527 89/<- %edx 4/r32/esp + 9528 (tailor-exit-descriptor %edx 0x10) + 9529 # + 9530 (write _test-input-stream "fn foo {\n") + 9531 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") + 9532 (write _test-input-stream " var b: offset\n") + 9533 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") + 9534 (write _test-input-stream "}\n") + 9535 # convert + 9536 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9537 # registers except esp clobbered at this point + 9538 # restore ed + 9539 89/<- %edx 4/r32/esp + 9540 (flush _test-output-buffered-file) + 9541 (flush _test-error-buffered-file) + 9542 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9548 # check output + 9549 (check-stream-equal _test-output-stream "" "F - test-index-with-offset-atom-index-type: output should be empty") + 9550 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: offset 'b' must specify the type of array elements" "F - test-index-with-offset-atom-index-type: error message") + 9551 # check that stop(1) was called + 9552 (check-ints-equal *(edx+4) 2 "F - test-index-with-offset-atom-index-type: exit status") + 9553 # don't restore from ebp + 9554 81 0/subop/add %esp 8/imm32 + 9555 # . epilogue + 9556 5d/pop-to-ebp + 9557 c3/return + 9558 + 9559 test-index-with-offset-on-stack: + 9560 # . prologue + 9561 55/push-ebp + 9562 89/<- %ebp 4/r32/esp + 9563 # setup + 9564 (clear-stream _test-input-stream) + 9565 (clear-stream $_test-input-buffered-file->buffer) + 9566 (clear-stream _test-output-stream) + 9567 (clear-stream $_test-output-buffered-file->buffer) + 9568 (clear-stream _test-error-stream) + 9569 (clear-stream $_test-error-buffered-file->buffer) + 9570 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9571 68/push 0/imm32 + 9572 68/push 0/imm32 + 9573 89/<- %edx 4/r32/esp + 9574 (tailor-exit-descriptor %edx 0x10) + 9575 # + 9576 (write _test-input-stream "fn foo {\n") + 9577 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") + 9578 (write _test-input-stream " var b: int\n") + 9579 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") + 9580 (write _test-input-stream "}\n") + 9581 # convert + 9582 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9583 # registers except esp clobbered at this point + 9584 # restore ed + 9585 89/<- %edx 4/r32/esp + 9586 (flush _test-output-buffered-file) + 9587 (flush _test-error-buffered-file) + 9588 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9594 # check output + 9595 (check-stream-equal _test-output-stream "" "F - test-index-with-offset-on-stack: output should be empty") + 9596 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: second argument 'b' must be in a register" "F - test-index-with-offset-on-stack: error message") + 9597 # check that stop(1) was called + 9598 (check-ints-equal *(edx+4) 2 "F - test-index-with-offset-on-stack: exit status") + 9599 # don't restore from ebp + 9600 81 0/subop/add %esp 8/imm32 + 9601 # . epilogue + 9602 5d/pop-to-ebp + 9603 c3/return + 9604 + 9605 test-index-needs-offset-type: + 9606 # . prologue + 9607 55/push-ebp + 9608 89/<- %ebp 4/r32/esp + 9609 # setup + 9610 (clear-stream _test-input-stream) + 9611 (clear-stream $_test-input-buffered-file->buffer) + 9612 (clear-stream _test-output-stream) + 9613 (clear-stream $_test-output-buffered-file->buffer) + 9614 (clear-stream _test-error-stream) + 9615 (clear-stream $_test-error-buffered-file->buffer) + 9616 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9617 68/push 0/imm32 + 9618 68/push 0/imm32 + 9619 89/<- %edx 4/r32/esp + 9620 (tailor-exit-descriptor %edx 0x10) + 9621 # + 9622 (write _test-input-stream "fn foo {\n") + 9623 (write _test-input-stream " var a/eax: (addr array t) <- copy 0\n") + 9624 (write _test-input-stream " var b/ebx: int <- copy 0\n") + 9625 (write _test-input-stream " var c/ecx: (addr int) <- index a, b\n") + 9626 (write _test-input-stream "}\n") + 9627 (write _test-input-stream "type t {\n") # size 12 is not a power of two + 9628 (write _test-input-stream " x: int\n") + 9629 (write _test-input-stream " y: int\n") + 9630 (write _test-input-stream " z: int\n") + 9631 (write _test-input-stream "}\n") + 9632 # convert + 9633 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9634 # registers except esp clobbered at this point + 9635 # restore ed + 9636 89/<- %edx 4/r32/esp + 9637 (flush _test-output-buffered-file) + 9638 (flush _test-error-buffered-file) + 9639 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9645 # check output + 9646 (check-stream-equal _test-output-stream "" "F - test-index-needs-offset-type: output should be empty") + 9647 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: cannot take an int for array 'a'; create an offset instead. See mu.md for details." "F - test-index-needs-offset-type: error message") + 9648 # check that stop(1) was called + 9649 (check-ints-equal *(edx+4) 2 "F - test-index-needs-offset-type: exit status") + 9650 # don't restore from ebp + 9651 81 0/subop/add %esp 8/imm32 + 9652 # . epilogue + 9653 5d/pop-to-ebp + 9654 c3/return + 9655 + 9656 test-index-with-output-not-address: + 9657 # . prologue + 9658 55/push-ebp + 9659 89/<- %ebp 4/r32/esp + 9660 # setup + 9661 (clear-stream _test-input-stream) + 9662 (clear-stream $_test-input-buffered-file->buffer) + 9663 (clear-stream _test-output-stream) + 9664 (clear-stream $_test-output-buffered-file->buffer) + 9665 (clear-stream _test-error-stream) + 9666 (clear-stream $_test-error-buffered-file->buffer) + 9667 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9668 68/push 0/imm32 + 9669 68/push 0/imm32 + 9670 89/<- %edx 4/r32/esp + 9671 (tailor-exit-descriptor %edx 0x10) + 9672 # + 9673 (write _test-input-stream "fn foo {\n") + 9674 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") + 9675 (write _test-input-stream " var o/edi: int <- index a, 0\n") + 9676 (write _test-input-stream "}\n") + 9677 # convert + 9678 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9679 # registers except esp clobbered at this point + 9680 # restore ed + 9681 89/<- %edx 4/r32/esp + 9682 (flush _test-output-buffered-file) + 9683 (flush _test-error-buffered-file) + 9684 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9690 # check output + 9691 (check-stream-equal _test-output-stream "" "F - test-index-with-output-not-address: output should be empty") + 9692 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: output 'o' must be an addr" "F - test-index-with-output-not-address: error message") + 9693 # check that stop(1) was called + 9694 (check-ints-equal *(edx+4) 2 "F - test-index-with-output-not-address: exit status") + 9695 # don't restore from ebp + 9696 81 0/subop/add %esp 8/imm32 + 9697 # . epilogue + 9698 5d/pop-to-ebp + 9699 c3/return + 9700 + 9701 test-index-with-output-not-address-2: + 9702 # . prologue + 9703 55/push-ebp + 9704 89/<- %ebp 4/r32/esp + 9705 # setup + 9706 (clear-stream _test-input-stream) + 9707 (clear-stream $_test-input-buffered-file->buffer) + 9708 (clear-stream _test-output-stream) + 9709 (clear-stream $_test-output-buffered-file->buffer) + 9710 (clear-stream _test-error-stream) + 9711 (clear-stream $_test-error-buffered-file->buffer) + 9712 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9713 68/push 0/imm32 + 9714 68/push 0/imm32 + 9715 89/<- %edx 4/r32/esp + 9716 (tailor-exit-descriptor %edx 0x10) + 9717 # + 9718 (write _test-input-stream "fn foo {\n") + 9719 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") + 9720 (write _test-input-stream " var o/edi: (int) <- index a, 0\n") + 9721 (write _test-input-stream "}\n") + 9722 # convert + 9723 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9724 # registers except esp clobbered at this point + 9725 # restore ed + 9726 89/<- %edx 4/r32/esp + 9727 (flush _test-output-buffered-file) + 9728 (flush _test-error-buffered-file) + 9729 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9735 # check output + 9736 (check-stream-equal _test-output-stream "" "F - test-index-with-output-not-address-2: output should be empty") + 9737 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: output 'o' must be an addr" "F - test-index-with-output-not-address-2: error message") + 9738 # check that stop(1) was called + 9739 (check-ints-equal *(edx+4) 2 "F - test-index-with-output-not-address-2: exit status") + 9740 # don't restore from ebp + 9741 81 0/subop/add %esp 8/imm32 + 9742 # . epilogue + 9743 5d/pop-to-ebp + 9744 c3/return + 9745 + 9746 test-index-with-wrong-output-type: + 9747 # . prologue + 9748 55/push-ebp + 9749 89/<- %ebp 4/r32/esp + 9750 # setup + 9751 (clear-stream _test-input-stream) + 9752 (clear-stream $_test-input-buffered-file->buffer) + 9753 (clear-stream _test-output-stream) + 9754 (clear-stream $_test-output-buffered-file->buffer) + 9755 (clear-stream _test-error-stream) + 9756 (clear-stream $_test-error-buffered-file->buffer) + 9757 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9758 68/push 0/imm32 + 9759 68/push 0/imm32 + 9760 89/<- %edx 4/r32/esp + 9761 (tailor-exit-descriptor %edx 0x10) + 9762 # + 9763 (write _test-input-stream "fn foo {\n") + 9764 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") + 9765 (write _test-input-stream " var o/edi: (addr int) <- index a, 0\n") + 9766 (write _test-input-stream "}\n") + 9767 # convert + 9768 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9769 # registers except esp clobbered at this point + 9770 # restore ed + 9771 89/<- %edx 4/r32/esp + 9772 (flush _test-output-buffered-file) + 9773 (flush _test-error-buffered-file) + 9774 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9780 # check output + 9781 (check-stream-equal _test-output-stream "" "F - test-index-with-wrong-output-type: output should be empty") + 9782 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: output 'o' does not have the right type" "F - test-index-with-wrong-output-type: error message") + 9783 # check that stop(1) was called + 9784 (check-ints-equal *(edx+4) 2 "F - test-index-with-wrong-output-type: exit status") + 9785 # don't restore from ebp + 9786 81 0/subop/add %esp 8/imm32 + 9787 # . epilogue + 9788 5d/pop-to-ebp + 9789 c3/return + 9790 + 9791 test-index-with-wrong-output-compound-type: + 9792 # . prologue + 9793 55/push-ebp + 9794 89/<- %ebp 4/r32/esp + 9795 # setup + 9796 (clear-stream _test-input-stream) + 9797 (clear-stream $_test-input-buffered-file->buffer) + 9798 (clear-stream _test-output-stream) + 9799 (clear-stream $_test-output-buffered-file->buffer) + 9800 (clear-stream _test-error-stream) + 9801 (clear-stream $_test-error-buffered-file->buffer) + 9802 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9803 68/push 0/imm32 + 9804 68/push 0/imm32 + 9805 89/<- %edx 4/r32/esp + 9806 (tailor-exit-descriptor %edx 0x10) + 9807 # + 9808 (write _test-input-stream "fn foo {\n") + 9809 (write _test-input-stream " var a/ebx: (addr array handle boolean) <- copy 0\n") + 9810 (write _test-input-stream " var o/edi: (addr handle int) <- index a, 0\n") + 9811 (write _test-input-stream "}\n") + 9812 # convert + 9813 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9814 # registers except esp clobbered at this point + 9815 # restore ed + 9816 89/<- %edx 4/r32/esp + 9817 (flush _test-output-buffered-file) + 9818 (flush _test-error-buffered-file) + 9819 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9825 # check output + 9826 (check-stream-equal _test-output-stream "" "F - test-index-with-wrong-output-compound-type: output should be empty") + 9827 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: output 'o' does not have the right type" "F - test-index-with-wrong-output-compound-type: error message") + 9828 # check that stop(1) was called + 9829 (check-ints-equal *(edx+4) 2 "F - test-index-with-wrong-output-compound-type: exit status") + 9830 # don't restore from ebp + 9831 81 0/subop/add %esp 8/imm32 + 9832 # . epilogue + 9833 5d/pop-to-ebp + 9834 c3/return + 9835 + 9836 test-index-with-no-inouts: + 9837 # . prologue + 9838 55/push-ebp + 9839 89/<- %ebp 4/r32/esp + 9840 # setup + 9841 (clear-stream _test-input-stream) + 9842 (clear-stream $_test-input-buffered-file->buffer) + 9843 (clear-stream _test-output-stream) + 9844 (clear-stream $_test-output-buffered-file->buffer) + 9845 (clear-stream _test-error-stream) + 9846 (clear-stream $_test-error-buffered-file->buffer) + 9847 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9848 68/push 0/imm32 + 9849 68/push 0/imm32 + 9850 89/<- %edx 4/r32/esp + 9851 (tailor-exit-descriptor %edx 0x10) + 9852 # + 9853 (write _test-input-stream "fn foo {\n") + 9854 (write _test-input-stream " var c/ecx: (addr int) <- index\n") + 9855 (write _test-input-stream "}\n") + 9856 # convert + 9857 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9858 # registers except esp clobbered at this point + 9859 # restore ed + 9860 89/<- %edx 4/r32/esp + 9861 (flush _test-output-buffered-file) + 9862 (flush _test-error-buffered-file) + 9863 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9869 # check output + 9870 (check-stream-equal _test-output-stream "" "F - test-index-with-no-inouts: output should be empty") + 9871 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: too few inouts (2 required)" "F - test-index-with-no-inouts: error message") + 9872 # check that stop(1) was called + 9873 (check-ints-equal *(edx+4) 2 "F - test-index-with-no-inouts: exit status") + 9874 # don't restore from ebp + 9875 81 0/subop/add %esp 8/imm32 + 9876 # . epilogue + 9877 5d/pop-to-ebp + 9878 c3/return + 9879 + 9880 test-index-with-too-few-inouts: + 9881 # . prologue + 9882 55/push-ebp + 9883 89/<- %ebp 4/r32/esp + 9884 # setup + 9885 (clear-stream _test-input-stream) + 9886 (clear-stream $_test-input-buffered-file->buffer) + 9887 (clear-stream _test-output-stream) + 9888 (clear-stream $_test-output-buffered-file->buffer) + 9889 (clear-stream _test-error-stream) + 9890 (clear-stream $_test-error-buffered-file->buffer) + 9891 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9892 68/push 0/imm32 + 9893 68/push 0/imm32 + 9894 89/<- %edx 4/r32/esp + 9895 (tailor-exit-descriptor %edx 0x10) + 9896 # + 9897 (write _test-input-stream "fn foo {\n") + 9898 (write _test-input-stream " var a: (array int 3)\n") + 9899 (write _test-input-stream " var c/ecx: (addr int) <- index a\n") + 9900 (write _test-input-stream "}\n") + 9901 # convert + 9902 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9903 # registers except esp clobbered at this point + 9904 # restore ed + 9905 89/<- %edx 4/r32/esp + 9906 (flush _test-output-buffered-file) + 9907 (flush _test-error-buffered-file) + 9908 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9914 # check output + 9915 (check-stream-equal _test-output-stream "" "F - test-index-with-too-few-inouts: output should be empty") + 9916 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: too few inouts (2 required)" "F - test-index-with-too-few-inouts: error message") + 9917 # check that stop(1) was called + 9918 (check-ints-equal *(edx+4) 2 "F - test-index-with-too-few-inouts: exit status") + 9919 # don't restore from ebp + 9920 81 0/subop/add %esp 8/imm32 + 9921 # . epilogue + 9922 5d/pop-to-ebp + 9923 c3/return + 9924 + 9925 test-index-with-too-many-inouts: + 9926 # . prologue + 9927 55/push-ebp + 9928 89/<- %ebp 4/r32/esp + 9929 # setup + 9930 (clear-stream _test-input-stream) + 9931 (clear-stream $_test-input-buffered-file->buffer) + 9932 (clear-stream _test-output-stream) + 9933 (clear-stream $_test-output-buffered-file->buffer) + 9934 (clear-stream _test-error-stream) + 9935 (clear-stream $_test-error-buffered-file->buffer) + 9936 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9937 68/push 0/imm32 + 9938 68/push 0/imm32 + 9939 89/<- %edx 4/r32/esp + 9940 (tailor-exit-descriptor %edx 0x10) + 9941 # + 9942 (write _test-input-stream "fn foo {\n") + 9943 (write _test-input-stream " var a: (array int 3)\n") + 9944 (write _test-input-stream " var c/ecx: (addr int) <- index a, 0, 0\n") + 9945 (write _test-input-stream "}\n") + 9946 # convert + 9947 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9948 # registers except esp clobbered at this point + 9949 # restore ed + 9950 89/<- %edx 4/r32/esp + 9951 (flush _test-output-buffered-file) + 9952 (flush _test-error-buffered-file) + 9953 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 9959 # check output + 9960 (check-stream-equal _test-output-stream "" "F - test-index-with-too-many-inouts: output should be empty") + 9961 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: too many inouts (2 required)" "F - test-index-with-too-many-inouts: error message") + 9962 # check that stop(1) was called + 9963 (check-ints-equal *(edx+4) 2 "F - test-index-with-too-many-inouts: exit status") + 9964 # don't restore from ebp + 9965 81 0/subop/add %esp 8/imm32 + 9966 # . epilogue + 9967 5d/pop-to-ebp + 9968 c3/return + 9969 + 9970 test-index-with-no-output: + 9971 # . prologue + 9972 55/push-ebp + 9973 89/<- %ebp 4/r32/esp + 9974 # setup + 9975 (clear-stream _test-input-stream) + 9976 (clear-stream $_test-input-buffered-file->buffer) + 9977 (clear-stream _test-output-stream) + 9978 (clear-stream $_test-output-buffered-file->buffer) + 9979 (clear-stream _test-error-stream) + 9980 (clear-stream $_test-error-buffered-file->buffer) + 9981 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) + 9982 68/push 0/imm32 + 9983 68/push 0/imm32 + 9984 89/<- %edx 4/r32/esp + 9985 (tailor-exit-descriptor %edx 0x10) + 9986 # + 9987 (write _test-input-stream "fn foo {\n") + 9988 (write _test-input-stream " var a: (array int 3)\n") + 9989 (write _test-input-stream " index a, 0\n") + 9990 (write _test-input-stream "}\n") + 9991 # convert + 9992 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) + 9993 # registers except esp clobbered at this point + 9994 # restore ed + 9995 89/<- %edx 4/r32/esp + 9996 (flush _test-output-buffered-file) + 9997 (flush _test-error-buffered-file) + 9998 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10004 # check output +10005 (check-stream-equal _test-output-stream "" "F - test-index-with-no-output: output should be empty") +10006 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: must have an output" "F - test-index-with-no-output: error message") +10007 # check that stop(1) was called +10008 (check-ints-equal *(edx+4) 2 "F - test-index-with-no-output: exit status") +10009 # don't restore from ebp +10010 81 0/subop/add %esp 8/imm32 +10011 # . epilogue +10012 5d/pop-to-ebp +10013 c3/return +10014 +10015 test-index-with-too-many-outputs: +10016 # . prologue +10017 55/push-ebp +10018 89/<- %ebp 4/r32/esp +10019 # setup +10020 (clear-stream _test-input-stream) +10021 (clear-stream $_test-input-buffered-file->buffer) +10022 (clear-stream _test-output-stream) +10023 (clear-stream $_test-output-buffered-file->buffer) +10024 (clear-stream _test-error-stream) +10025 (clear-stream $_test-error-buffered-file->buffer) +10026 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10027 68/push 0/imm32 +10028 68/push 0/imm32 +10029 89/<- %edx 4/r32/esp +10030 (tailor-exit-descriptor %edx 0x10) +10031 # +10032 (write _test-input-stream "fn foo {\n") +10033 (write _test-input-stream " var a: (array int 3)\n") +10034 (write _test-input-stream " var b/eax: (addr int) <- copy 0\n") +10035 (write _test-input-stream " var c/ecx: (addr int) <- copy 0\n") +10036 (write _test-input-stream " b, c <- index a, 0\n") +10037 (write _test-input-stream "}\n") +10038 # convert +10039 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10040 # registers except esp clobbered at this point +10041 # restore ed +10042 89/<- %edx 4/r32/esp +10043 (flush _test-output-buffered-file) +10044 (flush _test-error-buffered-file) +10045 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10051 # check output +10052 (check-stream-equal _test-output-stream "" "F - test-index-with-too-many-outputs: output should be empty") +10053 (check-next-stream-line-equal _test-error-stream "fn foo: stmt index: too many outputs (1 required)" "F - test-index-with-too-many-outputs: error message") +10054 # check that stop(1) was called +10055 (check-ints-equal *(edx+4) 2 "F - test-index-with-too-many-outputs: exit status") +10056 # don't restore from ebp +10057 81 0/subop/add %esp 8/imm32 +10058 # . epilogue +10059 5d/pop-to-ebp +10060 c3/return +10061 +10062 test-compute-offset-with-non-array-atom-base-type: +10063 # . prologue +10064 55/push-ebp +10065 89/<- %ebp 4/r32/esp +10066 # setup +10067 (clear-stream _test-input-stream) +10068 (clear-stream $_test-input-buffered-file->buffer) +10069 (clear-stream _test-output-stream) +10070 (clear-stream $_test-output-buffered-file->buffer) +10071 (clear-stream _test-error-stream) +10072 (clear-stream $_test-error-buffered-file->buffer) +10073 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10074 68/push 0/imm32 +10075 68/push 0/imm32 +10076 89/<- %edx 4/r32/esp +10077 (tailor-exit-descriptor %edx 0x10) +10078 # +10079 (write _test-input-stream "fn foo {\n") +10080 (write _test-input-stream " var a: int\n") +10081 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") +10082 (write _test-input-stream "}\n") +10083 # convert +10084 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10085 # registers except esp clobbered at this point +10086 # restore ed +10087 89/<- %edx 4/r32/esp +10088 (flush _test-output-buffered-file) +10089 (flush _test-error-buffered-file) +10090 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10096 # check output +10097 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-non-array-atom-base-type: output should be empty") +10098 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: var 'a' is not an array" "F - test-compute-offset-with-non-array-atom-base-type: error message") +10099 # check that stop(1) was called +10100 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-non-array-atom-base-type: exit status") +10101 # don't restore from ebp +10102 81 0/subop/add %esp 8/imm32 +10103 # . epilogue +10104 5d/pop-to-ebp +10105 c3/return +10106 +10107 test-compute-offset-with-non-array-compound-base-type: +10108 # . prologue +10109 55/push-ebp +10110 89/<- %ebp 4/r32/esp +10111 # setup +10112 (clear-stream _test-input-stream) +10113 (clear-stream $_test-input-buffered-file->buffer) +10114 (clear-stream _test-output-stream) +10115 (clear-stream $_test-output-buffered-file->buffer) +10116 (clear-stream _test-error-stream) +10117 (clear-stream $_test-error-buffered-file->buffer) +10118 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10119 68/push 0/imm32 +10120 68/push 0/imm32 +10121 89/<- %edx 4/r32/esp +10122 (tailor-exit-descriptor %edx 0x10) +10123 # +10124 (write _test-input-stream "fn foo {\n") +10125 (write _test-input-stream " var a: (handle int)\n") +10126 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") +10127 (write _test-input-stream "}\n") +10128 # convert +10129 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10130 # registers except esp clobbered at this point +10131 # restore ed +10132 89/<- %edx 4/r32/esp +10133 (flush _test-output-buffered-file) +10134 (flush _test-error-buffered-file) +10135 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10141 # check output +10142 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-non-array-compound-base-type: output should be empty") +10143 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: var 'a' is not an array" "F - test-compute-offset-with-non-array-compound-base-type: error message") +10144 # check that stop(1) was called +10145 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-non-array-compound-base-type: exit status") +10146 # don't restore from ebp +10147 81 0/subop/add %esp 8/imm32 +10148 # . epilogue +10149 5d/pop-to-ebp +10150 c3/return +10151 +10152 test-compute-offset-with-non-array-compound-base-type-2: +10153 # . prologue +10154 55/push-ebp +10155 89/<- %ebp 4/r32/esp +10156 # setup +10157 (clear-stream _test-input-stream) +10158 (clear-stream $_test-input-buffered-file->buffer) +10159 (clear-stream _test-output-stream) +10160 (clear-stream $_test-output-buffered-file->buffer) +10161 (clear-stream _test-error-stream) +10162 (clear-stream $_test-error-buffered-file->buffer) +10163 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10164 68/push 0/imm32 +10165 68/push 0/imm32 +10166 89/<- %edx 4/r32/esp +10167 (tailor-exit-descriptor %edx 0x10) +10168 # +10169 (write _test-input-stream "fn foo {\n") +10170 (write _test-input-stream " var a: (addr int)\n") +10171 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") +10172 (write _test-input-stream "}\n") +10173 # convert +10174 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10175 # registers except esp clobbered at this point +10176 # restore ed +10177 89/<- %edx 4/r32/esp +10178 (flush _test-output-buffered-file) +10179 (flush _test-error-buffered-file) +10180 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10186 # check output +10187 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-non-array-compound-base-type-2: output should be empty") +10188 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: var 'a' is not an array" "F - test-compute-offset-with-non-array-compound-base-type-2: error message") +10189 # check that stop(1) was called +10190 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-non-array-compound-base-type-2: exit status") +10191 # don't restore from ebp +10192 81 0/subop/add %esp 8/imm32 +10193 # . epilogue +10194 5d/pop-to-ebp +10195 c3/return +10196 +10197 test-compute-offset-with-array-atom-base-type: +10198 # . prologue +10199 55/push-ebp +10200 89/<- %ebp 4/r32/esp +10201 # setup +10202 (clear-stream _test-input-stream) +10203 (clear-stream $_test-input-buffered-file->buffer) +10204 (clear-stream _test-output-stream) +10205 (clear-stream $_test-output-buffered-file->buffer) +10206 (clear-stream _test-error-stream) +10207 (clear-stream $_test-error-buffered-file->buffer) +10208 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10209 68/push 0/imm32 +10210 68/push 0/imm32 +10211 89/<- %edx 4/r32/esp +10212 (tailor-exit-descriptor %edx 0x10) +10213 # +10214 (write _test-input-stream "fn foo {\n") +10215 (write _test-input-stream " var a: array\n") +10216 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0\n") +10217 (write _test-input-stream "}\n") +10218 # convert +10219 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10220 # registers except esp clobbered at this point +10221 # restore ed +10222 89/<- %edx 4/r32/esp +10223 (flush _test-output-buffered-file) +10224 (flush _test-error-buffered-file) +10225 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10231 # check output +10232 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-array-atom-base-type: output should be empty") +10233 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: array 'a' must specify the type of its elements" "F - test-compute-offset-with-array-atom-base-type: error message") +10234 # check that stop(1) was called +10235 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-array-atom-base-type: exit status") +10236 # don't restore from ebp +10237 81 0/subop/add %esp 8/imm32 +10238 # . epilogue +10239 5d/pop-to-ebp +10240 c3/return +10241 +10242 test-compute-offset-with-wrong-index-type: +10243 # . prologue +10244 55/push-ebp +10245 89/<- %ebp 4/r32/esp +10246 # setup +10247 (clear-stream _test-input-stream) +10248 (clear-stream $_test-input-buffered-file->buffer) +10249 (clear-stream _test-output-stream) +10250 (clear-stream $_test-output-buffered-file->buffer) +10251 (clear-stream _test-error-stream) +10252 (clear-stream $_test-error-buffered-file->buffer) +10253 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10254 68/push 0/imm32 +10255 68/push 0/imm32 +10256 89/<- %edx 4/r32/esp +10257 (tailor-exit-descriptor %edx 0x10) +10258 # +10259 (write _test-input-stream "fn foo {\n") +10260 (write _test-input-stream " var a/eax: (addr array int) <- copy 0\n") +10261 (write _test-input-stream " var b: boolean\n") +10262 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, b\n") +10263 (write _test-input-stream "}\n") +10264 # convert +10265 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10266 # registers except esp clobbered at this point +10267 # restore ed +10268 89/<- %edx 4/r32/esp +10269 (flush _test-output-buffered-file) +10270 (flush _test-error-buffered-file) +10271 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10277 # check output +10278 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-wrong-index-type: output should be empty") +10279 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: second argument 'b' must be an int" "F - test-compute-offset-with-wrong-index-type: error message") +10280 # check that stop(1) was called +10281 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-wrong-index-type: exit status") +10282 # don't restore from ebp +10283 81 0/subop/add %esp 8/imm32 +10284 # . epilogue +10285 5d/pop-to-ebp +10286 c3/return +10287 +10288 test-compute-offset-with-output-not-offset: +10289 # . prologue +10290 55/push-ebp +10291 89/<- %ebp 4/r32/esp +10292 # setup +10293 (clear-stream _test-input-stream) +10294 (clear-stream $_test-input-buffered-file->buffer) +10295 (clear-stream _test-output-stream) +10296 (clear-stream $_test-output-buffered-file->buffer) +10297 (clear-stream _test-error-stream) +10298 (clear-stream $_test-error-buffered-file->buffer) +10299 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10300 68/push 0/imm32 +10301 68/push 0/imm32 +10302 89/<- %edx 4/r32/esp +10303 (tailor-exit-descriptor %edx 0x10) +10304 # +10305 (write _test-input-stream "fn foo {\n") +10306 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") +10307 (write _test-input-stream " var o/edi: int <- compute-offset a, 0\n") +10308 (write _test-input-stream "}\n") +10309 # convert +10310 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10311 # registers except esp clobbered at this point +10312 # restore ed +10313 89/<- %edx 4/r32/esp +10314 (flush _test-output-buffered-file) +10315 (flush _test-error-buffered-file) +10316 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10322 # check output +10323 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-output-not-offset: output should be empty") +10324 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: output 'o' must be an offset" "F - test-compute-offset-with-output-not-offset: error message") +10325 # check that stop(1) was called +10326 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-output-not-offset: exit status") +10327 # don't restore from ebp +10328 81 0/subop/add %esp 8/imm32 +10329 # . epilogue +10330 5d/pop-to-ebp +10331 c3/return +10332 +10333 test-compute-offset-with-output-not-address-2: +10334 # . prologue +10335 55/push-ebp +10336 89/<- %ebp 4/r32/esp +10337 # setup +10338 (clear-stream _test-input-stream) +10339 (clear-stream $_test-input-buffered-file->buffer) +10340 (clear-stream _test-output-stream) +10341 (clear-stream $_test-output-buffered-file->buffer) +10342 (clear-stream _test-error-stream) +10343 (clear-stream $_test-error-buffered-file->buffer) +10344 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10345 68/push 0/imm32 +10346 68/push 0/imm32 +10347 89/<- %edx 4/r32/esp +10348 (tailor-exit-descriptor %edx 0x10) +10349 # +10350 (write _test-input-stream "fn foo {\n") +10351 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") +10352 (write _test-input-stream " var o/edi: (int) <- compute-offset a, 0\n") +10353 (write _test-input-stream "}\n") +10354 # convert +10355 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10356 # registers except esp clobbered at this point +10357 # restore ed +10358 89/<- %edx 4/r32/esp +10359 (flush _test-output-buffered-file) +10360 (flush _test-error-buffered-file) +10361 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10367 # check output +10368 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-output-not-address-2: output should be empty") +10369 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: output 'o' must be an offset" "F - test-compute-offset-with-output-not-address-2: error message") +10370 # check that stop(1) was called +10371 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-output-not-address-2: exit status") +10372 # don't restore from ebp +10373 81 0/subop/add %esp 8/imm32 +10374 # . epilogue +10375 5d/pop-to-ebp +10376 c3/return +10377 +10378 test-compute-offset-with-wrong-output-type: +10379 # . prologue +10380 55/push-ebp +10381 89/<- %ebp 4/r32/esp +10382 # setup +10383 (clear-stream _test-input-stream) +10384 (clear-stream $_test-input-buffered-file->buffer) +10385 (clear-stream _test-output-stream) +10386 (clear-stream $_test-output-buffered-file->buffer) +10387 (clear-stream _test-error-stream) +10388 (clear-stream $_test-error-buffered-file->buffer) +10389 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10390 68/push 0/imm32 +10391 68/push 0/imm32 +10392 89/<- %edx 4/r32/esp +10393 (tailor-exit-descriptor %edx 0x10) +10394 # +10395 (write _test-input-stream "fn foo {\n") +10396 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") +10397 (write _test-input-stream " var o/edi: (offset int) <- compute-offset a, 0\n") +10398 (write _test-input-stream "}\n") +10399 # convert +10400 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10401 # registers except esp clobbered at this point +10402 # restore ed +10403 89/<- %edx 4/r32/esp +10404 (flush _test-output-buffered-file) +10405 (flush _test-error-buffered-file) +10406 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10412 # check output +10413 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-wrong-output-type: output should be empty") +10414 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: output 'o' does not have the right type" "F - test-compute-offset-with-wrong-output-type: error message") +10415 # check that stop(1) was called +10416 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-wrong-output-type: exit status") +10417 # don't restore from ebp +10418 81 0/subop/add %esp 8/imm32 +10419 # . epilogue +10420 5d/pop-to-ebp +10421 c3/return +10422 +10423 test-compute-offset-with-wrong-output-compound-type: +10424 # . prologue +10425 55/push-ebp +10426 89/<- %ebp 4/r32/esp +10427 # setup +10428 (clear-stream _test-input-stream) +10429 (clear-stream $_test-input-buffered-file->buffer) +10430 (clear-stream _test-output-stream) +10431 (clear-stream $_test-output-buffered-file->buffer) +10432 (clear-stream _test-error-stream) +10433 (clear-stream $_test-error-buffered-file->buffer) +10434 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10435 68/push 0/imm32 +10436 68/push 0/imm32 +10437 89/<- %edx 4/r32/esp +10438 (tailor-exit-descriptor %edx 0x10) +10439 # +10440 (write _test-input-stream "fn foo {\n") +10441 (write _test-input-stream " var a/ebx: (addr array handle boolean) <- copy 0\n") +10442 (write _test-input-stream " var o/edi: (offset handle int) <- compute-offset a, 0\n") +10443 (write _test-input-stream "}\n") +10444 # convert +10445 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10446 # registers except esp clobbered at this point +10447 # restore ed +10448 89/<- %edx 4/r32/esp +10449 (flush _test-output-buffered-file) +10450 (flush _test-error-buffered-file) +10451 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10457 # check output +10458 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-wrong-output-compound-type: output should be empty") +10459 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: output 'o' does not have the right type" "F - test-compute-offset-with-wrong-output-compound-type: error message") +10460 # check that stop(1) was called +10461 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-wrong-output-compound-type: exit status") +10462 # don't restore from ebp +10463 81 0/subop/add %esp 8/imm32 +10464 # . epilogue +10465 5d/pop-to-ebp +10466 c3/return +10467 +10468 test-compute-offset-with-no-inouts: +10469 # . prologue +10470 55/push-ebp +10471 89/<- %ebp 4/r32/esp +10472 # setup +10473 (clear-stream _test-input-stream) +10474 (clear-stream $_test-input-buffered-file->buffer) +10475 (clear-stream _test-output-stream) +10476 (clear-stream $_test-output-buffered-file->buffer) +10477 (clear-stream _test-error-stream) +10478 (clear-stream $_test-error-buffered-file->buffer) +10479 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10480 68/push 0/imm32 +10481 68/push 0/imm32 +10482 89/<- %edx 4/r32/esp +10483 (tailor-exit-descriptor %edx 0x10) +10484 # +10485 (write _test-input-stream "fn foo {\n") +10486 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset\n") +10487 (write _test-input-stream "}\n") +10488 # convert +10489 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10490 # registers except esp clobbered at this point +10491 # restore ed +10492 89/<- %edx 4/r32/esp +10493 (flush _test-output-buffered-file) +10494 (flush _test-error-buffered-file) +10495 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10501 # check output +10502 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-no-inouts: output should be empty") +10503 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: too few inouts (2 required)" "F - test-compute-offset-with-no-inouts: error message") +10504 # check that stop(1) was called +10505 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-no-inouts: exit status") +10506 # don't restore from ebp +10507 81 0/subop/add %esp 8/imm32 +10508 # . epilogue +10509 5d/pop-to-ebp +10510 c3/return +10511 +10512 test-compute-offset-with-too-few-inouts: +10513 # . prologue +10514 55/push-ebp +10515 89/<- %ebp 4/r32/esp +10516 # setup +10517 (clear-stream _test-input-stream) +10518 (clear-stream $_test-input-buffered-file->buffer) +10519 (clear-stream _test-output-stream) +10520 (clear-stream $_test-output-buffered-file->buffer) +10521 (clear-stream _test-error-stream) +10522 (clear-stream $_test-error-buffered-file->buffer) +10523 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10524 68/push 0/imm32 +10525 68/push 0/imm32 +10526 89/<- %edx 4/r32/esp +10527 (tailor-exit-descriptor %edx 0x10) +10528 # +10529 (write _test-input-stream "fn foo {\n") +10530 (write _test-input-stream " var a: (array int 3)\n") +10531 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a\n") +10532 (write _test-input-stream "}\n") +10533 # convert +10534 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10535 # registers except esp clobbered at this point +10536 # restore ed +10537 89/<- %edx 4/r32/esp +10538 (flush _test-output-buffered-file) +10539 (flush _test-error-buffered-file) +10540 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10546 # check output +10547 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-too-few-inouts: output should be empty") +10548 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: too few inouts (2 required)" "F - test-compute-offset-with-too-few-inouts: error message") +10549 # check that stop(1) was called +10550 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-too-few-inouts: exit status") +10551 # don't restore from ebp +10552 81 0/subop/add %esp 8/imm32 +10553 # . epilogue +10554 5d/pop-to-ebp +10555 c3/return +10556 +10557 test-compute-offset-with-too-many-inouts: +10558 # . prologue +10559 55/push-ebp +10560 89/<- %ebp 4/r32/esp +10561 # setup +10562 (clear-stream _test-input-stream) +10563 (clear-stream $_test-input-buffered-file->buffer) +10564 (clear-stream _test-output-stream) +10565 (clear-stream $_test-output-buffered-file->buffer) +10566 (clear-stream _test-error-stream) +10567 (clear-stream $_test-error-buffered-file->buffer) +10568 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10569 68/push 0/imm32 +10570 68/push 0/imm32 +10571 89/<- %edx 4/r32/esp +10572 (tailor-exit-descriptor %edx 0x10) +10573 # +10574 (write _test-input-stream "fn foo {\n") +10575 (write _test-input-stream " var a: (array int 3)\n") +10576 (write _test-input-stream " var c/ecx: (offset int) <- compute-offset a, 0, 0\n") +10577 (write _test-input-stream "}\n") +10578 # convert +10579 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10580 # registers except esp clobbered at this point +10581 # restore ed +10582 89/<- %edx 4/r32/esp +10583 (flush _test-output-buffered-file) +10584 (flush _test-error-buffered-file) +10585 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10591 # check output +10592 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-too-many-inouts: output should be empty") +10593 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: too many inouts (2 required)" "F - test-compute-offset-with-too-many-inouts: error message") +10594 # check that stop(1) was called +10595 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-too-many-inouts: exit status") +10596 # don't restore from ebp +10597 81 0/subop/add %esp 8/imm32 +10598 # . epilogue +10599 5d/pop-to-ebp +10600 c3/return +10601 +10602 test-compute-offset-with-no-output: +10603 # . prologue +10604 55/push-ebp +10605 89/<- %ebp 4/r32/esp +10606 # setup +10607 (clear-stream _test-input-stream) +10608 (clear-stream $_test-input-buffered-file->buffer) +10609 (clear-stream _test-output-stream) +10610 (clear-stream $_test-output-buffered-file->buffer) +10611 (clear-stream _test-error-stream) +10612 (clear-stream $_test-error-buffered-file->buffer) +10613 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10614 68/push 0/imm32 +10615 68/push 0/imm32 +10616 89/<- %edx 4/r32/esp +10617 (tailor-exit-descriptor %edx 0x10) +10618 # +10619 (write _test-input-stream "fn foo {\n") +10620 (write _test-input-stream " var a: (array int 3)\n") +10621 (write _test-input-stream " compute-offset a, 0\n") +10622 (write _test-input-stream "}\n") +10623 # convert +10624 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10625 # registers except esp clobbered at this point +10626 # restore ed +10627 89/<- %edx 4/r32/esp +10628 (flush _test-output-buffered-file) +10629 (flush _test-error-buffered-file) +10630 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10636 # check output +10637 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-no-output: output should be empty") +10638 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: must have an output" "F - test-compute-offset-with-no-output: error message") +10639 # check that stop(1) was called +10640 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-no-output: exit status") +10641 # don't restore from ebp +10642 81 0/subop/add %esp 8/imm32 +10643 # . epilogue +10644 5d/pop-to-ebp +10645 c3/return +10646 +10647 test-compute-offset-with-too-many-outputs: +10648 # . prologue +10649 55/push-ebp +10650 89/<- %ebp 4/r32/esp +10651 # setup +10652 (clear-stream _test-input-stream) +10653 (clear-stream $_test-input-buffered-file->buffer) +10654 (clear-stream _test-output-stream) +10655 (clear-stream $_test-output-buffered-file->buffer) +10656 (clear-stream _test-error-stream) +10657 (clear-stream $_test-error-buffered-file->buffer) +10658 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10659 68/push 0/imm32 +10660 68/push 0/imm32 +10661 89/<- %edx 4/r32/esp +10662 (tailor-exit-descriptor %edx 0x10) +10663 # +10664 (write _test-input-stream "fn foo {\n") +10665 (write _test-input-stream " var a: (array int 3)\n") +10666 (write _test-input-stream " var b/eax: (offset int) <- compute-offset a, 0\n") +10667 (write _test-input-stream " var c/ecx: (addr int) <- copy 0\n") +10668 (write _test-input-stream " b, c <- compute-offset a, 0\n") +10669 (write _test-input-stream "}\n") +10670 # convert +10671 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10672 # registers except esp clobbered at this point +10673 # restore ed +10674 89/<- %edx 4/r32/esp +10675 (flush _test-output-buffered-file) +10676 (flush _test-error-buffered-file) +10677 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10683 # check output +10684 (check-stream-equal _test-output-stream "" "F - test-compute-offset-with-too-many-outputs: output should be empty") +10685 (check-next-stream-line-equal _test-error-stream "fn foo: stmt compute-offset: too many outputs (1 required)" "F - test-compute-offset-with-too-many-outputs: error message") +10686 # check that stop(1) was called +10687 (check-ints-equal *(edx+4) 2 "F - test-compute-offset-with-too-many-outputs: exit status") +10688 # don't restore from ebp +10689 81 0/subop/add %esp 8/imm32 +10690 # . epilogue +10691 5d/pop-to-ebp +10692 c3/return +10693 +10694 test-convert-read-from-stream: +10695 # . prologue +10696 55/push-ebp +10697 89/<- %ebp 4/r32/esp +10698 # setup +10699 (clear-stream _test-input-stream) +10700 (clear-stream $_test-input-buffered-file->buffer) +10701 (clear-stream _test-output-stream) +10702 (clear-stream $_test-output-buffered-file->buffer) +10703 # +10704 (write _test-input-stream "fn foo {\n") +10705 (write _test-input-stream " var s/esi: (addr stream int) <- copy 0\n") +10706 (write _test-input-stream " var o/ecx: (addr int) <- copy 0\n") +10707 (write _test-input-stream " read-from-stream s, o\n") +10708 (write _test-input-stream "}\n") +10709 # convert +10710 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +10711 # registers except esp clobbered at this point +10712 # restore ed +10713 89/<- %edx 4/r32/esp +10714 (flush _test-output-buffered-file) +10715 (flush _test-error-buffered-file) +10716 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10722 # check output +10723 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-read-from-stream/0") +10724 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-read-from-stream/1") +10725 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-read-from-stream/2") +10726 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-read-from-stream/3") +10727 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-read-from-stream/4") +10728 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-read-from-stream/5") +10729 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-read-from-stream/6") +10730 (check-next-stream-line-equal _test-output-stream " be/copy-to-esi 0/imm32" "F - test-convert-read-from-stream/7") +10731 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-read-from-stream/8") +10732 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-read-from-stream/9") +10733 (check-next-stream-line-equal _test-output-stream " (read-from-stream %esi %ecx 0x00000004)" "F - test-convert-read-from-stream/10") +10734 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-read-from-stream/11") +10735 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-read-from-stream/12") +10736 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-read-from-stream/13") +10737 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-read-from-stream/14") +10738 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-read-from-stream/15") +10739 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-read-from-stream/16") +10740 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-read-from-stream/17") +10741 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-read-from-stream/18") +10742 # . epilogue +10743 89/<- %esp 5/r32/ebp +10744 5d/pop-to-ebp +10745 c3/return +10746 +10747 test-convert-read-from-stream-with-correct-payload-size: +10748 # . prologue +10749 55/push-ebp +10750 89/<- %ebp 4/r32/esp +10751 # setup +10752 (clear-stream _test-input-stream) +10753 (clear-stream $_test-input-buffered-file->buffer) +10754 (clear-stream _test-output-stream) +10755 (clear-stream $_test-output-buffered-file->buffer) +10756 # +10757 (write _test-input-stream "fn foo {\n") +10758 (write _test-input-stream " var s/esi: (addr stream handle int) <- copy 0\n") +10759 (write _test-input-stream " var o/ecx: (addr handle int) <- copy 0\n") +10760 (write _test-input-stream " read-from-stream s, o\n") +10761 (write _test-input-stream "}\n") +10762 # convert +10763 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +10764 # registers except esp clobbered at this point +10765 # restore ed +10766 89/<- %edx 4/r32/esp +10767 (flush _test-output-buffered-file) +10768 (flush _test-error-buffered-file) +10769 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10775 # check output +10776 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-read-from-stream-with-correct-payload-size/0") +10777 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-read-from-stream-with-correct-payload-size/1") +10778 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-read-from-stream-with-correct-payload-size/2") +10779 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-read-from-stream-with-correct-payload-size/3") +10780 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-read-from-stream-with-correct-payload-size/4") +10781 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-read-from-stream-with-correct-payload-size/5") +10782 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-read-from-stream-with-correct-payload-size/6") +10783 (check-next-stream-line-equal _test-output-stream " be/copy-to-esi 0/imm32" "F - test-convert-read-from-stream-with-correct-payload-size/7") +10784 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-read-from-stream-with-correct-payload-size/8") +10785 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-read-from-stream-with-correct-payload-size/9") +10786 (check-next-stream-line-equal _test-output-stream " (read-from-stream %esi %ecx 0x00000008)" "F - test-convert-read-from-stream-with-correct-payload-size/10") +10787 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-read-from-stream-with-correct-payload-size/11") +10788 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-read-from-stream-with-correct-payload-size/12") +10789 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-read-from-stream-with-correct-payload-size/13") +10790 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-read-from-stream-with-correct-payload-size/14") +10791 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-read-from-stream-with-correct-payload-size/15") +10792 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-read-from-stream-with-correct-payload-size/16") +10793 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-read-from-stream-with-correct-payload-size/17") +10794 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-read-from-stream-with-correct-payload-size/18") +10795 # . epilogue +10796 89/<- %esp 5/r32/ebp +10797 5d/pop-to-ebp +10798 c3/return +10799 +10800 test-read-from-stream-with-non-stream-atom-base-type: +10801 # . prologue +10802 55/push-ebp +10803 89/<- %ebp 4/r32/esp +10804 # setup +10805 (clear-stream _test-input-stream) +10806 (clear-stream $_test-input-buffered-file->buffer) +10807 (clear-stream _test-output-stream) +10808 (clear-stream $_test-output-buffered-file->buffer) +10809 (clear-stream _test-error-stream) +10810 (clear-stream $_test-error-buffered-file->buffer) +10811 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10812 68/push 0/imm32 +10813 68/push 0/imm32 10814 89/<- %edx 4/r32/esp -10815 (flush _test-output-buffered-file) -10816 (flush _test-error-buffered-file) -10817 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10823 # check output -10824 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-output: output should be empty") -10825 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: unexpected output" "F - test-read-from-stream-with-output: error message") -10826 # check that stop(1) was called -10827 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-output: exit status") -10828 # don't restore from ebp -10829 81 0/subop/add %esp 8/imm32 -10830 # . epilogue -10831 5d/pop-to-ebp -10832 c3/return -10833 -10834 test-convert-write-to-stream: -10835 # . prologue -10836 55/push-ebp -10837 89/<- %ebp 4/r32/esp -10838 # setup -10839 (clear-stream _test-input-stream) -10840 (clear-stream $_test-input-buffered-file->buffer) -10841 (clear-stream _test-output-stream) -10842 (clear-stream $_test-output-buffered-file->buffer) -10843 # -10844 (write _test-input-stream "fn foo {\n") -10845 (write _test-input-stream " var s/esi: (addr stream int) <- copy 0\n") -10846 (write _test-input-stream " var o/ecx: (addr int) <- copy 0\n") -10847 (write _test-input-stream " write-to-stream s, o\n") -10848 (write _test-input-stream "}\n") -10849 # convert -10850 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -10851 # registers except esp clobbered at this point -10852 # restore ed -10853 89/<- %edx 4/r32/esp -10854 (flush _test-output-buffered-file) -10855 (flush _test-error-buffered-file) -10856 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -10862 # check output -10863 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-write-to-stream/0") -10864 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-write-to-stream/1") -10865 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-write-to-stream/2") -10866 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-write-to-stream/3") -10867 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-write-to-stream/4") -10868 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-write-to-stream/5") -10869 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-write-to-stream/6") -10870 (check-next-stream-line-equal _test-output-stream " be/copy-to-esi 0/imm32" "F - test-convert-write-to-stream/7") -10871 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-write-to-stream/8") -10872 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-write-to-stream/9") -10873 (check-next-stream-line-equal _test-output-stream " (write-to-stream %esi %ecx 0x00000004)" "F - test-convert-write-to-stream/10") -10874 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-write-to-stream/11") -10875 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-write-to-stream/12") -10876 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-write-to-stream/13") -10877 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-write-to-stream/14") -10878 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-write-to-stream/15") -10879 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-write-to-stream/16") -10880 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-write-to-stream/17") -10881 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-write-to-stream/18") -10882 # . epilogue -10883 89/<- %esp 5/r32/ebp -10884 5d/pop-to-ebp -10885 c3/return -10886 -10887 test-convert-write-to-stream-with-correct-payload-size: -10888 # . prologue -10889 55/push-ebp -10890 89/<- %ebp 4/r32/esp -10891 # setup -10892 (clear-stream _test-input-stream) -10893 (clear-stream $_test-input-buffered-file->buffer) -10894 (clear-stream _test-output-stream) -10895 (clear-stream $_test-output-buffered-file->buffer) -10896 # -10897 (write _test-input-stream "fn foo {\n") -10898 (write _test-input-stream " var s/esi: (addr stream handle int) <- copy 0\n") -10899 (write _test-input-stream " var o/ecx: (addr handle int) <- copy 0\n") -10900 (write _test-input-stream " write-to-stream s, o\n") -10901 (write _test-input-stream "}\n") -10902 # convert -10903 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -10904 # registers except esp clobbered at this point -10905 # restore ed -10906 89/<- %edx 4/r32/esp -10907 (flush _test-output-buffered-file) -10908 (flush _test-error-buffered-file) -10909 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -10915 # check output -10916 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-write-to-stream-with-correct-payload-size/0") -10917 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-write-to-stream-with-correct-payload-size/1") -10918 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-write-to-stream-with-correct-payload-size/2") -10919 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-write-to-stream-with-correct-payload-size/3") -10920 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-write-to-stream-with-correct-payload-size/4") -10921 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-write-to-stream-with-correct-payload-size/5") -10922 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-write-to-stream-with-correct-payload-size/6") -10923 (check-next-stream-line-equal _test-output-stream " be/copy-to-esi 0/imm32" "F - test-convert-write-to-stream-with-correct-payload-size/7") -10924 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-write-to-stream-with-correct-payload-size/8") -10925 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-write-to-stream-with-correct-payload-size/9") -10926 (check-next-stream-line-equal _test-output-stream " (write-to-stream %esi %ecx 0x00000008)" "F - test-convert-write-to-stream-with-correct-payload-size/10") -10927 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-write-to-stream-with-correct-payload-size/11") -10928 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-write-to-stream-with-correct-payload-size/12") -10929 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-write-to-stream-with-correct-payload-size/13") -10930 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-write-to-stream-with-correct-payload-size/14") -10931 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-write-to-stream-with-correct-payload-size/15") -10932 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-write-to-stream-with-correct-payload-size/16") -10933 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-write-to-stream-with-correct-payload-size/17") -10934 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-write-to-stream-with-correct-payload-size/18") -10935 # . epilogue -10936 89/<- %esp 5/r32/ebp -10937 5d/pop-to-ebp -10938 c3/return -10939 -10940 test-write-to-stream-with-non-stream-atom-base-type: -10941 # . prologue -10942 55/push-ebp -10943 89/<- %ebp 4/r32/esp -10944 # setup -10945 (clear-stream _test-input-stream) -10946 (clear-stream $_test-input-buffered-file->buffer) -10947 (clear-stream _test-output-stream) -10948 (clear-stream $_test-output-buffered-file->buffer) -10949 (clear-stream _test-error-stream) -10950 (clear-stream $_test-error-buffered-file->buffer) -10951 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10952 68/push 0/imm32 -10953 68/push 0/imm32 -10954 89/<- %edx 4/r32/esp -10955 (tailor-exit-descriptor %edx 0x10) -10956 # -10957 (write _test-input-stream "fn foo {\n") -10958 (write _test-input-stream " var a: int\n") -10959 (write _test-input-stream " write-to-stream a, 0\n") -10960 (write _test-input-stream "}\n") -10961 # convert -10962 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -10963 # registers except esp clobbered at this point -10964 # restore ed -10965 89/<- %edx 4/r32/esp -10966 (flush _test-output-buffered-file) -10967 (flush _test-error-buffered-file) -10968 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -10974 # check output -10975 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-non-stream-atom-base-type: output should be empty") -10976 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: var 'a' must be an addr to a stream" "F - test-write-to-stream-with-non-stream-atom-base-type: error message") -10977 # check that stop(1) was called -10978 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-non-stream-atom-base-type: exit status") -10979 # don't restore from ebp -10980 81 0/subop/add %esp 8/imm32 -10981 # . epilogue -10982 5d/pop-to-ebp -10983 c3/return -10984 -10985 test-write-to-stream-with-non-stream-compound-base-type: -10986 # . prologue -10987 55/push-ebp -10988 89/<- %ebp 4/r32/esp -10989 # setup -10990 (clear-stream _test-input-stream) -10991 (clear-stream $_test-input-buffered-file->buffer) -10992 (clear-stream _test-output-stream) -10993 (clear-stream $_test-output-buffered-file->buffer) -10994 (clear-stream _test-error-stream) -10995 (clear-stream $_test-error-buffered-file->buffer) -10996 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -10997 68/push 0/imm32 -10998 68/push 0/imm32 -10999 89/<- %edx 4/r32/esp -11000 (tailor-exit-descriptor %edx 0x10) -11001 # -11002 (write _test-input-stream "fn foo {\n") -11003 (write _test-input-stream " var a: (handle int)\n") -11004 (write _test-input-stream " write-to-stream a, 0\n") -11005 (write _test-input-stream "}\n") -11006 # convert -11007 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11008 # registers except esp clobbered at this point -11009 # restore ed -11010 89/<- %edx 4/r32/esp -11011 (flush _test-output-buffered-file) -11012 (flush _test-error-buffered-file) -11013 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11019 # check output -11020 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-non-stream-compound-base-type: output should be empty") -11021 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: var 'a' must be an addr to a stream" "F - test-write-to-stream-with-non-stream-compound-base-type: error message") -11022 # check that stop(1) was called -11023 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-non-stream-compound-base-type: exit status") -11024 # don't restore from ebp -11025 81 0/subop/add %esp 8/imm32 -11026 # . epilogue -11027 5d/pop-to-ebp -11028 c3/return -11029 -11030 test-write-to-stream-with-non-stream-compound-base-type-2: -11031 # . prologue -11032 55/push-ebp -11033 89/<- %ebp 4/r32/esp -11034 # setup -11035 (clear-stream _test-input-stream) -11036 (clear-stream $_test-input-buffered-file->buffer) -11037 (clear-stream _test-output-stream) -11038 (clear-stream $_test-output-buffered-file->buffer) -11039 (clear-stream _test-error-stream) -11040 (clear-stream $_test-error-buffered-file->buffer) -11041 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11042 68/push 0/imm32 -11043 68/push 0/imm32 -11044 89/<- %edx 4/r32/esp -11045 (tailor-exit-descriptor %edx 0x10) -11046 # -11047 (write _test-input-stream "fn foo {\n") -11048 (write _test-input-stream " var a: (addr int)\n") -11049 (write _test-input-stream " write-to-stream a, 0\n") -11050 (write _test-input-stream "}\n") -11051 # convert -11052 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11053 # registers except esp clobbered at this point -11054 # restore ed -11055 89/<- %edx 4/r32/esp -11056 (flush _test-output-buffered-file) -11057 (flush _test-error-buffered-file) -11058 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11064 # check output -11065 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-non-stream-compound-base-type-2: output should be empty") -11066 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: var 'a' must be an addr to a stream" "F - test-write-to-stream-with-non-stream-compound-base-type-2: error message") -11067 # check that stop(1) was called -11068 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-non-stream-compound-base-type-2: exit status") -11069 # don't restore from ebp -11070 81 0/subop/add %esp 8/imm32 -11071 # . epilogue -11072 5d/pop-to-ebp -11073 c3/return -11074 -11075 test-write-to-stream-with-stream-atom-base-type: -11076 # . prologue -11077 55/push-ebp -11078 89/<- %ebp 4/r32/esp -11079 # setup -11080 (clear-stream _test-input-stream) -11081 (clear-stream $_test-input-buffered-file->buffer) -11082 (clear-stream _test-output-stream) -11083 (clear-stream $_test-output-buffered-file->buffer) -11084 (clear-stream _test-error-stream) -11085 (clear-stream $_test-error-buffered-file->buffer) -11086 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11087 68/push 0/imm32 -11088 68/push 0/imm32 -11089 89/<- %edx 4/r32/esp -11090 (tailor-exit-descriptor %edx 0x10) -11091 # -11092 (write _test-input-stream "fn foo {\n") -11093 (write _test-input-stream " var a: stream\n") -11094 (write _test-input-stream " write-to-stream a, 0\n") -11095 (write _test-input-stream "}\n") -11096 # convert -11097 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11098 # registers except esp clobbered at this point -11099 # restore ed -11100 89/<- %edx 4/r32/esp -11101 (flush _test-output-buffered-file) -11102 (flush _test-error-buffered-file) -11103 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11109 # check output -11110 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-stream-atom-base-type: output should be empty") -11111 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: var 'a' must be an addr to a stream" "F - test-write-to-stream-with-stream-atom-base-type: error message") -11112 # check that stop(1) was called -11113 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-stream-atom-base-type: exit status") -11114 # don't restore from ebp -11115 81 0/subop/add %esp 8/imm32 -11116 # . epilogue -11117 5d/pop-to-ebp -11118 c3/return -11119 -11120 test-write-to-stream-with-wrong-index-type: -11121 # . prologue -11122 55/push-ebp -11123 89/<- %ebp 4/r32/esp -11124 # setup -11125 (clear-stream _test-input-stream) -11126 (clear-stream $_test-input-buffered-file->buffer) -11127 (clear-stream _test-output-stream) -11128 (clear-stream $_test-output-buffered-file->buffer) -11129 (clear-stream _test-error-stream) -11130 (clear-stream $_test-error-buffered-file->buffer) -11131 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11132 68/push 0/imm32 -11133 68/push 0/imm32 -11134 89/<- %edx 4/r32/esp -11135 (tailor-exit-descriptor %edx 0x10) -11136 # -11137 (write _test-input-stream "fn foo {\n") -11138 (write _test-input-stream " var a/eax: (addr stream int) <- copy 0\n") -11139 (write _test-input-stream " var b: boolean\n") -11140 (write _test-input-stream " write-to-stream a, b\n") -11141 (write _test-input-stream "}\n") -11142 # convert -11143 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11144 # registers except esp clobbered at this point -11145 # restore ed -11146 89/<- %edx 4/r32/esp -11147 (flush _test-output-buffered-file) -11148 (flush _test-error-buffered-file) -11149 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11155 # check output -11156 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-wrong-index-type: output should be empty") -11157 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: target 'b' must be an addr" "F - test-write-to-stream-with-wrong-index-type: error message") -11158 # check that stop(1) was called -11159 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-wrong-index-type: exit status") -11160 # don't restore from ebp -11161 81 0/subop/add %esp 8/imm32 -11162 # . epilogue -11163 5d/pop-to-ebp -11164 c3/return -11165 -11166 test-write-to-stream-with-no-inouts: -11167 # . prologue -11168 55/push-ebp -11169 89/<- %ebp 4/r32/esp -11170 # setup -11171 (clear-stream _test-input-stream) -11172 (clear-stream $_test-input-buffered-file->buffer) -11173 (clear-stream _test-output-stream) -11174 (clear-stream $_test-output-buffered-file->buffer) -11175 (clear-stream _test-error-stream) -11176 (clear-stream $_test-error-buffered-file->buffer) -11177 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11178 68/push 0/imm32 -11179 68/push 0/imm32 -11180 89/<- %edx 4/r32/esp -11181 (tailor-exit-descriptor %edx 0x10) -11182 # -11183 (write _test-input-stream "fn foo {\n") -11184 (write _test-input-stream " write-to-stream\n") -11185 (write _test-input-stream "}\n") -11186 # convert -11187 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11188 # registers except esp clobbered at this point -11189 # restore ed -11190 89/<- %edx 4/r32/esp -11191 (flush _test-output-buffered-file) -11192 (flush _test-error-buffered-file) -11193 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11199 # check output -11200 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-no-inouts: output should be empty") -11201 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: too few inouts (2 required)" "F - test-write-to-stream-with-no-inouts: error message") -11202 # check that stop(1) was called -11203 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-no-inouts: exit status") -11204 # don't restore from ebp -11205 81 0/subop/add %esp 8/imm32 -11206 # . epilogue -11207 5d/pop-to-ebp -11208 c3/return -11209 -11210 test-write-to-stream-with-too-few-inouts: -11211 # . prologue -11212 55/push-ebp -11213 89/<- %ebp 4/r32/esp -11214 # setup -11215 (clear-stream _test-input-stream) -11216 (clear-stream $_test-input-buffered-file->buffer) -11217 (clear-stream _test-output-stream) -11218 (clear-stream $_test-output-buffered-file->buffer) -11219 (clear-stream _test-error-stream) -11220 (clear-stream $_test-error-buffered-file->buffer) -11221 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11222 68/push 0/imm32 -11223 68/push 0/imm32 -11224 89/<- %edx 4/r32/esp -11225 (tailor-exit-descriptor %edx 0x10) -11226 # -11227 (write _test-input-stream "fn foo {\n") -11228 (write _test-input-stream " var a: (addr stream int)\n") -11229 (write _test-input-stream " write-to-stream a\n") -11230 (write _test-input-stream "}\n") -11231 # convert -11232 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11233 # registers except esp clobbered at this point -11234 # restore ed -11235 89/<- %edx 4/r32/esp -11236 (flush _test-output-buffered-file) -11237 (flush _test-error-buffered-file) -11238 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11244 # check output -11245 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-too-few-inouts: output should be empty") -11246 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: too few inouts (2 required)" "F - test-write-to-stream-with-too-few-inouts: error message") -11247 # check that stop(1) was called -11248 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-too-few-inouts: exit status") -11249 # don't restore from ebp -11250 81 0/subop/add %esp 8/imm32 -11251 # . epilogue -11252 5d/pop-to-ebp -11253 c3/return -11254 -11255 test-write-to-stream-with-too-many-inouts: -11256 # . prologue -11257 55/push-ebp -11258 89/<- %ebp 4/r32/esp -11259 # setup -11260 (clear-stream _test-input-stream) -11261 (clear-stream $_test-input-buffered-file->buffer) -11262 (clear-stream _test-output-stream) -11263 (clear-stream $_test-output-buffered-file->buffer) -11264 (clear-stream _test-error-stream) -11265 (clear-stream $_test-error-buffered-file->buffer) -11266 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11267 68/push 0/imm32 -11268 68/push 0/imm32 -11269 89/<- %edx 4/r32/esp -11270 (tailor-exit-descriptor %edx 0x10) -11271 # -11272 (write _test-input-stream "fn foo {\n") -11273 (write _test-input-stream " var a: (addr stream int)\n") -11274 (write _test-input-stream " var b: (addr int)\n") -11275 (write _test-input-stream " write-to-stream a, b, 0\n") -11276 (write _test-input-stream "}\n") -11277 # convert -11278 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11279 # registers except esp clobbered at this point -11280 # restore ed -11281 89/<- %edx 4/r32/esp -11282 (flush _test-output-buffered-file) -11283 (flush _test-error-buffered-file) -11284 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11290 # check output -11291 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-too-many-inouts: output should be empty") -11292 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: too many inouts (2 required)" "F - test-write-to-stream-with-too-many-inouts: error message") -11293 # check that stop(1) was called -11294 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-too-many-inouts: exit status") -11295 # don't restore from ebp -11296 81 0/subop/add %esp 8/imm32 -11297 # . epilogue -11298 5d/pop-to-ebp -11299 c3/return -11300 -11301 test-write-to-stream-with-output: -11302 # . prologue -11303 55/push-ebp -11304 89/<- %ebp 4/r32/esp -11305 # setup -11306 (clear-stream _test-input-stream) -11307 (clear-stream $_test-input-buffered-file->buffer) -11308 (clear-stream _test-output-stream) -11309 (clear-stream $_test-output-buffered-file->buffer) -11310 (clear-stream _test-error-stream) -11311 (clear-stream $_test-error-buffered-file->buffer) -11312 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11313 68/push 0/imm32 -11314 68/push 0/imm32 -11315 89/<- %edx 4/r32/esp -11316 (tailor-exit-descriptor %edx 0x10) -11317 # -11318 (write _test-input-stream "fn foo {\n") -11319 (write _test-input-stream " var a: (addr stream int)\n") -11320 (write _test-input-stream " var b/eax: (addr int) <- copy 0\n") -11321 (write _test-input-stream " b <- write-to-stream a, b\n") -11322 (write _test-input-stream "}\n") -11323 # convert -11324 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11325 # registers except esp clobbered at this point -11326 # restore ed +10815 (tailor-exit-descriptor %edx 0x10) +10816 # +10817 (write _test-input-stream "fn foo {\n") +10818 (write _test-input-stream " var a: int\n") +10819 (write _test-input-stream " read-from-stream a, 0\n") +10820 (write _test-input-stream "}\n") +10821 # convert +10822 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10823 # registers except esp clobbered at this point +10824 # restore ed +10825 89/<- %edx 4/r32/esp +10826 (flush _test-output-buffered-file) +10827 (flush _test-error-buffered-file) +10828 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10834 # check output +10835 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-non-stream-atom-base-type: output should be empty") +10836 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: var 'a' must be an addr to a stream" "F - test-read-from-stream-with-non-stream-atom-base-type: error message") +10837 # check that stop(1) was called +10838 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-non-stream-atom-base-type: exit status") +10839 # don't restore from ebp +10840 81 0/subop/add %esp 8/imm32 +10841 # . epilogue +10842 5d/pop-to-ebp +10843 c3/return +10844 +10845 test-read-from-stream-with-non-stream-compound-base-type: +10846 # . prologue +10847 55/push-ebp +10848 89/<- %ebp 4/r32/esp +10849 # setup +10850 (clear-stream _test-input-stream) +10851 (clear-stream $_test-input-buffered-file->buffer) +10852 (clear-stream _test-output-stream) +10853 (clear-stream $_test-output-buffered-file->buffer) +10854 (clear-stream _test-error-stream) +10855 (clear-stream $_test-error-buffered-file->buffer) +10856 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10857 68/push 0/imm32 +10858 68/push 0/imm32 +10859 89/<- %edx 4/r32/esp +10860 (tailor-exit-descriptor %edx 0x10) +10861 # +10862 (write _test-input-stream "fn foo {\n") +10863 (write _test-input-stream " var a: (handle int)\n") +10864 (write _test-input-stream " read-from-stream a, 0\n") +10865 (write _test-input-stream "}\n") +10866 # convert +10867 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10868 # registers except esp clobbered at this point +10869 # restore ed +10870 89/<- %edx 4/r32/esp +10871 (flush _test-output-buffered-file) +10872 (flush _test-error-buffered-file) +10873 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10879 # check output +10880 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-non-stream-compound-base-type: output should be empty") +10881 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: var 'a' must be an addr to a stream" "F - test-read-from-stream-with-non-stream-compound-base-type: error message") +10882 # check that stop(1) was called +10883 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-non-stream-compound-base-type: exit status") +10884 # don't restore from ebp +10885 81 0/subop/add %esp 8/imm32 +10886 # . epilogue +10887 5d/pop-to-ebp +10888 c3/return +10889 +10890 test-read-from-stream-with-non-stream-compound-base-type-2: +10891 # . prologue +10892 55/push-ebp +10893 89/<- %ebp 4/r32/esp +10894 # setup +10895 (clear-stream _test-input-stream) +10896 (clear-stream $_test-input-buffered-file->buffer) +10897 (clear-stream _test-output-stream) +10898 (clear-stream $_test-output-buffered-file->buffer) +10899 (clear-stream _test-error-stream) +10900 (clear-stream $_test-error-buffered-file->buffer) +10901 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10902 68/push 0/imm32 +10903 68/push 0/imm32 +10904 89/<- %edx 4/r32/esp +10905 (tailor-exit-descriptor %edx 0x10) +10906 # +10907 (write _test-input-stream "fn foo {\n") +10908 (write _test-input-stream " var a: (addr int)\n") +10909 (write _test-input-stream " read-from-stream a, 0\n") +10910 (write _test-input-stream "}\n") +10911 # convert +10912 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10913 # registers except esp clobbered at this point +10914 # restore ed +10915 89/<- %edx 4/r32/esp +10916 (flush _test-output-buffered-file) +10917 (flush _test-error-buffered-file) +10918 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10924 # check output +10925 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-non-stream-compound-base-type-2: output should be empty") +10926 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: var 'a' must be an addr to a stream" "F - test-read-from-stream-with-non-stream-compound-base-type-2: error message") +10927 # check that stop(1) was called +10928 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-non-stream-compound-base-type-2: exit status") +10929 # don't restore from ebp +10930 81 0/subop/add %esp 8/imm32 +10931 # . epilogue +10932 5d/pop-to-ebp +10933 c3/return +10934 +10935 test-read-from-stream-with-stream-atom-base-type: +10936 # . prologue +10937 55/push-ebp +10938 89/<- %ebp 4/r32/esp +10939 # setup +10940 (clear-stream _test-input-stream) +10941 (clear-stream $_test-input-buffered-file->buffer) +10942 (clear-stream _test-output-stream) +10943 (clear-stream $_test-output-buffered-file->buffer) +10944 (clear-stream _test-error-stream) +10945 (clear-stream $_test-error-buffered-file->buffer) +10946 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10947 68/push 0/imm32 +10948 68/push 0/imm32 +10949 89/<- %edx 4/r32/esp +10950 (tailor-exit-descriptor %edx 0x10) +10951 # +10952 (write _test-input-stream "fn foo {\n") +10953 (write _test-input-stream " var a: stream\n") +10954 (write _test-input-stream " read-from-stream a, 0\n") +10955 (write _test-input-stream "}\n") +10956 # convert +10957 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +10958 # registers except esp clobbered at this point +10959 # restore ed +10960 89/<- %edx 4/r32/esp +10961 (flush _test-output-buffered-file) +10962 (flush _test-error-buffered-file) +10963 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +10969 # check output +10970 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-stream-atom-base-type: output should be empty") +10971 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: var 'a' must be an addr to a stream" "F - test-read-from-stream-with-stream-atom-base-type: error message") +10972 # check that stop(1) was called +10973 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-stream-atom-base-type: exit status") +10974 # don't restore from ebp +10975 81 0/subop/add %esp 8/imm32 +10976 # . epilogue +10977 5d/pop-to-ebp +10978 c3/return +10979 +10980 test-read-from-stream-with-wrong-index-type: +10981 # . prologue +10982 55/push-ebp +10983 89/<- %ebp 4/r32/esp +10984 # setup +10985 (clear-stream _test-input-stream) +10986 (clear-stream $_test-input-buffered-file->buffer) +10987 (clear-stream _test-output-stream) +10988 (clear-stream $_test-output-buffered-file->buffer) +10989 (clear-stream _test-error-stream) +10990 (clear-stream $_test-error-buffered-file->buffer) +10991 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +10992 68/push 0/imm32 +10993 68/push 0/imm32 +10994 89/<- %edx 4/r32/esp +10995 (tailor-exit-descriptor %edx 0x10) +10996 # +10997 (write _test-input-stream "fn foo {\n") +10998 (write _test-input-stream " var a/eax: (addr stream int) <- copy 0\n") +10999 (write _test-input-stream " var b: boolean\n") +11000 (write _test-input-stream " read-from-stream a, b\n") +11001 (write _test-input-stream "}\n") +11002 # convert +11003 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11004 # registers except esp clobbered at this point +11005 # restore ed +11006 89/<- %edx 4/r32/esp +11007 (flush _test-output-buffered-file) +11008 (flush _test-error-buffered-file) +11009 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11015 # check output +11016 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-wrong-index-type: output should be empty") +11017 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: target 'b' must be an addr" "F - test-read-from-stream-with-wrong-index-type: error message") +11018 # check that stop(1) was called +11019 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-wrong-index-type: exit status") +11020 # don't restore from ebp +11021 81 0/subop/add %esp 8/imm32 +11022 # . epilogue +11023 5d/pop-to-ebp +11024 c3/return +11025 +11026 test-read-from-stream-with-no-inouts: +11027 # . prologue +11028 55/push-ebp +11029 89/<- %ebp 4/r32/esp +11030 # setup +11031 (clear-stream _test-input-stream) +11032 (clear-stream $_test-input-buffered-file->buffer) +11033 (clear-stream _test-output-stream) +11034 (clear-stream $_test-output-buffered-file->buffer) +11035 (clear-stream _test-error-stream) +11036 (clear-stream $_test-error-buffered-file->buffer) +11037 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11038 68/push 0/imm32 +11039 68/push 0/imm32 +11040 89/<- %edx 4/r32/esp +11041 (tailor-exit-descriptor %edx 0x10) +11042 # +11043 (write _test-input-stream "fn foo {\n") +11044 (write _test-input-stream " read-from-stream\n") +11045 (write _test-input-stream "}\n") +11046 # convert +11047 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11048 # registers except esp clobbered at this point +11049 # restore ed +11050 89/<- %edx 4/r32/esp +11051 (flush _test-output-buffered-file) +11052 (flush _test-error-buffered-file) +11053 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11059 # check output +11060 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-no-inouts: output should be empty") +11061 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: too few inouts (2 required)" "F - test-read-from-stream-with-no-inouts: error message") +11062 # check that stop(1) was called +11063 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-no-inouts: exit status") +11064 # don't restore from ebp +11065 81 0/subop/add %esp 8/imm32 +11066 # . epilogue +11067 5d/pop-to-ebp +11068 c3/return +11069 +11070 test-read-from-stream-with-too-few-inouts: +11071 # . prologue +11072 55/push-ebp +11073 89/<- %ebp 4/r32/esp +11074 # setup +11075 (clear-stream _test-input-stream) +11076 (clear-stream $_test-input-buffered-file->buffer) +11077 (clear-stream _test-output-stream) +11078 (clear-stream $_test-output-buffered-file->buffer) +11079 (clear-stream _test-error-stream) +11080 (clear-stream $_test-error-buffered-file->buffer) +11081 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11082 68/push 0/imm32 +11083 68/push 0/imm32 +11084 89/<- %edx 4/r32/esp +11085 (tailor-exit-descriptor %edx 0x10) +11086 # +11087 (write _test-input-stream "fn foo {\n") +11088 (write _test-input-stream " var a: (addr stream int)\n") +11089 (write _test-input-stream " read-from-stream a\n") +11090 (write _test-input-stream "}\n") +11091 # convert +11092 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11093 # registers except esp clobbered at this point +11094 # restore ed +11095 89/<- %edx 4/r32/esp +11096 (flush _test-output-buffered-file) +11097 (flush _test-error-buffered-file) +11098 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11104 # check output +11105 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-too-few-inouts: output should be empty") +11106 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: too few inouts (2 required)" "F - test-read-from-stream-with-too-few-inouts: error message") +11107 # check that stop(1) was called +11108 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-too-few-inouts: exit status") +11109 # don't restore from ebp +11110 81 0/subop/add %esp 8/imm32 +11111 # . epilogue +11112 5d/pop-to-ebp +11113 c3/return +11114 +11115 test-read-from-stream-with-too-many-inouts: +11116 # . prologue +11117 55/push-ebp +11118 89/<- %ebp 4/r32/esp +11119 # setup +11120 (clear-stream _test-input-stream) +11121 (clear-stream $_test-input-buffered-file->buffer) +11122 (clear-stream _test-output-stream) +11123 (clear-stream $_test-output-buffered-file->buffer) +11124 (clear-stream _test-error-stream) +11125 (clear-stream $_test-error-buffered-file->buffer) +11126 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11127 68/push 0/imm32 +11128 68/push 0/imm32 +11129 89/<- %edx 4/r32/esp +11130 (tailor-exit-descriptor %edx 0x10) +11131 # +11132 (write _test-input-stream "fn foo {\n") +11133 (write _test-input-stream " var a: (addr stream int)\n") +11134 (write _test-input-stream " var b: (addr int)\n") +11135 (write _test-input-stream " read-from-stream a, b, 0\n") +11136 (write _test-input-stream "}\n") +11137 # convert +11138 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11139 # registers except esp clobbered at this point +11140 # restore ed +11141 89/<- %edx 4/r32/esp +11142 (flush _test-output-buffered-file) +11143 (flush _test-error-buffered-file) +11144 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11150 # check output +11151 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-too-many-inouts: output should be empty") +11152 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: too many inouts (2 required)" "F - test-read-from-stream-with-too-many-inouts: error message") +11153 # check that stop(1) was called +11154 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-too-many-inouts: exit status") +11155 # don't restore from ebp +11156 81 0/subop/add %esp 8/imm32 +11157 # . epilogue +11158 5d/pop-to-ebp +11159 c3/return +11160 +11161 test-read-from-stream-with-output: +11162 # . prologue +11163 55/push-ebp +11164 89/<- %ebp 4/r32/esp +11165 # setup +11166 (clear-stream _test-input-stream) +11167 (clear-stream $_test-input-buffered-file->buffer) +11168 (clear-stream _test-output-stream) +11169 (clear-stream $_test-output-buffered-file->buffer) +11170 (clear-stream _test-error-stream) +11171 (clear-stream $_test-error-buffered-file->buffer) +11172 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11173 68/push 0/imm32 +11174 68/push 0/imm32 +11175 89/<- %edx 4/r32/esp +11176 (tailor-exit-descriptor %edx 0x10) +11177 # +11178 (write _test-input-stream "fn foo {\n") +11179 (write _test-input-stream " var a: (addr stream int)\n") +11180 (write _test-input-stream " var b/eax: (addr int) <- copy 0\n") +11181 (write _test-input-stream " b <- read-from-stream a, b\n") +11182 (write _test-input-stream "}\n") +11183 # convert +11184 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11185 # registers except esp clobbered at this point +11186 # restore ed +11187 89/<- %edx 4/r32/esp +11188 (flush _test-output-buffered-file) +11189 (flush _test-error-buffered-file) +11190 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11196 # check output +11197 (check-stream-equal _test-output-stream "" "F - test-read-from-stream-with-output: output should be empty") +11198 (check-next-stream-line-equal _test-error-stream "fn foo: stmt read-from-stream: unexpected output" "F - test-read-from-stream-with-output: error message") +11199 # check that stop(1) was called +11200 (check-ints-equal *(edx+4) 2 "F - test-read-from-stream-with-output: exit status") +11201 # don't restore from ebp +11202 81 0/subop/add %esp 8/imm32 +11203 # . epilogue +11204 5d/pop-to-ebp +11205 c3/return +11206 +11207 test-convert-write-to-stream: +11208 # . prologue +11209 55/push-ebp +11210 89/<- %ebp 4/r32/esp +11211 # setup +11212 (clear-stream _test-input-stream) +11213 (clear-stream $_test-input-buffered-file->buffer) +11214 (clear-stream _test-output-stream) +11215 (clear-stream $_test-output-buffered-file->buffer) +11216 # +11217 (write _test-input-stream "fn foo {\n") +11218 (write _test-input-stream " var s/esi: (addr stream int) <- copy 0\n") +11219 (write _test-input-stream " var o/ecx: (addr int) <- copy 0\n") +11220 (write _test-input-stream " write-to-stream s, o\n") +11221 (write _test-input-stream "}\n") +11222 # convert +11223 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +11224 # registers except esp clobbered at this point +11225 # restore ed +11226 89/<- %edx 4/r32/esp +11227 (flush _test-output-buffered-file) +11228 (flush _test-error-buffered-file) +11229 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11235 # check output +11236 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-write-to-stream/0") +11237 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-write-to-stream/1") +11238 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-write-to-stream/2") +11239 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-write-to-stream/3") +11240 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-write-to-stream/4") +11241 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-write-to-stream/5") +11242 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-write-to-stream/6") +11243 (check-next-stream-line-equal _test-output-stream " be/copy-to-esi 0/imm32" "F - test-convert-write-to-stream/7") +11244 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-write-to-stream/8") +11245 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-write-to-stream/9") +11246 (check-next-stream-line-equal _test-output-stream " (write-to-stream %esi %ecx 0x00000004)" "F - test-convert-write-to-stream/10") +11247 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-write-to-stream/11") +11248 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-write-to-stream/12") +11249 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-write-to-stream/13") +11250 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-write-to-stream/14") +11251 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-write-to-stream/15") +11252 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-write-to-stream/16") +11253 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-write-to-stream/17") +11254 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-write-to-stream/18") +11255 # . epilogue +11256 89/<- %esp 5/r32/ebp +11257 5d/pop-to-ebp +11258 c3/return +11259 +11260 test-convert-write-to-stream-with-correct-payload-size: +11261 # . prologue +11262 55/push-ebp +11263 89/<- %ebp 4/r32/esp +11264 # setup +11265 (clear-stream _test-input-stream) +11266 (clear-stream $_test-input-buffered-file->buffer) +11267 (clear-stream _test-output-stream) +11268 (clear-stream $_test-output-buffered-file->buffer) +11269 # +11270 (write _test-input-stream "fn foo {\n") +11271 (write _test-input-stream " var s/esi: (addr stream handle int) <- copy 0\n") +11272 (write _test-input-stream " var o/ecx: (addr handle int) <- copy 0\n") +11273 (write _test-input-stream " write-to-stream s, o\n") +11274 (write _test-input-stream "}\n") +11275 # convert +11276 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +11277 # registers except esp clobbered at this point +11278 # restore ed +11279 89/<- %edx 4/r32/esp +11280 (flush _test-output-buffered-file) +11281 (flush _test-error-buffered-file) +11282 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11288 # check output +11289 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-write-to-stream-with-correct-payload-size/0") +11290 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-write-to-stream-with-correct-payload-size/1") +11291 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-write-to-stream-with-correct-payload-size/2") +11292 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-write-to-stream-with-correct-payload-size/3") +11293 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-write-to-stream-with-correct-payload-size/4") +11294 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-write-to-stream-with-correct-payload-size/5") +11295 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %esi" "F - test-convert-write-to-stream-with-correct-payload-size/6") +11296 (check-next-stream-line-equal _test-output-stream " be/copy-to-esi 0/imm32" "F - test-convert-write-to-stream-with-correct-payload-size/7") +11297 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-write-to-stream-with-correct-payload-size/8") +11298 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 0/imm32" "F - test-convert-write-to-stream-with-correct-payload-size/9") +11299 (check-next-stream-line-equal _test-output-stream " (write-to-stream %esi %ecx 0x00000008)" "F - test-convert-write-to-stream-with-correct-payload-size/10") +11300 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-write-to-stream-with-correct-payload-size/11") +11301 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %esi" "F - test-convert-write-to-stream-with-correct-payload-size/12") +11302 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-write-to-stream-with-correct-payload-size/13") +11303 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-write-to-stream-with-correct-payload-size/14") +11304 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-write-to-stream-with-correct-payload-size/15") +11305 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-write-to-stream-with-correct-payload-size/16") +11306 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-write-to-stream-with-correct-payload-size/17") +11307 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-write-to-stream-with-correct-payload-size/18") +11308 # . epilogue +11309 89/<- %esp 5/r32/ebp +11310 5d/pop-to-ebp +11311 c3/return +11312 +11313 test-write-to-stream-with-non-stream-atom-base-type: +11314 # . prologue +11315 55/push-ebp +11316 89/<- %ebp 4/r32/esp +11317 # setup +11318 (clear-stream _test-input-stream) +11319 (clear-stream $_test-input-buffered-file->buffer) +11320 (clear-stream _test-output-stream) +11321 (clear-stream $_test-output-buffered-file->buffer) +11322 (clear-stream _test-error-stream) +11323 (clear-stream $_test-error-buffered-file->buffer) +11324 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11325 68/push 0/imm32 +11326 68/push 0/imm32 11327 89/<- %edx 4/r32/esp -11328 (flush _test-output-buffered-file) -11329 (flush _test-error-buffered-file) -11330 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11336 # check output -11337 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-output: output should be empty") -11338 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: unexpected output" "F - test-write-to-stream-with-output: error message") -11339 # check that stop(1) was called -11340 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-output: exit status") -11341 # don't restore from ebp -11342 81 0/subop/add %esp 8/imm32 -11343 # . epilogue -11344 5d/pop-to-ebp -11345 c3/return -11346 -11347 test-length-with-non-array-atom-base-type: -11348 # . prologue -11349 55/push-ebp -11350 89/<- %ebp 4/r32/esp -11351 # setup -11352 (clear-stream _test-input-stream) -11353 (clear-stream $_test-input-buffered-file->buffer) -11354 (clear-stream _test-output-stream) -11355 (clear-stream $_test-output-buffered-file->buffer) -11356 (clear-stream _test-error-stream) -11357 (clear-stream $_test-error-buffered-file->buffer) -11358 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11359 68/push 0/imm32 -11360 68/push 0/imm32 -11361 89/<- %edx 4/r32/esp -11362 (tailor-exit-descriptor %edx 0x10) -11363 # -11364 (write _test-input-stream "fn foo {\n") -11365 (write _test-input-stream " var a: int\n") -11366 (write _test-input-stream " var c/ecx: int <- length a\n") -11367 (write _test-input-stream "}\n") -11368 # convert -11369 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11370 # registers except esp clobbered at this point -11371 # restore ed +11328 (tailor-exit-descriptor %edx 0x10) +11329 # +11330 (write _test-input-stream "fn foo {\n") +11331 (write _test-input-stream " var a: int\n") +11332 (write _test-input-stream " write-to-stream a, 0\n") +11333 (write _test-input-stream "}\n") +11334 # convert +11335 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11336 # registers except esp clobbered at this point +11337 # restore ed +11338 89/<- %edx 4/r32/esp +11339 (flush _test-output-buffered-file) +11340 (flush _test-error-buffered-file) +11341 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11347 # check output +11348 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-non-stream-atom-base-type: output should be empty") +11349 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: var 'a' must be an addr to a stream" "F - test-write-to-stream-with-non-stream-atom-base-type: error message") +11350 # check that stop(1) was called +11351 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-non-stream-atom-base-type: exit status") +11352 # don't restore from ebp +11353 81 0/subop/add %esp 8/imm32 +11354 # . epilogue +11355 5d/pop-to-ebp +11356 c3/return +11357 +11358 test-write-to-stream-with-non-stream-compound-base-type: +11359 # . prologue +11360 55/push-ebp +11361 89/<- %ebp 4/r32/esp +11362 # setup +11363 (clear-stream _test-input-stream) +11364 (clear-stream $_test-input-buffered-file->buffer) +11365 (clear-stream _test-output-stream) +11366 (clear-stream $_test-output-buffered-file->buffer) +11367 (clear-stream _test-error-stream) +11368 (clear-stream $_test-error-buffered-file->buffer) +11369 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11370 68/push 0/imm32 +11371 68/push 0/imm32 11372 89/<- %edx 4/r32/esp -11373 (flush _test-output-buffered-file) -11374 (flush _test-error-buffered-file) -11375 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11381 # check output -11382 (check-stream-equal _test-output-stream "" "F - test-length-with-non-array-atom-base-type: output should be empty") -11383 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: var 'a' is not an array" "F - test-length-with-non-array-atom-base-type: error message") -11384 # check that stop(1) was called -11385 (check-ints-equal *(edx+4) 2 "F - test-length-with-non-array-atom-base-type: exit status") -11386 # don't restore from ebp -11387 81 0/subop/add %esp 8/imm32 -11388 # . epilogue -11389 5d/pop-to-ebp -11390 c3/return -11391 -11392 test-length-with-non-array-compound-base-type: -11393 # . prologue -11394 55/push-ebp -11395 89/<- %ebp 4/r32/esp -11396 # setup -11397 (clear-stream _test-input-stream) -11398 (clear-stream $_test-input-buffered-file->buffer) -11399 (clear-stream _test-output-stream) -11400 (clear-stream $_test-output-buffered-file->buffer) -11401 (clear-stream _test-error-stream) -11402 (clear-stream $_test-error-buffered-file->buffer) -11403 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11404 68/push 0/imm32 -11405 68/push 0/imm32 -11406 89/<- %edx 4/r32/esp -11407 (tailor-exit-descriptor %edx 0x10) -11408 # -11409 (write _test-input-stream "fn foo {\n") -11410 (write _test-input-stream " var a: (handle int)\n") -11411 (write _test-input-stream " var c/ecx: (addr int) <- length a, 0\n") -11412 (write _test-input-stream "}\n") -11413 # convert -11414 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11415 # registers except esp clobbered at this point -11416 # restore ed +11373 (tailor-exit-descriptor %edx 0x10) +11374 # +11375 (write _test-input-stream "fn foo {\n") +11376 (write _test-input-stream " var a: (handle int)\n") +11377 (write _test-input-stream " write-to-stream a, 0\n") +11378 (write _test-input-stream "}\n") +11379 # convert +11380 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11381 # registers except esp clobbered at this point +11382 # restore ed +11383 89/<- %edx 4/r32/esp +11384 (flush _test-output-buffered-file) +11385 (flush _test-error-buffered-file) +11386 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11392 # check output +11393 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-non-stream-compound-base-type: output should be empty") +11394 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: var 'a' must be an addr to a stream" "F - test-write-to-stream-with-non-stream-compound-base-type: error message") +11395 # check that stop(1) was called +11396 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-non-stream-compound-base-type: exit status") +11397 # don't restore from ebp +11398 81 0/subop/add %esp 8/imm32 +11399 # . epilogue +11400 5d/pop-to-ebp +11401 c3/return +11402 +11403 test-write-to-stream-with-non-stream-compound-base-type-2: +11404 # . prologue +11405 55/push-ebp +11406 89/<- %ebp 4/r32/esp +11407 # setup +11408 (clear-stream _test-input-stream) +11409 (clear-stream $_test-input-buffered-file->buffer) +11410 (clear-stream _test-output-stream) +11411 (clear-stream $_test-output-buffered-file->buffer) +11412 (clear-stream _test-error-stream) +11413 (clear-stream $_test-error-buffered-file->buffer) +11414 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11415 68/push 0/imm32 +11416 68/push 0/imm32 11417 89/<- %edx 4/r32/esp -11418 (flush _test-output-buffered-file) -11419 (flush _test-error-buffered-file) -11420 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11426 # check output -11427 (check-stream-equal _test-output-stream "" "F - test-length-with-non-array-compound-base-type: output should be empty") -11428 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: var 'a' is not an array" "F - test-length-with-non-array-compound-base-type: error message") -11429 # check that stop(1) was called -11430 (check-ints-equal *(edx+4) 2 "F - test-length-with-non-array-compound-base-type: exit status") -11431 # don't restore from ebp -11432 81 0/subop/add %esp 8/imm32 -11433 # . epilogue -11434 5d/pop-to-ebp -11435 c3/return -11436 -11437 test-length-with-non-array-compound-base-type-2: -11438 # . prologue -11439 55/push-ebp -11440 89/<- %ebp 4/r32/esp -11441 # setup -11442 (clear-stream _test-input-stream) -11443 (clear-stream $_test-input-buffered-file->buffer) -11444 (clear-stream _test-output-stream) -11445 (clear-stream $_test-output-buffered-file->buffer) -11446 (clear-stream _test-error-stream) -11447 (clear-stream $_test-error-buffered-file->buffer) -11448 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11449 68/push 0/imm32 -11450 68/push 0/imm32 -11451 89/<- %edx 4/r32/esp -11452 (tailor-exit-descriptor %edx 0x10) -11453 # -11454 (write _test-input-stream "fn foo {\n") -11455 (write _test-input-stream " var a: (addr int)\n") -11456 (write _test-input-stream " var c/ecx: (addr int) <- length a, 0\n") -11457 (write _test-input-stream "}\n") -11458 # convert -11459 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11460 # registers except esp clobbered at this point -11461 # restore ed +11418 (tailor-exit-descriptor %edx 0x10) +11419 # +11420 (write _test-input-stream "fn foo {\n") +11421 (write _test-input-stream " var a: (addr int)\n") +11422 (write _test-input-stream " write-to-stream a, 0\n") +11423 (write _test-input-stream "}\n") +11424 # convert +11425 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11426 # registers except esp clobbered at this point +11427 # restore ed +11428 89/<- %edx 4/r32/esp +11429 (flush _test-output-buffered-file) +11430 (flush _test-error-buffered-file) +11431 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11437 # check output +11438 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-non-stream-compound-base-type-2: output should be empty") +11439 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: var 'a' must be an addr to a stream" "F - test-write-to-stream-with-non-stream-compound-base-type-2: error message") +11440 # check that stop(1) was called +11441 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-non-stream-compound-base-type-2: exit status") +11442 # don't restore from ebp +11443 81 0/subop/add %esp 8/imm32 +11444 # . epilogue +11445 5d/pop-to-ebp +11446 c3/return +11447 +11448 test-write-to-stream-with-stream-atom-base-type: +11449 # . prologue +11450 55/push-ebp +11451 89/<- %ebp 4/r32/esp +11452 # setup +11453 (clear-stream _test-input-stream) +11454 (clear-stream $_test-input-buffered-file->buffer) +11455 (clear-stream _test-output-stream) +11456 (clear-stream $_test-output-buffered-file->buffer) +11457 (clear-stream _test-error-stream) +11458 (clear-stream $_test-error-buffered-file->buffer) +11459 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11460 68/push 0/imm32 +11461 68/push 0/imm32 11462 89/<- %edx 4/r32/esp -11463 (flush _test-output-buffered-file) -11464 (flush _test-error-buffered-file) -11465 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11471 # check output -11472 (check-stream-equal _test-output-stream "" "F - test-length-with-non-array-compound-base-type-2: output should be empty") -11473 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: var 'a' is not an array" "F - test-length-with-non-array-compound-base-type-2: error message") -11474 # check that stop(1) was called -11475 (check-ints-equal *(edx+4) 2 "F - test-length-with-non-array-compound-base-type-2: exit status") -11476 # don't restore from ebp -11477 81 0/subop/add %esp 8/imm32 -11478 # . epilogue -11479 5d/pop-to-ebp -11480 c3/return -11481 -11482 test-length-with-array-atom-base-type: -11483 # . prologue -11484 55/push-ebp -11485 89/<- %ebp 4/r32/esp -11486 # setup -11487 (clear-stream _test-input-stream) -11488 (clear-stream $_test-input-buffered-file->buffer) -11489 (clear-stream _test-output-stream) -11490 (clear-stream $_test-output-buffered-file->buffer) -11491 (clear-stream _test-error-stream) -11492 (clear-stream $_test-error-buffered-file->buffer) -11493 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11494 68/push 0/imm32 -11495 68/push 0/imm32 -11496 89/<- %edx 4/r32/esp -11497 (tailor-exit-descriptor %edx 0x10) -11498 # -11499 (write _test-input-stream "fn foo {\n") -11500 (write _test-input-stream " var a: array\n") -11501 (write _test-input-stream " var c/ecx: (addr int) <- length a\n") -11502 (write _test-input-stream "}\n") -11503 # convert -11504 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11505 # registers except esp clobbered at this point -11506 # restore ed +11463 (tailor-exit-descriptor %edx 0x10) +11464 # +11465 (write _test-input-stream "fn foo {\n") +11466 (write _test-input-stream " var a: stream\n") +11467 (write _test-input-stream " write-to-stream a, 0\n") +11468 (write _test-input-stream "}\n") +11469 # convert +11470 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11471 # registers except esp clobbered at this point +11472 # restore ed +11473 89/<- %edx 4/r32/esp +11474 (flush _test-output-buffered-file) +11475 (flush _test-error-buffered-file) +11476 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11482 # check output +11483 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-stream-atom-base-type: output should be empty") +11484 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: var 'a' must be an addr to a stream" "F - test-write-to-stream-with-stream-atom-base-type: error message") +11485 # check that stop(1) was called +11486 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-stream-atom-base-type: exit status") +11487 # don't restore from ebp +11488 81 0/subop/add %esp 8/imm32 +11489 # . epilogue +11490 5d/pop-to-ebp +11491 c3/return +11492 +11493 test-write-to-stream-with-wrong-index-type: +11494 # . prologue +11495 55/push-ebp +11496 89/<- %ebp 4/r32/esp +11497 # setup +11498 (clear-stream _test-input-stream) +11499 (clear-stream $_test-input-buffered-file->buffer) +11500 (clear-stream _test-output-stream) +11501 (clear-stream $_test-output-buffered-file->buffer) +11502 (clear-stream _test-error-stream) +11503 (clear-stream $_test-error-buffered-file->buffer) +11504 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11505 68/push 0/imm32 +11506 68/push 0/imm32 11507 89/<- %edx 4/r32/esp -11508 (flush _test-output-buffered-file) -11509 (flush _test-error-buffered-file) -11510 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11516 # check output -11517 (check-stream-equal _test-output-stream "" "F - test-length-with-array-atom-base-type: output should be empty") -11518 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: array 'a' must specify the type of its elements" "F - test-length-with-array-atom-base-type: error message") -11519 # check that stop(1) was called -11520 (check-ints-equal *(edx+4) 2 "F - test-length-with-array-atom-base-type: exit status") -11521 # don't restore from ebp -11522 81 0/subop/add %esp 8/imm32 -11523 # . epilogue -11524 5d/pop-to-ebp -11525 c3/return -11526 -11527 test-length-with-addr-base-on-stack: -11528 # . prologue -11529 55/push-ebp -11530 89/<- %ebp 4/r32/esp -11531 # setup -11532 (clear-stream _test-input-stream) -11533 (clear-stream $_test-input-buffered-file->buffer) -11534 (clear-stream _test-output-stream) -11535 (clear-stream $_test-output-buffered-file->buffer) -11536 (clear-stream _test-error-stream) -11537 (clear-stream $_test-error-buffered-file->buffer) -11538 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11539 68/push 0/imm32 -11540 68/push 0/imm32 -11541 89/<- %edx 4/r32/esp -11542 (tailor-exit-descriptor %edx 0x10) -11543 # -11544 (write _test-input-stream "fn foo {\n") -11545 (write _test-input-stream " var a: (addr array int)\n") -11546 (write _test-input-stream " var c/ecx: (addr int) <- length a\n") -11547 (write _test-input-stream "}\n") -11548 # convert -11549 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11550 # registers except esp clobbered at this point -11551 # restore ed -11552 89/<- %edx 4/r32/esp -11553 (flush _test-output-buffered-file) -11554 (flush _test-error-buffered-file) -11555 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11561 # check output -11562 (check-stream-equal _test-output-stream "" "F - test-length-with-addr-base-on-stack: output should be empty") -11563 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: var 'a' is an addr to an array, and so must live in a register" "F - test-length-with-addr-base-on-stack: error message") -11564 # check that stop(1) was called -11565 (check-ints-equal *(edx+4) 2 "F - test-length-with-addr-base-on-stack: exit status") -11566 # don't restore from ebp -11567 81 0/subop/add %esp 8/imm32 -11568 # . epilogue -11569 5d/pop-to-ebp -11570 c3/return -11571 -11572 test-length-with-wrong-output-type: -11573 # . prologue -11574 55/push-ebp -11575 89/<- %ebp 4/r32/esp -11576 # setup -11577 (clear-stream _test-input-stream) -11578 (clear-stream $_test-input-buffered-file->buffer) -11579 (clear-stream _test-output-stream) -11580 (clear-stream $_test-output-buffered-file->buffer) -11581 (clear-stream _test-error-stream) -11582 (clear-stream $_test-error-buffered-file->buffer) -11583 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11584 68/push 0/imm32 -11585 68/push 0/imm32 -11586 89/<- %edx 4/r32/esp -11587 (tailor-exit-descriptor %edx 0x10) -11588 # -11589 (write _test-input-stream "fn foo {\n") -11590 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") -11591 (write _test-input-stream " var o/edi: (addr int) <- length a\n") -11592 (write _test-input-stream "}\n") -11593 # convert -11594 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11595 # registers except esp clobbered at this point -11596 # restore ed +11508 (tailor-exit-descriptor %edx 0x10) +11509 # +11510 (write _test-input-stream "fn foo {\n") +11511 (write _test-input-stream " var a/eax: (addr stream int) <- copy 0\n") +11512 (write _test-input-stream " var b: boolean\n") +11513 (write _test-input-stream " write-to-stream a, b\n") +11514 (write _test-input-stream "}\n") +11515 # convert +11516 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11517 # registers except esp clobbered at this point +11518 # restore ed +11519 89/<- %edx 4/r32/esp +11520 (flush _test-output-buffered-file) +11521 (flush _test-error-buffered-file) +11522 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11528 # check output +11529 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-wrong-index-type: output should be empty") +11530 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: target 'b' must be an addr" "F - test-write-to-stream-with-wrong-index-type: error message") +11531 # check that stop(1) was called +11532 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-wrong-index-type: exit status") +11533 # don't restore from ebp +11534 81 0/subop/add %esp 8/imm32 +11535 # . epilogue +11536 5d/pop-to-ebp +11537 c3/return +11538 +11539 test-write-to-stream-with-no-inouts: +11540 # . prologue +11541 55/push-ebp +11542 89/<- %ebp 4/r32/esp +11543 # setup +11544 (clear-stream _test-input-stream) +11545 (clear-stream $_test-input-buffered-file->buffer) +11546 (clear-stream _test-output-stream) +11547 (clear-stream $_test-output-buffered-file->buffer) +11548 (clear-stream _test-error-stream) +11549 (clear-stream $_test-error-buffered-file->buffer) +11550 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11551 68/push 0/imm32 +11552 68/push 0/imm32 +11553 89/<- %edx 4/r32/esp +11554 (tailor-exit-descriptor %edx 0x10) +11555 # +11556 (write _test-input-stream "fn foo {\n") +11557 (write _test-input-stream " write-to-stream\n") +11558 (write _test-input-stream "}\n") +11559 # convert +11560 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11561 # registers except esp clobbered at this point +11562 # restore ed +11563 89/<- %edx 4/r32/esp +11564 (flush _test-output-buffered-file) +11565 (flush _test-error-buffered-file) +11566 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11572 # check output +11573 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-no-inouts: output should be empty") +11574 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: too few inouts (2 required)" "F - test-write-to-stream-with-no-inouts: error message") +11575 # check that stop(1) was called +11576 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-no-inouts: exit status") +11577 # don't restore from ebp +11578 81 0/subop/add %esp 8/imm32 +11579 # . epilogue +11580 5d/pop-to-ebp +11581 c3/return +11582 +11583 test-write-to-stream-with-too-few-inouts: +11584 # . prologue +11585 55/push-ebp +11586 89/<- %ebp 4/r32/esp +11587 # setup +11588 (clear-stream _test-input-stream) +11589 (clear-stream $_test-input-buffered-file->buffer) +11590 (clear-stream _test-output-stream) +11591 (clear-stream $_test-output-buffered-file->buffer) +11592 (clear-stream _test-error-stream) +11593 (clear-stream $_test-error-buffered-file->buffer) +11594 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11595 68/push 0/imm32 +11596 68/push 0/imm32 11597 89/<- %edx 4/r32/esp -11598 (flush _test-output-buffered-file) -11599 (flush _test-error-buffered-file) -11600 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11606 # check output -11607 (check-stream-equal _test-output-stream "" "F - test-length-with-wrong-output-type: output should be empty") -11608 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: output 'o' does not have the right type" "F - test-length-with-wrong-output-type: error message") -11609 # check that stop(1) was called -11610 (check-ints-equal *(edx+4) 2 "F - test-length-with-wrong-output-type: exit status") -11611 # don't restore from ebp -11612 81 0/subop/add %esp 8/imm32 -11613 # . epilogue -11614 5d/pop-to-ebp -11615 c3/return -11616 -11617 test-length-with-wrong-output-compound-type: -11618 # . prologue -11619 55/push-ebp -11620 89/<- %ebp 4/r32/esp -11621 # setup -11622 (clear-stream _test-input-stream) -11623 (clear-stream $_test-input-buffered-file->buffer) -11624 (clear-stream _test-output-stream) -11625 (clear-stream $_test-output-buffered-file->buffer) -11626 (clear-stream _test-error-stream) -11627 (clear-stream $_test-error-buffered-file->buffer) -11628 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11629 68/push 0/imm32 -11630 68/push 0/imm32 -11631 89/<- %edx 4/r32/esp -11632 (tailor-exit-descriptor %edx 0x10) -11633 # -11634 (write _test-input-stream "fn foo {\n") -11635 (write _test-input-stream " var a/ebx: (addr array handle boolean) <- copy 0\n") -11636 (write _test-input-stream " var o/edi: (addr handle int) <- length a\n") -11637 (write _test-input-stream "}\n") -11638 # convert -11639 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11640 # registers except esp clobbered at this point -11641 # restore ed +11598 (tailor-exit-descriptor %edx 0x10) +11599 # +11600 (write _test-input-stream "fn foo {\n") +11601 (write _test-input-stream " var a: (addr stream int)\n") +11602 (write _test-input-stream " write-to-stream a\n") +11603 (write _test-input-stream "}\n") +11604 # convert +11605 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11606 # registers except esp clobbered at this point +11607 # restore ed +11608 89/<- %edx 4/r32/esp +11609 (flush _test-output-buffered-file) +11610 (flush _test-error-buffered-file) +11611 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11617 # check output +11618 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-too-few-inouts: output should be empty") +11619 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: too few inouts (2 required)" "F - test-write-to-stream-with-too-few-inouts: error message") +11620 # check that stop(1) was called +11621 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-too-few-inouts: exit status") +11622 # don't restore from ebp +11623 81 0/subop/add %esp 8/imm32 +11624 # . epilogue +11625 5d/pop-to-ebp +11626 c3/return +11627 +11628 test-write-to-stream-with-too-many-inouts: +11629 # . prologue +11630 55/push-ebp +11631 89/<- %ebp 4/r32/esp +11632 # setup +11633 (clear-stream _test-input-stream) +11634 (clear-stream $_test-input-buffered-file->buffer) +11635 (clear-stream _test-output-stream) +11636 (clear-stream $_test-output-buffered-file->buffer) +11637 (clear-stream _test-error-stream) +11638 (clear-stream $_test-error-buffered-file->buffer) +11639 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11640 68/push 0/imm32 +11641 68/push 0/imm32 11642 89/<- %edx 4/r32/esp -11643 (flush _test-output-buffered-file) -11644 (flush _test-error-buffered-file) -11645 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11651 # check output -11652 (check-stream-equal _test-output-stream "" "F - test-length-with-wrong-output-compound-type: output should be empty") -11653 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: output 'o' does not have the right type" "F - test-length-with-wrong-output-compound-type: error message") -11654 # check that stop(1) was called -11655 (check-ints-equal *(edx+4) 2 "F - test-length-with-wrong-output-compound-type: exit status") -11656 # don't restore from ebp -11657 81 0/subop/add %esp 8/imm32 -11658 # . epilogue -11659 5d/pop-to-ebp -11660 c3/return -11661 -11662 test-length-with-no-inouts: -11663 # . prologue -11664 55/push-ebp -11665 89/<- %ebp 4/r32/esp -11666 # setup -11667 (clear-stream _test-input-stream) -11668 (clear-stream $_test-input-buffered-file->buffer) -11669 (clear-stream _test-output-stream) -11670 (clear-stream $_test-output-buffered-file->buffer) -11671 (clear-stream _test-error-stream) -11672 (clear-stream $_test-error-buffered-file->buffer) -11673 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11674 68/push 0/imm32 -11675 68/push 0/imm32 -11676 89/<- %edx 4/r32/esp -11677 (tailor-exit-descriptor %edx 0x10) -11678 # -11679 (write _test-input-stream "fn foo {\n") -11680 (write _test-input-stream " var c/ecx: int <- length\n") -11681 (write _test-input-stream "}\n") -11682 # convert -11683 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11684 # registers except esp clobbered at this point -11685 # restore ed -11686 89/<- %edx 4/r32/esp -11687 (flush _test-output-buffered-file) -11688 (flush _test-error-buffered-file) -11689 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11695 # check output -11696 (check-stream-equal _test-output-stream "" "F - test-length-with-no-inouts: output should be empty") -11697 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: too few inouts (1 required)" "F - test-length-with-no-inouts: error message") -11698 # check that stop(1) was called -11699 (check-ints-equal *(edx+4) 2 "F - test-length-with-no-inouts: exit status") -11700 # don't restore from ebp -11701 81 0/subop/add %esp 8/imm32 -11702 # . epilogue -11703 5d/pop-to-ebp -11704 c3/return -11705 -11706 test-length-with-too-many-inouts: -11707 # . prologue -11708 55/push-ebp -11709 89/<- %ebp 4/r32/esp -11710 # setup -11711 (clear-stream _test-input-stream) -11712 (clear-stream $_test-input-buffered-file->buffer) -11713 (clear-stream _test-output-stream) -11714 (clear-stream $_test-output-buffered-file->buffer) -11715 (clear-stream _test-error-stream) -11716 (clear-stream $_test-error-buffered-file->buffer) -11717 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11718 68/push 0/imm32 -11719 68/push 0/imm32 -11720 89/<- %edx 4/r32/esp -11721 (tailor-exit-descriptor %edx 0x10) -11722 # -11723 (write _test-input-stream "fn foo {\n") -11724 (write _test-input-stream " var a: (array int 3)\n") -11725 (write _test-input-stream " var c/ecx: int <- length a, 0, 0\n") -11726 (write _test-input-stream "}\n") -11727 # convert -11728 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11729 # registers except esp clobbered at this point -11730 # restore ed -11731 89/<- %edx 4/r32/esp -11732 (flush _test-output-buffered-file) -11733 (flush _test-error-buffered-file) -11734 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11740 # check output -11741 (check-stream-equal _test-output-stream "" "F - test-length-with-too-many-inouts: output should be empty") -11742 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: too many inouts (1 required)" "F - test-length-with-too-many-inouts: error message") -11743 # check that stop(1) was called -11744 (check-ints-equal *(edx+4) 2 "F - test-length-with-too-many-inouts: exit status") -11745 # don't restore from ebp -11746 81 0/subop/add %esp 8/imm32 -11747 # . epilogue -11748 5d/pop-to-ebp -11749 c3/return -11750 -11751 test-length-with-no-output: -11752 # . prologue -11753 55/push-ebp -11754 89/<- %ebp 4/r32/esp -11755 # setup -11756 (clear-stream _test-input-stream) -11757 (clear-stream $_test-input-buffered-file->buffer) -11758 (clear-stream _test-output-stream) -11759 (clear-stream $_test-output-buffered-file->buffer) -11760 (clear-stream _test-error-stream) -11761 (clear-stream $_test-error-buffered-file->buffer) -11762 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11763 68/push 0/imm32 -11764 68/push 0/imm32 -11765 89/<- %edx 4/r32/esp -11766 (tailor-exit-descriptor %edx 0x10) -11767 # -11768 (write _test-input-stream "fn foo {\n") -11769 (write _test-input-stream " var a: (array int 3)\n") -11770 (write _test-input-stream " length a\n") -11771 (write _test-input-stream "}\n") -11772 # convert -11773 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11774 # registers except esp clobbered at this point -11775 # restore ed -11776 89/<- %edx 4/r32/esp -11777 (flush _test-output-buffered-file) -11778 (flush _test-error-buffered-file) -11779 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11785 # check output -11786 (check-stream-equal _test-output-stream "" "F - test-length-with-no-output: output should be empty") -11787 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: must have an output" "F - test-length-with-no-output: error message") -11788 # check that stop(1) was called -11789 (check-ints-equal *(edx+4) 2 "F - test-length-with-no-output: exit status") -11790 # don't restore from ebp -11791 81 0/subop/add %esp 8/imm32 -11792 # . epilogue -11793 5d/pop-to-ebp -11794 c3/return -11795 -11796 test-length-with-too-many-outputs: -11797 # . prologue -11798 55/push-ebp -11799 89/<- %ebp 4/r32/esp -11800 # setup -11801 (clear-stream _test-input-stream) -11802 (clear-stream $_test-input-buffered-file->buffer) -11803 (clear-stream _test-output-stream) -11804 (clear-stream $_test-output-buffered-file->buffer) -11805 (clear-stream _test-error-stream) -11806 (clear-stream $_test-error-buffered-file->buffer) -11807 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -11808 68/push 0/imm32 -11809 68/push 0/imm32 -11810 89/<- %edx 4/r32/esp -11811 (tailor-exit-descriptor %edx 0x10) -11812 # -11813 (write _test-input-stream "fn foo {\n") -11814 (write _test-input-stream " var a: (array int 3)\n") -11815 (write _test-input-stream " var b/eax: int <- copy 0\n") -11816 (write _test-input-stream " var c/ecx: int <- copy 0\n") -11817 (write _test-input-stream " b, c <- length a\n") -11818 (write _test-input-stream "}\n") -11819 # convert -11820 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -11821 # registers except esp clobbered at this point -11822 # restore ed -11823 89/<- %edx 4/r32/esp -11824 (flush _test-output-buffered-file) -11825 (flush _test-error-buffered-file) -11826 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -11832 # check output -11833 (check-stream-equal _test-output-stream "" "F - test-length-with-too-many-outputs: output should be empty") -11834 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: too many outputs (1 required)" "F - test-length-with-too-many-outputs: error message") -11835 # check that stop(1) was called -11836 (check-ints-equal *(edx+4) 2 "F - test-length-with-too-many-outputs: exit status") -11837 # don't restore from ebp -11838 81 0/subop/add %esp 8/imm32 -11839 # . epilogue -11840 5d/pop-to-ebp -11841 c3/return -11842 -11843 test-convert-function-with-return-register-and-local: -11844 # . prologue -11845 55/push-ebp -11846 89/<- %ebp 4/r32/esp -11847 # setup -11848 (clear-stream _test-input-stream) -11849 (clear-stream $_test-input-buffered-file->buffer) -11850 (clear-stream _test-output-stream) -11851 (clear-stream $_test-output-buffered-file->buffer) -11852 # -11853 (write _test-input-stream "fn foo -> _/eax: int {\n") -11854 (write _test-input-stream " var y/eax: int <- copy 3\n") -11855 (write _test-input-stream " var z/ecx: int <- copy 4\n") -11856 (write _test-input-stream " return y\n") -11857 (write _test-input-stream "}\n") -11858 # convert -11859 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -11860 (flush _test-output-buffered-file) -11861 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -11867 # check output -11868 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-register-and-local/0") -11869 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-register-and-local/1") -11870 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-register-and-local/2") -11871 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-register-and-local/3") -11872 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-register-and-local/4") -11873 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-register-and-local/5") -11874 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-return-register-and-local/6") -11875 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-convert-function-with-return-register-and-local/7") -11876 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-return-register-and-local/8") -11877 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-convert-function-with-return-register-and-local/9") -11878 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-with-return-register-and-local/10") -11879 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-return-register-and-local/11") -11880 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-return-register-and-local/12") -11881 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-register-and-local/13") -11882 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-register-and-local/14") -11883 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-register-and-local/15") -11884 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-register-and-local/16") -11885 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-register-and-local/17") -11886 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-register-and-local/18") -11887 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-register-and-local/19") -11888 # . epilogue -11889 89/<- %esp 5/r32/ebp -11890 5d/pop-to-ebp -11891 c3/return -11892 -11893 test-convert-function-with-return-register-and-local-2: -11894 # . prologue -11895 55/push-ebp -11896 89/<- %ebp 4/r32/esp -11897 # setup -11898 (clear-stream _test-input-stream) -11899 (clear-stream $_test-input-buffered-file->buffer) -11900 (clear-stream _test-output-stream) -11901 (clear-stream $_test-output-buffered-file->buffer) -11902 # -11903 (write _test-input-stream "fn foo -> _/eax: int {\n") -11904 (write _test-input-stream " var y/eax: int <- copy 3\n") -11905 (write _test-input-stream " var z/ecx: int <- copy 4\n") -11906 (write _test-input-stream " return z\n") -11907 (write _test-input-stream "}\n") -11908 # convert -11909 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -11910 (flush _test-output-buffered-file) -11911 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -11917 # check output -11918 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-register-and-local-2/0") -11919 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-register-and-local-2/1") -11920 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-register-and-local-2/2") -11921 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-register-and-local-2/3") -11922 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-register-and-local-2/4") -11923 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-register-and-local-2/5") -11924 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-return-register-and-local-2/6") -11925 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-convert-function-with-return-register-and-local-2/7") -11926 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-return-register-and-local-2/8") -11927 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-convert-function-with-return-register-and-local-2/9") -11928 (check-next-stream-line-equal _test-output-stream " 8b/-> %ecx 0x00000000/r32" "F - test-convert-function-with-return-register-and-local-2/10") -11929 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-return-register-and-local-2/11") -11930 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-return-register-and-local-2/12") -11931 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-register-and-local-2/13") -11932 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-register-and-local-2/14") -11933 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-register-and-local-2/15") -11934 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-register-and-local-2/16") -11935 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-register-and-local-2/17") -11936 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-register-and-local-2/18") -11937 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-register-and-local-2/19") -11938 # . epilogue -11939 89/<- %esp 5/r32/ebp -11940 5d/pop-to-ebp -11941 c3/return -11942 -11943 test-convert-function-with-return-float-register-and-local: -11944 # . prologue -11945 55/push-ebp -11946 89/<- %ebp 4/r32/esp -11947 # setup -11948 (clear-stream _test-input-stream) -11949 (clear-stream $_test-input-buffered-file->buffer) -11950 (clear-stream _test-output-stream) -11951 (clear-stream $_test-output-buffered-file->buffer) -11952 # -11953 (write _test-input-stream "fn foo -> _/xmm1: float {\n") -11954 (write _test-input-stream " var y/eax: int <- copy 3\n") -11955 (write _test-input-stream " var g/xmm0: float <- convert y\n") -11956 (write _test-input-stream " var h/xmm1: float <- convert y\n") -11957 (write _test-input-stream " return g\n") -11958 (write _test-input-stream "}\n") -11959 # convert -11960 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -11961 (flush _test-output-buffered-file) -11962 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -11968 # check output -11969 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-float-register-and-local/0") -11970 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-float-register-and-local/1") -11971 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-float-register-and-local/2") -11972 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-float-register-and-local/3") -11973 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-float-register-and-local/4") -11974 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-float-register-and-local/5") -11975 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-return-float-register-and-local/6") # var y -11976 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-convert-function-with-return-float-register-and-local/7") -11977 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-function-with-return-float-register-and-local/8") # var g -11978 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 0/x32" "F - test-convert-function-with-return-float-register-and-local/9") -11979 (check-next-stream-line-equal _test-output-stream " f3 0f 2a/convert-to-float %eax 0x00000000/x32" "F - test-convert-function-with-return-float-register-and-local/10") -11980 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-function-with-return-float-register-and-local/11") # var h -11981 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-function-with-return-float-register-and-local/12") -11982 (check-next-stream-line-equal _test-output-stream " f3 0f 2a/convert-to-float %eax 0x00000001/x32" "F - test-convert-function-with-return-float-register-and-local/13") -11983 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> %xmm0 0x00000001/x32" "F - test-convert-function-with-return-float-register-and-local/14") # return g -11984 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-dereferenced/15") # reclaim h -11985 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 0/x32" "F - test-convert-floating-point-dereferenced/16") # reclaim g -11986 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-dereferenced/17") -11987 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-return-float-register-and-local/18") # reclaim y -11988 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-float-register-and-local/19") -11989 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-float-register-and-local/20") -11990 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-float-register-and-local/21") -11991 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-float-register-and-local/22") -11992 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-float-register-and-local/23") -11993 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-float-register-and-local/24") -11994 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-float-register-and-local/25") -11995 # . epilogue -11996 89/<- %esp 5/r32/ebp -11997 5d/pop-to-ebp -11998 c3/return -11999 -12000 test-convert-function-with-return-and-local-vars: -12001 # . prologue -12002 55/push-ebp -12003 89/<- %ebp 4/r32/esp -12004 # setup -12005 (clear-stream _test-input-stream) -12006 (clear-stream $_test-input-buffered-file->buffer) -12007 (clear-stream _test-output-stream) -12008 (clear-stream $_test-output-buffered-file->buffer) -12009 # -12010 (write _test-input-stream "fn foo -> _/eax: int {\n") -12011 (write _test-input-stream " {\n") -12012 (write _test-input-stream " var x: int\n") -12013 (write _test-input-stream " {\n") -12014 (write _test-input-stream " var y: int\n") -12015 (write _test-input-stream " return y\n") -12016 (write _test-input-stream " increment x\n") -12017 (write _test-input-stream " }\n") -12018 (write _test-input-stream " }\n") -12019 (write _test-input-stream " return 0\n") -12020 (write _test-input-stream "}\n") -12021 # convert -12022 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -12023 (flush _test-output-buffered-file) -12024 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -12030 # check output -12031 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-and-local-vars/0") -12032 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-and-local-vars/1") -12033 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-and-local-vars/2") -12034 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-and-local-vars/3") -12035 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-and-local-vars/4") -12036 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-and-local-vars/5") -12037 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-and-local-vars/6") -12038 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-return-and-local-vars/7") -12039 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-return-and-local-vars/8") # var x -12040 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-and-local-vars/9") -12041 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-return-and-local-vars/10") -12042 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-return-and-local-vars/11") # var y -12043 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0xfffffff8) 0x00000000/r32" "F - test-convert-function-with-return-and-local-vars/12") -12044 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-return-and-local-vars/13") -12045 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-return-and-local-vars/14") -12046 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-and-local-vars/15") -12047 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-and-local-vars/16") -12048 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-return-and-local-vars/17") -12049 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-return-and-local-vars/18") -12050 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-and-local-vars/19") -12051 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-return-and-local-vars/20") -12052 (check-next-stream-line-equal _test-output-stream " c7 0/subop/copy %eax 0/imm32" "F - test-convert-function-with-return-and-local-vars/21") -12053 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-and-local-vars/21") -12054 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-and-local-vars/21") -12055 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-and-local-vars/22") -12056 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-and-local-vars/23") -12057 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-and-local-vars/24") -12058 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-and-local-vars/25") -12059 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-and-local-vars/26") -12060 # . epilogue -12061 89/<- %esp 5/r32/ebp -12062 5d/pop-to-ebp -12063 c3/return -12064 -12065 test-copy-object-with-no-inout: -12066 # . prologue -12067 55/push-ebp -12068 89/<- %ebp 4/r32/esp -12069 # setup -12070 (clear-stream _test-input-stream) -12071 (clear-stream $_test-input-buffered-file->buffer) -12072 (clear-stream _test-output-stream) -12073 (clear-stream $_test-output-buffered-file->buffer) -12074 (clear-stream _test-error-stream) -12075 (clear-stream $_test-error-buffered-file->buffer) -12076 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12077 68/push 0/imm32 -12078 68/push 0/imm32 -12079 89/<- %edx 4/r32/esp -12080 (tailor-exit-descriptor %edx 0x10) -12081 # -12082 (write _test-input-stream "fn foo {\n") -12083 (write _test-input-stream " copy-object\n") -12084 (write _test-input-stream "}\n") -12085 # convert -12086 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12087 # registers except esp clobbered at this point -12088 # restore ed -12089 89/<- %edx 4/r32/esp -12090 (flush _test-output-buffered-file) -12091 (flush _test-error-buffered-file) -12092 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12098 # check output -12099 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-no-inout: output should be empty") -12100 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-object' must have two inouts" "F - test-copy-object-with-no-inout: error message") -12101 # check that stop(1) was called -12102 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-no-inout: exit status") -12103 # don't restore from ebp -12104 81 0/subop/add %esp 8/imm32 -12105 # . epilogue -12106 5d/pop-to-ebp -12107 c3/return -12108 -12109 test-copy-object-with-no-input: -12110 # . prologue -12111 55/push-ebp -12112 89/<- %ebp 4/r32/esp -12113 # setup -12114 (clear-stream _test-input-stream) -12115 (clear-stream $_test-input-buffered-file->buffer) -12116 (clear-stream _test-output-stream) -12117 (clear-stream $_test-output-buffered-file->buffer) -12118 (clear-stream _test-error-stream) -12119 (clear-stream $_test-error-buffered-file->buffer) -12120 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12121 68/push 0/imm32 -12122 68/push 0/imm32 -12123 89/<- %edx 4/r32/esp -12124 (tailor-exit-descriptor %edx 0x10) -12125 # -12126 (write _test-input-stream "fn foo {\n") -12127 (write _test-input-stream " var x: (addr int)\n") -12128 (write _test-input-stream " copy-object x\n") -12129 (write _test-input-stream "}\n") -12130 # convert -12131 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12132 # registers except esp clobbered at this point -12133 # restore ed -12134 89/<- %edx 4/r32/esp -12135 (flush _test-output-buffered-file) -12136 (flush _test-error-buffered-file) -12137 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12143 # check output -12144 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-no-input: output should be empty") -12145 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-object' must have two inouts" "F - test-copy-object-with-no-input: error message") -12146 # check that stop(1) was called -12147 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-no-input: exit status") -12148 # don't restore from ebp -12149 81 0/subop/add %esp 8/imm32 -12150 # . epilogue -12151 5d/pop-to-ebp -12152 c3/return -12153 -12154 test-copy-object-with-too-many-inouts: -12155 # . prologue -12156 55/push-ebp -12157 89/<- %ebp 4/r32/esp -12158 # setup -12159 (clear-stream _test-input-stream) -12160 (clear-stream $_test-input-buffered-file->buffer) -12161 (clear-stream _test-output-stream) -12162 (clear-stream $_test-output-buffered-file->buffer) -12163 (clear-stream _test-error-stream) -12164 (clear-stream $_test-error-buffered-file->buffer) -12165 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12166 68/push 0/imm32 -12167 68/push 0/imm32 -12168 89/<- %edx 4/r32/esp -12169 (tailor-exit-descriptor %edx 0x10) -12170 # -12171 (write _test-input-stream "fn foo {\n") -12172 (write _test-input-stream " var x: (addr boolean)\n") -12173 (write _test-input-stream " copy-object x, x, x\n") -12174 (write _test-input-stream "}\n") -12175 # convert -12176 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12177 # registers except esp clobbered at this point -12178 # restore ed -12179 89/<- %edx 4/r32/esp -12180 (flush _test-output-buffered-file) -12181 (flush _test-error-buffered-file) -12182 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12188 # check output -12189 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-too-many-inouts: output should be empty") -12190 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-object' must have two inouts" "F - test-copy-object-with-too-many-inouts: error message") -12191 # check that stop(1) was called -12192 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-too-many-inouts: exit status") -12193 # don't restore from ebp -12194 81 0/subop/add %esp 8/imm32 -12195 # . epilogue -12196 5d/pop-to-ebp -12197 c3/return -12198 -12199 test-copy-object-with-output: -12200 # . prologue -12201 55/push-ebp -12202 89/<- %ebp 4/r32/esp -12203 # setup -12204 (clear-stream _test-input-stream) -12205 (clear-stream $_test-input-buffered-file->buffer) -12206 (clear-stream _test-output-stream) -12207 (clear-stream $_test-output-buffered-file->buffer) -12208 (clear-stream _test-error-stream) -12209 (clear-stream $_test-error-buffered-file->buffer) -12210 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12211 68/push 0/imm32 -12212 68/push 0/imm32 -12213 89/<- %edx 4/r32/esp -12214 (tailor-exit-descriptor %edx 0x10) -12215 # -12216 (write _test-input-stream "fn foo {\n") -12217 (write _test-input-stream " var x/eax: (addr boolean) <- copy 0\n") -12218 (write _test-input-stream " var y/ecx: (addr boolean) <- copy 0\n") -12219 (write _test-input-stream " x <- copy-object x, y\n") -12220 (write _test-input-stream "}\n") -12221 # convert -12222 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12223 # registers except esp clobbered at this point -12224 # restore ed -12225 89/<- %edx 4/r32/esp -12226 (flush _test-output-buffered-file) -12227 (flush _test-error-buffered-file) -12228 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12234 # check output -12235 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-output: output should be empty") -12236 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-object' must not have any outputs" "F - test-copy-object-with-output: error message") -12237 # check that stop(1) was called -12238 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-output: exit status") -12239 # don't restore from ebp -12240 81 0/subop/add %esp 8/imm32 -12241 # . epilogue -12242 5d/pop-to-ebp -12243 c3/return -12244 -12245 test-copy-object-deref-address: -12246 # . prologue -12247 55/push-ebp -12248 89/<- %ebp 4/r32/esp -12249 # setup -12250 (clear-stream _test-input-stream) -12251 (clear-stream $_test-input-buffered-file->buffer) -12252 (clear-stream _test-output-stream) -12253 (clear-stream $_test-output-buffered-file->buffer) -12254 # -12255 (write _test-input-stream "fn foo {\n") -12256 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") -12257 (write _test-input-stream " var y/ecx: (addr addr int) <- copy 0\n") -12258 (write _test-input-stream " copy-object *y, x\n") -12259 (write _test-input-stream "}\n") -12260 # convert -12261 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -12262 (flush _test-output-buffered-file) -12263 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12269 # not bothering checking output -12270 (check-next-stream-line-equal _test-error-stream "" "F - test-copy-object-deref-address: error message") -12271 # . epilogue -12272 5d/pop-to-ebp -12273 c3/return -12274 -12275 test-copy-object-non-addr: -12276 # . prologue -12277 55/push-ebp -12278 89/<- %ebp 4/r32/esp -12279 # setup -12280 (clear-stream _test-input-stream) -12281 (clear-stream $_test-input-buffered-file->buffer) -12282 (clear-stream _test-output-stream) -12283 (clear-stream $_test-output-buffered-file->buffer) -12284 (clear-stream _test-error-stream) -12285 (clear-stream $_test-error-buffered-file->buffer) -12286 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12287 68/push 0/imm32 -12288 68/push 0/imm32 -12289 89/<- %edx 4/r32/esp -12290 (tailor-exit-descriptor %edx 0x10) -12291 # -12292 (write _test-input-stream "fn foo {\n") -12293 (write _test-input-stream " var x: int\n") -12294 (write _test-input-stream " var y: int\n") -12295 (write _test-input-stream " copy-object y, x\n") -12296 (write _test-input-stream "}\n") -12297 # convert -12298 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12299 # registers except esp clobbered at this point -12300 # restore ed -12301 89/<- %edx 4/r32/esp -12302 (flush _test-output-buffered-file) -12303 (flush _test-error-buffered-file) -12304 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12310 # check output -12311 (check-stream-equal _test-output-stream "" "F - test-copy-object-non-addr: output should be empty") -12312 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-object: two inouts with identical addr types expected" "F - test-copy-object-non-addr: error message") -12313 # check that stop(1) was called -12314 (check-ints-equal *(edx+4) 2 "F - test-copy-object-non-addr: exit status") -12315 # don't restore from ebp -12316 81 0/subop/add %esp 8/imm32 -12317 # . epilogue -12318 5d/pop-to-ebp -12319 c3/return -12320 -12321 test-copy-object-non-equal: -12322 # . prologue -12323 55/push-ebp -12324 89/<- %ebp 4/r32/esp -12325 # setup -12326 (clear-stream _test-input-stream) -12327 (clear-stream $_test-input-buffered-file->buffer) -12328 (clear-stream _test-output-stream) -12329 (clear-stream $_test-output-buffered-file->buffer) -12330 (clear-stream _test-error-stream) -12331 (clear-stream $_test-error-buffered-file->buffer) -12332 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12333 68/push 0/imm32 -12334 68/push 0/imm32 -12335 89/<- %edx 4/r32/esp -12336 (tailor-exit-descriptor %edx 0x10) -12337 # -12338 (write _test-input-stream "fn foo {\n") -12339 (write _test-input-stream " var x: (addr int)\n") -12340 (write _test-input-stream " var y: (addr boolean)\n") -12341 (write _test-input-stream " copy-object y, x\n") -12342 (write _test-input-stream "}\n") -12343 # convert -12344 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12345 # registers except esp clobbered at this point -12346 # restore ed -12347 89/<- %edx 4/r32/esp -12348 (flush _test-output-buffered-file) -12349 (flush _test-error-buffered-file) -12350 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12356 # check output -12357 (check-stream-equal _test-output-stream "" "F - test-copy-object-non-equal: output should be empty") -12358 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-object: two inouts with identical addr types expected" "F - test-copy-object-non-equal: error message") -12359 # check that stop(1) was called -12360 (check-ints-equal *(edx+4) 2 "F - test-copy-object-non-equal: exit status") -12361 # don't restore from ebp -12362 81 0/subop/add %esp 8/imm32 -12363 # . epilogue -12364 5d/pop-to-ebp -12365 c3/return -12366 -12367 test-allocate-with-no-inout: -12368 # . prologue -12369 55/push-ebp -12370 89/<- %ebp 4/r32/esp -12371 # setup -12372 (clear-stream _test-input-stream) -12373 (clear-stream $_test-input-buffered-file->buffer) -12374 (clear-stream _test-output-stream) -12375 (clear-stream $_test-output-buffered-file->buffer) -12376 (clear-stream _test-error-stream) -12377 (clear-stream $_test-error-buffered-file->buffer) -12378 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12379 68/push 0/imm32 -12380 68/push 0/imm32 -12381 89/<- %edx 4/r32/esp -12382 (tailor-exit-descriptor %edx 0x10) -12383 # -12384 (write _test-input-stream "fn foo {\n") -12385 (write _test-input-stream " allocate\n") -12386 (write _test-input-stream "}\n") -12387 # convert -12388 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12389 # registers except esp clobbered at this point -12390 # restore ed -12391 89/<- %edx 4/r32/esp -12392 (flush _test-output-buffered-file) -12393 (flush _test-error-buffered-file) -12394 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12400 # check output -12401 (check-stream-equal _test-output-stream "" "F - test-allocate-with-no-inout: output should be empty") -12402 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'allocate' must have a single inout" "F - test-allocate-with-no-inout: error message") -12403 # check that stop(1) was called -12404 (check-ints-equal *(edx+4) 2 "F - test-allocate-with-no-inout: exit status") -12405 # don't restore from ebp -12406 81 0/subop/add %esp 8/imm32 -12407 # . epilogue -12408 5d/pop-to-ebp -12409 c3/return -12410 -12411 test-allocate-with-too-many-inouts: -12412 # . prologue -12413 55/push-ebp -12414 89/<- %ebp 4/r32/esp -12415 # setup -12416 (clear-stream _test-input-stream) -12417 (clear-stream $_test-input-buffered-file->buffer) -12418 (clear-stream _test-output-stream) -12419 (clear-stream $_test-output-buffered-file->buffer) -12420 (clear-stream _test-error-stream) -12421 (clear-stream $_test-error-buffered-file->buffer) -12422 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12423 68/push 0/imm32 -12424 68/push 0/imm32 -12425 89/<- %edx 4/r32/esp -12426 (tailor-exit-descriptor %edx 0x10) -12427 # -12428 (write _test-input-stream "fn foo {\n") -12429 (write _test-input-stream " var x: (addr handle int)\n") -12430 (write _test-input-stream " allocate x, 0\n") -12431 (write _test-input-stream "}\n") -12432 # convert -12433 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12434 # registers except esp clobbered at this point -12435 # restore ed -12436 89/<- %edx 4/r32/esp -12437 (flush _test-output-buffered-file) -12438 (flush _test-error-buffered-file) -12439 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12445 # check output -12446 (check-stream-equal _test-output-stream "" "F - test-allocate-with-too-many-inouts: output should be empty") -12447 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'allocate' must have a single inout" "F - test-allocate-with-too-many-inouts: error message") -12448 # check that stop(1) was called -12449 (check-ints-equal *(edx+4) 2 "F - test-allocate-with-too-many-inouts: exit status") -12450 # don't restore from ebp -12451 81 0/subop/add %esp 8/imm32 -12452 # . epilogue -12453 5d/pop-to-ebp -12454 c3/return -12455 -12456 test-allocate-with-output: -12457 # . prologue -12458 55/push-ebp -12459 89/<- %ebp 4/r32/esp -12460 # setup -12461 (clear-stream _test-input-stream) -12462 (clear-stream $_test-input-buffered-file->buffer) -12463 (clear-stream _test-output-stream) -12464 (clear-stream $_test-output-buffered-file->buffer) -12465 (clear-stream _test-error-stream) -12466 (clear-stream $_test-error-buffered-file->buffer) -12467 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12468 68/push 0/imm32 -12469 68/push 0/imm32 -12470 89/<- %edx 4/r32/esp -12471 (tailor-exit-descriptor %edx 0x10) -12472 # -12473 (write _test-input-stream "fn foo {\n") -12474 (write _test-input-stream " var x/eax: boolean <- copy 0\n") -12475 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") -12476 (write _test-input-stream " x <- allocate y\n") -12477 (write _test-input-stream "}\n") -12478 # convert -12479 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12480 # registers except esp clobbered at this point -12481 # restore ed -12482 89/<- %edx 4/r32/esp -12483 (flush _test-output-buffered-file) -12484 (flush _test-error-buffered-file) -12485 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12491 # check output -12492 (check-stream-equal _test-output-stream "" "F - test-allocate-with-output: output should be empty") -12493 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'allocate' must not have any outputs" "F - test-allocate-with-output: error message") -12494 # check that stop(1) was called -12495 (check-ints-equal *(edx+4) 2 "F - test-allocate-with-output: exit status") -12496 # don't restore from ebp -12497 81 0/subop/add %esp 8/imm32 -12498 # . epilogue -12499 5d/pop-to-ebp -12500 c3/return -12501 -12502 test-allocate-non-addr: -12503 # . prologue -12504 55/push-ebp -12505 89/<- %ebp 4/r32/esp -12506 # setup -12507 (clear-stream _test-input-stream) -12508 (clear-stream $_test-input-buffered-file->buffer) -12509 (clear-stream _test-output-stream) -12510 (clear-stream $_test-output-buffered-file->buffer) -12511 (clear-stream _test-error-stream) -12512 (clear-stream $_test-error-buffered-file->buffer) -12513 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12514 68/push 0/imm32 -12515 68/push 0/imm32 -12516 89/<- %edx 4/r32/esp -12517 (tailor-exit-descriptor %edx 0x10) -12518 # -12519 (write _test-input-stream "fn foo {\n") -12520 (write _test-input-stream " var y/ecx: (handle int) <- copy 0\n") -12521 (write _test-input-stream " allocate y\n") -12522 (write _test-input-stream "}\n") -12523 # convert -12524 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12525 # registers except esp clobbered at this point -12526 # restore ed -12527 89/<- %edx 4/r32/esp -12528 (flush _test-output-buffered-file) -12529 (flush _test-error-buffered-file) -12530 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12536 # check output -12537 (check-stream-equal _test-output-stream "" "F - test-allocate-non-addr: output must be empty") -12538 (check-next-stream-line-equal _test-error-stream "fn foo: stmt allocate: inout 'y' must have type (addr handle ...)" "F - test-allocate-non-addr: error message") -12539 # check that stop(1) was called -12540 (check-ints-equal *(edx+4) 2 "F - test-allocate-non-addr: exit status") -12541 # don't restore from ebp -12542 81 0/subop/add %esp 8/imm32 -12543 # . epilogue -12544 5d/pop-to-ebp -12545 c3/return -12546 -12547 test-allocate-non-addr-handle: -12548 # . prologue -12549 55/push-ebp -12550 89/<- %ebp 4/r32/esp -12551 # setup -12552 (clear-stream _test-input-stream) -12553 (clear-stream $_test-input-buffered-file->buffer) -12554 (clear-stream _test-output-stream) -12555 (clear-stream $_test-output-buffered-file->buffer) -12556 (clear-stream _test-error-stream) -12557 (clear-stream $_test-error-buffered-file->buffer) -12558 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12559 68/push 0/imm32 -12560 68/push 0/imm32 -12561 89/<- %edx 4/r32/esp -12562 (tailor-exit-descriptor %edx 0x10) -12563 # -12564 (write _test-input-stream "fn foo {\n") -12565 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") -12566 (write _test-input-stream " allocate y\n") -12567 (write _test-input-stream "}\n") -12568 # convert -12569 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12570 # registers except esp clobbered at this point -12571 # restore ed -12572 89/<- %edx 4/r32/esp -12573 (flush _test-output-buffered-file) -12574 (flush _test-error-buffered-file) -12575 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12581 # check output -12582 (check-stream-equal _test-output-stream "" "F - test-allocate-non-addr-handle: output should be empty") -12583 (check-next-stream-line-equal _test-error-stream "fn foo: stmt allocate: inout 'y' must have type (addr handle ...)" "F - test-allocate-non-addr-handle: error message") -12584 # check that stop(1) was called -12585 (check-ints-equal *(edx+4) 2 "F - test-allocate-non-addr-handle: exit status") -12586 # don't restore from ebp -12587 81 0/subop/add %esp 8/imm32 -12588 # . epilogue -12589 5d/pop-to-ebp -12590 c3/return -12591 -12592 test-allocate-deref-address: -12593 # . prologue -12594 55/push-ebp -12595 89/<- %ebp 4/r32/esp -12596 # setup -12597 (clear-stream _test-input-stream) -12598 (clear-stream $_test-input-buffered-file->buffer) -12599 (clear-stream _test-output-stream) -12600 (clear-stream $_test-output-buffered-file->buffer) -12601 # -12602 (write _test-input-stream "fn foo {\n") -12603 (write _test-input-stream " var y/ecx: (addr addr handle int) <- copy 0\n") -12604 (write _test-input-stream " allocate *y\n") -12605 (write _test-input-stream "}\n") -12606 # convert -12607 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -12608 (flush _test-output-buffered-file) -12609 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12615 # not bothering checking output -12616 (check-next-stream-line-equal _test-error-stream "" "F - test-allocate-deref-address: error message") -12617 # . epilogue -12618 5d/pop-to-ebp -12619 c3/return -12620 -12621 test-populate-with-no-inout: -12622 # . prologue -12623 55/push-ebp -12624 89/<- %ebp 4/r32/esp -12625 # setup -12626 (clear-stream _test-input-stream) -12627 (clear-stream $_test-input-buffered-file->buffer) -12628 (clear-stream _test-output-stream) -12629 (clear-stream $_test-output-buffered-file->buffer) -12630 (clear-stream _test-error-stream) -12631 (clear-stream $_test-error-buffered-file->buffer) -12632 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12633 68/push 0/imm32 -12634 68/push 0/imm32 -12635 89/<- %edx 4/r32/esp -12636 (tailor-exit-descriptor %edx 0x10) -12637 # -12638 (write _test-input-stream "fn foo {\n") -12639 (write _test-input-stream " populate\n") -12640 (write _test-input-stream "}\n") -12641 # convert -12642 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12643 # registers except esp clobbered at this point -12644 # restore ed -12645 89/<- %edx 4/r32/esp -12646 (flush _test-output-buffered-file) -12647 (flush _test-error-buffered-file) -12648 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12654 # check output -12655 (check-stream-equal _test-output-stream "" "F - test-populate-with-no-inout: output should be empty") -12656 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate' must have two inouts" "F - test-populate-with-no-inout: error message") -12657 # check that stop(1) was called -12658 (check-ints-equal *(edx+4) 2 "F - test-populate-with-no-inout: exit status") -12659 # don't restore from ebp -12660 81 0/subop/add %esp 8/imm32 -12661 # . epilogue -12662 5d/pop-to-ebp -12663 c3/return -12664 -12665 test-populate-with-too-many-inouts: -12666 # . prologue -12667 55/push-ebp -12668 89/<- %ebp 4/r32/esp -12669 # setup -12670 (clear-stream _test-input-stream) -12671 (clear-stream $_test-input-buffered-file->buffer) -12672 (clear-stream _test-output-stream) -12673 (clear-stream $_test-output-buffered-file->buffer) -12674 (clear-stream _test-error-stream) -12675 (clear-stream $_test-error-buffered-file->buffer) -12676 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12677 68/push 0/imm32 -12678 68/push 0/imm32 -12679 89/<- %edx 4/r32/esp -12680 (tailor-exit-descriptor %edx 0x10) -12681 # -12682 (write _test-input-stream "fn foo {\n") -12683 (write _test-input-stream " var x: (addr handle int)\n") -12684 (write _test-input-stream " populate x, 3, 0\n") -12685 (write _test-input-stream "}\n") -12686 # convert -12687 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12688 # registers except esp clobbered at this point -12689 # restore ed -12690 89/<- %edx 4/r32/esp -12691 (flush _test-output-buffered-file) -12692 (flush _test-error-buffered-file) -12693 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12699 # check output -12700 (check-stream-equal _test-output-stream "" "F - test-populate-with-too-many-inouts: output should be empty") -12701 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate' must have two inouts" "F - test-populate-with-too-many-inouts: error message") -12702 # check that stop(1) was called -12703 (check-ints-equal *(edx+4) 2 "F - test-populate-with-too-many-inouts: exit status") -12704 # don't restore from ebp -12705 81 0/subop/add %esp 8/imm32 -12706 # . epilogue -12707 5d/pop-to-ebp -12708 c3/return -12709 -12710 test-populate-with-output: -12711 # . prologue -12712 55/push-ebp -12713 89/<- %ebp 4/r32/esp -12714 # setup -12715 (clear-stream _test-input-stream) -12716 (clear-stream $_test-input-buffered-file->buffer) -12717 (clear-stream _test-output-stream) -12718 (clear-stream $_test-output-buffered-file->buffer) -12719 (clear-stream _test-error-stream) -12720 (clear-stream $_test-error-buffered-file->buffer) -12721 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12722 68/push 0/imm32 -12723 68/push 0/imm32 -12724 89/<- %edx 4/r32/esp -12725 (tailor-exit-descriptor %edx 0x10) -12726 # -12727 (write _test-input-stream "fn foo {\n") -12728 (write _test-input-stream " var x/eax: boolean <- copy 0\n") -12729 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") -12730 (write _test-input-stream " x <- populate y\n") -12731 (write _test-input-stream "}\n") -12732 # convert -12733 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12734 # registers except esp clobbered at this point -12735 # restore ed -12736 89/<- %edx 4/r32/esp -12737 (flush _test-output-buffered-file) -12738 (flush _test-error-buffered-file) -12739 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12745 # check output -12746 (check-stream-equal _test-output-stream "" "F - test-populate-with-output: output should be empty") -12747 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate' must not have any outputs" "F - test-populate-with-output: error message") -12748 # check that stop(1) was called -12749 (check-ints-equal *(edx+4) 2 "F - test-populate-with-output: exit status") -12750 # don't restore from ebp -12751 81 0/subop/add %esp 8/imm32 -12752 # . epilogue -12753 5d/pop-to-ebp -12754 c3/return -12755 -12756 test-populate-non-addr: -12757 # . prologue -12758 55/push-ebp -12759 89/<- %ebp 4/r32/esp -12760 # setup -12761 (clear-stream _test-input-stream) -12762 (clear-stream $_test-input-buffered-file->buffer) -12763 (clear-stream _test-output-stream) -12764 (clear-stream $_test-output-buffered-file->buffer) -12765 (clear-stream _test-error-stream) -12766 (clear-stream $_test-error-buffered-file->buffer) -12767 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12768 68/push 0/imm32 -12769 68/push 0/imm32 -12770 89/<- %edx 4/r32/esp -12771 (tailor-exit-descriptor %edx 0x10) -12772 # -12773 (write _test-input-stream "fn foo {\n") -12774 (write _test-input-stream " var y/ecx: (handle int) <- copy 0\n") -12775 (write _test-input-stream " populate y, 3\n") -12776 (write _test-input-stream "}\n") -12777 # convert -12778 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12779 # registers except esp clobbered at this point -12780 # restore ed -12781 89/<- %edx 4/r32/esp -12782 (flush _test-output-buffered-file) -12783 (flush _test-error-buffered-file) -12784 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12790 # check output -12791 (check-stream-equal _test-output-stream "" "F - test-populate-non-addr: output must be empty") -12792 (check-next-stream-line-equal _test-error-stream "fn foo: stmt populate: first inout 'y' must have type (addr handle array ...)" "F - test-populate-non-addr: error message") -12793 # check that stop(1) was called -12794 (check-ints-equal *(edx+4) 2 "F - test-populate-non-addr: exit status") -12795 # don't restore from ebp -12796 81 0/subop/add %esp 8/imm32 -12797 # . epilogue -12798 5d/pop-to-ebp -12799 c3/return -12800 -12801 test-populate-non-addr-handle: -12802 # . prologue -12803 55/push-ebp -12804 89/<- %ebp 4/r32/esp -12805 # setup -12806 (clear-stream _test-input-stream) -12807 (clear-stream $_test-input-buffered-file->buffer) -12808 (clear-stream _test-output-stream) -12809 (clear-stream $_test-output-buffered-file->buffer) -12810 (clear-stream _test-error-stream) -12811 (clear-stream $_test-error-buffered-file->buffer) -12812 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12813 68/push 0/imm32 -12814 68/push 0/imm32 -12815 89/<- %edx 4/r32/esp -12816 (tailor-exit-descriptor %edx 0x10) -12817 # -12818 (write _test-input-stream "fn foo {\n") -12819 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") -12820 (write _test-input-stream " populate y, 3\n") -12821 (write _test-input-stream "}\n") -12822 # convert -12823 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12824 # registers except esp clobbered at this point -12825 # restore ed -12826 89/<- %edx 4/r32/esp -12827 (flush _test-output-buffered-file) -12828 (flush _test-error-buffered-file) -12829 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12835 # check output -12836 (check-stream-equal _test-output-stream "" "F - test-populate-non-addr-handle: output should be empty") -12837 (check-next-stream-line-equal _test-error-stream "fn foo: stmt populate: first inout 'y' must have type (addr handle array ...)" "F - test-populate-non-addr-handle: error message") -12838 # check that stop(1) was called -12839 (check-ints-equal *(edx+4) 2 "F - test-populate-non-addr-handle: exit status") -12840 # don't restore from ebp -12841 81 0/subop/add %esp 8/imm32 -12842 # . epilogue -12843 5d/pop-to-ebp -12844 c3/return -12845 -12846 test-populate-non-addr-handle-array: -12847 # . prologue -12848 55/push-ebp -12849 89/<- %ebp 4/r32/esp -12850 # setup -12851 (clear-stream _test-input-stream) -12852 (clear-stream $_test-input-buffered-file->buffer) -12853 (clear-stream _test-output-stream) -12854 (clear-stream $_test-output-buffered-file->buffer) -12855 (clear-stream _test-error-stream) -12856 (clear-stream $_test-error-buffered-file->buffer) -12857 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12858 68/push 0/imm32 -12859 68/push 0/imm32 -12860 89/<- %edx 4/r32/esp -12861 (tailor-exit-descriptor %edx 0x10) -12862 # -12863 (write _test-input-stream "fn foo {\n") -12864 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") -12865 (write _test-input-stream " populate y, 3\n") -12866 (write _test-input-stream "}\n") -12867 # convert -12868 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12869 # registers except esp clobbered at this point -12870 # restore ed -12871 89/<- %edx 4/r32/esp -12872 (flush _test-output-buffered-file) -12873 (flush _test-error-buffered-file) -12874 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12880 # check output -12881 (check-stream-equal _test-output-stream "" "F - test-populate-non-addr-handle-array: output should be empty") -12882 (check-next-stream-line-equal _test-error-stream "fn foo: stmt populate: first inout 'y' must have type (addr handle array ...)" "F - test-populate-non-addr-handle-array: error message") -12883 # check that stop(1) was called -12884 (check-ints-equal *(edx+4) 2 "F - test-populate-non-addr-handle-array: exit status") -12885 # don't restore from ebp -12886 81 0/subop/add %esp 8/imm32 -12887 # . epilogue -12888 5d/pop-to-ebp -12889 c3/return -12890 -12891 test-populate-deref-address: -12892 # . prologue -12893 55/push-ebp -12894 89/<- %ebp 4/r32/esp -12895 # setup -12896 (clear-stream _test-input-stream) -12897 (clear-stream $_test-input-buffered-file->buffer) -12898 (clear-stream _test-output-stream) -12899 (clear-stream $_test-output-buffered-file->buffer) -12900 # -12901 (write _test-input-stream "fn foo {\n") -12902 (write _test-input-stream " var y/ecx: (addr addr handle array int) <- copy 0\n") -12903 (write _test-input-stream " populate *y, 3\n") -12904 (write _test-input-stream "}\n") -12905 # convert -12906 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -12907 (flush _test-output-buffered-file) -12908 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12914 # not bothering checking output -12915 (check-next-stream-line-equal _test-error-stream "" "F - test-populate-deref-address: error message") +11643 (tailor-exit-descriptor %edx 0x10) +11644 # +11645 (write _test-input-stream "fn foo {\n") +11646 (write _test-input-stream " var a: (addr stream int)\n") +11647 (write _test-input-stream " var b: (addr int)\n") +11648 (write _test-input-stream " write-to-stream a, b, 0\n") +11649 (write _test-input-stream "}\n") +11650 # convert +11651 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11652 # registers except esp clobbered at this point +11653 # restore ed +11654 89/<- %edx 4/r32/esp +11655 (flush _test-output-buffered-file) +11656 (flush _test-error-buffered-file) +11657 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11663 # check output +11664 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-too-many-inouts: output should be empty") +11665 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: too many inouts (2 required)" "F - test-write-to-stream-with-too-many-inouts: error message") +11666 # check that stop(1) was called +11667 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-too-many-inouts: exit status") +11668 # don't restore from ebp +11669 81 0/subop/add %esp 8/imm32 +11670 # . epilogue +11671 5d/pop-to-ebp +11672 c3/return +11673 +11674 test-write-to-stream-with-output: +11675 # . prologue +11676 55/push-ebp +11677 89/<- %ebp 4/r32/esp +11678 # setup +11679 (clear-stream _test-input-stream) +11680 (clear-stream $_test-input-buffered-file->buffer) +11681 (clear-stream _test-output-stream) +11682 (clear-stream $_test-output-buffered-file->buffer) +11683 (clear-stream _test-error-stream) +11684 (clear-stream $_test-error-buffered-file->buffer) +11685 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11686 68/push 0/imm32 +11687 68/push 0/imm32 +11688 89/<- %edx 4/r32/esp +11689 (tailor-exit-descriptor %edx 0x10) +11690 # +11691 (write _test-input-stream "fn foo {\n") +11692 (write _test-input-stream " var a: (addr stream int)\n") +11693 (write _test-input-stream " var b/eax: (addr int) <- copy 0\n") +11694 (write _test-input-stream " b <- write-to-stream a, b\n") +11695 (write _test-input-stream "}\n") +11696 # convert +11697 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11698 # registers except esp clobbered at this point +11699 # restore ed +11700 89/<- %edx 4/r32/esp +11701 (flush _test-output-buffered-file) +11702 (flush _test-error-buffered-file) +11703 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11709 # check output +11710 (check-stream-equal _test-output-stream "" "F - test-write-to-stream-with-output: output should be empty") +11711 (check-next-stream-line-equal _test-error-stream "fn foo: stmt write-to-stream: unexpected output" "F - test-write-to-stream-with-output: error message") +11712 # check that stop(1) was called +11713 (check-ints-equal *(edx+4) 2 "F - test-write-to-stream-with-output: exit status") +11714 # don't restore from ebp +11715 81 0/subop/add %esp 8/imm32 +11716 # . epilogue +11717 5d/pop-to-ebp +11718 c3/return +11719 +11720 test-length-with-non-array-atom-base-type: +11721 # . prologue +11722 55/push-ebp +11723 89/<- %ebp 4/r32/esp +11724 # setup +11725 (clear-stream _test-input-stream) +11726 (clear-stream $_test-input-buffered-file->buffer) +11727 (clear-stream _test-output-stream) +11728 (clear-stream $_test-output-buffered-file->buffer) +11729 (clear-stream _test-error-stream) +11730 (clear-stream $_test-error-buffered-file->buffer) +11731 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11732 68/push 0/imm32 +11733 68/push 0/imm32 +11734 89/<- %edx 4/r32/esp +11735 (tailor-exit-descriptor %edx 0x10) +11736 # +11737 (write _test-input-stream "fn foo {\n") +11738 (write _test-input-stream " var a: int\n") +11739 (write _test-input-stream " var c/ecx: int <- length a\n") +11740 (write _test-input-stream "}\n") +11741 # convert +11742 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11743 # registers except esp clobbered at this point +11744 # restore ed +11745 89/<- %edx 4/r32/esp +11746 (flush _test-output-buffered-file) +11747 (flush _test-error-buffered-file) +11748 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11754 # check output +11755 (check-stream-equal _test-output-stream "" "F - test-length-with-non-array-atom-base-type: output should be empty") +11756 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: var 'a' is not an array" "F - test-length-with-non-array-atom-base-type: error message") +11757 # check that stop(1) was called +11758 (check-ints-equal *(edx+4) 2 "F - test-length-with-non-array-atom-base-type: exit status") +11759 # don't restore from ebp +11760 81 0/subop/add %esp 8/imm32 +11761 # . epilogue +11762 5d/pop-to-ebp +11763 c3/return +11764 +11765 test-length-with-non-array-compound-base-type: +11766 # . prologue +11767 55/push-ebp +11768 89/<- %ebp 4/r32/esp +11769 # setup +11770 (clear-stream _test-input-stream) +11771 (clear-stream $_test-input-buffered-file->buffer) +11772 (clear-stream _test-output-stream) +11773 (clear-stream $_test-output-buffered-file->buffer) +11774 (clear-stream _test-error-stream) +11775 (clear-stream $_test-error-buffered-file->buffer) +11776 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11777 68/push 0/imm32 +11778 68/push 0/imm32 +11779 89/<- %edx 4/r32/esp +11780 (tailor-exit-descriptor %edx 0x10) +11781 # +11782 (write _test-input-stream "fn foo {\n") +11783 (write _test-input-stream " var a: (handle int)\n") +11784 (write _test-input-stream " var c/ecx: (addr int) <- length a, 0\n") +11785 (write _test-input-stream "}\n") +11786 # convert +11787 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11788 # registers except esp clobbered at this point +11789 # restore ed +11790 89/<- %edx 4/r32/esp +11791 (flush _test-output-buffered-file) +11792 (flush _test-error-buffered-file) +11793 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11799 # check output +11800 (check-stream-equal _test-output-stream "" "F - test-length-with-non-array-compound-base-type: output should be empty") +11801 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: var 'a' is not an array" "F - test-length-with-non-array-compound-base-type: error message") +11802 # check that stop(1) was called +11803 (check-ints-equal *(edx+4) 2 "F - test-length-with-non-array-compound-base-type: exit status") +11804 # don't restore from ebp +11805 81 0/subop/add %esp 8/imm32 +11806 # . epilogue +11807 5d/pop-to-ebp +11808 c3/return +11809 +11810 test-length-with-non-array-compound-base-type-2: +11811 # . prologue +11812 55/push-ebp +11813 89/<- %ebp 4/r32/esp +11814 # setup +11815 (clear-stream _test-input-stream) +11816 (clear-stream $_test-input-buffered-file->buffer) +11817 (clear-stream _test-output-stream) +11818 (clear-stream $_test-output-buffered-file->buffer) +11819 (clear-stream _test-error-stream) +11820 (clear-stream $_test-error-buffered-file->buffer) +11821 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11822 68/push 0/imm32 +11823 68/push 0/imm32 +11824 89/<- %edx 4/r32/esp +11825 (tailor-exit-descriptor %edx 0x10) +11826 # +11827 (write _test-input-stream "fn foo {\n") +11828 (write _test-input-stream " var a: (addr int)\n") +11829 (write _test-input-stream " var c/ecx: (addr int) <- length a, 0\n") +11830 (write _test-input-stream "}\n") +11831 # convert +11832 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11833 # registers except esp clobbered at this point +11834 # restore ed +11835 89/<- %edx 4/r32/esp +11836 (flush _test-output-buffered-file) +11837 (flush _test-error-buffered-file) +11838 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11844 # check output +11845 (check-stream-equal _test-output-stream "" "F - test-length-with-non-array-compound-base-type-2: output should be empty") +11846 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: var 'a' is not an array" "F - test-length-with-non-array-compound-base-type-2: error message") +11847 # check that stop(1) was called +11848 (check-ints-equal *(edx+4) 2 "F - test-length-with-non-array-compound-base-type-2: exit status") +11849 # don't restore from ebp +11850 81 0/subop/add %esp 8/imm32 +11851 # . epilogue +11852 5d/pop-to-ebp +11853 c3/return +11854 +11855 test-length-with-array-atom-base-type: +11856 # . prologue +11857 55/push-ebp +11858 89/<- %ebp 4/r32/esp +11859 # setup +11860 (clear-stream _test-input-stream) +11861 (clear-stream $_test-input-buffered-file->buffer) +11862 (clear-stream _test-output-stream) +11863 (clear-stream $_test-output-buffered-file->buffer) +11864 (clear-stream _test-error-stream) +11865 (clear-stream $_test-error-buffered-file->buffer) +11866 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11867 68/push 0/imm32 +11868 68/push 0/imm32 +11869 89/<- %edx 4/r32/esp +11870 (tailor-exit-descriptor %edx 0x10) +11871 # +11872 (write _test-input-stream "fn foo {\n") +11873 (write _test-input-stream " var a: array\n") +11874 (write _test-input-stream " var c/ecx: (addr int) <- length a\n") +11875 (write _test-input-stream "}\n") +11876 # convert +11877 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11878 # registers except esp clobbered at this point +11879 # restore ed +11880 89/<- %edx 4/r32/esp +11881 (flush _test-output-buffered-file) +11882 (flush _test-error-buffered-file) +11883 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11889 # check output +11890 (check-stream-equal _test-output-stream "" "F - test-length-with-array-atom-base-type: output should be empty") +11891 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: array 'a' must specify the type of its elements" "F - test-length-with-array-atom-base-type: error message") +11892 # check that stop(1) was called +11893 (check-ints-equal *(edx+4) 2 "F - test-length-with-array-atom-base-type: exit status") +11894 # don't restore from ebp +11895 81 0/subop/add %esp 8/imm32 +11896 # . epilogue +11897 5d/pop-to-ebp +11898 c3/return +11899 +11900 test-length-with-addr-base-on-stack: +11901 # . prologue +11902 55/push-ebp +11903 89/<- %ebp 4/r32/esp +11904 # setup +11905 (clear-stream _test-input-stream) +11906 (clear-stream $_test-input-buffered-file->buffer) +11907 (clear-stream _test-output-stream) +11908 (clear-stream $_test-output-buffered-file->buffer) +11909 (clear-stream _test-error-stream) +11910 (clear-stream $_test-error-buffered-file->buffer) +11911 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11912 68/push 0/imm32 +11913 68/push 0/imm32 +11914 89/<- %edx 4/r32/esp +11915 (tailor-exit-descriptor %edx 0x10) +11916 # +11917 (write _test-input-stream "fn foo {\n") +11918 (write _test-input-stream " var a: (addr array int)\n") +11919 (write _test-input-stream " var c/ecx: (addr int) <- length a\n") +11920 (write _test-input-stream "}\n") +11921 # convert +11922 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11923 # registers except esp clobbered at this point +11924 # restore ed +11925 89/<- %edx 4/r32/esp +11926 (flush _test-output-buffered-file) +11927 (flush _test-error-buffered-file) +11928 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11934 # check output +11935 (check-stream-equal _test-output-stream "" "F - test-length-with-addr-base-on-stack: output should be empty") +11936 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: var 'a' is an addr to an array, and so must live in a register" "F - test-length-with-addr-base-on-stack: error message") +11937 # check that stop(1) was called +11938 (check-ints-equal *(edx+4) 2 "F - test-length-with-addr-base-on-stack: exit status") +11939 # don't restore from ebp +11940 81 0/subop/add %esp 8/imm32 +11941 # . epilogue +11942 5d/pop-to-ebp +11943 c3/return +11944 +11945 test-length-with-wrong-output-type: +11946 # . prologue +11947 55/push-ebp +11948 89/<- %ebp 4/r32/esp +11949 # setup +11950 (clear-stream _test-input-stream) +11951 (clear-stream $_test-input-buffered-file->buffer) +11952 (clear-stream _test-output-stream) +11953 (clear-stream $_test-output-buffered-file->buffer) +11954 (clear-stream _test-error-stream) +11955 (clear-stream $_test-error-buffered-file->buffer) +11956 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +11957 68/push 0/imm32 +11958 68/push 0/imm32 +11959 89/<- %edx 4/r32/esp +11960 (tailor-exit-descriptor %edx 0x10) +11961 # +11962 (write _test-input-stream "fn foo {\n") +11963 (write _test-input-stream " var a/ebx: (addr array boolean) <- copy 0\n") +11964 (write _test-input-stream " var o/edi: (addr int) <- length a\n") +11965 (write _test-input-stream "}\n") +11966 # convert +11967 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +11968 # registers except esp clobbered at this point +11969 # restore ed +11970 89/<- %edx 4/r32/esp +11971 (flush _test-output-buffered-file) +11972 (flush _test-error-buffered-file) +11973 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +11979 # check output +11980 (check-stream-equal _test-output-stream "" "F - test-length-with-wrong-output-type: output should be empty") +11981 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: output 'o' does not have the right type" "F - test-length-with-wrong-output-type: error message") +11982 # check that stop(1) was called +11983 (check-ints-equal *(edx+4) 2 "F - test-length-with-wrong-output-type: exit status") +11984 # don't restore from ebp +11985 81 0/subop/add %esp 8/imm32 +11986 # . epilogue +11987 5d/pop-to-ebp +11988 c3/return +11989 +11990 test-length-with-wrong-output-compound-type: +11991 # . prologue +11992 55/push-ebp +11993 89/<- %ebp 4/r32/esp +11994 # setup +11995 (clear-stream _test-input-stream) +11996 (clear-stream $_test-input-buffered-file->buffer) +11997 (clear-stream _test-output-stream) +11998 (clear-stream $_test-output-buffered-file->buffer) +11999 (clear-stream _test-error-stream) +12000 (clear-stream $_test-error-buffered-file->buffer) +12001 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12002 68/push 0/imm32 +12003 68/push 0/imm32 +12004 89/<- %edx 4/r32/esp +12005 (tailor-exit-descriptor %edx 0x10) +12006 # +12007 (write _test-input-stream "fn foo {\n") +12008 (write _test-input-stream " var a/ebx: (addr array handle boolean) <- copy 0\n") +12009 (write _test-input-stream " var o/edi: (addr handle int) <- length a\n") +12010 (write _test-input-stream "}\n") +12011 # convert +12012 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12013 # registers except esp clobbered at this point +12014 # restore ed +12015 89/<- %edx 4/r32/esp +12016 (flush _test-output-buffered-file) +12017 (flush _test-error-buffered-file) +12018 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12024 # check output +12025 (check-stream-equal _test-output-stream "" "F - test-length-with-wrong-output-compound-type: output should be empty") +12026 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: output 'o' does not have the right type" "F - test-length-with-wrong-output-compound-type: error message") +12027 # check that stop(1) was called +12028 (check-ints-equal *(edx+4) 2 "F - test-length-with-wrong-output-compound-type: exit status") +12029 # don't restore from ebp +12030 81 0/subop/add %esp 8/imm32 +12031 # . epilogue +12032 5d/pop-to-ebp +12033 c3/return +12034 +12035 test-length-with-no-inouts: +12036 # . prologue +12037 55/push-ebp +12038 89/<- %ebp 4/r32/esp +12039 # setup +12040 (clear-stream _test-input-stream) +12041 (clear-stream $_test-input-buffered-file->buffer) +12042 (clear-stream _test-output-stream) +12043 (clear-stream $_test-output-buffered-file->buffer) +12044 (clear-stream _test-error-stream) +12045 (clear-stream $_test-error-buffered-file->buffer) +12046 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12047 68/push 0/imm32 +12048 68/push 0/imm32 +12049 89/<- %edx 4/r32/esp +12050 (tailor-exit-descriptor %edx 0x10) +12051 # +12052 (write _test-input-stream "fn foo {\n") +12053 (write _test-input-stream " var c/ecx: int <- length\n") +12054 (write _test-input-stream "}\n") +12055 # convert +12056 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12057 # registers except esp clobbered at this point +12058 # restore ed +12059 89/<- %edx 4/r32/esp +12060 (flush _test-output-buffered-file) +12061 (flush _test-error-buffered-file) +12062 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12068 # check output +12069 (check-stream-equal _test-output-stream "" "F - test-length-with-no-inouts: output should be empty") +12070 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: too few inouts (1 required)" "F - test-length-with-no-inouts: error message") +12071 # check that stop(1) was called +12072 (check-ints-equal *(edx+4) 2 "F - test-length-with-no-inouts: exit status") +12073 # don't restore from ebp +12074 81 0/subop/add %esp 8/imm32 +12075 # . epilogue +12076 5d/pop-to-ebp +12077 c3/return +12078 +12079 test-length-with-too-many-inouts: +12080 # . prologue +12081 55/push-ebp +12082 89/<- %ebp 4/r32/esp +12083 # setup +12084 (clear-stream _test-input-stream) +12085 (clear-stream $_test-input-buffered-file->buffer) +12086 (clear-stream _test-output-stream) +12087 (clear-stream $_test-output-buffered-file->buffer) +12088 (clear-stream _test-error-stream) +12089 (clear-stream $_test-error-buffered-file->buffer) +12090 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12091 68/push 0/imm32 +12092 68/push 0/imm32 +12093 89/<- %edx 4/r32/esp +12094 (tailor-exit-descriptor %edx 0x10) +12095 # +12096 (write _test-input-stream "fn foo {\n") +12097 (write _test-input-stream " var a: (array int 3)\n") +12098 (write _test-input-stream " var c/ecx: int <- length a, 0, 0\n") +12099 (write _test-input-stream "}\n") +12100 # convert +12101 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12102 # registers except esp clobbered at this point +12103 # restore ed +12104 89/<- %edx 4/r32/esp +12105 (flush _test-output-buffered-file) +12106 (flush _test-error-buffered-file) +12107 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12113 # check output +12114 (check-stream-equal _test-output-stream "" "F - test-length-with-too-many-inouts: output should be empty") +12115 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: too many inouts (1 required)" "F - test-length-with-too-many-inouts: error message") +12116 # check that stop(1) was called +12117 (check-ints-equal *(edx+4) 2 "F - test-length-with-too-many-inouts: exit status") +12118 # don't restore from ebp +12119 81 0/subop/add %esp 8/imm32 +12120 # . epilogue +12121 5d/pop-to-ebp +12122 c3/return +12123 +12124 test-length-with-no-output: +12125 # . prologue +12126 55/push-ebp +12127 89/<- %ebp 4/r32/esp +12128 # setup +12129 (clear-stream _test-input-stream) +12130 (clear-stream $_test-input-buffered-file->buffer) +12131 (clear-stream _test-output-stream) +12132 (clear-stream $_test-output-buffered-file->buffer) +12133 (clear-stream _test-error-stream) +12134 (clear-stream $_test-error-buffered-file->buffer) +12135 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12136 68/push 0/imm32 +12137 68/push 0/imm32 +12138 89/<- %edx 4/r32/esp +12139 (tailor-exit-descriptor %edx 0x10) +12140 # +12141 (write _test-input-stream "fn foo {\n") +12142 (write _test-input-stream " var a: (array int 3)\n") +12143 (write _test-input-stream " length a\n") +12144 (write _test-input-stream "}\n") +12145 # convert +12146 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12147 # registers except esp clobbered at this point +12148 # restore ed +12149 89/<- %edx 4/r32/esp +12150 (flush _test-output-buffered-file) +12151 (flush _test-error-buffered-file) +12152 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12158 # check output +12159 (check-stream-equal _test-output-stream "" "F - test-length-with-no-output: output should be empty") +12160 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: must have an output" "F - test-length-with-no-output: error message") +12161 # check that stop(1) was called +12162 (check-ints-equal *(edx+4) 2 "F - test-length-with-no-output: exit status") +12163 # don't restore from ebp +12164 81 0/subop/add %esp 8/imm32 +12165 # . epilogue +12166 5d/pop-to-ebp +12167 c3/return +12168 +12169 test-length-with-too-many-outputs: +12170 # . prologue +12171 55/push-ebp +12172 89/<- %ebp 4/r32/esp +12173 # setup +12174 (clear-stream _test-input-stream) +12175 (clear-stream $_test-input-buffered-file->buffer) +12176 (clear-stream _test-output-stream) +12177 (clear-stream $_test-output-buffered-file->buffer) +12178 (clear-stream _test-error-stream) +12179 (clear-stream $_test-error-buffered-file->buffer) +12180 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12181 68/push 0/imm32 +12182 68/push 0/imm32 +12183 89/<- %edx 4/r32/esp +12184 (tailor-exit-descriptor %edx 0x10) +12185 # +12186 (write _test-input-stream "fn foo {\n") +12187 (write _test-input-stream " var a: (array int 3)\n") +12188 (write _test-input-stream " var b/eax: int <- copy 0\n") +12189 (write _test-input-stream " var c/ecx: int <- copy 0\n") +12190 (write _test-input-stream " b, c <- length a\n") +12191 (write _test-input-stream "}\n") +12192 # convert +12193 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12194 # registers except esp clobbered at this point +12195 # restore ed +12196 89/<- %edx 4/r32/esp +12197 (flush _test-output-buffered-file) +12198 (flush _test-error-buffered-file) +12199 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12205 # check output +12206 (check-stream-equal _test-output-stream "" "F - test-length-with-too-many-outputs: output should be empty") +12207 (check-next-stream-line-equal _test-error-stream "fn foo: stmt length: too many outputs (1 required)" "F - test-length-with-too-many-outputs: error message") +12208 # check that stop(1) was called +12209 (check-ints-equal *(edx+4) 2 "F - test-length-with-too-many-outputs: exit status") +12210 # don't restore from ebp +12211 81 0/subop/add %esp 8/imm32 +12212 # . epilogue +12213 5d/pop-to-ebp +12214 c3/return +12215 +12216 test-convert-function-with-return-register-and-local: +12217 # . prologue +12218 55/push-ebp +12219 89/<- %ebp 4/r32/esp +12220 # setup +12221 (clear-stream _test-input-stream) +12222 (clear-stream $_test-input-buffered-file->buffer) +12223 (clear-stream _test-output-stream) +12224 (clear-stream $_test-output-buffered-file->buffer) +12225 # +12226 (write _test-input-stream "fn foo -> _/eax: int {\n") +12227 (write _test-input-stream " var y/eax: int <- copy 3\n") +12228 (write _test-input-stream " var z/ecx: int <- copy 4\n") +12229 (write _test-input-stream " return y\n") +12230 (write _test-input-stream "}\n") +12231 # convert +12232 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +12233 (flush _test-output-buffered-file) +12234 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12240 # check output +12241 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-register-and-local/0") +12242 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-register-and-local/1") +12243 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-register-and-local/2") +12244 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-register-and-local/3") +12245 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-register-and-local/4") +12246 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-register-and-local/5") +12247 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-return-register-and-local/6") +12248 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-convert-function-with-return-register-and-local/7") +12249 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-return-register-and-local/8") +12250 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-convert-function-with-return-register-and-local/9") +12251 (check-next-stream-line-equal _test-output-stream " 8b/-> %eax 0x00000000/r32" "F - test-convert-function-with-return-register-and-local/10") +12252 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-return-register-and-local/11") +12253 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-return-register-and-local/12") +12254 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-register-and-local/13") +12255 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-register-and-local/14") +12256 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-register-and-local/15") +12257 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-register-and-local/16") +12258 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-register-and-local/17") +12259 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-register-and-local/18") +12260 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-register-and-local/19") +12261 # . epilogue +12262 89/<- %esp 5/r32/ebp +12263 5d/pop-to-ebp +12264 c3/return +12265 +12266 test-convert-function-with-return-register-and-local-2: +12267 # . prologue +12268 55/push-ebp +12269 89/<- %ebp 4/r32/esp +12270 # setup +12271 (clear-stream _test-input-stream) +12272 (clear-stream $_test-input-buffered-file->buffer) +12273 (clear-stream _test-output-stream) +12274 (clear-stream $_test-output-buffered-file->buffer) +12275 # +12276 (write _test-input-stream "fn foo -> _/eax: int {\n") +12277 (write _test-input-stream " var y/eax: int <- copy 3\n") +12278 (write _test-input-stream " var z/ecx: int <- copy 4\n") +12279 (write _test-input-stream " return z\n") +12280 (write _test-input-stream "}\n") +12281 # convert +12282 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +12283 (flush _test-output-buffered-file) +12284 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12290 # check output +12291 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-register-and-local-2/0") +12292 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-register-and-local-2/1") +12293 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-register-and-local-2/2") +12294 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-register-and-local-2/3") +12295 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-register-and-local-2/4") +12296 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-register-and-local-2/5") +12297 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-return-register-and-local-2/6") +12298 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-convert-function-with-return-register-and-local-2/7") +12299 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %ecx" "F - test-convert-function-with-return-register-and-local-2/8") +12300 (check-next-stream-line-equal _test-output-stream " b9/copy-to-ecx 4/imm32" "F - test-convert-function-with-return-register-and-local-2/9") +12301 (check-next-stream-line-equal _test-output-stream " 8b/-> %ecx 0x00000000/r32" "F - test-convert-function-with-return-register-and-local-2/10") +12302 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %ecx" "F - test-convert-function-with-return-register-and-local-2/11") +12303 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-function-with-return-register-and-local-2/12") +12304 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-register-and-local-2/13") +12305 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-register-and-local-2/14") +12306 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-register-and-local-2/15") +12307 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-register-and-local-2/16") +12308 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-register-and-local-2/17") +12309 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-register-and-local-2/18") +12310 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-register-and-local-2/19") +12311 # . epilogue +12312 89/<- %esp 5/r32/ebp +12313 5d/pop-to-ebp +12314 c3/return +12315 +12316 test-convert-function-with-return-float-register-and-local: +12317 # . prologue +12318 55/push-ebp +12319 89/<- %ebp 4/r32/esp +12320 # setup +12321 (clear-stream _test-input-stream) +12322 (clear-stream $_test-input-buffered-file->buffer) +12323 (clear-stream _test-output-stream) +12324 (clear-stream $_test-output-buffered-file->buffer) +12325 # +12326 (write _test-input-stream "fn foo -> _/xmm1: float {\n") +12327 (write _test-input-stream " var y/eax: int <- copy 3\n") +12328 (write _test-input-stream " var g/xmm0: float <- convert y\n") +12329 (write _test-input-stream " var h/xmm1: float <- convert y\n") +12330 (write _test-input-stream " return g\n") +12331 (write _test-input-stream "}\n") +12332 # convert +12333 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +12334 (flush _test-output-buffered-file) +12335 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12341 # check output +12342 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-float-register-and-local/0") +12343 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-float-register-and-local/1") +12344 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-float-register-and-local/2") +12345 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-float-register-and-local/3") +12346 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-float-register-and-local/4") +12347 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-float-register-and-local/5") +12348 (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-function-with-return-float-register-and-local/6") # var y +12349 (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 3/imm32" "F - test-convert-function-with-return-float-register-and-local/7") +12350 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-function-with-return-float-register-and-local/8") # var g +12351 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 0/x32" "F - test-convert-function-with-return-float-register-and-local/9") +12352 (check-next-stream-line-equal _test-output-stream " f3 0f 2a/convert-to-float %eax 0x00000000/x32" "F - test-convert-function-with-return-float-register-and-local/10") +12353 (check-next-stream-line-equal _test-output-stream " 81 5/subop/subtract %esp 4/imm32" "F - test-convert-function-with-return-float-register-and-local/11") # var h +12354 (check-next-stream-line-equal _test-output-stream " f3 0f 11/<- *esp 1/x32" "F - test-convert-function-with-return-float-register-and-local/12") +12355 (check-next-stream-line-equal _test-output-stream " f3 0f 2a/convert-to-float %eax 0x00000001/x32" "F - test-convert-function-with-return-float-register-and-local/13") +12356 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> %xmm0 0x00000001/x32" "F - test-convert-function-with-return-float-register-and-local/14") # return g +12357 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-dereferenced/15") # reclaim h +12358 (check-next-stream-line-equal _test-output-stream " f3 0f 10/-> *esp 0/x32" "F - test-convert-floating-point-dereferenced/16") # reclaim g +12359 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 4/imm32" "F - test-convert-floating-point-dereferenced/17") +12360 (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-function-with-return-float-register-and-local/18") # reclaim y +12361 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-float-register-and-local/19") +12362 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-float-register-and-local/20") +12363 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-float-register-and-local/21") +12364 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-float-register-and-local/22") +12365 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-float-register-and-local/23") +12366 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-float-register-and-local/24") +12367 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-float-register-and-local/25") +12368 # . epilogue +12369 89/<- %esp 5/r32/ebp +12370 5d/pop-to-ebp +12371 c3/return +12372 +12373 test-convert-function-with-return-and-local-vars: +12374 # . prologue +12375 55/push-ebp +12376 89/<- %ebp 4/r32/esp +12377 # setup +12378 (clear-stream _test-input-stream) +12379 (clear-stream $_test-input-buffered-file->buffer) +12380 (clear-stream _test-output-stream) +12381 (clear-stream $_test-output-buffered-file->buffer) +12382 # +12383 (write _test-input-stream "fn foo -> _/eax: int {\n") +12384 (write _test-input-stream " {\n") +12385 (write _test-input-stream " var x: int\n") +12386 (write _test-input-stream " {\n") +12387 (write _test-input-stream " var y: int\n") +12388 (write _test-input-stream " return y\n") +12389 (write _test-input-stream " increment x\n") +12390 (write _test-input-stream " }\n") +12391 (write _test-input-stream " }\n") +12392 (write _test-input-stream " return 0\n") +12393 (write _test-input-stream "}\n") +12394 # convert +12395 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +12396 (flush _test-output-buffered-file) +12397 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12403 # check output +12404 (check-next-stream-line-equal _test-output-stream "foo:" "F - test-convert-function-with-return-and-local-vars/0") +12405 (check-next-stream-line-equal _test-output-stream " # . prologue" "F - test-convert-function-with-return-and-local-vars/1") +12406 (check-next-stream-line-equal _test-output-stream " 55/push-ebp" "F - test-convert-function-with-return-and-local-vars/2") +12407 (check-next-stream-line-equal _test-output-stream " 89/<- %ebp 4/r32/esp" "F - test-convert-function-with-return-and-local-vars/3") +12408 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-and-local-vars/4") +12409 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-function-with-return-and-local-vars/5") +12410 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-and-local-vars/6") +12411 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:loop:" "F - test-convert-function-with-return-and-local-vars/7") +12412 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-return-and-local-vars/8") # var x +12413 (check-next-stream-line-equal _test-output-stream " {" "F - test-convert-function-with-return-and-local-vars/9") +12414 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:loop:" "F - test-convert-function-with-return-and-local-vars/10") +12415 (check-next-stream-line-equal _test-output-stream " 68/push 0/imm32" "F - test-convert-function-with-return-and-local-vars/11") # var y +12416 (check-next-stream-line-equal _test-output-stream " 8b/-> *(ebp+0xfffffff8) 0x00000000/r32" "F - test-convert-function-with-return-and-local-vars/12") +12417 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-return-and-local-vars/13") +12418 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-return-and-local-vars/14") +12419 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-and-local-vars/15") +12420 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-and-local-vars/16") +12421 (check-next-stream-line-equal _test-output-stream "$foo:0x00000003:break:" "F - test-convert-function-with-return-and-local-vars/17") +12422 (check-next-stream-line-equal _test-output-stream " 81 0/subop/add %esp 0x00000004/imm32" "F - test-convert-function-with-return-and-local-vars/18") +12423 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-and-local-vars/19") +12424 (check-next-stream-line-equal _test-output-stream "$foo:0x00000002:break:" "F - test-convert-function-with-return-and-local-vars/20") +12425 (check-next-stream-line-equal _test-output-stream " c7 0/subop/copy %eax 0/imm32" "F - test-convert-function-with-return-and-local-vars/21") +12426 (check-next-stream-line-equal _test-output-stream " e9/jump $foo:0x00000001:break/disp32" "F - test-convert-function-with-return-and-local-vars/21") +12427 (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-function-with-return-and-local-vars/21") +12428 (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:break:" "F - test-convert-function-with-return-and-local-vars/22") +12429 (check-next-stream-line-equal _test-output-stream " # . epilogue" "F - test-convert-function-with-return-and-local-vars/23") +12430 (check-next-stream-line-equal _test-output-stream " 89/<- %esp 5/r32/ebp" "F - test-convert-function-with-return-and-local-vars/24") +12431 (check-next-stream-line-equal _test-output-stream " 5d/pop-to-ebp" "F - test-convert-function-with-return-and-local-vars/25") +12432 (check-next-stream-line-equal _test-output-stream " c3/return" "F - test-convert-function-with-return-and-local-vars/26") +12433 # . epilogue +12434 89/<- %esp 5/r32/ebp +12435 5d/pop-to-ebp +12436 c3/return +12437 +12438 test-copy-object-with-no-inout: +12439 # . prologue +12440 55/push-ebp +12441 89/<- %ebp 4/r32/esp +12442 # setup +12443 (clear-stream _test-input-stream) +12444 (clear-stream $_test-input-buffered-file->buffer) +12445 (clear-stream _test-output-stream) +12446 (clear-stream $_test-output-buffered-file->buffer) +12447 (clear-stream _test-error-stream) +12448 (clear-stream $_test-error-buffered-file->buffer) +12449 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12450 68/push 0/imm32 +12451 68/push 0/imm32 +12452 89/<- %edx 4/r32/esp +12453 (tailor-exit-descriptor %edx 0x10) +12454 # +12455 (write _test-input-stream "fn foo {\n") +12456 (write _test-input-stream " copy-object\n") +12457 (write _test-input-stream "}\n") +12458 # convert +12459 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12460 # registers except esp clobbered at this point +12461 # restore ed +12462 89/<- %edx 4/r32/esp +12463 (flush _test-output-buffered-file) +12464 (flush _test-error-buffered-file) +12465 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12471 # check output +12472 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-no-inout: output should be empty") +12473 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-object' must have two inouts" "F - test-copy-object-with-no-inout: error message") +12474 # check that stop(1) was called +12475 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-no-inout: exit status") +12476 # don't restore from ebp +12477 81 0/subop/add %esp 8/imm32 +12478 # . epilogue +12479 5d/pop-to-ebp +12480 c3/return +12481 +12482 test-copy-object-with-no-input: +12483 # . prologue +12484 55/push-ebp +12485 89/<- %ebp 4/r32/esp +12486 # setup +12487 (clear-stream _test-input-stream) +12488 (clear-stream $_test-input-buffered-file->buffer) +12489 (clear-stream _test-output-stream) +12490 (clear-stream $_test-output-buffered-file->buffer) +12491 (clear-stream _test-error-stream) +12492 (clear-stream $_test-error-buffered-file->buffer) +12493 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12494 68/push 0/imm32 +12495 68/push 0/imm32 +12496 89/<- %edx 4/r32/esp +12497 (tailor-exit-descriptor %edx 0x10) +12498 # +12499 (write _test-input-stream "fn foo {\n") +12500 (write _test-input-stream " var x: (addr int)\n") +12501 (write _test-input-stream " copy-object x\n") +12502 (write _test-input-stream "}\n") +12503 # convert +12504 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12505 # registers except esp clobbered at this point +12506 # restore ed +12507 89/<- %edx 4/r32/esp +12508 (flush _test-output-buffered-file) +12509 (flush _test-error-buffered-file) +12510 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12516 # check output +12517 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-no-input: output should be empty") +12518 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-object' must have two inouts" "F - test-copy-object-with-no-input: error message") +12519 # check that stop(1) was called +12520 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-no-input: exit status") +12521 # don't restore from ebp +12522 81 0/subop/add %esp 8/imm32 +12523 # . epilogue +12524 5d/pop-to-ebp +12525 c3/return +12526 +12527 test-copy-object-with-too-many-inouts: +12528 # . prologue +12529 55/push-ebp +12530 89/<- %ebp 4/r32/esp +12531 # setup +12532 (clear-stream _test-input-stream) +12533 (clear-stream $_test-input-buffered-file->buffer) +12534 (clear-stream _test-output-stream) +12535 (clear-stream $_test-output-buffered-file->buffer) +12536 (clear-stream _test-error-stream) +12537 (clear-stream $_test-error-buffered-file->buffer) +12538 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12539 68/push 0/imm32 +12540 68/push 0/imm32 +12541 89/<- %edx 4/r32/esp +12542 (tailor-exit-descriptor %edx 0x10) +12543 # +12544 (write _test-input-stream "fn foo {\n") +12545 (write _test-input-stream " var x: (addr boolean)\n") +12546 (write _test-input-stream " copy-object x, x, x\n") +12547 (write _test-input-stream "}\n") +12548 # convert +12549 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12550 # registers except esp clobbered at this point +12551 # restore ed +12552 89/<- %edx 4/r32/esp +12553 (flush _test-output-buffered-file) +12554 (flush _test-error-buffered-file) +12555 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12561 # check output +12562 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-too-many-inouts: output should be empty") +12563 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-object' must have two inouts" "F - test-copy-object-with-too-many-inouts: error message") +12564 # check that stop(1) was called +12565 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-too-many-inouts: exit status") +12566 # don't restore from ebp +12567 81 0/subop/add %esp 8/imm32 +12568 # . epilogue +12569 5d/pop-to-ebp +12570 c3/return +12571 +12572 test-copy-object-with-output: +12573 # . prologue +12574 55/push-ebp +12575 89/<- %ebp 4/r32/esp +12576 # setup +12577 (clear-stream _test-input-stream) +12578 (clear-stream $_test-input-buffered-file->buffer) +12579 (clear-stream _test-output-stream) +12580 (clear-stream $_test-output-buffered-file->buffer) +12581 (clear-stream _test-error-stream) +12582 (clear-stream $_test-error-buffered-file->buffer) +12583 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12584 68/push 0/imm32 +12585 68/push 0/imm32 +12586 89/<- %edx 4/r32/esp +12587 (tailor-exit-descriptor %edx 0x10) +12588 # +12589 (write _test-input-stream "fn foo {\n") +12590 (write _test-input-stream " var x/eax: (addr boolean) <- copy 0\n") +12591 (write _test-input-stream " var y/ecx: (addr boolean) <- copy 0\n") +12592 (write _test-input-stream " x <- copy-object x, y\n") +12593 (write _test-input-stream "}\n") +12594 # convert +12595 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12596 # registers except esp clobbered at this point +12597 # restore ed +12598 89/<- %edx 4/r32/esp +12599 (flush _test-output-buffered-file) +12600 (flush _test-error-buffered-file) +12601 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12607 # check output +12608 (check-stream-equal _test-output-stream "" "F - test-copy-object-with-output: output should be empty") +12609 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'copy-object' must not have any outputs" "F - test-copy-object-with-output: error message") +12610 # check that stop(1) was called +12611 (check-ints-equal *(edx+4) 2 "F - test-copy-object-with-output: exit status") +12612 # don't restore from ebp +12613 81 0/subop/add %esp 8/imm32 +12614 # . epilogue +12615 5d/pop-to-ebp +12616 c3/return +12617 +12618 test-copy-object-deref-address: +12619 # . prologue +12620 55/push-ebp +12621 89/<- %ebp 4/r32/esp +12622 # setup +12623 (clear-stream _test-input-stream) +12624 (clear-stream $_test-input-buffered-file->buffer) +12625 (clear-stream _test-output-stream) +12626 (clear-stream $_test-output-buffered-file->buffer) +12627 # +12628 (write _test-input-stream "fn foo {\n") +12629 (write _test-input-stream " var x/eax: (addr int) <- copy 0\n") +12630 (write _test-input-stream " var y/ecx: (addr addr int) <- copy 0\n") +12631 (write _test-input-stream " copy-object *y, x\n") +12632 (write _test-input-stream "}\n") +12633 # convert +12634 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +12635 (flush _test-output-buffered-file) +12636 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12642 # not bothering checking output +12643 (check-next-stream-line-equal _test-error-stream "" "F - test-copy-object-deref-address: error message") +12644 # . epilogue +12645 5d/pop-to-ebp +12646 c3/return +12647 +12648 test-copy-object-non-addr: +12649 # . prologue +12650 55/push-ebp +12651 89/<- %ebp 4/r32/esp +12652 # setup +12653 (clear-stream _test-input-stream) +12654 (clear-stream $_test-input-buffered-file->buffer) +12655 (clear-stream _test-output-stream) +12656 (clear-stream $_test-output-buffered-file->buffer) +12657 (clear-stream _test-error-stream) +12658 (clear-stream $_test-error-buffered-file->buffer) +12659 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12660 68/push 0/imm32 +12661 68/push 0/imm32 +12662 89/<- %edx 4/r32/esp +12663 (tailor-exit-descriptor %edx 0x10) +12664 # +12665 (write _test-input-stream "fn foo {\n") +12666 (write _test-input-stream " var x: int\n") +12667 (write _test-input-stream " var y: int\n") +12668 (write _test-input-stream " copy-object y, x\n") +12669 (write _test-input-stream "}\n") +12670 # convert +12671 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12672 # registers except esp clobbered at this point +12673 # restore ed +12674 89/<- %edx 4/r32/esp +12675 (flush _test-output-buffered-file) +12676 (flush _test-error-buffered-file) +12677 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12683 # check output +12684 (check-stream-equal _test-output-stream "" "F - test-copy-object-non-addr: output should be empty") +12685 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-object: two inouts with identical addr types expected" "F - test-copy-object-non-addr: error message") +12686 # check that stop(1) was called +12687 (check-ints-equal *(edx+4) 2 "F - test-copy-object-non-addr: exit status") +12688 # don't restore from ebp +12689 81 0/subop/add %esp 8/imm32 +12690 # . epilogue +12691 5d/pop-to-ebp +12692 c3/return +12693 +12694 test-copy-object-non-equal: +12695 # . prologue +12696 55/push-ebp +12697 89/<- %ebp 4/r32/esp +12698 # setup +12699 (clear-stream _test-input-stream) +12700 (clear-stream $_test-input-buffered-file->buffer) +12701 (clear-stream _test-output-stream) +12702 (clear-stream $_test-output-buffered-file->buffer) +12703 (clear-stream _test-error-stream) +12704 (clear-stream $_test-error-buffered-file->buffer) +12705 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12706 68/push 0/imm32 +12707 68/push 0/imm32 +12708 89/<- %edx 4/r32/esp +12709 (tailor-exit-descriptor %edx 0x10) +12710 # +12711 (write _test-input-stream "fn foo {\n") +12712 (write _test-input-stream " var x: (addr int)\n") +12713 (write _test-input-stream " var y: (addr boolean)\n") +12714 (write _test-input-stream " copy-object y, x\n") +12715 (write _test-input-stream "}\n") +12716 # convert +12717 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12718 # registers except esp clobbered at this point +12719 # restore ed +12720 89/<- %edx 4/r32/esp +12721 (flush _test-output-buffered-file) +12722 (flush _test-error-buffered-file) +12723 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12729 # check output +12730 (check-stream-equal _test-output-stream "" "F - test-copy-object-non-equal: output should be empty") +12731 (check-next-stream-line-equal _test-error-stream "fn foo: stmt copy-object: two inouts with identical addr types expected" "F - test-copy-object-non-equal: error message") +12732 # check that stop(1) was called +12733 (check-ints-equal *(edx+4) 2 "F - test-copy-object-non-equal: exit status") +12734 # don't restore from ebp +12735 81 0/subop/add %esp 8/imm32 +12736 # . epilogue +12737 5d/pop-to-ebp +12738 c3/return +12739 +12740 test-allocate-with-no-inout: +12741 # . prologue +12742 55/push-ebp +12743 89/<- %ebp 4/r32/esp +12744 # setup +12745 (clear-stream _test-input-stream) +12746 (clear-stream $_test-input-buffered-file->buffer) +12747 (clear-stream _test-output-stream) +12748 (clear-stream $_test-output-buffered-file->buffer) +12749 (clear-stream _test-error-stream) +12750 (clear-stream $_test-error-buffered-file->buffer) +12751 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12752 68/push 0/imm32 +12753 68/push 0/imm32 +12754 89/<- %edx 4/r32/esp +12755 (tailor-exit-descriptor %edx 0x10) +12756 # +12757 (write _test-input-stream "fn foo {\n") +12758 (write _test-input-stream " allocate\n") +12759 (write _test-input-stream "}\n") +12760 # convert +12761 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12762 # registers except esp clobbered at this point +12763 # restore ed +12764 89/<- %edx 4/r32/esp +12765 (flush _test-output-buffered-file) +12766 (flush _test-error-buffered-file) +12767 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12773 # check output +12774 (check-stream-equal _test-output-stream "" "F - test-allocate-with-no-inout: output should be empty") +12775 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'allocate' must have a single inout" "F - test-allocate-with-no-inout: error message") +12776 # check that stop(1) was called +12777 (check-ints-equal *(edx+4) 2 "F - test-allocate-with-no-inout: exit status") +12778 # don't restore from ebp +12779 81 0/subop/add %esp 8/imm32 +12780 # . epilogue +12781 5d/pop-to-ebp +12782 c3/return +12783 +12784 test-allocate-with-too-many-inouts: +12785 # . prologue +12786 55/push-ebp +12787 89/<- %ebp 4/r32/esp +12788 # setup +12789 (clear-stream _test-input-stream) +12790 (clear-stream $_test-input-buffered-file->buffer) +12791 (clear-stream _test-output-stream) +12792 (clear-stream $_test-output-buffered-file->buffer) +12793 (clear-stream _test-error-stream) +12794 (clear-stream $_test-error-buffered-file->buffer) +12795 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12796 68/push 0/imm32 +12797 68/push 0/imm32 +12798 89/<- %edx 4/r32/esp +12799 (tailor-exit-descriptor %edx 0x10) +12800 # +12801 (write _test-input-stream "fn foo {\n") +12802 (write _test-input-stream " var x: (addr handle int)\n") +12803 (write _test-input-stream " allocate x, 0\n") +12804 (write _test-input-stream "}\n") +12805 # convert +12806 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12807 # registers except esp clobbered at this point +12808 # restore ed +12809 89/<- %edx 4/r32/esp +12810 (flush _test-output-buffered-file) +12811 (flush _test-error-buffered-file) +12812 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12818 # check output +12819 (check-stream-equal _test-output-stream "" "F - test-allocate-with-too-many-inouts: output should be empty") +12820 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'allocate' must have a single inout" "F - test-allocate-with-too-many-inouts: error message") +12821 # check that stop(1) was called +12822 (check-ints-equal *(edx+4) 2 "F - test-allocate-with-too-many-inouts: exit status") +12823 # don't restore from ebp +12824 81 0/subop/add %esp 8/imm32 +12825 # . epilogue +12826 5d/pop-to-ebp +12827 c3/return +12828 +12829 test-allocate-with-output: +12830 # . prologue +12831 55/push-ebp +12832 89/<- %ebp 4/r32/esp +12833 # setup +12834 (clear-stream _test-input-stream) +12835 (clear-stream $_test-input-buffered-file->buffer) +12836 (clear-stream _test-output-stream) +12837 (clear-stream $_test-output-buffered-file->buffer) +12838 (clear-stream _test-error-stream) +12839 (clear-stream $_test-error-buffered-file->buffer) +12840 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12841 68/push 0/imm32 +12842 68/push 0/imm32 +12843 89/<- %edx 4/r32/esp +12844 (tailor-exit-descriptor %edx 0x10) +12845 # +12846 (write _test-input-stream "fn foo {\n") +12847 (write _test-input-stream " var x/eax: boolean <- copy 0\n") +12848 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") +12849 (write _test-input-stream " x <- allocate y\n") +12850 (write _test-input-stream "}\n") +12851 # convert +12852 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12853 # registers except esp clobbered at this point +12854 # restore ed +12855 89/<- %edx 4/r32/esp +12856 (flush _test-output-buffered-file) +12857 (flush _test-error-buffered-file) +12858 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12864 # check output +12865 (check-stream-equal _test-output-stream "" "F - test-allocate-with-output: output should be empty") +12866 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'allocate' must not have any outputs" "F - test-allocate-with-output: error message") +12867 # check that stop(1) was called +12868 (check-ints-equal *(edx+4) 2 "F - test-allocate-with-output: exit status") +12869 # don't restore from ebp +12870 81 0/subop/add %esp 8/imm32 +12871 # . epilogue +12872 5d/pop-to-ebp +12873 c3/return +12874 +12875 test-allocate-non-addr: +12876 # . prologue +12877 55/push-ebp +12878 89/<- %ebp 4/r32/esp +12879 # setup +12880 (clear-stream _test-input-stream) +12881 (clear-stream $_test-input-buffered-file->buffer) +12882 (clear-stream _test-output-stream) +12883 (clear-stream $_test-output-buffered-file->buffer) +12884 (clear-stream _test-error-stream) +12885 (clear-stream $_test-error-buffered-file->buffer) +12886 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +12887 68/push 0/imm32 +12888 68/push 0/imm32 +12889 89/<- %edx 4/r32/esp +12890 (tailor-exit-descriptor %edx 0x10) +12891 # +12892 (write _test-input-stream "fn foo {\n") +12893 (write _test-input-stream " var y: (handle int)\n") +12894 (write _test-input-stream " allocate y\n") +12895 (write _test-input-stream "}\n") +12896 # convert +12897 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12898 # registers except esp clobbered at this point +12899 # restore ed +12900 89/<- %edx 4/r32/esp +12901 (flush _test-output-buffered-file) +12902 (flush _test-error-buffered-file) +12903 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12909 # check output +12910 (check-stream-equal _test-output-stream "" "F - test-allocate-non-addr: output must be empty") +12911 (check-next-stream-line-equal _test-error-stream "fn foo: stmt allocate: inout 'y' must have type (addr handle ...)" "F - test-allocate-non-addr: error message") +12912 # check that stop(1) was called +12913 (check-ints-equal *(edx+4) 2 "F - test-allocate-non-addr: exit status") +12914 # don't restore from ebp +12915 81 0/subop/add %esp 8/imm32 12916 # . epilogue 12917 5d/pop-to-ebp 12918 c3/return 12919 -12920 test-populate-stream-with-no-inout: +12920 test-allocate-non-addr-handle: 12921 # . prologue 12922 55/push-ebp 12923 89/<- %ebp 4/r32/esp @@ -11697,3904 +11702,3859 @@ if ('onhashchange' in window) { 12935 (tailor-exit-descriptor %edx 0x10) 12936 # 12937 (write _test-input-stream "fn foo {\n") -12938 (write _test-input-stream " populate-stream\n") -12939 (write _test-input-stream "}\n") -12940 # convert -12941 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12942 # registers except esp clobbered at this point -12943 # restore ed -12944 89/<- %edx 4/r32/esp -12945 (flush _test-output-buffered-file) -12946 (flush _test-error-buffered-file) -12947 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12953 # check output -12954 (check-stream-equal _test-output-stream "" "F - test-populate-stream-with-no-inout: output should be empty") -12955 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate-stream' must have two inouts" "F - test-populate-stream-with-no-inout: error message") -12956 # check that stop(1) was called -12957 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-with-no-inout: exit status") -12958 # don't restore from ebp -12959 81 0/subop/add %esp 8/imm32 -12960 # . epilogue -12961 5d/pop-to-ebp -12962 c3/return -12963 -12964 test-populate-stream-with-too-many-inouts: -12965 # . prologue -12966 55/push-ebp -12967 89/<- %ebp 4/r32/esp -12968 # setup -12969 (clear-stream _test-input-stream) -12970 (clear-stream $_test-input-buffered-file->buffer) -12971 (clear-stream _test-output-stream) -12972 (clear-stream $_test-output-buffered-file->buffer) -12973 (clear-stream _test-error-stream) -12974 (clear-stream $_test-error-buffered-file->buffer) -12975 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -12976 68/push 0/imm32 -12977 68/push 0/imm32 -12978 89/<- %edx 4/r32/esp -12979 (tailor-exit-descriptor %edx 0x10) -12980 # -12981 (write _test-input-stream "fn foo {\n") -12982 (write _test-input-stream " var x: (addr handle int)\n") -12983 (write _test-input-stream " populate-stream x, 3, 0\n") -12984 (write _test-input-stream "}\n") -12985 # convert -12986 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -12987 # registers except esp clobbered at this point -12988 # restore ed -12989 89/<- %edx 4/r32/esp -12990 (flush _test-output-buffered-file) -12991 (flush _test-error-buffered-file) -12992 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -12998 # check output -12999 (check-stream-equal _test-output-stream "" "F - test-populate-stream-with-too-many-inouts: output should be empty") -13000 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate-stream' must have two inouts" "F - test-populate-stream-with-too-many-inouts: error message") -13001 # check that stop(1) was called -13002 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-with-too-many-inouts: exit status") -13003 # don't restore from ebp -13004 81 0/subop/add %esp 8/imm32 -13005 # . epilogue -13006 5d/pop-to-ebp -13007 c3/return -13008 -13009 test-populate-stream-with-output: -13010 # . prologue -13011 55/push-ebp -13012 89/<- %ebp 4/r32/esp -13013 # setup -13014 (clear-stream _test-input-stream) -13015 (clear-stream $_test-input-buffered-file->buffer) -13016 (clear-stream _test-output-stream) -13017 (clear-stream $_test-output-buffered-file->buffer) -13018 (clear-stream _test-error-stream) -13019 (clear-stream $_test-error-buffered-file->buffer) -13020 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13021 68/push 0/imm32 -13022 68/push 0/imm32 -13023 89/<- %edx 4/r32/esp -13024 (tailor-exit-descriptor %edx 0x10) -13025 # -13026 (write _test-input-stream "fn foo {\n") -13027 (write _test-input-stream " var x/eax: boolean <- copy 0\n") -13028 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") -13029 (write _test-input-stream " x <- populate-stream y\n") -13030 (write _test-input-stream "}\n") -13031 # convert -13032 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13033 # registers except esp clobbered at this point -13034 # restore ed -13035 89/<- %edx 4/r32/esp -13036 (flush _test-output-buffered-file) -13037 (flush _test-error-buffered-file) -13038 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -13044 # check output -13045 (check-stream-equal _test-output-stream "" "F - test-populate-stream-with-output: output should be empty") -13046 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate-stream' must not have any outputs" "F - test-populate-stream-with-output: error message") -13047 # check that stop(1) was called -13048 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-with-output: exit status") -13049 # don't restore from ebp -13050 81 0/subop/add %esp 8/imm32 -13051 # . epilogue -13052 5d/pop-to-ebp -13053 c3/return -13054 -13055 test-populate-stream-non-addr: -13056 # . prologue -13057 55/push-ebp -13058 89/<- %ebp 4/r32/esp -13059 # setup -13060 (clear-stream _test-input-stream) -13061 (clear-stream $_test-input-buffered-file->buffer) -13062 (clear-stream _test-output-stream) -13063 (clear-stream $_test-output-buffered-file->buffer) -13064 (clear-stream _test-error-stream) -13065 (clear-stream $_test-error-buffered-file->buffer) -13066 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13067 68/push 0/imm32 -13068 68/push 0/imm32 -13069 89/<- %edx 4/r32/esp -13070 (tailor-exit-descriptor %edx 0x10) -13071 # -13072 (write _test-input-stream "fn foo {\n") -13073 (write _test-input-stream " var y/ecx: (handle int) <- copy 0\n") -13074 (write _test-input-stream " populate-stream y, 3\n") -13075 (write _test-input-stream "}\n") -13076 # convert -13077 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13078 # registers except esp clobbered at this point -13079 # restore ed -13080 89/<- %edx 4/r32/esp -13081 (flush _test-output-buffered-file) -13082 (flush _test-error-buffered-file) -13083 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -13089 # check output -13090 (check-stream-equal _test-output-stream "" "F - test-populate-stream-non-addr: output must be empty") -13091 (check-next-stream-line-equal _test-error-stream "fn foo: stmt populate-stream: first inout 'y' must have type (addr handle stream ...)" "F - test-populate-stream-non-addr: error message") -13092 # check that stop(1) was called -13093 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-non-addr: exit status") -13094 # don't restore from ebp -13095 81 0/subop/add %esp 8/imm32 -13096 # . epilogue -13097 5d/pop-to-ebp -13098 c3/return -13099 -13100 test-populate-stream-non-addr-handle: -13101 # . prologue -13102 55/push-ebp -13103 89/<- %ebp 4/r32/esp -13104 # setup -13105 (clear-stream _test-input-stream) -13106 (clear-stream $_test-input-buffered-file->buffer) -13107 (clear-stream _test-output-stream) -13108 (clear-stream $_test-output-buffered-file->buffer) -13109 (clear-stream _test-error-stream) -13110 (clear-stream $_test-error-buffered-file->buffer) -13111 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13112 68/push 0/imm32 -13113 68/push 0/imm32 -13114 89/<- %edx 4/r32/esp -13115 (tailor-exit-descriptor %edx 0x10) -13116 # -13117 (write _test-input-stream "fn foo {\n") -13118 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") -13119 (write _test-input-stream " populate-stream y, 3\n") -13120 (write _test-input-stream "}\n") -13121 # convert -13122 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13123 # registers except esp clobbered at this point -13124 # restore ed -13125 89/<- %edx 4/r32/esp -13126 (flush _test-output-buffered-file) -13127 (flush _test-error-buffered-file) -13128 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -13134 # check output -13135 (check-stream-equal _test-output-stream "" "F - test-populate-stream-non-addr-handle: output should be empty") -13136 (check-next-stream-line-equal _test-error-stream "fn foo: stmt populate-stream: first inout 'y' must have type (addr handle stream ...)" "F - test-populate-stream-non-addr-handle: error message") -13137 # check that stop(1) was called -13138 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-non-addr-handle: exit status") -13139 # don't restore from ebp -13140 81 0/subop/add %esp 8/imm32 -13141 # . epilogue -13142 5d/pop-to-ebp -13143 c3/return -13144 -13145 test-populate-stream-non-addr-handle-stream: -13146 # . prologue -13147 55/push-ebp -13148 89/<- %ebp 4/r32/esp -13149 # setup -13150 (clear-stream _test-input-stream) -13151 (clear-stream $_test-input-buffered-file->buffer) -13152 (clear-stream _test-output-stream) -13153 (clear-stream $_test-output-buffered-file->buffer) -13154 (clear-stream _test-error-stream) -13155 (clear-stream $_test-error-buffered-file->buffer) -13156 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) -13157 68/push 0/imm32 -13158 68/push 0/imm32 -13159 89/<- %edx 4/r32/esp -13160 (tailor-exit-descriptor %edx 0x10) -13161 # -13162 (write _test-input-stream "fn foo {\n") -13163 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") -13164 (write _test-input-stream " populate-stream y, 3\n") -13165 (write _test-input-stream "}\n") -13166 # convert -13167 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) -13168 # registers except esp clobbered at this point -13169 # restore ed -13170 89/<- %edx 4/r32/esp -13171 (flush _test-output-buffered-file) -13172 (flush _test-error-buffered-file) -13173 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -13179 # check output -13180 (check-stream-equal _test-output-stream "" "F - test-populate-stream-non-addr-handle-stream: output should be empty") -13181 (check-next-stream-line-equal _test-error-stream "fn foo: stmt populate-stream: first inout 'y' must have type (addr handle stream ...)" "F - test-populate-stream-non-addr-handle-stream: error message") -13182 # check that stop(1) was called -13183 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-non-addr-handle-stream: exit status") -13184 # don't restore from ebp -13185 81 0/subop/add %esp 8/imm32 -13186 # . epilogue -13187 5d/pop-to-ebp -13188 c3/return -13189 -13190 test-populate-stream-deref-address: -13191 # . prologue -13192 55/push-ebp -13193 89/<- %ebp 4/r32/esp -13194 # setup -13195 (clear-stream _test-input-stream) -13196 (clear-stream $_test-input-buffered-file->buffer) -13197 (clear-stream _test-output-stream) -13198 (clear-stream $_test-output-buffered-file->buffer) -13199 # -13200 (write _test-input-stream "fn foo {\n") -13201 (write _test-input-stream " var y/ecx: (addr addr handle stream int) <- copy 0\n") -13202 (write _test-input-stream " populate-stream *y, 3\n") -13203 (write _test-input-stream "}\n") -13204 # convert -13205 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) -13206 (flush _test-output-buffered-file) -13207 +-- 6 lines: #? # dump _test-error-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -13213 # not bothering checking output -13214 (check-next-stream-line-equal _test-error-stream "" "F - test-populate-stream-deref-address: error message") +12938 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") +12939 (write _test-input-stream " allocate y\n") +12940 (write _test-input-stream "}\n") +12941 # convert +12942 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +12943 # registers except esp clobbered at this point +12944 # restore ed +12945 89/<- %edx 4/r32/esp +12946 (flush _test-output-buffered-file) +12947 (flush _test-error-buffered-file) +12948 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12954 # check output +12955 (check-stream-equal _test-output-stream "" "F - test-allocate-non-addr-handle: output should be empty") +12956 (check-next-stream-line-equal _test-error-stream "fn foo: stmt allocate: inout 'y' must have type (addr handle ...)" "F - test-allocate-non-addr-handle: error message") +12957 # check that stop(1) was called +12958 (check-ints-equal *(edx+4) 2 "F - test-allocate-non-addr-handle: exit status") +12959 # don't restore from ebp +12960 81 0/subop/add %esp 8/imm32 +12961 # . epilogue +12962 5d/pop-to-ebp +12963 c3/return +12964 +12965 test-allocate-deref-address: +12966 # . prologue +12967 55/push-ebp +12968 89/<- %ebp 4/r32/esp +12969 # setup +12970 (clear-stream _test-input-stream) +12971 (clear-stream $_test-input-buffered-file->buffer) +12972 (clear-stream _test-output-stream) +12973 (clear-stream $_test-output-buffered-file->buffer) +12974 # +12975 (write _test-input-stream "fn foo {\n") +12976 (write _test-input-stream " var y/ecx: (addr addr handle int) <- copy 0\n") +12977 (write _test-input-stream " allocate *y\n") +12978 (write _test-input-stream "}\n") +12979 # convert +12980 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +12981 (flush _test-output-buffered-file) +12982 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +12988 # not bothering checking output +12989 (check-next-stream-line-equal _test-error-stream "" "F - test-allocate-deref-address: error message") +12990 # . epilogue +12991 5d/pop-to-ebp +12992 c3/return +12993 +12994 test-populate-with-no-inout: +12995 # . prologue +12996 55/push-ebp +12997 89/<- %ebp 4/r32/esp +12998 # setup +12999 (clear-stream _test-input-stream) +13000 (clear-stream $_test-input-buffered-file->buffer) +13001 (clear-stream _test-output-stream) +13002 (clear-stream $_test-output-buffered-file->buffer) +13003 (clear-stream _test-error-stream) +13004 (clear-stream $_test-error-buffered-file->buffer) +13005 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13006 68/push 0/imm32 +13007 68/push 0/imm32 +13008 89/<- %edx 4/r32/esp +13009 (tailor-exit-descriptor %edx 0x10) +13010 # +13011 (write _test-input-stream "fn foo {\n") +13012 (write _test-input-stream " populate\n") +13013 (write _test-input-stream "}\n") +13014 # convert +13015 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13016 # registers except esp clobbered at this point +13017 # restore ed +13018 89/<- %edx 4/r32/esp +13019 (flush _test-output-buffered-file) +13020 (flush _test-error-buffered-file) +13021 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +13027 # check output +13028 (check-stream-equal _test-output-stream "" "F - test-populate-with-no-inout: output should be empty") +13029 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate' must have two inouts" "F - test-populate-with-no-inout: error message") +13030 # check that stop(1) was called +13031 (check-ints-equal *(edx+4) 2 "F - test-populate-with-no-inout: exit status") +13032 # don't restore from ebp +13033 81 0/subop/add %esp 8/imm32 +13034 # . epilogue +13035 5d/pop-to-ebp +13036 c3/return +13037 +13038 test-populate-with-too-many-inouts: +13039 # . prologue +13040 55/push-ebp +13041 89/<- %ebp 4/r32/esp +13042 # setup +13043 (clear-stream _test-input-stream) +13044 (clear-stream $_test-input-buffered-file->buffer) +13045 (clear-stream _test-output-stream) +13046 (clear-stream $_test-output-buffered-file->buffer) +13047 (clear-stream _test-error-stream) +13048 (clear-stream $_test-error-buffered-file->buffer) +13049 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13050 68/push 0/imm32 +13051 68/push 0/imm32 +13052 89/<- %edx 4/r32/esp +13053 (tailor-exit-descriptor %edx 0x10) +13054 # +13055 (write _test-input-stream "fn foo {\n") +13056 (write _test-input-stream " var x: (addr handle int)\n") +13057 (write _test-input-stream " populate x, 3, 0\n") +13058 (write _test-input-stream "}\n") +13059 # convert +13060 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13061 # registers except esp clobbered at this point +13062 # restore ed +13063 89/<- %edx 4/r32/esp +13064 (flush _test-output-buffered-file) +13065 (flush _test-error-buffered-file) +13066 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +13072 # check output +13073 (check-stream-equal _test-output-stream "" "F - test-populate-with-too-many-inouts: output should be empty") +13074 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate' must have two inouts" "F - test-populate-with-too-many-inouts: error message") +13075 # check that stop(1) was called +13076 (check-ints-equal *(edx+4) 2 "F - test-populate-with-too-many-inouts: exit status") +13077 # don't restore from ebp +13078 81 0/subop/add %esp 8/imm32 +13079 # . epilogue +13080 5d/pop-to-ebp +13081 c3/return +13082 +13083 test-populate-with-output: +13084 # . prologue +13085 55/push-ebp +13086 89/<- %ebp 4/r32/esp +13087 # setup +13088 (clear-stream _test-input-stream) +13089 (clear-stream $_test-input-buffered-file->buffer) +13090 (clear-stream _test-output-stream) +13091 (clear-stream $_test-output-buffered-file->buffer) +13092 (clear-stream _test-error-stream) +13093 (clear-stream $_test-error-buffered-file->buffer) +13094 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13095 68/push 0/imm32 +13096 68/push 0/imm32 +13097 89/<- %edx 4/r32/esp +13098 (tailor-exit-descriptor %edx 0x10) +13099 # +13100 (write _test-input-stream "fn foo {\n") +13101 (write _test-input-stream " var x/eax: boolean <- copy 0\n") +13102 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") +13103 (write _test-input-stream " x <- populate y\n") +13104 (write _test-input-stream "}\n") +13105 # convert +13106 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13107 # registers except esp clobbered at this point +13108 # restore ed +13109 89/<- %edx 4/r32/esp +13110 (flush _test-output-buffered-file) +13111 (flush _test-error-buffered-file) +13112 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +13118 # check output +13119 (check-stream-equal _test-output-stream "" "F - test-populate-with-output: output should be empty") +13120 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate' must not have any outputs" "F - test-populate-with-output: error message") +13121 # check that stop(1) was called +13122 (check-ints-equal *(edx+4) 2 "F - test-populate-with-output: exit status") +13123 # don't restore from ebp +13124 81 0/subop/add %esp 8/imm32 +13125 # . epilogue +13126 5d/pop-to-ebp +13127 c3/return +13128 +13129 test-populate-non-addr: +13130 # . prologue +13131 55/push-ebp +13132 89/<- %ebp 4/r32/esp +13133 # setup +13134 (clear-stream _test-input-stream) +13135 (clear-stream $_test-input-buffered-file->buffer) +13136 (clear-stream _test-output-stream) +13137 (clear-stream $_test-output-buffered-file->buffer) +13138 (clear-stream _test-error-stream) +13139 (clear-stream $_test-error-buffered-file->buffer) +13140 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13141 68/push 0/imm32 +13142 68/push 0/imm32 +13143 89/<- %edx 4/r32/esp +13144 (tailor-exit-descriptor %edx 0x10) +13145 # +13146 (write _test-input-stream "fn foo {\n") +13147 (write _test-input-stream " var y: (handle int)\n") +13148 (write _test-input-stream " populate y, 3\n") +13149 (write _test-input-stream "}\n") +13150 # convert +13151 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13152 # registers except esp clobbered at this point +13153 # restore ed +13154 89/<- %edx 4/r32/esp +13155 (flush _test-output-buffered-file) +13156 (flush _test-error-buffered-file) +13157 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +13163 # check output +13164 (check-stream-equal _test-output-stream "" "F - test-populate-non-addr: output must be empty") +13165 (check-next-stream-line-equal _test-error-stream "fn foo: stmt populate: first inout 'y' must have type (addr handle array ...)" "F - test-populate-non-addr: error message") +13166 # check that stop(1) was called +13167 (check-ints-equal *(edx+4) 2 "F - test-populate-non-addr: exit status") +13168 # don't restore from ebp +13169 81 0/subop/add %esp 8/imm32 +13170 # . epilogue +13171 5d/pop-to-ebp +13172 c3/return +13173 +13174 test-populate-non-addr-handle: +13175 # . prologue +13176 55/push-ebp +13177 89/<- %ebp 4/r32/esp +13178 # setup +13179 (clear-stream _test-input-stream) +13180 (clear-stream $_test-input-buffered-file->buffer) +13181 (clear-stream _test-output-stream) +13182 (clear-stream $_test-output-buffered-file->buffer) +13183 (clear-stream _test-error-stream) +13184 (clear-stream $_test-error-buffered-file->buffer) +13185 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13186 68/push 0/imm32 +13187 68/push 0/imm32 +13188 89/<- %edx 4/r32/esp +13189 (tailor-exit-descriptor %edx 0x10) +13190 # +13191 (write _test-input-stream "fn foo {\n") +13192 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") +13193 (write _test-input-stream " populate y, 3\n") +13194 (write _test-input-stream "}\n") +13195 # convert +13196 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13197 # registers except esp clobbered at this point +13198 # restore ed +13199 89/<- %edx 4/r32/esp +13200 (flush _test-output-buffered-file) +13201 (flush _test-error-buffered-file) +13202 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +13208 # check output +13209 (check-stream-equal _test-output-stream "" "F - test-populate-non-addr-handle: output should be empty") +13210 (check-next-stream-line-equal _test-error-stream "fn foo: stmt populate: first inout 'y' must have type (addr handle array ...)" "F - test-populate-non-addr-handle: error message") +13211 # check that stop(1) was called +13212 (check-ints-equal *(edx+4) 2 "F - test-populate-non-addr-handle: exit status") +13213 # don't restore from ebp +13214 81 0/subop/add %esp 8/imm32 13215 # . epilogue 13216 5d/pop-to-ebp 13217 c3/return 13218 -13219 ####################################################### -13220 # Parsing -13221 ####################################################### -13222 -13223 == data -13224 -13225 # Global state added to each var record when parsing a function -13226 Next-block-index: # (addr int) -13227 1/imm32 -13228 -13229 Curr-block-depth: # (addr int) -13230 1/imm32 -13231 -13232 == code -13233 -13234 parse-mu: # in: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) -13235 # pseudocode -13236 # var curr-function: (addr handle function) = Program->functions -13237 # var curr-signature: (addr handle function) = Program->signatures -13238 # var curr-type: (addr handle typeinfo) = Program->types -13239 # var line: (stream byte 512) -13240 # var word-slice: slice -13241 # while true # line loop -13242 # clear-stream(line) -13243 # read-line-buffered(in, line) -13244 # if (line->write == 0) break # end of file -13245 # word-slice = next-mu-token(line) -13246 # if slice-empty?(word-slice) # end of line -13247 # continue -13248 # else if slice-starts-with?(word-slice, "#") # comment -13249 # continue # end of line -13250 # else if slice-equal?(word-slice, "fn") -13251 # var new-function: (handle function) = allocate(function) -13252 # var vars: (stack live-var 256) -13253 # populate-mu-function-header(line, new-function, vars) -13254 # populate-mu-function-body(in, new-function, vars) -13255 # assert(vars->top == 0) -13256 # *curr-function = new-function -13257 # curr-function = &new-function->next -13258 # else if slice-equal?(word-slice, "sig") -13259 # var new-function: (handle function) = allocate(function) -13260 # populate-mu-function-signature(line, new-function) -13261 # *curr-signature = new-function -13262 # curr-signature = &new-function->next -13263 # else if slice-equal?(word-slice, "type") -13264 # word-slice = next-mu-token(line) -13265 # type-id = pos-or-insert-slice(Type-id, word-slice) -13266 # var new-type: (handle typeinfo) = find-or-create-typeinfo(type-id) -13267 # assert(next-word(line) == "{") -13268 # populate-mu-type(in, new-type) -13269 # else -13270 # abort() -13271 # -13272 # . prologue -13273 55/push-ebp -13274 89/<- %ebp 4/r32/esp -13275 # var curr-signature: (addr handle function) at *(ebp-4) -13276 68/push _Program-signatures/imm32 -13277 # . save registers -13278 50/push-eax -13279 51/push-ecx -13280 52/push-edx -13281 53/push-ebx -13282 56/push-esi -13283 57/push-edi -13284 # var line/ecx: (stream byte 512) -13285 81 5/subop/subtract %esp 0x200/imm32 -13286 68/push 0x200/imm32/size -13287 68/push 0/imm32/read -13288 68/push 0/imm32/write -13289 89/<- %ecx 4/r32/esp -13290 # var word-slice/edx: slice -13291 68/push 0/imm32/end -13292 68/push 0/imm32/start -13293 89/<- %edx 4/r32/esp -13294 # var curr-function/edi: (addr handle function) -13295 bf/copy-to-edi _Program-functions/imm32 -13296 # var vars/ebx: (stack live-var 256) -13297 81 5/subop/subtract %esp 0xc00/imm32 -13298 68/push 0xc00/imm32/size -13299 68/push 0/imm32/top -13300 89/<- %ebx 4/r32/esp -13301 { -13302 $parse-mu:line-loop: -13303 (clear-stream %ecx) -13304 (read-line-buffered *(ebp+8) %ecx) -13305 # if (line->write == 0) break -13306 81 7/subop/compare *ecx 0/imm32 -13307 0f 84/jump-if-= break/disp32 -13308 +-- 6 lines: #? # dump line ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -13314 (next-mu-token %ecx %edx) -13315 # if slice-empty?(word-slice) continue -13316 (slice-empty? %edx) # => eax -13317 3d/compare-eax-and 0/imm32/false -13318 0f 85/jump-if-!= loop/disp32 -13319 # if (*word-slice->start == "#") continue -13320 # . eax = *word-slice->start -13321 8b/-> *edx 0/r32/eax -13322 8a/copy-byte *eax 0/r32/AL -13323 81 4/subop/and %eax 0xff/imm32 -13324 # . if (eax == '#') continue -13325 3d/compare-eax-and 0x23/imm32/hash -13326 0f 84/jump-if-= loop/disp32 -13327 # if (slice-equal?(word-slice, "fn")) parse a function -13328 { -13329 $parse-mu:fn: -13330 (slice-equal? %edx "fn") # => eax -13331 3d/compare-eax-and 0/imm32/false -13332 0f 84/jump-if-= break/disp32 -13333 # var new-function/esi: (handle function) -13334 68/push 0/imm32 -13335 68/push 0/imm32 -13336 89/<- %esi 4/r32/esp -13337 # populate-mu-function(line, in, vars, new-function) -13338 (allocate Heap *Function-size %esi) -13339 # var new-function-addr/eax: (addr function) -13340 (lookup *esi *(esi+4)) # => eax -13341 # initialize vars -13342 (clear-stack %ebx) -13343 # -13344 (populate-mu-function-header %ecx %eax %ebx *(ebp+0xc) *(ebp+0x10)) -13345 (populate-mu-function-body *(ebp+8) %eax %ebx *(ebp+0xc) *(ebp+0x10)) -13346 # *curr-function = new-function -13347 8b/-> *esi 0/r32/eax -13348 89/<- *edi 0/r32/eax -13349 8b/-> *(esi+4) 0/r32/eax -13350 89/<- *(edi+4) 0/r32/eax -13351 # curr-function = &new-function->next -13352 # . var tmp/eax: (addr function) = lookup(new-function) -13353 (lookup *esi *(esi+4)) # => eax -13354 # . curr-function = &tmp->next -13355 8d/copy-address *(eax+0x20) 7/r32/edi # Function-next -13356 # reclaim new-function -13357 81 0/subop/add %esp 8/imm32 -13358 # -13359 e9/jump $parse-mu:line-loop/disp32 -13360 } -13361 # if (slice-equal?(word-slice, "sig")) parse a function signature -13362 # Function signatures are for providing types to SubX functions. -13363 { -13364 $parse-mu:sig: -13365 (slice-equal? %edx "sig") # => eax -13366 3d/compare-eax-and 0/imm32/false -13367 0f 84/jump-if-= break/disp32 -13368 # edi = curr-function -13369 57/push-edi -13370 8b/-> *(ebp-4) 7/r32/edi -13371 # var new-function/esi: (handle function) -13372 68/push 0/imm32 -13373 68/push 0/imm32 -13374 89/<- %esi 4/r32/esp -13375 # populate-mu-function(line, in, vars, new-function) -13376 (allocate Heap *Function-size %esi) -13377 # var new-function-addr/eax: (addr function) -13378 (lookup *esi *(esi+4)) # => eax -13379 # -13380 (populate-mu-function-signature %ecx %eax *(ebp+0xc) *(ebp+0x10)) -13381 # *curr-signature = new-function -13382 8b/-> *esi 0/r32/eax -13383 89/<- *edi 0/r32/eax -13384 8b/-> *(esi+4) 0/r32/eax -13385 89/<- *(edi+4) 0/r32/eax -13386 # curr-signature = &new-function->next -13387 # . var tmp/eax: (addr function) = lookup(new-function) -13388 (lookup *esi *(esi+4)) # => eax -13389 # . curr-function = &tmp->next -13390 8d/copy-address *(eax+0x20) 7/r32/edi # Function-next -13391 # reclaim new-function -13392 81 0/subop/add %esp 8/imm32 -13393 # save curr-function -13394 89/<- *(ebp-4) 7/r32/edi -13395 # restore edi -13396 5f/pop-to-edi -13397 # -13398 e9/jump $parse-mu:line-loop/disp32 -13399 } -13400 # if (slice-equal?(word-slice, "type")) parse a type (struct/record) definition -13401 { -13402 $parse-mu:type: -13403 (slice-equal? %edx "type") # => eax -13404 3d/compare-eax-and 0/imm32 -13405 0f 84/jump-if-= break/disp32 -13406 (next-mu-token %ecx %edx) -13407 # var type-id/eax: int -13408 (pos-or-insert-slice Type-id %edx) # => eax -13409 # spill -13410 51/push-ecx -13411 # var new-type/ecx: (handle typeinfo) -13412 68/push 0/imm32 -13413 68/push 0/imm32 -13414 89/<- %ecx 4/r32/esp -13415 (find-or-create-typeinfo %eax %ecx) -13416 # -13417 (lookup *ecx *(ecx+4)) # => eax -13418 # TODO: ensure that 'line' has nothing else but '{' -13419 #? (dump-typeinfos "=== aaa\n") -13420 (populate-mu-type *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10)) # => eax -13421 #? (dump-typeinfos "=== zzz\n") -13422 # reclaim new-type -13423 81 0/subop/add %esp 8/imm32 -13424 # restore -13425 59/pop-to-ecx -13426 e9/jump $parse-mu:line-loop/disp32 -13427 } -13428 # otherwise abort -13429 e9/jump $parse-mu:error1/disp32 -13430 } # end line loop -13431 $parse-mu:end: -13432 # . reclaim locals -13433 81 0/subop/add %esp 0x20c/imm32 # line -13434 81 0/subop/add %esp 0xc08/imm32 # vars -13435 81 0/subop/add %esp 8/imm32 -13436 # . restore registers -13437 5f/pop-to-edi -13438 5e/pop-to-esi -13439 5b/pop-to-ebx -13440 5a/pop-to-edx -13441 59/pop-to-ecx -13442 58/pop-to-eax -13443 # . reclaim local -13444 81 0/subop/add %esp 4/imm32 -13445 # . epilogue -13446 89/<- %esp 5/r32/ebp -13447 5d/pop-to-ebp -13448 c3/return -13449 -13450 $parse-mu:error1: -13451 # error("unexpected top-level command: " word-slice "\n") -13452 (write-buffered *(ebp+0xc) "unexpected top-level command: ") -13453 (write-slice-buffered *(ebp+0xc) %edx) -13454 (write-buffered *(ebp+0xc) "\n") -13455 (flush *(ebp+0xc)) -13456 (stop *(ebp+0x10) 1) -13457 # never gets here -13458 -13459 $parse-mu:error2: -13460 # error(vars->top " vars not reclaimed after fn '" new-function->name "'\n") -13461 (write-int32-hex-buffered *(ebp+0xc) *ebx) -13462 (write-buffered *(ebp+0xc) " vars not reclaimed after fn '") -13463 (write-slice-buffered *(ebp+0xc) *eax) # Function-name -13464 (write-buffered *(ebp+0xc) "'\n") -13465 (flush *(ebp+0xc)) -13466 (stop *(ebp+0x10) 1) -13467 # never gets here -13468 -13469 # scenarios considered: -13470 # ✗ fn foo # no block -13471 # ✓ fn foo { -13472 # ✗ fn foo { { -13473 # ✗ fn foo { } -13474 # ✗ fn foo { } { -13475 # ✗ fn foo x { -13476 # ✗ fn foo x: { -13477 # ✓ fn foo x: int { -13478 # ✓ fn foo x: int { -13479 # ✓ fn foo x: int -> _/eax: int { -13480 # TODO: -13481 # disallow outputs of type `(... addr ...)` -13482 # disallow inputs of type `(... addr ... addr ...)` -13483 populate-mu-function-header: # first-line: (addr stream byte), out: (addr function), vars: (addr stack live-var), err: (addr buffered-file), ed: (addr exit-descriptor) -13484 # pseudocode: -13485 # var word-slice: slice -13486 # next-mu-token(first-line, word-slice) -13487 # if slice-empty?(word-slice) abort -13488 # assert(word-slice not in '{' '}' '->') -13489 # out->name = slice-to-string(word-slice) -13490 # ## inouts -13491 # while true -13492 # word-slice = next-mu-token(first-line) -13493 # if slice-empty?(word-slice) abort -13494 # if (word-slice == '{') goto done -13495 # if (word-slice == '->') break -13496 # assert(word-slice != '}') -13497 # var v: (handle var) = parse-var-with-type(word-slice, first-line) -13498 # assert(v->register == null) -13499 # # v->block-depth is implicitly 0 -13500 # out->inouts = append(v, out->inouts) -13501 # push(vars, {v, false}) -13502 # ## outputs -13503 # while true -13504 # word-slice = next-mu-token(first-line) -13505 # if slice-empty?(word-slice) abort -13506 # if (word-slice == '{') break -13507 # assert(word-slice not in '}' '->') -13508 # var v: (handle var) = parse-var-with-type(word-slice, first-line) -13509 # assert(v->register != null) -13510 # assert(v->name == "_") -13511 # out->outputs = append(v, out->outputs) -13512 # done: -13513 # -13514 # . prologue -13515 55/push-ebp -13516 89/<- %ebp 4/r32/esp -13517 # . save registers -13518 50/push-eax -13519 51/push-ecx -13520 52/push-edx -13521 53/push-ebx -13522 57/push-edi -13523 # edi = out -13524 8b/-> *(ebp+0xc) 7/r32/edi -13525 # var word-slice/ecx: slice -13526 68/push 0/imm32/end -13527 68/push 0/imm32/start -13528 89/<- %ecx 4/r32/esp -13529 # var v/ebx: (handle var) +13219 test-populate-non-addr-handle-array: +13220 # . prologue +13221 55/push-ebp +13222 89/<- %ebp 4/r32/esp +13223 # setup +13224 (clear-stream _test-input-stream) +13225 (clear-stream $_test-input-buffered-file->buffer) +13226 (clear-stream _test-output-stream) +13227 (clear-stream $_test-output-buffered-file->buffer) +13228 (clear-stream _test-error-stream) +13229 (clear-stream $_test-error-buffered-file->buffer) +13230 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13231 68/push 0/imm32 +13232 68/push 0/imm32 +13233 89/<- %edx 4/r32/esp +13234 (tailor-exit-descriptor %edx 0x10) +13235 # +13236 (write _test-input-stream "fn foo {\n") +13237 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") +13238 (write _test-input-stream " populate y, 3\n") +13239 (write _test-input-stream "}\n") +13240 # convert +13241 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13242 # registers except esp clobbered at this point +13243 # restore ed +13244 89/<- %edx 4/r32/esp +13245 (flush _test-output-buffered-file) +13246 (flush _test-error-buffered-file) +13247 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +13253 # check output +13254 (check-stream-equal _test-output-stream "" "F - test-populate-non-addr-handle-array: output should be empty") +13255 (check-next-stream-line-equal _test-error-stream "fn foo: stmt populate: first inout 'y' must have type (addr handle array ...)" "F - test-populate-non-addr-handle-array: error message") +13256 # check that stop(1) was called +13257 (check-ints-equal *(edx+4) 2 "F - test-populate-non-addr-handle-array: exit status") +13258 # don't restore from ebp +13259 81 0/subop/add %esp 8/imm32 +13260 # . epilogue +13261 5d/pop-to-ebp +13262 c3/return +13263 +13264 test-populate-deref-address: +13265 # . prologue +13266 55/push-ebp +13267 89/<- %ebp 4/r32/esp +13268 # setup +13269 (clear-stream _test-input-stream) +13270 (clear-stream $_test-input-buffered-file->buffer) +13271 (clear-stream _test-output-stream) +13272 (clear-stream $_test-output-buffered-file->buffer) +13273 # +13274 (write _test-input-stream "fn foo {\n") +13275 (write _test-input-stream " var y/ecx: (addr addr handle array int) <- copy 0\n") +13276 (write _test-input-stream " populate *y, 3\n") +13277 (write _test-input-stream "}\n") +13278 # convert +13279 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +13280 (flush _test-output-buffered-file) +13281 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +13287 # not bothering checking output +13288 (check-next-stream-line-equal _test-error-stream "" "F - test-populate-deref-address: error message") +13289 # . epilogue +13290 5d/pop-to-ebp +13291 c3/return +13292 +13293 test-populate-stream-with-no-inout: +13294 # . prologue +13295 55/push-ebp +13296 89/<- %ebp 4/r32/esp +13297 # setup +13298 (clear-stream _test-input-stream) +13299 (clear-stream $_test-input-buffered-file->buffer) +13300 (clear-stream _test-output-stream) +13301 (clear-stream $_test-output-buffered-file->buffer) +13302 (clear-stream _test-error-stream) +13303 (clear-stream $_test-error-buffered-file->buffer) +13304 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13305 68/push 0/imm32 +13306 68/push 0/imm32 +13307 89/<- %edx 4/r32/esp +13308 (tailor-exit-descriptor %edx 0x10) +13309 # +13310 (write _test-input-stream "fn foo {\n") +13311 (write _test-input-stream " populate-stream\n") +13312 (write _test-input-stream "}\n") +13313 # convert +13314 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13315 # registers except esp clobbered at this point +13316 # restore ed +13317 89/<- %edx 4/r32/esp +13318 (flush _test-output-buffered-file) +13319 (flush _test-error-buffered-file) +13320 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +13326 # check output +13327 (check-stream-equal _test-output-stream "" "F - test-populate-stream-with-no-inout: output should be empty") +13328 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate-stream' must have two inouts" "F - test-populate-stream-with-no-inout: error message") +13329 # check that stop(1) was called +13330 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-with-no-inout: exit status") +13331 # don't restore from ebp +13332 81 0/subop/add %esp 8/imm32 +13333 # . epilogue +13334 5d/pop-to-ebp +13335 c3/return +13336 +13337 test-populate-stream-with-too-many-inouts: +13338 # . prologue +13339 55/push-ebp +13340 89/<- %ebp 4/r32/esp +13341 # setup +13342 (clear-stream _test-input-stream) +13343 (clear-stream $_test-input-buffered-file->buffer) +13344 (clear-stream _test-output-stream) +13345 (clear-stream $_test-output-buffered-file->buffer) +13346 (clear-stream _test-error-stream) +13347 (clear-stream $_test-error-buffered-file->buffer) +13348 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13349 68/push 0/imm32 +13350 68/push 0/imm32 +13351 89/<- %edx 4/r32/esp +13352 (tailor-exit-descriptor %edx 0x10) +13353 # +13354 (write _test-input-stream "fn foo {\n") +13355 (write _test-input-stream " var x: (addr handle int)\n") +13356 (write _test-input-stream " populate-stream x, 3, 0\n") +13357 (write _test-input-stream "}\n") +13358 # convert +13359 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13360 # registers except esp clobbered at this point +13361 # restore ed +13362 89/<- %edx 4/r32/esp +13363 (flush _test-output-buffered-file) +13364 (flush _test-error-buffered-file) +13365 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +13371 # check output +13372 (check-stream-equal _test-output-stream "" "F - test-populate-stream-with-too-many-inouts: output should be empty") +13373 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate-stream' must have two inouts" "F - test-populate-stream-with-too-many-inouts: error message") +13374 # check that stop(1) was called +13375 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-with-too-many-inouts: exit status") +13376 # don't restore from ebp +13377 81 0/subop/add %esp 8/imm32 +13378 # . epilogue +13379 5d/pop-to-ebp +13380 c3/return +13381 +13382 test-populate-stream-with-output: +13383 # . prologue +13384 55/push-ebp +13385 89/<- %ebp 4/r32/esp +13386 # setup +13387 (clear-stream _test-input-stream) +13388 (clear-stream $_test-input-buffered-file->buffer) +13389 (clear-stream _test-output-stream) +13390 (clear-stream $_test-output-buffered-file->buffer) +13391 (clear-stream _test-error-stream) +13392 (clear-stream $_test-error-buffered-file->buffer) +13393 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13394 68/push 0/imm32 +13395 68/push 0/imm32 +13396 89/<- %edx 4/r32/esp +13397 (tailor-exit-descriptor %edx 0x10) +13398 # +13399 (write _test-input-stream "fn foo {\n") +13400 (write _test-input-stream " var x/eax: boolean <- copy 0\n") +13401 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") +13402 (write _test-input-stream " x <- populate-stream y\n") +13403 (write _test-input-stream "}\n") +13404 # convert +13405 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13406 # registers except esp clobbered at this point +13407 # restore ed +13408 89/<- %edx 4/r32/esp +13409 (flush _test-output-buffered-file) +13410 (flush _test-error-buffered-file) +13411 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +13417 # check output +13418 (check-stream-equal _test-output-stream "" "F - test-populate-stream-with-output: output should be empty") +13419 (check-next-stream-line-equal _test-error-stream "fn foo: stmt 'populate-stream' must not have any outputs" "F - test-populate-stream-with-output: error message") +13420 # check that stop(1) was called +13421 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-with-output: exit status") +13422 # don't restore from ebp +13423 81 0/subop/add %esp 8/imm32 +13424 # . epilogue +13425 5d/pop-to-ebp +13426 c3/return +13427 +13428 test-populate-stream-non-addr: +13429 # . prologue +13430 55/push-ebp +13431 89/<- %ebp 4/r32/esp +13432 # setup +13433 (clear-stream _test-input-stream) +13434 (clear-stream $_test-input-buffered-file->buffer) +13435 (clear-stream _test-output-stream) +13436 (clear-stream $_test-output-buffered-file->buffer) +13437 (clear-stream _test-error-stream) +13438 (clear-stream $_test-error-buffered-file->buffer) +13439 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13440 68/push 0/imm32 +13441 68/push 0/imm32 +13442 89/<- %edx 4/r32/esp +13443 (tailor-exit-descriptor %edx 0x10) +13444 # +13445 (write _test-input-stream "fn foo {\n") +13446 (write _test-input-stream " var y: (handle int)\n") +13447 (write _test-input-stream " populate-stream y, 3\n") +13448 (write _test-input-stream "}\n") +13449 # convert +13450 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13451 # registers except esp clobbered at this point +13452 # restore ed +13453 89/<- %edx 4/r32/esp +13454 (flush _test-output-buffered-file) +13455 (flush _test-error-buffered-file) +13456 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +13462 # check output +13463 (check-stream-equal _test-output-stream "" "F - test-populate-stream-non-addr: output must be empty") +13464 (check-next-stream-line-equal _test-error-stream "fn foo: stmt populate-stream: first inout 'y' must have type (addr handle stream ...)" "F - test-populate-stream-non-addr: error message") +13465 # check that stop(1) was called +13466 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-non-addr: exit status") +13467 # don't restore from ebp +13468 81 0/subop/add %esp 8/imm32 +13469 # . epilogue +13470 5d/pop-to-ebp +13471 c3/return +13472 +13473 test-populate-stream-non-addr-handle: +13474 # . prologue +13475 55/push-ebp +13476 89/<- %ebp 4/r32/esp +13477 # setup +13478 (clear-stream _test-input-stream) +13479 (clear-stream $_test-input-buffered-file->buffer) +13480 (clear-stream _test-output-stream) +13481 (clear-stream $_test-output-buffered-file->buffer) +13482 (clear-stream _test-error-stream) +13483 (clear-stream $_test-error-buffered-file->buffer) +13484 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) +13485 68/push 0/imm32 +13486 68/push 0/imm32 +13487 89/<- %edx 4/r32/esp +13488 (tailor-exit-descriptor %edx 0x10) +13489 # +13490 (write _test-input-stream "fn foo {\n") +13491 (write _test-input-stream " var y/ecx: (addr int) <- copy 0\n") +13492 (write _test-input-stream " populate-stream y, 3\n") +13493 (write _test-input-stream "}\n") +13494 # convert +13495 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13496 # registers except esp clobbered at this point +13497 # restore ed +13498 89/<- %edx 4/r32/esp +13499 (flush _test-output-buffered-file) +13500 (flush _test-error-buffered-file) +13501 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +13507 # check output +13508 (check-stream-equal _test-output-stream "" "F - test-populate-stream-non-addr-handle: output should be empty") +13509 (check-next-stream-line-equal _test-error-stream "fn foo: stmt populate-stream: first inout 'y' must have type (addr handle stream ...)" "F - test-populate-stream-non-addr-handle: error message") +13510 # check that stop(1) was called +13511 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-non-addr-handle: exit status") +13512 # don't restore from ebp +13513 81 0/subop/add %esp 8/imm32 +13514 # . epilogue +13515 5d/pop-to-ebp +13516 c3/return +13517 +13518 test-populate-stream-non-addr-handle-stream: +13519 # . prologue +13520 55/push-ebp +13521 89/<- %ebp 4/r32/esp +13522 # setup +13523 (clear-stream _test-input-stream) +13524 (clear-stream $_test-input-buffered-file->buffer) +13525 (clear-stream _test-output-stream) +13526 (clear-stream $_test-output-buffered-file->buffer) +13527 (clear-stream _test-error-stream) +13528 (clear-stream $_test-error-buffered-file->buffer) +13529 # var ed/edx: exit-descriptor = tailor-exit-descriptor(16) 13530 68/push 0/imm32 13531 68/push 0/imm32 -13532 89/<- %ebx 4/r32/esp -13533 # read function name -13534 (next-mu-token *(ebp+8) %ecx) -13535 # error checking -13536 # if slice-empty?(word-slice) abort -13537 (slice-empty? %ecx) # => eax -13538 3d/compare-eax-and 0/imm32/false -13539 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -13540 # if (word-slice == '{') abort -13541 (slice-equal? %ecx "{") # => eax -13542 3d/compare-eax-and 0/imm32/false -13543 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -13544 # if (word-slice == '->') abort -13545 (slice-equal? %ecx "->") # => eax -13546 3d/compare-eax-and 0/imm32/false -13547 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -13548 # if (word-slice == '}') abort -13549 (slice-equal? %ecx "}") # => eax -13550 3d/compare-eax-and 0/imm32/false -13551 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -13552 # save function name -13553 (slice-to-string Heap %ecx %edi) # Function-name -13554 # save function inouts -13555 { -13556 $populate-mu-function-header:check-for-inout: -13557 (next-mu-token *(ebp+8) %ecx) -13558 # if slice-empty?(word-slice) abort -13559 (slice-empty? %ecx) # => eax -13560 3d/compare-eax-and 0/imm32/false -13561 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -13562 # if (word-slice == '{') goto done -13563 (slice-equal? %ecx "{") # => eax -13564 3d/compare-eax-and 0/imm32/false -13565 0f 85/jump-if-!= $populate-mu-function-header:done/disp32 -13566 # if (word-slice == '->') break -13567 (slice-equal? %ecx "->") # => eax -13568 3d/compare-eax-and 0/imm32/false -13569 0f 85/jump-if-!= break/disp32 -13570 # if (word-slice == '}') abort -13571 (slice-equal? %ecx "}") # => eax -13572 3d/compare-eax-and 0/imm32/false -13573 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -13574 # v = parse-var-with-type(word-slice, first-line) -13575 (parse-var-with-type %ecx *(ebp+8) %ebx *(ebp+0x14) *(ebp+0x18)) -13576 # assert(v->register == null) -13577 # . eax: (addr var) = lookup(v) -13578 (lookup *ebx *(ebx+4)) # => eax -13579 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -13580 0f 85/jump-if-!= $populate-mu-function-header:error2/disp32 -13581 # v->block-depth is implicitly 0 -13582 # -13583 # out->inouts = append(v, out->inouts) -13584 8d/copy-address *(edi+8) 0/r32/eax # Function-inouts -13585 (append-list Heap *ebx *(ebx+4) *(edi+8) *(edi+0xc) %eax) # Function-inouts, Function-inouts -13586 # push(vars, {v, false}) -13587 (push *(ebp+0x10) *ebx) -13588 (push *(ebp+0x10) *(ebx+4)) -13589 (push *(ebp+0x10) 0) # false -13590 # -13591 e9/jump loop/disp32 -13592 } -13593 # save function outputs -13594 { -13595 $populate-mu-function-header:check-for-out: -13596 (next-mu-token *(ebp+8) %ecx) -13597 # if slice-empty?(word-slice) abort -13598 (slice-empty? %ecx) # => eax -13599 3d/compare-eax-and 0/imm32/false -13600 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -13601 # if (word-slice == '{') break -13602 (slice-equal? %ecx "{") # => eax -13603 3d/compare-eax-and 0/imm32/false -13604 0f 85/jump-if-!= break/disp32 -13605 # if (word-slice == '->') abort -13606 (slice-equal? %ecx "->") # => eax -13607 3d/compare-eax-and 0/imm32/false -13608 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -13609 # if (word-slice == '}') abort -13610 (slice-equal? %ecx "}") # => eax -13611 3d/compare-eax-and 0/imm32/false -13612 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 -13613 # v = parse-var-with-type(word-slice, first-line) -13614 (parse-var-with-type %ecx *(ebp+8) %ebx *(ebp+0x14) *(ebp+0x18)) -13615 # assert(var->register != null) -13616 # . eax: (addr var) = lookup(v) -13617 (lookup *ebx *(ebx+4)) # => eax -13618 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -13619 0f 84/jump-if-= $populate-mu-function-header:error3/disp32 -13620 # assert(var->name == "_") -13621 (lookup *eax *(eax+4)) # Var-name Var-name => eax -13622 (string-equal? %eax "_") # => eax -13623 3d/compare-eax-and 0/imm32/false -13624 0f 84/jump-if-= $populate-mu-function-header:error4/disp32 -13625 # out->outputs = append(v, out->outputs) -13626 8d/copy-address *(edi+0x10) 0/r32/eax # Function-outputs -13627 (append-list Heap *ebx *(ebx+4) *(edi+0x10) *(edi+0x14) %eax) # Function-outputs, Function-outputs -13628 # -13629 e9/jump loop/disp32 -13630 } -13631 $populate-mu-function-header:done: -13632 (check-no-tokens-left *(ebp+8)) -13633 $populate-mu-function-header:end: -13634 # . reclaim locals -13635 81 0/subop/add %esp 0x10/imm32 -13636 # . restore registers -13637 5f/pop-to-edi -13638 5b/pop-to-ebx -13639 5a/pop-to-edx -13640 59/pop-to-ecx -13641 58/pop-to-eax -13642 # . epilogue -13643 89/<- %esp 5/r32/ebp -13644 5d/pop-to-ebp -13645 c3/return -13646 -13647 $populate-mu-function-header:error1: -13648 # error("function header not in form 'fn <name> {'") -13649 (write-buffered *(ebp+0x14) "function header not in form 'fn <name> [inouts] [-> outputs] {' -- '") -13650 (flush *(ebp+0x14)) -13651 (rewind-stream *(ebp+8)) -13652 (write-stream-data *(ebp+0x14) *(ebp+8)) -13653 (write-buffered *(ebp+0x14) "'\n") -13654 (flush *(ebp+0x14)) -13655 (stop *(ebp+0x18) 1) -13656 # never gets here -13657 -13658 $populate-mu-function-header:error2: -13659 # error("fn " fn ": function inout '" var "' cannot be in a register") -13660 (write-buffered *(ebp+0x14) "fn ") -13661 50/push-eax -13662 (lookup *edi *(edi+4)) # Function-name Function-name => eax -13663 (write-buffered *(ebp+0x14) %eax) -13664 58/pop-to-eax -13665 (write-buffered *(ebp+0x14) ": function inout '") -13666 (lookup *eax *(eax+4)) # Var-name Var-name => eax -13667 (write-buffered *(ebp+0x14) %eax) -13668 (write-buffered *(ebp+0x14) "' cannot be in a register") -13669 (flush *(ebp+0x14)) -13670 (stop *(ebp+0x18) 1) -13671 # never gets here -13672 -13673 $populate-mu-function-header:error3: -13674 # error("fn " fn ": function output '" var "' must be in a register") -13675 (write-buffered *(ebp+0x14) "fn ") -13676 50/push-eax -13677 (lookup *edi *(edi+4)) # Function-name Function-name => eax -13678 (write-buffered *(ebp+0x14) %eax) -13679 58/pop-to-eax -13680 (write-buffered *(ebp+0x14) ": function output '") -13681 (lookup *ebx *(ebx+4)) # => eax -13682 (lookup *eax *(eax+4)) # Var-name Var-name => eax -13683 (write-buffered *(ebp+0x14) %eax) -13684 (write-buffered *(ebp+0x14) "' must be in a register, in instruction '") -13685 (rewind-stream *(ebp+8)) -13686 (write-stream-data *(ebp+0x14) *(ebp+8)) -13687 (write-buffered *(ebp+0x14) "'\n") -13688 (flush *(ebp+0x14)) -13689 (stop *(ebp+0x18) 1) -13690 # never gets here -13691 -13692 $populate-mu-function-header:error4: -13693 # error("fn " fn ": function outputs cannot be named; rename '" var "' in the header to '_'") -13694 (write-buffered *(ebp+0x14) "fn ") -13695 50/push-eax -13696 (lookup *edi *(edi+4)) # Function-name Function-name => eax -13697 (write-buffered *(ebp+0x14) %eax) -13698 58/pop-to-eax -13699 (write-buffered *(ebp+0x14) ": function outputs cannot be named; rename '") -13700 (lookup *ebx *(ebx+4)) # => eax -13701 (lookup *eax *(eax+4)) # Var-name Var-name => eax -13702 (write-buffered *(ebp+0x14) %eax) -13703 (write-buffered *(ebp+0x14) "' in the header to '_'\n") -13704 (flush *(ebp+0x14)) -13705 (stop *(ebp+0x18) 1) -13706 # never gets here -13707 -13708 # scenarios considered: -13709 # ✓ fn foo -13710 # ✗ fn foo { -13711 # ✓ fn foo x -13712 # ✓ fn foo x: int -13713 # ✓ fn foo x: int -> _/eax: int -13714 # TODO: -13715 # disallow outputs of type `(... addr ...)` -13716 # disallow inputs of type `(... addr ... addr ...)` -13717 populate-mu-function-signature: # first-line: (addr stream byte), out: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -13718 # pseudocode: -13719 # var word-slice: slice -13720 # next-mu-token(first-line, word-slice) -13721 # assert(word-slice not in '{' '}' '->') -13722 # out->name = slice-to-string(word-slice) -13723 # ## inouts -13724 # while true -13725 # word-slice = next-mu-token(first-line) -13726 # if slice-empty?(word-slice) break -13727 # if (word-slice == '->') break -13728 # assert(word-slice not in '{' '}') -13729 # var v: (handle var) = parse-var-with-type(word-slice, first-line) -13730 # assert(v->register == null) -13731 # # v->block-depth is implicitly 0 -13732 # out->inouts = append(v, out->inouts) -13733 # ## outputs -13734 # while true -13735 # word-slice = next-mu-token(first-line) -13736 # if slice-empty?(word-slice) break -13737 # assert(word-slice not in '{' '}' '->') -13738 # var v: (handle var) = parse-var-with-type(word-slice, first-line) -13739 # assert(v->register != null) -13740 # out->outputs = append(v, out->outputs) -13741 # -13742 # . prologue -13743 55/push-ebp -13744 89/<- %ebp 4/r32/esp -13745 # . save registers -13746 50/push-eax -13747 51/push-ecx -13748 52/push-edx -13749 53/push-ebx -13750 57/push-edi -13751 # edi = out -13752 8b/-> *(ebp+0xc) 7/r32/edi -13753 # var word-slice/ecx: slice -13754 68/push 0/imm32/end -13755 68/push 0/imm32/start -13756 89/<- %ecx 4/r32/esp -13757 # var v/ebx: (handle var) -13758 68/push 0/imm32 -13759 68/push 0/imm32 -13760 89/<- %ebx 4/r32/esp -13761 # read function name -13762 (next-mu-token *(ebp+8) %ecx) -13763 # error checking -13764 # if (word-slice == '{') abort -13765 (slice-equal? %ecx "{") # => eax -13766 3d/compare-eax-and 0/imm32/false -13767 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -13768 # if (word-slice == '->') abort -13769 (slice-equal? %ecx "->") # => eax -13770 3d/compare-eax-and 0/imm32/false -13771 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -13772 # if (word-slice == '}') abort -13773 (slice-equal? %ecx "}") # => eax -13774 3d/compare-eax-and 0/imm32/false -13775 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -13776 # save function name -13777 (slice-to-string Heap %ecx %edi) # Function-name -13778 # save function inouts -13779 { -13780 $populate-mu-function-signature:check-for-inout: -13781 (next-mu-token *(ebp+8) %ecx) -13782 (slice-empty? %ecx) # => eax -13783 3d/compare-eax-and 0/imm32/false -13784 0f 85/jump-if-!= break/disp32 -13785 # if (word-slice == '->') break -13786 (slice-equal? %ecx "->") # => eax -13787 3d/compare-eax-and 0/imm32/false -13788 0f 85/jump-if-!= break/disp32 -13789 # if (word-slice == '{') abort -13790 (slice-equal? %ecx "{") # => eax -13791 3d/compare-eax-and 0/imm32/false -13792 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -13793 # if (word-slice == '}') abort -13794 (slice-equal? %ecx "}") # => eax -13795 3d/compare-eax-and 0/imm32/false -13796 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -13797 # v = parse-var-with-type(word-slice, first-line) -13798 (parse-var-with-type %ecx *(ebp+8) %ebx *(ebp+0x10) *(ebp+0x14)) -13799 # assert(v->register == null) -13800 # . eax: (addr var) = lookup(v) -13801 (lookup *ebx *(ebx+4)) # => eax -13802 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -13803 0f 85/jump-if-!= $populate-mu-function-signature:error2/disp32 -13804 # v->block-depth is implicitly 0 -13805 # -13806 # out->inouts = append(v, out->inouts) -13807 8d/copy-address *(edi+8) 0/r32/eax # Function-inouts -13808 (append-list Heap *ebx *(ebx+4) *(edi+8) *(edi+0xc) %eax) # Function-inouts, Function-inouts -13809 # -13810 e9/jump loop/disp32 -13811 } -13812 # save function outputs -13813 { -13814 $populate-mu-function-signature:check-for-out: -13815 (next-mu-token *(ebp+8) %ecx) -13816 (slice-empty? %ecx) # => eax -13817 3d/compare-eax-and 0/imm32/false -13818 0f 85/jump-if-!= break/disp32 -13819 # if (word-slice == '{') abort -13820 (slice-equal? %ecx "{") # => eax -13821 3d/compare-eax-and 0/imm32/false -13822 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -13823 # if (word-slice == '->') abort -13824 (slice-equal? %ecx "->") # => eax -13825 3d/compare-eax-and 0/imm32/false -13826 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -13827 # if (word-slice == '}') abort -13828 (slice-equal? %ecx "}") # => eax -13829 3d/compare-eax-and 0/imm32/false -13830 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 -13831 # v = parse-var-with-type(word-slice, first-line) -13832 (parse-var-with-type %ecx *(ebp+8) %ebx *(ebp+0x10) *(ebp+0x14)) -13833 # assert(var->register != null) -13834 # . eax: (addr var) = lookup(v) -13835 (lookup *ebx *(ebx+4)) # => eax -13836 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -13837 0f 84/jump-if-= $populate-mu-function-signature:error3/disp32 -13838 # out->outputs = append(v, out->outputs) -13839 8d/copy-address *(edi+0x10) 0/r32/eax # Function-outputs -13840 (append-list Heap *ebx *(ebx+4) *(edi+0x10) *(edi+0x14) %eax) # Function-outputs, Function-outputs -13841 # -13842 e9/jump loop/disp32 -13843 } -13844 $populate-mu-function-signature:done: -13845 (check-no-tokens-left *(ebp+8)) -13846 $populate-mu-function-signature:end: -13847 # . reclaim locals -13848 81 0/subop/add %esp 0x10/imm32 -13849 # . restore registers -13850 5f/pop-to-edi -13851 5b/pop-to-ebx -13852 5a/pop-to-edx -13853 59/pop-to-ecx -13854 58/pop-to-eax -13855 # . epilogue -13856 89/<- %esp 5/r32/ebp -13857 5d/pop-to-ebp -13858 c3/return -13859 -13860 $populate-mu-function-signature:error1: -13861 # error("function signature not in form 'fn <name> {'") -13862 (write-buffered *(ebp+0x10) "function signature not in form 'fn <name> [inouts] [-> outputs] {' -- '") -13863 (flush *(ebp+0x10)) -13864 (rewind-stream *(ebp+8)) -13865 (write-stream-data *(ebp+0x10) *(ebp+8)) -13866 (write-buffered *(ebp+0x10) "'\n") -13867 (flush *(ebp+0x10)) -13868 (stop *(ebp+0x14) 1) -13869 # never gets here -13870 -13871 $populate-mu-function-signature:error2: -13872 # error("fn " fn ": function inout '" var "' cannot be in a register") -13873 (write-buffered *(ebp+0x10) "fn ") -13874 50/push-eax -13875 (lookup *edi *(edi+4)) # Function-name Function-name => eax -13876 (write-buffered *(ebp+0x10) %eax) -13877 58/pop-to-eax -13878 (write-buffered *(ebp+0x10) ": function inout '") -13879 (lookup *eax *(eax+4)) # Var-name Var-name => eax -13880 (write-buffered *(ebp+0x10) %eax) -13881 (write-buffered *(ebp+0x10) "' cannot be in a register") -13882 (flush *(ebp+0x10)) -13883 (stop *(ebp+0x14) 1) -13884 # never gets here -13885 -13886 $populate-mu-function-signature:error3: -13887 # error("fn " fn ": function output '" var "' must be in a register") -13888 (write-buffered *(ebp+0x10) "fn ") -13889 50/push-eax -13890 (lookup *edi *(edi+4)) # Function-name Function-name => eax -13891 (write-buffered *(ebp+0x10) %eax) -13892 58/pop-to-eax -13893 (write-buffered *(ebp+0x10) ": function output '") -13894 (lookup *ebx *(ebx+4)) # => eax -13895 (lookup *eax *(eax+4)) # Var-name Var-name => eax -13896 (write-buffered *(ebp+0x10) %eax) -13897 (write-buffered *(ebp+0x10) "' must be in a register, in instruction '") -13898 (rewind-stream *(ebp+8)) -13899 (write-stream-data *(ebp+0x10) *(ebp+8)) -13900 (write-buffered *(ebp+0x10) "'\n") -13901 (flush *(ebp+0x10)) -13902 (stop *(ebp+0x14) 1) -13903 # never gets here -13904 -13905 test-function-header-with-arg: -13906 # . prologue -13907 55/push-ebp -13908 89/<- %ebp 4/r32/esp -13909 # setup -13910 8b/-> *Primitive-type-ids 0/r32/eax -13911 89/<- *Type-id 0/r32/eax # stream-write -13912 (clear-stream _test-input-stream) -13913 (write _test-input-stream "foo n: int {\n") -13914 # var result/ecx: function -13915 2b/subtract *Function-size 4/r32/esp -13916 89/<- %ecx 4/r32/esp -13917 (zero-out %ecx *Function-size) -13918 # var vars/ebx: (stack live-var 16) -13919 81 5/subop/subtract %esp 0xc0/imm32 -13920 68/push 0xc0/imm32/size -13921 68/push 0/imm32/top -13922 89/<- %ebx 4/r32/esp -13923 # convert -13924 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) -13925 # check result->name -13926 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax -13927 (check-strings-equal %eax "foo" "F - test-function-header-with-arg/name") -13928 # var v/edx: (addr var) = result->inouts->value -13929 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax -13930 (lookup *eax *(eax+4)) # List-value List-value => eax -13931 89/<- %edx 0/r32/eax -13932 # check v->name -13933 (lookup *edx *(edx+4)) # Var-name Var-name => eax -13934 (check-strings-equal %eax "n" "F - test-function-header-with-arg/inout:0") -13935 # check v->type -13936 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -13937 (check-ints-equal *eax 1 "F - test-function-header-with-arg/inout:0/type:0") # Type-tree-is-atom -13938 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-arg/inout:0/type:1") # Type-tree-value -13939 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-arg/inout:0/type:2") # Type-tree-right -13940 # . epilogue -13941 89/<- %esp 5/r32/ebp -13942 5d/pop-to-ebp -13943 c3/return -13944 -13945 test-function-header-with-multiple-args: -13946 # . prologue -13947 55/push-ebp -13948 89/<- %ebp 4/r32/esp -13949 # setup -13950 8b/-> *Primitive-type-ids 0/r32/eax -13951 89/<- *Type-id 0/r32/eax # stream-write -13952 (clear-stream _test-input-stream) -13953 (write _test-input-stream "foo a: int, b: int c: int {\n") -13954 # result/ecx: function -13955 2b/subtract *Function-size 4/r32/esp -13956 89/<- %ecx 4/r32/esp -13957 (zero-out %ecx *Function-size) -13958 # var vars/ebx: (stack live-var 16) -13959 81 5/subop/subtract %esp 0xc0/imm32 -13960 68/push 0xc0/imm32/size -13961 68/push 0/imm32/top -13962 89/<- %ebx 4/r32/esp -13963 # convert -13964 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) -13965 # check result->name -13966 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax -13967 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args/name") -13968 # var inouts/edx: (addr list var) = lookup(result->inouts) -13969 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax -13970 89/<- %edx 0/r32/eax -13971 $test-function-header-with-multiple-args:inout0: -13972 # var v/ebx: (addr var) = lookup(inouts->value) -13973 (lookup *edx *(edx+4)) # List-value List-value => eax -13974 89/<- %ebx 0/r32/eax -13975 # check v->name -13976 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -13977 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args/inout:0") # Var-name -13978 # check v->type -13979 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -13980 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:0/type:0") # Type-tree-is-atom -13981 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:0/type:1") # Type-tree-value -13982 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:0/type:2") # Type-tree-right -13983 $test-function-header-with-multiple-args:inout1: -13984 # inouts = lookup(inouts->next) -13985 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax -13986 89/<- %edx 0/r32/eax -13987 # v = lookup(inouts->value) -13988 (lookup *edx *(edx+4)) # List-value List-value => eax -13989 89/<- %ebx 0/r32/eax -13990 # check v->name -13991 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -13992 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args/inout:1") # Var-name -13993 # check v->type -13994 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -13995 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:1/type:0") # Type-tree-is-atom -13996 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:1/type:1") # Type-tree-value -13997 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:1/type:2") # Type-tree-right -13998 $test-function-header-with-multiple-args:inout2: -13999 # inouts = lookup(inouts->next) -14000 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax -14001 89/<- %edx 0/r32/eax -14002 # v = lookup(inouts->value) -14003 (lookup *edx *(edx+4)) # List-value List-value => eax -14004 89/<- %ebx 0/r32/eax -14005 # check v->name -14006 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -14007 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args/inout:2") # Var-name -14008 # check v->type -14009 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -14010 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:2/type:0") # Type-tree-is-atom -14011 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:2/type:1") # Type-tree-value -14012 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:2/type:2") # Type-tree-right -14013 # . epilogue -14014 89/<- %esp 5/r32/ebp -14015 5d/pop-to-ebp -14016 c3/return -14017 -14018 test-function-header-with-multiple-args-and-outputs: -14019 # . prologue -14020 55/push-ebp -14021 89/<- %ebp 4/r32/esp -14022 # setup -14023 8b/-> *Primitive-type-ids 0/r32/eax -14024 89/<- *Type-id 0/r32/eax # stream-write -14025 (clear-stream _test-input-stream) -14026 (write _test-input-stream "foo a: int, b: int, c: int -> _/ecx: int _/edx: int {\n") -14027 # result/ecx: function -14028 2b/subtract *Function-size 4/r32/esp -14029 89/<- %ecx 4/r32/esp -14030 (zero-out %ecx *Function-size) -14031 # var vars/ebx: (stack live-var 16) -14032 81 5/subop/subtract %esp 0xc0/imm32 -14033 68/push 0xc0/imm32/size -14034 68/push 0/imm32/top -14035 89/<- %ebx 4/r32/esp -14036 # convert -14037 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) -14038 # check result->name -14039 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax -14040 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args-and-outputs/name") -14041 # var inouts/edx: (addr list var) = lookup(result->inouts) -14042 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax -14043 89/<- %edx 0/r32/eax -14044 $test-function-header-with-multiple-args-and-outputs:inout0: -14045 # var v/ebx: (addr var) = lookup(inouts->value) -14046 (lookup *edx *(edx+4)) # List-value List-value => eax -14047 89/<- %ebx 0/r32/eax -14048 # check v->name -14049 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -14050 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args-and-outputs/inout:0") -14051 # check v->type -14052 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -14053 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:0") # Type-tree-is-atom -14054 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:1") # Type-tree-value -14055 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:2") # Type-tree-right -14056 $test-function-header-with-multiple-args-and-outputs:inout1: -14057 # inouts = lookup(inouts->next) -14058 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax -14059 89/<- %edx 0/r32/eax -14060 # v = lookup(inouts->value) -14061 (lookup *edx *(edx+4)) # List-value List-value => eax -14062 89/<- %ebx 0/r32/eax -14063 # check v->name -14064 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -14065 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args-and-outputs/inout:1") -14066 # check v->type -14067 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -14068 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:0") # Type-tree-is-atom -14069 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:1") # Type-tree-value -14070 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:2") # Type-tree-right -14071 $test-function-header-with-multiple-args-and-outputs:inout2: -14072 # inouts = lookup(inouts->next) -14073 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax -14074 89/<- %edx 0/r32/eax -14075 # v = lookup(inouts->value) -14076 (lookup *edx *(edx+4)) # List-value List-value => eax -14077 89/<- %ebx 0/r32/eax -14078 # check v->name -14079 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -14080 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args-and-outputs/inout:2") -14081 # check v->type -14082 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -14083 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:0") # Type-tree-is-atom -14084 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:1") # Type-tree-value -14085 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:2") # Type-tree-right -14086 $test-function-header-with-multiple-args-and-outputs:out0: -14087 # var outputs/edx: (addr list var) = lookup(result->outputs) -14088 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax -14089 89/<- %edx 0/r32/eax -14090 # v = lookup(outputs->value) -14091 (lookup *edx *(edx+4)) # List-value List-value => eax -14092 89/<- %ebx 0/r32/eax -14093 # check v->name -14094 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -14095 (check-strings-equal %eax "_" "F - test-function-header-with-multiple-args-and-outputs/output:0") -14096 # check v->register -14097 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -14098 (check-strings-equal %eax "ecx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register") -14099 # check v->type -14100 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -14101 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:0") # Type-tree-is-atom -14102 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1") # Type-tree-value -14103 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:2") # Type-tree-right -14104 $test-function-header-with-multiple-args-and-outputs:out1: -14105 # outputs = lookup(outputs->next) -14106 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax -14107 89/<- %edx 0/r32/eax -14108 # v = lookup(inouts->value) -14109 (lookup *edx *(edx+4)) # List-value List-value => eax -14110 89/<- %ebx 0/r32/eax -14111 # check v->name -14112 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -14113 (check-strings-equal %eax "_" "F - test-function-header-with-multiple-args-and-outputs/output:1") -14114 # check v->register -14115 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -14116 (check-strings-equal %eax "edx" "F - test-function-header-with-multiple-args-and-outputs/output:1/register") -14117 # check v->type -14118 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax -14119 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:0") # Type-tree-is-atom -14120 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1") # Type-tree-value -14121 (check-ints-equal *(eax+0c) 0 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:2") # Type-tree-right -14122 # . epilogue -14123 89/<- %esp 5/r32/ebp -14124 5d/pop-to-ebp -14125 c3/return -14126 -14127 # format for variables with types -14128 # x: int -14129 # x: int, -14130 # x/eax: int -14131 # x/eax: int, -14132 # ignores at most one trailing comma -14133 # WARNING: modifies name -14134 parse-var-with-type: # name: (addr slice), first-line: (addr stream byte), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) -14135 # pseudocode: -14136 # var s: slice -14137 # if (!slice-ends-with(name, ":")) -14138 # abort -14139 # --name->end to skip ':' -14140 # next-token-from-slice(name->start, name->end, '/', s) -14141 # new-var-from-slice(s, out) -14142 # ## register -14143 # next-token-from-slice(s->end, name->end, '/', s) -14144 # if (!slice-empty?(s)) -14145 # out->register = slice-to-string(s) -14146 # ## type -14147 # var type: (handle type-tree) = parse-type(first-line) -14148 # out->type = type -14149 # -14150 # . prologue -14151 55/push-ebp -14152 89/<- %ebp 4/r32/esp -14153 # . save registers -14154 50/push-eax -14155 51/push-ecx -14156 52/push-edx -14157 53/push-ebx -14158 56/push-esi -14159 57/push-edi -14160 # esi = name -14161 8b/-> *(ebp+8) 6/r32/esi -14162 # if (!slice-ends-with?(name, ":")) abort -14163 8b/-> *(esi+4) 1/r32/ecx # Slice-end -14164 49/decrement-ecx -14165 8a/copy-byte *ecx 1/r32/CL -14166 81 4/subop/and %ecx 0xff/imm32 -14167 81 7/subop/compare %ecx 0x3a/imm32/colon -14168 0f 85/jump-if-!= $parse-var-with-type:abort/disp32 -14169 # --name->end to skip ':' -14170 ff 1/subop/decrement *(esi+4) -14171 # var s/ecx: slice -14172 68/push 0/imm32/end -14173 68/push 0/imm32/start -14174 89/<- %ecx 4/r32/esp -14175 $parse-var-with-type:parse-name: -14176 (next-token-from-slice *esi *(esi+4) 0x2f %ecx) # Slice-start, Slice-end, '/' -14177 $parse-var-with-type:create-var: -14178 # new-var-from-slice(s, out) -14179 (new-var-from-slice Heap %ecx *(ebp+0x10)) -14180 # save out->register -14181 $parse-var-with-type:save-register: -14182 # . var out-addr/edi: (addr var) = lookup(*out) -14183 8b/-> *(ebp+0x10) 7/r32/edi -14184 (lookup *edi *(edi+4)) # => eax -14185 89/<- %edi 0/r32/eax -14186 # . s = next-token(...) -14187 (next-token-from-slice *(ecx+4) *(esi+4) 0x2f %ecx) # s->end, name->end, '/' -14188 # . if (!slice-empty?(s)) out->register = slice-to-string(s) -14189 { -14190 $parse-var-with-type:write-register: -14191 (slice-empty? %ecx) # => eax -14192 3d/compare-eax-and 0/imm32/false -14193 75/jump-if-!= break/disp8 -14194 # out->register = slice-to-string(s) -14195 8d/copy-address *(edi+0x18) 0/r32/eax # Var-register -14196 (slice-to-string Heap %ecx %eax) -14197 } -14198 $parse-var-with-type:save-type: -14199 8d/copy-address *(edi+8) 0/r32/eax # Var-type -14200 (parse-type Heap *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) -14201 $parse-var-with-type:end: -14202 # . reclaim locals -14203 81 0/subop/add %esp 8/imm32 -14204 # . restore registers -14205 5f/pop-to-edi -14206 5e/pop-to-esi -14207 5b/pop-to-ebx -14208 5a/pop-to-edx -14209 59/pop-to-ecx -14210 58/pop-to-eax -14211 # . epilogue -14212 89/<- %esp 5/r32/ebp -14213 5d/pop-to-ebp -14214 c3/return -14215 -14216 $parse-var-with-type:abort: -14217 # error("var should have form 'name: type' in '" line "'\n") -14218 (write-buffered *(ebp+0x14) "var should have form 'name: type' in '") -14219 (flush *(ebp+0x14)) -14220 (rewind-stream *(ebp+0xc)) -14221 (write-stream-data *(ebp+0x14) *(ebp+0xc)) -14222 (write-buffered *(ebp+0x14) "'\n") -14223 (flush *(ebp+0x14)) -14224 (stop *(ebp+0x18) 1) -14225 # never gets here -14226 -14227 parse-type: # ad: (addr allocation-descriptor), in: (addr stream byte), out: (addr handle type-tree), err: (addr buffered-file), ed: (addr exit-descriptor) -14228 # pseudocode: -14229 # var s: slice = next-mu-token(in) -14230 # assert s != "" -14231 # assert s != "->" -14232 # assert s != "{" -14233 # assert s != "}" -14234 # if s == ")" -14235 # return -14236 # out = allocate(Type-tree) -14237 # if s != "(" -14238 # HACK: if s is an int, parse and return it -14239 # out->is-atom? = true -14240 # if (s[0] == "_") -14241 # out->value = type-parameter -14242 # out->parameter-name = slice-to-string(ad, s) -14243 # else -14244 # out->value = pos-or-insert-slice(Type-id, s) -14245 # return -14246 # out->left = parse-type(ad, in) -14247 # out->right = parse-type-tree(ad, in) -14248 # -14249 # . prologue -14250 55/push-ebp -14251 89/<- %ebp 4/r32/esp -14252 # . save registers -14253 50/push-eax -14254 51/push-ecx -14255 52/push-edx -14256 # clear out -14257 (zero-out *(ebp+0x10) *Handle-size) -14258 # var s/ecx: slice -14259 68/push 0/imm32 -14260 68/push 0/imm32 -14261 89/<- %ecx 4/r32/esp -14262 # s = next-mu-token(in) -14263 (next-mu-token *(ebp+0xc) %ecx) -14264 #? (write-buffered Stderr "tok: ") -14265 #? (write-slice-buffered Stderr %ecx) -14266 #? (write-buffered Stderr "$\n") -14267 #? (flush Stderr) -14268 # assert s != "" -14269 (slice-equal? %ecx "") # => eax -14270 3d/compare-eax-and 0/imm32/false -14271 0f 85/jump-if-!= $parse-type:abort/disp32 -14272 # assert s != "{" -14273 (slice-equal? %ecx "{") # => eax -14274 3d/compare-eax-and 0/imm32/false -14275 0f 85/jump-if-!= $parse-type:abort/disp32 -14276 # assert s != "}" -14277 (slice-equal? %ecx "}") # => eax -14278 3d/compare-eax-and 0/imm32/false -14279 0f 85/jump-if-!= $parse-type:abort/disp32 -14280 # assert s != "->" -14281 (slice-equal? %ecx "->") # => eax -14282 3d/compare-eax-and 0/imm32/false -14283 0f 85/jump-if-!= $parse-type:abort/disp32 -14284 # if (s == ")") return -14285 (slice-equal? %ecx ")") # => eax -14286 3d/compare-eax-and 0/imm32/false -14287 0f 85/jump-if-!= $parse-type:end/disp32 -14288 # out = new tree -14289 (allocate *(ebp+8) *Type-tree-size *(ebp+0x10)) -14290 # var out-addr/edx: (addr type-tree) = lookup(*out) -14291 8b/-> *(ebp+0x10) 2/r32/edx -14292 (lookup *edx *(edx+4)) # => eax -14293 89/<- %edx 0/r32/eax -14294 { -14295 # if (s != "(") break -14296 (slice-equal? %ecx "(") # => eax -14297 3d/compare-eax-and 0/imm32/false -14298 0f 85/jump-if-!= break/disp32 -14299 # if s is a number, store it in the type's size field -14300 { -14301 $parse-type:check-for-int: -14302 # var tmp/eax: byte = *s->slice -14303 8b/-> *ecx 0/r32/eax -14304 8a/copy-byte *eax 0/r32/AL -14305 81 4/subop/and %eax 0xff/imm32 -14306 # TODO: raise an error on `var x: (array int a)` -14307 (is-decimal-digit? %eax) # => eax -14308 3d/compare-eax-and 0/imm32/false -14309 74/jump-if-= break/disp8 -14310 # -14311 (is-hex-int? %ecx) # => eax -14312 3d/compare-eax-and 0/imm32/false -14313 74/jump-if-= break/disp8 -14314 $parse-type:int: -14315 (check-mu-hex-int %ecx *(ebp+0x14) *(ebp+0x18)) -14316 (parse-hex-int-from-slice %ecx) # => eax -14317 c7 0/subop/copy *(edx+4) 9/imm32/type-id-array-capacity # Type-tree-value -14318 89/<- *(edx+8) 0/r32/eax # Type-tree-value-size -14319 e9/jump $parse-type:end/disp32 -14320 } -14321 $parse-type:atom: -14322 # out->is-atom? = true -14323 c7 0/subop/copy *edx 1/imm32/true # Type-tree-is-atom -14324 { -14325 $parse-type:check-for-type-parameter: -14326 # var tmp/eax: byte = *s->slice -14327 8b/-> *ecx 0/r32/eax -14328 8a/copy-byte *eax 0/r32/AL -14329 81 4/subop/and %eax 0xff/imm32 -14330 # if (tmp != '_') break -14331 3d/compare-eax-and 0x5f/imm32/_ -14332 75/jump-if-!= break/disp8 -14333 $parse-type:type-parameter: -14334 # out->value = type-parameter -14335 c7 0/subop/copy *(edx+4) 0xa/imm32/type-parameter # Type-tree-value -14336 # out->parameter-name = slice-to-string(ad, s) -14337 8d/copy-address *(edx+8) 0/r32/eax # Type-tree-parameter-name -14338 (slice-to-string *(ebp+8) %ecx %eax) -14339 e9/jump $parse-type:end/disp32 -14340 } -14341 $parse-type:non-type-parameter: -14342 # out->value = pos-or-insert-slice(Type-id, s) -14343 (pos-or-insert-slice Type-id %ecx) # => eax -14344 89/<- *(edx+4) 0/r32/eax # Type-tree-value -14345 e9/jump $parse-type:end/disp32 -14346 } -14347 $parse-type:non-atom: -14348 # otherwise s == "(" -14349 # out->left = parse-type(ad, in) -14350 8d/copy-address *(edx+4) 0/r32/eax # Type-tree-left -14351 (parse-type *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) -14352 # out->right = parse-type-tree(ad, in) -14353 8d/copy-address *(edx+0xc) 0/r32/eax # Type-tree-right -14354 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) -14355 $parse-type:end: -14356 # . reclaim locals -14357 81 0/subop/add %esp 8/imm32 -14358 # . restore registers -14359 5a/pop-to-edx -14360 59/pop-to-ecx -14361 58/pop-to-eax -14362 # . epilogue -14363 89/<- %esp 5/r32/ebp -14364 5d/pop-to-ebp -14365 c3/return -14366 -14367 $parse-type:abort: -14368 # error("unexpected token when parsing type: '" s "'\n") -14369 (write-buffered *(ebp+0x14) "unexpected token when parsing type: '") -14370 (write-slice-buffered *(ebp+0x14) %ecx) -14371 (write-buffered *(ebp+0x14) "'\n") -14372 (flush *(ebp+0x14)) -14373 (stop *(ebp+0x18) 1) -14374 # never gets here -14375 -14376 parse-type-tree: # ad: (addr allocation-descriptor), in: (addr stream byte), out: (addr handle type-tree), err: (addr buffered-file), ed: (addr exit-descriptor) -14377 # pseudocode: -14378 # var tmp: (handle type-tree) = parse-type(ad, in) -14379 # if tmp == 0 -14380 # return 0 -14381 # out = allocate(Type-tree) -14382 # out->left = tmp -14383 # out->right = parse-type-tree(ad, in) -14384 # -14385 # . prologue -14386 55/push-ebp -14387 89/<- %ebp 4/r32/esp -14388 # . save registers -14389 50/push-eax -14390 51/push-ecx -14391 52/push-edx -14392 # -14393 (zero-out *(ebp+0x10) *Handle-size) -14394 # var tmp/ecx: (handle type-tree) -14395 68/push 0/imm32 -14396 68/push 0/imm32 -14397 89/<- %ecx 4/r32/esp -14398 # tmp = parse-type(ad, in) -14399 (parse-type *(ebp+8) *(ebp+0xc) %ecx *(ebp+0x14) *(ebp+0x18)) -14400 # if (tmp == 0) return -14401 81 7/subop/compare *ecx 0/imm32 -14402 74/jump-if-= $parse-type-tree:end/disp8 -14403 # out = new tree -14404 (allocate *(ebp+8) *Type-tree-size *(ebp+0x10)) -14405 # var out-addr/edx: (addr tree) = lookup(*out) -14406 8b/-> *(ebp+0x10) 2/r32/edx -14407 (lookup *edx *(edx+4)) # => eax -14408 89/<- %edx 0/r32/eax -14409 # out->left = tmp -14410 8b/-> *ecx 0/r32/eax -14411 89/<- *(edx+4) 0/r32/eax # Type-tree-left -14412 8b/-> *(ecx+4) 0/r32/eax -14413 89/<- *(edx+8) 0/r32/eax # Type-tree-left -14414 # out->right = parse-type-tree(ad, in) -14415 8d/copy-address *(edx+0xc) 0/r32/eax # Type-tree-right -14416 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) -14417 $parse-type-tree:end: -14418 # . reclaim locals -14419 81 0/subop/add %esp 8/imm32 -14420 # . restore registers -14421 5a/pop-to-edx -14422 59/pop-to-ecx -14423 58/pop-to-eax -14424 # . epilogue -14425 89/<- %esp 5/r32/ebp -14426 5d/pop-to-ebp -14427 c3/return -14428 -14429 next-mu-token: # in: (addr stream byte), out: (addr slice) -14430 # pseudocode: -14431 # start: -14432 # skip-chars-matching-whitespace(in) -14433 # if in->read >= in->write # end of in -14434 # out = {0, 0} -14435 # return -14436 # out->start = &in->data[in->read] -14437 # var curr-byte/eax: byte = in->data[in->read] -14438 # if curr->byte == ',' # comment token -14439 # ++in->read -14440 # goto start -14441 # if curr-byte == '#' # comment -14442 # goto done # treat as eof -14443 # if curr-byte == '"' # string literal -14444 # skip-string(in) -14445 # goto done # no metadata -14446 # if curr-byte == '(' -14447 # ++in->read -14448 # goto done -14449 # if curr-byte == ')' -14450 # ++in->read -14451 # goto done -14452 # # read a word -14453 # while true -14454 # if in->read >= in->write -14455 # break -14456 # curr-byte = in->data[in->read] -14457 # if curr-byte == ' ' -14458 # break -14459 # if curr-byte == '\r' -14460 # break -14461 # if curr-byte == '\n' -14462 # break -14463 # if curr-byte == '(' -14464 # break -14465 # if curr-byte == ')' -14466 # break -14467 # if curr-byte == ',' -14468 # break -14469 # ++in->read -14470 # done: -14471 # out->end = &in->data[in->read] -14472 # -14473 # . prologue -14474 55/push-ebp -14475 89/<- %ebp 4/r32/esp -14476 # . save registers -14477 50/push-eax -14478 51/push-ecx -14479 56/push-esi -14480 57/push-edi -14481 # esi = in -14482 8b/-> *(ebp+8) 6/r32/esi -14483 # edi = out -14484 8b/-> *(ebp+0xc) 7/r32/edi -14485 $next-mu-token:start: -14486 (skip-chars-matching-whitespace %esi) -14487 $next-mu-token:check0: -14488 # if (in->read >= in->write) return out = {0, 0} -14489 # . ecx = in->read -14490 8b/-> *(esi+4) 1/r32/ecx -14491 # . if (ecx >= in->write) return out = {0, 0} -14492 3b/compare<- *esi 1/r32/ecx -14493 c7 0/subop/copy *edi 0/imm32 -14494 c7 0/subop/copy *(edi+4) 0/imm32 -14495 0f 8d/jump-if->= $next-mu-token:end/disp32 -14496 # out->start = &in->data[in->read] -14497 8d/copy-address *(esi+ecx+0xc) 0/r32/eax -14498 89/<- *edi 0/r32/eax -14499 # var curr-byte/eax: byte = in->data[in->read] -14500 31/xor-with %eax 0/r32/eax -14501 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL -14502 { -14503 $next-mu-token:check-for-comma: -14504 # if (curr-byte != ',') break -14505 3d/compare-eax-and 0x2c/imm32/comma -14506 75/jump-if-!= break/disp8 -14507 # ++in->read -14508 ff 0/subop/increment *(esi+4) -14509 # restart -14510 e9/jump $next-mu-token:start/disp32 -14511 } -14512 { -14513 $next-mu-token:check-for-comment: -14514 # if (curr-byte != '#') break -14515 3d/compare-eax-and 0x23/imm32/pound -14516 75/jump-if-!= break/disp8 -14517 # return eof -14518 e9/jump $next-mu-token:done/disp32 -14519 } -14520 { -14521 $next-mu-token:check-for-string-literal: -14522 # if (curr-byte != '"') break -14523 3d/compare-eax-and 0x22/imm32/dquote -14524 75/jump-if-!= break/disp8 -14525 (skip-string %esi) -14526 # return -14527 e9/jump $next-mu-token:done/disp32 -14528 } -14529 { -14530 $next-mu-token:check-for-open-paren: -14531 # if (curr-byte != '(') break -14532 3d/compare-eax-and 0x28/imm32/open-paren -14533 75/jump-if-!= break/disp8 -14534 # ++in->read -14535 ff 0/subop/increment *(esi+4) -14536 # return -14537 e9/jump $next-mu-token:done/disp32 -14538 } -14539 { -14540 $next-mu-token:check-for-close-paren: -14541 # if (curr-byte != ')') break -14542 3d/compare-eax-and 0x29/imm32/close-paren -14543 75/jump-if-!= break/disp8 -14544 # ++in->read -14545 ff 0/subop/increment *(esi+4) -14546 # return -14547 e9/jump $next-mu-token:done/disp32 -14548 } -14549 { -14550 $next-mu-token:regular-word-without-metadata: -14551 # if (in->read >= in->write) break -14552 # . ecx = in->read -14553 8b/-> *(esi+4) 1/r32/ecx -14554 # . if (ecx >= in->write) break -14555 3b/compare<- *esi 1/r32/ecx -14556 7d/jump-if->= break/disp8 -14557 # var c/eax: byte = in->data[in->read] -14558 31/xor-with %eax 0/r32/eax -14559 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL -14560 # if (c == ' ') break -14561 3d/compare-eax-and 0x20/imm32/space -14562 74/jump-if-= break/disp8 -14563 # if (c == '\r') break -14564 3d/compare-eax-and 0xd/imm32/carriage-return -14565 74/jump-if-= break/disp8 -14566 # if (c == '\n') break -14567 3d/compare-eax-and 0xa/imm32/newline -14568 74/jump-if-= break/disp8 -14569 # if (c == '(') break -14570 3d/compare-eax-and 0x28/imm32/open-paren -14571 0f 84/jump-if-= break/disp32 -14572 # if (c == ')') break -14573 3d/compare-eax-and 0x29/imm32/close-paren -14574 0f 84/jump-if-= break/disp32 -14575 # if (c == ',') break -14576 3d/compare-eax-and 0x2c/imm32/comma -14577 0f 84/jump-if-= break/disp32 -14578 # ++in->read -14579 ff 0/subop/increment *(esi+4) -14580 # -14581 e9/jump loop/disp32 -14582 } -14583 $next-mu-token:done: -14584 # out->end = &in->data[in->read] -14585 8b/-> *(esi+4) 1/r32/ecx -14586 8d/copy-address *(esi+ecx+0xc) 0/r32/eax -14587 89/<- *(edi+4) 0/r32/eax -14588 $next-mu-token:end: -14589 # . restore registers -14590 5f/pop-to-edi -14591 5e/pop-to-esi -14592 59/pop-to-ecx -14593 58/pop-to-eax -14594 # . epilogue -14595 89/<- %esp 5/r32/ebp -14596 5d/pop-to-ebp -14597 c3/return -14598 -14599 pos-or-insert-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int -14600 # . prologue -14601 55/push-ebp -14602 89/<- %ebp 4/r32/esp -14603 # if (pos-slice(arr, s) != -1) return it -14604 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax -14605 3d/compare-eax-and -1/imm32 -14606 75/jump-if-!= $pos-or-insert-slice:end/disp8 -14607 $pos-or-insert-slice:insert: -14608 # var s2/eax: (handle array byte) -14609 68/push 0/imm32 -14610 68/push 0/imm32 -14611 89/<- %eax 4/r32/esp -14612 (slice-to-string Heap *(ebp+0xc) %eax) -14613 # throw away alloc-id -14614 (lookup *eax *(eax+4)) # => eax -14615 (write-int *(ebp+8) %eax) -14616 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax -14617 $pos-or-insert-slice:end: -14618 # . reclaim locals -14619 81 0/subop/add %esp 8/imm32 -14620 # . epilogue -14621 89/<- %esp 5/r32/ebp -14622 5d/pop-to-ebp -14623 c3/return -14624 -14625 # return the index in an array of strings matching 's', -1 if not found -14626 # index is denominated in elements, not bytes -14627 pos-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int -14628 # . prologue -14629 55/push-ebp -14630 89/<- %ebp 4/r32/esp -14631 # . save registers -14632 51/push-ecx -14633 52/push-edx -14634 53/push-ebx -14635 56/push-esi -14636 #? (write-buffered Stderr "pos-slice: ") -14637 #? (write-slice-buffered Stderr *(ebp+0xc)) -14638 #? (write-buffered Stderr "\n") -14639 #? (flush Stderr) -14640 # esi = arr -14641 8b/-> *(ebp+8) 6/r32/esi -14642 # var index/ecx: int = 0 -14643 b9/copy-to-ecx 0/imm32 -14644 # var curr/edx: (addr (addr array byte)) = arr->data -14645 8d/copy-address *(esi+0xc) 2/r32/edx -14646 # var max/ebx: (addr (addr array byte)) = &arr->data[arr->write] -14647 8b/-> *esi 3/r32/ebx -14648 8d/copy-address *(esi+ebx+0xc) 3/r32/ebx -14649 { -14650 #? (write-buffered Stderr " ") -14651 #? (write-int32-hex-buffered Stderr %ecx) -14652 #? (write-buffered Stderr "\n") -14653 #? (flush Stderr) -14654 # if (curr >= max) return -1 -14655 39/compare %edx 3/r32/ebx -14656 b8/copy-to-eax -1/imm32 -14657 73/jump-if-addr>= $pos-slice:end/disp8 -14658 # if (slice-equal?(s, *curr)) break -14659 (slice-equal? *(ebp+0xc) *edx) # => eax -14660 3d/compare-eax-and 0/imm32/false -14661 75/jump-if-!= break/disp8 -14662 # ++index -14663 41/increment-ecx -14664 # curr += 4 -14665 81 0/subop/add %edx 4/imm32 -14666 # -14667 eb/jump loop/disp8 -14668 } -14669 # return index -14670 89/<- %eax 1/r32/ecx -14671 $pos-slice:end: -14672 #? (write-buffered Stderr "=> ") -14673 #? (write-int32-hex-buffered Stderr %eax) -14674 #? (write-buffered Stderr "\n") -14675 # . restore registers -14676 5e/pop-to-esi -14677 5b/pop-to-ebx -14678 5a/pop-to-edx -14679 59/pop-to-ecx -14680 # . epilogue -14681 89/<- %esp 5/r32/ebp -14682 5d/pop-to-ebp -14683 c3/return -14684 -14685 test-parse-var-with-type: -14686 # . prologue -14687 55/push-ebp -14688 89/<- %ebp 4/r32/esp -14689 # setup -14690 8b/-> *Primitive-type-ids 0/r32/eax -14691 89/<- *Type-id 0/r32/eax # stream-write -14692 # (eax..ecx) = "x:" -14693 b8/copy-to-eax "x:"/imm32 -14694 8b/-> *eax 1/r32/ecx -14695 8d/copy-address *(eax+ecx+4) 1/r32/ecx -14696 05/add-to-eax 4/imm32 -14697 # var slice/ecx: slice = {eax, ecx} -14698 51/push-ecx -14699 50/push-eax -14700 89/<- %ecx 4/r32/esp -14701 # _test-input-stream contains "int" -14702 (clear-stream _test-input-stream) -14703 (write _test-input-stream "int") -14704 # var v/edx: (handle var) -14705 68/push 0/imm32 -14706 68/push 0/imm32 -14707 89/<- %edx 4/r32/esp -14708 # -14709 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) -14710 # var v-addr/edx: (addr var) = lookup(v) -14711 (lookup *edx *(edx+4)) # => eax -14712 89/<- %edx 0/r32/eax -14713 # check v-addr->name -14714 (lookup *edx *(edx+4)) # Var-name Var-name => eax -14715 (check-strings-equal %eax "x" "F - test-parse-var-with-type/name") -14716 # check v-addr->type -14717 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -14718 (check-ints-equal *eax 1 "F - test-parse-var-with-type/type:0") # Type-tree-is-atom -14719 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type/type:1") # Type-tree-value -14720 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type/type:2") # Type-tree-right -14721 # . epilogue -14722 89/<- %esp 5/r32/ebp -14723 5d/pop-to-ebp -14724 c3/return -14725 -14726 test-parse-var-with-type-and-register: -14727 # . prologue -14728 55/push-ebp -14729 89/<- %ebp 4/r32/esp -14730 # setup -14731 8b/-> *Primitive-type-ids 0/r32/eax -14732 89/<- *Type-id 0/r32/eax # stream-write -14733 # (eax..ecx) = "x/eax:" -14734 b8/copy-to-eax "x/eax:"/imm32 -14735 8b/-> *eax 1/r32/ecx -14736 8d/copy-address *(eax+ecx+4) 1/r32/ecx -14737 05/add-to-eax 4/imm32 -14738 # var slice/ecx: slice = {eax, ecx} -14739 51/push-ecx -14740 50/push-eax -14741 89/<- %ecx 4/r32/esp -14742 # _test-input-stream contains "int" -14743 (clear-stream _test-input-stream) -14744 (write _test-input-stream "int") -14745 # var v/edx: (handle var) -14746 68/push 0/imm32 -14747 68/push 0/imm32 -14748 89/<- %edx 4/r32/esp -14749 # -14750 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) -14751 # var v-addr/edx: (addr var) = lookup(v) -14752 (lookup *edx *(edx+4)) # => eax -14753 89/<- %edx 0/r32/eax -14754 # check v-addr->name -14755 (lookup *edx *(edx+4)) # Var-name Var-name => eax -14756 (check-strings-equal %eax "x" "F - test-parse-var-with-type-and-register/name") -14757 # check v-addr->register -14758 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -14759 (check-strings-equal %eax "eax" "F - test-parse-var-with-type-and-register/register") -14760 # check v-addr->type -14761 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -14762 (check-ints-equal *eax 1 "F - test-parse-var-with-type-and-register/type:0") # Type-tree-is-atom -14763 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type-and-register/type:1") # Type-tree-left -14764 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type-and-register/type:2") # Type-tree-right -14765 # . epilogue -14766 89/<- %esp 5/r32/ebp -14767 5d/pop-to-ebp -14768 c3/return -14769 -14770 test-parse-var-with-trailing-characters: -14771 # . prologue -14772 55/push-ebp -14773 89/<- %ebp 4/r32/esp -14774 # setup -14775 8b/-> *Primitive-type-ids 0/r32/eax -14776 89/<- *Type-id 0/r32/eax # stream-write -14777 # (eax..ecx) = "x:" -14778 b8/copy-to-eax "x:"/imm32 -14779 8b/-> *eax 1/r32/ecx -14780 8d/copy-address *(eax+ecx+4) 1/r32/ecx -14781 05/add-to-eax 4/imm32 -14782 # var slice/ecx: slice = {eax, ecx} -14783 51/push-ecx -14784 50/push-eax -14785 89/<- %ecx 4/r32/esp -14786 # _test-input-stream contains "int," -14787 (clear-stream _test-input-stream) -14788 (write _test-input-stream "int,") -14789 # var v/edx: (handle var) -14790 68/push 0/imm32 -14791 68/push 0/imm32 -14792 89/<- %edx 4/r32/esp -14793 # -14794 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) -14795 # var v-addr/edx: (addr var) = lookup(v) -14796 (lookup *edx *(edx+4)) # => eax -14797 89/<- %edx 0/r32/eax -14798 # check v-addr->name -14799 (lookup *edx *(edx+4)) # Var-name Var-name => eax -14800 (check-strings-equal %eax "x" "F - test-parse-var-with-trailing-characters/name") -14801 # check v-addr->register -14802 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-trailing-characters/register") # Var-register -14803 # check v-addr->type -14804 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -14805 (check-ints-equal *eax 1 "F - test-parse-var-with-trailing-characters/type:0") # Type-tree-is-atom -14806 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-trailing-characters/type:1") # Type-tree-left -14807 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-trailing-characters/type:1") # Type-tree-right -14808 # . epilogue -14809 89/<- %esp 5/r32/ebp -14810 5d/pop-to-ebp -14811 c3/return -14812 -14813 test-parse-var-with-register-and-trailing-characters: -14814 # . prologue -14815 55/push-ebp -14816 89/<- %ebp 4/r32/esp -14817 # setup -14818 8b/-> *Primitive-type-ids 0/r32/eax -14819 89/<- *Type-id 0/r32/eax # stream-write -14820 # (eax..ecx) = "x/eax:" -14821 b8/copy-to-eax "x/eax:"/imm32 -14822 8b/-> *eax 1/r32/ecx -14823 8d/copy-address *(eax+ecx+4) 1/r32/ecx -14824 05/add-to-eax 4/imm32 -14825 # var slice/ecx: slice = {eax, ecx} -14826 51/push-ecx -14827 50/push-eax -14828 89/<- %ecx 4/r32/esp -14829 # _test-input-stream contains "int," -14830 (clear-stream _test-input-stream) -14831 (write _test-input-stream "int,") -14832 # var v/edx: (handle var) -14833 68/push 0/imm32 -14834 68/push 0/imm32 -14835 89/<- %edx 4/r32/esp -14836 # -14837 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) -14838 # var v-addr/edx: (addr var) = lookup(v) -14839 (lookup *edx *(edx+4)) # => eax -14840 89/<- %edx 0/r32/eax -14841 # check v-addr->name -14842 (lookup *edx *(edx+4)) # Var-name Var-name => eax -14843 (check-strings-equal %eax "x" "F - test-parse-var-with-register-and-trailing-characters/name") -14844 # check v-addr->register -14845 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -14846 (check-strings-equal %eax "eax" "F - test-parse-var-with-register-and-trailing-characters/register") -14847 # check v-addr->type -14848 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -14849 (check-ints-equal *eax 1 "F - test-parse-var-with-register-and-trailing-characters/type:0") # Type-tree-is-atom -14850 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-register-and-trailing-characters/type:1") # Type-tree-left -14851 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-register-and-trailing-characters/type:2") # Type-tree-right -14852 # . epilogue -14853 89/<- %esp 5/r32/ebp -14854 5d/pop-to-ebp -14855 c3/return -14856 -14857 test-parse-var-with-compound-type: -14858 # . prologue -14859 55/push-ebp -14860 89/<- %ebp 4/r32/esp -14861 # setup -14862 8b/-> *Primitive-type-ids 0/r32/eax -14863 89/<- *Type-id 0/r32/eax # stream-write -14864 # (eax..ecx) = "x:" -14865 b8/copy-to-eax "x:"/imm32 -14866 8b/-> *eax 1/r32/ecx -14867 8d/copy-address *(eax+ecx+4) 1/r32/ecx -14868 05/add-to-eax 4/imm32 -14869 # var slice/ecx: slice = {eax, ecx} -14870 51/push-ecx -14871 50/push-eax -14872 89/<- %ecx 4/r32/esp -14873 # _test-input-stream contains "(addr int)" -14874 (clear-stream _test-input-stream) -14875 (write _test-input-stream "(addr int)") -14876 # var v/edx: (handle var) -14877 68/push 0/imm32 -14878 68/push 0/imm32 -14879 89/<- %edx 4/r32/esp -14880 # -14881 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) -14882 # var v-addr/edx: (addr var) = lookup(v) -14883 (lookup *edx *(edx+4)) # => eax -14884 89/<- %edx 0/r32/eax -14885 # check v-addr->name -14886 (lookup *edx *(edx+4)) # Var-name Var-name => eax -14887 (check-strings-equal %eax "x" "F - test-parse-var-with-compound-type/name") -14888 # check v-addr->register -14889 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-compound-type/register") # Var-register -14890 # - check v-addr->type -14891 # var type/edx: (addr type-tree) = var->type -14892 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -14893 89/<- %edx 0/r32/eax -14894 # type is a non-atom -14895 (check-ints-equal *edx 0 "F - test-parse-var-with-compound-type/type:0") # Type-tree-is-atom -14896 # type->left == atom(addr) -14897 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -14898 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:1") # Type-tree-is-atom -14899 (check-ints-equal *(eax+4) 2 "F - test-parse-var-with-compound-type/type:2") # Type-tree-value -14900 # type->right->left == atom(int) -14901 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax -14902 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -14903 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:3") # Type-tree-is-atom -14904 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-compound-type/type:4") # Type-tree-value -14905 # type->right->right == null -14906 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-compound-type/type:5") # Type-tree-right -14907 # . epilogue -14908 89/<- %esp 5/r32/ebp -14909 5d/pop-to-ebp -14910 c3/return -14911 -14912 # identifier starts with a letter or '$' or '_' -14913 # no constraints at the moment on later letters -14914 # all we really want to do so far is exclude '{', '}' and '->' -14915 is-identifier?: # in: (addr slice) -> result/eax: boolean -14916 # . prologue -14917 55/push-ebp -14918 89/<- %ebp 4/r32/esp -14919 # if (slice-empty?(in)) return false -14920 (slice-empty? *(ebp+8)) # => eax -14921 3d/compare-eax-and 0/imm32/false -14922 75/jump-if-!= $is-identifier?:false/disp8 -14923 # var c/eax: byte = *in->start -14924 8b/-> *(ebp+8) 0/r32/eax -14925 8b/-> *eax 0/r32/eax -14926 8a/copy-byte *eax 0/r32/AL -14927 81 4/subop/and %eax 0xff/imm32 -14928 # if (c == '$') return true -14929 3d/compare-eax-and 0x24/imm32/$ -14930 74/jump-if-= $is-identifier?:true/disp8 -14931 # if (c == '_') return true -14932 3d/compare-eax-and 0x5f/imm32/_ -14933 74/jump-if-= $is-identifier?:true/disp8 -14934 # drop case -14935 25/and-eax-with 0x5f/imm32 -14936 # if (c < 'A') return false -14937 3d/compare-eax-and 0x41/imm32/A -14938 7c/jump-if-< $is-identifier?:false/disp8 -14939 # if (c > 'Z') return false -14940 3d/compare-eax-and 0x5a/imm32/Z -14941 7f/jump-if-> $is-identifier?:false/disp8 -14942 # otherwise return true -14943 $is-identifier?:true: -14944 b8/copy-to-eax 1/imm32/true -14945 eb/jump $is-identifier?:end/disp8 -14946 $is-identifier?:false: -14947 b8/copy-to-eax 0/imm32/false -14948 $is-identifier?:end: -14949 # . epilogue -14950 89/<- %esp 5/r32/ebp -14951 5d/pop-to-ebp -14952 c3/return -14953 -14954 test-is-identifier-dollar: -14955 # . prologue -14956 55/push-ebp -14957 89/<- %ebp 4/r32/esp -14958 # (eax..ecx) = "$a" -14959 b8/copy-to-eax "$a"/imm32 -14960 8b/-> *eax 1/r32/ecx -14961 8d/copy-address *(eax+ecx+4) 1/r32/ecx -14962 05/add-to-eax 4/imm32 -14963 # var slice/ecx: slice = {eax, ecx} -14964 51/push-ecx -14965 50/push-eax -14966 89/<- %ecx 4/r32/esp -14967 # -14968 (is-identifier? %ecx) -14969 (check-ints-equal %eax 1 "F - test-is-identifier-dollar") -14970 # . epilogue -14971 89/<- %esp 5/r32/ebp -14972 5d/pop-to-ebp -14973 c3/return -14974 -14975 test-is-identifier-underscore: -14976 # . prologue -14977 55/push-ebp -14978 89/<- %ebp 4/r32/esp -14979 # (eax..ecx) = "_a" -14980 b8/copy-to-eax "_a"/imm32 -14981 8b/-> *eax 1/r32/ecx -14982 8d/copy-address *(eax+ecx+4) 1/r32/ecx -14983 05/add-to-eax 4/imm32 -14984 # var slice/ecx: slice = {eax, ecx} -14985 51/push-ecx -14986 50/push-eax -14987 89/<- %ecx 4/r32/esp -14988 # -14989 (is-identifier? %ecx) -14990 (check-ints-equal %eax 1 "F - test-is-identifier-underscore") -14991 # . epilogue -14992 89/<- %esp 5/r32/ebp -14993 5d/pop-to-ebp -14994 c3/return -14995 -14996 test-is-identifier-a: -14997 # . prologue -14998 55/push-ebp -14999 89/<- %ebp 4/r32/esp -15000 # (eax..ecx) = "a$" -15001 b8/copy-to-eax "a$"/imm32 -15002 8b/-> *eax 1/r32/ecx -15003 8d/copy-address *(eax+ecx+4) 1/r32/ecx -15004 05/add-to-eax 4/imm32 -15005 # var slice/ecx: slice = {eax, ecx} -15006 51/push-ecx -15007 50/push-eax -15008 89/<- %ecx 4/r32/esp -15009 # -15010 (is-identifier? %ecx) -15011 (check-ints-equal %eax 1 "F - test-is-identifier-a") -15012 # . epilogue -15013 89/<- %esp 5/r32/ebp -15014 5d/pop-to-ebp -15015 c3/return -15016 -15017 test-is-identifier-z: -15018 # . prologue -15019 55/push-ebp -15020 89/<- %ebp 4/r32/esp -15021 # (eax..ecx) = "z$" -15022 b8/copy-to-eax "z$"/imm32 -15023 8b/-> *eax 1/r32/ecx -15024 8d/copy-address *(eax+ecx+4) 1/r32/ecx -15025 05/add-to-eax 4/imm32 -15026 # var slice/ecx: slice = {eax, ecx} -15027 51/push-ecx -15028 50/push-eax -15029 89/<- %ecx 4/r32/esp -15030 # -15031 (is-identifier? %ecx) -15032 (check-ints-equal %eax 1 "F - test-is-identifier-z") -15033 # . epilogue -15034 89/<- %esp 5/r32/ebp -15035 5d/pop-to-ebp -15036 c3/return -15037 -15038 test-is-identifier-A: -15039 # . prologue -15040 55/push-ebp -15041 89/<- %ebp 4/r32/esp -15042 # (eax..ecx) = "A$" -15043 b8/copy-to-eax "A$"/imm32 -15044 8b/-> *eax 1/r32/ecx -15045 8d/copy-address *(eax+ecx+4) 1/r32/ecx -15046 05/add-to-eax 4/imm32 -15047 # var slice/ecx: slice = {eax, ecx} -15048 51/push-ecx -15049 50/push-eax -15050 89/<- %ecx 4/r32/esp -15051 # -15052 (is-identifier? %ecx) -15053 (check-ints-equal %eax 1 "F - test-is-identifier-A") -15054 # . epilogue -15055 89/<- %esp 5/r32/ebp -15056 5d/pop-to-ebp -15057 c3/return -15058 -15059 test-is-identifier-Z: -15060 # . prologue -15061 55/push-ebp -15062 89/<- %ebp 4/r32/esp -15063 # (eax..ecx) = "Z$" -15064 b8/copy-to-eax "Z$"/imm32 -15065 8b/-> *eax 1/r32/ecx -15066 8d/copy-address *(eax+ecx+4) 1/r32/ecx -15067 05/add-to-eax 4/imm32 -15068 # var slice/ecx: slice = {eax, ecx} -15069 51/push-ecx -15070 50/push-eax -15071 89/<- %ecx 4/r32/esp -15072 # -15073 (is-identifier? %ecx) -15074 (check-ints-equal %eax 1 "F - test-is-identifier-Z") -15075 # . epilogue -15076 89/<- %esp 5/r32/ebp -15077 5d/pop-to-ebp -15078 c3/return -15079 -15080 test-is-identifier-at: -15081 # character before 'A' is invalid -15082 # . prologue -15083 55/push-ebp -15084 89/<- %ebp 4/r32/esp -15085 # (eax..ecx) = "@a" -15086 b8/copy-to-eax "@a"/imm32 -15087 8b/-> *eax 1/r32/ecx -15088 8d/copy-address *(eax+ecx+4) 1/r32/ecx -15089 05/add-to-eax 4/imm32 -15090 # var slice/ecx: slice = {eax, ecx} -15091 51/push-ecx -15092 50/push-eax -15093 89/<- %ecx 4/r32/esp -15094 # -15095 (is-identifier? %ecx) -15096 (check-ints-equal %eax 0 "F - test-is-identifier-@") -15097 # . epilogue -15098 89/<- %esp 5/r32/ebp -15099 5d/pop-to-ebp -15100 c3/return -15101 -15102 test-is-identifier-square-bracket: -15103 # character after 'Z' is invalid -15104 # . prologue -15105 55/push-ebp -15106 89/<- %ebp 4/r32/esp -15107 # (eax..ecx) = "[a" -15108 b8/copy-to-eax "[a"/imm32 -15109 8b/-> *eax 1/r32/ecx -15110 8d/copy-address *(eax+ecx+4) 1/r32/ecx -15111 05/add-to-eax 4/imm32 -15112 # var slice/ecx: slice = {eax, ecx} -15113 51/push-ecx -15114 50/push-eax -15115 89/<- %ecx 4/r32/esp -15116 # -15117 (is-identifier? %ecx) -15118 (check-ints-equal %eax 0 "F - test-is-identifier-@") -15119 # . epilogue -15120 89/<- %esp 5/r32/ebp -15121 5d/pop-to-ebp -15122 c3/return -15123 -15124 test-is-identifier-backtick: -15125 # character before 'a' is invalid -15126 # . prologue -15127 55/push-ebp -15128 89/<- %ebp 4/r32/esp -15129 # (eax..ecx) = "`a" -15130 b8/copy-to-eax "`a"/imm32 -15131 8b/-> *eax 1/r32/ecx -15132 8d/copy-address *(eax+ecx+4) 1/r32/ecx -15133 05/add-to-eax 4/imm32 -15134 # var slice/ecx: slice = {eax, ecx} -15135 51/push-ecx -15136 50/push-eax -15137 89/<- %ecx 4/r32/esp -15138 # -15139 (is-identifier? %ecx) -15140 (check-ints-equal %eax 0 "F - test-is-identifier-backtick") -15141 # . epilogue -15142 89/<- %esp 5/r32/ebp -15143 5d/pop-to-ebp -15144 c3/return -15145 -15146 test-is-identifier-curly-brace-open: -15147 # character after 'z' is invalid; also used for blocks -15148 # . prologue -15149 55/push-ebp -15150 89/<- %ebp 4/r32/esp -15151 # (eax..ecx) = "{a" -15152 b8/copy-to-eax "{a"/imm32 -15153 8b/-> *eax 1/r32/ecx -15154 8d/copy-address *(eax+ecx+4) 1/r32/ecx -15155 05/add-to-eax 4/imm32 -15156 # var slice/ecx: slice = {eax, ecx} -15157 51/push-ecx -15158 50/push-eax -15159 89/<- %ecx 4/r32/esp -15160 # -15161 (is-identifier? %ecx) -15162 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-open") -15163 # . epilogue -15164 89/<- %esp 5/r32/ebp -15165 5d/pop-to-ebp -15166 c3/return -15167 -15168 test-is-identifier-curly-brace-close: -15169 # . prologue -15170 55/push-ebp -15171 89/<- %ebp 4/r32/esp -15172 # (eax..ecx) = "}a" -15173 b8/copy-to-eax "}a"/imm32 -15174 8b/-> *eax 1/r32/ecx -15175 8d/copy-address *(eax+ecx+4) 1/r32/ecx -15176 05/add-to-eax 4/imm32 -15177 # var slice/ecx: slice = {eax, ecx} -15178 51/push-ecx -15179 50/push-eax -15180 89/<- %ecx 4/r32/esp -15181 # -15182 (is-identifier? %ecx) -15183 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-close") -15184 # . epilogue -15185 89/<- %esp 5/r32/ebp -15186 5d/pop-to-ebp -15187 c3/return -15188 -15189 test-is-identifier-hyphen: -15190 # disallow leading '-' since '->' has special meaning -15191 # . prologue -15192 55/push-ebp -15193 89/<- %ebp 4/r32/esp -15194 # (eax..ecx) = "-a" -15195 b8/copy-to-eax "-a"/imm32 -15196 8b/-> *eax 1/r32/ecx -15197 8d/copy-address *(eax+ecx+4) 1/r32/ecx -15198 05/add-to-eax 4/imm32 -15199 # var slice/ecx: slice = {eax, ecx} -15200 51/push-ecx -15201 50/push-eax -15202 89/<- %ecx 4/r32/esp -15203 # -15204 (is-identifier? %ecx) -15205 (check-ints-equal %eax 0 "F - test-is-identifier-hyphen") -15206 # . epilogue -15207 89/<- %esp 5/r32/ebp -15208 5d/pop-to-ebp -15209 c3/return -15210 -15211 populate-mu-function-body: # in: (addr buffered-file), out: (addr function), vars: (addr stack live-var), err: (addr buffered-file), ed: (addr exit-descriptor) -15212 # . prologue -15213 55/push-ebp -15214 89/<- %ebp 4/r32/esp -15215 # . save registers -15216 50/push-eax -15217 56/push-esi -15218 57/push-edi -15219 # esi = in -15220 8b/-> *(ebp+8) 6/r32/esi -15221 # edi = out -15222 8b/-> *(ebp+0xc) 7/r32/edi -15223 # initialize some global state -15224 c7 0/subop/copy *Curr-block-depth 1/imm32 -15225 # parse-mu-block(in, vars, out, out->body) -15226 8d/copy-address *(edi+0x18) 0/r32/eax # Function-body -15227 (parse-mu-block %esi *(ebp+0x10) %edi %eax *(ebp+0x14) *(ebp+0x18)) -15228 $populate-mu-function-body:end: -15229 # . restore registers -15230 5f/pop-to-edi -15231 5e/pop-to-esi -15232 58/pop-to-eax -15233 # . epilogue -15234 89/<- %esp 5/r32/ebp -15235 5d/pop-to-ebp -15236 c3/return -15237 -15238 # parses a block, assuming that the leading '{' has already been read by the caller -15239 parse-mu-block: # in: (addr buffered-file), vars: (addr stack live-var), fn: (addr function), out: (addr handle block), err: (addr buffered-file), ed: (addr exit-descriptor) -15240 # pseudocode: -15241 # var line: (stream byte 512) -15242 # var word-slice: slice -15243 # allocate(Heap, Stmt-size, out) -15244 # var out-addr: (addr block) = lookup(*out) -15245 # out-addr->tag = 0/block -15246 # out-addr->var = some unique name -15247 # push(vars, {out-addr->var, false}) -15248 # while true # line loop -15249 # clear-stream(line) -15250 # read-line-buffered(in, line) -15251 # if (line->write == 0) break # end of file -15252 # word-slice = next-mu-token(line) -15253 # if slice-empty?(word-slice) # end of line -15254 # continue -15255 # else if slice-starts-with?(word-slice, "#") -15256 # continue -15257 # else if slice-equal?(word-slice, "{") -15258 # assert(no-tokens-in(line)) -15259 # block = parse-mu-block(in, vars, fn) -15260 # append-to-block(out-addr, block) -15261 # else if slice-equal?(word-slice, "}") -15262 # break -15263 # else if slice-ends-with?(word-slice, ":") -15264 # # TODO: error-check the rest of 'line' -15265 # --word-slice->end to skip ':' -15266 # named-block = parse-mu-named-block(word-slice, in, vars, fn) -15267 # append-to-block(out-addr, named-block) -15268 # else if slice-equal?(word-slice, "var") -15269 # var-def = parse-mu-var-def(line, vars, fn) -15270 # append-to-block(out-addr, var-def) -15271 # else -15272 # stmt = parse-mu-stmt(line, vars, fn) -15273 # append-to-block(out-addr, stmt) -15274 # pop(vars) -15275 # -15276 # . prologue -15277 55/push-ebp -15278 89/<- %ebp 4/r32/esp -15279 # . save registers -15280 50/push-eax -15281 51/push-ecx -15282 52/push-edx -15283 53/push-ebx -15284 57/push-edi -15285 # var line/ecx: (stream byte 512) -15286 81 5/subop/subtract %esp 0x200/imm32 -15287 68/push 0x200/imm32/size -15288 68/push 0/imm32/read -15289 68/push 0/imm32/write -15290 89/<- %ecx 4/r32/esp -15291 # var word-slice/edx: slice -15292 68/push 0/imm32/end -15293 68/push 0/imm32/start -15294 89/<- %edx 4/r32/esp -15295 # allocate into out -15296 (allocate Heap *Stmt-size *(ebp+0x14)) -15297 # var out-addr/edi: (addr block) = lookup(*out) -15298 8b/-> *(ebp+0x14) 7/r32/edi -15299 (lookup *edi *(edi+4)) # => eax -15300 89/<- %edi 0/r32/eax -15301 # out-addr->tag is 0 (block) by default -15302 # set out-addr->var -15303 8d/copy-address *(edi+0xc) 0/r32/eax # Block-var -15304 (new-block-name *(ebp+0x10) %eax) -15305 # push(vars, out-addr->var) -15306 (push *(ebp+0xc) *(edi+0xc)) # Block-var -15307 (push *(ebp+0xc) *(edi+0x10)) # Block-var -15308 (push *(ebp+0xc) 0) # false -15309 # increment *Curr-block-depth -15310 ff 0/subop/increment *Curr-block-depth -15311 { -15312 $parse-mu-block:line-loop: -15313 # line = read-line-buffered(in) -15314 (clear-stream %ecx) -15315 (read-line-buffered *(ebp+8) %ecx) -15316 #? (write-buffered Stderr "line: ") -15317 #? (write-stream-data Stderr %ecx) -15318 #? #? (write-buffered Stderr Newline) # line has its own newline -15319 #? (flush Stderr) -15320 #? (rewind-stream %ecx) -15321 # if (line->write == 0) break -15322 81 7/subop/compare *ecx 0/imm32 -15323 0f 84/jump-if-= break/disp32 -15324 #? (write-buffered Stderr "vars:\n") -15325 #? (dump-vars *(ebp+0xc)) -15326 # word-slice = next-mu-token(line) -15327 (next-mu-token %ecx %edx) -15328 #? (write-buffered Stderr "word: ") -15329 #? (write-slice-buffered Stderr %edx) -15330 #? (write-buffered Stderr Newline) -15331 #? (flush Stderr) -15332 # if slice-empty?(word-slice) continue -15333 (slice-empty? %edx) -15334 3d/compare-eax-and 0/imm32/false -15335 0f 85/jump-if-!= loop/disp32 -15336 # if (slice-starts-with?(word-slice, '#') continue -15337 # . eax = *word-slice->start -15338 8b/-> *edx 0/r32/eax -15339 8a/copy-byte *eax 0/r32/AL -15340 81 4/subop/and %eax 0xff/imm32 -15341 # . if (eax == '#') continue -15342 3d/compare-eax-and 0x23/imm32/hash -15343 0f 84/jump-if-= loop/disp32 -15344 # if slice-equal?(word-slice, "{") -15345 { -15346 $parse-mu-block:check-for-block: -15347 (slice-equal? %edx "{") -15348 3d/compare-eax-and 0/imm32/false -15349 74/jump-if-= break/disp8 -15350 (check-no-tokens-left %ecx) -15351 # parse new block and append -15352 # . var tmp/eax: (handle block) -15353 68/push 0/imm32 -15354 68/push 0/imm32 -15355 89/<- %eax 4/r32/esp -15356 # . -15357 (parse-mu-block *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) -15358 (append-to-block Heap %edi *eax *(eax+4)) -15359 # . reclaim tmp -15360 81 0/subop/add %esp 8/imm32 -15361 # . -15362 e9/jump $parse-mu-block:line-loop/disp32 -15363 } -15364 # if slice-equal?(word-slice, "}") break -15365 $parse-mu-block:check-for-end: -15366 (slice-equal? %edx "}") -15367 3d/compare-eax-and 0/imm32/false -15368 0f 85/jump-if-!= break/disp32 -15369 # if slice-ends-with?(word-slice, ":") parse named block and append -15370 { -15371 $parse-mu-block:check-for-named-block: -15372 # . eax = *(word-slice->end-1) -15373 8b/-> *(edx+4) 0/r32/eax -15374 48/decrement-eax -15375 8a/copy-byte *eax 0/r32/AL -15376 81 4/subop/and %eax 0xff/imm32 -15377 # . if (eax != ':') break -15378 3d/compare-eax-and 0x3a/imm32/colon -15379 0f 85/jump-if-!= break/disp32 -15380 # TODO: error-check the rest of 'line' -15381 # -15382 # skip ':' -15383 ff 1/subop/decrement *(edx+4) # Slice-end -15384 # var tmp/eax: (handle block) -15385 68/push 0/imm32 -15386 68/push 0/imm32 -15387 89/<- %eax 4/r32/esp -15388 # -15389 (parse-mu-named-block %edx *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) -15390 (append-to-block Heap %edi *eax *(eax+4)) -15391 # reclaim tmp -15392 81 0/subop/add %esp 8/imm32 -15393 # -15394 e9/jump $parse-mu-block:line-loop/disp32 -15395 } -15396 # if slice-equal?(word-slice, "var") -15397 { -15398 $parse-mu-block:check-for-var: -15399 (slice-equal? %edx "var") -15400 3d/compare-eax-and 0/imm32/false -15401 74/jump-if-= break/disp8 -15402 # var tmp/eax: (handle block) -15403 68/push 0/imm32 -15404 68/push 0/imm32 -15405 89/<- %eax 4/r32/esp -15406 # -15407 (parse-mu-var-def %ecx *(ebp+0xc) %eax *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) -15408 (append-to-block Heap %edi *eax *(eax+4)) -15409 # reclaim tmp -15410 81 0/subop/add %esp 8/imm32 -15411 # -15412 e9/jump $parse-mu-block:line-loop/disp32 -15413 } -15414 $parse-mu-block:regular-stmt: -15415 # otherwise -15416 # var tmp/eax: (handle block) -15417 68/push 0/imm32 -15418 68/push 0/imm32 -15419 89/<- %eax 4/r32/esp -15420 # -15421 (parse-mu-stmt %ecx *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) -15422 (append-to-block Heap %edi *eax *(eax+4)) -15423 # reclaim tmp -15424 81 0/subop/add %esp 8/imm32 -15425 # -15426 e9/jump loop/disp32 -15427 } # end line loop -15428 (clean-up-blocks *(ebp+0xc) *Curr-block-depth *(ebp+0x10)) -15429 # decrement *Curr-block-depth -15430 ff 1/subop/decrement *Curr-block-depth -15431 # pop(vars) -15432 (pop *(ebp+0xc)) # => eax -15433 (pop *(ebp+0xc)) # => eax -15434 (pop *(ebp+0xc)) # => eax -15435 $parse-mu-block:end: -15436 # . reclaim locals -15437 81 0/subop/add %esp 0x214/imm32 -15438 # . restore registers -15439 5f/pop-to-edi -15440 5b/pop-to-ebx -15441 5a/pop-to-edx -15442 59/pop-to-ecx -15443 58/pop-to-eax -15444 # . epilogue -15445 89/<- %esp 5/r32/ebp -15446 5d/pop-to-ebp -15447 c3/return -15448 -15449 $parse-mu-block:abort: -15450 # error("'{' or '}' should be on its own line, but got '") -15451 (write-buffered *(ebp+0x18) "'{' or '}' should be on its own line, but got '") -15452 (rewind-stream %ecx) -15453 (write-stream-data *(ebp+0x18) %ecx) -15454 (write-buffered *(ebp+0x18) "'\n") -15455 (flush *(ebp+0x18)) -15456 (stop *(ebp+0x1c) 1) -15457 # never gets here -15458 -15459 new-block-name: # fn: (addr function), out: (addr handle var) -15460 # . prologue -15461 55/push-ebp -15462 89/<- %ebp 4/r32/esp -15463 # . save registers -15464 50/push-eax -15465 51/push-ecx -15466 52/push-edx -15467 # var n/ecx: int = len(fn->name) + 10 for an int + 2 for '$:' -15468 8b/-> *(ebp+8) 0/r32/eax -15469 (lookup *eax *(eax+4)) # Function-name Function-name => eax -15470 8b/-> *eax 0/r32/eax # String-size -15471 05/add-to-eax 0xd/imm32 # 10 + 2 for '$:' -15472 89/<- %ecx 0/r32/eax -15473 # var name/edx: (stream byte n) -15474 29/subtract-from %esp 1/r32/ecx -15475 ff 6/subop/push %ecx -15476 68/push 0/imm32/read -15477 68/push 0/imm32/write -15478 89/<- %edx 4/r32/esp -15479 (clear-stream %edx) -15480 # eax = fn->name -15481 8b/-> *(ebp+8) 0/r32/eax -15482 (lookup *eax *(eax+4)) # Function-name Function-name => eax -15483 # construct result using Next-block-index (and increment it) -15484 (write %edx "$") -15485 (write %edx %eax) -15486 (write %edx ":") -15487 (write-int32-hex %edx *Next-block-index) -15488 ff 0/subop/increment *Next-block-index -15489 # var s/eax: slice = {name->data, name->data + name->write} (clobbering edx) -15490 # . eax = name->write -15491 8b/-> *edx 0/r32/eax -15492 # . edx = name->data -15493 8d/copy-address *(edx+0xc) 2/r32/edx -15494 # . eax = name->write + name->data -15495 01/add-to %eax 2/r32/edx -15496 # . push {edx, eax} -15497 ff 6/subop/push %eax -15498 ff 6/subop/push %edx -15499 89/<- %eax 4/r32/esp -15500 # out = new literal(s) -15501 (new-literal Heap %eax *(ebp+0xc)) -15502 #? 8b/-> *(ebp+0xc) 0/r32/eax -15503 #? (write-buffered Stderr "type allocid in caller after new-literal: ") -15504 #? (write-int32-hex-buffered Stderr *(eax+8)) -15505 #? (write-buffered Stderr " for var ") -15506 #? (write-int32-hex-buffered Stderr %eax) -15507 #? (write-buffered Stderr Newline) -15508 #? (flush Stderr) -15509 $new-block-name:end: -15510 # . reclaim locals -15511 81 0/subop/add %ecx 0xc/imm32 # name.{read/write/len} -15512 81 0/subop/add %ecx 8/imm32 # slice -15513 01/add-to %esp 1/r32/ecx -15514 # . restore registers -15515 5a/pop-to-edx -15516 59/pop-to-ecx -15517 58/pop-to-eax -15518 # . epilogue -15519 89/<- %esp 5/r32/ebp -15520 5d/pop-to-ebp -15521 c3/return -15522 -15523 check-no-tokens-left: # line: (addr stream byte) -15524 # . prologue -15525 55/push-ebp -15526 89/<- %ebp 4/r32/esp -15527 # . save registers -15528 50/push-eax -15529 51/push-ecx -15530 # var s/ecx: slice -15531 68/push 0/imm32/end -15532 68/push 0/imm32/start -15533 89/<- %ecx 4/r32/esp -15534 # -15535 (next-mu-token *(ebp+8) %ecx) -15536 # if slice-empty?(s) return -15537 (slice-empty? %ecx) -15538 3d/compare-eax-and 0/imm32/false -15539 75/jump-if-!= $check-no-tokens-left:end/disp8 -15540 # if (slice-starts-with?(s, '#') return -15541 # . eax = *s->start -15542 8b/-> *edx 0/r32/eax -15543 8a/copy-byte *eax 0/r32/AL -15544 81 4/subop/and %eax 0xff/imm32 -15545 # . if (eax == '#') continue -15546 3d/compare-eax-and 0x23/imm32/hash -15547 74/jump-if-= $check-no-tokens-left:end/disp8 -15548 # abort -15549 (write-buffered Stderr "'{' or '}' should be on its own line, but got '") -15550 (rewind-stream %ecx) -15551 (write-stream 2 %ecx) -15552 (write-buffered Stderr "'\n") -15553 (flush Stderr) -15554 # . syscall(exit, 1) -15555 bb/copy-to-ebx 1/imm32 -15556 e8/call syscall_exit/disp32 -15557 # never gets here -15558 $check-no-tokens-left:end: -15559 # . reclaim locals -15560 81 0/subop/add %esp 8/imm32 -15561 # . restore registers -15562 59/pop-to-ecx -15563 58/pop-to-eax -15564 # . epilogue -15565 89/<- %esp 5/r32/ebp -15566 5d/pop-to-ebp -15567 c3/return -15568 -15569 parse-mu-named-block: # name: (addr slice), in: (addr buffered-file), vars: (addr stack live-var), fn: (addr function), out: (addr handle stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -15570 # pseudocode: -15571 # var v: (handle var) -15572 # new-literal(name, v) -15573 # push(vars, {v, false}) -15574 # parse-mu-block(in, vars, fn, out) -15575 # pop(vars) -15576 # out->tag = block -15577 # out->var = v -15578 # -15579 # . prologue -15580 55/push-ebp -15581 89/<- %ebp 4/r32/esp -15582 # . save registers +13532 89/<- %edx 4/r32/esp +13533 (tailor-exit-descriptor %edx 0x10) +13534 # +13535 (write _test-input-stream "fn foo {\n") +13536 (write _test-input-stream " var y/ecx: (addr handle int) <- copy 0\n") +13537 (write _test-input-stream " populate-stream y, 3\n") +13538 (write _test-input-stream "}\n") +13539 # convert +13540 (convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx) +13541 # registers except esp clobbered at this point +13542 # restore ed +13543 89/<- %edx 4/r32/esp +13544 (flush _test-output-buffered-file) +13545 (flush _test-error-buffered-file) +13546 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +13552 # check output +13553 (check-stream-equal _test-output-stream "" "F - test-populate-stream-non-addr-handle-stream: output should be empty") +13554 (check-next-stream-line-equal _test-error-stream "fn foo: stmt populate-stream: first inout 'y' must have type (addr handle stream ...)" "F - test-populate-stream-non-addr-handle-stream: error message") +13555 # check that stop(1) was called +13556 (check-ints-equal *(edx+4) 2 "F - test-populate-stream-non-addr-handle-stream: exit status") +13557 # don't restore from ebp +13558 81 0/subop/add %esp 8/imm32 +13559 # . epilogue +13560 5d/pop-to-ebp +13561 c3/return +13562 +13563 test-populate-stream-deref-address: +13564 # . prologue +13565 55/push-ebp +13566 89/<- %ebp 4/r32/esp +13567 # setup +13568 (clear-stream _test-input-stream) +13569 (clear-stream $_test-input-buffered-file->buffer) +13570 (clear-stream _test-output-stream) +13571 (clear-stream $_test-output-buffered-file->buffer) +13572 # +13573 (write _test-input-stream "fn foo {\n") +13574 (write _test-input-stream " var y/ecx: (addr addr handle stream int) <- copy 0\n") +13575 (write _test-input-stream " populate-stream *y, 3\n") +13576 (write _test-input-stream "}\n") +13577 # convert +13578 (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0) +13579 (flush _test-output-buffered-file) +13580 +-- 6 lines: #? # dump _test-error-stream --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +13586 # not bothering checking output +13587 (check-next-stream-line-equal _test-error-stream "" "F - test-populate-stream-deref-address: error message") +13588 # . epilogue +13589 5d/pop-to-ebp +13590 c3/return +13591 +13592 ####################################################### +13593 # Parsing +13594 ####################################################### +13595 +13596 == data +13597 +13598 # Global state added to each var record when parsing a function +13599 Next-block-index: # (addr int) +13600 1/imm32 +13601 +13602 Curr-block-depth: # (addr int) +13603 1/imm32 +13604 +13605 == code +13606 +13607 parse-mu: # in: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) +13608 # pseudocode +13609 # var curr-function: (addr handle function) = Program->functions +13610 # var curr-signature: (addr handle function) = Program->signatures +13611 # var curr-type: (addr handle typeinfo) = Program->types +13612 # var line: (stream byte 512) +13613 # var word-slice: slice +13614 # while true # line loop +13615 # clear-stream(line) +13616 # read-line-buffered(in, line) +13617 # if (line->write == 0) break # end of file +13618 # word-slice = next-mu-token(line) +13619 # if slice-empty?(word-slice) # end of line +13620 # continue +13621 # else if slice-starts-with?(word-slice, "#") # comment +13622 # continue # end of line +13623 # else if slice-equal?(word-slice, "fn") +13624 # var new-function: (handle function) = allocate(function) +13625 # var vars: (stack live-var 256) +13626 # populate-mu-function-header(line, new-function, vars) +13627 # populate-mu-function-body(in, new-function, vars) +13628 # assert(vars->top == 0) +13629 # *curr-function = new-function +13630 # curr-function = &new-function->next +13631 # else if slice-equal?(word-slice, "sig") +13632 # var new-function: (handle function) = allocate(function) +13633 # populate-mu-function-signature(line, new-function) +13634 # *curr-signature = new-function +13635 # curr-signature = &new-function->next +13636 # else if slice-equal?(word-slice, "type") +13637 # word-slice = next-mu-token(line) +13638 # type-id = pos-or-insert-slice(Type-id, word-slice) +13639 # var new-type: (handle typeinfo) = find-or-create-typeinfo(type-id) +13640 # assert(next-word(line) == "{") +13641 # populate-mu-type(in, new-type) +13642 # else +13643 # abort() +13644 # +13645 # . prologue +13646 55/push-ebp +13647 89/<- %ebp 4/r32/esp +13648 # var curr-signature: (addr handle function) at *(ebp-4) +13649 68/push _Program-signatures/imm32 +13650 # . save registers +13651 50/push-eax +13652 51/push-ecx +13653 52/push-edx +13654 53/push-ebx +13655 56/push-esi +13656 57/push-edi +13657 # var line/ecx: (stream byte 512) +13658 81 5/subop/subtract %esp 0x200/imm32 +13659 68/push 0x200/imm32/size +13660 68/push 0/imm32/read +13661 68/push 0/imm32/write +13662 89/<- %ecx 4/r32/esp +13663 # var word-slice/edx: slice +13664 68/push 0/imm32/end +13665 68/push 0/imm32/start +13666 89/<- %edx 4/r32/esp +13667 # var curr-function/edi: (addr handle function) +13668 bf/copy-to-edi _Program-functions/imm32 +13669 # var vars/ebx: (stack live-var 256) +13670 81 5/subop/subtract %esp 0xc00/imm32 +13671 68/push 0xc00/imm32/size +13672 68/push 0/imm32/top +13673 89/<- %ebx 4/r32/esp +13674 { +13675 $parse-mu:line-loop: +13676 (clear-stream %ecx) +13677 (read-line-buffered *(ebp+8) %ecx) +13678 # if (line->write == 0) break +13679 81 7/subop/compare *ecx 0/imm32 +13680 0f 84/jump-if-= break/disp32 +13681 +-- 6 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +13687 (next-mu-token %ecx %edx) +13688 # if slice-empty?(word-slice) continue +13689 (slice-empty? %edx) # => eax +13690 3d/compare-eax-and 0/imm32/false +13691 0f 85/jump-if-!= loop/disp32 +13692 # if (*word-slice->start == "#") continue +13693 # . eax = *word-slice->start +13694 8b/-> *edx 0/r32/eax +13695 8a/copy-byte *eax 0/r32/AL +13696 81 4/subop/and %eax 0xff/imm32 +13697 # . if (eax == '#') continue +13698 3d/compare-eax-and 0x23/imm32/hash +13699 0f 84/jump-if-= loop/disp32 +13700 # if (slice-equal?(word-slice, "fn")) parse a function +13701 { +13702 $parse-mu:fn: +13703 (slice-equal? %edx "fn") # => eax +13704 3d/compare-eax-and 0/imm32/false +13705 0f 84/jump-if-= break/disp32 +13706 # var new-function/esi: (handle function) +13707 68/push 0/imm32 +13708 68/push 0/imm32 +13709 89/<- %esi 4/r32/esp +13710 # populate-mu-function(line, in, vars, new-function) +13711 (allocate Heap *Function-size %esi) +13712 # var new-function-addr/eax: (addr function) +13713 (lookup *esi *(esi+4)) # => eax +13714 # initialize vars +13715 (clear-stack %ebx) +13716 # +13717 (populate-mu-function-header %ecx %eax %ebx *(ebp+0xc) *(ebp+0x10)) +13718 (populate-mu-function-body *(ebp+8) %eax %ebx *(ebp+0xc) *(ebp+0x10)) +13719 # *curr-function = new-function +13720 8b/-> *esi 0/r32/eax +13721 89/<- *edi 0/r32/eax +13722 8b/-> *(esi+4) 0/r32/eax +13723 89/<- *(edi+4) 0/r32/eax +13724 # curr-function = &new-function->next +13725 # . var tmp/eax: (addr function) = lookup(new-function) +13726 (lookup *esi *(esi+4)) # => eax +13727 # . curr-function = &tmp->next +13728 8d/copy-address *(eax+0x20) 7/r32/edi # Function-next +13729 # reclaim new-function +13730 81 0/subop/add %esp 8/imm32 +13731 # +13732 e9/jump $parse-mu:line-loop/disp32 +13733 } +13734 # if (slice-equal?(word-slice, "sig")) parse a function signature +13735 # Function signatures are for providing types to SubX functions. +13736 { +13737 $parse-mu:sig: +13738 (slice-equal? %edx "sig") # => eax +13739 3d/compare-eax-and 0/imm32/false +13740 0f 84/jump-if-= break/disp32 +13741 # edi = curr-function +13742 57/push-edi +13743 8b/-> *(ebp-4) 7/r32/edi +13744 # var new-function/esi: (handle function) +13745 68/push 0/imm32 +13746 68/push 0/imm32 +13747 89/<- %esi 4/r32/esp +13748 # populate-mu-function(line, in, vars, new-function) +13749 (allocate Heap *Function-size %esi) +13750 # var new-function-addr/eax: (addr function) +13751 (lookup *esi *(esi+4)) # => eax +13752 # +13753 (populate-mu-function-signature %ecx %eax *(ebp+0xc) *(ebp+0x10)) +13754 # *curr-signature = new-function +13755 8b/-> *esi 0/r32/eax +13756 89/<- *edi 0/r32/eax +13757 8b/-> *(esi+4) 0/r32/eax +13758 89/<- *(edi+4) 0/r32/eax +13759 # curr-signature = &new-function->next +13760 # . var tmp/eax: (addr function) = lookup(new-function) +13761 (lookup *esi *(esi+4)) # => eax +13762 # . curr-function = &tmp->next +13763 8d/copy-address *(eax+0x20) 7/r32/edi # Function-next +13764 # reclaim new-function +13765 81 0/subop/add %esp 8/imm32 +13766 # save curr-function +13767 89/<- *(ebp-4) 7/r32/edi +13768 # restore edi +13769 5f/pop-to-edi +13770 # +13771 e9/jump $parse-mu:line-loop/disp32 +13772 } +13773 # if (slice-equal?(word-slice, "type")) parse a type (struct/record) definition +13774 { +13775 $parse-mu:type: +13776 (slice-equal? %edx "type") # => eax +13777 3d/compare-eax-and 0/imm32 +13778 0f 84/jump-if-= break/disp32 +13779 (next-mu-token %ecx %edx) +13780 # var type-id/eax: int +13781 (pos-or-insert-slice Type-id %edx) # => eax +13782 # spill +13783 51/push-ecx +13784 # var new-type/ecx: (handle typeinfo) +13785 68/push 0/imm32 +13786 68/push 0/imm32 +13787 89/<- %ecx 4/r32/esp +13788 (find-or-create-typeinfo %eax %ecx) +13789 # +13790 (lookup *ecx *(ecx+4)) # => eax +13791 # TODO: ensure that 'line' has nothing else but '{' +13792 #? (dump-typeinfos "=== aaa\n") +13793 (populate-mu-type *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10)) # => eax +13794 #? (dump-typeinfos "=== zzz\n") +13795 # reclaim new-type +13796 81 0/subop/add %esp 8/imm32 +13797 # restore +13798 59/pop-to-ecx +13799 e9/jump $parse-mu:line-loop/disp32 +13800 } +13801 # otherwise abort +13802 e9/jump $parse-mu:error1/disp32 +13803 } # end line loop +13804 $parse-mu:end: +13805 # . reclaim locals +13806 81 0/subop/add %esp 0x20c/imm32 # line +13807 81 0/subop/add %esp 0xc08/imm32 # vars +13808 81 0/subop/add %esp 8/imm32 +13809 # . restore registers +13810 5f/pop-to-edi +13811 5e/pop-to-esi +13812 5b/pop-to-ebx +13813 5a/pop-to-edx +13814 59/pop-to-ecx +13815 58/pop-to-eax +13816 # . reclaim local +13817 81 0/subop/add %esp 4/imm32 +13818 # . epilogue +13819 89/<- %esp 5/r32/ebp +13820 5d/pop-to-ebp +13821 c3/return +13822 +13823 $parse-mu:error1: +13824 # error("unexpected top-level command: " word-slice "\n") +13825 (write-buffered *(ebp+0xc) "unexpected top-level command: ") +13826 (write-slice-buffered *(ebp+0xc) %edx) +13827 (write-buffered *(ebp+0xc) "\n") +13828 (flush *(ebp+0xc)) +13829 (stop *(ebp+0x10) 1) +13830 # never gets here +13831 +13832 $parse-mu:error2: +13833 # error(vars->top " vars not reclaimed after fn '" new-function->name "'\n") +13834 (write-int32-hex-buffered *(ebp+0xc) *ebx) +13835 (write-buffered *(ebp+0xc) " vars not reclaimed after fn '") +13836 (write-slice-buffered *(ebp+0xc) *eax) # Function-name +13837 (write-buffered *(ebp+0xc) "'\n") +13838 (flush *(ebp+0xc)) +13839 (stop *(ebp+0x10) 1) +13840 # never gets here +13841 +13842 # scenarios considered: +13843 # ✗ fn foo # no block +13844 # ✓ fn foo { +13845 # ✗ fn foo { { +13846 # ✗ fn foo { } +13847 # ✗ fn foo { } { +13848 # ✗ fn foo x { +13849 # ✗ fn foo x: { +13850 # ✓ fn foo x: int { +13851 # ✓ fn foo x: int { +13852 # ✓ fn foo x: int -> _/eax: int { +13853 # TODO: +13854 # disallow outputs of type `(... addr ...)` +13855 # disallow inputs of type `(... addr ... addr ...)` +13856 populate-mu-function-header: # first-line: (addr stream byte), out: (addr function), vars: (addr stack live-var), err: (addr buffered-file), ed: (addr exit-descriptor) +13857 # pseudocode: +13858 # var word-slice: slice +13859 # next-mu-token(first-line, word-slice) +13860 # if slice-empty?(word-slice) abort +13861 # assert(word-slice not in '{' '}' '->') +13862 # out->name = slice-to-string(word-slice) +13863 # ## inouts +13864 # while true +13865 # word-slice = next-mu-token(first-line) +13866 # if slice-empty?(word-slice) abort +13867 # if (word-slice == '{') goto done +13868 # if (word-slice == '->') break +13869 # assert(word-slice != '}') +13870 # var v: (handle var) = parse-var-with-type(word-slice, first-line) +13871 # assert(v->register == null) +13872 # # v->block-depth is implicitly 0 +13873 # out->inouts = append(v, out->inouts) +13874 # push(vars, {v, false}) +13875 # ## outputs +13876 # while true +13877 # word-slice = next-mu-token(first-line) +13878 # if slice-empty?(word-slice) abort +13879 # if (word-slice == '{') break +13880 # assert(word-slice not in '}' '->') +13881 # var v: (handle var) = parse-var-with-type(word-slice, first-line) +13882 # assert(v->register != null) +13883 # assert(v->name == "_") +13884 # out->outputs = append(v, out->outputs) +13885 # done: +13886 # +13887 # . prologue +13888 55/push-ebp +13889 89/<- %ebp 4/r32/esp +13890 # . save registers +13891 50/push-eax +13892 51/push-ecx +13893 52/push-edx +13894 53/push-ebx +13895 57/push-edi +13896 # edi = out +13897 8b/-> *(ebp+0xc) 7/r32/edi +13898 # var word-slice/ecx: slice +13899 68/push 0/imm32/end +13900 68/push 0/imm32/start +13901 89/<- %ecx 4/r32/esp +13902 # var v/ebx: (handle var) +13903 68/push 0/imm32 +13904 68/push 0/imm32 +13905 89/<- %ebx 4/r32/esp +13906 # read function name +13907 (next-mu-token *(ebp+8) %ecx) +13908 # error checking +13909 # if slice-empty?(word-slice) abort +13910 (slice-empty? %ecx) # => eax +13911 3d/compare-eax-and 0/imm32/false +13912 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +13913 # if (word-slice == '{') abort +13914 (slice-equal? %ecx "{") # => eax +13915 3d/compare-eax-and 0/imm32/false +13916 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +13917 # if (word-slice == '->') abort +13918 (slice-equal? %ecx "->") # => eax +13919 3d/compare-eax-and 0/imm32/false +13920 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +13921 # if (word-slice == '}') abort +13922 (slice-equal? %ecx "}") # => eax +13923 3d/compare-eax-and 0/imm32/false +13924 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +13925 # if word-slice already defined, abort +13926 (function-exists? %ecx) # => eax +13927 3d/compare-eax-and 0/imm32/false +13928 0f 85/jump-if-!= $populate-mu-function-header:error-duplicate/disp32 +13929 # +13930 (slice-starts-with? %ecx "break") # => eax +13931 3d/compare-eax-and 0/imm32/false +13932 0f 85/jump-if-!= $populate-mu-function-header:error-break/disp32 +13933 (slice-starts-with? %ecx "loop") # => eax +13934 3d/compare-eax-and 0/imm32/false +13935 0f 85/jump-if-!= $populate-mu-function-header:error-loop/disp32 +13936 # save function name +13937 (slice-to-string Heap %ecx %edi) # Function-name +13938 # save function inouts +13939 { +13940 $populate-mu-function-header:check-for-inout: +13941 (next-mu-token *(ebp+8) %ecx) +13942 # if slice-empty?(word-slice) abort +13943 (slice-empty? %ecx) # => eax +13944 3d/compare-eax-and 0/imm32/false +13945 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +13946 # if (word-slice == '{') goto done +13947 (slice-equal? %ecx "{") # => eax +13948 3d/compare-eax-and 0/imm32/false +13949 0f 85/jump-if-!= $populate-mu-function-header:done/disp32 +13950 # if (word-slice == '->') break +13951 (slice-equal? %ecx "->") # => eax +13952 3d/compare-eax-and 0/imm32/false +13953 0f 85/jump-if-!= break/disp32 +13954 # if (word-slice == '}') abort +13955 (slice-equal? %ecx "}") # => eax +13956 3d/compare-eax-and 0/imm32/false +13957 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +13958 # v = parse-var-with-type(word-slice, first-line) +13959 (parse-var-with-type %ecx *(ebp+8) %ebx *(ebp+0x14) *(ebp+0x18)) +13960 # assert(v->register == null) +13961 # . eax: (addr var) = lookup(v) +13962 (lookup *ebx *(ebx+4)) # => eax +13963 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +13964 0f 85/jump-if-!= $populate-mu-function-header:error2/disp32 +13965 # v->block-depth is implicitly 0 +13966 # +13967 # out->inouts = append(v, out->inouts) +13968 8d/copy-address *(edi+8) 0/r32/eax # Function-inouts +13969 (append-list Heap *ebx *(ebx+4) *(edi+8) *(edi+0xc) %eax) # Function-inouts, Function-inouts +13970 # push(vars, {v, false}) +13971 (push *(ebp+0x10) *ebx) +13972 (push *(ebp+0x10) *(ebx+4)) +13973 (push *(ebp+0x10) 0) # false +13974 # +13975 e9/jump loop/disp32 +13976 } +13977 # save function outputs +13978 { +13979 $populate-mu-function-header:check-for-out: +13980 (next-mu-token *(ebp+8) %ecx) +13981 # if slice-empty?(word-slice) abort +13982 (slice-empty? %ecx) # => eax +13983 3d/compare-eax-and 0/imm32/false +13984 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +13985 # if (word-slice == '{') break +13986 (slice-equal? %ecx "{") # => eax +13987 3d/compare-eax-and 0/imm32/false +13988 0f 85/jump-if-!= break/disp32 +13989 # if (word-slice == '->') abort +13990 (slice-equal? %ecx "->") # => eax +13991 3d/compare-eax-and 0/imm32/false +13992 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +13993 # if (word-slice == '}') abort +13994 (slice-equal? %ecx "}") # => eax +13995 3d/compare-eax-and 0/imm32/false +13996 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 +13997 # v = parse-var-with-type(word-slice, first-line) +13998 (parse-var-with-type %ecx *(ebp+8) %ebx *(ebp+0x14) *(ebp+0x18)) +13999 # assert(var->register != null) +14000 # . eax: (addr var) = lookup(v) +14001 (lookup *ebx *(ebx+4)) # => eax +14002 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +14003 0f 84/jump-if-= $populate-mu-function-header:error3/disp32 +14004 # assert(var->name == "_") +14005 (lookup *eax *(eax+4)) # Var-name Var-name => eax +14006 (string-equal? %eax "_") # => eax +14007 3d/compare-eax-and 0/imm32/false +14008 0f 84/jump-if-= $populate-mu-function-header:error4/disp32 +14009 # out->outputs = append(v, out->outputs) +14010 8d/copy-address *(edi+0x10) 0/r32/eax # Function-outputs +14011 (append-list Heap *ebx *(ebx+4) *(edi+0x10) *(edi+0x14) %eax) # Function-outputs, Function-outputs +14012 # +14013 e9/jump loop/disp32 +14014 } +14015 $populate-mu-function-header:done: +14016 (check-no-tokens-left *(ebp+8)) +14017 $populate-mu-function-header:end: +14018 # . reclaim locals +14019 81 0/subop/add %esp 0x10/imm32 +14020 # . restore registers +14021 5f/pop-to-edi +14022 5b/pop-to-ebx +14023 5a/pop-to-edx +14024 59/pop-to-ecx +14025 58/pop-to-eax +14026 # . epilogue +14027 89/<- %esp 5/r32/ebp +14028 5d/pop-to-ebp +14029 c3/return +14030 +14031 $populate-mu-function-header:error1: +14032 # error("function header not in form 'fn <name> {'") +14033 (write-buffered *(ebp+0x14) "function header not in form 'fn <name> [inouts] [-> outputs] {' -- '") +14034 (flush *(ebp+0x14)) +14035 (rewind-stream *(ebp+8)) +14036 (write-stream-data *(ebp+0x14) *(ebp+8)) +14037 (write-buffered *(ebp+0x14) "'\n") +14038 (flush *(ebp+0x14)) +14039 (stop *(ebp+0x18) 1) +14040 # never gets here +14041 +14042 $populate-mu-function-header:error2: +14043 # error("fn " fn ": function inout '" var "' cannot be in a register") +14044 (write-buffered *(ebp+0x14) "fn ") +14045 50/push-eax +14046 (lookup *edi *(edi+4)) # Function-name Function-name => eax +14047 (write-buffered *(ebp+0x14) %eax) +14048 58/pop-to-eax +14049 (write-buffered *(ebp+0x14) ": function inout '") +14050 (lookup *eax *(eax+4)) # Var-name Var-name => eax +14051 (write-buffered *(ebp+0x14) %eax) +14052 (write-buffered *(ebp+0x14) "' cannot be in a register") +14053 (flush *(ebp+0x14)) +14054 (stop *(ebp+0x18) 1) +14055 # never gets here +14056 +14057 $populate-mu-function-header:error3: +14058 # error("fn " fn ": function output '" var "' must be in a register") +14059 (write-buffered *(ebp+0x14) "fn ") +14060 50/push-eax +14061 (lookup *edi *(edi+4)) # Function-name Function-name => eax +14062 (write-buffered *(ebp+0x14) %eax) +14063 58/pop-to-eax +14064 (write-buffered *(ebp+0x14) ": function output '") +14065 (lookup *ebx *(ebx+4)) # => eax +14066 (lookup *eax *(eax+4)) # Var-name Var-name => eax +14067 (write-buffered *(ebp+0x14) %eax) +14068 (write-buffered *(ebp+0x14) "' must be in a register, in instruction '") +14069 (rewind-stream *(ebp+8)) +14070 (write-stream-data *(ebp+0x14) *(ebp+8)) +14071 (write-buffered *(ebp+0x14) "'\n") +14072 (flush *(ebp+0x14)) +14073 (stop *(ebp+0x18) 1) +14074 # never gets here +14075 +14076 $populate-mu-function-header:error4: +14077 # error("fn " fn ": function outputs cannot be named; rename '" var "' in the header to '_'") +14078 (write-buffered *(ebp+0x14) "fn ") +14079 50/push-eax +14080 (lookup *edi *(edi+4)) # Function-name Function-name => eax +14081 (write-buffered *(ebp+0x14) %eax) +14082 58/pop-to-eax +14083 (write-buffered *(ebp+0x14) ": function outputs cannot be named; rename '") +14084 (lookup *ebx *(ebx+4)) # => eax +14085 (lookup *eax *(eax+4)) # Var-name Var-name => eax +14086 (write-buffered *(ebp+0x14) %eax) +14087 (write-buffered *(ebp+0x14) "' in the header to '_'\n") +14088 (flush *(ebp+0x14)) +14089 (stop *(ebp+0x18) 1) +14090 # never gets here +14091 +14092 $populate-mu-function-header:error-duplicate: +14093 (write-buffered *(ebp+0x14) "fn ") +14094 (write-slice-buffered *(ebp+0x14) %ecx) +14095 (write-buffered *(ebp+0x14) " defined more than once\n") +14096 (flush *(ebp+0x14)) +14097 (stop *(ebp+0x18) 1) +14098 # never gets here +14099 +14100 $populate-mu-function-header:error-break: +14101 (write-buffered *(ebp+0x14) "Sorry, I've reserved all function names starting with 'break' for now. Please contact mu@akkartik.com.\n") +14102 (flush *(ebp+0x14)) +14103 (stop *(ebp+0x18) 1) +14104 # never gets here +14105 +14106 $populate-mu-function-header:error-loop: +14107 (write-buffered *(ebp+0x14) "Sorry, I've reserved all function names starting with 'loop' for now. Please contact mu@akkartik.com.\n") +14108 (flush *(ebp+0x14)) +14109 (stop *(ebp+0x18) 1) +14110 # never gets here +14111 +14112 # scenarios considered: +14113 # ✓ fn foo +14114 # ✗ fn foo { +14115 # ✓ fn foo x +14116 # ✓ fn foo x: int +14117 # ✓ fn foo x: int -> _/eax: int +14118 # TODO: +14119 # disallow outputs of type `(... addr ...)` +14120 # disallow inputs of type `(... addr ... addr ...)` +14121 populate-mu-function-signature: # first-line: (addr stream byte), out: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +14122 # pseudocode: +14123 # var word-slice: slice +14124 # next-mu-token(first-line, word-slice) +14125 # assert(word-slice not in '{' '}' '->') +14126 # out->name = slice-to-string(word-slice) +14127 # ## inouts +14128 # while true +14129 # word-slice = next-mu-token(first-line) +14130 # if slice-empty?(word-slice) break +14131 # if (word-slice == '->') break +14132 # assert(word-slice not in '{' '}') +14133 # var v: (handle var) = parse-var-with-type(word-slice, first-line) +14134 # assert(v->register == null) +14135 # # v->block-depth is implicitly 0 +14136 # out->inouts = append(v, out->inouts) +14137 # ## outputs +14138 # while true +14139 # word-slice = next-mu-token(first-line) +14140 # if slice-empty?(word-slice) break +14141 # assert(word-slice not in '{' '}' '->') +14142 # var v: (handle var) = parse-var-with-type(word-slice, first-line) +14143 # assert(v->register != null) +14144 # out->outputs = append(v, out->outputs) +14145 # +14146 # . prologue +14147 55/push-ebp +14148 89/<- %ebp 4/r32/esp +14149 # . save registers +14150 50/push-eax +14151 51/push-ecx +14152 52/push-edx +14153 53/push-ebx +14154 57/push-edi +14155 # edi = out +14156 8b/-> *(ebp+0xc) 7/r32/edi +14157 # var word-slice/ecx: slice +14158 68/push 0/imm32/end +14159 68/push 0/imm32/start +14160 89/<- %ecx 4/r32/esp +14161 # var v/ebx: (handle var) +14162 68/push 0/imm32 +14163 68/push 0/imm32 +14164 89/<- %ebx 4/r32/esp +14165 # read function name +14166 (next-mu-token *(ebp+8) %ecx) +14167 # error checking +14168 # if (word-slice == '{') abort +14169 (slice-equal? %ecx "{") # => eax +14170 3d/compare-eax-and 0/imm32/false +14171 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +14172 # if (word-slice == '->') abort +14173 (slice-equal? %ecx "->") # => eax +14174 3d/compare-eax-and 0/imm32/false +14175 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +14176 # if (word-slice == '}') abort +14177 (slice-equal? %ecx "}") # => eax +14178 3d/compare-eax-and 0/imm32/false +14179 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +14180 # if word-slice already defined, abort +14181 (function-exists? %ecx) # => eax +14182 3d/compare-eax-and 0/imm32/false +14183 0f 85/jump-if-!= $populate-mu-function-signature:error-duplicate/disp32 +14184 # +14185 (slice-starts-with? %ecx "break") # => eax +14186 3d/compare-eax-and 0/imm32/false +14187 0f 85/jump-if-!= $populate-mu-function-signature:error-break/disp32 +14188 (slice-starts-with? %ecx "loop") # => eax +14189 3d/compare-eax-and 0/imm32/false +14190 0f 85/jump-if-!= $populate-mu-function-signature:error-loop/disp32 +14191 # save function name +14192 (slice-to-string Heap %ecx %edi) # Function-name +14193 # save function inouts +14194 { +14195 $populate-mu-function-signature:check-for-inout: +14196 (next-mu-token *(ebp+8) %ecx) +14197 (slice-empty? %ecx) # => eax +14198 3d/compare-eax-and 0/imm32/false +14199 0f 85/jump-if-!= break/disp32 +14200 # if (word-slice == '->') break +14201 (slice-equal? %ecx "->") # => eax +14202 3d/compare-eax-and 0/imm32/false +14203 0f 85/jump-if-!= break/disp32 +14204 # if (word-slice == '{') abort +14205 (slice-equal? %ecx "{") # => eax +14206 3d/compare-eax-and 0/imm32/false +14207 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +14208 # if (word-slice == '}') abort +14209 (slice-equal? %ecx "}") # => eax +14210 3d/compare-eax-and 0/imm32/false +14211 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +14212 # v = parse-var-with-type(word-slice, first-line) +14213 (parse-var-with-type %ecx *(ebp+8) %ebx *(ebp+0x10) *(ebp+0x14)) +14214 # assert(v->register == null) +14215 # . eax: (addr var) = lookup(v) +14216 (lookup *ebx *(ebx+4)) # => eax +14217 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +14218 0f 85/jump-if-!= $populate-mu-function-signature:error2/disp32 +14219 # v->block-depth is implicitly 0 +14220 # +14221 # out->inouts = append(v, out->inouts) +14222 8d/copy-address *(edi+8) 0/r32/eax # Function-inouts +14223 (append-list Heap *ebx *(ebx+4) *(edi+8) *(edi+0xc) %eax) # Function-inouts, Function-inouts +14224 # +14225 e9/jump loop/disp32 +14226 } +14227 # save function outputs +14228 { +14229 $populate-mu-function-signature:check-for-out: +14230 (next-mu-token *(ebp+8) %ecx) +14231 (slice-empty? %ecx) # => eax +14232 3d/compare-eax-and 0/imm32/false +14233 0f 85/jump-if-!= break/disp32 +14234 # if (word-slice == '{') abort +14235 (slice-equal? %ecx "{") # => eax +14236 3d/compare-eax-and 0/imm32/false +14237 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +14238 # if (word-slice == '->') abort +14239 (slice-equal? %ecx "->") # => eax +14240 3d/compare-eax-and 0/imm32/false +14241 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +14242 # if (word-slice == '}') abort +14243 (slice-equal? %ecx "}") # => eax +14244 3d/compare-eax-and 0/imm32/false +14245 0f 85/jump-if-!= $populate-mu-function-signature:error1/disp32 +14246 # v = parse-var-with-type(word-slice, first-line) +14247 (parse-var-with-type %ecx *(ebp+8) %ebx *(ebp+0x10) *(ebp+0x14)) +14248 # assert(var->register != null) +14249 # . eax: (addr var) = lookup(v) +14250 (lookup *ebx *(ebx+4)) # => eax +14251 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +14252 0f 84/jump-if-= $populate-mu-function-signature:error3/disp32 +14253 # out->outputs = append(v, out->outputs) +14254 8d/copy-address *(edi+0x10) 0/r32/eax # Function-outputs +14255 (append-list Heap *ebx *(ebx+4) *(edi+0x10) *(edi+0x14) %eax) # Function-outputs, Function-outputs +14256 # +14257 e9/jump loop/disp32 +14258 } +14259 $populate-mu-function-signature:done: +14260 (check-no-tokens-left *(ebp+8)) +14261 $populate-mu-function-signature:end: +14262 # . reclaim locals +14263 81 0/subop/add %esp 0x10/imm32 +14264 # . restore registers +14265 5f/pop-to-edi +14266 5b/pop-to-ebx +14267 5a/pop-to-edx +14268 59/pop-to-ecx +14269 58/pop-to-eax +14270 # . epilogue +14271 89/<- %esp 5/r32/ebp +14272 5d/pop-to-ebp +14273 c3/return +14274 +14275 $populate-mu-function-signature:error1: +14276 # error("function signature not in form 'fn <name> {'") +14277 (write-buffered *(ebp+0x10) "function signature not in form 'fn <name> [inouts] [-> outputs] {' -- '") +14278 (flush *(ebp+0x10)) +14279 (rewind-stream *(ebp+8)) +14280 (write-stream-data *(ebp+0x10) *(ebp+8)) +14281 (write-buffered *(ebp+0x10) "'\n") +14282 (flush *(ebp+0x10)) +14283 (stop *(ebp+0x14) 1) +14284 # never gets here +14285 +14286 $populate-mu-function-signature:error2: +14287 # error("fn " fn ": function inout '" var "' cannot be in a register") +14288 (write-buffered *(ebp+0x10) "fn ") +14289 50/push-eax +14290 (lookup *edi *(edi+4)) # Function-name Function-name => eax +14291 (write-buffered *(ebp+0x10) %eax) +14292 58/pop-to-eax +14293 (write-buffered *(ebp+0x10) ": function inout '") +14294 (lookup *eax *(eax+4)) # Var-name Var-name => eax +14295 (write-buffered *(ebp+0x10) %eax) +14296 (write-buffered *(ebp+0x10) "' cannot be in a register") +14297 (flush *(ebp+0x10)) +14298 (stop *(ebp+0x14) 1) +14299 # never gets here +14300 +14301 $populate-mu-function-signature:error3: +14302 # error("fn " fn ": function output '" var "' must be in a register") +14303 (write-buffered *(ebp+0x10) "fn ") +14304 50/push-eax +14305 (lookup *edi *(edi+4)) # Function-name Function-name => eax +14306 (write-buffered *(ebp+0x10) %eax) +14307 58/pop-to-eax +14308 (write-buffered *(ebp+0x10) ": function output '") +14309 (lookup *ebx *(ebx+4)) # => eax +14310 (lookup *eax *(eax+4)) # Var-name Var-name => eax +14311 (write-buffered *(ebp+0x10) %eax) +14312 (write-buffered *(ebp+0x10) "' must be in a register, in instruction '") +14313 (rewind-stream *(ebp+8)) +14314 (write-stream-data *(ebp+0x10) *(ebp+8)) +14315 (write-buffered *(ebp+0x10) "'\n") +14316 (flush *(ebp+0x10)) +14317 (stop *(ebp+0x14) 1) +14318 # never gets here +14319 +14320 $populate-mu-function-signature:error-duplicate: +14321 (write-buffered *(ebp+0x10) "fn ") +14322 (write-slice-buffered *(ebp+0x10) %ecx) +14323 (write-buffered *(ebp+0x10) " defined more than once\n") +14324 (flush *(ebp+0x10)) +14325 (stop *(ebp+0x14) 1) +14326 # never gets here +14327 +14328 $populate-mu-function-signature:error-break: +14329 (write-buffered *(ebp+0x14) "Sorry, I've reserved all function names starting with 'break' for now. Please contact mu@akkartik.com.\n") +14330 (flush *(ebp+0x14)) +14331 (stop *(ebp+0x18) 1) +14332 # never gets here +14333 +14334 $populate-mu-function-signature:error-loop: +14335 (write-buffered *(ebp+0x14) "Sorry, I've reserved all function names starting with 'loop' for now. Please contact mu@akkartik.com.\n") +14336 (flush *(ebp+0x14)) +14337 (stop *(ebp+0x18) 1) +14338 # never gets here +14339 +14340 function-exists?: # s: (addr slice) -> result/eax: boolean +14341 # . prologue +14342 55/push-ebp +14343 89/<- %ebp 4/r32/esp +14344 # . save registers +14345 51/push-ecx +14346 # var curr/ecx: (addr function) = functions +14347 (lookup *_Program-functions *_Program-functions->payload) # => eax +14348 89/<- %ecx 0/r32/eax +14349 { +14350 # if (curr == null) break +14351 81 7/subop/compare %ecx 0/imm32 +14352 74/jump-if-= break/disp8 +14353 # if (curr->name == s) return true +14354 { +14355 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax +14356 (slice-equal? *(ebp+8) %eax) # => eax +14357 3d/compare-eax-and 0/imm32/false +14358 74/jump-if-= break/disp8 +14359 b8/copy-to-eax 1/imm32/true +14360 e9/jump $function-exists?:end/disp32 +14361 } +14362 # curr = curr->next +14363 (lookup *(ecx+0x20) *(ecx+0x24)) # Function-next Function-next => eax +14364 89/<- %ecx 0/r32/eax +14365 # +14366 eb/jump loop/disp8 +14367 } +14368 # var curr/ecx: (addr function) = signatures +14369 (lookup *_Program-signatures *_Program-signatures->payload) # => eax +14370 89/<- %ecx 0/r32/eax +14371 { +14372 # if (curr == null) break +14373 81 7/subop/compare %ecx 0/imm32 +14374 74/jump-if-= break/disp8 +14375 # if (curr->name == s) return true +14376 { +14377 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax +14378 (slice-equal? *(ebp+8) %eax) # => eax +14379 3d/compare-eax-and 0/imm32/false +14380 74/jump-if-= break/disp8 +14381 b8/copy-to-eax 1/imm32/true +14382 eb/jump $function-exists?:end/disp8 +14383 } +14384 # curr = curr->next +14385 (lookup *(ecx+0x20) *(ecx+0x24)) # Function-next Function-next => eax +14386 89/<- %ecx 0/r32/eax +14387 # +14388 eb/jump loop/disp8 +14389 } +14390 # return false +14391 b8/copy-to-eax 0/imm32/false +14392 $function-exists?:end: +14393 # . restore registers +14394 59/pop-to-ecx +14395 # . epilogue +14396 89/<- %esp 5/r32/ebp +14397 5d/pop-to-ebp +14398 c3/return +14399 +14400 test-function-header-with-arg: +14401 # . prologue +14402 55/push-ebp +14403 89/<- %ebp 4/r32/esp +14404 # setup +14405 8b/-> *Primitive-type-ids 0/r32/eax +14406 89/<- *Type-id 0/r32/eax # stream-write +14407 c7 0/subop/copy *_Program-functions 0/imm32 +14408 c7 0/subop/copy *_Program-functions->payload 0/imm32 +14409 c7 0/subop/copy *_Program-types 0/imm32 +14410 c7 0/subop/copy *_Program-types->payload 0/imm32 +14411 c7 0/subop/copy *_Program-signatures 0/imm32 +14412 c7 0/subop/copy *_Program-signatures->payload 0/imm32 +14413 (clear-stream _test-input-stream) +14414 (write _test-input-stream "foo n: int {\n") +14415 # var result/ecx: function +14416 2b/subtract *Function-size 4/r32/esp +14417 89/<- %ecx 4/r32/esp +14418 (zero-out %ecx *Function-size) +14419 # var vars/ebx: (stack live-var 16) +14420 81 5/subop/subtract %esp 0xc0/imm32 +14421 68/push 0xc0/imm32/size +14422 68/push 0/imm32/top +14423 89/<- %ebx 4/r32/esp +14424 # convert +14425 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) +14426 # check result->name +14427 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax +14428 (check-strings-equal %eax "foo" "F - test-function-header-with-arg/name") +14429 # var v/edx: (addr var) = result->inouts->value +14430 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax +14431 (lookup *eax *(eax+4)) # List-value List-value => eax +14432 89/<- %edx 0/r32/eax +14433 # check v->name +14434 (lookup *edx *(edx+4)) # Var-name Var-name => eax +14435 (check-strings-equal %eax "n" "F - test-function-header-with-arg/inout:0") +14436 # check v->type +14437 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +14438 (check-ints-equal *eax 1 "F - test-function-header-with-arg/inout:0/type:0") # Type-tree-is-atom +14439 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-arg/inout:0/type:1") # Type-tree-value +14440 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-arg/inout:0/type:2") # Type-tree-right +14441 # . epilogue +14442 89/<- %esp 5/r32/ebp +14443 5d/pop-to-ebp +14444 c3/return +14445 +14446 test-function-header-with-multiple-args: +14447 # . prologue +14448 55/push-ebp +14449 89/<- %ebp 4/r32/esp +14450 # setup +14451 8b/-> *Primitive-type-ids 0/r32/eax +14452 89/<- *Type-id 0/r32/eax # stream-write +14453 c7 0/subop/copy *_Program-functions 0/imm32 +14454 c7 0/subop/copy *_Program-functions->payload 0/imm32 +14455 c7 0/subop/copy *_Program-types 0/imm32 +14456 c7 0/subop/copy *_Program-types->payload 0/imm32 +14457 c7 0/subop/copy *_Program-signatures 0/imm32 +14458 c7 0/subop/copy *_Program-signatures->payload 0/imm32 +14459 (clear-stream _test-input-stream) +14460 (write _test-input-stream "foo a: int, b: int c: int {\n") +14461 # result/ecx: function +14462 2b/subtract *Function-size 4/r32/esp +14463 89/<- %ecx 4/r32/esp +14464 (zero-out %ecx *Function-size) +14465 # var vars/ebx: (stack live-var 16) +14466 81 5/subop/subtract %esp 0xc0/imm32 +14467 68/push 0xc0/imm32/size +14468 68/push 0/imm32/top +14469 89/<- %ebx 4/r32/esp +14470 # convert +14471 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) +14472 # check result->name +14473 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax +14474 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args/name") +14475 # var inouts/edx: (addr list var) = lookup(result->inouts) +14476 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax +14477 89/<- %edx 0/r32/eax +14478 $test-function-header-with-multiple-args:inout0: +14479 # var v/ebx: (addr var) = lookup(inouts->value) +14480 (lookup *edx *(edx+4)) # List-value List-value => eax +14481 89/<- %ebx 0/r32/eax +14482 # check v->name +14483 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +14484 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args/inout:0") # Var-name +14485 # check v->type +14486 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +14487 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:0/type:0") # Type-tree-is-atom +14488 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:0/type:1") # Type-tree-value +14489 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:0/type:2") # Type-tree-right +14490 $test-function-header-with-multiple-args:inout1: +14491 # inouts = lookup(inouts->next) +14492 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax +14493 89/<- %edx 0/r32/eax +14494 # v = lookup(inouts->value) +14495 (lookup *edx *(edx+4)) # List-value List-value => eax +14496 89/<- %ebx 0/r32/eax +14497 # check v->name +14498 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +14499 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args/inout:1") # Var-name +14500 # check v->type +14501 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +14502 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:1/type:0") # Type-tree-is-atom +14503 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:1/type:1") # Type-tree-value +14504 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:1/type:2") # Type-tree-right +14505 $test-function-header-with-multiple-args:inout2: +14506 # inouts = lookup(inouts->next) +14507 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax +14508 89/<- %edx 0/r32/eax +14509 # v = lookup(inouts->value) +14510 (lookup *edx *(edx+4)) # List-value List-value => eax +14511 89/<- %ebx 0/r32/eax +14512 # check v->name +14513 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +14514 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args/inout:2") # Var-name +14515 # check v->type +14516 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +14517 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args/inout:2/type:0") # Type-tree-is-atom +14518 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args/inout:2/type:1") # Type-tree-value +14519 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args/inout:2/type:2") # Type-tree-right +14520 # . epilogue +14521 89/<- %esp 5/r32/ebp +14522 5d/pop-to-ebp +14523 c3/return +14524 +14525 test-function-header-with-multiple-args-and-outputs: +14526 # . prologue +14527 55/push-ebp +14528 89/<- %ebp 4/r32/esp +14529 # setup +14530 8b/-> *Primitive-type-ids 0/r32/eax +14531 89/<- *Type-id 0/r32/eax # stream-write +14532 c7 0/subop/copy *_Program-functions 0/imm32 +14533 c7 0/subop/copy *_Program-functions->payload 0/imm32 +14534 c7 0/subop/copy *_Program-types 0/imm32 +14535 c7 0/subop/copy *_Program-types->payload 0/imm32 +14536 c7 0/subop/copy *_Program-signatures 0/imm32 +14537 c7 0/subop/copy *_Program-signatures->payload 0/imm32 +14538 (clear-stream _test-input-stream) +14539 (write _test-input-stream "foo a: int, b: int, c: int -> _/ecx: int _/edx: int {\n") +14540 # result/ecx: function +14541 2b/subtract *Function-size 4/r32/esp +14542 89/<- %ecx 4/r32/esp +14543 (zero-out %ecx *Function-size) +14544 # var vars/ebx: (stack live-var 16) +14545 81 5/subop/subtract %esp 0xc0/imm32 +14546 68/push 0xc0/imm32/size +14547 68/push 0/imm32/top +14548 89/<- %ebx 4/r32/esp +14549 # convert +14550 (populate-mu-function-header _test-input-stream %ecx %ebx Stderr 0) +14551 # check result->name +14552 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax +14553 (check-strings-equal %eax "foo" "F - test-function-header-with-multiple-args-and-outputs/name") +14554 # var inouts/edx: (addr list var) = lookup(result->inouts) +14555 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax +14556 89/<- %edx 0/r32/eax +14557 $test-function-header-with-multiple-args-and-outputs:inout0: +14558 # var v/ebx: (addr var) = lookup(inouts->value) +14559 (lookup *edx *(edx+4)) # List-value List-value => eax +14560 89/<- %ebx 0/r32/eax +14561 # check v->name +14562 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +14563 (check-strings-equal %eax "a" "F - test-function-header-with-multiple-args-and-outputs/inout:0") +14564 # check v->type +14565 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +14566 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:0") # Type-tree-is-atom +14567 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:1") # Type-tree-value +14568 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:0/type:2") # Type-tree-right +14569 $test-function-header-with-multiple-args-and-outputs:inout1: +14570 # inouts = lookup(inouts->next) +14571 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax +14572 89/<- %edx 0/r32/eax +14573 # v = lookup(inouts->value) +14574 (lookup *edx *(edx+4)) # List-value List-value => eax +14575 89/<- %ebx 0/r32/eax +14576 # check v->name +14577 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +14578 (check-strings-equal %eax "b" "F - test-function-header-with-multiple-args-and-outputs/inout:1") +14579 # check v->type +14580 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +14581 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:0") # Type-tree-is-atom +14582 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:1") # Type-tree-value +14583 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:1/type:2") # Type-tree-right +14584 $test-function-header-with-multiple-args-and-outputs:inout2: +14585 # inouts = lookup(inouts->next) +14586 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax +14587 89/<- %edx 0/r32/eax +14588 # v = lookup(inouts->value) +14589 (lookup *edx *(edx+4)) # List-value List-value => eax +14590 89/<- %ebx 0/r32/eax +14591 # check v->name +14592 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +14593 (check-strings-equal %eax "c" "F - test-function-header-with-multiple-args-and-outputs/inout:2") +14594 # check v->type +14595 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +14596 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:0") # Type-tree-is-atom +14597 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:1") # Type-tree-value +14598 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:2") # Type-tree-right +14599 $test-function-header-with-multiple-args-and-outputs:out0: +14600 # var outputs/edx: (addr list var) = lookup(result->outputs) +14601 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax +14602 89/<- %edx 0/r32/eax +14603 # v = lookup(outputs->value) +14604 (lookup *edx *(edx+4)) # List-value List-value => eax +14605 89/<- %ebx 0/r32/eax +14606 # check v->name +14607 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +14608 (check-strings-equal %eax "_" "F - test-function-header-with-multiple-args-and-outputs/output:0") +14609 # check v->register +14610 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +14611 (check-strings-equal %eax "ecx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register") +14612 # check v->type +14613 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +14614 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:0") # Type-tree-is-atom +14615 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:1") # Type-tree-value +14616 (check-ints-equal *(eax+0xc) 0 "F - test-function-header-with-multiple-args-and-outputs/output:0/type:2") # Type-tree-right +14617 $test-function-header-with-multiple-args-and-outputs:out1: +14618 # outputs = lookup(outputs->next) +14619 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax +14620 89/<- %edx 0/r32/eax +14621 # v = lookup(inouts->value) +14622 (lookup *edx *(edx+4)) # List-value List-value => eax +14623 89/<- %ebx 0/r32/eax +14624 # check v->name +14625 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +14626 (check-strings-equal %eax "_" "F - test-function-header-with-multiple-args-and-outputs/output:1") +14627 # check v->register +14628 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +14629 (check-strings-equal %eax "edx" "F - test-function-header-with-multiple-args-and-outputs/output:1/register") +14630 # check v->type +14631 (lookup *(ebx+8) *(ebx+0xc)) # Var-type Var-type => eax +14632 (check-ints-equal *eax 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:0") # Type-tree-is-atom +14633 (check-ints-equal *(eax+4) 1 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:1") # Type-tree-value +14634 (check-ints-equal *(eax+0c) 0 "F - test-function-header-with-multiple-args-and-outputs/output:1/type:2") # Type-tree-right +14635 # . epilogue +14636 89/<- %esp 5/r32/ebp +14637 5d/pop-to-ebp +14638 c3/return +14639 +14640 # format for variables with types +14641 # x: int +14642 # x: int, +14643 # x/eax: int +14644 # x/eax: int, +14645 # ignores at most one trailing comma +14646 # WARNING: modifies name +14647 parse-var-with-type: # name: (addr slice), first-line: (addr stream byte), out: (addr handle var), err: (addr buffered-file), ed: (addr exit-descriptor) +14648 # pseudocode: +14649 # var s: slice +14650 # if (!slice-ends-with(name, ":")) +14651 # abort +14652 # --name->end to skip ':' +14653 # next-token-from-slice(name->start, name->end, '/', s) +14654 # new-var-from-slice(s, out) +14655 # ## register +14656 # next-token-from-slice(s->end, name->end, '/', s) +14657 # if (!slice-empty?(s)) +14658 # out->register = slice-to-string(s) +14659 # ## type +14660 # var type: (handle type-tree) = parse-type(first-line) +14661 # out->type = type +14662 # +14663 # . prologue +14664 55/push-ebp +14665 89/<- %ebp 4/r32/esp +14666 # . save registers +14667 50/push-eax +14668 51/push-ecx +14669 52/push-edx +14670 53/push-ebx +14671 56/push-esi +14672 57/push-edi +14673 # esi = name +14674 8b/-> *(ebp+8) 6/r32/esi +14675 # if (!slice-ends-with?(name, ":")) abort +14676 8b/-> *(esi+4) 1/r32/ecx # Slice-end +14677 49/decrement-ecx +14678 8a/copy-byte *ecx 1/r32/CL +14679 81 4/subop/and %ecx 0xff/imm32 +14680 81 7/subop/compare %ecx 0x3a/imm32/colon +14681 0f 85/jump-if-!= $parse-var-with-type:abort/disp32 +14682 # --name->end to skip ':' +14683 ff 1/subop/decrement *(esi+4) +14684 # var s/ecx: slice +14685 68/push 0/imm32/end +14686 68/push 0/imm32/start +14687 89/<- %ecx 4/r32/esp +14688 $parse-var-with-type:parse-name: +14689 (next-token-from-slice *esi *(esi+4) 0x2f %ecx) # Slice-start, Slice-end, '/' +14690 $parse-var-with-type:create-var: +14691 # new-var-from-slice(s, out) +14692 (new-var-from-slice Heap %ecx *(ebp+0x10)) +14693 # save out->register +14694 $parse-var-with-type:save-register: +14695 # . var out-addr/edi: (addr var) = lookup(*out) +14696 8b/-> *(ebp+0x10) 7/r32/edi +14697 (lookup *edi *(edi+4)) # => eax +14698 89/<- %edi 0/r32/eax +14699 # . s = next-token(...) +14700 (next-token-from-slice *(ecx+4) *(esi+4) 0x2f %ecx) # s->end, name->end, '/' +14701 # . if (!slice-empty?(s)) out->register = slice-to-string(s) +14702 { +14703 $parse-var-with-type:write-register: +14704 (slice-empty? %ecx) # => eax +14705 3d/compare-eax-and 0/imm32/false +14706 75/jump-if-!= break/disp8 +14707 # out->register = slice-to-string(s) +14708 8d/copy-address *(edi+0x18) 0/r32/eax # Var-register +14709 (slice-to-string Heap %ecx %eax) +14710 } +14711 $parse-var-with-type:save-type: +14712 8d/copy-address *(edi+8) 0/r32/eax # Var-type +14713 (parse-type Heap *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) +14714 $parse-var-with-type:end: +14715 # . reclaim locals +14716 81 0/subop/add %esp 8/imm32 +14717 # . restore registers +14718 5f/pop-to-edi +14719 5e/pop-to-esi +14720 5b/pop-to-ebx +14721 5a/pop-to-edx +14722 59/pop-to-ecx +14723 58/pop-to-eax +14724 # . epilogue +14725 89/<- %esp 5/r32/ebp +14726 5d/pop-to-ebp +14727 c3/return +14728 +14729 $parse-var-with-type:abort: +14730 # error("var should have form 'name: type' in '" line "'\n") +14731 (write-buffered *(ebp+0x14) "var should have form 'name: type' in '") +14732 (flush *(ebp+0x14)) +14733 (rewind-stream *(ebp+0xc)) +14734 (write-stream-data *(ebp+0x14) *(ebp+0xc)) +14735 (write-buffered *(ebp+0x14) "'\n") +14736 (flush *(ebp+0x14)) +14737 (stop *(ebp+0x18) 1) +14738 # never gets here +14739 +14740 parse-type: # ad: (addr allocation-descriptor), in: (addr stream byte), out: (addr handle type-tree), err: (addr buffered-file), ed: (addr exit-descriptor) +14741 # pseudocode: +14742 # var s: slice = next-mu-token(in) +14743 # assert s != "" +14744 # assert s != "->" +14745 # assert s != "{" +14746 # assert s != "}" +14747 # if s == ")" +14748 # return +14749 # out = allocate(Type-tree) +14750 # if s != "(" +14751 # HACK: if s is an int, parse and return it +14752 # out->is-atom? = true +14753 # if (s[0] == "_") +14754 # out->value = type-parameter +14755 # out->parameter-name = slice-to-string(ad, s) +14756 # else +14757 # out->value = pos-or-insert-slice(Type-id, s) +14758 # return +14759 # out->left = parse-type(ad, in) +14760 # out->right = parse-type-tree(ad, in) +14761 # +14762 # . prologue +14763 55/push-ebp +14764 89/<- %ebp 4/r32/esp +14765 # . save registers +14766 50/push-eax +14767 51/push-ecx +14768 52/push-edx +14769 # clear out +14770 (zero-out *(ebp+0x10) *Handle-size) +14771 # var s/ecx: slice +14772 68/push 0/imm32 +14773 68/push 0/imm32 +14774 89/<- %ecx 4/r32/esp +14775 # s = next-mu-token(in) +14776 (next-mu-token *(ebp+0xc) %ecx) +14777 #? (write-buffered Stderr "tok: ") +14778 #? (write-slice-buffered Stderr %ecx) +14779 #? (write-buffered Stderr "$\n") +14780 #? (flush Stderr) +14781 # assert s != "" +14782 (slice-equal? %ecx "") # => eax +14783 3d/compare-eax-and 0/imm32/false +14784 0f 85/jump-if-!= $parse-type:abort/disp32 +14785 # assert s != "{" +14786 (slice-equal? %ecx "{") # => eax +14787 3d/compare-eax-and 0/imm32/false +14788 0f 85/jump-if-!= $parse-type:abort/disp32 +14789 # assert s != "}" +14790 (slice-equal? %ecx "}") # => eax +14791 3d/compare-eax-and 0/imm32/false +14792 0f 85/jump-if-!= $parse-type:abort/disp32 +14793 # assert s != "->" +14794 (slice-equal? %ecx "->") # => eax +14795 3d/compare-eax-and 0/imm32/false +14796 0f 85/jump-if-!= $parse-type:abort/disp32 +14797 # if (s == ")") return +14798 (slice-equal? %ecx ")") # => eax +14799 3d/compare-eax-and 0/imm32/false +14800 0f 85/jump-if-!= $parse-type:end/disp32 +14801 # out = new tree +14802 (allocate *(ebp+8) *Type-tree-size *(ebp+0x10)) +14803 # var out-addr/edx: (addr type-tree) = lookup(*out) +14804 8b/-> *(ebp+0x10) 2/r32/edx +14805 (lookup *edx *(edx+4)) # => eax +14806 89/<- %edx 0/r32/eax +14807 { +14808 # if (s != "(") break +14809 (slice-equal? %ecx "(") # => eax +14810 3d/compare-eax-and 0/imm32/false +14811 0f 85/jump-if-!= break/disp32 +14812 # if s is a number, store it in the type's size field +14813 { +14814 $parse-type:check-for-int: +14815 # var tmp/eax: byte = *s->slice +14816 8b/-> *ecx 0/r32/eax +14817 8a/copy-byte *eax 0/r32/AL +14818 81 4/subop/and %eax 0xff/imm32 +14819 # TODO: raise an error on `var x: (array int a)` +14820 (is-decimal-digit? %eax) # => eax +14821 3d/compare-eax-and 0/imm32/false +14822 74/jump-if-= break/disp8 +14823 # +14824 (is-hex-int? %ecx) # => eax +14825 3d/compare-eax-and 0/imm32/false +14826 74/jump-if-= break/disp8 +14827 $parse-type:int: +14828 (check-mu-hex-int %ecx *(ebp+0x14) *(ebp+0x18)) +14829 (parse-hex-int-from-slice %ecx) # => eax +14830 c7 0/subop/copy *(edx+4) 9/imm32/type-id-array-capacity # Type-tree-value +14831 89/<- *(edx+8) 0/r32/eax # Type-tree-value-size +14832 e9/jump $parse-type:end/disp32 +14833 } +14834 $parse-type:atom: +14835 # out->is-atom? = true +14836 c7 0/subop/copy *edx 1/imm32/true # Type-tree-is-atom +14837 { +14838 $parse-type:check-for-type-parameter: +14839 # var tmp/eax: byte = *s->slice +14840 8b/-> *ecx 0/r32/eax +14841 8a/copy-byte *eax 0/r32/AL +14842 81 4/subop/and %eax 0xff/imm32 +14843 # if (tmp != '_') break +14844 3d/compare-eax-and 0x5f/imm32/_ +14845 75/jump-if-!= break/disp8 +14846 $parse-type:type-parameter: +14847 # out->value = type-parameter +14848 c7 0/subop/copy *(edx+4) 0xa/imm32/type-parameter # Type-tree-value +14849 # out->parameter-name = slice-to-string(ad, s) +14850 8d/copy-address *(edx+8) 0/r32/eax # Type-tree-parameter-name +14851 (slice-to-string *(ebp+8) %ecx %eax) +14852 e9/jump $parse-type:end/disp32 +14853 } +14854 $parse-type:non-type-parameter: +14855 # out->value = pos-or-insert-slice(Type-id, s) +14856 (pos-or-insert-slice Type-id %ecx) # => eax +14857 89/<- *(edx+4) 0/r32/eax # Type-tree-value +14858 e9/jump $parse-type:end/disp32 +14859 } +14860 $parse-type:non-atom: +14861 # otherwise s == "(" +14862 # out->left = parse-type(ad, in) +14863 8d/copy-address *(edx+4) 0/r32/eax # Type-tree-left +14864 (parse-type *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) +14865 # out->right = parse-type-tree(ad, in) +14866 8d/copy-address *(edx+0xc) 0/r32/eax # Type-tree-right +14867 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) +14868 $parse-type:end: +14869 # . reclaim locals +14870 81 0/subop/add %esp 8/imm32 +14871 # . restore registers +14872 5a/pop-to-edx +14873 59/pop-to-ecx +14874 58/pop-to-eax +14875 # . epilogue +14876 89/<- %esp 5/r32/ebp +14877 5d/pop-to-ebp +14878 c3/return +14879 +14880 $parse-type:abort: +14881 # error("unexpected token when parsing type: '" s "'\n") +14882 (write-buffered *(ebp+0x14) "unexpected token when parsing type: '") +14883 (write-slice-buffered *(ebp+0x14) %ecx) +14884 (write-buffered *(ebp+0x14) "'\n") +14885 (flush *(ebp+0x14)) +14886 (stop *(ebp+0x18) 1) +14887 # never gets here +14888 +14889 parse-type-tree: # ad: (addr allocation-descriptor), in: (addr stream byte), out: (addr handle type-tree), err: (addr buffered-file), ed: (addr exit-descriptor) +14890 # pseudocode: +14891 # var tmp: (handle type-tree) = parse-type(ad, in) +14892 # if tmp == 0 +14893 # return 0 +14894 # out = allocate(Type-tree) +14895 # out->left = tmp +14896 # out->right = parse-type-tree(ad, in) +14897 # +14898 # . prologue +14899 55/push-ebp +14900 89/<- %ebp 4/r32/esp +14901 # . save registers +14902 50/push-eax +14903 51/push-ecx +14904 52/push-edx +14905 # +14906 (zero-out *(ebp+0x10) *Handle-size) +14907 # var tmp/ecx: (handle type-tree) +14908 68/push 0/imm32 +14909 68/push 0/imm32 +14910 89/<- %ecx 4/r32/esp +14911 # tmp = parse-type(ad, in) +14912 (parse-type *(ebp+8) *(ebp+0xc) %ecx *(ebp+0x14) *(ebp+0x18)) +14913 # if (tmp == 0) return +14914 81 7/subop/compare *ecx 0/imm32 +14915 74/jump-if-= $parse-type-tree:end/disp8 +14916 # out = new tree +14917 (allocate *(ebp+8) *Type-tree-size *(ebp+0x10)) +14918 # var out-addr/edx: (addr tree) = lookup(*out) +14919 8b/-> *(ebp+0x10) 2/r32/edx +14920 (lookup *edx *(edx+4)) # => eax +14921 89/<- %edx 0/r32/eax +14922 # out->left = tmp +14923 8b/-> *ecx 0/r32/eax +14924 89/<- *(edx+4) 0/r32/eax # Type-tree-left +14925 8b/-> *(ecx+4) 0/r32/eax +14926 89/<- *(edx+8) 0/r32/eax # Type-tree-left +14927 # out->right = parse-type-tree(ad, in) +14928 8d/copy-address *(edx+0xc) 0/r32/eax # Type-tree-right +14929 (parse-type-tree *(ebp+8) *(ebp+0xc) %eax *(ebp+0x14) *(ebp+0x18)) +14930 $parse-type-tree:end: +14931 # . reclaim locals +14932 81 0/subop/add %esp 8/imm32 +14933 # . restore registers +14934 5a/pop-to-edx +14935 59/pop-to-ecx +14936 58/pop-to-eax +14937 # . epilogue +14938 89/<- %esp 5/r32/ebp +14939 5d/pop-to-ebp +14940 c3/return +14941 +14942 next-mu-token: # in: (addr stream byte), out: (addr slice) +14943 # pseudocode: +14944 # start: +14945 # skip-chars-matching-whitespace(in) +14946 # if in->read >= in->write # end of in +14947 # out = {0, 0} +14948 # return +14949 # out->start = &in->data[in->read] +14950 # var curr-byte/eax: byte = in->data[in->read] +14951 # if curr->byte == ',' # comment token +14952 # ++in->read +14953 # goto start +14954 # if curr-byte == '#' # comment +14955 # goto done # treat as eof +14956 # if curr-byte == '"' # string literal +14957 # skip-string(in) +14958 # goto done # no metadata +14959 # if curr-byte == '(' +14960 # ++in->read +14961 # goto done +14962 # if curr-byte == ')' +14963 # ++in->read +14964 # goto done +14965 # # read a word +14966 # while true +14967 # if in->read >= in->write +14968 # break +14969 # curr-byte = in->data[in->read] +14970 # if curr-byte == ' ' +14971 # break +14972 # if curr-byte == '\r' +14973 # break +14974 # if curr-byte == '\n' +14975 # break +14976 # if curr-byte == '(' +14977 # break +14978 # if curr-byte == ')' +14979 # break +14980 # if curr-byte == ',' +14981 # break +14982 # ++in->read +14983 # done: +14984 # out->end = &in->data[in->read] +14985 # +14986 # . prologue +14987 55/push-ebp +14988 89/<- %ebp 4/r32/esp +14989 # . save registers +14990 50/push-eax +14991 51/push-ecx +14992 56/push-esi +14993 57/push-edi +14994 # esi = in +14995 8b/-> *(ebp+8) 6/r32/esi +14996 # edi = out +14997 8b/-> *(ebp+0xc) 7/r32/edi +14998 $next-mu-token:start: +14999 (skip-chars-matching-whitespace %esi) +15000 $next-mu-token:check0: +15001 # if (in->read >= in->write) return out = {0, 0} +15002 # . ecx = in->read +15003 8b/-> *(esi+4) 1/r32/ecx +15004 # . if (ecx >= in->write) return out = {0, 0} +15005 3b/compare<- *esi 1/r32/ecx +15006 c7 0/subop/copy *edi 0/imm32 +15007 c7 0/subop/copy *(edi+4) 0/imm32 +15008 0f 8d/jump-if->= $next-mu-token:end/disp32 +15009 # out->start = &in->data[in->read] +15010 8d/copy-address *(esi+ecx+0xc) 0/r32/eax +15011 89/<- *edi 0/r32/eax +15012 # var curr-byte/eax: byte = in->data[in->read] +15013 31/xor-with %eax 0/r32/eax +15014 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL +15015 { +15016 $next-mu-token:check-for-comma: +15017 # if (curr-byte != ',') break +15018 3d/compare-eax-and 0x2c/imm32/comma +15019 75/jump-if-!= break/disp8 +15020 # ++in->read +15021 ff 0/subop/increment *(esi+4) +15022 # restart +15023 e9/jump $next-mu-token:start/disp32 +15024 } +15025 { +15026 $next-mu-token:check-for-comment: +15027 # if (curr-byte != '#') break +15028 3d/compare-eax-and 0x23/imm32/pound +15029 75/jump-if-!= break/disp8 +15030 # return eof +15031 e9/jump $next-mu-token:done/disp32 +15032 } +15033 { +15034 $next-mu-token:check-for-string-literal: +15035 # if (curr-byte != '"') break +15036 3d/compare-eax-and 0x22/imm32/dquote +15037 75/jump-if-!= break/disp8 +15038 (skip-string %esi) +15039 # return +15040 e9/jump $next-mu-token:done/disp32 +15041 } +15042 { +15043 $next-mu-token:check-for-open-paren: +15044 # if (curr-byte != '(') break +15045 3d/compare-eax-and 0x28/imm32/open-paren +15046 75/jump-if-!= break/disp8 +15047 # ++in->read +15048 ff 0/subop/increment *(esi+4) +15049 # return +15050 e9/jump $next-mu-token:done/disp32 +15051 } +15052 { +15053 $next-mu-token:check-for-close-paren: +15054 # if (curr-byte != ')') break +15055 3d/compare-eax-and 0x29/imm32/close-paren +15056 75/jump-if-!= break/disp8 +15057 # ++in->read +15058 ff 0/subop/increment *(esi+4) +15059 # return +15060 e9/jump $next-mu-token:done/disp32 +15061 } +15062 { +15063 $next-mu-token:regular-word-without-metadata: +15064 # if (in->read >= in->write) break +15065 # . ecx = in->read +15066 8b/-> *(esi+4) 1/r32/ecx +15067 # . if (ecx >= in->write) break +15068 3b/compare<- *esi 1/r32/ecx +15069 7d/jump-if->= break/disp8 +15070 # var c/eax: byte = in->data[in->read] +15071 31/xor-with %eax 0/r32/eax +15072 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL +15073 # if (c == ' ') break +15074 3d/compare-eax-and 0x20/imm32/space +15075 74/jump-if-= break/disp8 +15076 # if (c == '\r') break +15077 3d/compare-eax-and 0xd/imm32/carriage-return +15078 74/jump-if-= break/disp8 +15079 # if (c == '\n') break +15080 3d/compare-eax-and 0xa/imm32/newline +15081 74/jump-if-= break/disp8 +15082 # if (c == '(') break +15083 3d/compare-eax-and 0x28/imm32/open-paren +15084 0f 84/jump-if-= break/disp32 +15085 # if (c == ')') break +15086 3d/compare-eax-and 0x29/imm32/close-paren +15087 0f 84/jump-if-= break/disp32 +15088 # if (c == ',') break +15089 3d/compare-eax-and 0x2c/imm32/comma +15090 0f 84/jump-if-= break/disp32 +15091 # ++in->read +15092 ff 0/subop/increment *(esi+4) +15093 # +15094 e9/jump loop/disp32 +15095 } +15096 $next-mu-token:done: +15097 # out->end = &in->data[in->read] +15098 8b/-> *(esi+4) 1/r32/ecx +15099 8d/copy-address *(esi+ecx+0xc) 0/r32/eax +15100 89/<- *(edi+4) 0/r32/eax +15101 $next-mu-token:end: +15102 # . restore registers +15103 5f/pop-to-edi +15104 5e/pop-to-esi +15105 59/pop-to-ecx +15106 58/pop-to-eax +15107 # . epilogue +15108 89/<- %esp 5/r32/ebp +15109 5d/pop-to-ebp +15110 c3/return +15111 +15112 pos-or-insert-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int +15113 # . prologue +15114 55/push-ebp +15115 89/<- %ebp 4/r32/esp +15116 # if (pos-slice(arr, s) != -1) return it +15117 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax +15118 3d/compare-eax-and -1/imm32 +15119 75/jump-if-!= $pos-or-insert-slice:end/disp8 +15120 $pos-or-insert-slice:insert: +15121 # var s2/eax: (handle array byte) +15122 68/push 0/imm32 +15123 68/push 0/imm32 +15124 89/<- %eax 4/r32/esp +15125 (slice-to-string Heap *(ebp+0xc) %eax) +15126 # throw away alloc-id +15127 (lookup *eax *(eax+4)) # => eax +15128 (write-int *(ebp+8) %eax) +15129 (pos-slice *(ebp+8) *(ebp+0xc)) # => eax +15130 $pos-or-insert-slice:end: +15131 # . reclaim locals +15132 81 0/subop/add %esp 8/imm32 +15133 # . epilogue +15134 89/<- %esp 5/r32/ebp +15135 5d/pop-to-ebp +15136 c3/return +15137 +15138 # return the index in an array of strings matching 's', -1 if not found +15139 # index is denominated in elements, not bytes +15140 pos-slice: # arr: (addr stream (addr array byte)), s: (addr slice) -> index/eax: int +15141 # . prologue +15142 55/push-ebp +15143 89/<- %ebp 4/r32/esp +15144 # . save registers +15145 51/push-ecx +15146 52/push-edx +15147 53/push-ebx +15148 56/push-esi +15149 #? (write-buffered Stderr "pos-slice: ") +15150 #? (write-slice-buffered Stderr *(ebp+0xc)) +15151 #? (write-buffered Stderr "\n") +15152 #? (flush Stderr) +15153 # esi = arr +15154 8b/-> *(ebp+8) 6/r32/esi +15155 # var index/ecx: int = 0 +15156 b9/copy-to-ecx 0/imm32 +15157 # var curr/edx: (addr (addr array byte)) = arr->data +15158 8d/copy-address *(esi+0xc) 2/r32/edx +15159 # var max/ebx: (addr (addr array byte)) = &arr->data[arr->write] +15160 8b/-> *esi 3/r32/ebx +15161 8d/copy-address *(esi+ebx+0xc) 3/r32/ebx +15162 { +15163 #? (write-buffered Stderr " ") +15164 #? (write-int32-hex-buffered Stderr %ecx) +15165 #? (write-buffered Stderr "\n") +15166 #? (flush Stderr) +15167 # if (curr >= max) return -1 +15168 39/compare %edx 3/r32/ebx +15169 b8/copy-to-eax -1/imm32 +15170 73/jump-if-addr>= $pos-slice:end/disp8 +15171 # if (slice-equal?(s, *curr)) break +15172 (slice-equal? *(ebp+0xc) *edx) # => eax +15173 3d/compare-eax-and 0/imm32/false +15174 75/jump-if-!= break/disp8 +15175 # ++index +15176 41/increment-ecx +15177 # curr += 4 +15178 81 0/subop/add %edx 4/imm32 +15179 # +15180 eb/jump loop/disp8 +15181 } +15182 # return index +15183 89/<- %eax 1/r32/ecx +15184 $pos-slice:end: +15185 #? (write-buffered Stderr "=> ") +15186 #? (write-int32-hex-buffered Stderr %eax) +15187 #? (write-buffered Stderr "\n") +15188 # . restore registers +15189 5e/pop-to-esi +15190 5b/pop-to-ebx +15191 5a/pop-to-edx +15192 59/pop-to-ecx +15193 # . epilogue +15194 89/<- %esp 5/r32/ebp +15195 5d/pop-to-ebp +15196 c3/return +15197 +15198 test-parse-var-with-type: +15199 # . prologue +15200 55/push-ebp +15201 89/<- %ebp 4/r32/esp +15202 # setup +15203 8b/-> *Primitive-type-ids 0/r32/eax +15204 89/<- *Type-id 0/r32/eax # stream-write +15205 # (eax..ecx) = "x:" +15206 b8/copy-to-eax "x:"/imm32 +15207 8b/-> *eax 1/r32/ecx +15208 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15209 05/add-to-eax 4/imm32 +15210 # var slice/ecx: slice = {eax, ecx} +15211 51/push-ecx +15212 50/push-eax +15213 89/<- %ecx 4/r32/esp +15214 # _test-input-stream contains "int" +15215 (clear-stream _test-input-stream) +15216 (write _test-input-stream "int") +15217 # var v/edx: (handle var) +15218 68/push 0/imm32 +15219 68/push 0/imm32 +15220 89/<- %edx 4/r32/esp +15221 # +15222 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) +15223 # var v-addr/edx: (addr var) = lookup(v) +15224 (lookup *edx *(edx+4)) # => eax +15225 89/<- %edx 0/r32/eax +15226 # check v-addr->name +15227 (lookup *edx *(edx+4)) # Var-name Var-name => eax +15228 (check-strings-equal %eax "x" "F - test-parse-var-with-type/name") +15229 # check v-addr->type +15230 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +15231 (check-ints-equal *eax 1 "F - test-parse-var-with-type/type:0") # Type-tree-is-atom +15232 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type/type:1") # Type-tree-value +15233 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type/type:2") # Type-tree-right +15234 # . epilogue +15235 89/<- %esp 5/r32/ebp +15236 5d/pop-to-ebp +15237 c3/return +15238 +15239 test-parse-var-with-type-and-register: +15240 # . prologue +15241 55/push-ebp +15242 89/<- %ebp 4/r32/esp +15243 # setup +15244 8b/-> *Primitive-type-ids 0/r32/eax +15245 89/<- *Type-id 0/r32/eax # stream-write +15246 # (eax..ecx) = "x/eax:" +15247 b8/copy-to-eax "x/eax:"/imm32 +15248 8b/-> *eax 1/r32/ecx +15249 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15250 05/add-to-eax 4/imm32 +15251 # var slice/ecx: slice = {eax, ecx} +15252 51/push-ecx +15253 50/push-eax +15254 89/<- %ecx 4/r32/esp +15255 # _test-input-stream contains "int" +15256 (clear-stream _test-input-stream) +15257 (write _test-input-stream "int") +15258 # var v/edx: (handle var) +15259 68/push 0/imm32 +15260 68/push 0/imm32 +15261 89/<- %edx 4/r32/esp +15262 # +15263 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) +15264 # var v-addr/edx: (addr var) = lookup(v) +15265 (lookup *edx *(edx+4)) # => eax +15266 89/<- %edx 0/r32/eax +15267 # check v-addr->name +15268 (lookup *edx *(edx+4)) # Var-name Var-name => eax +15269 (check-strings-equal %eax "x" "F - test-parse-var-with-type-and-register/name") +15270 # check v-addr->register +15271 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +15272 (check-strings-equal %eax "eax" "F - test-parse-var-with-type-and-register/register") +15273 # check v-addr->type +15274 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +15275 (check-ints-equal *eax 1 "F - test-parse-var-with-type-and-register/type:0") # Type-tree-is-atom +15276 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-type-and-register/type:1") # Type-tree-left +15277 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-type-and-register/type:2") # Type-tree-right +15278 # . epilogue +15279 89/<- %esp 5/r32/ebp +15280 5d/pop-to-ebp +15281 c3/return +15282 +15283 test-parse-var-with-trailing-characters: +15284 # . prologue +15285 55/push-ebp +15286 89/<- %ebp 4/r32/esp +15287 # setup +15288 8b/-> *Primitive-type-ids 0/r32/eax +15289 89/<- *Type-id 0/r32/eax # stream-write +15290 # (eax..ecx) = "x:" +15291 b8/copy-to-eax "x:"/imm32 +15292 8b/-> *eax 1/r32/ecx +15293 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15294 05/add-to-eax 4/imm32 +15295 # var slice/ecx: slice = {eax, ecx} +15296 51/push-ecx +15297 50/push-eax +15298 89/<- %ecx 4/r32/esp +15299 # _test-input-stream contains "int," +15300 (clear-stream _test-input-stream) +15301 (write _test-input-stream "int,") +15302 # var v/edx: (handle var) +15303 68/push 0/imm32 +15304 68/push 0/imm32 +15305 89/<- %edx 4/r32/esp +15306 # +15307 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) +15308 # var v-addr/edx: (addr var) = lookup(v) +15309 (lookup *edx *(edx+4)) # => eax +15310 89/<- %edx 0/r32/eax +15311 # check v-addr->name +15312 (lookup *edx *(edx+4)) # Var-name Var-name => eax +15313 (check-strings-equal %eax "x" "F - test-parse-var-with-trailing-characters/name") +15314 # check v-addr->register +15315 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-trailing-characters/register") # Var-register +15316 # check v-addr->type +15317 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +15318 (check-ints-equal *eax 1 "F - test-parse-var-with-trailing-characters/type:0") # Type-tree-is-atom +15319 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-trailing-characters/type:1") # Type-tree-left +15320 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-trailing-characters/type:1") # Type-tree-right +15321 # . epilogue +15322 89/<- %esp 5/r32/ebp +15323 5d/pop-to-ebp +15324 c3/return +15325 +15326 test-parse-var-with-register-and-trailing-characters: +15327 # . prologue +15328 55/push-ebp +15329 89/<- %ebp 4/r32/esp +15330 # setup +15331 8b/-> *Primitive-type-ids 0/r32/eax +15332 89/<- *Type-id 0/r32/eax # stream-write +15333 # (eax..ecx) = "x/eax:" +15334 b8/copy-to-eax "x/eax:"/imm32 +15335 8b/-> *eax 1/r32/ecx +15336 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15337 05/add-to-eax 4/imm32 +15338 # var slice/ecx: slice = {eax, ecx} +15339 51/push-ecx +15340 50/push-eax +15341 89/<- %ecx 4/r32/esp +15342 # _test-input-stream contains "int," +15343 (clear-stream _test-input-stream) +15344 (write _test-input-stream "int,") +15345 # var v/edx: (handle var) +15346 68/push 0/imm32 +15347 68/push 0/imm32 +15348 89/<- %edx 4/r32/esp +15349 # +15350 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) +15351 # var v-addr/edx: (addr var) = lookup(v) +15352 (lookup *edx *(edx+4)) # => eax +15353 89/<- %edx 0/r32/eax +15354 # check v-addr->name +15355 (lookup *edx *(edx+4)) # Var-name Var-name => eax +15356 (check-strings-equal %eax "x" "F - test-parse-var-with-register-and-trailing-characters/name") +15357 # check v-addr->register +15358 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +15359 (check-strings-equal %eax "eax" "F - test-parse-var-with-register-and-trailing-characters/register") +15360 # check v-addr->type +15361 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +15362 (check-ints-equal *eax 1 "F - test-parse-var-with-register-and-trailing-characters/type:0") # Type-tree-is-atom +15363 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-register-and-trailing-characters/type:1") # Type-tree-left +15364 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-register-and-trailing-characters/type:2") # Type-tree-right +15365 # . epilogue +15366 89/<- %esp 5/r32/ebp +15367 5d/pop-to-ebp +15368 c3/return +15369 +15370 test-parse-var-with-compound-type: +15371 # . prologue +15372 55/push-ebp +15373 89/<- %ebp 4/r32/esp +15374 # setup +15375 8b/-> *Primitive-type-ids 0/r32/eax +15376 89/<- *Type-id 0/r32/eax # stream-write +15377 # (eax..ecx) = "x:" +15378 b8/copy-to-eax "x:"/imm32 +15379 8b/-> *eax 1/r32/ecx +15380 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15381 05/add-to-eax 4/imm32 +15382 # var slice/ecx: slice = {eax, ecx} +15383 51/push-ecx +15384 50/push-eax +15385 89/<- %ecx 4/r32/esp +15386 # _test-input-stream contains "(addr int)" +15387 (clear-stream _test-input-stream) +15388 (write _test-input-stream "(addr int)") +15389 # var v/edx: (handle var) +15390 68/push 0/imm32 +15391 68/push 0/imm32 +15392 89/<- %edx 4/r32/esp +15393 # +15394 (parse-var-with-type %ecx _test-input-stream %edx Stderr 0) +15395 # var v-addr/edx: (addr var) = lookup(v) +15396 (lookup *edx *(edx+4)) # => eax +15397 89/<- %edx 0/r32/eax +15398 # check v-addr->name +15399 (lookup *edx *(edx+4)) # Var-name Var-name => eax +15400 (check-strings-equal %eax "x" "F - test-parse-var-with-compound-type/name") +15401 # check v-addr->register +15402 (check-ints-equal *(edx+0x18) 0 "F - test-parse-var-with-compound-type/register") # Var-register +15403 # - check v-addr->type +15404 # var type/edx: (addr type-tree) = var->type +15405 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +15406 89/<- %edx 0/r32/eax +15407 # type is a non-atom +15408 (check-ints-equal *edx 0 "F - test-parse-var-with-compound-type/type:0") # Type-tree-is-atom +15409 # type->left == atom(addr) +15410 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +15411 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:1") # Type-tree-is-atom +15412 (check-ints-equal *(eax+4) 2 "F - test-parse-var-with-compound-type/type:2") # Type-tree-value +15413 # type->right->left == atom(int) +15414 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax +15415 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +15416 (check-ints-equal *eax 1 "F - test-parse-var-with-compound-type/type:3") # Type-tree-is-atom +15417 (check-ints-equal *(eax+4) 1 "F - test-parse-var-with-compound-type/type:4") # Type-tree-value +15418 # type->right->right == null +15419 (check-ints-equal *(eax+0xc) 0 "F - test-parse-var-with-compound-type/type:5") # Type-tree-right +15420 # . epilogue +15421 89/<- %esp 5/r32/ebp +15422 5d/pop-to-ebp +15423 c3/return +15424 +15425 # identifier starts with a letter or '$' or '_' +15426 # no constraints at the moment on later letters +15427 # all we really want to do so far is exclude '{', '}' and '->' +15428 is-identifier?: # in: (addr slice) -> result/eax: boolean +15429 # . prologue +15430 55/push-ebp +15431 89/<- %ebp 4/r32/esp +15432 # if (slice-empty?(in)) return false +15433 (slice-empty? *(ebp+8)) # => eax +15434 3d/compare-eax-and 0/imm32/false +15435 75/jump-if-!= $is-identifier?:false/disp8 +15436 # var c/eax: byte = *in->start +15437 8b/-> *(ebp+8) 0/r32/eax +15438 8b/-> *eax 0/r32/eax +15439 8a/copy-byte *eax 0/r32/AL +15440 81 4/subop/and %eax 0xff/imm32 +15441 # if (c == '$') return true +15442 3d/compare-eax-and 0x24/imm32/$ +15443 74/jump-if-= $is-identifier?:true/disp8 +15444 # if (c == '_') return true +15445 3d/compare-eax-and 0x5f/imm32/_ +15446 74/jump-if-= $is-identifier?:true/disp8 +15447 # drop case +15448 25/and-eax-with 0x5f/imm32 +15449 # if (c < 'A') return false +15450 3d/compare-eax-and 0x41/imm32/A +15451 7c/jump-if-< $is-identifier?:false/disp8 +15452 # if (c > 'Z') return false +15453 3d/compare-eax-and 0x5a/imm32/Z +15454 7f/jump-if-> $is-identifier?:false/disp8 +15455 # otherwise return true +15456 $is-identifier?:true: +15457 b8/copy-to-eax 1/imm32/true +15458 eb/jump $is-identifier?:end/disp8 +15459 $is-identifier?:false: +15460 b8/copy-to-eax 0/imm32/false +15461 $is-identifier?:end: +15462 # . epilogue +15463 89/<- %esp 5/r32/ebp +15464 5d/pop-to-ebp +15465 c3/return +15466 +15467 test-is-identifier-dollar: +15468 # . prologue +15469 55/push-ebp +15470 89/<- %ebp 4/r32/esp +15471 # (eax..ecx) = "$a" +15472 b8/copy-to-eax "$a"/imm32 +15473 8b/-> *eax 1/r32/ecx +15474 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15475 05/add-to-eax 4/imm32 +15476 # var slice/ecx: slice = {eax, ecx} +15477 51/push-ecx +15478 50/push-eax +15479 89/<- %ecx 4/r32/esp +15480 # +15481 (is-identifier? %ecx) +15482 (check-ints-equal %eax 1 "F - test-is-identifier-dollar") +15483 # . epilogue +15484 89/<- %esp 5/r32/ebp +15485 5d/pop-to-ebp +15486 c3/return +15487 +15488 test-is-identifier-underscore: +15489 # . prologue +15490 55/push-ebp +15491 89/<- %ebp 4/r32/esp +15492 # (eax..ecx) = "_a" +15493 b8/copy-to-eax "_a"/imm32 +15494 8b/-> *eax 1/r32/ecx +15495 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15496 05/add-to-eax 4/imm32 +15497 # var slice/ecx: slice = {eax, ecx} +15498 51/push-ecx +15499 50/push-eax +15500 89/<- %ecx 4/r32/esp +15501 # +15502 (is-identifier? %ecx) +15503 (check-ints-equal %eax 1 "F - test-is-identifier-underscore") +15504 # . epilogue +15505 89/<- %esp 5/r32/ebp +15506 5d/pop-to-ebp +15507 c3/return +15508 +15509 test-is-identifier-a: +15510 # . prologue +15511 55/push-ebp +15512 89/<- %ebp 4/r32/esp +15513 # (eax..ecx) = "a$" +15514 b8/copy-to-eax "a$"/imm32 +15515 8b/-> *eax 1/r32/ecx +15516 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15517 05/add-to-eax 4/imm32 +15518 # var slice/ecx: slice = {eax, ecx} +15519 51/push-ecx +15520 50/push-eax +15521 89/<- %ecx 4/r32/esp +15522 # +15523 (is-identifier? %ecx) +15524 (check-ints-equal %eax 1 "F - test-is-identifier-a") +15525 # . epilogue +15526 89/<- %esp 5/r32/ebp +15527 5d/pop-to-ebp +15528 c3/return +15529 +15530 test-is-identifier-z: +15531 # . prologue +15532 55/push-ebp +15533 89/<- %ebp 4/r32/esp +15534 # (eax..ecx) = "z$" +15535 b8/copy-to-eax "z$"/imm32 +15536 8b/-> *eax 1/r32/ecx +15537 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15538 05/add-to-eax 4/imm32 +15539 # var slice/ecx: slice = {eax, ecx} +15540 51/push-ecx +15541 50/push-eax +15542 89/<- %ecx 4/r32/esp +15543 # +15544 (is-identifier? %ecx) +15545 (check-ints-equal %eax 1 "F - test-is-identifier-z") +15546 # . epilogue +15547 89/<- %esp 5/r32/ebp +15548 5d/pop-to-ebp +15549 c3/return +15550 +15551 test-is-identifier-A: +15552 # . prologue +15553 55/push-ebp +15554 89/<- %ebp 4/r32/esp +15555 # (eax..ecx) = "A$" +15556 b8/copy-to-eax "A$"/imm32 +15557 8b/-> *eax 1/r32/ecx +15558 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15559 05/add-to-eax 4/imm32 +15560 # var slice/ecx: slice = {eax, ecx} +15561 51/push-ecx +15562 50/push-eax +15563 89/<- %ecx 4/r32/esp +15564 # +15565 (is-identifier? %ecx) +15566 (check-ints-equal %eax 1 "F - test-is-identifier-A") +15567 # . epilogue +15568 89/<- %esp 5/r32/ebp +15569 5d/pop-to-ebp +15570 c3/return +15571 +15572 test-is-identifier-Z: +15573 # . prologue +15574 55/push-ebp +15575 89/<- %ebp 4/r32/esp +15576 # (eax..ecx) = "Z$" +15577 b8/copy-to-eax "Z$"/imm32 +15578 8b/-> *eax 1/r32/ecx +15579 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15580 05/add-to-eax 4/imm32 +15581 # var slice/ecx: slice = {eax, ecx} +15582 51/push-ecx 15583 50/push-eax -15584 51/push-ecx -15585 57/push-edi -15586 # var v/ecx: (handle var) -15587 68/push 0/imm32 -15588 68/push 0/imm32 -15589 89/<- %ecx 4/r32/esp -15590 # -15591 (new-literal Heap *(ebp+8) %ecx) -15592 # push(vars, v) -15593 (push *(ebp+0x10) *ecx) -15594 (push *(ebp+0x10) *(ecx+4)) -15595 (push *(ebp+0x10) 0) # false -15596 # -15597 (parse-mu-block *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20)) -15598 # pop v off vars -15599 (pop *(ebp+0x10)) # => eax -15600 (pop *(ebp+0x10)) # => eax -15601 (pop *(ebp+0x10)) # => eax -15602 # var out-addr/edi: (addr stmt) = lookup(*out) -15603 8b/-> *(ebp+0x18) 7/r32/edi -15604 (lookup *edi *(edi+4)) # => eax -15605 89/<- %edi 0/r32/eax -15606 # out-addr->tag = named-block -15607 c7 0/subop/copy *edi 0/imm32/block # Stmt-tag -15608 # out-addr->var = v -15609 8b/-> *ecx 0/r32/eax -15610 89/<- *(edi+0xc) 0/r32/eax # Block-var -15611 8b/-> *(ecx+4) 0/r32/eax -15612 89/<- *(edi+0x10) 0/r32/eax # Block-var -15613 $parse-mu-named-block:end: -15614 # . reclaim locals -15615 81 0/subop/add %esp 8/imm32 -15616 # . restore registers -15617 5f/pop-to-edi -15618 59/pop-to-ecx -15619 58/pop-to-eax -15620 # . epilogue -15621 89/<- %esp 5/r32/ebp -15622 5d/pop-to-ebp -15623 c3/return -15624 -15625 parse-mu-var-def: # line: (addr stream byte), vars: (addr stack live-var), out: (addr handle stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -15626 # . prologue -15627 55/push-ebp -15628 89/<- %ebp 4/r32/esp -15629 # . save registers -15630 50/push-eax -15631 51/push-ecx -15632 52/push-edx -15633 53/push-ebx -15634 57/push-edi -15635 # edi = out -15636 8b/-> *(ebp+0x10) 7/r32/edi -15637 # var word-slice/ecx: slice -15638 68/push 0/imm32/end -15639 68/push 0/imm32/start -15640 89/<- %ecx 4/r32/esp -15641 # var v/edx: (handle var) -15642 68/push 0/imm32 -15643 68/push 0/imm32 -15644 89/<- %edx 4/r32/esp -15645 # v = parse-var-with-type(next-mu-token(line)) -15646 (next-mu-token *(ebp+8) %ecx) -15647 (parse-var-with-type %ecx *(ebp+8) %edx *(ebp+0x18) *(ebp+0x1c)) -15648 # var v-addr/eax: (addr var) -15649 (lookup *edx *(edx+4)) # => eax -15650 # v->block-depth = *Curr-block-depth -15651 8b/-> *Curr-block-depth 3/r32/ebx -15652 89/<- *(eax+0x10) 3/r32/ebx # Var-block-depth -15653 # either v has no register and there's no more to this line -15654 8b/-> *(eax+0x18) 0/r32/eax # Var-register -15655 3d/compare-eax-and 0/imm32 -15656 { -15657 75/jump-if-!= break/disp8 -15658 # TODO: disallow vars of type 'byte' on the stack -15659 # ensure that there's nothing else on this line -15660 (next-mu-token *(ebp+8) %ecx) -15661 (slice-empty? %ecx) # => eax -15662 3d/compare-eax-and 0/imm32/false -15663 0f 84/jump-if-= $parse-mu-var-def:error2/disp32 -15664 # -15665 (new-var-def Heap *edx *(edx+4) %edi) -15666 e9/jump $parse-mu-var-def:update-vars/disp32 -15667 } -15668 # or v has a register and there's more to this line -15669 { -15670 0f 84/jump-if-= break/disp32 -15671 # TODO: disallow vars of type 'byte' in registers 'esi' or 'edi' -15672 # TODO: vars of type 'byte' should only be initialized by clearing to 0 -15673 # ensure that the next word is '<-' -15674 (next-mu-token *(ebp+8) %ecx) -15675 (slice-equal? %ecx "<-") # => eax -15676 3d/compare-eax-and 0/imm32/false -15677 0f 84/jump-if-= $parse-mu-var-def:error1/disp32 -15678 # -15679 (new-reg-var-def Heap *edx *(edx+4) %edi) -15680 (lookup *edi *(edi+4)) # => eax -15681 (add-operation-and-inputs-to-stmt %eax *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -15682 } -15683 $parse-mu-var-def:update-vars: -15684 # push 'v' at end of function -15685 (push *(ebp+0xc) *edx) -15686 (push *(ebp+0xc) *(edx+4)) -15687 (push *(ebp+0xc) 0) # Live-var-register-spilled is unused during parsing -15688 $parse-mu-var-def:end: -15689 # . reclaim locals -15690 81 0/subop/add %esp 0x10/imm32 -15691 # . restore registers -15692 5f/pop-to-edi -15693 5b/pop-to-ebx -15694 5a/pop-to-edx -15695 59/pop-to-ecx -15696 58/pop-to-eax +15584 89/<- %ecx 4/r32/esp +15585 # +15586 (is-identifier? %ecx) +15587 (check-ints-equal %eax 1 "F - test-is-identifier-Z") +15588 # . epilogue +15589 89/<- %esp 5/r32/ebp +15590 5d/pop-to-ebp +15591 c3/return +15592 +15593 test-is-identifier-at: +15594 # character before 'A' is invalid +15595 # . prologue +15596 55/push-ebp +15597 89/<- %ebp 4/r32/esp +15598 # (eax..ecx) = "@a" +15599 b8/copy-to-eax "@a"/imm32 +15600 8b/-> *eax 1/r32/ecx +15601 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15602 05/add-to-eax 4/imm32 +15603 # var slice/ecx: slice = {eax, ecx} +15604 51/push-ecx +15605 50/push-eax +15606 89/<- %ecx 4/r32/esp +15607 # +15608 (is-identifier? %ecx) +15609 (check-ints-equal %eax 0 "F - test-is-identifier-@") +15610 # . epilogue +15611 89/<- %esp 5/r32/ebp +15612 5d/pop-to-ebp +15613 c3/return +15614 +15615 test-is-identifier-square-bracket: +15616 # character after 'Z' is invalid +15617 # . prologue +15618 55/push-ebp +15619 89/<- %ebp 4/r32/esp +15620 # (eax..ecx) = "[a" +15621 b8/copy-to-eax "[a"/imm32 +15622 8b/-> *eax 1/r32/ecx +15623 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15624 05/add-to-eax 4/imm32 +15625 # var slice/ecx: slice = {eax, ecx} +15626 51/push-ecx +15627 50/push-eax +15628 89/<- %ecx 4/r32/esp +15629 # +15630 (is-identifier? %ecx) +15631 (check-ints-equal %eax 0 "F - test-is-identifier-@") +15632 # . epilogue +15633 89/<- %esp 5/r32/ebp +15634 5d/pop-to-ebp +15635 c3/return +15636 +15637 test-is-identifier-backtick: +15638 # character before 'a' is invalid +15639 # . prologue +15640 55/push-ebp +15641 89/<- %ebp 4/r32/esp +15642 # (eax..ecx) = "`a" +15643 b8/copy-to-eax "`a"/imm32 +15644 8b/-> *eax 1/r32/ecx +15645 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15646 05/add-to-eax 4/imm32 +15647 # var slice/ecx: slice = {eax, ecx} +15648 51/push-ecx +15649 50/push-eax +15650 89/<- %ecx 4/r32/esp +15651 # +15652 (is-identifier? %ecx) +15653 (check-ints-equal %eax 0 "F - test-is-identifier-backtick") +15654 # . epilogue +15655 89/<- %esp 5/r32/ebp +15656 5d/pop-to-ebp +15657 c3/return +15658 +15659 test-is-identifier-curly-brace-open: +15660 # character after 'z' is invalid; also used for blocks +15661 # . prologue +15662 55/push-ebp +15663 89/<- %ebp 4/r32/esp +15664 # (eax..ecx) = "{a" +15665 b8/copy-to-eax "{a"/imm32 +15666 8b/-> *eax 1/r32/ecx +15667 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15668 05/add-to-eax 4/imm32 +15669 # var slice/ecx: slice = {eax, ecx} +15670 51/push-ecx +15671 50/push-eax +15672 89/<- %ecx 4/r32/esp +15673 # +15674 (is-identifier? %ecx) +15675 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-open") +15676 # . epilogue +15677 89/<- %esp 5/r32/ebp +15678 5d/pop-to-ebp +15679 c3/return +15680 +15681 test-is-identifier-curly-brace-close: +15682 # . prologue +15683 55/push-ebp +15684 89/<- %ebp 4/r32/esp +15685 # (eax..ecx) = "}a" +15686 b8/copy-to-eax "}a"/imm32 +15687 8b/-> *eax 1/r32/ecx +15688 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15689 05/add-to-eax 4/imm32 +15690 # var slice/ecx: slice = {eax, ecx} +15691 51/push-ecx +15692 50/push-eax +15693 89/<- %ecx 4/r32/esp +15694 # +15695 (is-identifier? %ecx) +15696 (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-close") 15697 # . epilogue 15698 89/<- %esp 5/r32/ebp 15699 5d/pop-to-ebp 15700 c3/return 15701 -15702 $parse-mu-var-def:error1: -15703 (rewind-stream *(ebp+8)) -15704 # error("register variable requires a valid instruction to initialize but got '" line "'\n") -15705 (write-buffered *(ebp+0x18) "register variable requires a valid instruction to initialize but got '") -15706 (flush *(ebp+0x18)) -15707 (write-stream-data *(ebp+0x18) *(ebp+8)) -15708 (write-buffered *(ebp+0x18) "'\n") -15709 (flush *(ebp+0x18)) -15710 (stop *(ebp+0x1c) 1) -15711 # never gets here -15712 -15713 $parse-mu-var-def:error2: -15714 (rewind-stream *(ebp+8)) -15715 # error("fn " fn ": var " var ": variables on the stack can't take an initializer\n") -15716 (write-buffered *(ebp+0x18) "fn ") -15717 8b/-> *(ebp+0x14) 0/r32/eax -15718 (lookup *eax *(eax+4)) # Function-name Function-name => eax -15719 (write-buffered *(ebp+0x18) %eax) -15720 (write-buffered *(ebp+0x18) ": var ") -15721 # var v-addr/eax: (addr var) = lookup(v) -15722 (lookup *edx *(edx+4)) # => eax -15723 (lookup *eax *(eax+4)) # Var-name Var-name => eax -15724 (write-buffered *(ebp+0x18) %eax) -15725 (write-buffered *(ebp+0x18) ": variables on the stack can't take an initializer\n") -15726 (flush *(ebp+0x18)) -15727 (stop *(ebp+0x1c) 1) -15728 # never gets here -15729 -15730 test-parse-mu-var-def: -15731 # 'var n: int' -15732 # . prologue -15733 55/push-ebp -15734 89/<- %ebp 4/r32/esp -15735 # setup -15736 8b/-> *Primitive-type-ids 0/r32/eax -15737 89/<- *Type-id 0/r32/eax # stream-write -15738 (clear-stream _test-input-stream) -15739 (write _test-input-stream "n: int\n") # caller has consumed the 'var' -15740 c7 0/subop/copy *Curr-block-depth 1/imm32 -15741 # var out/esi: (handle stmt) -15742 68/push 0/imm32 -15743 68/push 0/imm32 -15744 89/<- %esi 4/r32/esp -15745 # var vars/ecx: (stack (addr var) 16) -15746 81 5/subop/subtract %esp 0xc0/imm32 -15747 68/push 0xc0/imm32/size -15748 68/push 0/imm32/top -15749 89/<- %ecx 4/r32/esp -15750 (clear-stack %ecx) -15751 # convert -15752 (parse-mu-var-def _test-input-stream %ecx %esi 0 Stderr 0) -15753 # var out-addr/esi: (addr stmt) -15754 (lookup *esi *(esi+4)) # => eax -15755 89/<- %esi 0/r32/eax -15756 # -15757 (check-ints-equal *esi 2 "F - test-parse-mu-var-def/tag") # Stmt-tag is var-def -15758 # var v/ecx: (addr var) = lookup(out->var) -15759 (lookup *(esi+4) *(esi+8)) # Vardef-var Vardef-var => eax -15760 89/<- %ecx 0/r32/eax -15761 # v->name -15762 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -15763 (check-strings-equal %eax "n" "F - test-parse-mu-var-def/var-name") -15764 # v->register -15765 (check-ints-equal *(ecx+0x18) 0 "F - test-parse-mu-var-def/var-register") # Var-register -15766 # v->block-depth -15767 (check-ints-equal *(ecx+0x10) 1 "F - test-parse-mu-var-def/output-block-depth") # Var-block-depth -15768 # v->type == int -15769 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -15770 (check-ints-equal *eax 1 "F - test-parse-mu-var-def/var-type:0") # Type-tree-is-atom -15771 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-var-def/var-type:1") # Type-tree-value -15772 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-var-def/var-type:2") # Type-tree-right -15773 # . epilogue -15774 89/<- %esp 5/r32/ebp -15775 5d/pop-to-ebp -15776 c3/return -15777 -15778 test-parse-mu-reg-var-def: -15779 # 'var n/eax: int <- copy 0' -15780 # . prologue -15781 55/push-ebp -15782 89/<- %ebp 4/r32/esp -15783 # setup -15784 8b/-> *Primitive-type-ids 0/r32/eax -15785 89/<- *Type-id 0/r32/eax # stream-write -15786 (clear-stream _test-input-stream) -15787 (write _test-input-stream "n/eax: int <- copy 0\n") # caller has consumed the 'var' -15788 c7 0/subop/copy *Curr-block-depth 1/imm32 -15789 # var out/esi: (handle stmt) -15790 68/push 0/imm32 -15791 68/push 0/imm32 -15792 89/<- %esi 4/r32/esp -15793 # var vars/ecx: (stack (addr var) 16) -15794 81 5/subop/subtract %esp 0xc0/imm32 -15795 68/push 0xc0/imm32/size -15796 68/push 0/imm32/top -15797 89/<- %ecx 4/r32/esp -15798 (clear-stack %ecx) -15799 # convert -15800 (parse-mu-var-def _test-input-stream %ecx %esi 0 Stderr 0) -15801 # var out-addr/esi: (addr stmt) -15802 (lookup *esi *(esi+4)) # => eax -15803 89/<- %esi 0/r32/eax -15804 # -15805 (check-ints-equal *esi 3 "F - test-parse-mu-reg-var-def/tag") # Stmt-tag is reg-var-def -15806 # var v/ecx: (addr var) = lookup(out->outputs->value) -15807 # . eax: (addr stmt-var) = lookup(out->outputs) -15808 (lookup *(esi+0x14) *(esi+0x18)) # Regvardef-outputs Regvardef-outputs => eax -15809 # . -15810 (check-ints-equal *(eax+8) 0 "F - test-parse-mu-reg-var-def/single-output") # Stmt-var-next -15811 # . eax: (addr var) = lookup(eax->value) -15812 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -15813 # . ecx = eax -15814 89/<- %ecx 0/r32/eax -15815 # v->name -15816 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -15817 (check-strings-equal %eax "n" "F - test-parse-mu-reg-var-def/output-name") # Var-name -15818 # v->register -15819 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax -15820 (check-strings-equal %eax "eax" "F - test-parse-mu-reg-var-def/output-register") -15821 # v->block-depth -15822 (check-ints-equal *(ecx+0x10) 1 "F - test-parse-mu-reg-var-def/output-block-depth") # Var-block-depth -15823 # v->type == int -15824 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -15825 (check-ints-equal *eax 1 "F - test-parse-mu-reg-var-def/output-type:0") # Type-tree-is-atom -15826 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-reg-var-def/output-type:1") # Type-tree-value -15827 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-reg-var-def/output-type:2") # Type-tree-right -15828 # . epilogue -15829 89/<- %esp 5/r32/ebp -15830 5d/pop-to-ebp -15831 c3/return -15832 -15833 parse-mu-stmt: # line: (addr stream byte), vars: (addr stack live-var), fn: (addr function), out: (addr handle stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -15834 # pseudocode: -15835 # var name: slice -15836 # allocate(Heap, Stmt-size, out) -15837 # var out-addr: (addr stmt) = lookup(*out) -15838 # out-addr->tag = stmt -15839 # if stmt-has-outputs?(line) -15840 # while true -15841 # name = next-mu-token(line) -15842 # if (name == '<-') break -15843 # assert(is-identifier?(name)) -15844 # var v: (handle var) = lookup-var(name, vars) -15845 # out-addr->outputs = append(v, out-addr->outputs) -15846 # add-operation-and-inputs-to-stmt(out-addr, line, vars) -15847 # -15848 # . prologue -15849 55/push-ebp -15850 89/<- %ebp 4/r32/esp -15851 # . save registers -15852 50/push-eax -15853 51/push-ecx -15854 52/push-edx -15855 53/push-ebx -15856 57/push-edi -15857 # var name/ecx: slice -15858 68/push 0/imm32/end -15859 68/push 0/imm32/start -15860 89/<- %ecx 4/r32/esp -15861 # var is-deref?/edx: boolean = false -15862 ba/copy-to-edx 0/imm32/false -15863 # var v: (handle var) -15864 68/push 0/imm32 -15865 68/push 0/imm32 -15866 89/<- %ebx 4/r32/esp -15867 # -15868 (allocate Heap *Stmt-size *(ebp+0x14)) -15869 # var out-addr/edi: (addr stmt) = lookup(*out) -15870 8b/-> *(ebp+0x14) 7/r32/edi -15871 (lookup *edi *(edi+4)) # => eax -15872 89/<- %edi 0/r32/eax -15873 # out-addr->tag = 1/stmt -15874 c7 0/subop/copy *edi 1/imm32/stmt1 # Stmt-tag -15875 { -15876 (stmt-has-outputs? *(ebp+8)) -15877 3d/compare-eax-and 0/imm32/false -15878 0f 84/jump-if-= break/disp32 -15879 { -15880 $parse-mu-stmt:read-outputs: -15881 # name = next-mu-token(line) -15882 (next-mu-token *(ebp+8) %ecx) -15883 # if slice-empty?(word-slice) break -15884 (slice-empty? %ecx) # => eax -15885 3d/compare-eax-and 0/imm32/false -15886 0f 85/jump-if-!= break/disp32 -15887 # if (name == "<-") break -15888 (slice-equal? %ecx "<-") # => eax -15889 3d/compare-eax-and 0/imm32/false -15890 0f 85/jump-if-!= break/disp32 -15891 # is-deref? = false -15892 ba/copy-to-edx 0/imm32/false -15893 # if (slice-starts-with?(name, '*')) ++name->start and set is-deref? -15894 8b/-> *ecx 0/r32/eax # Slice-start -15895 8a/copy-byte *eax 0/r32/AL -15896 81 4/subop/and %eax 0xff/imm32 -15897 3d/compare-eax-and 0x2a/imm32/asterisk -15898 { -15899 75/jump-if-!= break/disp8 -15900 ff 0/subop/increment *ecx -15901 ba/copy-to-edx 1/imm32/true -15902 } -15903 # assert(is-identifier?(name)) -15904 (is-identifier? %ecx) # => eax -15905 3d/compare-eax-and 0/imm32/false -15906 0f 84/jump-if-= $parse-mu-stmt:abort/disp32 -15907 # -15908 (lookup-var %ecx *(ebp+0xc) %ebx *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) -15909 8d/copy-address *(edi+0x14) 0/r32/eax # Stmt1-outputs -15910 (append-stmt-var Heap *ebx *(ebx+4) *(edi+0x14) *(edi+0x18) %edx %eax) # Stmt1-outputs -15911 # -15912 e9/jump loop/disp32 -15913 } -15914 } -15915 (add-operation-and-inputs-to-stmt %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) -15916 $parse-mu-stmt:end: -15917 # . reclaim locals -15918 81 0/subop/add %esp 0x10/imm32 -15919 # . restore registers -15920 5f/pop-to-edi -15921 5b/pop-to-ebx -15922 5a/pop-to-edx -15923 59/pop-to-ecx -15924 58/pop-to-eax -15925 # . epilogue -15926 89/<- %esp 5/r32/ebp -15927 5d/pop-to-ebp -15928 c3/return -15929 -15930 $parse-mu-stmt:abort: -15931 # error("invalid identifier '" name "'\n") -15932 (write-buffered *(ebp+0x18) "invalid identifier '") -15933 (write-slice-buffered *(ebp+0x18) %ecx) -15934 (write-buffered *(ebp+0x18) "'\n") -15935 (flush *(ebp+0x18)) -15936 (stop *(ebp+0x1c) 1) -15937 # never gets here -15938 -15939 add-operation-and-inputs-to-stmt: # stmt: (addr stmt), line: (addr stream byte), vars: (addr stack live-var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -15940 # pseudocode: -15941 # stmt->name = slice-to-string(next-mu-token(line)) -15942 # while true -15943 # name = next-mu-token(line) -15944 # v = lookup-var-or-literal(name) -15945 # stmt->inouts = append(v, stmt->inouts) -15946 # -15947 # . prologue -15948 55/push-ebp -15949 89/<- %ebp 4/r32/esp -15950 # . save registers -15951 50/push-eax -15952 51/push-ecx -15953 52/push-edx -15954 53/push-ebx -15955 56/push-esi -15956 57/push-edi -15957 # edi = stmt -15958 8b/-> *(ebp+8) 7/r32/edi -15959 # var name/ecx: slice -15960 68/push 0/imm32/end -15961 68/push 0/imm32/start -15962 89/<- %ecx 4/r32/esp -15963 # var is-deref?/edx: boolean = false -15964 ba/copy-to-edx 0/imm32/false -15965 # var v/esi: (handle var) -15966 68/push 0/imm32 -15967 68/push 0/imm32 -15968 89/<- %esi 4/r32/esp -15969 $add-operation-and-inputs-to-stmt:read-operation: -15970 (next-mu-token *(ebp+0xc) %ecx) -15971 8d/copy-address *(edi+4) 0/r32/eax # Stmt1-operation or Regvardef-operationStmt1-operation or Regvardef-operation -15972 (slice-to-string Heap %ecx %eax) -15973 # var is-get?/ebx: boolean = (name == "get") -15974 (slice-equal? %ecx "get") # => eax -15975 89/<- %ebx 0/r32/eax -15976 { -15977 $add-operation-and-inputs-to-stmt:read-inouts: -15978 # name = next-mu-token(line) -15979 (next-mu-token *(ebp+0xc) %ecx) -15980 # if slice-empty?(word-slice) break -15981 (slice-empty? %ecx) # => eax -15982 3d/compare-eax-and 0/imm32/false -15983 0f 85/jump-if-!= break/disp32 -15984 # if (name == "<-") abort -15985 (slice-equal? %ecx "<-") -15986 3d/compare-eax-and 0/imm32/false -15987 0f 85/jump-if-!= $add-operation-and-inputs-to-stmt:abort/disp32 -15988 # if (is-get? && second operand) lookup or create offset -15989 { -15990 81 7/subop/compare %ebx 0/imm32/false -15991 74/jump-if-= break/disp8 -15992 (lookup *(edi+0xc) *(edi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -15993 3d/compare-eax-and 0/imm32 -15994 74/jump-if-= break/disp8 -15995 (lookup-or-create-constant %eax %ecx %esi) -15996 #? (lookup *esi *(esi+4)) -15997 #? (write-buffered Stderr "creating new output var ") -15998 #? (write-int32-hex-buffered Stderr %eax) -15999 #? (write-buffered Stderr " for field called ") -16000 #? (write-slice-buffered Stderr %ecx) -16001 #? (write-buffered Stderr "; var name ") -16002 #? (lookup *eax *(eax+4)) # Var-name -16003 #? (write-buffered Stderr %eax) -16004 #? (write-buffered Stderr Newline) -16005 #? (flush Stderr) -16006 e9/jump $add-operation-and-inputs-to-stmt:save-var/disp32 -16007 } -16008 # is-deref? = false -16009 ba/copy-to-edx 0/imm32/false -16010 # if (slice-starts-with?(name, '*')) ++name->start and set is-deref? -16011 8b/-> *ecx 0/r32/eax # Slice-start -16012 8a/copy-byte *eax 0/r32/AL -16013 81 4/subop/and %eax 0xff/imm32 -16014 3d/compare-eax-and 0x2a/imm32/asterisk -16015 { -16016 75/jump-if-!= break/disp8 -16017 $add-operation-and-inputs-to-stmt:inout-is-deref: -16018 ff 0/subop/increment *ecx -16019 ba/copy-to-edx 1/imm32/true -16020 } -16021 (lookup-var-or-literal %ecx *(ebp+0x10) %esi *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -16022 $add-operation-and-inputs-to-stmt:save-var: -16023 8d/copy-address *(edi+0xc) 0/r32/eax -16024 (append-stmt-var Heap *esi *(esi+4) *(edi+0xc) *(edi+0x10) %edx %eax) # Stmt1-inouts or Regvardef-inouts -16025 # -16026 e9/jump loop/disp32 -16027 } -16028 $add-operation-and-inputs-to-stmt:end: -16029 # . reclaim locals -16030 81 0/subop/add %esp 0x10/imm32 -16031 # . restore registers -16032 5f/pop-to-edi -16033 5e/pop-to-esi -16034 5b/pop-to-ebx -16035 5a/pop-to-edx -16036 59/pop-to-ecx -16037 58/pop-to-eax -16038 # . epilogue -16039 89/<- %esp 5/r32/ebp -16040 5d/pop-to-ebp -16041 c3/return -16042 -16043 $add-operation-and-inputs-to-stmt:abort: -16044 # error("fn ___: invalid identifier in '" line "'\n") -16045 (write-buffered *(ebp+0x18) "fn ") -16046 8b/-> *(ebp+0x14) 0/r32/eax -16047 (lookup *eax *(eax+4)) # Function-name Function-name => eax -16048 (write-buffered *(ebp+0x18) %eax) -16049 (rewind-stream *(ebp+0xc)) -16050 (write-buffered *(ebp+0x18) ": invalid identifier in '") -16051 (write-stream-data *(ebp+0x18) *(ebp+0xc)) -16052 (write-buffered *(ebp+0x18) "'\n") -16053 (flush *(ebp+0x18)) -16054 (stop *(ebp+0x1c) 1) -16055 # never gets here -16056 -16057 stmt-has-outputs?: # line: (addr stream byte) -> result/eax: boolean -16058 # . prologue -16059 55/push-ebp -16060 89/<- %ebp 4/r32/esp -16061 # . save registers -16062 51/push-ecx -16063 # var word-slice/ecx: slice -16064 68/push 0/imm32/end -16065 68/push 0/imm32/start -16066 89/<- %ecx 4/r32/esp -16067 # result = false -16068 b8/copy-to-eax 0/imm32/false -16069 (rewind-stream *(ebp+8)) -16070 { -16071 (next-mu-token *(ebp+8) %ecx) -16072 # if slice-empty?(word-slice) break -16073 (slice-empty? %ecx) -16074 3d/compare-eax-and 0/imm32/false -16075 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) -16076 0f 85/jump-if-!= break/disp32 -16077 # if slice-starts-with?(word-slice, '#') break -16078 # . eax = *word-slice->start -16079 8b/-> *ecx 0/r32/eax -16080 8a/copy-byte *eax 0/r32/AL -16081 81 4/subop/and %eax 0xff/imm32 -16082 # . if (eax == '#') break -16083 3d/compare-eax-and 0x23/imm32/hash -16084 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) -16085 0f 84/jump-if-= break/disp32 -16086 # if slice-equal?(word-slice, '<-') return true -16087 (slice-equal? %ecx "<-") -16088 3d/compare-eax-and 0/imm32/false -16089 74/jump-if-= loop/disp8 -16090 b8/copy-to-eax 1/imm32/true -16091 } -16092 $stmt-has-outputs:end: -16093 (rewind-stream *(ebp+8)) -16094 # . reclaim locals -16095 81 0/subop/add %esp 8/imm32 -16096 # . restore registers -16097 59/pop-to-ecx -16098 # . epilogue -16099 89/<- %esp 5/r32/ebp -16100 5d/pop-to-ebp -16101 c3/return -16102 -16103 # if 'name' starts with a digit, create a new literal var for it -16104 # otherwise return first 'name' from the top (back) of 'vars' and abort if not found -16105 lookup-var-or-literal: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -16106 # . prologue -16107 55/push-ebp -16108 89/<- %ebp 4/r32/esp -16109 # . save registers -16110 50/push-eax -16111 51/push-ecx -16112 56/push-esi -16113 # esi = name -16114 8b/-> *(ebp+8) 6/r32/esi -16115 # if slice-empty?(name) abort -16116 (slice-empty? %esi) # => eax -16117 3d/compare-eax-and 0/imm32/false -16118 0f 85/jump-if-!= $lookup-var-or-literal:abort/disp32 -16119 # var c/ecx: byte = *name->start -16120 8b/-> *esi 1/r32/ecx -16121 8a/copy-byte *ecx 1/r32/CL -16122 81 4/subop/and %ecx 0xff/imm32 -16123 # if (is-decimal-digit?(c) || c == '-') return new var(name) -16124 { -16125 81 7/subop/compare %ecx 0x2d/imm32/dash -16126 74/jump-if-= $lookup-var-or-literal:literal/disp8 -16127 (is-decimal-digit? %ecx) # => eax -16128 3d/compare-eax-and 0/imm32/false -16129 74/jump-if-= break/disp8 -16130 $lookup-var-or-literal:literal: -16131 (new-literal-integer Heap %esi *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -16132 eb/jump $lookup-var-or-literal:end/disp8 -16133 } -16134 # else if (c == '"') return new var(name) -16135 { -16136 81 7/subop/compare %ecx 0x22/imm32/dquote -16137 75/jump-if-!= break/disp8 -16138 $lookup-var-or-literal:literal-string: -16139 (new-literal Heap %esi *(ebp+0x10)) -16140 eb/jump $lookup-var-or-literal:end/disp8 -16141 } -16142 # otherwise return lookup-var(name, vars) -16143 { -16144 $lookup-var-or-literal:var: -16145 (lookup-var %esi *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -16146 } -16147 $lookup-var-or-literal:end: -16148 # . restore registers -16149 5e/pop-to-esi -16150 59/pop-to-ecx -16151 58/pop-to-eax -16152 # . epilogue -16153 89/<- %esp 5/r32/ebp -16154 5d/pop-to-ebp -16155 c3/return -16156 -16157 $lookup-var-or-literal:abort: -16158 (write-buffered *(ebp+0x18) "fn ") -16159 8b/-> *(ebp+0x14) 0/r32/eax -16160 (lookup *eax *(eax+4)) # Function-name Function-name => eax -16161 (write-buffered *(ebp+0x18) %eax) -16162 (write-buffered *(ebp+0x18) ": empty variable!") -16163 (flush *(ebp+0x18)) -16164 (stop *(ebp+0x1c) 1) -16165 # never gets here -16166 -16167 # return first 'name' from the top (back) of 'vars' and abort if not found -16168 lookup-var: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -16169 # . prologue -16170 55/push-ebp -16171 89/<- %ebp 4/r32/esp -16172 # . save registers -16173 50/push-eax -16174 # -16175 (lookup-var-helper *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -16176 # if (*out == 0) abort -16177 8b/-> *(ebp+0x10) 0/r32/eax -16178 81 7/subop/compare *eax 0/imm32 -16179 74/jump-if-= $lookup-var:abort/disp8 -16180 $lookup-var:end: -16181 # . restore registers -16182 58/pop-to-eax -16183 # . epilogue -16184 89/<- %esp 5/r32/ebp -16185 5d/pop-to-ebp -16186 c3/return -16187 -16188 $lookup-var:abort: -16189 (write-buffered *(ebp+0x18) "fn ") -16190 8b/-> *(ebp+0x14) 0/r32/eax -16191 (lookup *eax *(eax+4)) # Function-name Function-name => eax -16192 (write-buffered *(ebp+0x18) %eax) -16193 (write-buffered *(ebp+0x18) ": unknown variable '") -16194 (write-slice-buffered *(ebp+0x18) *(ebp+8)) -16195 (write-buffered *(ebp+0x18) "'\n") -16196 (flush *(ebp+0x18)) -16197 (stop *(ebp+0x1c) 1) -16198 # never gets here -16199 -16200 # return first 'name' from the top (back) of 'vars', and 0/null if not found -16201 # ensure that 'name' if in a register is the topmost variable in that register -16202 lookup-var-helper: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -16203 # pseudocode: -16204 # var curr: (addr handle var) = &vars->data[vars->top - 12] -16205 # var min = vars->data -16206 # while curr >= min -16207 # var v: (handle var) = *curr -16208 # if v->name == name -16209 # return -16210 # curr -= 12 -16211 # -16212 # . prologue -16213 55/push-ebp -16214 89/<- %ebp 4/r32/esp -16215 # . save registers -16216 50/push-eax -16217 51/push-ecx -16218 52/push-edx -16219 53/push-ebx -16220 56/push-esi -16221 57/push-edi -16222 # clear out -16223 (zero-out *(ebp+0x10) *Handle-size) -16224 # esi = vars -16225 8b/-> *(ebp+0xc) 6/r32/esi -16226 # ebx = vars->top -16227 8b/-> *esi 3/r32/ebx -16228 # if (vars->top > vars->size) abort -16229 3b/compare<- *(esi+4) 0/r32/eax -16230 0f 8f/jump-if-> $lookup-var-helper:error1/disp32 -16231 # var min/edx: (addr handle var) = vars->data -16232 8d/copy-address *(esi+8) 2/r32/edx -16233 # var curr/ebx: (addr handle var) = &vars->data[vars->top - 12] -16234 8d/copy-address *(esi+ebx-4) 3/r32/ebx # vars + 8 + vars->type - 12 -16235 # var var-in-reg/edi: 16 addrs -16236 68/push 0/imm32 -16237 68/push 0/imm32 -16238 68/push 0/imm32 -16239 68/push 0/imm32 -16240 68/push 0/imm32 -16241 68/push 0/imm32 -16242 68/push 0/imm32 -16243 68/push 0/imm32 -16244 68/push 0/imm32 -16245 68/push 0/imm32 -16246 68/push 0/imm32 -16247 68/push 0/imm32 -16248 68/push 0/imm32 -16249 68/push 0/imm32 -16250 68/push 0/imm32 -16251 68/push 0/imm32 -16252 89/<- %edi 4/r32/esp -16253 { -16254 $lookup-var-helper:loop: -16255 # if (curr < min) return -16256 39/compare %ebx 2/r32/edx -16257 0f 82/jump-if-addr< break/disp32 -16258 # var v/ecx: (addr var) = lookup(*curr) -16259 (lookup *ebx *(ebx+4)) # => eax -16260 89/<- %ecx 0/r32/eax -16261 # var vn/eax: (addr array byte) = lookup(v->name) -16262 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -16263 # if (vn == name) return curr -16264 (slice-equal? *(ebp+8) %eax) # => eax -16265 3d/compare-eax-and 0/imm32/false -16266 { -16267 74/jump-if-= break/disp8 -16268 $lookup-var-helper:found: -16269 # var vr/eax: (addr array byte) = lookup(v->register) -16270 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax -16271 3d/compare-eax-and 0/imm32 -16272 { -16273 74/jump-if-= break/disp8 -16274 $lookup-var-helper:found-register: -16275 # var reg/eax: int = get(Registers, vr) -16276 (get Mu-registers-unique %eax 0xc "Mu-registers-unique") # => eax -16277 8b/-> *eax 0/r32/eax -16278 # if (var-in-reg[reg]) error -16279 8b/-> *(edi+eax<<2) 0/r32/eax -16280 3d/compare-eax-and 0/imm32 -16281 0f 85/jump-if-!= $lookup-var-helper:error2/disp32 -16282 } -16283 $lookup-var-helper:return: -16284 # esi = out -16285 8b/-> *(ebp+0x10) 6/r32/esi -16286 # *out = *curr -16287 8b/-> *ebx 0/r32/eax -16288 89/<- *esi 0/r32/eax -16289 8b/-> *(ebx+4) 0/r32/eax -16290 89/<- *(esi+4) 0/r32/eax -16291 # return -16292 eb/jump $lookup-var-helper:end/disp8 -16293 } -16294 # 'name' not yet found; update var-in-reg if v in register -16295 # . var vr/eax: (addr array byte) = lookup(v->register) -16296 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax -16297 # . if (vr == 0) continue -16298 3d/compare-eax-and 0/imm32 -16299 74/jump-if-= $lookup-var-helper:continue/disp8 -16300 # . var reg/eax: int = get(Registers, vr) -16301 (get Mu-registers-unique %eax 0xc "Mu-registers-unique") # => eax -16302 8b/-> *eax 0/r32/eax -16303 # . var-in-reg[reg] = v -16304 89/<- *(edi+eax<<2) 1/r32/ecx -16305 $lookup-var-helper:continue: -16306 # curr -= 12 -16307 81 5/subop/subtract %ebx 0xc/imm32 -16308 e9/jump loop/disp32 -16309 } -16310 $lookup-var-helper:end: -16311 # . reclaim locals -16312 81 0/subop/add %esp 0x40/imm32 -16313 # . restore registers -16314 5f/pop-to-edi -16315 5e/pop-to-esi -16316 5b/pop-to-ebx -16317 5a/pop-to-edx -16318 59/pop-to-ecx -16319 58/pop-to-eax -16320 # . epilogue -16321 89/<- %esp 5/r32/ebp -16322 5d/pop-to-ebp -16323 c3/return -16324 -16325 $lookup-var-helper:error1: -16326 (write-buffered *(ebp+0x18) "fn ") -16327 8b/-> *(ebp+0x14) 0/r32/eax -16328 (lookup *eax *(eax+4)) # Function-name Function-name => eax -16329 (write-buffered *(ebp+0x18) %eax) -16330 (write-buffered *(ebp+0x18) ": malformed stack when looking up '") -16331 (write-slice-buffered *(ebp+0x18) *(ebp+8)) -16332 (write-buffered *(ebp+0x18) "'\n") -16333 (flush *(ebp+0x18)) -16334 (stop *(ebp+0x1c) 1) -16335 # never gets here -16336 -16337 $lookup-var-helper:error2: -16338 # eax contains the conflicting var at this point -16339 (write-buffered *(ebp+0x18) "fn ") -16340 50/push-eax -16341 8b/-> *(ebp+0x14) 0/r32/eax -16342 (lookup *eax *(eax+4)) # Function-name Function-name => eax -16343 (write-buffered *(ebp+0x18) %eax) -16344 58/pop-eax -16345 (write-buffered *(ebp+0x18) ": register ") -16346 50/push-eax -16347 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -16348 (write-buffered *(ebp+0x18) %eax) -16349 58/pop-to-eax -16350 (write-buffered *(ebp+0x18) " reads var '") -16351 (write-slice-buffered *(ebp+0x18) *(ebp+8)) -16352 (write-buffered *(ebp+0x18) "' after writing var '") -16353 (lookup *eax *(eax+4)) # Var-name Var-name => eax -16354 (write-buffered *(ebp+0x18) %eax) -16355 (write-buffered *(ebp+0x18) "'\n") -16356 (flush *(ebp+0x18)) -16357 (stop *(ebp+0x1c) 1) -16358 # never gets here -16359 -16360 dump-vars: # vars: (addr stack live-var) -16361 # pseudocode: -16362 # var curr: (addr handle var) = &vars->data[vars->top - 12] -16363 # var min = vars->data -16364 # while curr >= min -16365 # var v: (handle var) = *curr -16366 # print v -16367 # curr -= 12 -16368 # -16369 # . prologue -16370 55/push-ebp -16371 89/<- %ebp 4/r32/esp -16372 # . save registers -16373 52/push-edx -16374 53/push-ebx -16375 56/push-esi -16376 # esi = vars -16377 8b/-> *(ebp+8) 6/r32/esi -16378 # ebx = vars->top -16379 8b/-> *esi 3/r32/ebx -16380 # var min/edx: (addr handle var) = vars->data -16381 8d/copy-address *(esi+8) 2/r32/edx -16382 # var curr/ebx: (addr handle var) = &vars->data[vars->top - 12] -16383 8d/copy-address *(esi+ebx-4) 3/r32/ebx # vars + 8 + vars->type - 12 -16384 { -16385 $dump-vars:loop: -16386 # if (curr < min) return -16387 39/compare %ebx 2/r32/edx -16388 0f 82/jump-if-addr< break/disp32 -16389 # -16390 (write-buffered Stderr " var@") -16391 (dump-var 2 %ebx) -16392 # curr -= 12 -16393 81 5/subop/subtract %ebx 0xc/imm32 -16394 e9/jump loop/disp32 -16395 } -16396 $dump-vars:end: -16397 # . restore registers -16398 5e/pop-to-esi -16399 5b/pop-to-ebx -16400 5a/pop-to-edx -16401 # . epilogue -16402 89/<- %esp 5/r32/ebp -16403 5d/pop-to-ebp -16404 c3/return -16405 -16406 == data -16407 # Like Registers, but no esp or ebp -16408 Mu-registers: # (addr stream {(handle array byte), int}) -16409 # a table is a stream -16410 0xa8/imm32/write -16411 0/imm32/read -16412 0xa8/imm32/length -16413 # data -16414 # general-purpose registers -16415 # it is perfectly ok to use fake alloc-ids -- as long as you never try to reclaim them -16416 0x11/imm32/alloc-id $Mu-register-eax/imm32 0/imm32 -16417 0x11/imm32/alloc-id $Mu-register-ecx/imm32 1/imm32 -16418 0x11/imm32/alloc-id $Mu-register-edx/imm32 2/imm32 -16419 0x11/imm32/alloc-id $Mu-register-ebx/imm32 3/imm32 -16420 0x11/imm32/alloc-id $Mu-register-esi/imm32 6/imm32 -16421 0x11/imm32/alloc-id $Mu-register-edi/imm32 7/imm32 -16422 # floating-point registers -16423 0x11/imm32/alloc-id $Mu-register-xmm0/imm32 0/imm32 -16424 0x11/imm32/alloc-id $Mu-register-xmm1/imm32 1/imm32 -16425 0x11/imm32/alloc-id $Mu-register-xmm2/imm32 2/imm32 -16426 0x11/imm32/alloc-id $Mu-register-xmm3/imm32 3/imm32 -16427 0x11/imm32/alloc-id $Mu-register-xmm4/imm32 4/imm32 -16428 0x11/imm32/alloc-id $Mu-register-xmm5/imm32 5/imm32 -16429 0x11/imm32/alloc-id $Mu-register-xmm6/imm32 6/imm32 -16430 0x11/imm32/alloc-id $Mu-register-xmm7/imm32 7/imm32 -16431 -16432 # Like Mu-registers, but with unique codes for integer and floating-point -16433 # registers. -16434 # Don't use this for code-generation, only for checking. -16435 Mu-registers-unique: # (addr stream {(handle array byte), int}) -16436 # a table is a stream -16437 0xa8/imm32/write -16438 0/imm32/read -16439 0xa8/imm32/length -16440 # data -16441 # general-purpose registers -16442 0x11/imm32/alloc-id $Mu-register-eax/imm32 0/imm32 -16443 0x11/imm32/alloc-id $Mu-register-ecx/imm32 1/imm32 -16444 0x11/imm32/alloc-id $Mu-register-edx/imm32 2/imm32 -16445 0x11/imm32/alloc-id $Mu-register-ebx/imm32 3/imm32 -16446 0x11/imm32/alloc-id $Mu-register-esi/imm32 6/imm32 -16447 0x11/imm32/alloc-id $Mu-register-edi/imm32 7/imm32 -16448 # floating-point registers -16449 0x11/imm32/alloc-id $Mu-register-xmm0/imm32 8/imm32 -16450 0x11/imm32/alloc-id $Mu-register-xmm1/imm32 9/imm32 -16451 0x11/imm32/alloc-id $Mu-register-xmm2/imm32 0xa/imm32 -16452 0x11/imm32/alloc-id $Mu-register-xmm3/imm32 0xb/imm32 -16453 0x11/imm32/alloc-id $Mu-register-xmm4/imm32 0xc/imm32 -16454 0x11/imm32/alloc-id $Mu-register-xmm5/imm32 0xd/imm32 -16455 0x11/imm32/alloc-id $Mu-register-xmm6/imm32 0xe/imm32 -16456 0x11/imm32/alloc-id $Mu-register-xmm7/imm32 0xf/imm32 -16457 -16458 $Mu-register-eax: -16459 0x11/imm32/alloc-id -16460 3/imm32/size -16461 0x65/e 0x61/a 0x78/x -16462 -16463 $Mu-register-ecx: -16464 0x11/imm32/alloc-id -16465 3/imm32/size -16466 0x65/e 0x63/c 0x78/x -16467 -16468 $Mu-register-edx: -16469 0x11/imm32/alloc-id -16470 3/imm32/size -16471 0x65/e 0x64/d 0x78/x -16472 -16473 $Mu-register-ebx: -16474 0x11/imm32/alloc-id -16475 3/imm32/size -16476 0x65/e 0x62/b 0x78/x -16477 -16478 $Mu-register-esi: -16479 0x11/imm32/alloc-id -16480 3/imm32/size -16481 0x65/e 0x73/s 0x69/i -16482 -16483 $Mu-register-edi: -16484 0x11/imm32/alloc-id -16485 3/imm32/size -16486 0x65/e 0x64/d 0x69/i -16487 -16488 $Mu-register-xmm0: -16489 0x11/imm32/alloc-id:fake:payload -16490 # "xmm0" -16491 0x4/imm32/size -16492 0x78/x 0x6d/m 0x6d/m 0x30/0 -16493 -16494 $Mu-register-xmm1: -16495 0x11/imm32/alloc-id:fake:payload -16496 # "xmm1" -16497 0x4/imm32/size -16498 0x78/x 0x6d/m 0x6d/m 0x31/1 -16499 -16500 $Mu-register-xmm2: -16501 0x11/imm32/alloc-id:fake:payload -16502 # "xmm2" -16503 0x4/imm32/size -16504 0x78/x 0x6d/m 0x6d/m 0x32/2 -16505 -16506 $Mu-register-xmm3: -16507 0x11/imm32/alloc-id:fake:payload -16508 # "xmm3" -16509 0x4/imm32/size -16510 0x78/x 0x6d/m 0x6d/m 0x33/3 -16511 -16512 $Mu-register-xmm4: -16513 0x11/imm32/alloc-id:fake:payload -16514 # "xmm4" -16515 0x4/imm32/size -16516 0x78/x 0x6d/m 0x6d/m 0x34/4 -16517 -16518 $Mu-register-xmm5: -16519 0x11/imm32/alloc-id:fake:payload -16520 # "xmm5" -16521 0x4/imm32/size -16522 0x78/x 0x6d/m 0x6d/m 0x35/5 -16523 -16524 $Mu-register-xmm6: -16525 0x11/imm32/alloc-id:fake:payload -16526 # "xmm6" -16527 0x4/imm32/size -16528 0x78/x 0x6d/m 0x6d/m 0x36/6 -16529 -16530 $Mu-register-xmm7: -16531 0x11/imm32/alloc-id:fake:payload -16532 # "xmm7" -16533 0x4/imm32/size -16534 0x78/x 0x6d/m 0x6d/m 0x37/7 -16535 -16536 == code -16537 -16538 # push 'out' to 'vars' if not already there; it's assumed to be a fn output -16539 maybe-define-var: # out: (handle var), vars: (addr stack live-var) -16540 # . prologue -16541 55/push-ebp -16542 89/<- %ebp 4/r32/esp -16543 # . save registers -16544 50/push-eax -16545 # var out-addr/eax: (addr var) -16546 (lookup *(ebp+8) *(ebp+0xc)) # => eax -16547 # -16548 (binding-exists? %eax *(ebp+0x10)) # => eax -16549 3d/compare-eax-and 0/imm32/false -16550 75/jump-if-!= $maybe-define-var:end/disp8 -16551 # otherwise update vars -16552 (push *(ebp+0x10) *(ebp+8)) -16553 (push *(ebp+0x10) *(ebp+0xc)) -16554 (push *(ebp+0x10) 0) # 'out' is always a fn output; never spill it -16555 $maybe-define-var:end: -16556 # . restore registers -16557 58/pop-to-eax -16558 # . epilogue -16559 89/<- %esp 5/r32/ebp -16560 5d/pop-to-ebp -16561 c3/return -16562 -16563 # simpler version of lookup-var-helper -16564 binding-exists?: # target: (addr var), vars: (addr stack live-var) -> result/eax: boolean -16565 # pseudocode: -16566 # var curr: (addr handle var) = &vars->data[vars->top - 12] -16567 # var min = vars->data -16568 # while curr >= min -16569 # var v: (handle var) = *curr -16570 # if v->name == target->name -16571 # return true -16572 # curr -= 12 -16573 # return false -16574 # -16575 # . prologue -16576 55/push-ebp -16577 89/<- %ebp 4/r32/esp -16578 # . save registers -16579 51/push-ecx -16580 52/push-edx -16581 56/push-esi -16582 # var target-name/ecx: (addr array byte) = lookup(target->name) -16583 8b/-> *(ebp+8) 0/r32/eax -16584 (lookup *eax *(eax+4)) # Var-name Var-name => eax -16585 89/<- %ecx 0/r32/eax -16586 # esi = vars -16587 8b/-> *(ebp+0xc) 6/r32/esi -16588 # eax = vars->top -16589 8b/-> *esi 0/r32/eax -16590 # var min/edx: (addr handle var) = vars->data -16591 8d/copy-address *(esi+8) 2/r32/edx -16592 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] -16593 8d/copy-address *(esi+eax-4) 6/r32/esi # vars + 8 + vars->type - 12 -16594 { -16595 $binding-exists?:loop: -16596 # if (curr < min) return -16597 39/compare %esi 2/r32/edx -16598 0f 82/jump-if-addr< break/disp32 -16599 # var v/eax: (addr var) = lookup(*curr) -16600 (lookup *esi *(esi+4)) # => eax -16601 # var vn/eax: (addr array byte) = lookup(v->name) -16602 (lookup *eax *(eax+4)) # Var-name Var-name => eax -16603 # if (vn == target-name) return true -16604 (string-equal? %ecx %eax) # => eax -16605 3d/compare-eax-and 0/imm32/false -16606 75/jump-if-!= $binding-exists?:end/disp8 # eax already contains true -16607 # curr -= 12 -16608 81 5/subop/subtract %esi 0xc/imm32 -16609 e9/jump loop/disp32 -16610 } -16611 b8/copy-to-eax 0/imm32/false -16612 $binding-exists?:end: -16613 # . restore registers -16614 5e/pop-to-esi -16615 5a/pop-to-edx -16616 59/pop-to-ecx -16617 # . epilogue -16618 89/<- %esp 5/r32/ebp -16619 5d/pop-to-ebp -16620 c3/return -16621 -16622 test-parse-mu-stmt: -16623 # . prologue -16624 55/push-ebp -16625 89/<- %ebp 4/r32/esp -16626 # setup -16627 8b/-> *Primitive-type-ids 0/r32/eax -16628 89/<- *Type-id 0/r32/eax # stream-write -16629 (clear-stream _test-input-stream) -16630 (write _test-input-stream "increment n\n") -16631 # var vars/ecx: (stack (addr var) 16) -16632 81 5/subop/subtract %esp 0xc0/imm32 -16633 68/push 0xc0/imm32/size -16634 68/push 0/imm32/top -16635 89/<- %ecx 4/r32/esp -16636 (clear-stack %ecx) -16637 # var v/edx: (handle var) -16638 68/push 0/imm32 -16639 68/push 0/imm32 -16640 89/<- %edx 4/r32/esp -16641 # var s/eax: (handle array byte) -16642 68/push 0/imm32 -16643 68/push 0/imm32 -16644 89/<- %eax 4/r32/esp -16645 # v = new var("n") -16646 (copy-array Heap "n" %eax) -16647 (new-var Heap *eax *(eax+4) %edx) -16648 # -16649 (push %ecx *edx) -16650 (push %ecx *(edx+4)) -16651 (push %ecx 0) -16652 # var out/eax: (handle stmt) -16653 68/push 0/imm32 -16654 68/push 0/imm32 -16655 89/<- %eax 4/r32/esp -16656 # convert -16657 (parse-mu-stmt _test-input-stream %ecx 0 %eax Stderr 0) -16658 # var out-addr/edx: (addr stmt) = lookup(*out) -16659 (lookup *eax *(eax+4)) # => eax -16660 89/<- %edx 0/r32/eax -16661 # out->tag -16662 (check-ints-equal *edx 1 "F - test-parse-mu-stmt/tag") # Stmt-tag is Stmt1 -16663 # out->operation -16664 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax -16665 (check-strings-equal %eax "increment" "F - test-parse-mu-stmt/name") # Stmt1-operation -16666 # out->inouts->value->name -16667 # . eax = out->inouts -16668 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -16669 # . eax = out->inouts->value -16670 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -16671 # . eax = out->inouts->value->name -16672 (lookup *eax *(eax+4)) # Var-name Var-name => eax -16673 # . -16674 (check-strings-equal %eax "n" "F - test-parse-mu-stmt/inout:0") -16675 # . epilogue -16676 89/<- %esp 5/r32/ebp -16677 5d/pop-to-ebp -16678 c3/return -16679 -16680 test-parse-mu-stmt-with-comma: -16681 # . prologue -16682 55/push-ebp -16683 89/<- %ebp 4/r32/esp -16684 # setup -16685 8b/-> *Primitive-type-ids 0/r32/eax -16686 89/<- *Type-id 0/r32/eax # stream-write -16687 (clear-stream _test-input-stream) -16688 (write _test-input-stream "copy-to n, 3\n") -16689 # var vars/ecx: (stack (addr var) 16) -16690 81 5/subop/subtract %esp 0xc0/imm32 -16691 68/push 0xc0/imm32/size -16692 68/push 0/imm32/top -16693 89/<- %ecx 4/r32/esp -16694 (clear-stack %ecx) -16695 # var v/edx: (handle var) -16696 68/push 0/imm32 -16697 68/push 0/imm32 -16698 89/<- %edx 4/r32/esp -16699 # var s/eax: (handle array byte) -16700 68/push 0/imm32 -16701 68/push 0/imm32 -16702 89/<- %eax 4/r32/esp -16703 # v = new var("n") -16704 (copy-array Heap "n" %eax) -16705 (new-var Heap *eax *(eax+4) %edx) -16706 # -16707 (push %ecx *edx) -16708 (push %ecx *(edx+4)) -16709 (push %ecx 0) -16710 # var out/eax: (handle stmt) -16711 68/push 0/imm32 -16712 68/push 0/imm32 -16713 89/<- %eax 4/r32/esp -16714 # convert -16715 (parse-mu-stmt _test-input-stream %ecx 0 %eax Stderr 0) -16716 # var out-addr/edx: (addr stmt) = lookup(*out) -16717 (lookup *eax *(eax+4)) # => eax -16718 89/<- %edx 0/r32/eax -16719 # out->tag -16720 (check-ints-equal *edx 1 "F - test-parse-mu-stmt-with-comma/tag") # Stmt-tag is Stmt1 -16721 # out->operation -16722 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax -16723 (check-strings-equal %eax "copy-to" "F - test-parse-mu-stmt-with-comma/name") # Stmt1-operation -16724 # out->inouts->value->name -16725 # . eax = out->inouts -16726 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -16727 # . eax = out->inouts->value -16728 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -16729 # . eax = out->inouts->value->name -16730 (lookup *eax *(eax+4)) # Var-name Var-name => eax -16731 # . -16732 (check-strings-equal %eax "n" "F - test-parse-mu-stmt-with-comma/inout:0") -16733 # . epilogue -16734 89/<- %esp 5/r32/ebp -16735 5d/pop-to-ebp -16736 c3/return -16737 -16738 new-var: # ad: (addr allocation-descriptor), name: (handle array byte), out: (addr handle var) -16739 # . prologue -16740 55/push-ebp -16741 89/<- %ebp 4/r32/esp -16742 # . save registers -16743 50/push-eax -16744 51/push-ecx -16745 # ecx = out -16746 8b/-> *(ebp+0x14) 1/r32/ecx -16747 # -16748 (allocate *(ebp+8) *Var-size %ecx) -16749 # var out-addr/eax: (addr var) -16750 (lookup *ecx *(ecx+4)) # => eax -16751 # out-addr->name = name -16752 8b/-> *(ebp+0xc) 1/r32/ecx -16753 89/<- *eax 1/r32/ecx # Var-name -16754 8b/-> *(ebp+0x10) 1/r32/ecx -16755 89/<- *(eax+4) 1/r32/ecx # Var-name -16756 #? (write-buffered Stderr "var ") -16757 #? (lookup *(ebp+0xc) *(ebp+0x10)) -16758 #? (write-buffered Stderr %eax) -16759 #? (write-buffered Stderr " at ") -16760 #? 8b/-> *(ebp+0x14) 1/r32/ecx -16761 #? (lookup *ecx *(ecx+4)) # => eax -16762 #? (write-int32-hex-buffered Stderr %eax) -16763 #? (write-buffered Stderr Newline) -16764 #? (flush Stderr) -16765 $new-var:end: -16766 # . restore registers -16767 59/pop-to-ecx -16768 58/pop-to-eax -16769 # . epilogue -16770 89/<- %esp 5/r32/ebp -16771 5d/pop-to-ebp -16772 c3/return -16773 -16774 new-literal-integer: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -16775 # . prologue -16776 55/push-ebp -16777 89/<- %ebp 4/r32/esp -16778 # . save registers -16779 50/push-eax -16780 51/push-ecx -16781 # if (!is-hex-int?(name)) abort -16782 (is-hex-int? *(ebp+0xc)) # => eax -16783 3d/compare-eax-and 0/imm32/false -16784 0f 84/jump-if-= $new-literal-integer:abort/disp32 -16785 # a little more error-checking -16786 (check-mu-hex-int *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) -16787 # out = new var(s) -16788 (new-var-from-slice *(ebp+8) *(ebp+0xc) *(ebp+0x10)) -16789 # var out-addr/ecx: (addr var) = lookup(*out) -16790 8b/-> *(ebp+0x10) 0/r32/eax -16791 (lookup *eax *(eax+4)) # => eax -16792 89/<- %ecx 0/r32/eax -16793 # out-addr->block-depth = *Curr-block-depth -16794 8b/-> *Curr-block-depth 0/r32/eax -16795 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth -16796 # out-addr->type = new tree() -16797 8d/copy-address *(ecx+8) 0/r32/eax # Var-type -16798 (allocate *(ebp+8) *Type-tree-size %eax) -16799 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -16800 c7 0/subop/copy *eax 1/imm32/true # Type-tree-is-atom -16801 # nothing else to do; default type is 'literal' -16802 $new-literal-integer:end: -16803 # . reclaim locals -16804 81 0/subop/add %esp 8/imm32 -16805 # . restore registers -16806 59/pop-to-ecx -16807 58/pop-to-eax -16808 # . epilogue -16809 89/<- %esp 5/r32/ebp -16810 5d/pop-to-ebp -16811 c3/return -16812 -16813 $new-literal-integer:abort: -16814 (write-buffered *(ebp+0x18) "fn ") -16815 8b/-> *(ebp+0x14) 0/r32/eax -16816 (lookup *eax *(eax+4)) # Function-name Function-name => eax -16817 (write-buffered *(ebp+0x18) %eax) -16818 (write-buffered *(ebp+0x18) ": variable '") -16819 (write-slice-buffered *(ebp+0x18) *(ebp+0xc)) -16820 (write-buffered *(ebp+0x18) "' cannot begin with a digit (or do you have a typo in a number?)\n") -16821 (flush *(ebp+0x18)) -16822 (stop *(ebp+0x1c) 1) -16823 # never gets here -16824 -16825 # precondition: name is a valid hex integer; require a '0x' prefix -16826 check-mu-hex-int: # name: (addr slice), err: (addr buffered-file), ed: (addr exit-descriptor) -16827 # . prologue -16828 55/push-ebp -16829 89/<- %ebp 4/r32/esp -16830 # . save registers -16831 50/push-eax -16832 51/push-ecx -16833 52/push-edx -16834 # ecx = name -16835 8b/-> *(ebp+8) 1/r32/ecx -16836 # var start/edx: (addr byte) = name->start -16837 8b/-> *ecx 2/r32/edx -16838 # if (*start == '-') ++start -16839 b8/copy-to-eax 0/imm32 -16840 8a/copy-byte *edx 0/r32/AL -16841 3d/compare-eax-and 0x2d/imm32/dash -16842 { -16843 75/jump-if-!= break/disp8 -16844 42/increment-edx -16845 } -16846 # var end/ecx: (addr byte) = name->end -16847 8b/-> *(ecx+4) 1/r32/ecx -16848 # var len/eax: int = name->end - name->start -16849 89/<- %eax 1/r32/ecx -16850 29/subtract-from %eax 2/r32/edx -16851 # if (len <= 1) return -16852 3d/compare-eax-with 1/imm32 -16853 0f 8e/jump-if-<= $check-mu-hex-int:end/disp32 -16854 $check-mu-hex-int:length->-1: -16855 # if slice-starts-with?({start, end}, "0x") return -16856 # . var tmp = {start, end} -16857 51/push-ecx -16858 52/push-edx -16859 89/<- %eax 4/r32/esp -16860 # . -16861 (slice-starts-with? %eax "0x") # => eax -16862 # . reclaim tmp -16863 81 0/subop/add %esp 8/imm32 -16864 # . -16865 3d/compare-eax-with 0/imm32/false -16866 75/jump-if-!= $check-mu-hex-int:end/disp8 -16867 $check-mu-hex-int:abort: -16868 # otherwise abort -16869 (write-buffered *(ebp+0xc) "literal integers are always hex in Mu; start '") -16870 (write-slice-buffered *(ebp+0xc) *(ebp+8)) -16871 (write-buffered *(ebp+0xc) "' with a '0x' to be unambiguous, converting it to hexadecimal as necessary.\n") -16872 (flush *(ebp+0xc)) -16873 (stop *(ebp+0x10) 1) -16874 $check-mu-hex-int:end: -16875 # . restore registers +15702 test-is-identifier-hyphen: +15703 # disallow leading '-' since '->' has special meaning +15704 # . prologue +15705 55/push-ebp +15706 89/<- %ebp 4/r32/esp +15707 # (eax..ecx) = "-a" +15708 b8/copy-to-eax "-a"/imm32 +15709 8b/-> *eax 1/r32/ecx +15710 8d/copy-address *(eax+ecx+4) 1/r32/ecx +15711 05/add-to-eax 4/imm32 +15712 # var slice/ecx: slice = {eax, ecx} +15713 51/push-ecx +15714 50/push-eax +15715 89/<- %ecx 4/r32/esp +15716 # +15717 (is-identifier? %ecx) +15718 (check-ints-equal %eax 0 "F - test-is-identifier-hyphen") +15719 # . epilogue +15720 89/<- %esp 5/r32/ebp +15721 5d/pop-to-ebp +15722 c3/return +15723 +15724 populate-mu-function-body: # in: (addr buffered-file), out: (addr function), vars: (addr stack live-var), err: (addr buffered-file), ed: (addr exit-descriptor) +15725 # . prologue +15726 55/push-ebp +15727 89/<- %ebp 4/r32/esp +15728 # . save registers +15729 50/push-eax +15730 56/push-esi +15731 57/push-edi +15732 # esi = in +15733 8b/-> *(ebp+8) 6/r32/esi +15734 # edi = out +15735 8b/-> *(ebp+0xc) 7/r32/edi +15736 # initialize some global state +15737 c7 0/subop/copy *Curr-block-depth 1/imm32 +15738 # parse-mu-block(in, vars, out, out->body) +15739 8d/copy-address *(edi+0x18) 0/r32/eax # Function-body +15740 (parse-mu-block %esi *(ebp+0x10) %edi %eax *(ebp+0x14) *(ebp+0x18)) +15741 $populate-mu-function-body:end: +15742 # . restore registers +15743 5f/pop-to-edi +15744 5e/pop-to-esi +15745 58/pop-to-eax +15746 # . epilogue +15747 89/<- %esp 5/r32/ebp +15748 5d/pop-to-ebp +15749 c3/return +15750 +15751 # parses a block, assuming that the leading '{' has already been read by the caller +15752 parse-mu-block: # in: (addr buffered-file), vars: (addr stack live-var), fn: (addr function), out: (addr handle block), err: (addr buffered-file), ed: (addr exit-descriptor) +15753 # pseudocode: +15754 # var line: (stream byte 512) +15755 # var word-slice: slice +15756 # allocate(Heap, Stmt-size, out) +15757 # var out-addr: (addr block) = lookup(*out) +15758 # out-addr->tag = 0/block +15759 # out-addr->var = some unique name +15760 # push(vars, {out-addr->var, false}) +15761 # while true # line loop +15762 # clear-stream(line) +15763 # read-line-buffered(in, line) +15764 # if (line->write == 0) break # end of file +15765 # word-slice = next-mu-token(line) +15766 # if slice-empty?(word-slice) # end of line +15767 # continue +15768 # else if slice-starts-with?(word-slice, "#") +15769 # continue +15770 # else if slice-equal?(word-slice, "{") +15771 # assert(no-tokens-in(line)) +15772 # block = parse-mu-block(in, vars, fn) +15773 # append-to-block(out-addr, block) +15774 # else if slice-equal?(word-slice, "}") +15775 # break +15776 # else if slice-ends-with?(word-slice, ":") +15777 # # TODO: error-check the rest of 'line' +15778 # --word-slice->end to skip ':' +15779 # named-block = parse-mu-named-block(word-slice, in, vars, fn) +15780 # append-to-block(out-addr, named-block) +15781 # else if slice-equal?(word-slice, "var") +15782 # var-def = parse-mu-var-def(line, vars, fn) +15783 # append-to-block(out-addr, var-def) +15784 # else +15785 # stmt = parse-mu-stmt(line, vars, fn) +15786 # append-to-block(out-addr, stmt) +15787 # pop(vars) +15788 # +15789 # . prologue +15790 55/push-ebp +15791 89/<- %ebp 4/r32/esp +15792 # . save registers +15793 50/push-eax +15794 51/push-ecx +15795 52/push-edx +15796 53/push-ebx +15797 57/push-edi +15798 # var line/ecx: (stream byte 512) +15799 81 5/subop/subtract %esp 0x200/imm32 +15800 68/push 0x200/imm32/size +15801 68/push 0/imm32/read +15802 68/push 0/imm32/write +15803 89/<- %ecx 4/r32/esp +15804 # var word-slice/edx: slice +15805 68/push 0/imm32/end +15806 68/push 0/imm32/start +15807 89/<- %edx 4/r32/esp +15808 # allocate into out +15809 (allocate Heap *Stmt-size *(ebp+0x14)) +15810 # var out-addr/edi: (addr block) = lookup(*out) +15811 8b/-> *(ebp+0x14) 7/r32/edi +15812 (lookup *edi *(edi+4)) # => eax +15813 89/<- %edi 0/r32/eax +15814 # out-addr->tag is 0 (block) by default +15815 # set out-addr->var +15816 8d/copy-address *(edi+0xc) 0/r32/eax # Block-var +15817 (new-block-name *(ebp+0x10) %eax) +15818 # push(vars, out-addr->var) +15819 (push *(ebp+0xc) *(edi+0xc)) # Block-var +15820 (push *(ebp+0xc) *(edi+0x10)) # Block-var +15821 (push *(ebp+0xc) 0) # false +15822 # increment *Curr-block-depth +15823 ff 0/subop/increment *Curr-block-depth +15824 { +15825 $parse-mu-block:line-loop: +15826 # line = read-line-buffered(in) +15827 (clear-stream %ecx) +15828 (read-line-buffered *(ebp+8) %ecx) +15829 #? (write-buffered Stderr "line: ") +15830 #? (write-stream-data Stderr %ecx) +15831 #? #? (write-buffered Stderr Newline) # line has its own newline +15832 #? (flush Stderr) +15833 #? (rewind-stream %ecx) +15834 # if (line->write == 0) break +15835 81 7/subop/compare *ecx 0/imm32 +15836 0f 84/jump-if-= break/disp32 +15837 #? (write-buffered Stderr "vars:\n") +15838 #? (dump-vars *(ebp+0xc)) +15839 # word-slice = next-mu-token(line) +15840 (next-mu-token %ecx %edx) +15841 #? (write-buffered Stderr "word: ") +15842 #? (write-slice-buffered Stderr %edx) +15843 #? (write-buffered Stderr Newline) +15844 #? (flush Stderr) +15845 # if slice-empty?(word-slice) continue +15846 (slice-empty? %edx) +15847 3d/compare-eax-and 0/imm32/false +15848 0f 85/jump-if-!= loop/disp32 +15849 # if (slice-starts-with?(word-slice, '#') continue +15850 # . eax = *word-slice->start +15851 8b/-> *edx 0/r32/eax +15852 8a/copy-byte *eax 0/r32/AL +15853 81 4/subop/and %eax 0xff/imm32 +15854 # . if (eax == '#') continue +15855 3d/compare-eax-and 0x23/imm32/hash +15856 0f 84/jump-if-= loop/disp32 +15857 # if slice-equal?(word-slice, "{") +15858 { +15859 $parse-mu-block:check-for-block: +15860 (slice-equal? %edx "{") +15861 3d/compare-eax-and 0/imm32/false +15862 74/jump-if-= break/disp8 +15863 (check-no-tokens-left %ecx) +15864 # parse new block and append +15865 # . var tmp/eax: (handle block) +15866 68/push 0/imm32 +15867 68/push 0/imm32 +15868 89/<- %eax 4/r32/esp +15869 # . +15870 (parse-mu-block *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) +15871 (append-to-block Heap %edi *eax *(eax+4)) +15872 # . reclaim tmp +15873 81 0/subop/add %esp 8/imm32 +15874 # . +15875 e9/jump $parse-mu-block:line-loop/disp32 +15876 } +15877 # if slice-equal?(word-slice, "}") break +15878 $parse-mu-block:check-for-end: +15879 (slice-equal? %edx "}") +15880 3d/compare-eax-and 0/imm32/false +15881 0f 85/jump-if-!= break/disp32 +15882 # if slice-ends-with?(word-slice, ":") parse named block and append +15883 { +15884 $parse-mu-block:check-for-named-block: +15885 # . eax = *(word-slice->end-1) +15886 8b/-> *(edx+4) 0/r32/eax +15887 48/decrement-eax +15888 8a/copy-byte *eax 0/r32/AL +15889 81 4/subop/and %eax 0xff/imm32 +15890 # . if (eax != ':') break +15891 3d/compare-eax-and 0x3a/imm32/colon +15892 0f 85/jump-if-!= break/disp32 +15893 # TODO: error-check the rest of 'line' +15894 # +15895 # skip ':' +15896 ff 1/subop/decrement *(edx+4) # Slice-end +15897 # var tmp/eax: (handle block) +15898 68/push 0/imm32 +15899 68/push 0/imm32 +15900 89/<- %eax 4/r32/esp +15901 # +15902 (parse-mu-named-block %edx *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) +15903 (append-to-block Heap %edi *eax *(eax+4)) +15904 # reclaim tmp +15905 81 0/subop/add %esp 8/imm32 +15906 # +15907 e9/jump $parse-mu-block:line-loop/disp32 +15908 } +15909 # if slice-equal?(word-slice, "var") +15910 { +15911 $parse-mu-block:check-for-var: +15912 (slice-equal? %edx "var") +15913 3d/compare-eax-and 0/imm32/false +15914 74/jump-if-= break/disp8 +15915 # var tmp/eax: (handle block) +15916 68/push 0/imm32 +15917 68/push 0/imm32 +15918 89/<- %eax 4/r32/esp +15919 # +15920 (parse-mu-var-def %ecx *(ebp+0xc) %eax *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) +15921 (append-to-block Heap %edi *eax *(eax+4)) +15922 # reclaim tmp +15923 81 0/subop/add %esp 8/imm32 +15924 # +15925 e9/jump $parse-mu-block:line-loop/disp32 +15926 } +15927 $parse-mu-block:regular-stmt: +15928 # otherwise +15929 # var tmp/eax: (handle block) +15930 68/push 0/imm32 +15931 68/push 0/imm32 +15932 89/<- %eax 4/r32/esp +15933 # +15934 (parse-mu-stmt %ecx *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c)) +15935 (append-to-block Heap %edi *eax *(eax+4)) +15936 # reclaim tmp +15937 81 0/subop/add %esp 8/imm32 +15938 # +15939 e9/jump loop/disp32 +15940 } # end line loop +15941 (clean-up-blocks *(ebp+0xc) *Curr-block-depth *(ebp+0x10)) +15942 # decrement *Curr-block-depth +15943 ff 1/subop/decrement *Curr-block-depth +15944 # pop(vars) +15945 (pop *(ebp+0xc)) # => eax +15946 (pop *(ebp+0xc)) # => eax +15947 (pop *(ebp+0xc)) # => eax +15948 $parse-mu-block:end: +15949 # . reclaim locals +15950 81 0/subop/add %esp 0x214/imm32 +15951 # . restore registers +15952 5f/pop-to-edi +15953 5b/pop-to-ebx +15954 5a/pop-to-edx +15955 59/pop-to-ecx +15956 58/pop-to-eax +15957 # . epilogue +15958 89/<- %esp 5/r32/ebp +15959 5d/pop-to-ebp +15960 c3/return +15961 +15962 $parse-mu-block:abort: +15963 # error("'{' or '}' should be on its own line, but got '") +15964 (write-buffered *(ebp+0x18) "'{' or '}' should be on its own line, but got '") +15965 (rewind-stream %ecx) +15966 (write-stream-data *(ebp+0x18) %ecx) +15967 (write-buffered *(ebp+0x18) "'\n") +15968 (flush *(ebp+0x18)) +15969 (stop *(ebp+0x1c) 1) +15970 # never gets here +15971 +15972 new-block-name: # fn: (addr function), out: (addr handle var) +15973 # . prologue +15974 55/push-ebp +15975 89/<- %ebp 4/r32/esp +15976 # . save registers +15977 50/push-eax +15978 51/push-ecx +15979 52/push-edx +15980 # var n/ecx: int = len(fn->name) + 10 for an int + 2 for '$:' +15981 8b/-> *(ebp+8) 0/r32/eax +15982 (lookup *eax *(eax+4)) # Function-name Function-name => eax +15983 8b/-> *eax 0/r32/eax # String-size +15984 05/add-to-eax 0xd/imm32 # 10 + 2 for '$:' +15985 89/<- %ecx 0/r32/eax +15986 # var name/edx: (stream byte n) +15987 29/subtract-from %esp 1/r32/ecx +15988 ff 6/subop/push %ecx +15989 68/push 0/imm32/read +15990 68/push 0/imm32/write +15991 89/<- %edx 4/r32/esp +15992 (clear-stream %edx) +15993 # eax = fn->name +15994 8b/-> *(ebp+8) 0/r32/eax +15995 (lookup *eax *(eax+4)) # Function-name Function-name => eax +15996 # construct result using Next-block-index (and increment it) +15997 (write %edx "$") +15998 (write %edx %eax) +15999 (write %edx ":") +16000 (write-int32-hex %edx *Next-block-index) +16001 ff 0/subop/increment *Next-block-index +16002 # var s/eax: slice = {name->data, name->data + name->write} (clobbering edx) +16003 # . eax = name->write +16004 8b/-> *edx 0/r32/eax +16005 # . edx = name->data +16006 8d/copy-address *(edx+0xc) 2/r32/edx +16007 # . eax = name->write + name->data +16008 01/add-to %eax 2/r32/edx +16009 # . push {edx, eax} +16010 ff 6/subop/push %eax +16011 ff 6/subop/push %edx +16012 89/<- %eax 4/r32/esp +16013 # out = new literal(s) +16014 (new-literal Heap %eax *(ebp+0xc)) +16015 #? 8b/-> *(ebp+0xc) 0/r32/eax +16016 #? (write-buffered Stderr "type allocid in caller after new-literal: ") +16017 #? (write-int32-hex-buffered Stderr *(eax+8)) +16018 #? (write-buffered Stderr " for var ") +16019 #? (write-int32-hex-buffered Stderr %eax) +16020 #? (write-buffered Stderr Newline) +16021 #? (flush Stderr) +16022 $new-block-name:end: +16023 # . reclaim locals +16024 81 0/subop/add %ecx 0xc/imm32 # name.{read/write/len} +16025 81 0/subop/add %ecx 8/imm32 # slice +16026 01/add-to %esp 1/r32/ecx +16027 # . restore registers +16028 5a/pop-to-edx +16029 59/pop-to-ecx +16030 58/pop-to-eax +16031 # . epilogue +16032 89/<- %esp 5/r32/ebp +16033 5d/pop-to-ebp +16034 c3/return +16035 +16036 check-no-tokens-left: # line: (addr stream byte) +16037 # . prologue +16038 55/push-ebp +16039 89/<- %ebp 4/r32/esp +16040 # . save registers +16041 50/push-eax +16042 51/push-ecx +16043 # var s/ecx: slice +16044 68/push 0/imm32/end +16045 68/push 0/imm32/start +16046 89/<- %ecx 4/r32/esp +16047 # +16048 (next-mu-token *(ebp+8) %ecx) +16049 # if slice-empty?(s) return +16050 (slice-empty? %ecx) +16051 3d/compare-eax-and 0/imm32/false +16052 75/jump-if-!= $check-no-tokens-left:end/disp8 +16053 # if (slice-starts-with?(s, '#') return +16054 # . eax = *s->start +16055 8b/-> *edx 0/r32/eax +16056 8a/copy-byte *eax 0/r32/AL +16057 81 4/subop/and %eax 0xff/imm32 +16058 # . if (eax == '#') continue +16059 3d/compare-eax-and 0x23/imm32/hash +16060 74/jump-if-= $check-no-tokens-left:end/disp8 +16061 # abort +16062 (write-buffered Stderr "'{' or '}' should be on its own line, but got '") +16063 (rewind-stream %ecx) +16064 (write-stream 2 %ecx) +16065 (write-buffered Stderr "'\n") +16066 (flush Stderr) +16067 # . syscall(exit, 1) +16068 bb/copy-to-ebx 1/imm32 +16069 e8/call syscall_exit/disp32 +16070 # never gets here +16071 $check-no-tokens-left:end: +16072 # . reclaim locals +16073 81 0/subop/add %esp 8/imm32 +16074 # . restore registers +16075 59/pop-to-ecx +16076 58/pop-to-eax +16077 # . epilogue +16078 89/<- %esp 5/r32/ebp +16079 5d/pop-to-ebp +16080 c3/return +16081 +16082 parse-mu-named-block: # name: (addr slice), in: (addr buffered-file), vars: (addr stack live-var), fn: (addr function), out: (addr handle stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +16083 # pseudocode: +16084 # var v: (handle var) +16085 # new-literal(name, v) +16086 # push(vars, {v, false}) +16087 # parse-mu-block(in, vars, fn, out) +16088 # pop(vars) +16089 # out->tag = block +16090 # out->var = v +16091 # +16092 # . prologue +16093 55/push-ebp +16094 89/<- %ebp 4/r32/esp +16095 # . save registers +16096 50/push-eax +16097 51/push-ecx +16098 57/push-edi +16099 # var v/ecx: (handle var) +16100 68/push 0/imm32 +16101 68/push 0/imm32 +16102 89/<- %ecx 4/r32/esp +16103 # +16104 (new-literal Heap *(ebp+8) %ecx) +16105 # push(vars, v) +16106 (push *(ebp+0x10) *ecx) +16107 (push *(ebp+0x10) *(ecx+4)) +16108 (push *(ebp+0x10) 0) # false +16109 # +16110 (parse-mu-block *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20)) +16111 # pop v off vars +16112 (pop *(ebp+0x10)) # => eax +16113 (pop *(ebp+0x10)) # => eax +16114 (pop *(ebp+0x10)) # => eax +16115 # var out-addr/edi: (addr stmt) = lookup(*out) +16116 8b/-> *(ebp+0x18) 7/r32/edi +16117 (lookup *edi *(edi+4)) # => eax +16118 89/<- %edi 0/r32/eax +16119 # out-addr->tag = named-block +16120 c7 0/subop/copy *edi 0/imm32/block # Stmt-tag +16121 # out-addr->var = v +16122 8b/-> *ecx 0/r32/eax +16123 89/<- *(edi+0xc) 0/r32/eax # Block-var +16124 8b/-> *(ecx+4) 0/r32/eax +16125 89/<- *(edi+0x10) 0/r32/eax # Block-var +16126 $parse-mu-named-block:end: +16127 # . reclaim locals +16128 81 0/subop/add %esp 8/imm32 +16129 # . restore registers +16130 5f/pop-to-edi +16131 59/pop-to-ecx +16132 58/pop-to-eax +16133 # . epilogue +16134 89/<- %esp 5/r32/ebp +16135 5d/pop-to-ebp +16136 c3/return +16137 +16138 parse-mu-var-def: # line: (addr stream byte), vars: (addr stack live-var), out: (addr handle stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +16139 # . prologue +16140 55/push-ebp +16141 89/<- %ebp 4/r32/esp +16142 # . save registers +16143 50/push-eax +16144 51/push-ecx +16145 52/push-edx +16146 53/push-ebx +16147 57/push-edi +16148 # edi = out +16149 8b/-> *(ebp+0x10) 7/r32/edi +16150 # var word-slice/ecx: slice +16151 68/push 0/imm32/end +16152 68/push 0/imm32/start +16153 89/<- %ecx 4/r32/esp +16154 # var v/edx: (handle var) +16155 68/push 0/imm32 +16156 68/push 0/imm32 +16157 89/<- %edx 4/r32/esp +16158 # v = parse-var-with-type(next-mu-token(line)) +16159 (next-mu-token *(ebp+8) %ecx) +16160 (parse-var-with-type %ecx *(ebp+8) %edx *(ebp+0x18) *(ebp+0x1c)) +16161 # var v-addr/eax: (addr var) +16162 (lookup *edx *(edx+4)) # => eax +16163 # v->block-depth = *Curr-block-depth +16164 8b/-> *Curr-block-depth 3/r32/ebx +16165 89/<- *(eax+0x10) 3/r32/ebx # Var-block-depth +16166 # either v has no register and there's no more to this line +16167 8b/-> *(eax+0x18) 0/r32/eax # Var-register +16168 3d/compare-eax-and 0/imm32 +16169 { +16170 75/jump-if-!= break/disp8 +16171 # TODO: disallow vars of type 'byte' on the stack +16172 # ensure that there's nothing else on this line +16173 (next-mu-token *(ebp+8) %ecx) +16174 (slice-empty? %ecx) # => eax +16175 3d/compare-eax-and 0/imm32/false +16176 0f 84/jump-if-= $parse-mu-var-def:error2/disp32 +16177 # +16178 (new-var-def Heap *edx *(edx+4) %edi) +16179 e9/jump $parse-mu-var-def:update-vars/disp32 +16180 } +16181 # or v has a register and there's more to this line +16182 { +16183 0f 84/jump-if-= break/disp32 +16184 # TODO: disallow vars of type 'byte' in registers 'esi' or 'edi' +16185 # TODO: vars of type 'byte' should only be initialized by clearing to 0 +16186 # ensure that the next word is '<-' +16187 (next-mu-token *(ebp+8) %ecx) +16188 (slice-equal? %ecx "<-") # => eax +16189 3d/compare-eax-and 0/imm32/false +16190 0f 84/jump-if-= $parse-mu-var-def:error1/disp32 +16191 # +16192 (new-reg-var-def Heap *edx *(edx+4) %edi) +16193 (lookup *edi *(edi+4)) # => eax +16194 (add-operation-and-inputs-to-stmt %eax *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +16195 } +16196 $parse-mu-var-def:update-vars: +16197 # push 'v' at end of function +16198 (push *(ebp+0xc) *edx) +16199 (push *(ebp+0xc) *(edx+4)) +16200 (push *(ebp+0xc) 0) # Live-var-register-spilled is unused during parsing +16201 $parse-mu-var-def:end: +16202 # . reclaim locals +16203 81 0/subop/add %esp 0x10/imm32 +16204 # . restore registers +16205 5f/pop-to-edi +16206 5b/pop-to-ebx +16207 5a/pop-to-edx +16208 59/pop-to-ecx +16209 58/pop-to-eax +16210 # . epilogue +16211 89/<- %esp 5/r32/ebp +16212 5d/pop-to-ebp +16213 c3/return +16214 +16215 $parse-mu-var-def:error1: +16216 (rewind-stream *(ebp+8)) +16217 # error("register variable requires a valid instruction to initialize but got '" line "'\n") +16218 (write-buffered *(ebp+0x18) "register variable requires a valid instruction to initialize but got '") +16219 (flush *(ebp+0x18)) +16220 (write-stream-data *(ebp+0x18) *(ebp+8)) +16221 (write-buffered *(ebp+0x18) "'\n") +16222 (flush *(ebp+0x18)) +16223 (stop *(ebp+0x1c) 1) +16224 # never gets here +16225 +16226 $parse-mu-var-def:error2: +16227 (rewind-stream *(ebp+8)) +16228 # error("fn " fn ": var " var ": variables on the stack can't take an initializer\n") +16229 (write-buffered *(ebp+0x18) "fn ") +16230 8b/-> *(ebp+0x14) 0/r32/eax +16231 (lookup *eax *(eax+4)) # Function-name Function-name => eax +16232 (write-buffered *(ebp+0x18) %eax) +16233 (write-buffered *(ebp+0x18) ": var ") +16234 # var v-addr/eax: (addr var) = lookup(v) +16235 (lookup *edx *(edx+4)) # => eax +16236 (lookup *eax *(eax+4)) # Var-name Var-name => eax +16237 (write-buffered *(ebp+0x18) %eax) +16238 (write-buffered *(ebp+0x18) ": variables on the stack can't take an initializer\n") +16239 (flush *(ebp+0x18)) +16240 (stop *(ebp+0x1c) 1) +16241 # never gets here +16242 +16243 test-parse-mu-var-def: +16244 # 'var n: int' +16245 # . prologue +16246 55/push-ebp +16247 89/<- %ebp 4/r32/esp +16248 # setup +16249 8b/-> *Primitive-type-ids 0/r32/eax +16250 89/<- *Type-id 0/r32/eax # stream-write +16251 (clear-stream _test-input-stream) +16252 (write _test-input-stream "n: int\n") # caller has consumed the 'var' +16253 c7 0/subop/copy *Curr-block-depth 1/imm32 +16254 # var out/esi: (handle stmt) +16255 68/push 0/imm32 +16256 68/push 0/imm32 +16257 89/<- %esi 4/r32/esp +16258 # var vars/ecx: (stack (addr var) 16) +16259 81 5/subop/subtract %esp 0xc0/imm32 +16260 68/push 0xc0/imm32/size +16261 68/push 0/imm32/top +16262 89/<- %ecx 4/r32/esp +16263 (clear-stack %ecx) +16264 # convert +16265 (parse-mu-var-def _test-input-stream %ecx %esi 0 Stderr 0) +16266 # var out-addr/esi: (addr stmt) +16267 (lookup *esi *(esi+4)) # => eax +16268 89/<- %esi 0/r32/eax +16269 # +16270 (check-ints-equal *esi 2 "F - test-parse-mu-var-def/tag") # Stmt-tag is var-def +16271 # var v/ecx: (addr var) = lookup(out->var) +16272 (lookup *(esi+4) *(esi+8)) # Vardef-var Vardef-var => eax +16273 89/<- %ecx 0/r32/eax +16274 # v->name +16275 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +16276 (check-strings-equal %eax "n" "F - test-parse-mu-var-def/var-name") +16277 # v->register +16278 (check-ints-equal *(ecx+0x18) 0 "F - test-parse-mu-var-def/var-register") # Var-register +16279 # v->block-depth +16280 (check-ints-equal *(ecx+0x10) 1 "F - test-parse-mu-var-def/output-block-depth") # Var-block-depth +16281 # v->type == int +16282 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +16283 (check-ints-equal *eax 1 "F - test-parse-mu-var-def/var-type:0") # Type-tree-is-atom +16284 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-var-def/var-type:1") # Type-tree-value +16285 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-var-def/var-type:2") # Type-tree-right +16286 # . epilogue +16287 89/<- %esp 5/r32/ebp +16288 5d/pop-to-ebp +16289 c3/return +16290 +16291 test-parse-mu-reg-var-def: +16292 # 'var n/eax: int <- copy 0' +16293 # . prologue +16294 55/push-ebp +16295 89/<- %ebp 4/r32/esp +16296 # setup +16297 8b/-> *Primitive-type-ids 0/r32/eax +16298 89/<- *Type-id 0/r32/eax # stream-write +16299 (clear-stream _test-input-stream) +16300 (write _test-input-stream "n/eax: int <- copy 0\n") # caller has consumed the 'var' +16301 c7 0/subop/copy *Curr-block-depth 1/imm32 +16302 # var out/esi: (handle stmt) +16303 68/push 0/imm32 +16304 68/push 0/imm32 +16305 89/<- %esi 4/r32/esp +16306 # var vars/ecx: (stack (addr var) 16) +16307 81 5/subop/subtract %esp 0xc0/imm32 +16308 68/push 0xc0/imm32/size +16309 68/push 0/imm32/top +16310 89/<- %ecx 4/r32/esp +16311 (clear-stack %ecx) +16312 # convert +16313 (parse-mu-var-def _test-input-stream %ecx %esi 0 Stderr 0) +16314 # var out-addr/esi: (addr stmt) +16315 (lookup *esi *(esi+4)) # => eax +16316 89/<- %esi 0/r32/eax +16317 # +16318 (check-ints-equal *esi 3 "F - test-parse-mu-reg-var-def/tag") # Stmt-tag is reg-var-def +16319 # var v/ecx: (addr var) = lookup(out->outputs->value) +16320 # . eax: (addr stmt-var) = lookup(out->outputs) +16321 (lookup *(esi+0x14) *(esi+0x18)) # Regvardef-outputs Regvardef-outputs => eax +16322 # . +16323 (check-ints-equal *(eax+8) 0 "F - test-parse-mu-reg-var-def/single-output") # Stmt-var-next +16324 # . eax: (addr var) = lookup(eax->value) +16325 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +16326 # . ecx = eax +16327 89/<- %ecx 0/r32/eax +16328 # v->name +16329 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +16330 (check-strings-equal %eax "n" "F - test-parse-mu-reg-var-def/output-name") # Var-name +16331 # v->register +16332 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax +16333 (check-strings-equal %eax "eax" "F - test-parse-mu-reg-var-def/output-register") +16334 # v->block-depth +16335 (check-ints-equal *(ecx+0x10) 1 "F - test-parse-mu-reg-var-def/output-block-depth") # Var-block-depth +16336 # v->type == int +16337 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +16338 (check-ints-equal *eax 1 "F - test-parse-mu-reg-var-def/output-type:0") # Type-tree-is-atom +16339 (check-ints-equal *(eax+4) 1 "F - test-parse-mu-reg-var-def/output-type:1") # Type-tree-value +16340 (check-ints-equal *(eax+0xc) 0 "F - test-parse-mu-reg-var-def/output-type:2") # Type-tree-right +16341 # . epilogue +16342 89/<- %esp 5/r32/ebp +16343 5d/pop-to-ebp +16344 c3/return +16345 +16346 parse-mu-stmt: # line: (addr stream byte), vars: (addr stack live-var), fn: (addr function), out: (addr handle stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +16347 # pseudocode: +16348 # var name: slice +16349 # allocate(Heap, Stmt-size, out) +16350 # var out-addr: (addr stmt) = lookup(*out) +16351 # out-addr->tag = stmt +16352 # if stmt-has-outputs?(line) +16353 # while true +16354 # name = next-mu-token(line) +16355 # if (name == '<-') break +16356 # assert(is-identifier?(name)) +16357 # var v: (handle var) = lookup-var(name, vars) +16358 # out-addr->outputs = append(v, out-addr->outputs) +16359 # add-operation-and-inputs-to-stmt(out-addr, line, vars) +16360 # +16361 # . prologue +16362 55/push-ebp +16363 89/<- %ebp 4/r32/esp +16364 # . save registers +16365 50/push-eax +16366 51/push-ecx +16367 52/push-edx +16368 53/push-ebx +16369 57/push-edi +16370 # var name/ecx: slice +16371 68/push 0/imm32/end +16372 68/push 0/imm32/start +16373 89/<- %ecx 4/r32/esp +16374 # var is-deref?/edx: boolean = false +16375 ba/copy-to-edx 0/imm32/false +16376 # var v: (handle var) +16377 68/push 0/imm32 +16378 68/push 0/imm32 +16379 89/<- %ebx 4/r32/esp +16380 # +16381 (allocate Heap *Stmt-size *(ebp+0x14)) +16382 # var out-addr/edi: (addr stmt) = lookup(*out) +16383 8b/-> *(ebp+0x14) 7/r32/edi +16384 (lookup *edi *(edi+4)) # => eax +16385 89/<- %edi 0/r32/eax +16386 # out-addr->tag = 1/stmt +16387 c7 0/subop/copy *edi 1/imm32/stmt1 # Stmt-tag +16388 { +16389 (stmt-has-outputs? *(ebp+8)) +16390 3d/compare-eax-and 0/imm32/false +16391 0f 84/jump-if-= break/disp32 +16392 { +16393 $parse-mu-stmt:read-outputs: +16394 # name = next-mu-token(line) +16395 (next-mu-token *(ebp+8) %ecx) +16396 # if slice-empty?(word-slice) break +16397 (slice-empty? %ecx) # => eax +16398 3d/compare-eax-and 0/imm32/false +16399 0f 85/jump-if-!= break/disp32 +16400 # if (name == "<-") break +16401 (slice-equal? %ecx "<-") # => eax +16402 3d/compare-eax-and 0/imm32/false +16403 0f 85/jump-if-!= break/disp32 +16404 # is-deref? = false +16405 ba/copy-to-edx 0/imm32/false +16406 # if (slice-starts-with?(name, '*')) ++name->start and set is-deref? +16407 8b/-> *ecx 0/r32/eax # Slice-start +16408 8a/copy-byte *eax 0/r32/AL +16409 81 4/subop/and %eax 0xff/imm32 +16410 3d/compare-eax-and 0x2a/imm32/asterisk +16411 { +16412 75/jump-if-!= break/disp8 +16413 ff 0/subop/increment *ecx +16414 ba/copy-to-edx 1/imm32/true +16415 } +16416 # assert(is-identifier?(name)) +16417 (is-identifier? %ecx) # => eax +16418 3d/compare-eax-and 0/imm32/false +16419 0f 84/jump-if-= $parse-mu-stmt:abort/disp32 +16420 # +16421 (lookup-var %ecx *(ebp+0xc) %ebx *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) +16422 8d/copy-address *(edi+0x14) 0/r32/eax # Stmt1-outputs +16423 (append-stmt-var Heap *ebx *(ebx+4) *(edi+0x14) *(edi+0x18) %edx %eax) # Stmt1-outputs +16424 # +16425 e9/jump loop/disp32 +16426 } +16427 } +16428 (add-operation-and-inputs-to-stmt %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) +16429 $parse-mu-stmt:end: +16430 # . reclaim locals +16431 81 0/subop/add %esp 0x10/imm32 +16432 # . restore registers +16433 5f/pop-to-edi +16434 5b/pop-to-ebx +16435 5a/pop-to-edx +16436 59/pop-to-ecx +16437 58/pop-to-eax +16438 # . epilogue +16439 89/<- %esp 5/r32/ebp +16440 5d/pop-to-ebp +16441 c3/return +16442 +16443 $parse-mu-stmt:abort: +16444 # error("invalid identifier '" name "'\n") +16445 (write-buffered *(ebp+0x18) "invalid identifier '") +16446 (write-slice-buffered *(ebp+0x18) %ecx) +16447 (write-buffered *(ebp+0x18) "'\n") +16448 (flush *(ebp+0x18)) +16449 (stop *(ebp+0x1c) 1) +16450 # never gets here +16451 +16452 add-operation-and-inputs-to-stmt: # stmt: (addr stmt), line: (addr stream byte), vars: (addr stack live-var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +16453 # pseudocode: +16454 # stmt->name = slice-to-string(next-mu-token(line)) +16455 # while true +16456 # name = next-mu-token(line) +16457 # v = lookup-var-or-literal(name) +16458 # stmt->inouts = append(v, stmt->inouts) +16459 # +16460 # . prologue +16461 55/push-ebp +16462 89/<- %ebp 4/r32/esp +16463 # . save registers +16464 50/push-eax +16465 51/push-ecx +16466 52/push-edx +16467 53/push-ebx +16468 56/push-esi +16469 57/push-edi +16470 # edi = stmt +16471 8b/-> *(ebp+8) 7/r32/edi +16472 # var name/ecx: slice +16473 68/push 0/imm32/end +16474 68/push 0/imm32/start +16475 89/<- %ecx 4/r32/esp +16476 # var is-deref?/edx: boolean = false +16477 ba/copy-to-edx 0/imm32/false +16478 # var v/esi: (handle var) +16479 68/push 0/imm32 +16480 68/push 0/imm32 +16481 89/<- %esi 4/r32/esp +16482 $add-operation-and-inputs-to-stmt:read-operation: +16483 (next-mu-token *(ebp+0xc) %ecx) +16484 8d/copy-address *(edi+4) 0/r32/eax # Stmt1-operation or Regvardef-operationStmt1-operation or Regvardef-operation +16485 (slice-to-string Heap %ecx %eax) +16486 # var is-get?/ebx: boolean = (name == "get") +16487 (slice-equal? %ecx "get") # => eax +16488 89/<- %ebx 0/r32/eax +16489 { +16490 $add-operation-and-inputs-to-stmt:read-inouts: +16491 # name = next-mu-token(line) +16492 (next-mu-token *(ebp+0xc) %ecx) +16493 # if slice-empty?(word-slice) break +16494 (slice-empty? %ecx) # => eax +16495 3d/compare-eax-and 0/imm32/false +16496 0f 85/jump-if-!= break/disp32 +16497 # if (name == "<-") abort +16498 (slice-equal? %ecx "<-") +16499 3d/compare-eax-and 0/imm32/false +16500 0f 85/jump-if-!= $add-operation-and-inputs-to-stmt:abort/disp32 +16501 # if (is-get? && second operand) lookup or create offset +16502 { +16503 81 7/subop/compare %ebx 0/imm32/false +16504 74/jump-if-= break/disp8 +16505 (lookup *(edi+0xc) *(edi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +16506 3d/compare-eax-and 0/imm32 +16507 74/jump-if-= break/disp8 +16508 (lookup-or-create-constant %eax %ecx %esi) +16509 #? (lookup *esi *(esi+4)) +16510 #? (write-buffered Stderr "creating new output var ") +16511 #? (write-int32-hex-buffered Stderr %eax) +16512 #? (write-buffered Stderr " for field called ") +16513 #? (write-slice-buffered Stderr %ecx) +16514 #? (write-buffered Stderr "; var name ") +16515 #? (lookup *eax *(eax+4)) # Var-name +16516 #? (write-buffered Stderr %eax) +16517 #? (write-buffered Stderr Newline) +16518 #? (flush Stderr) +16519 e9/jump $add-operation-and-inputs-to-stmt:save-var/disp32 +16520 } +16521 # is-deref? = false +16522 ba/copy-to-edx 0/imm32/false +16523 # if (slice-starts-with?(name, '*')) ++name->start and set is-deref? +16524 8b/-> *ecx 0/r32/eax # Slice-start +16525 8a/copy-byte *eax 0/r32/AL +16526 81 4/subop/and %eax 0xff/imm32 +16527 3d/compare-eax-and 0x2a/imm32/asterisk +16528 { +16529 75/jump-if-!= break/disp8 +16530 $add-operation-and-inputs-to-stmt:inout-is-deref: +16531 ff 0/subop/increment *ecx +16532 ba/copy-to-edx 1/imm32/true +16533 } +16534 (lookup-var-or-literal %ecx *(ebp+0x10) %esi *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +16535 # if (is-deref?) some additional checks +16536 81 7/subop/compare %edx 0/imm32/false +16537 { +16538 74/jump-if-= break/disp8 +16539 # if var is not in register, abort +16540 (lookup *esi *(esi+4)) # => eax +16541 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +16542 0f 84/jump-if-= $add-operation-and-inputs-to-stmt:error-deref-on-stack/disp32 +16543 # if var is not an address, abort +16544 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +16545 (is-mu-addr-type? %eax) # => eax +16546 3d/compare-eax-and 0/imm32/false +16547 0f 84/jump-if-= $add-operation-and-inputs-to-stmt:error-deref-non-addr/disp32 +16548 } +16549 $add-operation-and-inputs-to-stmt:save-var: +16550 8d/copy-address *(edi+0xc) 0/r32/eax +16551 (append-stmt-var Heap *esi *(esi+4) *(edi+0xc) *(edi+0x10) %edx %eax) # Stmt1-inouts or Regvardef-inouts +16552 # +16553 e9/jump loop/disp32 +16554 } +16555 $add-operation-and-inputs-to-stmt:end: +16556 # . reclaim locals +16557 81 0/subop/add %esp 0x10/imm32 +16558 # . restore registers +16559 5f/pop-to-edi +16560 5e/pop-to-esi +16561 5b/pop-to-ebx +16562 5a/pop-to-edx +16563 59/pop-to-ecx +16564 58/pop-to-eax +16565 # . epilogue +16566 89/<- %esp 5/r32/ebp +16567 5d/pop-to-ebp +16568 c3/return +16569 +16570 $add-operation-and-inputs-to-stmt:abort: +16571 # error("fn ___: invalid identifier in '" line "'\n") +16572 (write-buffered *(ebp+0x18) "fn ") +16573 8b/-> *(ebp+0x14) 0/r32/eax +16574 (lookup *eax *(eax+4)) # Function-name Function-name => eax +16575 (write-buffered *(ebp+0x18) %eax) +16576 (rewind-stream *(ebp+0xc)) +16577 (write-buffered *(ebp+0x18) ": invalid identifier in '") +16578 (write-stream-data *(ebp+0x18) *(ebp+0xc)) +16579 (write-buffered *(ebp+0x18) "'\n") +16580 (flush *(ebp+0x18)) +16581 (stop *(ebp+0x1c) 1) +16582 # never gets here +16583 +16584 $add-operation-and-inputs-to-stmt:error-deref-on-stack: +16585 # error("fn ___: cannot dereference var ___ on stack\n") +16586 (write-buffered *(ebp+0x18) "fn ") +16587 8b/-> *(ebp+0x14) 0/r32/eax +16588 (lookup *eax *(eax+4)) # Function-name Function-name => eax +16589 (write-buffered *(ebp+0x18) %eax) +16590 (rewind-stream *(ebp+0xc)) +16591 (write-buffered *(ebp+0x18) ": cannot dereference var '") +16592 (lookup *esi *(esi+4)) # => eax +16593 (lookup *eax *(eax+4)) # Var-name Var-name => eax +16594 (write-buffered *(ebp+0x18) %eax) +16595 (write-buffered *(ebp+0x18) "' on stack\n") +16596 (flush *(ebp+0x18)) +16597 (stop *(ebp+0x1c) 1) +16598 # never gets here +16599 +16600 $add-operation-and-inputs-to-stmt:error-deref-non-addr: +16601 # error("fn ___: cannot dereference non-addr var ___\n") +16602 (write-buffered *(ebp+0x18) "fn ") +16603 8b/-> *(ebp+0x14) 0/r32/eax +16604 (lookup *eax *(eax+4)) # Function-name Function-name => eax +16605 (write-buffered *(ebp+0x18) %eax) +16606 (rewind-stream *(ebp+0xc)) +16607 (write-buffered *(ebp+0x18) ": cannot dereference non-addr var '") +16608 (lookup *esi *(esi+4)) # => eax +16609 (lookup *eax *(eax+4)) # Var-name Var-name => eax +16610 (write-buffered *(ebp+0x18) %eax) +16611 (write-buffered *(ebp+0x18) "'\n") +16612 (flush *(ebp+0x18)) +16613 (stop *(ebp+0x1c) 1) +16614 # never gets here +16615 +16616 stmt-has-outputs?: # line: (addr stream byte) -> result/eax: boolean +16617 # . prologue +16618 55/push-ebp +16619 89/<- %ebp 4/r32/esp +16620 # . save registers +16621 51/push-ecx +16622 # var word-slice/ecx: slice +16623 68/push 0/imm32/end +16624 68/push 0/imm32/start +16625 89/<- %ecx 4/r32/esp +16626 # result = false +16627 b8/copy-to-eax 0/imm32/false +16628 (rewind-stream *(ebp+8)) +16629 { +16630 (next-mu-token *(ebp+8) %ecx) +16631 # if slice-empty?(word-slice) break +16632 (slice-empty? %ecx) +16633 3d/compare-eax-and 0/imm32/false +16634 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) +16635 0f 85/jump-if-!= break/disp32 +16636 # if slice-starts-with?(word-slice, '#') break +16637 # . eax = *word-slice->start +16638 8b/-> *ecx 0/r32/eax +16639 8a/copy-byte *eax 0/r32/AL +16640 81 4/subop/and %eax 0xff/imm32 +16641 # . if (eax == '#') break +16642 3d/compare-eax-and 0x23/imm32/hash +16643 b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false) +16644 0f 84/jump-if-= break/disp32 +16645 # if slice-equal?(word-slice, '<-') return true +16646 (slice-equal? %ecx "<-") +16647 3d/compare-eax-and 0/imm32/false +16648 74/jump-if-= loop/disp8 +16649 b8/copy-to-eax 1/imm32/true +16650 } +16651 $stmt-has-outputs:end: +16652 (rewind-stream *(ebp+8)) +16653 # . reclaim locals +16654 81 0/subop/add %esp 8/imm32 +16655 # . restore registers +16656 59/pop-to-ecx +16657 # . epilogue +16658 89/<- %esp 5/r32/ebp +16659 5d/pop-to-ebp +16660 c3/return +16661 +16662 # if 'name' starts with a digit, create a new literal var for it +16663 # otherwise return first 'name' from the top (back) of 'vars' and abort if not found +16664 lookup-var-or-literal: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +16665 # . prologue +16666 55/push-ebp +16667 89/<- %ebp 4/r32/esp +16668 # . save registers +16669 50/push-eax +16670 51/push-ecx +16671 56/push-esi +16672 # esi = name +16673 8b/-> *(ebp+8) 6/r32/esi +16674 # if slice-empty?(name) abort +16675 (slice-empty? %esi) # => eax +16676 3d/compare-eax-and 0/imm32/false +16677 0f 85/jump-if-!= $lookup-var-or-literal:abort/disp32 +16678 # var c/ecx: byte = *name->start +16679 8b/-> *esi 1/r32/ecx +16680 8a/copy-byte *ecx 1/r32/CL +16681 81 4/subop/and %ecx 0xff/imm32 +16682 # if (is-decimal-digit?(c) || c == '-') return new var(name) +16683 { +16684 81 7/subop/compare %ecx 0x2d/imm32/dash +16685 74/jump-if-= $lookup-var-or-literal:literal/disp8 +16686 (is-decimal-digit? %ecx) # => eax +16687 3d/compare-eax-and 0/imm32/false +16688 74/jump-if-= break/disp8 +16689 $lookup-var-or-literal:literal: +16690 (new-literal-integer Heap %esi *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +16691 eb/jump $lookup-var-or-literal:end/disp8 +16692 } +16693 # else if (c == '"') return new var(name) +16694 { +16695 81 7/subop/compare %ecx 0x22/imm32/dquote +16696 75/jump-if-!= break/disp8 +16697 $lookup-var-or-literal:literal-string: +16698 (new-literal-string Heap %esi *(ebp+0x10)) +16699 eb/jump $lookup-var-or-literal:end/disp8 +16700 } +16701 # otherwise return lookup-var(name, vars) +16702 { +16703 $lookup-var-or-literal:var: +16704 (lookup-var %esi *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +16705 } +16706 $lookup-var-or-literal:end: +16707 # . restore registers +16708 5e/pop-to-esi +16709 59/pop-to-ecx +16710 58/pop-to-eax +16711 # . epilogue +16712 89/<- %esp 5/r32/ebp +16713 5d/pop-to-ebp +16714 c3/return +16715 +16716 $lookup-var-or-literal:abort: +16717 (write-buffered *(ebp+0x18) "fn ") +16718 8b/-> *(ebp+0x14) 0/r32/eax +16719 (lookup *eax *(eax+4)) # Function-name Function-name => eax +16720 (write-buffered *(ebp+0x18) %eax) +16721 (write-buffered *(ebp+0x18) ": empty variable!") +16722 (flush *(ebp+0x18)) +16723 (stop *(ebp+0x1c) 1) +16724 # never gets here +16725 +16726 # return first 'name' from the top (back) of 'vars' and abort if not found +16727 lookup-var: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +16728 # . prologue +16729 55/push-ebp +16730 89/<- %ebp 4/r32/esp +16731 # . save registers +16732 50/push-eax +16733 # +16734 (lookup-var-helper *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +16735 # if (*out == 0) abort +16736 8b/-> *(ebp+0x10) 0/r32/eax +16737 81 7/subop/compare *eax 0/imm32 +16738 74/jump-if-= $lookup-var:abort/disp8 +16739 $lookup-var:end: +16740 # . restore registers +16741 58/pop-to-eax +16742 # . epilogue +16743 89/<- %esp 5/r32/ebp +16744 5d/pop-to-ebp +16745 c3/return +16746 +16747 $lookup-var:abort: +16748 (write-buffered *(ebp+0x18) "fn ") +16749 8b/-> *(ebp+0x14) 0/r32/eax +16750 (lookup *eax *(eax+4)) # Function-name Function-name => eax +16751 (write-buffered *(ebp+0x18) %eax) +16752 (write-buffered *(ebp+0x18) ": unknown variable '") +16753 (write-slice-buffered *(ebp+0x18) *(ebp+8)) +16754 (write-buffered *(ebp+0x18) "'\n") +16755 (flush *(ebp+0x18)) +16756 (stop *(ebp+0x1c) 1) +16757 # never gets here +16758 +16759 # return first 'name' from the top (back) of 'vars', and 0/null if not found +16760 # ensure that 'name' if in a register is the topmost variable in that register +16761 lookup-var-helper: # name: (addr slice), vars: (addr stack live-var), out: (addr handle var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +16762 # pseudocode: +16763 # var curr: (addr handle var) = &vars->data[vars->top - 12] +16764 # var min = vars->data +16765 # while curr >= min +16766 # var v: (handle var) = *curr +16767 # if v->name == name +16768 # return +16769 # curr -= 12 +16770 # +16771 # . prologue +16772 55/push-ebp +16773 89/<- %ebp 4/r32/esp +16774 # . save registers +16775 50/push-eax +16776 51/push-ecx +16777 52/push-edx +16778 53/push-ebx +16779 56/push-esi +16780 57/push-edi +16781 # clear out +16782 (zero-out *(ebp+0x10) *Handle-size) +16783 # esi = vars +16784 8b/-> *(ebp+0xc) 6/r32/esi +16785 # ebx = vars->top +16786 8b/-> *esi 3/r32/ebx +16787 # if (vars->top > vars->size) abort +16788 3b/compare<- *(esi+4) 0/r32/eax +16789 0f 8f/jump-if-> $lookup-var-helper:error1/disp32 +16790 # var min/edx: (addr handle var) = vars->data +16791 8d/copy-address *(esi+8) 2/r32/edx +16792 # var curr/ebx: (addr handle var) = &vars->data[vars->top - 12] +16793 8d/copy-address *(esi+ebx-4) 3/r32/ebx # vars + 8 + vars->type - 12 +16794 # var var-in-reg/edi: 16 addrs +16795 68/push 0/imm32 +16796 68/push 0/imm32 +16797 68/push 0/imm32 +16798 68/push 0/imm32 +16799 68/push 0/imm32 +16800 68/push 0/imm32 +16801 68/push 0/imm32 +16802 68/push 0/imm32 +16803 68/push 0/imm32 +16804 68/push 0/imm32 +16805 68/push 0/imm32 +16806 68/push 0/imm32 +16807 68/push 0/imm32 +16808 68/push 0/imm32 +16809 68/push 0/imm32 +16810 68/push 0/imm32 +16811 89/<- %edi 4/r32/esp +16812 { +16813 $lookup-var-helper:loop: +16814 # if (curr < min) return +16815 39/compare %ebx 2/r32/edx +16816 0f 82/jump-if-addr< break/disp32 +16817 # var v/ecx: (addr var) = lookup(*curr) +16818 (lookup *ebx *(ebx+4)) # => eax +16819 89/<- %ecx 0/r32/eax +16820 # var vn/eax: (addr array byte) = lookup(v->name) +16821 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +16822 # if (vn == name) return curr +16823 (slice-equal? *(ebp+8) %eax) # => eax +16824 3d/compare-eax-and 0/imm32/false +16825 { +16826 74/jump-if-= break/disp8 +16827 $lookup-var-helper:found: +16828 # var vr/eax: (addr array byte) = lookup(v->register) +16829 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax +16830 3d/compare-eax-and 0/imm32 +16831 { +16832 74/jump-if-= break/disp8 +16833 $lookup-var-helper:found-register: +16834 # var reg/eax: int = get(Registers, vr) +16835 (get Mu-registers-unique %eax 0xc "Mu-registers-unique") # => eax +16836 8b/-> *eax 0/r32/eax +16837 # if (var-in-reg[reg]) error +16838 8b/-> *(edi+eax<<2) 0/r32/eax +16839 3d/compare-eax-and 0/imm32 +16840 0f 85/jump-if-!= $lookup-var-helper:error2/disp32 +16841 } +16842 $lookup-var-helper:return: +16843 # esi = out +16844 8b/-> *(ebp+0x10) 6/r32/esi +16845 # *out = *curr +16846 8b/-> *ebx 0/r32/eax +16847 89/<- *esi 0/r32/eax +16848 8b/-> *(ebx+4) 0/r32/eax +16849 89/<- *(esi+4) 0/r32/eax +16850 # return +16851 eb/jump $lookup-var-helper:end/disp8 +16852 } +16853 # 'name' not yet found; update var-in-reg if v in register +16854 # . var vr/eax: (addr array byte) = lookup(v->register) +16855 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax +16856 # . if (vr == 0) continue +16857 3d/compare-eax-and 0/imm32 +16858 74/jump-if-= $lookup-var-helper:continue/disp8 +16859 # . var reg/eax: int = get(Registers, vr) +16860 (get Mu-registers-unique %eax 0xc "Mu-registers-unique") # => eax +16861 8b/-> *eax 0/r32/eax +16862 # . var-in-reg[reg] = v +16863 89/<- *(edi+eax<<2) 1/r32/ecx +16864 $lookup-var-helper:continue: +16865 # curr -= 12 +16866 81 5/subop/subtract %ebx 0xc/imm32 +16867 e9/jump loop/disp32 +16868 } +16869 $lookup-var-helper:end: +16870 # . reclaim locals +16871 81 0/subop/add %esp 0x40/imm32 +16872 # . restore registers +16873 5f/pop-to-edi +16874 5e/pop-to-esi +16875 5b/pop-to-ebx 16876 5a/pop-to-edx 16877 59/pop-to-ecx 16878 58/pop-to-eax @@ -15603,17036 +15563,17777 @@ if ('onhashchange' in window) { 16881 5d/pop-to-ebp 16882 c3/return 16883 -16884 new-literal: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) -16885 # . prologue -16886 55/push-ebp -16887 89/<- %ebp 4/r32/esp -16888 # . save registers -16889 50/push-eax -16890 51/push-ecx -16891 # var s/ecx: (handle array byte) -16892 68/push 0/imm32 -16893 68/push 0/imm32 -16894 89/<- %ecx 4/r32/esp -16895 # s = slice-to-string(name) -16896 (slice-to-string Heap *(ebp+0xc) %ecx) -16897 # allocate to out -16898 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) -16899 # var out-addr/ecx: (addr var) = lookup(*out) -16900 8b/-> *(ebp+0x10) 1/r32/ecx -16901 (lookup *ecx *(ecx+4)) # => eax -16902 89/<- %ecx 0/r32/eax -16903 # out-addr->block-depth = *Curr-block-depth -16904 8b/-> *Curr-block-depth 0/r32/eax -16905 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth -16906 # out-addr->type/eax = new type -16907 8d/copy-address *(ecx+8) 0/r32/eax # Var-type -16908 (allocate *(ebp+8) *Type-tree-size %eax) -16909 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -16910 # nothing else to do; default type is 'literal' -16911 c7 0/subop/copy *eax 1/imm32/true # Type-tree-is-atom -16912 $new-literal:end: -16913 # . reclaim locals -16914 81 0/subop/add %esp 8/imm32 -16915 # . restore registers -16916 59/pop-to-ecx -16917 58/pop-to-eax -16918 # . epilogue -16919 89/<- %esp 5/r32/ebp -16920 5d/pop-to-ebp -16921 c3/return -16922 -16923 new-var-from-slice: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) -16924 # . prologue -16925 55/push-ebp -16926 89/<- %ebp 4/r32/esp -16927 # . save registers -16928 51/push-ecx -16929 # var tmp/ecx: (handle array byte) -16930 68/push 0/imm32 -16931 68/push 0/imm32 -16932 89/<- %ecx 4/r32/esp -16933 # tmp = slice-to-string(name) -16934 (slice-to-string Heap *(ebp+0xc) %ecx) -16935 # out = new-var(tmp) -16936 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) -16937 $new-var-from-slice:end: -16938 # . reclaim locals -16939 81 0/subop/add %esp 8/imm32 -16940 # . restore registers -16941 59/pop-to-ecx -16942 # . epilogue -16943 89/<- %esp 5/r32/ebp -16944 5d/pop-to-ebp -16945 c3/return -16946 -16947 new-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) -16948 # . prologue -16949 55/push-ebp -16950 89/<- %ebp 4/r32/esp -16951 # . save registers -16952 50/push-eax -16953 51/push-ecx -16954 # -16955 (allocate *(ebp+8) *Stmt-size *(ebp+0x14)) -16956 # var out-addr/eax: (addr stmt) = lookup(*out) -16957 8b/-> *(ebp+0x14) 0/r32/eax -16958 (lookup *eax *(eax+4)) # => eax -16959 # out-addr->tag = stmt -16960 c7 0/subop/copy *eax 2/imm32/tag/var-on-stack # Stmt-tag -16961 # result->var = var -16962 8b/-> *(ebp+0xc) 1/r32/ecx -16963 89/<- *(eax+4) 1/r32/ecx # Vardef-var -16964 8b/-> *(ebp+0x10) 1/r32/ecx -16965 89/<- *(eax+8) 1/r32/ecx # Vardef-var -16966 $new-var-def:end: -16967 # . restore registers -16968 59/pop-to-ecx -16969 58/pop-to-eax -16970 # . epilogue -16971 89/<- %esp 5/r32/ebp -16972 5d/pop-to-ebp -16973 c3/return -16974 -16975 new-reg-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) -16976 # . prologue -16977 55/push-ebp -16978 89/<- %ebp 4/r32/esp -16979 # . save registers -16980 50/push-eax -16981 # eax = out -16982 8b/-> *(ebp+0x14) 0/r32/eax -16983 # -16984 (allocate *(ebp+8) *Stmt-size %eax) -16985 # var out-addr/eax: (addr stmt) = lookup(*out) -16986 (lookup *eax *(eax+4)) # => eax -16987 # set tag -16988 c7 0/subop/copy *eax 3/imm32/tag/var-in-register # Stmt-tag -16989 # set output -16990 8d/copy-address *(eax+0x14) 0/r32/eax # Regvardef-outputs -16991 (append-stmt-var Heap *(ebp+0xc) *(ebp+0x10) 0 0 0 %eax) -16992 $new-reg-var-def:end: -16993 # . restore registers -16994 58/pop-to-eax -16995 # . epilogue -16996 89/<- %esp 5/r32/ebp -16997 5d/pop-to-ebp -16998 c3/return -16999 -17000 append-list: # ad: (addr allocation-descriptor), value: (handle _type), list: (handle list _type), out: (addr handle list _type) -17001 # . prologue -17002 55/push-ebp -17003 89/<- %ebp 4/r32/esp -17004 # . save registers -17005 50/push-eax -17006 51/push-ecx -17007 57/push-edi -17008 # edi = out -17009 8b/-> *(ebp+0x1c) 7/r32/edi -17010 # *out = new list -17011 (allocate *(ebp+8) *List-size %edi) -17012 # var out-addr/edi: (addr list _type) = lookup(*out) -17013 (lookup *edi *(edi+4)) # => eax -17014 89/<- %edi 0/r32/eax -17015 # out-addr->value = value -17016 8b/-> *(ebp+0xc) 0/r32/eax -17017 89/<- *edi 0/r32/eax # List-value -17018 8b/-> *(ebp+0x10) 0/r32/eax -17019 89/<- *(edi+4) 0/r32/eax # List-value -17020 # if (list == null) return -17021 81 7/subop/compare *(ebp+0x14) 0/imm32 -17022 74/jump-if-= $append-list:end/disp8 -17023 # otherwise append -17024 $append-list:non-empty-list: -17025 # var curr/eax: (addr list _type) = lookup(list) -17026 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax -17027 # while (curr->next != null) curr = curr->next -17028 { -17029 81 7/subop/compare *(eax+8) 0/imm32 # List-next -17030 74/jump-if-= break/disp8 -17031 # curr = lookup(curr->next) -17032 (lookup *(eax+8) *(eax+0xc)) # List-next, List-next => eax -17033 # -17034 eb/jump loop/disp8 -17035 } -17036 # edi = out -17037 8b/-> *(ebp+0x1c) 7/r32/edi -17038 # curr->next = out -17039 8b/-> *edi 1/r32/ecx -17040 89/<- *(eax+8) 1/r32/ecx # List-next -17041 8b/-> *(edi+4) 1/r32/ecx -17042 89/<- *(eax+0xc) 1/r32/ecx # List-next -17043 # out = list -17044 8b/-> *(ebp+0x14) 1/r32/ecx -17045 89/<- *edi 1/r32/ecx -17046 8b/-> *(ebp+0x18) 1/r32/ecx -17047 89/<- *(edi+4) 1/r32/ecx -17048 $append-list:end: -17049 # . restore registers -17050 5f/pop-to-edi -17051 59/pop-to-ecx -17052 58/pop-to-eax -17053 # . epilogue -17054 89/<- %esp 5/r32/ebp -17055 5d/pop-to-ebp -17056 c3/return -17057 -17058 append-stmt-var: # ad: (addr allocation-descriptor), v: (handle var), vars: (handle stmt-var), is-deref?: boolean, out: (addr handle stmt-var) -17059 # . prologue -17060 55/push-ebp -17061 89/<- %ebp 4/r32/esp -17062 # . save registers -17063 50/push-eax -17064 51/push-ecx -17065 57/push-edi -17066 # edi = out -17067 8b/-> *(ebp+0x20) 7/r32/edi -17068 # out = new stmt-var -17069 (allocate *(ebp+8) *Stmt-var-size %edi) -17070 # var out-addr/ecx: (addr stmt-var) = lookup(*out) -17071 (lookup *edi *(edi+4)) # => eax -17072 89/<- %ecx 0/r32/eax -17073 # out-addr->value = v -17074 8b/-> *(ebp+0xc) 0/r32/eax -17075 89/<- *ecx 0/r32/eax # Stmt-var-value -17076 8b/-> *(ebp+0x10) 0/r32/eax -17077 89/<- *(ecx+4) 0/r32/eax # Stmt-var-value -17078 # out-addr->is-deref? = is-deref? -17079 8b/-> *(ebp+0x1c) 0/r32/eax -17080 89/<- *(ecx+0x10) 0/r32/eax # Stmt-var-is-deref -17081 # if (vars == null) return result -17082 81 7/subop/compare *(ebp+0x14) 0/imm32/null -17083 74/jump-if-= $append-stmt-var:end/disp8 -17084 # otherwise append -17085 # var curr/eax: (addr stmt-var) = lookup(vars) -17086 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax -17087 # while (curr->next != null) curr = curr->next -17088 { -17089 81 7/subop/compare *(eax+8) 0/imm32 # Stmt-var-next -17090 74/jump-if-= break/disp8 -17091 # curr = lookup(curr->next) -17092 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next, Stmt-var-next => eax -17093 # -17094 eb/jump loop/disp8 -17095 } -17096 # curr->next = out -17097 8b/-> *edi 1/r32/ecx -17098 89/<- *(eax+8) 1/r32/ecx # Stmt-var-next -17099 8b/-> *(edi+4) 1/r32/ecx -17100 89/<- *(eax+0xc) 1/r32/ecx # Stmt-var-next -17101 # out = vars -17102 8b/-> *(ebp+0x14) 1/r32/ecx -17103 89/<- *edi 1/r32/ecx -17104 8b/-> *(ebp+0x18) 1/r32/ecx -17105 89/<- *(edi+4) 1/r32/ecx -17106 $append-stmt-var:end: -17107 # . restore registers -17108 5f/pop-to-edi -17109 59/pop-to-ecx -17110 58/pop-to-eax -17111 # . epilogue -17112 89/<- %esp 5/r32/ebp -17113 5d/pop-to-ebp -17114 c3/return -17115 -17116 append-to-block: # ad: (addr allocation-descriptor), block: (addr block), x: (handle stmt) -17117 # . prologue -17118 55/push-ebp -17119 89/<- %ebp 4/r32/esp -17120 # . save registers -17121 50/push-eax -17122 56/push-esi -17123 # esi = block -17124 8b/-> *(ebp+0xc) 6/r32/esi -17125 # block->stmts = append(x, block->stmts) -17126 8d/copy-address *(esi+4) 0/r32/eax # Block-stmts -17127 (append-list *(ebp+8) *(ebp+0x10) *(ebp+0x14) *(esi+4) *(esi+8) %eax) # ad, x, x, Block-stmts, Block-stmts -17128 $append-to-block:end: -17129 # . restore registers -17130 5e/pop-to-esi -17131 58/pop-to-eax -17132 # . epilogue -17133 89/<- %esp 5/r32/ebp -17134 5d/pop-to-ebp -17135 c3/return -17136 -17137 ## Parsing types -17138 # We need to create metadata on user-defined types, and we need to use this -17139 # metadata as we parse instructions. -17140 # However, we also want to allow types to be used before their definitions. -17141 # This means we can't ever assume any type data structures exist. -17142 -17143 lookup-or-create-constant: # container: (addr stmt-var), field-name: (addr slice), out: (addr handle var) -17144 # . prologue -17145 55/push-ebp -17146 89/<- %ebp 4/r32/esp -17147 # . save registers -17148 50/push-eax -17149 56/push-esi -17150 # var container-type/esi: type-id -17151 (container-type *(ebp+8)) # => eax -17152 89/<- %esi 0/r32/eax -17153 # var tmp/eax: (handle typeinfo) = find-or-create-typeinfo(container-type) -17154 68/push 0/imm32 -17155 68/push 0/imm32 -17156 89/<- %eax 4/r32/esp -17157 (find-or-create-typeinfo %esi %eax) -17158 # var tmp-addr/eax: (addr typeinfo) = lookup(tmp) -17159 (lookup *eax *(eax+4)) # => eax -17160 # result = find-or-create-typeinfo-output-var(typeinfo, field-name) -17161 #? (write-buffered Stderr "constant: ") -17162 #? (write-slice-buffered Stderr *(ebp+0xc)) -17163 #? (write-buffered Stderr Newline) -17164 #? (flush Stderr) -17165 (find-or-create-typeinfo-output-var %eax *(ebp+0xc) *(ebp+0x10)) -17166 #? 8b/-> *(ebp+0x10) 0/r32/eax -17167 #? (write-buffered Stderr "@") -17168 #? (lookup *eax *(eax+4)) -17169 #? (write-int32-hex-buffered Stderr %eax) -17170 #? (lookup *eax *(eax+4)) -17171 #? (write-buffered Stderr %eax) -17172 #? (write-buffered Stderr Newline) -17173 #? (flush Stderr) -17174 #? (write-buffered Stderr "offset: ") -17175 #? 8b/-> *(eax+0x14) 0/r32/eax -17176 #? (write-int32-hex-buffered Stderr %eax) -17177 #? (write-buffered Stderr Newline) -17178 #? (flush Stderr) -17179 $lookup-or-create-constant:end: -17180 # . reclaim locals -17181 81 0/subop/add %esp 8/imm32 -17182 # . restore registers -17183 5e/pop-to-esi -17184 58/pop-to-eax -17185 # . epilogue -17186 89/<- %esp 5/r32/ebp -17187 5d/pop-to-ebp -17188 c3/return -17189 -17190 # if addr var: -17191 # container->var->type->right->left->value -17192 # otherwise -17193 # container->var->type->value -17194 container-type: # container: (addr stmt-var) -> result/eax: type-id -17195 # . prologue -17196 55/push-ebp -17197 89/<- %ebp 4/r32/esp -17198 # -17199 8b/-> *(ebp+8) 0/r32/eax -17200 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -17201 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -17202 { -17203 81 7/subop/compare *(eax+8) 0/imm32 # Type-tree-right -17204 74/jump-if-= break/disp8 -17205 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -17206 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -17207 } -17208 8b/-> *(eax+4) 0/r32/eax # Type-tree-value -17209 $container-type:end: -17210 # . epilogue -17211 89/<- %esp 5/r32/ebp -17212 5d/pop-to-ebp -17213 c3/return -17214 -17215 is-container?: # t: type-id -> result/eax: boolean -17216 # . prologue -17217 55/push-ebp -17218 89/<- %ebp 4/r32/esp -17219 # -17220 8b/-> *(ebp+8) 0/r32/eax -17221 c1/shift 4/subop/left %eax 2/imm8 -17222 3b/compare 0/r32/eax *Primitive-type-ids -17223 0f 9d/set-if->= %al -17224 81 4/subop/and %eax 0xff/imm32 -17225 $is-container?:end: -17226 # . epilogue -17227 89/<- %esp 5/r32/ebp -17228 5d/pop-to-ebp -17229 c3/return -17230 -17231 find-or-create-typeinfo: # t: type-id, out: (addr handle typeinfo) -17232 # . prologue -17233 55/push-ebp -17234 89/<- %ebp 4/r32/esp -17235 # . save registers -17236 50/push-eax -17237 51/push-ecx -17238 52/push-edx -17239 57/push-edi -17240 # edi = out -17241 8b/-> *(ebp+0xc) 7/r32/edi -17242 # var fields/ecx: (handle table (handle array byte) (handle typeinfo-entry)) -17243 68/push 0/imm32 -17244 68/push 0/imm32 -17245 89/<- %ecx 4/r32/esp -17246 # find-typeinfo(t, out) -17247 (find-typeinfo *(ebp+8) %edi) -17248 { -17249 # if (*out != 0) break -17250 81 7/subop/compare *edi 0/imm32 -17251 0f 85/jump-if-!= break/disp32 -17252 $find-or-create-typeinfo:create: -17253 # *out = allocate -17254 (allocate Heap *Typeinfo-size %edi) -17255 # var tmp/eax: (addr typeinfo) = lookup(*out) -17256 (lookup *edi *(edi+4)) # => eax -17257 #? (write-buffered Stderr "created typeinfo at ") -17258 #? (write-int32-hex-buffered Stderr %eax) -17259 #? (write-buffered Stderr " for type-id ") -17260 #? (write-int32-hex-buffered Stderr *(ebp+8)) -17261 #? (write-buffered Stderr Newline) -17262 #? (flush Stderr) -17263 # tmp->id = t -17264 8b/-> *(ebp+8) 2/r32/edx -17265 89/<- *eax 2/r32/edx # Typeinfo-id -17266 # tmp->fields = new table -17267 # . fields = new table -17268 (new-stream Heap 0x40 *Typeinfo-fields-row-size %ecx) -17269 # . tmp->fields = fields -17270 8b/-> *ecx 2/r32/edx -17271 89/<- *(eax+4) 2/r32/edx # Typeinfo-fields -17272 8b/-> *(ecx+4) 2/r32/edx -17273 89/<- *(eax+8) 2/r32/edx # Typeinfo-fields -17274 # tmp->next = Program->types -17275 8b/-> *_Program-types 1/r32/ecx -17276 89/<- *(eax+0x10) 1/r32/ecx # Typeinfo-next -17277 8b/-> *_Program-types->payload 1/r32/ecx -17278 89/<- *(eax+0x14) 1/r32/ecx # Typeinfo-next -17279 # Program->types = out -17280 8b/-> *edi 1/r32/ecx -17281 89/<- *_Program-types 1/r32/ecx -17282 8b/-> *(edi+4) 1/r32/ecx -17283 89/<- *_Program-types->payload 1/r32/ecx -17284 } -17285 $find-or-create-typeinfo:end: -17286 # . reclaim locals -17287 81 0/subop/add %esp 8/imm32 -17288 # . restore registers -17289 5f/pop-to-edi -17290 5a/pop-to-edx -17291 59/pop-to-ecx -17292 58/pop-to-eax -17293 # . epilogue -17294 89/<- %esp 5/r32/ebp -17295 5d/pop-to-ebp -17296 c3/return -17297 -17298 find-typeinfo: # t: type-id, out: (addr handle typeinfo) -17299 # . prologue -17300 55/push-ebp -17301 89/<- %ebp 4/r32/esp -17302 # . save registers -17303 50/push-eax -17304 51/push-ecx -17305 52/push-edx -17306 57/push-edi -17307 # ecx = t -17308 8b/-> *(ebp+8) 1/r32/ecx -17309 # edi = out -17310 8b/-> *(ebp+0xc) 7/r32/edi -17311 # *out = Program->types -17312 8b/-> *_Program-types 0/r32/eax -17313 89/<- *edi 0/r32/eax -17314 8b/-> *_Program-types->payload 0/r32/eax -17315 89/<- *(edi+4) 0/r32/eax -17316 { -17317 $find-typeinfo:loop: -17318 # if (*out == 0) break -17319 81 7/subop/compare *edi 0/imm32 -17320 74/jump-if-= break/disp8 -17321 $find-typeinfo:check: -17322 # var tmp/eax: (addr typeinfo) = lookup(*out) -17323 (lookup *edi *(edi+4)) # => eax -17324 # if (tmp->id == t) break -17325 39/compare *eax 1/r32/ecx # Typeinfo-id -17326 74/jump-if-= break/disp8 -17327 $find-typeinfo:continue: -17328 # *out = tmp->next -17329 8b/-> *(eax+0x10) 2/r32/edx # Typeinfo-next -17330 89/<- *edi 2/r32/edx -17331 8b/-> *(eax+0x14) 2/r32/edx # Typeinfo-next -17332 89/<- *(edi+4) 2/r32/edx -17333 # -17334 eb/jump loop/disp8 -17335 } -17336 $find-typeinfo:end: -17337 # . restore registers -17338 5f/pop-to-edi -17339 5a/pop-to-edx -17340 59/pop-to-ecx -17341 58/pop-to-eax -17342 # . epilogue -17343 89/<- %esp 5/r32/ebp -17344 5d/pop-to-ebp -17345 c3/return -17346 -17347 find-or-create-typeinfo-output-var: # T: (addr typeinfo), f: (addr slice), out: (addr handle var) -17348 # . prologue -17349 55/push-ebp -17350 89/<- %ebp 4/r32/esp -17351 # . save registers -17352 50/push-eax -17353 52/push-edx -17354 57/push-edi -17355 # var dest/edi: (handle typeinfo-entry) -17356 68/push 0/imm32 -17357 68/push 0/imm32 -17358 89/<- %edi 4/r32/esp -17359 # find-or-create-typeinfo-fields(T, f, dest) -17360 (find-or-create-typeinfo-fields *(ebp+8) *(ebp+0xc) %edi) -17361 # var dest-addr/edi: (addr typeinfo-entry) = lookup(dest) -17362 (lookup *edi *(edi+4)) # => eax -17363 89/<- %edi 0/r32/eax -17364 # if dest-addr->output-var doesn't exist, create it -17365 { -17366 81 7/subop/compare *(edi+0xc) 0/imm32 # Typeinfo-entry-output-var -17367 0f 85/jump-if-!= break/disp32 -17368 # dest-addr->output-var = new var(dummy name, type, -1 offset) -17369 # . var name/eax: (handle array byte) = "field" -17370 68/push 0/imm32 -17371 68/push 0/imm32 -17372 89/<- %eax 4/r32/esp -17373 (slice-to-string Heap *(ebp+0xc) %eax) -17374 # . new var -17375 8d/copy-address *(edi+0xc) 2/r32/edx -17376 (new-var Heap *eax *(eax+4) %edx) -17377 # . reclaim name -17378 81 0/subop/add %esp 8/imm32 -17379 # var result/edx: (addr var) = lookup(dest-addr->output-var) -17380 (lookup *(edi+0xc) *(edi+0x10)) # => eax -17381 89/<- %edx 0/r32/eax -17382 # result->type = new constant type -17383 8d/copy-address *(edx+8) 0/r32/eax # Var-type -17384 (allocate Heap *Type-tree-size %eax) -17385 (lookup *(edx+8) *(edx+0xc)) # => eax -17386 c7 0/subop/copy *eax 1/imm32/true # Type-tree-is-atom -17387 c7 0/subop/copy *(eax+4) 6/imm32/constant # Type-tree-value -17388 c7 0/subop/copy *(eax+8) 0/imm32 # Type-tree-left -17389 c7 0/subop/copy *(eax+0xc) 0/imm32 # Type-tree-right -17390 c7 0/subop/copy *(eax+0x10) 0/imm32 # Type-tree-right -17391 # result->offset isn't filled out yet -17392 c7 0/subop/copy *(edx+0x14) -1/imm32/uninitialized # Var-offset -17393 } -17394 # out = dest-addr->output-var -17395 8b/-> *(ebp+0x10) 2/r32/edx -17396 8b/-> *(edi+0xc) 0/r32/eax # Typeinfo-entry-output-var -17397 89/<- *edx 0/r32/eax -17398 8b/-> *(edi+0x10) 0/r32/eax # Typeinfo-entry-output-var -17399 89/<- *(edx+4) 0/r32/eax -17400 $find-or-create-typeinfo-output-var:end: -17401 # . reclaim locals -17402 81 0/subop/add %esp 8/imm32 -17403 # . restore registers -17404 5f/pop-to-edi -17405 5a/pop-to-edx -17406 58/pop-to-eax -17407 # . epilogue -17408 89/<- %esp 5/r32/ebp -17409 5d/pop-to-ebp -17410 c3/return -17411 -17412 find-or-create-typeinfo-fields: # T: (addr typeinfo), f: (addr slice), out: (addr handle typeinfo-entry) -17413 # . prologue -17414 55/push-ebp -17415 89/<- %ebp 4/r32/esp -17416 # . save registers -17417 50/push-eax -17418 56/push-esi -17419 57/push-edi -17420 # eax = lookup(T->fields) -17421 8b/-> *(ebp+8) 0/r32/eax -17422 (lookup *(eax+4) *(eax+8)) # Typeinfo-fields Typeinfo-fields => eax -17423 # edi = out -17424 8b/-> *(ebp+0x10) 7/r32/edi -17425 # var src/esi: (addr handle typeinfo-entry) = get-or-insert-slice(T->fields, f) -17426 (get-or-insert-slice %eax *(ebp+0xc) *Typeinfo-fields-row-size Heap) # => eax -17427 89/<- %esi 0/r32/eax -17428 # if src doesn't exist, allocate it -17429 { -17430 81 7/subop/compare *esi 0/imm32 -17431 75/jump-if-!= break/disp8 -17432 (allocate Heap *Typeinfo-entry-size %esi) -17433 #? (write-buffered Stderr "handle at ") -17434 #? (write-int32-hex-buffered Stderr %esi) -17435 #? (write-buffered Stderr ": ") -17436 #? (write-int32-hex-buffered Stderr *esi) -17437 #? (write-buffered Stderr " ") -17438 #? (write-int32-hex-buffered Stderr *(esi+4)) -17439 #? (write-buffered Stderr Newline) -17440 #? (flush Stderr) -17441 #? (lookup *esi *(esi+4)) -17442 #? (write-buffered Stderr "created typeinfo fields at ") -17443 #? (write-int32-hex-buffered Stderr %esi) -17444 #? (write-buffered Stderr " for ") -17445 #? (write-int32-hex-buffered Stderr *(ebp+8)) -17446 #? (write-buffered Stderr Newline) -17447 #? (flush Stderr) -17448 } -17449 # *out = src -17450 # . *edi = *src -17451 8b/-> *esi 0/r32/eax -17452 89/<- *edi 0/r32/eax -17453 8b/-> *(esi+4) 0/r32/eax -17454 89/<- *(edi+4) 0/r32/eax -17455 $find-or-create-typeinfo-fields:end: -17456 # . restore registers -17457 5f/pop-to-edi -17458 5e/pop-to-esi -17459 58/pop-to-eax -17460 # . epilogue -17461 89/<- %esp 5/r32/ebp -17462 5d/pop-to-ebp -17463 c3/return -17464 -17465 populate-mu-type: # in: (addr stream byte), t: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) -17466 # pseudocode: -17467 # var line: (stream byte 512) -17468 # curr-index = 0 -17469 # while true -17470 # clear-stream(line) -17471 # read-line-buffered(in, line) -17472 # if line->write == 0 -17473 # abort -17474 # word-slice = next-mu-token(line) -17475 # if slice-empty?(word-slice) # end of line -17476 # continue -17477 # if slice-equal?(word-slice, "}") -17478 # break -17479 # var v: (handle var) = parse-var-with-type(word-slice, line) -17480 # var r: (handle typeinfo-fields) = find-or-create-typeinfo-fields(t, word-slice/v->name) -17481 # TODO: ensure that r->first is null -17482 # r->index = curr-index -17483 # curr-index++ -17484 # r->input-var = v -17485 # if r->output-var == 0 -17486 # r->output-var = new literal -17487 # TODO: ensure nothing else in line -17488 # t->total-size-in-bytes = -2 (not yet initialized) -17489 # -17490 # . prologue -17491 55/push-ebp -17492 89/<- %ebp 4/r32/esp -17493 # var curr-index: int at *(ebp-4) -17494 68/push 0/imm32 -17495 # . save registers -17496 50/push-eax -17497 51/push-ecx -17498 52/push-edx -17499 53/push-ebx -17500 56/push-esi -17501 57/push-edi -17502 # edi = t -17503 8b/-> *(ebp+0xc) 7/r32/edi -17504 # var line/ecx: (stream byte 512) -17505 81 5/subop/subtract %esp 0x200/imm32 -17506 68/push 0x200/imm32/size -17507 68/push 0/imm32/read -17508 68/push 0/imm32/write -17509 89/<- %ecx 4/r32/esp -17510 # var word-slice/edx: slice -17511 68/push 0/imm32/end -17512 68/push 0/imm32/start -17513 89/<- %edx 4/r32/esp -17514 # var v/esi: (handle var) -17515 68/push 0/imm32 -17516 68/push 0/imm32 -17517 89/<- %esi 4/r32/esp -17518 # var r/ebx: (handle typeinfo-entry) -17519 68/push 0/imm32 -17520 68/push 0/imm32 -17521 89/<- %ebx 4/r32/esp -17522 { -17523 $populate-mu-type:line-loop: -17524 (clear-stream %ecx) -17525 (read-line-buffered *(ebp+8) %ecx) -17526 # if (line->write == 0) abort -17527 81 7/subop/compare *ecx 0/imm32 -17528 0f 84/jump-if-= $populate-mu-type:error1/disp32 -17529 +-- 6 lines: #? # dump line ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -17535 (next-mu-token %ecx %edx) -17536 # if slice-empty?(word-slice) continue -17537 (slice-empty? %edx) # => eax -17538 3d/compare-eax-and 0/imm32 -17539 0f 85/jump-if-!= loop/disp32 -17540 # if slice-equal?(word-slice, "}") break -17541 (slice-equal? %edx "}") -17542 3d/compare-eax-and 0/imm32 -17543 0f 85/jump-if-!= break/disp32 -17544 $populate-mu-type:parse-element: -17545 # v = parse-var-with-type(word-slice, first-line) -17546 # must do this first to strip the trailing ':' from word-slice before -17547 # using it in find-or-create-typeinfo-fields below -17548 # TODO: clean up that mutation in parse-var-with-type -17549 (parse-var-with-type %edx %ecx %esi *(ebp+0x10) *(ebp+0x14)) -17550 # if v is an addr, abort -17551 (lookup *esi *(esi+4)) # => eax -17552 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -17553 (is-mu-addr-type? %eax) # => eax -17554 3d/compare-eax-and 0/imm32/false -17555 0f 85/jump-if-!= $populate-mu-type:error2/disp32 -17556 # if v is an array, abort (we could support it, but initialization gets complex) -17557 (lookup *esi *(esi+4)) # => eax -17558 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -17559 (is-mu-array-type? %eax) # => eax -17560 3d/compare-eax-and 0/imm32/false -17561 0f 85/jump-if-!= $populate-mu-type:error3/disp32 -17562 # if v is a byte, abort -17563 (lookup *esi *(esi+4)) # => eax -17564 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -17565 (is-simple-mu-type? %eax 8) # byte => eax -17566 3d/compare-eax-and 0/imm32/false -17567 0f 85/jump-if-!= $populate-mu-type:error4/disp32 -17568 # if v is a slice, abort -17569 (lookup *esi *(esi+4)) # => eax -17570 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -17571 (is-simple-mu-type? %eax 0xc) # slice => eax -17572 3d/compare-eax-and 0/imm32/false -17573 0f 85/jump-if-!= $populate-mu-type:error5/disp32 -17574 # if v is a stream, abort (we could support it, but initialization gets even more complex) -17575 (lookup *esi *(esi+4)) # => eax -17576 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -17577 (is-mu-stream-type? %eax) # => eax -17578 3d/compare-eax-and 0/imm32/false -17579 0f 85/jump-if-!= $populate-mu-type:error6/disp32 -17580 # var tmp/ecx -17581 51/push-ecx -17582 $populate-mu-type:create-typeinfo-fields: -17583 # var r/ebx: (handle typeinfo-entry) -17584 (find-or-create-typeinfo-fields %edi %edx %ebx) -17585 # r->index = curr-index -17586 (lookup *ebx *(ebx+4)) # => eax -17587 8b/-> *(ebp-4) 1/r32/ecx -17588 #? (write-buffered Stderr "saving index ") -17589 #? (write-int32-hex-buffered Stderr %ecx) -17590 #? (write-buffered Stderr " at ") -17591 #? (write-int32-hex-buffered Stderr %edi) -17592 #? (write-buffered Stderr Newline) -17593 #? (flush Stderr) -17594 89/<- *(eax+8) 1/r32/ecx # Typeinfo-entry-index -17595 # ++curr-index -17596 ff 0/subop/increment *(ebp-4) -17597 $populate-mu-type:set-input-type: -17598 # r->input-var = v -17599 8b/-> *esi 1/r32/ecx -17600 89/<- *eax 1/r32/ecx # Typeinfo-entry-input-var -17601 8b/-> *(esi+4) 1/r32/ecx -17602 89/<- *(eax+4) 1/r32/ecx # Typeinfo-entry-input-var -17603 # restore line -17604 59/pop-to-ecx -17605 { -17606 $populate-mu-type:create-output-type: -17607 # if (r->output-var == 0) create a new var with some placeholder data -17608 81 7/subop/compare *(eax+0xc) 0/imm32 # Typeinfo-entry-output-var -17609 75/jump-if-!= break/disp8 -17610 8d/copy-address *(eax+0xc) 0/r32/eax # Typeinfo-entry-output-var -17611 (new-literal Heap %edx %eax) -17612 } -17613 e9/jump loop/disp32 -17614 } -17615 $populate-mu-type:invalidate-total-size-in-bytes: -17616 # Offsets and total size may not be accurate here since we may not yet -17617 # have encountered the element types. -17618 # We'll recompute them separately after parsing the entire program. -17619 c7 0/subop/copy *(edi+0xc) -2/imm32/uninitialized # Typeinfo-total-size-in-bytes -17620 $populate-mu-type:end: -17621 # . reclaim locals -17622 81 0/subop/add %esp 0x224/imm32 -17623 # . restore registers -17624 5f/pop-to-edi -17625 5e/pop-to-esi -17626 5b/pop-to-ebx -17627 5a/pop-to-edx -17628 59/pop-to-ecx -17629 58/pop-to-eax -17630 # reclaim curr-index -17631 81 0/subop/add %esp 4/imm32 -17632 # . epilogue -17633 89/<- %esp 5/r32/ebp -17634 5d/pop-to-ebp -17635 c3/return -17636 -17637 $populate-mu-type:error1: -17638 # error("incomplete type definition '" t->name "'\n") -17639 (write-buffered *(ebp+0x10) "incomplete type definition '") -17640 (type-name *edi) # Typeinfo-id => eax -17641 (write-buffered *(ebp+0x10) %eax) -17642 (write-buffered *(ebp+0x10) "\n") -17643 (flush *(ebp+0x10)) -17644 (stop *(ebp+0x14) 1) -17645 # never gets here -17646 -17647 $populate-mu-type:error2: -17648 (write-buffered *(ebp+0x10) "type ") -17649 (type-name *edi) # Typeinfo-id => eax -17650 (write-buffered *(ebp+0x10) %eax) -17651 (write-buffered *(ebp+0x10) ": 'addr' elements not allowed\n") -17652 (flush *(ebp+0x10)) -17653 (stop *(ebp+0x14) 1) -17654 # never gets here -17655 -17656 $populate-mu-type:error3: -17657 (write-buffered *(ebp+0x10) "type ") -17658 (type-name *edi) # Typeinfo-id => eax -17659 (write-buffered *(ebp+0x10) %eax) -17660 (write-buffered *(ebp+0x10) ": 'array' elements not allowed for now\n") -17661 (flush *(ebp+0x10)) -17662 (stop *(ebp+0x14) 1) -17663 # never gets here -17664 -17665 $populate-mu-type:error4: -17666 (write-buffered *(ebp+0x10) "type ") -17667 (type-name *edi) # Typeinfo-id => eax -17668 (write-buffered *(ebp+0x10) %eax) -17669 (write-buffered *(ebp+0x10) ": 'byte' elements not allowed\n") -17670 (flush *(ebp+0x10)) -17671 (stop *(ebp+0x14) 1) -17672 # never gets here -17673 -17674 $populate-mu-type:error5: -17675 (write-buffered *(ebp+0x10) "type ") -17676 (type-name *edi) # Typeinfo-id => eax -17677 (write-buffered *(ebp+0x10) %eax) -17678 (write-buffered *(ebp+0x10) ": 'slice' elements not allowed\n") -17679 (flush *(ebp+0x10)) -17680 (stop *(ebp+0x14) 1) -17681 # never gets here -17682 -17683 $populate-mu-type:error6: -17684 (write-buffered *(ebp+0x10) "type ") -17685 (type-name *edi) # Typeinfo-id => eax -17686 (write-buffered *(ebp+0x10) %eax) -17687 (write-buffered *(ebp+0x10) ": 'stream' elements not allowed for now\n") -17688 (flush *(ebp+0x10)) -17689 (stop *(ebp+0x14) 1) -17690 # never gets here -17691 -17692 type-name: # index: int -> result/eax: (addr array byte) -17693 # . prologue -17694 55/push-ebp -17695 89/<- %ebp 4/r32/esp -17696 # -17697 (index Type-id *(ebp+8)) -17698 $type-name:end: -17699 # . epilogue -17700 89/<- %esp 5/r32/ebp -17701 5d/pop-to-ebp -17702 c3/return -17703 -17704 index: # arr: (addr stream (handle array byte)), index: int -> result/eax: (addr array byte) -17705 # . prologue -17706 55/push-ebp -17707 89/<- %ebp 4/r32/esp -17708 # . save registers -17709 56/push-esi -17710 # TODO: bounds-check index -17711 # esi = arr -17712 8b/-> *(ebp+8) 6/r32/esi -17713 # eax = index -17714 8b/-> *(ebp+0xc) 0/r32/eax -17715 # eax = *(arr + 12 + index) -17716 8b/-> *(esi+eax<<2+0xc) 0/r32/eax -17717 $index:end: -17718 # . restore registers -17719 5e/pop-to-esi -17720 # . epilogue -17721 89/<- %esp 5/r32/ebp -17722 5d/pop-to-ebp -17723 c3/return -17724 -17725 ####################################################### -17726 # Compute type sizes -17727 ####################################################### -17728 -17729 # Compute the sizes of all user-defined types. -17730 # We'll need the sizes of their elements, which may be other user-defined -17731 # types, which we will compute as needed. -17732 -17733 # Initially, all user-defined types have their sizes set to -2 (invalid) -17734 populate-mu-type-sizes: # err: (addr buffered-file), ed: (addr exit-descriptor) -17735 # . prologue -17736 55/push-ebp -17737 89/<- %ebp 4/r32/esp -17738 $populate-mu-type-sizes:total-sizes: -17739 # var curr/eax: (addr typeinfo) = lookup(Program->types) -17740 (lookup *_Program-types *_Program-types->payload) # => eax -17741 { -17742 # if (curr == null) break -17743 3d/compare-eax-and 0/imm32/null -17744 74/jump-if-= break/disp8 -17745 (populate-mu-type-sizes-in-type %eax *(ebp+8) *(ebp+0xc)) -17746 # curr = lookup(curr->next) -17747 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax -17748 eb/jump loop/disp8 -17749 } -17750 $populate-mu-type-sizes:offsets: -17751 # curr = *Program->types -17752 (lookup *_Program-types *_Program-types->payload) # => eax -17753 { -17754 # if (curr == null) break -17755 3d/compare-eax-and 0/imm32/null -17756 74/jump-if-= break/disp8 -17757 (populate-mu-type-offsets %eax *(ebp+8) *(ebp+0xc)) -17758 # curr = curr->next -17759 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax -17760 eb/jump loop/disp8 -17761 } -17762 $populate-mu-type-sizes:end: -17763 # . epilogue -17764 89/<- %esp 5/r32/ebp -17765 5d/pop-to-ebp -17766 c3/return -17767 -17768 # compute sizes of all fields, recursing as necessary -17769 # sum up all their sizes to arrive at total size -17770 # fields may be out of order, but that doesn't affect the answer -17771 populate-mu-type-sizes-in-type: # T: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) -17772 # . prologue -17773 55/push-ebp -17774 89/<- %ebp 4/r32/esp -17775 # . save registers -17776 50/push-eax -17777 51/push-ecx -17778 52/push-edx -17779 56/push-esi -17780 57/push-edi -17781 # esi = T -17782 8b/-> *(ebp+8) 6/r32/esi -17783 # if T is already computed, return -17784 81 7/subop/compare *(esi+0xc) 0/imm32 # Typeinfo-total-size-in-bytes -17785 0f 8d/jump-if->= $populate-mu-type-sizes-in-type:end/disp32 -17786 # if T is being computed, abort -17787 81 7/subop/compare *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes -17788 0f 84/jump-if-= $populate-mu-type-sizes-in-type:abort/disp32 -17789 # tag T (-2 to -1) to avoid infinite recursion -17790 c7 0/subop/copy *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes -17791 # var total-size/edi: int = 0 -17792 bf/copy-to-edi 0/imm32 -17793 # - for every field, if it's a user-defined type, compute its size -17794 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) -17795 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax -17796 89/<- %ecx 0/r32/eax -17797 # var table-size/edx: int = table->write -17798 8b/-> *ecx 2/r32/edx # stream-write -17799 # var curr/ecx: (addr table_row) = table->data -17800 8d/copy-address *(ecx+0xc) 1/r32/ecx -17801 # var max/edx: (addr table_row) = table->data + table->write -17802 8d/copy-address *(ecx+edx) 2/r32/edx -17803 { -17804 $populate-mu-type-sizes-in-type:loop: -17805 # if (curr >= max) break -17806 39/compare %ecx 2/r32/edx -17807 73/jump-if-addr>= break/disp8 -17808 # var t/eax: (addr typeinfo-entry) = lookup(curr->value) -17809 (lookup *(ecx+8) *(ecx+0xc)) # => eax -17810 # if (t->input-var == 0) silently ignore it; we'll emit a nice error message while type-checking -17811 81 7/subop/compare *eax 0/imm32 # Typeinfo-entry-input-var -17812 74/jump-if-= $populate-mu-type-sizes-in-type:end/disp8 -17813 # compute size of t->input-var -17814 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax -17815 (compute-size-of-var %eax *(ebp+0xc) *(ebp+0x10)) # => eax -17816 # result += eax -17817 01/add-to %edi 0/r32/eax -17818 # curr += row-size -17819 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size -17820 # -17821 eb/jump loop/disp8 -17822 } -17823 # - save result -17824 89/<- *(esi+0xc) 7/r32/edi # Typeinfo-total-size-in-bytes -17825 $populate-mu-type-sizes-in-type:end: -17826 # . restore registers -17827 5f/pop-to-edi -17828 5e/pop-to-esi -17829 5a/pop-to-edx -17830 59/pop-to-ecx -17831 58/pop-to-eax -17832 # . epilogue -17833 89/<- %esp 5/r32/ebp -17834 5d/pop-to-ebp -17835 c3/return -17836 -17837 $populate-mu-type-sizes-in-type:abort: -17838 (write-buffered *(ebp+0xc) "cycle in type definitions\n") -17839 (flush *(ebp+0xc)) -17840 (stop *(ebp+0x10) 1) -17841 # never gets here -17842 -17843 # Analogous to size-of, except we need to compute what size-of can just read -17844 # off the right data structures. -17845 compute-size-of-var: # in: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int -17846 # . prologue -17847 55/push-ebp -17848 89/<- %ebp 4/r32/esp -17849 # . push registers -17850 51/push-ecx -17851 # var t/ecx: (addr type-tree) = lookup(v->type) -17852 8b/-> *(ebp+8) 1/r32/ecx -17853 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -17854 89/<- %ecx 0/r32/eax -17855 # if (t->is-atom == false) t = lookup(t->left) -17856 { -17857 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -17858 75/jump-if-!= break/disp8 -17859 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -17860 89/<- %ecx 0/r32/eax -17861 } -17862 # TODO: ensure t is an atom -17863 (compute-size-of-type-id *(ecx+4) *(ebp+0xc) *(ebp+0x10)) # Type-tree-value => eax -17864 $compute-size-of-var:end: -17865 # . restore registers -17866 59/pop-to-ecx -17867 # . epilogue -17868 89/<- %esp 5/r32/ebp -17869 5d/pop-to-ebp -17870 c3/return -17871 -17872 compute-size-of-type-id: # t: type-id, err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int -17873 # . prologue -17874 55/push-ebp -17875 89/<- %ebp 4/r32/esp -17876 # . save registers -17877 51/push-ecx -17878 # var out/ecx: (handle typeinfo) -17879 68/push 0/imm32 -17880 68/push 0/imm32 -17881 89/<- %ecx 4/r32/esp -17882 # eax = t -17883 8b/-> *(ebp+8) 0/r32/eax -17884 # if t is a literal, return 0 -17885 3d/compare-eax-and 0/imm32/literal -17886 0f 84/jump-if-= $compute-size-of-type-id:end/disp32 # eax changes type from type-id to int -17887 # if t is a byte, return 4 (because we don't really support non-multiples of 4) -17888 3d/compare-eax-and 8/imm32/byte -17889 { -17890 75/jump-if-!= break/disp8 -17891 b8/copy-to-eax 4/imm32 -17892 eb/jump $compute-size-of-type-id:end/disp8 -17893 } -17894 # if t is a handle, return 8 -17895 3d/compare-eax-and 4/imm32/handle -17896 { -17897 75/jump-if-!= break/disp8 -17898 b8/copy-to-eax 8/imm32 -17899 eb/jump $compute-size-of-type-id:end/disp8 # eax changes type from type-id to int -17900 } -17901 # if t is a slice, return 8 -17902 3d/compare-eax-and 0xc/imm32/slice -17903 { -17904 75/jump-if-!= break/disp8 -17905 b8/copy-to-eax 8/imm32 -17906 eb/jump $compute-size-of-type-id:end/disp8 # eax changes type from type-id to int -17907 } -17908 # if t is a user-defined type, compute its size -17909 # TODO: support non-atom type -17910 (find-typeinfo %eax %ecx) -17911 { -17912 81 7/subop/compare *ecx 0/imm32 -17913 74/jump-if-= break/disp8 -17914 $compute-size-of-type-id:user-defined: -17915 (lookup *ecx *(ecx+4)) # => eax -17916 (populate-mu-type-sizes-in-type %eax *(ebp+0xc) *(ebp+0x10)) -17917 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes -17918 eb/jump $compute-size-of-type-id:end/disp8 -17919 } -17920 # otherwise return the word size -17921 b8/copy-to-eax 4/imm32 -17922 $compute-size-of-type-id:end: -17923 # . reclaim locals -17924 81 0/subop/add %esp 8/imm32 -17925 # . restore registers -17926 59/pop-to-ecx -17927 # . epilogue -17928 89/<- %esp 5/r32/ebp -17929 5d/pop-to-ebp -17930 c3/return -17931 -17932 # at this point we have total sizes for all user-defined types -17933 # compute offsets for each element -17934 # complication: fields may be out of order -17935 populate-mu-type-offsets: # in: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) -17936 # . prologue -17937 55/push-ebp -17938 89/<- %ebp 4/r32/esp -17939 # . save registers -17940 50/push-eax -17941 51/push-ecx -17942 52/push-edx -17943 53/push-ebx -17944 56/push-esi -17945 57/push-edi -17946 #? (dump-typeinfos "aaa\n") -17947 # var curr-offset/edi: int = 0 -17948 bf/copy-to-edi 0/imm32 -17949 # var table/ecx: (addr table string_key (handle typeinfo-entry)) = lookup(in->fields) -17950 8b/-> *(ebp+8) 1/r32/ecx -17951 (lookup *(ecx+4) *(ecx+8)) # Typeinfo-fields Typeinfo-fields => eax -17952 89/<- %ecx 0/r32/eax -17953 # var num-elems/edx: int = table->write / Typeinfo-fields-row-size -17954 8b/-> *ecx 2/r32/edx # stream-write -17955 c1 5/subop/shift-right-logical %edx 4/imm8 -17956 # var i/ebx: int = 0 -17957 bb/copy-to-ebx 0/imm32 -17958 { -17959 $populate-mu-type-offsets:loop: -17960 39/compare %ebx 2/r32/edx -17961 0f 8d/jump-if->= break/disp32 -17962 #? (write-buffered Stderr "looking up index ") -17963 #? (write-int32-hex-buffered Stderr %ebx) -17964 #? (write-buffered Stderr " in ") -17965 #? (write-int32-hex-buffered Stderr *(ebp+8)) -17966 #? (write-buffered Stderr Newline) -17967 #? (flush Stderr) -17968 # var v/esi: (addr typeinfo-entry) -17969 (locate-typeinfo-entry-with-index %ecx %ebx *(ebp+0xc) *(ebp+0x10)) # => eax -17970 89/<- %esi 0/r32/eax -17971 # if v is null, silently move on; we'll emit a nice error message while type-checking -17972 81 7/subop/compare %esi 0/imm32 # Typeinfo-entry-input-var -17973 74/jump-if-= $populate-mu-type-offsets:end/disp8 -17974 # if (v->input-var == 0) silently ignore v; we'll emit a nice error message while type-checking -17975 81 7/subop/compare *esi 0/imm32 # Typeinfo-entry-input-var -17976 74/jump-if-= $populate-mu-type-offsets:end/disp8 -17977 # v->output-var->offset = curr-offset -17978 # . eax: (addr var) -17979 (lookup *(esi+0xc) *(esi+0x10)) # Typeinfo-entry-output-var Typeinfo-entry-output-var => eax -17980 89/<- *(eax+0x14) 7/r32/edi # Var-offset -17981 # curr-offset += size-of(v->input-var) -17982 (lookup *esi *(esi+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax -17983 (size-of %eax) # => eax -17984 01/add-to %edi 0/r32/eax -17985 # ++i -17986 43/increment-ebx -17987 e9/jump loop/disp32 -17988 } -17989 $populate-mu-type-offsets:end: -17990 # . restore registers -17991 5f/pop-to-edi -17992 5e/pop-to-esi -17993 5b/pop-to-ebx -17994 5a/pop-to-edx -17995 59/pop-to-ecx -17996 58/pop-to-eax -17997 # . epilogue -17998 89/<- %esp 5/r32/ebp -17999 5d/pop-to-ebp -18000 c3/return -18001 -18002 locate-typeinfo-entry-with-index: # table: (addr table (handle array byte) (handle typeinfo-entry)), idx: int, err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: (addr typeinfo-entry) -18003 # . prologue -18004 55/push-ebp -18005 89/<- %ebp 4/r32/esp -18006 # . save registers -18007 51/push-ecx -18008 52/push-edx -18009 53/push-ebx -18010 56/push-esi -18011 57/push-edi -18012 # esi = table -18013 8b/-> *(ebp+8) 6/r32/esi -18014 # var curr/ecx: (addr row (handle array byte) (handle typeinfo-entry)) = table->data -18015 8d/copy-address *(esi+0xc) 1/r32/ecx -18016 # var max/edx: (addr byte) = &table->data[table->write] -18017 8b/-> *esi 2/r32/edx -18018 8d/copy-address *(ecx+edx) 2/r32/edx -18019 { -18020 $locate-typeinfo-entry-with-index:loop: -18021 39/compare %ecx 2/r32/edx -18022 73/jump-if-addr>= break/disp8 -18023 # var v/eax: (addr typeinfo-entry) -18024 (lookup *(ecx+8) *(ecx+0xc)) # => eax -18025 # if (v->index == idx) return v -18026 8b/-> *(eax+8) 3/r32/ebx # Typeinfo-entry-index -18027 #? (write-buffered Stderr "comparing ") -18028 #? (write-int32-hex-buffered Stderr %ebx) -18029 #? (write-buffered Stderr " and ") -18030 #? (write-int32-hex-buffered Stderr *(ebp+0xc)) -18031 #? (write-buffered Stderr Newline) -18032 #? (flush Stderr) -18033 39/compare *(ebp+0xc) 3/r32/ebx -18034 74/jump-if-= $locate-typeinfo-entry-with-index:end/disp8 -18035 # curr += Typeinfo-entry-size -18036 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-entry-size -18037 # -18038 eb/jump loop/disp8 -18039 } -18040 # return 0 -18041 b8/copy-to-eax 0/imm32 -18042 $locate-typeinfo-entry-with-index:end: -18043 #? (write-buffered Stderr "returning ") -18044 #? (write-int32-hex-buffered Stderr %eax) -18045 #? (write-buffered Stderr Newline) -18046 #? (flush Stderr) -18047 # . restore registers -18048 5f/pop-to-edi -18049 5e/pop-to-esi -18050 5b/pop-to-ebx -18051 5a/pop-to-edx -18052 59/pop-to-ecx -18053 # . epilogue -18054 89/<- %esp 5/r32/ebp -18055 5d/pop-to-ebp -18056 c3/return -18057 -18058 dump-typeinfos: # hdr: (addr array byte) -18059 # . prologue -18060 55/push-ebp -18061 89/<- %ebp 4/r32/esp -18062 # . save registers -18063 50/push-eax -18064 # -18065 (write-buffered Stderr *(ebp+8)) -18066 (flush Stderr) -18067 # var curr/eax: (addr typeinfo) = lookup(Program->types) -18068 (lookup *_Program-types *_Program-types->payload) # => eax -18069 { -18070 # if (curr == null) break -18071 3d/compare-eax-and 0/imm32 -18072 74/jump-if-= break/disp8 -18073 (write-buffered Stderr "---\n") -18074 (flush Stderr) -18075 (dump-typeinfo %eax) -18076 # curr = lookup(curr->next) -18077 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax -18078 eb/jump loop/disp8 -18079 } -18080 $dump-typeinfos:end: -18081 # . restore registers -18082 58/pop-to-eax -18083 # . epilogue -18084 89/<- %esp 5/r32/ebp -18085 5d/pop-to-ebp -18086 c3/return -18087 -18088 dump-typeinfo: # in: (addr typeinfo) -18089 # . prologue -18090 55/push-ebp -18091 89/<- %ebp 4/r32/esp -18092 # . save registers -18093 50/push-eax -18094 51/push-ecx -18095 52/push-edx -18096 53/push-ebx -18097 56/push-esi -18098 57/push-edi -18099 # esi = in -18100 8b/-> *(ebp+8) 6/r32/esi -18101 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) -18102 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax -18103 89/<- %ecx 0/r32/eax -18104 (write-buffered Stderr "id:") -18105 (write-int32-hex-buffered Stderr *esi) -18106 (write-buffered Stderr "\n") -18107 (write-buffered Stderr "fields @ ") -18108 (write-int32-hex-buffered Stderr %ecx) -18109 (write-buffered Stderr Newline) -18110 (flush Stderr) -18111 (write-buffered Stderr " write: ") -18112 (write-int32-hex-buffered Stderr *ecx) -18113 (write-buffered Stderr Newline) -18114 (flush Stderr) -18115 (write-buffered Stderr " read: ") -18116 (write-int32-hex-buffered Stderr *(ecx+4)) -18117 (write-buffered Stderr Newline) -18118 (flush Stderr) -18119 (write-buffered Stderr " size: ") -18120 (write-int32-hex-buffered Stderr *(ecx+8)) -18121 (write-buffered Stderr Newline) -18122 (flush Stderr) -18123 # var table-size/edx: int = table->write -18124 8b/-> *ecx 2/r32/edx # stream-write -18125 # var curr/ecx: (addr table_row) = table->data -18126 8d/copy-address *(ecx+0xc) 1/r32/ecx -18127 # var max/edx: (addr table_row) = table->data + table->write -18128 8d/copy-address *(ecx+edx) 2/r32/edx -18129 { -18130 $dump-typeinfo:loop: -18131 # if (curr >= max) break -18132 39/compare %ecx 2/r32/edx -18133 0f 83/jump-if-addr>= break/disp32 -18134 (write-buffered Stderr " row:\n") -18135 (write-buffered Stderr " key: ") -18136 (write-int32-hex-buffered Stderr *ecx) -18137 (write-buffered Stderr ",") -18138 (write-int32-hex-buffered Stderr *(ecx+4)) -18139 (write-buffered Stderr " = '") -18140 (lookup *ecx *(ecx+4)) -18141 (write-buffered Stderr %eax) -18142 (write-buffered Stderr "' @ ") -18143 (write-int32-hex-buffered Stderr %eax) -18144 (write-buffered Stderr Newline) -18145 (flush Stderr) -18146 (write-buffered Stderr " value: ") -18147 (write-int32-hex-buffered Stderr *(ecx+8)) -18148 (write-buffered Stderr ",") -18149 (write-int32-hex-buffered Stderr *(ecx+0xc)) -18150 (write-buffered Stderr " = typeinfo-entry@") -18151 (lookup *(ecx+8) *(ecx+0xc)) -18152 (write-int32-hex-buffered Stderr %eax) -18153 (write-buffered Stderr Newline) -18154 (flush Stderr) -18155 (write-buffered Stderr " input var@") -18156 (dump-var 5 %eax) -18157 (lookup *(ecx+8) *(ecx+0xc)) -18158 (write-buffered Stderr " index: ") -18159 (write-int32-hex-buffered Stderr *(eax+8)) -18160 (write-buffered Stderr Newline) -18161 (flush Stderr) -18162 (write-buffered Stderr " output var@") -18163 8d/copy-address *(eax+0xc) 0/r32/eax # Typeinfo-entry-output-var -18164 (dump-var 5 %eax) -18165 (flush Stderr) -18166 # curr += row-size -18167 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size -18168 # -18169 e9/jump loop/disp32 -18170 } -18171 $dump-typeinfo:end: -18172 # . restore registers -18173 5f/pop-to-edi -18174 5e/pop-to-esi -18175 5b/pop-to-ebx -18176 5a/pop-to-edx -18177 59/pop-to-ecx -18178 58/pop-to-eax -18179 # . epilogue -18180 89/<- %esp 5/r32/ebp -18181 5d/pop-to-ebp -18182 c3/return -18183 -18184 dump-var: # indent: int, v: (addr handle var) -18185 # . prologue -18186 55/push-ebp -18187 89/<- %ebp 4/r32/esp -18188 # . save registers -18189 50/push-eax -18190 53/push-ebx -18191 # eax = v -18192 8b/-> *(ebp+0xc) 0/r32/eax -18193 # -18194 (write-int32-hex-buffered Stderr *eax) -18195 (write-buffered Stderr ",") -18196 (write-int32-hex-buffered Stderr *(eax+4)) -18197 (write-buffered Stderr "->") -18198 (lookup *eax *(eax+4)) -18199 (write-int32-hex-buffered Stderr %eax) -18200 (write-buffered Stderr Newline) -18201 (flush Stderr) -18202 { -18203 3d/compare-eax-and 0/imm32 -18204 0f 84/jump-if-= break/disp32 -18205 (emit-indent Stderr *(ebp+8)) -18206 (write-buffered Stderr "name: ") -18207 89/<- %ebx 0/r32/eax -18208 (write-int32-hex-buffered Stderr *ebx) # Var-name -18209 (write-buffered Stderr ",") -18210 (write-int32-hex-buffered Stderr *(ebx+4)) # Var-name -18211 (write-buffered Stderr "->") -18212 (lookup *ebx *(ebx+4)) # Var-name -18213 (write-int32-hex-buffered Stderr %eax) -18214 { -18215 3d/compare-eax-and 0/imm32 -18216 74/jump-if-= break/disp8 -18217 (write-buffered Stderr Space) -18218 (write-buffered Stderr %eax) -18219 } -18220 (write-buffered Stderr Newline) -18221 (flush Stderr) -18222 (emit-indent Stderr *(ebp+8)) -18223 (write-buffered Stderr "block depth: ") -18224 (write-int32-hex-buffered Stderr *(ebx+0x10)) # Var-block-depth -18225 (write-buffered Stderr Newline) -18226 (flush Stderr) -18227 (emit-indent Stderr *(ebp+8)) -18228 (write-buffered Stderr "stack offset: ") -18229 (write-int32-hex-buffered Stderr *(ebx+0x14)) # Var-offset -18230 (write-buffered Stderr Newline) -18231 (flush Stderr) -18232 (emit-indent Stderr *(ebp+8)) -18233 (write-buffered Stderr "reg: ") -18234 (write-int32-hex-buffered Stderr *(ebx+0x18)) # Var-register -18235 (write-buffered Stderr ",") -18236 (write-int32-hex-buffered Stderr *(ebx+0x1c)) # Var-register -18237 (write-buffered Stderr "->") -18238 (flush Stderr) -18239 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register -18240 (write-int32-hex-buffered Stderr %eax) -18241 { -18242 3d/compare-eax-and 0/imm32 -18243 74/jump-if-= break/disp8 -18244 (write-buffered Stderr Space) -18245 (write-buffered Stderr %eax) -18246 } -18247 (write-buffered Stderr Newline) -18248 (flush Stderr) -18249 } -18250 $dump-var:end: -18251 # . restore registers -18252 5b/pop-to-ebx -18253 58/pop-to-eax -18254 # . epilogue -18255 89/<- %esp 5/r32/ebp -18256 5d/pop-to-ebp -18257 c3/return -18258 -18259 ####################################################### -18260 # Type-checking -18261 ####################################################### -18262 -18263 check-mu-types: # err: (addr buffered-file), ed: (addr exit-descriptor) -18264 # . prologue -18265 55/push-ebp -18266 89/<- %ebp 4/r32/esp -18267 # . save registers -18268 50/push-eax -18269 # var curr/eax: (addr function) = lookup(Program->functions) -18270 (lookup *_Program-functions *_Program-functions->payload) # => eax -18271 { -18272 $check-mu-types:loop: -18273 # if (curr == null) break -18274 3d/compare-eax-and 0/imm32 -18275 0f 84/jump-if-= break/disp32 -18276 +-- 8 lines: #? # dump curr->name ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -18284 (check-mu-function %eax *(ebp+8) *(ebp+0xc)) -18285 # curr = lookup(curr->next) -18286 (lookup *(eax+0x20) *(eax+0x24)) # Function-next Function-next => eax -18287 e9/jump loop/disp32 -18288 } -18289 $check-mu-types:end: -18290 # . restore registers -18291 58/pop-to-eax -18292 # . epilogue -18293 89/<- %esp 5/r32/ebp -18294 5d/pop-to-ebp -18295 c3/return -18296 -18297 check-mu-function: # fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -18298 # . prologue -18299 55/push-ebp -18300 89/<- %ebp 4/r32/esp -18301 # . save registers -18302 50/push-eax -18303 56/push-esi -18304 # esi = f -18305 8b/-> *(ebp+8) 6/r32/esi -18306 # outputs -18307 (lookup *(esi+0x10) *(esi+0x14)) # Function-outputs Function-outputs => eax -18308 (check-all-unique-registers %eax %esi *(ebp+0xc) *(ebp+0x10)) -18309 # body -18310 (lookup *(esi+0x18) *(esi+0x1c)) # Function-body Function-body => eax -18311 (check-mu-block %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10)) -18312 # if function has no outputs, we're done -18313 81 7/subop/compare *(esi+0x10) 0/imm32 -18314 74/jump-if-= $check-mu-function:end/disp8 -18315 # some final checks on body -18316 (check-final-stmt-is-return %eax %esi *(ebp+0xc) *(ebp+0x10)) -18317 (check-no-breaks %eax %esi *(ebp+0xc) *(ebp+0x10)) -18318 $check-mu-function:end: -18319 # . restore registers -18320 5e/pop-to-esi -18321 58/pop-to-eax -18322 # . epilogue -18323 89/<- %esp 5/r32/ebp -18324 5d/pop-to-ebp -18325 c3/return -18326 -18327 check-mu-block: # block: (addr block), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -18328 # . prologue -18329 55/push-ebp -18330 89/<- %ebp 4/r32/esp -18331 # . save registers -18332 50/push-eax -18333 # eax = block -18334 8b/-> *(ebp+8) 0/r32/eax -18335 # var stmts/eax: (addr list stmt) = lookup(block->statements) -18336 (lookup *(eax+4) *(eax+8)) # Block-stmts Block-stmts => eax -18337 # -18338 { -18339 $check-mu-block:check-empty: -18340 3d/compare-eax-and 0/imm32 -18341 0f 84/jump-if-= break/disp32 -18342 # emit block->statements -18343 (check-mu-stmt-list %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18344 } -18345 $check-mu-block:end: -18346 # . restore registers -18347 58/pop-to-eax -18348 # . epilogue -18349 89/<- %esp 5/r32/ebp -18350 5d/pop-to-ebp -18351 c3/return -18352 -18353 check-mu-stmt-list: # stmts: (addr list stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -18354 # . prologue -18355 55/push-ebp -18356 89/<- %ebp 4/r32/esp -18357 # . save registers -18358 50/push-eax -18359 56/push-esi -18360 # esi = stmts -18361 8b/-> *(ebp+8) 6/r32/esi -18362 { -18363 $check-mu-stmt-list:loop: -18364 81 7/subop/compare %esi 0/imm32 -18365 0f 84/jump-if-= break/disp32 -18366 # var curr-stmt/eax: (addr stmt) = lookup(stmts->value) -18367 (lookup *esi *(esi+4)) # List-value List-value => eax -18368 { -18369 $check-mu-stmt-list:check-for-block: -18370 81 7/subop/compare *eax 0/imm32/block # Stmt-tag -18371 75/jump-if-!= break/disp8 -18372 $check-mu-stmt-list:block: -18373 (check-mu-block %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18374 eb/jump $check-mu-stmt-list:continue/disp8 -18375 } -18376 { -18377 $check-mu-stmt-list:check-for-stmt1: -18378 81 7/subop/compare *eax 1/imm32/stmt1 # Stmt-tag -18379 0f 85/jump-if-!= break/disp32 -18380 $check-mu-stmt-list:stmt1: -18381 (check-mu-stmt %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18382 eb/jump $check-mu-stmt-list:continue/disp8 -18383 } -18384 { -18385 $check-mu-stmt-list:check-for-reg-var-def: -18386 81 7/subop/compare *eax 3/imm32/reg-var-def # Stmt-tag -18387 0f 85/jump-if-!= break/disp32 -18388 $check-mu-stmt-list:reg-var-def: -18389 (check-mu-stmt %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18390 eb/jump $check-mu-stmt-list:continue/disp8 -18391 } -18392 $check-mu-stmt-list:continue: -18393 # TODO: raise an error on unrecognized Stmt-tag -18394 (lookup *(esi+8) *(esi+0xc)) # List-next List-next => eax -18395 89/<- %esi 0/r32/eax -18396 e9/jump loop/disp32 -18397 } -18398 $check-mu-stmt-list:end: -18399 # . restore registers -18400 5e/pop-to-esi -18401 58/pop-to-eax -18402 # . epilogue -18403 89/<- %esp 5/r32/ebp -18404 5d/pop-to-ebp -18405 c3/return -18406 -18407 check-mu-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -18408 # . prologue -18409 55/push-ebp -18410 89/<- %ebp 4/r32/esp -18411 # . save registers -18412 50/push-eax -18413 # - if stmt's operation matches a primitive, check against it -18414 (has-primitive-name? *(ebp+8)) # => eax -18415 3d/compare-eax-and 0/imm32/false -18416 { -18417 74/jump-if-= break/disp8 -18418 (check-mu-primitive *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18419 e9/jump $check-mu-stmt:end/disp32 -18420 } -18421 # - otherwise find a function to check against -18422 # var f/eax: (addr function) = lookup(*Program->functions) -18423 (lookup *_Program-functions *_Program-functions->payload) # => eax -18424 (find-matching-function %eax *(ebp+8)) # => eax -18425 3d/compare-eax-and 0/imm32 -18426 { -18427 74/jump-if-= break/disp8 -18428 (check-mu-call *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18429 eb/jump $check-mu-stmt:end/disp8 -18430 } -18431 # var f/eax: (addr function) = lookup(*Program->signatures) -18432 (lookup *_Program-signatures *_Program-signatures->payload) # => eax -18433 (find-matching-function %eax *(ebp+8)) # => eax -18434 3d/compare-eax-and 0/imm32 -18435 { -18436 74/jump-if-= break/disp8 -18437 (check-mu-call *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18438 eb/jump $check-mu-stmt:end/disp8 -18439 } -18440 # - otherwise abort -18441 e9/jump $check-mu-stmt:unknown-call/disp32 -18442 $check-mu-stmt:end: -18443 # . restore registers -18444 58/pop-to-eax -18445 # . epilogue -18446 89/<- %esp 5/r32/ebp -18447 5d/pop-to-ebp -18448 c3/return -18449 -18450 $check-mu-stmt:unknown-call: -18451 (write-buffered *(ebp+0x10) "unknown function '") -18452 8b/-> *(ebp+8) 0/r32/eax -18453 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -18454 (write-buffered *(ebp+0x10) %eax) -18455 (write-buffered *(ebp+0x10) "'\n") -18456 (flush *(ebp+0x10)) -18457 (stop *(ebp+0x14) 1) -18458 # never gets here -18459 -18460 has-primitive-name?: # stmt: (addr stmt) -> result/eax: boolean -18461 # . prologue -18462 55/push-ebp -18463 89/<- %ebp 4/r32/esp -18464 # . save registers -18465 51/push-ecx -18466 56/push-esi -18467 # var name/esi: (addr array byte) = lookup(stmt->operation) -18468 8b/-> *(ebp+8) 6/r32/esi -18469 (lookup *(esi+4) *(esi+8)) # Stmt1-operation Stmt1-operation => eax -18470 89/<- %esi 0/r32/eax -18471 # if (name == "return") return true -18472 (string-equal? %esi "return") # => eax -18473 3d/compare-eax-and 0/imm32/false -18474 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -18475 # if (name == "get") return true -18476 (string-equal? %esi "get") # => eax -18477 3d/compare-eax-and 0/imm32/false -18478 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -18479 # if (name == "index") return true -18480 (string-equal? %esi "index") # => eax -18481 3d/compare-eax-and 0/imm32/false -18482 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -18483 # if (name == "length") return true -18484 (string-equal? %esi "length") # => eax -18485 3d/compare-eax-and 0/imm32/false -18486 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -18487 # if (name == "compute-offset") return true -18488 (string-equal? %esi "compute-offset") # => eax -18489 3d/compare-eax-and 0/imm32/false -18490 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -18491 # if (name == "copy-object") return true -18492 (string-equal? %esi "copy-object") # => eax -18493 3d/compare-eax-and 0/imm32/false -18494 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -18495 # if (name == "allocate") return true -18496 (string-equal? %esi "allocate") # => eax -18497 3d/compare-eax-and 0/imm32/false -18498 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -18499 # if (name == "populate") return true -18500 (string-equal? %esi "populate") # => eax -18501 3d/compare-eax-and 0/imm32/false -18502 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -18503 # if (name == "populate-stream") return true -18504 (string-equal? %esi "populate-stream") # => eax -18505 3d/compare-eax-and 0/imm32/false -18506 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -18507 # if (name == "read-from-stream") return true -18508 (string-equal? %esi "read-from-stream") # => eax -18509 3d/compare-eax-and 0/imm32/false -18510 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -18511 # if (name == "write-to-stream") return true -18512 (string-equal? %esi "write-to-stream") # => eax -18513 3d/compare-eax-and 0/imm32/false -18514 0f 85/jump-if-!= $has-primitive-name?:end/disp32 -18515 # var curr/ecx: (addr primitive) = Primitives -18516 b9/copy-to-ecx Primitives/imm32 -18517 { -18518 $has-primitive-name?:loop: -18519 # if (curr == null) break -18520 81 7/subop/compare %ecx 0/imm32 -18521 74/jump-if-= break/disp8 -18522 # if (primitive->name == name) return true -18523 (lookup *ecx *(ecx+4)) # Primitive-name Primitive-name => eax -18524 #? (write-buffered Stderr %eax) -18525 #? (write-buffered Stderr Newline) -18526 #? (flush Stderr) -18527 (string-equal? %esi %eax) # => eax -18528 3d/compare-eax-and 0/imm32/false -18529 75/jump-if-!= $has-primitive-name?:end/disp8 -18530 $has-primitive-name?:next-primitive: -18531 # curr = curr->next -18532 (lookup *(ecx+0x3c) *(ecx+0x40)) # Primitive-next Primitive-next => eax -18533 89/<- %ecx 0/r32/eax -18534 # -18535 e9/jump loop/disp32 -18536 } -18537 # return null -18538 b8/copy-to-eax 0/imm32 -18539 $has-primitive-name?:end: -18540 # . restore registers -18541 5e/pop-to-esi -18542 59/pop-to-ecx -18543 # . epilogue -18544 89/<- %esp 5/r32/ebp -18545 5d/pop-to-ebp -18546 c3/return -18547 -18548 check-mu-primitive: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -18549 # . prologue -18550 55/push-ebp -18551 89/<- %ebp 4/r32/esp -18552 # . save registers -18553 50/push-eax -18554 51/push-ecx -18555 # var op/ecx: (addr array byte) = lookup(stmt->operation) -18556 8b/-> *(ebp+8) 0/r32/eax -18557 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -18558 89/<- %ecx 0/r32/eax -18559 # if (op == "copy") check-mu-copy-stmt -18560 { -18561 (string-equal? %ecx "copy") # => eax -18562 3d/compare-eax-and 0/imm32/false -18563 74/jump-if-= break/disp8 -18564 (check-mu-copy-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18565 e9/jump $check-mu-primitive:end/disp32 -18566 } -18567 # if (op == "copy-to") check-mu-copy-to-stmt -18568 { -18569 (string-equal? %ecx "copy-to") # => eax -18570 3d/compare-eax-and 0/imm32/false -18571 74/jump-if-= break/disp8 -18572 (check-mu-copy-to-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18573 e9/jump $check-mu-primitive:end/disp32 -18574 } -18575 # if (op == "compare") check-mu-compare-stmt -18576 { -18577 (string-equal? %ecx "compare") # => eax -18578 3d/compare-eax-and 0/imm32/false -18579 74/jump-if-= break/disp8 -18580 (check-mu-compare-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18581 e9/jump $check-mu-primitive:end/disp32 -18582 } -18583 # if (op == "address") check-mu-address-stmt -18584 { -18585 (string-equal? %ecx "address") # => eax -18586 3d/compare-eax-and 0/imm32/false -18587 74/jump-if-= break/disp8 -18588 (check-mu-address-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18589 e9/jump $check-mu-primitive:end/disp32 -18590 } -18591 # if (op == "return") check-mu-return-stmt -18592 { -18593 (string-equal? %ecx "return") # => eax -18594 3d/compare-eax-and 0/imm32/false -18595 74/jump-if-= break/disp8 -18596 (check-mu-return-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18597 e9/jump $check-mu-primitive:end/disp32 -18598 } -18599 # if (op == "get") check-mu-get-stmt -18600 { -18601 (string-equal? %ecx "get") # => eax -18602 3d/compare-eax-and 0/imm32/false -18603 74/jump-if-= break/disp8 -18604 (check-mu-get-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18605 e9/jump $check-mu-primitive:end/disp32 -18606 } -18607 # if (op == "index") check-mu-index-stmt -18608 { -18609 (string-equal? %ecx "index") # => eax -18610 3d/compare-eax-and 0/imm32/false -18611 74/jump-if-= break/disp8 -18612 (check-mu-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18613 e9/jump $check-mu-primitive:end/disp32 -18614 } -18615 # if (op == "length") check-mu-length-stmt -18616 { -18617 (string-equal? %ecx "length") # => eax -18618 3d/compare-eax-and 0/imm32/false -18619 74/jump-if-= break/disp8 -18620 (check-mu-length-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18621 e9/jump $check-mu-primitive:end/disp32 -18622 } -18623 # if (op == "compute-offset") check-mu-compute-offset-stmt -18624 { -18625 (string-equal? %ecx "compute-offset") # => eax -18626 3d/compare-eax-and 0/imm32/false -18627 74/jump-if-= break/disp8 -18628 (check-mu-compute-offset-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18629 e9/jump $check-mu-primitive:end/disp32 -18630 } -18631 # if (op == "copy-object") check-mu-copy-object-stmt -18632 { -18633 (string-equal? %ecx "copy-object") # => eax -18634 3d/compare-eax-and 0/imm32/false -18635 74/jump-if-= break/disp8 -18636 (check-mu-copy-object-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18637 e9/jump $check-mu-primitive:end/disp32 -18638 } -18639 # if (op == "allocate") check-mu-allocate-stmt -18640 { -18641 (string-equal? %ecx "allocate") # => eax -18642 3d/compare-eax-and 0/imm32/false -18643 74/jump-if-= break/disp8 -18644 (check-mu-allocate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18645 e9/jump $check-mu-primitive:end/disp32 -18646 } -18647 # if (op == "populate") check-mu-populate-stmt -18648 { -18649 (string-equal? %ecx "populate") # => eax -18650 3d/compare-eax-and 0/imm32/false -18651 74/jump-if-= break/disp8 -18652 (check-mu-populate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18653 e9/jump $check-mu-primitive:end/disp32 -18654 } -18655 # if (op == "populate-stream") check-mu-populate-stream-stmt -18656 { -18657 (string-equal? %ecx "populate-stream") # => eax -18658 3d/compare-eax-and 0/imm32/false -18659 74/jump-if-= break/disp8 -18660 (check-mu-populate-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18661 e9/jump $check-mu-primitive:end/disp32 -18662 } -18663 # if (op == "read-from-stream") check-mu-read-from-stream-stmt -18664 { -18665 (string-equal? %ecx "read-from-stream") # => eax -18666 3d/compare-eax-and 0/imm32/false -18667 74/jump-if-= break/disp8 -18668 (check-mu-read-from-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18669 e9/jump $check-mu-primitive:end/disp32 -18670 } -18671 # if (op == "write-to-stream") check-mu-write-to-stream-stmt -18672 { -18673 (string-equal? %ecx "write-to-stream") # => eax -18674 3d/compare-eax-and 0/imm32/false -18675 74/jump-if-= break/disp8 -18676 (check-mu-write-to-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18677 e9/jump $check-mu-primitive:end/disp32 -18678 } -18679 # if (op == "convert") check-mu-convert-stmt -18680 { -18681 (string-equal? %ecx "convert") # => eax -18682 3d/compare-eax-and 0/imm32/false -18683 74/jump-if-= break/disp8 -18684 (check-mu-convert-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18685 e9/jump $check-mu-primitive:end/disp32 -18686 } -18687 # otherwise check-numberlike-stmt -18688 (check-mu-numberlike-primitive *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18689 $check-mu-primitive:end: -18690 # . restore registers -18691 59/pop-to-ecx -18692 58/pop-to-eax -18693 # . epilogue -18694 89/<- %esp 5/r32/ebp -18695 5d/pop-to-ebp -18696 c3/return -18697 -18698 # by default, Mu primitives should only operate on 'number-like' types -18699 check-mu-numberlike-primitive: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -18700 # . prologue -18701 55/push-ebp -18702 89/<- %ebp 4/r32/esp -18703 # . save registers -18704 50/push-eax -18705 51/push-ecx -18706 56/push-esi -18707 # esi = stmt -18708 8b/-> *(ebp+8) 6/r32/esi -18709 # var gas/ecx: int = 2 -18710 b9/copy-to-ecx 2/imm32 -18711 # - check at most 1 output -18712 # var output/eax: (addr stmt-var) = stmt->outputs -18713 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -18714 { -18715 3d/compare-eax-and 0/imm32 -18716 74/jump-if-= break/disp8 -18717 $check-mu-numberlike-primitive:output: -18718 (check-mu-numberlike-output %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18719 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -18720 3d/compare-eax-and 0/imm32 -18721 0f 85/jump-if-!= $check-mu-numberlike-primitive:error-too-many-outputs/disp32 -18722 # check output is in a register -18723 # --gas -18724 49/decrement-ecx -18725 } -18726 # - check first inout -18727 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -18728 { -18729 3d/compare-eax-and 0/imm32 -18730 0f 84/jump-if-= $check-mu-numberlike-primitive:end/disp32 -18731 $check-mu-numberlike-primitive:first-inout: -18732 (check-mu-numberlike-arg %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18733 # --gas -18734 49/decrement-ecx -18735 } -18736 # - check second inout -18737 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -18738 { -18739 3d/compare-eax-and 0/imm32 -18740 74/jump-if-= $check-mu-numberlike-primitive:end/disp8 -18741 $check-mu-numberlike-primitive:second-inout: -18742 # is a second inout allowed? -18743 81 7/subop/compare %ecx 0/imm32 -18744 0f 84/jump-if-= $check-mu-numberlike-primitive:error-too-many-inouts/disp32 -18745 $check-mu-numberlike-primitive:second-inout-permitted: -18746 (check-mu-numberlike-arg %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -18747 } -18748 $check-mu-numberlike-primitive:third-inout: -18749 # if there's a third arg, raise an error -18750 81 7/subop/compare *(eax+8) 0/imm32 # Stmt-var-next -18751 0f 85/jump-if-!= $check-mu-numberlike-primitive:error-too-many-inouts/disp32 -18752 $check-mu-numberlike-primitive:end: -18753 # . restore registers -18754 5e/pop-to-esi -18755 59/pop-to-ecx -18756 58/pop-to-eax -18757 # . epilogue -18758 89/<- %esp 5/r32/ebp -18759 5d/pop-to-ebp -18760 c3/return -18761 -18762 $check-mu-numberlike-primitive:error-too-many-inouts: -18763 (write-buffered *(ebp+0x10) "fn ") -18764 8b/-> *(ebp+0xc) 0/r32/eax -18765 (lookup *eax *(eax+4)) # Function-name Function-name => eax -18766 (write-buffered *(ebp+0x10) %eax) -18767 (write-buffered *(ebp+0x10) ": stmt ") -18768 (lookup *(esi+4) *(esi+8)) # Stmt1-operation Stmt1-operation => eax -18769 (write-buffered *(ebp+0x10) %eax) -18770 (write-buffered *(ebp+0x10) ": too many inouts; most primitives support at most two arguments, across inouts and outputs\n") -18771 (flush *(ebp+0x10)) -18772 (stop *(ebp+0x14) 1) -18773 # never gets here -18774 -18775 $check-mu-numberlike-primitive:error-too-many-outputs: -18776 (write-buffered *(ebp+0x10) "fn ") -18777 8b/-> *(ebp+0xc) 0/r32/eax -18778 (lookup *eax *(eax+4)) # Function-name Function-name => eax -18779 (write-buffered *(ebp+0x10) %eax) -18780 (write-buffered *(ebp+0x10) ": stmt ") -18781 (lookup *(esi+4) *(esi+8)) # Stmt1-operation Stmt1-operation => eax -18782 (write-buffered *(ebp+0x10) %eax) -18783 (write-buffered *(ebp+0x10) ": too many outputs; most primitives support at most one output\n") -18784 (flush *(ebp+0x10)) -18785 (stop *(ebp+0x14) 1) -18786 # never gets here -18787 -18788 check-mu-numberlike-arg: # v: (addr stmt-var), stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -18789 # . prologue -18790 55/push-ebp -18791 89/<- %ebp 4/r32/esp -18792 # . save registers -18793 50/push-eax -18794 56/push-esi -18795 # var t/esi: (addr type-tree) = lookup(v->value->type) -18796 8b/-> *(ebp+8) 0/r32/eax -18797 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -18798 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -18799 89/<- %esi 0/r32/eax -18800 $check-mu-numberlike-arg:check-literal: -18801 # if t is an int, return -18802 (is-simple-mu-type? %esi 0) # literal => eax -18803 3d/compare-eax-and 0/imm32/false -18804 0f 85/jump-if-!= $check-mu-numberlike-arg:end/disp32 -18805 $check-mu-numberlike-arg:check-addr: -18806 # if t is an addr and v is dereferenced, return whether t->payload is an addr -18807 { -18808 (is-mu-addr-type? %esi) # => eax -18809 3d/compare-eax-and 0/imm32/false -18810 74/jump-if-= break/disp8 -18811 8b/-> *(ebp+8) 0/r32/eax -18812 8b/-> *(eax+0x10) 0/r32/eax # Stmt-var-is-deref -18813 3d/compare-eax-and 0/imm32/false +16884 $lookup-var-helper:error1: +16885 (write-buffered *(ebp+0x18) "fn ") +16886 8b/-> *(ebp+0x14) 0/r32/eax +16887 (lookup *eax *(eax+4)) # Function-name Function-name => eax +16888 (write-buffered *(ebp+0x18) %eax) +16889 (write-buffered *(ebp+0x18) ": malformed stack when looking up '") +16890 (write-slice-buffered *(ebp+0x18) *(ebp+8)) +16891 (write-buffered *(ebp+0x18) "'\n") +16892 (flush *(ebp+0x18)) +16893 (stop *(ebp+0x1c) 1) +16894 # never gets here +16895 +16896 $lookup-var-helper:error2: +16897 # eax contains the conflicting var at this point +16898 (write-buffered *(ebp+0x18) "fn ") +16899 50/push-eax +16900 8b/-> *(ebp+0x14) 0/r32/eax +16901 (lookup *eax *(eax+4)) # Function-name Function-name => eax +16902 (write-buffered *(ebp+0x18) %eax) +16903 58/pop-eax +16904 (write-buffered *(ebp+0x18) ": register ") +16905 50/push-eax +16906 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +16907 (write-buffered *(ebp+0x18) %eax) +16908 58/pop-to-eax +16909 (write-buffered *(ebp+0x18) " reads var '") +16910 (write-slice-buffered *(ebp+0x18) *(ebp+8)) +16911 (write-buffered *(ebp+0x18) "' after writing var '") +16912 (lookup *eax *(eax+4)) # Var-name Var-name => eax +16913 (write-buffered *(ebp+0x18) %eax) +16914 (write-buffered *(ebp+0x18) "'\n") +16915 (flush *(ebp+0x18)) +16916 (stop *(ebp+0x1c) 1) +16917 # never gets here +16918 +16919 dump-vars: # vars: (addr stack live-var) +16920 # pseudocode: +16921 # var curr: (addr handle var) = &vars->data[vars->top - 12] +16922 # var min = vars->data +16923 # while curr >= min +16924 # var v: (handle var) = *curr +16925 # print v +16926 # curr -= 12 +16927 # +16928 # . prologue +16929 55/push-ebp +16930 89/<- %ebp 4/r32/esp +16931 # . save registers +16932 52/push-edx +16933 53/push-ebx +16934 56/push-esi +16935 # esi = vars +16936 8b/-> *(ebp+8) 6/r32/esi +16937 # ebx = vars->top +16938 8b/-> *esi 3/r32/ebx +16939 # var min/edx: (addr handle var) = vars->data +16940 8d/copy-address *(esi+8) 2/r32/edx +16941 # var curr/ebx: (addr handle var) = &vars->data[vars->top - 12] +16942 8d/copy-address *(esi+ebx-4) 3/r32/ebx # vars + 8 + vars->type - 12 +16943 { +16944 $dump-vars:loop: +16945 # if (curr < min) return +16946 39/compare %ebx 2/r32/edx +16947 0f 82/jump-if-addr< break/disp32 +16948 # +16949 (write-buffered Stderr " var@") +16950 (dump-var 2 %ebx) +16951 # curr -= 12 +16952 81 5/subop/subtract %ebx 0xc/imm32 +16953 e9/jump loop/disp32 +16954 } +16955 $dump-vars:end: +16956 # . restore registers +16957 5e/pop-to-esi +16958 5b/pop-to-ebx +16959 5a/pop-to-edx +16960 # . epilogue +16961 89/<- %esp 5/r32/ebp +16962 5d/pop-to-ebp +16963 c3/return +16964 +16965 == data +16966 # Like Registers, but no esp or ebp +16967 Mu-registers: # (addr stream {(handle array byte), int}) +16968 # a table is a stream +16969 0xa8/imm32/write +16970 0/imm32/read +16971 0xa8/imm32/length +16972 # data +16973 # general-purpose registers +16974 # it is perfectly ok to use fake alloc-ids -- as long as you never try to reclaim them +16975 0x11/imm32/alloc-id $Mu-register-eax/imm32 0/imm32 +16976 0x11/imm32/alloc-id $Mu-register-ecx/imm32 1/imm32 +16977 0x11/imm32/alloc-id $Mu-register-edx/imm32 2/imm32 +16978 0x11/imm32/alloc-id $Mu-register-ebx/imm32 3/imm32 +16979 0x11/imm32/alloc-id $Mu-register-esi/imm32 6/imm32 +16980 0x11/imm32/alloc-id $Mu-register-edi/imm32 7/imm32 +16981 # floating-point registers +16982 0x11/imm32/alloc-id $Mu-register-xmm0/imm32 0/imm32 +16983 0x11/imm32/alloc-id $Mu-register-xmm1/imm32 1/imm32 +16984 0x11/imm32/alloc-id $Mu-register-xmm2/imm32 2/imm32 +16985 0x11/imm32/alloc-id $Mu-register-xmm3/imm32 3/imm32 +16986 0x11/imm32/alloc-id $Mu-register-xmm4/imm32 4/imm32 +16987 0x11/imm32/alloc-id $Mu-register-xmm5/imm32 5/imm32 +16988 0x11/imm32/alloc-id $Mu-register-xmm6/imm32 6/imm32 +16989 0x11/imm32/alloc-id $Mu-register-xmm7/imm32 7/imm32 +16990 +16991 # Like Mu-registers, but with unique codes for integer and floating-point +16992 # registers. +16993 # Don't use this for code-generation, only for checking. +16994 Mu-registers-unique: # (addr stream {(handle array byte), int}) +16995 # a table is a stream +16996 0xa8/imm32/write +16997 0/imm32/read +16998 0xa8/imm32/length +16999 # data +17000 # general-purpose registers +17001 0x11/imm32/alloc-id $Mu-register-eax/imm32 0/imm32 +17002 0x11/imm32/alloc-id $Mu-register-ecx/imm32 1/imm32 +17003 0x11/imm32/alloc-id $Mu-register-edx/imm32 2/imm32 +17004 0x11/imm32/alloc-id $Mu-register-ebx/imm32 3/imm32 +17005 0x11/imm32/alloc-id $Mu-register-esi/imm32 6/imm32 +17006 0x11/imm32/alloc-id $Mu-register-edi/imm32 7/imm32 +17007 # floating-point registers +17008 0x11/imm32/alloc-id $Mu-register-xmm0/imm32 8/imm32 +17009 0x11/imm32/alloc-id $Mu-register-xmm1/imm32 9/imm32 +17010 0x11/imm32/alloc-id $Mu-register-xmm2/imm32 0xa/imm32 +17011 0x11/imm32/alloc-id $Mu-register-xmm3/imm32 0xb/imm32 +17012 0x11/imm32/alloc-id $Mu-register-xmm4/imm32 0xc/imm32 +17013 0x11/imm32/alloc-id $Mu-register-xmm5/imm32 0xd/imm32 +17014 0x11/imm32/alloc-id $Mu-register-xmm6/imm32 0xe/imm32 +17015 0x11/imm32/alloc-id $Mu-register-xmm7/imm32 0xf/imm32 +17016 +17017 $Mu-register-eax: +17018 0x11/imm32/alloc-id +17019 3/imm32/size +17020 0x65/e 0x61/a 0x78/x +17021 +17022 $Mu-register-ecx: +17023 0x11/imm32/alloc-id +17024 3/imm32/size +17025 0x65/e 0x63/c 0x78/x +17026 +17027 $Mu-register-edx: +17028 0x11/imm32/alloc-id +17029 3/imm32/size +17030 0x65/e 0x64/d 0x78/x +17031 +17032 $Mu-register-ebx: +17033 0x11/imm32/alloc-id +17034 3/imm32/size +17035 0x65/e 0x62/b 0x78/x +17036 +17037 $Mu-register-esi: +17038 0x11/imm32/alloc-id +17039 3/imm32/size +17040 0x65/e 0x73/s 0x69/i +17041 +17042 $Mu-register-edi: +17043 0x11/imm32/alloc-id +17044 3/imm32/size +17045 0x65/e 0x64/d 0x69/i +17046 +17047 $Mu-register-xmm0: +17048 0x11/imm32/alloc-id:fake:payload +17049 # "xmm0" +17050 0x4/imm32/size +17051 0x78/x 0x6d/m 0x6d/m 0x30/0 +17052 +17053 $Mu-register-xmm1: +17054 0x11/imm32/alloc-id:fake:payload +17055 # "xmm1" +17056 0x4/imm32/size +17057 0x78/x 0x6d/m 0x6d/m 0x31/1 +17058 +17059 $Mu-register-xmm2: +17060 0x11/imm32/alloc-id:fake:payload +17061 # "xmm2" +17062 0x4/imm32/size +17063 0x78/x 0x6d/m 0x6d/m 0x32/2 +17064 +17065 $Mu-register-xmm3: +17066 0x11/imm32/alloc-id:fake:payload +17067 # "xmm3" +17068 0x4/imm32/size +17069 0x78/x 0x6d/m 0x6d/m 0x33/3 +17070 +17071 $Mu-register-xmm4: +17072 0x11/imm32/alloc-id:fake:payload +17073 # "xmm4" +17074 0x4/imm32/size +17075 0x78/x 0x6d/m 0x6d/m 0x34/4 +17076 +17077 $Mu-register-xmm5: +17078 0x11/imm32/alloc-id:fake:payload +17079 # "xmm5" +17080 0x4/imm32/size +17081 0x78/x 0x6d/m 0x6d/m 0x35/5 +17082 +17083 $Mu-register-xmm6: +17084 0x11/imm32/alloc-id:fake:payload +17085 # "xmm6" +17086 0x4/imm32/size +17087 0x78/x 0x6d/m 0x6d/m 0x36/6 +17088 +17089 $Mu-register-xmm7: +17090 0x11/imm32/alloc-id:fake:payload +17091 # "xmm7" +17092 0x4/imm32/size +17093 0x78/x 0x6d/m 0x6d/m 0x37/7 +17094 +17095 == code +17096 +17097 # push 'out' to 'vars' if not already there; it's assumed to be a fn output +17098 maybe-define-var: # out: (handle var), vars: (addr stack live-var) +17099 # . prologue +17100 55/push-ebp +17101 89/<- %ebp 4/r32/esp +17102 # . save registers +17103 50/push-eax +17104 # var out-addr/eax: (addr var) +17105 (lookup *(ebp+8) *(ebp+0xc)) # => eax +17106 # +17107 (binding-exists? %eax *(ebp+0x10)) # => eax +17108 3d/compare-eax-and 0/imm32/false +17109 75/jump-if-!= $maybe-define-var:end/disp8 +17110 # otherwise update vars +17111 (push *(ebp+0x10) *(ebp+8)) +17112 (push *(ebp+0x10) *(ebp+0xc)) +17113 (push *(ebp+0x10) 0) # 'out' is always a fn output; never spill it +17114 $maybe-define-var:end: +17115 # . restore registers +17116 58/pop-to-eax +17117 # . epilogue +17118 89/<- %esp 5/r32/ebp +17119 5d/pop-to-ebp +17120 c3/return +17121 +17122 # simpler version of lookup-var-helper +17123 binding-exists?: # target: (addr var), vars: (addr stack live-var) -> result/eax: boolean +17124 # pseudocode: +17125 # var curr: (addr handle var) = &vars->data[vars->top - 12] +17126 # var min = vars->data +17127 # while curr >= min +17128 # var v: (handle var) = *curr +17129 # if v->name == target->name +17130 # return true +17131 # curr -= 12 +17132 # return false +17133 # +17134 # . prologue +17135 55/push-ebp +17136 89/<- %ebp 4/r32/esp +17137 # . save registers +17138 51/push-ecx +17139 52/push-edx +17140 56/push-esi +17141 # var target-name/ecx: (addr array byte) = lookup(target->name) +17142 8b/-> *(ebp+8) 0/r32/eax +17143 (lookup *eax *(eax+4)) # Var-name Var-name => eax +17144 89/<- %ecx 0/r32/eax +17145 # esi = vars +17146 8b/-> *(ebp+0xc) 6/r32/esi +17147 # eax = vars->top +17148 8b/-> *esi 0/r32/eax +17149 # var min/edx: (addr handle var) = vars->data +17150 8d/copy-address *(esi+8) 2/r32/edx +17151 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] +17152 8d/copy-address *(esi+eax-4) 6/r32/esi # vars + 8 + vars->type - 12 +17153 { +17154 $binding-exists?:loop: +17155 # if (curr < min) return +17156 39/compare %esi 2/r32/edx +17157 0f 82/jump-if-addr< break/disp32 +17158 # var v/eax: (addr var) = lookup(*curr) +17159 (lookup *esi *(esi+4)) # => eax +17160 # var vn/eax: (addr array byte) = lookup(v->name) +17161 (lookup *eax *(eax+4)) # Var-name Var-name => eax +17162 # if (vn == target-name) return true +17163 (string-equal? %ecx %eax) # => eax +17164 3d/compare-eax-and 0/imm32/false +17165 75/jump-if-!= $binding-exists?:end/disp8 # eax already contains true +17166 # curr -= 12 +17167 81 5/subop/subtract %esi 0xc/imm32 +17168 e9/jump loop/disp32 +17169 } +17170 b8/copy-to-eax 0/imm32/false +17171 $binding-exists?:end: +17172 # . restore registers +17173 5e/pop-to-esi +17174 5a/pop-to-edx +17175 59/pop-to-ecx +17176 # . epilogue +17177 89/<- %esp 5/r32/ebp +17178 5d/pop-to-ebp +17179 c3/return +17180 +17181 test-parse-mu-stmt: +17182 # . prologue +17183 55/push-ebp +17184 89/<- %ebp 4/r32/esp +17185 # setup +17186 8b/-> *Primitive-type-ids 0/r32/eax +17187 89/<- *Type-id 0/r32/eax # stream-write +17188 (clear-stream _test-input-stream) +17189 (write _test-input-stream "increment n\n") +17190 # var vars/ecx: (stack (addr var) 16) +17191 81 5/subop/subtract %esp 0xc0/imm32 +17192 68/push 0xc0/imm32/size +17193 68/push 0/imm32/top +17194 89/<- %ecx 4/r32/esp +17195 (clear-stack %ecx) +17196 # var v/edx: (handle var) +17197 68/push 0/imm32 +17198 68/push 0/imm32 +17199 89/<- %edx 4/r32/esp +17200 # var s/eax: (handle array byte) +17201 68/push 0/imm32 +17202 68/push 0/imm32 +17203 89/<- %eax 4/r32/esp +17204 # v = new var("n") +17205 (copy-array Heap "n" %eax) +17206 (new-var Heap *eax *(eax+4) %edx) +17207 # +17208 (push %ecx *edx) +17209 (push %ecx *(edx+4)) +17210 (push %ecx 0) +17211 # var out/eax: (handle stmt) +17212 68/push 0/imm32 +17213 68/push 0/imm32 +17214 89/<- %eax 4/r32/esp +17215 # convert +17216 (parse-mu-stmt _test-input-stream %ecx 0 %eax Stderr 0) +17217 # var out-addr/edx: (addr stmt) = lookup(*out) +17218 (lookup *eax *(eax+4)) # => eax +17219 89/<- %edx 0/r32/eax +17220 # out->tag +17221 (check-ints-equal *edx 1 "F - test-parse-mu-stmt/tag") # Stmt-tag is Stmt1 +17222 # out->operation +17223 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax +17224 (check-strings-equal %eax "increment" "F - test-parse-mu-stmt/name") # Stmt1-operation +17225 # out->inouts->value->name +17226 # . eax = out->inouts +17227 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +17228 # . eax = out->inouts->value +17229 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +17230 # . eax = out->inouts->value->name +17231 (lookup *eax *(eax+4)) # Var-name Var-name => eax +17232 # . +17233 (check-strings-equal %eax "n" "F - test-parse-mu-stmt/inout:0") +17234 # . epilogue +17235 89/<- %esp 5/r32/ebp +17236 5d/pop-to-ebp +17237 c3/return +17238 +17239 test-parse-mu-stmt-with-comma: +17240 # . prologue +17241 55/push-ebp +17242 89/<- %ebp 4/r32/esp +17243 # setup +17244 8b/-> *Primitive-type-ids 0/r32/eax +17245 89/<- *Type-id 0/r32/eax # stream-write +17246 (clear-stream _test-input-stream) +17247 (write _test-input-stream "copy-to n, 3\n") +17248 # var vars/ecx: (stack (addr var) 16) +17249 81 5/subop/subtract %esp 0xc0/imm32 +17250 68/push 0xc0/imm32/size +17251 68/push 0/imm32/top +17252 89/<- %ecx 4/r32/esp +17253 (clear-stack %ecx) +17254 # var v/edx: (handle var) +17255 68/push 0/imm32 +17256 68/push 0/imm32 +17257 89/<- %edx 4/r32/esp +17258 # var s/eax: (handle array byte) +17259 68/push 0/imm32 +17260 68/push 0/imm32 +17261 89/<- %eax 4/r32/esp +17262 # v = new var("n") +17263 (copy-array Heap "n" %eax) +17264 (new-var Heap *eax *(eax+4) %edx) +17265 # +17266 (push %ecx *edx) +17267 (push %ecx *(edx+4)) +17268 (push %ecx 0) +17269 # var out/eax: (handle stmt) +17270 68/push 0/imm32 +17271 68/push 0/imm32 +17272 89/<- %eax 4/r32/esp +17273 # convert +17274 (parse-mu-stmt _test-input-stream %ecx 0 %eax Stderr 0) +17275 # var out-addr/edx: (addr stmt) = lookup(*out) +17276 (lookup *eax *(eax+4)) # => eax +17277 89/<- %edx 0/r32/eax +17278 # out->tag +17279 (check-ints-equal *edx 1 "F - test-parse-mu-stmt-with-comma/tag") # Stmt-tag is Stmt1 +17280 # out->operation +17281 (lookup *(edx+4) *(edx+8)) # Stmt1-operation Stmt1-operation => eax +17282 (check-strings-equal %eax "copy-to" "F - test-parse-mu-stmt-with-comma/name") # Stmt1-operation +17283 # out->inouts->value->name +17284 # . eax = out->inouts +17285 (lookup *(edx+0xc) *(edx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +17286 # . eax = out->inouts->value +17287 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +17288 # . eax = out->inouts->value->name +17289 (lookup *eax *(eax+4)) # Var-name Var-name => eax +17290 # . +17291 (check-strings-equal %eax "n" "F - test-parse-mu-stmt-with-comma/inout:0") +17292 # . epilogue +17293 89/<- %esp 5/r32/ebp +17294 5d/pop-to-ebp +17295 c3/return +17296 +17297 new-var: # ad: (addr allocation-descriptor), name: (handle array byte), out: (addr handle var) +17298 # . prologue +17299 55/push-ebp +17300 89/<- %ebp 4/r32/esp +17301 # . save registers +17302 50/push-eax +17303 51/push-ecx +17304 # ecx = out +17305 8b/-> *(ebp+0x14) 1/r32/ecx +17306 # +17307 (allocate *(ebp+8) *Var-size %ecx) +17308 # var out-addr/eax: (addr var) +17309 (lookup *ecx *(ecx+4)) # => eax +17310 # out-addr->name = name +17311 8b/-> *(ebp+0xc) 1/r32/ecx +17312 89/<- *eax 1/r32/ecx # Var-name +17313 8b/-> *(ebp+0x10) 1/r32/ecx +17314 89/<- *(eax+4) 1/r32/ecx # Var-name +17315 #? (write-buffered Stderr "var ") +17316 #? (lookup *(ebp+0xc) *(ebp+0x10)) +17317 #? (write-buffered Stderr %eax) +17318 #? (write-buffered Stderr " at ") +17319 #? 8b/-> *(ebp+0x14) 1/r32/ecx +17320 #? (lookup *ecx *(ecx+4)) # => eax +17321 #? (write-int32-hex-buffered Stderr %eax) +17322 #? (write-buffered Stderr Newline) +17323 #? (flush Stderr) +17324 $new-var:end: +17325 # . restore registers +17326 59/pop-to-ecx +17327 58/pop-to-eax +17328 # . epilogue +17329 89/<- %esp 5/r32/ebp +17330 5d/pop-to-ebp +17331 c3/return +17332 +17333 new-literal-integer: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +17334 # . prologue +17335 55/push-ebp +17336 89/<- %ebp 4/r32/esp +17337 # . save registers +17338 50/push-eax +17339 51/push-ecx +17340 # if (!is-hex-int?(name)) abort +17341 (is-hex-int? *(ebp+0xc)) # => eax +17342 3d/compare-eax-and 0/imm32/false +17343 0f 84/jump-if-= $new-literal-integer:abort/disp32 +17344 # a little more error-checking +17345 (check-mu-hex-int *(ebp+0xc) *(ebp+0x18) *(ebp+0x1c)) +17346 # out = new var(s) +17347 (new-var-from-slice *(ebp+8) *(ebp+0xc) *(ebp+0x10)) +17348 # var out-addr/ecx: (addr var) = lookup(*out) +17349 8b/-> *(ebp+0x10) 0/r32/eax +17350 (lookup *eax *(eax+4)) # => eax +17351 89/<- %ecx 0/r32/eax +17352 # out-addr->block-depth = *Curr-block-depth +17353 8b/-> *Curr-block-depth 0/r32/eax +17354 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth +17355 # out-addr->type = new tree() +17356 8d/copy-address *(ecx+8) 0/r32/eax # Var-type +17357 (allocate *(ebp+8) *Type-tree-size %eax) +17358 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +17359 c7 0/subop/copy *eax 1/imm32/true # Type-tree-is-atom +17360 # nothing else to do; default type is 'literal' +17361 $new-literal-integer:end: +17362 # . reclaim locals +17363 81 0/subop/add %esp 8/imm32 +17364 # . restore registers +17365 59/pop-to-ecx +17366 58/pop-to-eax +17367 # . epilogue +17368 89/<- %esp 5/r32/ebp +17369 5d/pop-to-ebp +17370 c3/return +17371 +17372 $new-literal-integer:abort: +17373 (write-buffered *(ebp+0x18) "fn ") +17374 8b/-> *(ebp+0x14) 0/r32/eax +17375 (lookup *eax *(eax+4)) # Function-name Function-name => eax +17376 (write-buffered *(ebp+0x18) %eax) +17377 (write-buffered *(ebp+0x18) ": variable '") +17378 (write-slice-buffered *(ebp+0x18) *(ebp+0xc)) +17379 (write-buffered *(ebp+0x18) "' cannot begin with a digit (or do you have a typo in a number?)\n") +17380 (flush *(ebp+0x18)) +17381 (stop *(ebp+0x1c) 1) +17382 # never gets here +17383 +17384 # precondition: name is a valid hex integer; require a '0x' prefix +17385 check-mu-hex-int: # name: (addr slice), err: (addr buffered-file), ed: (addr exit-descriptor) +17386 # . prologue +17387 55/push-ebp +17388 89/<- %ebp 4/r32/esp +17389 # . save registers +17390 50/push-eax +17391 51/push-ecx +17392 52/push-edx +17393 # ecx = name +17394 8b/-> *(ebp+8) 1/r32/ecx +17395 # var start/edx: (addr byte) = name->start +17396 8b/-> *ecx 2/r32/edx +17397 # if (*start == '-') ++start +17398 b8/copy-to-eax 0/imm32 +17399 8a/copy-byte *edx 0/r32/AL +17400 3d/compare-eax-and 0x2d/imm32/dash +17401 { +17402 75/jump-if-!= break/disp8 +17403 42/increment-edx +17404 } +17405 # var end/ecx: (addr byte) = name->end +17406 8b/-> *(ecx+4) 1/r32/ecx +17407 # var len/eax: int = name->end - name->start +17408 89/<- %eax 1/r32/ecx +17409 29/subtract-from %eax 2/r32/edx +17410 # if (len <= 1) return +17411 3d/compare-eax-with 1/imm32 +17412 0f 8e/jump-if-<= $check-mu-hex-int:end/disp32 +17413 $check-mu-hex-int:length->-1: +17414 # if slice-starts-with?({start, end}, "0x") return +17415 # . var tmp = {start, end} +17416 51/push-ecx +17417 52/push-edx +17418 89/<- %eax 4/r32/esp +17419 # . +17420 (slice-starts-with? %eax "0x") # => eax +17421 # . reclaim tmp +17422 81 0/subop/add %esp 8/imm32 +17423 # . +17424 3d/compare-eax-with 0/imm32/false +17425 75/jump-if-!= $check-mu-hex-int:end/disp8 +17426 $check-mu-hex-int:abort: +17427 # otherwise abort +17428 (write-buffered *(ebp+0xc) "literal integers are always hex in Mu; start '") +17429 (write-slice-buffered *(ebp+0xc) *(ebp+8)) +17430 (write-buffered *(ebp+0xc) "' with a '0x' to be unambiguous, converting it to hexadecimal as necessary.\n") +17431 (flush *(ebp+0xc)) +17432 (stop *(ebp+0x10) 1) +17433 $check-mu-hex-int:end: +17434 # . restore registers +17435 5a/pop-to-edx +17436 59/pop-to-ecx +17437 58/pop-to-eax +17438 # . epilogue +17439 89/<- %esp 5/r32/ebp +17440 5d/pop-to-ebp +17441 c3/return +17442 +17443 new-literal: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) +17444 # . prologue +17445 55/push-ebp +17446 89/<- %ebp 4/r32/esp +17447 # . save registers +17448 50/push-eax +17449 51/push-ecx +17450 # var s/ecx: (handle array byte) +17451 68/push 0/imm32 +17452 68/push 0/imm32 +17453 89/<- %ecx 4/r32/esp +17454 # s = slice-to-string(name) +17455 (slice-to-string Heap *(ebp+0xc) %ecx) +17456 # allocate to out +17457 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) +17458 # var out-addr/ecx: (addr var) = lookup(*out) +17459 8b/-> *(ebp+0x10) 1/r32/ecx +17460 (lookup *ecx *(ecx+4)) # => eax +17461 89/<- %ecx 0/r32/eax +17462 # out-addr->block-depth = *Curr-block-depth +17463 8b/-> *Curr-block-depth 0/r32/eax +17464 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth +17465 # out-addr->type/eax = new type +17466 8d/copy-address *(ecx+8) 0/r32/eax # Var-type +17467 (allocate *(ebp+8) *Type-tree-size %eax) +17468 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +17469 # nothing else to do; default type is 'literal' +17470 c7 0/subop/copy *eax 1/imm32/true # Type-tree-is-atom +17471 $new-literal:end: +17472 # . reclaim locals +17473 81 0/subop/add %esp 8/imm32 +17474 # . restore registers +17475 59/pop-to-ecx +17476 58/pop-to-eax +17477 # . epilogue +17478 89/<- %esp 5/r32/ebp +17479 5d/pop-to-ebp +17480 c3/return +17481 +17482 new-literal-string: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) +17483 # . prologue +17484 55/push-ebp +17485 89/<- %ebp 4/r32/esp +17486 # . save registers +17487 50/push-eax +17488 51/push-ecx +17489 # var s/ecx: (handle array byte) +17490 68/push 0/imm32 +17491 68/push 0/imm32 +17492 89/<- %ecx 4/r32/esp +17493 # s = slice-to-string(name) +17494 (slice-to-string Heap *(ebp+0xc) %ecx) +17495 # allocate to out +17496 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) +17497 # var out-addr/ecx: (addr var) = lookup(*out) +17498 8b/-> *(ebp+0x10) 1/r32/ecx +17499 (lookup *ecx *(ecx+4)) # => eax +17500 89/<- %ecx 0/r32/eax +17501 # out-addr->block-depth = *Curr-block-depth +17502 8b/-> *Curr-block-depth 0/r32/eax +17503 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth +17504 # out-addr->type/eax = new type +17505 8d/copy-address *(ecx+8) 0/r32/eax # Var-type +17506 (allocate *(ebp+8) *Type-tree-size %eax) +17507 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +17508 # out-addr->type->value = literal-string +17509 c7 0/subop/copy *(eax+4) 0x10/imm32/type-id-string-literal # Type-tree-value +17510 # out-addr->type->is-atom? = true +17511 c7 0/subop/copy *eax 1/imm32/true # Type-tree-is-atom +17512 $new-literal-string:end: +17513 # . reclaim locals +17514 81 0/subop/add %esp 8/imm32 +17515 # . restore registers +17516 59/pop-to-ecx +17517 58/pop-to-eax +17518 # . epilogue +17519 89/<- %esp 5/r32/ebp +17520 5d/pop-to-ebp +17521 c3/return +17522 +17523 new-var-from-slice: # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var) +17524 # . prologue +17525 55/push-ebp +17526 89/<- %ebp 4/r32/esp +17527 # . save registers +17528 51/push-ecx +17529 # var tmp/ecx: (handle array byte) +17530 68/push 0/imm32 +17531 68/push 0/imm32 +17532 89/<- %ecx 4/r32/esp +17533 # tmp = slice-to-string(name) +17534 (slice-to-string Heap *(ebp+0xc) %ecx) +17535 # out = new-var(tmp) +17536 (new-var *(ebp+8) *ecx *(ecx+4) *(ebp+0x10)) +17537 $new-var-from-slice:end: +17538 # . reclaim locals +17539 81 0/subop/add %esp 8/imm32 +17540 # . restore registers +17541 59/pop-to-ecx +17542 # . epilogue +17543 89/<- %esp 5/r32/ebp +17544 5d/pop-to-ebp +17545 c3/return +17546 +17547 new-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) +17548 # . prologue +17549 55/push-ebp +17550 89/<- %ebp 4/r32/esp +17551 # . save registers +17552 50/push-eax +17553 51/push-ecx +17554 # +17555 (allocate *(ebp+8) *Stmt-size *(ebp+0x14)) +17556 # var out-addr/eax: (addr stmt) = lookup(*out) +17557 8b/-> *(ebp+0x14) 0/r32/eax +17558 (lookup *eax *(eax+4)) # => eax +17559 # out-addr->tag = stmt +17560 c7 0/subop/copy *eax 2/imm32/tag/var-on-stack # Stmt-tag +17561 # result->var = var +17562 8b/-> *(ebp+0xc) 1/r32/ecx +17563 89/<- *(eax+4) 1/r32/ecx # Vardef-var +17564 8b/-> *(ebp+0x10) 1/r32/ecx +17565 89/<- *(eax+8) 1/r32/ecx # Vardef-var +17566 $new-var-def:end: +17567 # . restore registers +17568 59/pop-to-ecx +17569 58/pop-to-eax +17570 # . epilogue +17571 89/<- %esp 5/r32/ebp +17572 5d/pop-to-ebp +17573 c3/return +17574 +17575 new-reg-var-def: # ad: (addr allocation-descriptor), var: (handle var), out: (addr handle stmt) +17576 # . prologue +17577 55/push-ebp +17578 89/<- %ebp 4/r32/esp +17579 # . save registers +17580 50/push-eax +17581 # eax = out +17582 8b/-> *(ebp+0x14) 0/r32/eax +17583 # +17584 (allocate *(ebp+8) *Stmt-size %eax) +17585 # var out-addr/eax: (addr stmt) = lookup(*out) +17586 (lookup *eax *(eax+4)) # => eax +17587 # set tag +17588 c7 0/subop/copy *eax 3/imm32/tag/var-in-register # Stmt-tag +17589 # set output +17590 8d/copy-address *(eax+0x14) 0/r32/eax # Regvardef-outputs +17591 (append-stmt-var Heap *(ebp+0xc) *(ebp+0x10) 0 0 0 %eax) +17592 $new-reg-var-def:end: +17593 # . restore registers +17594 58/pop-to-eax +17595 # . epilogue +17596 89/<- %esp 5/r32/ebp +17597 5d/pop-to-ebp +17598 c3/return +17599 +17600 append-list: # ad: (addr allocation-descriptor), value: (handle _type), list: (handle list _type), out: (addr handle list _type) +17601 # . prologue +17602 55/push-ebp +17603 89/<- %ebp 4/r32/esp +17604 # . save registers +17605 50/push-eax +17606 51/push-ecx +17607 57/push-edi +17608 # edi = out +17609 8b/-> *(ebp+0x1c) 7/r32/edi +17610 # *out = new list +17611 (allocate *(ebp+8) *List-size %edi) +17612 # var out-addr/edi: (addr list _type) = lookup(*out) +17613 (lookup *edi *(edi+4)) # => eax +17614 89/<- %edi 0/r32/eax +17615 # out-addr->value = value +17616 8b/-> *(ebp+0xc) 0/r32/eax +17617 89/<- *edi 0/r32/eax # List-value +17618 8b/-> *(ebp+0x10) 0/r32/eax +17619 89/<- *(edi+4) 0/r32/eax # List-value +17620 # if (list == null) return +17621 81 7/subop/compare *(ebp+0x14) 0/imm32 +17622 74/jump-if-= $append-list:end/disp8 +17623 # otherwise append +17624 $append-list:non-empty-list: +17625 # var curr/eax: (addr list _type) = lookup(list) +17626 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax +17627 # while (curr->next != null) curr = curr->next +17628 { +17629 81 7/subop/compare *(eax+8) 0/imm32 # List-next +17630 74/jump-if-= break/disp8 +17631 # curr = lookup(curr->next) +17632 (lookup *(eax+8) *(eax+0xc)) # List-next, List-next => eax +17633 # +17634 eb/jump loop/disp8 +17635 } +17636 # edi = out +17637 8b/-> *(ebp+0x1c) 7/r32/edi +17638 # curr->next = out +17639 8b/-> *edi 1/r32/ecx +17640 89/<- *(eax+8) 1/r32/ecx # List-next +17641 8b/-> *(edi+4) 1/r32/ecx +17642 89/<- *(eax+0xc) 1/r32/ecx # List-next +17643 # out = list +17644 8b/-> *(ebp+0x14) 1/r32/ecx +17645 89/<- *edi 1/r32/ecx +17646 8b/-> *(ebp+0x18) 1/r32/ecx +17647 89/<- *(edi+4) 1/r32/ecx +17648 $append-list:end: +17649 # . restore registers +17650 5f/pop-to-edi +17651 59/pop-to-ecx +17652 58/pop-to-eax +17653 # . epilogue +17654 89/<- %esp 5/r32/ebp +17655 5d/pop-to-ebp +17656 c3/return +17657 +17658 append-stmt-var: # ad: (addr allocation-descriptor), v: (handle var), vars: (handle stmt-var), is-deref?: boolean, out: (addr handle stmt-var) +17659 # . prologue +17660 55/push-ebp +17661 89/<- %ebp 4/r32/esp +17662 # . save registers +17663 50/push-eax +17664 51/push-ecx +17665 57/push-edi +17666 # edi = out +17667 8b/-> *(ebp+0x20) 7/r32/edi +17668 # out = new stmt-var +17669 (allocate *(ebp+8) *Stmt-var-size %edi) +17670 # var out-addr/ecx: (addr stmt-var) = lookup(*out) +17671 (lookup *edi *(edi+4)) # => eax +17672 89/<- %ecx 0/r32/eax +17673 # out-addr->value = v +17674 8b/-> *(ebp+0xc) 0/r32/eax +17675 89/<- *ecx 0/r32/eax # Stmt-var-value +17676 8b/-> *(ebp+0x10) 0/r32/eax +17677 89/<- *(ecx+4) 0/r32/eax # Stmt-var-value +17678 # out-addr->is-deref? = is-deref? +17679 8b/-> *(ebp+0x1c) 0/r32/eax +17680 89/<- *(ecx+0x10) 0/r32/eax # Stmt-var-is-deref +17681 # if (vars == null) return result +17682 81 7/subop/compare *(ebp+0x14) 0/imm32/null +17683 74/jump-if-= $append-stmt-var:end/disp8 +17684 # otherwise append +17685 # var curr/eax: (addr stmt-var) = lookup(vars) +17686 (lookup *(ebp+0x14) *(ebp+0x18)) # => eax +17687 # while (curr->next != null) curr = curr->next +17688 { +17689 81 7/subop/compare *(eax+8) 0/imm32 # Stmt-var-next +17690 74/jump-if-= break/disp8 +17691 # curr = lookup(curr->next) +17692 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next, Stmt-var-next => eax +17693 # +17694 eb/jump loop/disp8 +17695 } +17696 # curr->next = out +17697 8b/-> *edi 1/r32/ecx +17698 89/<- *(eax+8) 1/r32/ecx # Stmt-var-next +17699 8b/-> *(edi+4) 1/r32/ecx +17700 89/<- *(eax+0xc) 1/r32/ecx # Stmt-var-next +17701 # out = vars +17702 8b/-> *(ebp+0x14) 1/r32/ecx +17703 89/<- *edi 1/r32/ecx +17704 8b/-> *(ebp+0x18) 1/r32/ecx +17705 89/<- *(edi+4) 1/r32/ecx +17706 $append-stmt-var:end: +17707 # . restore registers +17708 5f/pop-to-edi +17709 59/pop-to-ecx +17710 58/pop-to-eax +17711 # . epilogue +17712 89/<- %esp 5/r32/ebp +17713 5d/pop-to-ebp +17714 c3/return +17715 +17716 append-to-block: # ad: (addr allocation-descriptor), block: (addr block), x: (handle stmt) +17717 # . prologue +17718 55/push-ebp +17719 89/<- %ebp 4/r32/esp +17720 # . save registers +17721 50/push-eax +17722 56/push-esi +17723 # esi = block +17724 8b/-> *(ebp+0xc) 6/r32/esi +17725 # block->stmts = append(x, block->stmts) +17726 8d/copy-address *(esi+4) 0/r32/eax # Block-stmts +17727 (append-list *(ebp+8) *(ebp+0x10) *(ebp+0x14) *(esi+4) *(esi+8) %eax) # ad, x, x, Block-stmts, Block-stmts +17728 $append-to-block:end: +17729 # . restore registers +17730 5e/pop-to-esi +17731 58/pop-to-eax +17732 # . epilogue +17733 89/<- %esp 5/r32/ebp +17734 5d/pop-to-ebp +17735 c3/return +17736 +17737 ## Parsing types +17738 # We need to create metadata on user-defined types, and we need to use this +17739 # metadata as we parse instructions. +17740 # However, we also want to allow types to be used before their definitions. +17741 # This means we can't ever assume any type data structures exist. +17742 +17743 lookup-or-create-constant: # container: (addr stmt-var), field-name: (addr slice), out: (addr handle var) +17744 # . prologue +17745 55/push-ebp +17746 89/<- %ebp 4/r32/esp +17747 # . save registers +17748 50/push-eax +17749 56/push-esi +17750 # var container-type/esi: type-id +17751 (container-type *(ebp+8)) # => eax +17752 89/<- %esi 0/r32/eax +17753 # var tmp/eax: (handle typeinfo) = find-or-create-typeinfo(container-type) +17754 68/push 0/imm32 +17755 68/push 0/imm32 +17756 89/<- %eax 4/r32/esp +17757 (find-or-create-typeinfo %esi %eax) +17758 # var tmp-addr/eax: (addr typeinfo) = lookup(tmp) +17759 (lookup *eax *(eax+4)) # => eax +17760 # result = find-or-create-typeinfo-output-var(typeinfo, field-name) +17761 #? (write-buffered Stderr "constant: ") +17762 #? (write-slice-buffered Stderr *(ebp+0xc)) +17763 #? (write-buffered Stderr Newline) +17764 #? (flush Stderr) +17765 (find-or-create-typeinfo-output-var %eax *(ebp+0xc) *(ebp+0x10)) +17766 #? 8b/-> *(ebp+0x10) 0/r32/eax +17767 #? (write-buffered Stderr "@") +17768 #? (lookup *eax *(eax+4)) +17769 #? (write-int32-hex-buffered Stderr %eax) +17770 #? (lookup *eax *(eax+4)) +17771 #? (write-buffered Stderr %eax) +17772 #? (write-buffered Stderr Newline) +17773 #? (flush Stderr) +17774 #? (write-buffered Stderr "offset: ") +17775 #? 8b/-> *(eax+0x14) 0/r32/eax +17776 #? (write-int32-hex-buffered Stderr %eax) +17777 #? (write-buffered Stderr Newline) +17778 #? (flush Stderr) +17779 $lookup-or-create-constant:end: +17780 # . reclaim locals +17781 81 0/subop/add %esp 8/imm32 +17782 # . restore registers +17783 5e/pop-to-esi +17784 58/pop-to-eax +17785 # . epilogue +17786 89/<- %esp 5/r32/ebp +17787 5d/pop-to-ebp +17788 c3/return +17789 +17790 # if addr var: +17791 # container->var->type->right->left->value +17792 # otherwise +17793 # container->var->type->value +17794 container-type: # container: (addr stmt-var) -> result/eax: type-id +17795 # . prologue +17796 55/push-ebp +17797 89/<- %ebp 4/r32/esp +17798 # +17799 8b/-> *(ebp+8) 0/r32/eax +17800 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +17801 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +17802 { +17803 81 7/subop/compare *(eax+8) 0/imm32 # Type-tree-right +17804 74/jump-if-= break/disp8 +17805 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +17806 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +17807 } +17808 8b/-> *(eax+4) 0/r32/eax # Type-tree-value +17809 $container-type:end: +17810 # . epilogue +17811 89/<- %esp 5/r32/ebp +17812 5d/pop-to-ebp +17813 c3/return +17814 +17815 is-container?: # t: type-id -> result/eax: boolean +17816 # . prologue +17817 55/push-ebp +17818 89/<- %ebp 4/r32/esp +17819 # +17820 8b/-> *(ebp+8) 0/r32/eax +17821 c1/shift 4/subop/left %eax 2/imm8 +17822 3b/compare 0/r32/eax *Primitive-type-ids +17823 0f 9d/set-if->= %al +17824 81 4/subop/and %eax 0xff/imm32 +17825 $is-container?:end: +17826 # . epilogue +17827 89/<- %esp 5/r32/ebp +17828 5d/pop-to-ebp +17829 c3/return +17830 +17831 find-or-create-typeinfo: # t: type-id, out: (addr handle typeinfo) +17832 # . prologue +17833 55/push-ebp +17834 89/<- %ebp 4/r32/esp +17835 # . save registers +17836 50/push-eax +17837 51/push-ecx +17838 52/push-edx +17839 57/push-edi +17840 # edi = out +17841 8b/-> *(ebp+0xc) 7/r32/edi +17842 # var fields/ecx: (handle table (handle array byte) (handle typeinfo-entry)) +17843 68/push 0/imm32 +17844 68/push 0/imm32 +17845 89/<- %ecx 4/r32/esp +17846 # find-typeinfo(t, out) +17847 (find-typeinfo *(ebp+8) %edi) +17848 { +17849 # if (*out != 0) break +17850 81 7/subop/compare *edi 0/imm32 +17851 0f 85/jump-if-!= break/disp32 +17852 $find-or-create-typeinfo:create: +17853 # *out = allocate +17854 (allocate Heap *Typeinfo-size %edi) +17855 # var tmp/eax: (addr typeinfo) = lookup(*out) +17856 (lookup *edi *(edi+4)) # => eax +17857 #? (write-buffered Stderr "created typeinfo at ") +17858 #? (write-int32-hex-buffered Stderr %eax) +17859 #? (write-buffered Stderr " for type-id ") +17860 #? (write-int32-hex-buffered Stderr *(ebp+8)) +17861 #? (write-buffered Stderr Newline) +17862 #? (flush Stderr) +17863 # tmp->id = t +17864 8b/-> *(ebp+8) 2/r32/edx +17865 89/<- *eax 2/r32/edx # Typeinfo-id +17866 # tmp->fields = new table +17867 # . fields = new table +17868 (new-stream Heap 0x40 *Typeinfo-fields-row-size %ecx) +17869 # . tmp->fields = fields +17870 8b/-> *ecx 2/r32/edx +17871 89/<- *(eax+4) 2/r32/edx # Typeinfo-fields +17872 8b/-> *(ecx+4) 2/r32/edx +17873 89/<- *(eax+8) 2/r32/edx # Typeinfo-fields +17874 # tmp->next = Program->types +17875 8b/-> *_Program-types 1/r32/ecx +17876 89/<- *(eax+0x10) 1/r32/ecx # Typeinfo-next +17877 8b/-> *_Program-types->payload 1/r32/ecx +17878 89/<- *(eax+0x14) 1/r32/ecx # Typeinfo-next +17879 # Program->types = out +17880 8b/-> *edi 1/r32/ecx +17881 89/<- *_Program-types 1/r32/ecx +17882 8b/-> *(edi+4) 1/r32/ecx +17883 89/<- *_Program-types->payload 1/r32/ecx +17884 } +17885 $find-or-create-typeinfo:end: +17886 # . reclaim locals +17887 81 0/subop/add %esp 8/imm32 +17888 # . restore registers +17889 5f/pop-to-edi +17890 5a/pop-to-edx +17891 59/pop-to-ecx +17892 58/pop-to-eax +17893 # . epilogue +17894 89/<- %esp 5/r32/ebp +17895 5d/pop-to-ebp +17896 c3/return +17897 +17898 find-typeinfo: # t: type-id, out: (addr handle typeinfo) +17899 # . prologue +17900 55/push-ebp +17901 89/<- %ebp 4/r32/esp +17902 # . save registers +17903 50/push-eax +17904 51/push-ecx +17905 52/push-edx +17906 57/push-edi +17907 # ecx = t +17908 8b/-> *(ebp+8) 1/r32/ecx +17909 # edi = out +17910 8b/-> *(ebp+0xc) 7/r32/edi +17911 # *out = Program->types +17912 8b/-> *_Program-types 0/r32/eax +17913 89/<- *edi 0/r32/eax +17914 8b/-> *_Program-types->payload 0/r32/eax +17915 89/<- *(edi+4) 0/r32/eax +17916 { +17917 $find-typeinfo:loop: +17918 # if (*out == 0) break +17919 81 7/subop/compare *edi 0/imm32 +17920 74/jump-if-= break/disp8 +17921 $find-typeinfo:check: +17922 # var tmp/eax: (addr typeinfo) = lookup(*out) +17923 (lookup *edi *(edi+4)) # => eax +17924 # if (tmp->id == t) break +17925 39/compare *eax 1/r32/ecx # Typeinfo-id +17926 74/jump-if-= break/disp8 +17927 $find-typeinfo:continue: +17928 # *out = tmp->next +17929 8b/-> *(eax+0x10) 2/r32/edx # Typeinfo-next +17930 89/<- *edi 2/r32/edx +17931 8b/-> *(eax+0x14) 2/r32/edx # Typeinfo-next +17932 89/<- *(edi+4) 2/r32/edx +17933 # +17934 eb/jump loop/disp8 +17935 } +17936 $find-typeinfo:end: +17937 # . restore registers +17938 5f/pop-to-edi +17939 5a/pop-to-edx +17940 59/pop-to-ecx +17941 58/pop-to-eax +17942 # . epilogue +17943 89/<- %esp 5/r32/ebp +17944 5d/pop-to-ebp +17945 c3/return +17946 +17947 find-or-create-typeinfo-output-var: # T: (addr typeinfo), f: (addr slice), out: (addr handle var) +17948 # . prologue +17949 55/push-ebp +17950 89/<- %ebp 4/r32/esp +17951 # . save registers +17952 50/push-eax +17953 52/push-edx +17954 57/push-edi +17955 # var dest/edi: (handle typeinfo-entry) +17956 68/push 0/imm32 +17957 68/push 0/imm32 +17958 89/<- %edi 4/r32/esp +17959 # find-or-create-typeinfo-fields(T, f, dest) +17960 (find-or-create-typeinfo-fields *(ebp+8) *(ebp+0xc) %edi) +17961 # var dest-addr/edi: (addr typeinfo-entry) = lookup(dest) +17962 (lookup *edi *(edi+4)) # => eax +17963 89/<- %edi 0/r32/eax +17964 # if dest-addr->output-var doesn't exist, create it +17965 { +17966 81 7/subop/compare *(edi+0xc) 0/imm32 # Typeinfo-entry-output-var +17967 0f 85/jump-if-!= break/disp32 +17968 # dest-addr->output-var = new var(dummy name, type, -1 offset) +17969 # . var name/eax: (handle array byte) = "field" +17970 68/push 0/imm32 +17971 68/push 0/imm32 +17972 89/<- %eax 4/r32/esp +17973 (slice-to-string Heap *(ebp+0xc) %eax) +17974 # . new var +17975 8d/copy-address *(edi+0xc) 2/r32/edx +17976 (new-var Heap *eax *(eax+4) %edx) +17977 # . reclaim name +17978 81 0/subop/add %esp 8/imm32 +17979 # var result/edx: (addr var) = lookup(dest-addr->output-var) +17980 (lookup *(edi+0xc) *(edi+0x10)) # => eax +17981 89/<- %edx 0/r32/eax +17982 # result->type = new constant type +17983 8d/copy-address *(edx+8) 0/r32/eax # Var-type +17984 (allocate Heap *Type-tree-size %eax) +17985 (lookup *(edx+8) *(edx+0xc)) # => eax +17986 c7 0/subop/copy *eax 1/imm32/true # Type-tree-is-atom +17987 c7 0/subop/copy *(eax+4) 6/imm32/constant # Type-tree-value +17988 c7 0/subop/copy *(eax+8) 0/imm32 # Type-tree-left +17989 c7 0/subop/copy *(eax+0xc) 0/imm32 # Type-tree-right +17990 c7 0/subop/copy *(eax+0x10) 0/imm32 # Type-tree-right +17991 # result->offset isn't filled out yet +17992 c7 0/subop/copy *(edx+0x14) -1/imm32/uninitialized # Var-offset +17993 } +17994 # out = dest-addr->output-var +17995 8b/-> *(ebp+0x10) 2/r32/edx +17996 8b/-> *(edi+0xc) 0/r32/eax # Typeinfo-entry-output-var +17997 89/<- *edx 0/r32/eax +17998 8b/-> *(edi+0x10) 0/r32/eax # Typeinfo-entry-output-var +17999 89/<- *(edx+4) 0/r32/eax +18000 $find-or-create-typeinfo-output-var:end: +18001 # . reclaim locals +18002 81 0/subop/add %esp 8/imm32 +18003 # . restore registers +18004 5f/pop-to-edi +18005 5a/pop-to-edx +18006 58/pop-to-eax +18007 # . epilogue +18008 89/<- %esp 5/r32/ebp +18009 5d/pop-to-ebp +18010 c3/return +18011 +18012 find-or-create-typeinfo-fields: # T: (addr typeinfo), f: (addr slice), out: (addr handle typeinfo-entry) +18013 # . prologue +18014 55/push-ebp +18015 89/<- %ebp 4/r32/esp +18016 # . save registers +18017 50/push-eax +18018 56/push-esi +18019 57/push-edi +18020 # eax = lookup(T->fields) +18021 8b/-> *(ebp+8) 0/r32/eax +18022 (lookup *(eax+4) *(eax+8)) # Typeinfo-fields Typeinfo-fields => eax +18023 # edi = out +18024 8b/-> *(ebp+0x10) 7/r32/edi +18025 # var src/esi: (addr handle typeinfo-entry) = get-or-insert-slice(T->fields, f) +18026 (get-or-insert-slice %eax *(ebp+0xc) *Typeinfo-fields-row-size Heap) # => eax +18027 89/<- %esi 0/r32/eax +18028 # if src doesn't exist, allocate it +18029 { +18030 81 7/subop/compare *esi 0/imm32 +18031 75/jump-if-!= break/disp8 +18032 (allocate Heap *Typeinfo-entry-size %esi) +18033 #? (write-buffered Stderr "handle at ") +18034 #? (write-int32-hex-buffered Stderr %esi) +18035 #? (write-buffered Stderr ": ") +18036 #? (write-int32-hex-buffered Stderr *esi) +18037 #? (write-buffered Stderr " ") +18038 #? (write-int32-hex-buffered Stderr *(esi+4)) +18039 #? (write-buffered Stderr Newline) +18040 #? (flush Stderr) +18041 #? (lookup *esi *(esi+4)) +18042 #? (write-buffered Stderr "created typeinfo fields at ") +18043 #? (write-int32-hex-buffered Stderr %esi) +18044 #? (write-buffered Stderr " for ") +18045 #? (write-int32-hex-buffered Stderr *(ebp+8)) +18046 #? (write-buffered Stderr Newline) +18047 #? (flush Stderr) +18048 } +18049 # *out = src +18050 # . *edi = *src +18051 8b/-> *esi 0/r32/eax +18052 89/<- *edi 0/r32/eax +18053 8b/-> *(esi+4) 0/r32/eax +18054 89/<- *(edi+4) 0/r32/eax +18055 $find-or-create-typeinfo-fields:end: +18056 # . restore registers +18057 5f/pop-to-edi +18058 5e/pop-to-esi +18059 58/pop-to-eax +18060 # . epilogue +18061 89/<- %esp 5/r32/ebp +18062 5d/pop-to-ebp +18063 c3/return +18064 +18065 populate-mu-type: # in: (addr stream byte), t: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) +18066 # pseudocode: +18067 # var line: (stream byte 512) +18068 # curr-index = 0 +18069 # while true +18070 # clear-stream(line) +18071 # read-line-buffered(in, line) +18072 # if line->write == 0 +18073 # abort +18074 # word-slice = next-mu-token(line) +18075 # if slice-empty?(word-slice) # end of line +18076 # continue +18077 # if slice-equal?(word-slice, "}") +18078 # break +18079 # var v: (handle var) = parse-var-with-type(word-slice, line) +18080 # var r: (handle typeinfo-fields) = find-or-create-typeinfo-fields(t, word-slice/v->name) +18081 # TODO: ensure that r->first is null +18082 # r->index = curr-index +18083 # curr-index++ +18084 # r->input-var = v +18085 # if r->output-var == 0 +18086 # r->output-var = new literal +18087 # TODO: ensure nothing else in line +18088 # t->total-size-in-bytes = -2 (not yet initialized) +18089 # +18090 # . prologue +18091 55/push-ebp +18092 89/<- %ebp 4/r32/esp +18093 # var curr-index: int at *(ebp-4) +18094 68/push 0/imm32 +18095 # . save registers +18096 50/push-eax +18097 51/push-ecx +18098 52/push-edx +18099 53/push-ebx +18100 56/push-esi +18101 57/push-edi +18102 # edi = t +18103 8b/-> *(ebp+0xc) 7/r32/edi +18104 # var line/ecx: (stream byte 512) +18105 81 5/subop/subtract %esp 0x200/imm32 +18106 68/push 0x200/imm32/size +18107 68/push 0/imm32/read +18108 68/push 0/imm32/write +18109 89/<- %ecx 4/r32/esp +18110 # var word-slice/edx: slice +18111 68/push 0/imm32/end +18112 68/push 0/imm32/start +18113 89/<- %edx 4/r32/esp +18114 # var v/esi: (handle var) +18115 68/push 0/imm32 +18116 68/push 0/imm32 +18117 89/<- %esi 4/r32/esp +18118 # var r/ebx: (handle typeinfo-entry) +18119 68/push 0/imm32 +18120 68/push 0/imm32 +18121 89/<- %ebx 4/r32/esp +18122 { +18123 $populate-mu-type:line-loop: +18124 (clear-stream %ecx) +18125 (read-line-buffered *(ebp+8) %ecx) +18126 # if (line->write == 0) abort +18127 81 7/subop/compare *ecx 0/imm32 +18128 0f 84/jump-if-= $populate-mu-type:error1/disp32 +18129 +-- 6 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +18135 (next-mu-token %ecx %edx) +18136 # if slice-empty?(word-slice) continue +18137 (slice-empty? %edx) # => eax +18138 3d/compare-eax-and 0/imm32 +18139 0f 85/jump-if-!= loop/disp32 +18140 # if slice-equal?(word-slice, "}") break +18141 (slice-equal? %edx "}") +18142 3d/compare-eax-and 0/imm32 +18143 0f 85/jump-if-!= break/disp32 +18144 $populate-mu-type:parse-element: +18145 # v = parse-var-with-type(word-slice, first-line) +18146 # must do this first to strip the trailing ':' from word-slice before +18147 # using it in find-or-create-typeinfo-fields below +18148 # TODO: clean up that mutation in parse-var-with-type +18149 (parse-var-with-type %edx %ecx %esi *(ebp+0x10) *(ebp+0x14)) +18150 # if v is an addr, abort +18151 (lookup *esi *(esi+4)) # => eax +18152 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +18153 (is-mu-addr-type? %eax) # => eax +18154 3d/compare-eax-and 0/imm32/false +18155 0f 85/jump-if-!= $populate-mu-type:error2/disp32 +18156 # if v is an array, abort (we could support it, but initialization gets complex) +18157 (lookup *esi *(esi+4)) # => eax +18158 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +18159 (is-mu-array-type? %eax) # => eax +18160 3d/compare-eax-and 0/imm32/false +18161 0f 85/jump-if-!= $populate-mu-type:error3/disp32 +18162 # if v is a byte, abort +18163 (lookup *esi *(esi+4)) # => eax +18164 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +18165 (is-simple-mu-type? %eax 8) # byte => eax +18166 3d/compare-eax-and 0/imm32/false +18167 0f 85/jump-if-!= $populate-mu-type:error4/disp32 +18168 # if v is a slice, abort +18169 (lookup *esi *(esi+4)) # => eax +18170 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +18171 (is-simple-mu-type? %eax 0xc) # slice => eax +18172 3d/compare-eax-and 0/imm32/false +18173 0f 85/jump-if-!= $populate-mu-type:error5/disp32 +18174 # if v is a stream, abort (we could support it, but initialization gets even more complex) +18175 (lookup *esi *(esi+4)) # => eax +18176 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +18177 (is-mu-stream-type? %eax) # => eax +18178 3d/compare-eax-and 0/imm32/false +18179 0f 85/jump-if-!= $populate-mu-type:error6/disp32 +18180 # var tmp/ecx +18181 51/push-ecx +18182 $populate-mu-type:create-typeinfo-fields: +18183 # var r/ebx: (handle typeinfo-entry) +18184 (find-or-create-typeinfo-fields %edi %edx %ebx) +18185 # r->index = curr-index +18186 (lookup *ebx *(ebx+4)) # => eax +18187 8b/-> *(ebp-4) 1/r32/ecx +18188 #? (write-buffered Stderr "saving index ") +18189 #? (write-int32-hex-buffered Stderr %ecx) +18190 #? (write-buffered Stderr " at ") +18191 #? (write-int32-hex-buffered Stderr %edi) +18192 #? (write-buffered Stderr Newline) +18193 #? (flush Stderr) +18194 89/<- *(eax+8) 1/r32/ecx # Typeinfo-entry-index +18195 # ++curr-index +18196 ff 0/subop/increment *(ebp-4) +18197 $populate-mu-type:set-input-type: +18198 # r->input-var = v +18199 8b/-> *esi 1/r32/ecx +18200 89/<- *eax 1/r32/ecx # Typeinfo-entry-input-var +18201 8b/-> *(esi+4) 1/r32/ecx +18202 89/<- *(eax+4) 1/r32/ecx # Typeinfo-entry-input-var +18203 # restore line +18204 59/pop-to-ecx +18205 { +18206 $populate-mu-type:create-output-type: +18207 # if (r->output-var == 0) create a new var with some placeholder data +18208 81 7/subop/compare *(eax+0xc) 0/imm32 # Typeinfo-entry-output-var +18209 75/jump-if-!= break/disp8 +18210 8d/copy-address *(eax+0xc) 0/r32/eax # Typeinfo-entry-output-var +18211 (new-literal Heap %edx %eax) +18212 } +18213 e9/jump loop/disp32 +18214 } +18215 $populate-mu-type:invalidate-total-size-in-bytes: +18216 # Offsets and total size may not be accurate here since we may not yet +18217 # have encountered the element types. +18218 # We'll recompute them separately after parsing the entire program. +18219 c7 0/subop/copy *(edi+0xc) -2/imm32/uninitialized # Typeinfo-total-size-in-bytes +18220 $populate-mu-type:end: +18221 # . reclaim locals +18222 81 0/subop/add %esp 0x224/imm32 +18223 # . restore registers +18224 5f/pop-to-edi +18225 5e/pop-to-esi +18226 5b/pop-to-ebx +18227 5a/pop-to-edx +18228 59/pop-to-ecx +18229 58/pop-to-eax +18230 # reclaim curr-index +18231 81 0/subop/add %esp 4/imm32 +18232 # . epilogue +18233 89/<- %esp 5/r32/ebp +18234 5d/pop-to-ebp +18235 c3/return +18236 +18237 $populate-mu-type:error1: +18238 # error("incomplete type definition '" t->name "'\n") +18239 (write-buffered *(ebp+0x10) "incomplete type definition '") +18240 (type-name *edi) # Typeinfo-id => eax +18241 (write-buffered *(ebp+0x10) %eax) +18242 (write-buffered *(ebp+0x10) "\n") +18243 (flush *(ebp+0x10)) +18244 (stop *(ebp+0x14) 1) +18245 # never gets here +18246 +18247 $populate-mu-type:error2: +18248 (write-buffered *(ebp+0x10) "type ") +18249 (type-name *edi) # Typeinfo-id => eax +18250 (write-buffered *(ebp+0x10) %eax) +18251 (write-buffered *(ebp+0x10) ": 'addr' elements not allowed\n") +18252 (flush *(ebp+0x10)) +18253 (stop *(ebp+0x14) 1) +18254 # never gets here +18255 +18256 $populate-mu-type:error3: +18257 (write-buffered *(ebp+0x10) "type ") +18258 (type-name *edi) # Typeinfo-id => eax +18259 (write-buffered *(ebp+0x10) %eax) +18260 (write-buffered *(ebp+0x10) ": 'array' elements not allowed for now\n") +18261 (flush *(ebp+0x10)) +18262 (stop *(ebp+0x14) 1) +18263 # never gets here +18264 +18265 $populate-mu-type:error4: +18266 (write-buffered *(ebp+0x10) "type ") +18267 (type-name *edi) # Typeinfo-id => eax +18268 (write-buffered *(ebp+0x10) %eax) +18269 (write-buffered *(ebp+0x10) ": 'byte' elements not allowed\n") +18270 (flush *(ebp+0x10)) +18271 (stop *(ebp+0x14) 1) +18272 # never gets here +18273 +18274 $populate-mu-type:error5: +18275 (write-buffered *(ebp+0x10) "type ") +18276 (type-name *edi) # Typeinfo-id => eax +18277 (write-buffered *(ebp+0x10) %eax) +18278 (write-buffered *(ebp+0x10) ": 'slice' elements not allowed\n") +18279 (flush *(ebp+0x10)) +18280 (stop *(ebp+0x14) 1) +18281 # never gets here +18282 +18283 $populate-mu-type:error6: +18284 (write-buffered *(ebp+0x10) "type ") +18285 (type-name *edi) # Typeinfo-id => eax +18286 (write-buffered *(ebp+0x10) %eax) +18287 (write-buffered *(ebp+0x10) ": 'stream' elements not allowed for now\n") +18288 (flush *(ebp+0x10)) +18289 (stop *(ebp+0x14) 1) +18290 # never gets here +18291 +18292 type-name: # index: int -> result/eax: (addr array byte) +18293 # . prologue +18294 55/push-ebp +18295 89/<- %ebp 4/r32/esp +18296 # +18297 (index Type-id *(ebp+8)) +18298 $type-name:end: +18299 # . epilogue +18300 89/<- %esp 5/r32/ebp +18301 5d/pop-to-ebp +18302 c3/return +18303 +18304 index: # arr: (addr stream (handle array byte)), index: int -> result/eax: (addr array byte) +18305 # . prologue +18306 55/push-ebp +18307 89/<- %ebp 4/r32/esp +18308 # . save registers +18309 56/push-esi +18310 # TODO: bounds-check index +18311 # esi = arr +18312 8b/-> *(ebp+8) 6/r32/esi +18313 # eax = index +18314 8b/-> *(ebp+0xc) 0/r32/eax +18315 # eax = *(arr + 12 + index) +18316 8b/-> *(esi+eax<<2+0xc) 0/r32/eax +18317 $index:end: +18318 # . restore registers +18319 5e/pop-to-esi +18320 # . epilogue +18321 89/<- %esp 5/r32/ebp +18322 5d/pop-to-ebp +18323 c3/return +18324 +18325 ####################################################### +18326 # Compute type sizes +18327 ####################################################### +18328 +18329 # Compute the sizes of all user-defined types. +18330 # We'll need the sizes of their elements, which may be other user-defined +18331 # types, which we will compute as needed. +18332 +18333 # Initially, all user-defined types have their sizes set to -2 (invalid) +18334 populate-mu-type-sizes: # err: (addr buffered-file), ed: (addr exit-descriptor) +18335 # . prologue +18336 55/push-ebp +18337 89/<- %ebp 4/r32/esp +18338 $populate-mu-type-sizes:total-sizes: +18339 # var curr/eax: (addr typeinfo) = lookup(Program->types) +18340 (lookup *_Program-types *_Program-types->payload) # => eax +18341 { +18342 # if (curr == null) break +18343 3d/compare-eax-and 0/imm32/null +18344 74/jump-if-= break/disp8 +18345 (populate-mu-type-sizes-in-type %eax *(ebp+8) *(ebp+0xc)) +18346 # curr = lookup(curr->next) +18347 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax +18348 eb/jump loop/disp8 +18349 } +18350 $populate-mu-type-sizes:offsets: +18351 # curr = *Program->types +18352 (lookup *_Program-types *_Program-types->payload) # => eax +18353 { +18354 # if (curr == null) break +18355 3d/compare-eax-and 0/imm32/null +18356 74/jump-if-= break/disp8 +18357 (populate-mu-type-offsets %eax *(ebp+8) *(ebp+0xc)) +18358 # curr = curr->next +18359 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax +18360 eb/jump loop/disp8 +18361 } +18362 $populate-mu-type-sizes:end: +18363 # . epilogue +18364 89/<- %esp 5/r32/ebp +18365 5d/pop-to-ebp +18366 c3/return +18367 +18368 # compute sizes of all fields, recursing as necessary +18369 # sum up all their sizes to arrive at total size +18370 # fields may be out of order, but that doesn't affect the answer +18371 populate-mu-type-sizes-in-type: # T: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) +18372 # . prologue +18373 55/push-ebp +18374 89/<- %ebp 4/r32/esp +18375 # . save registers +18376 50/push-eax +18377 51/push-ecx +18378 52/push-edx +18379 56/push-esi +18380 57/push-edi +18381 # esi = T +18382 8b/-> *(ebp+8) 6/r32/esi +18383 # if T is already computed, return +18384 81 7/subop/compare *(esi+0xc) 0/imm32 # Typeinfo-total-size-in-bytes +18385 0f 8d/jump-if->= $populate-mu-type-sizes-in-type:end/disp32 +18386 # if T is being computed, abort +18387 81 7/subop/compare *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes +18388 0f 84/jump-if-= $populate-mu-type-sizes-in-type:abort/disp32 +18389 # tag T (-2 to -1) to avoid infinite recursion +18390 c7 0/subop/copy *(esi+0xc) -1/imm32/being-computed # Typeinfo-total-size-in-bytes +18391 # var total-size/edi: int = 0 +18392 bf/copy-to-edi 0/imm32 +18393 # - for every field, if it's a user-defined type, compute its size +18394 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) +18395 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax +18396 89/<- %ecx 0/r32/eax +18397 # var table-size/edx: int = table->write +18398 8b/-> *ecx 2/r32/edx # stream-write +18399 # var curr/ecx: (addr table_row) = table->data +18400 8d/copy-address *(ecx+0xc) 1/r32/ecx +18401 # var max/edx: (addr table_row) = table->data + table->write +18402 8d/copy-address *(ecx+edx) 2/r32/edx +18403 { +18404 $populate-mu-type-sizes-in-type:loop: +18405 # if (curr >= max) break +18406 39/compare %ecx 2/r32/edx +18407 73/jump-if-addr>= break/disp8 +18408 # var t/eax: (addr typeinfo-entry) = lookup(curr->value) +18409 (lookup *(ecx+8) *(ecx+0xc)) # => eax +18410 # if (t->input-var == 0) silently ignore it; we'll emit a nice error message while type-checking +18411 81 7/subop/compare *eax 0/imm32 # Typeinfo-entry-input-var +18412 74/jump-if-= $populate-mu-type-sizes-in-type:end/disp8 +18413 # compute size of t->input-var +18414 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax +18415 (compute-size-of-var %eax *(ebp+0xc) *(ebp+0x10)) # => eax +18416 # result += eax +18417 01/add-to %edi 0/r32/eax +18418 # curr += row-size +18419 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size +18420 # +18421 eb/jump loop/disp8 +18422 } +18423 # - save result +18424 89/<- *(esi+0xc) 7/r32/edi # Typeinfo-total-size-in-bytes +18425 $populate-mu-type-sizes-in-type:end: +18426 # . restore registers +18427 5f/pop-to-edi +18428 5e/pop-to-esi +18429 5a/pop-to-edx +18430 59/pop-to-ecx +18431 58/pop-to-eax +18432 # . epilogue +18433 89/<- %esp 5/r32/ebp +18434 5d/pop-to-ebp +18435 c3/return +18436 +18437 $populate-mu-type-sizes-in-type:abort: +18438 (write-buffered *(ebp+0xc) "cycle in type definitions\n") +18439 (flush *(ebp+0xc)) +18440 (stop *(ebp+0x10) 1) +18441 # never gets here +18442 +18443 # Analogous to size-of, except we need to compute what size-of can just read +18444 # off the right data structures. +18445 compute-size-of-var: # in: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int +18446 # . prologue +18447 55/push-ebp +18448 89/<- %ebp 4/r32/esp +18449 # . push registers +18450 51/push-ecx +18451 # var t/ecx: (addr type-tree) = lookup(v->type) +18452 8b/-> *(ebp+8) 1/r32/ecx +18453 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +18454 89/<- %ecx 0/r32/eax +18455 # if (t->is-atom == false) t = lookup(t->left) +18456 { +18457 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +18458 75/jump-if-!= break/disp8 +18459 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +18460 89/<- %ecx 0/r32/eax +18461 } +18462 # TODO: ensure t is an atom +18463 (compute-size-of-type-id *(ecx+4) *(ebp+0xc) *(ebp+0x10)) # Type-tree-value => eax +18464 $compute-size-of-var:end: +18465 # . restore registers +18466 59/pop-to-ecx +18467 # . epilogue +18468 89/<- %esp 5/r32/ebp +18469 5d/pop-to-ebp +18470 c3/return +18471 +18472 compute-size-of-type-id: # t: type-id, err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int +18473 # . prologue +18474 55/push-ebp +18475 89/<- %ebp 4/r32/esp +18476 # . save registers +18477 51/push-ecx +18478 # var out/ecx: (handle typeinfo) +18479 68/push 0/imm32 +18480 68/push 0/imm32 +18481 89/<- %ecx 4/r32/esp +18482 # eax = t +18483 8b/-> *(ebp+8) 0/r32/eax +18484 # if t is a literal, return 0 +18485 3d/compare-eax-and 0/imm32/literal +18486 0f 84/jump-if-= $compute-size-of-type-id:end/disp32 # eax changes type from type-id to int +18487 # if t is a byte, return 4 (because we don't really support non-multiples of 4) +18488 3d/compare-eax-and 8/imm32/byte +18489 { +18490 75/jump-if-!= break/disp8 +18491 b8/copy-to-eax 4/imm32 +18492 eb/jump $compute-size-of-type-id:end/disp8 +18493 } +18494 # if t is a handle, return 8 +18495 3d/compare-eax-and 4/imm32/handle +18496 { +18497 75/jump-if-!= break/disp8 +18498 b8/copy-to-eax 8/imm32 +18499 eb/jump $compute-size-of-type-id:end/disp8 # eax changes type from type-id to int +18500 } +18501 # if t is a slice, return 8 +18502 3d/compare-eax-and 0xc/imm32/slice +18503 { +18504 75/jump-if-!= break/disp8 +18505 b8/copy-to-eax 8/imm32 +18506 eb/jump $compute-size-of-type-id:end/disp8 # eax changes type from type-id to int +18507 } +18508 # if t is a user-defined type, compute its size +18509 # TODO: support non-atom type +18510 (find-typeinfo %eax %ecx) +18511 { +18512 81 7/subop/compare *ecx 0/imm32 +18513 74/jump-if-= break/disp8 +18514 $compute-size-of-type-id:user-defined: +18515 (lookup *ecx *(ecx+4)) # => eax +18516 (populate-mu-type-sizes-in-type %eax *(ebp+0xc) *(ebp+0x10)) +18517 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes +18518 eb/jump $compute-size-of-type-id:end/disp8 +18519 } +18520 # otherwise return the word size +18521 b8/copy-to-eax 4/imm32 +18522 $compute-size-of-type-id:end: +18523 # . reclaim locals +18524 81 0/subop/add %esp 8/imm32 +18525 # . restore registers +18526 59/pop-to-ecx +18527 # . epilogue +18528 89/<- %esp 5/r32/ebp +18529 5d/pop-to-ebp +18530 c3/return +18531 +18532 # at this point we have total sizes for all user-defined types +18533 # compute offsets for each element +18534 # complication: fields may be out of order +18535 populate-mu-type-offsets: # in: (addr typeinfo), err: (addr buffered-file), ed: (addr exit-descriptor) +18536 # . prologue +18537 55/push-ebp +18538 89/<- %ebp 4/r32/esp +18539 # . save registers +18540 50/push-eax +18541 51/push-ecx +18542 52/push-edx +18543 53/push-ebx +18544 56/push-esi +18545 57/push-edi +18546 #? (dump-typeinfos "aaa\n") +18547 # var curr-offset/edi: int = 0 +18548 bf/copy-to-edi 0/imm32 +18549 # var table/ecx: (addr table string_key (handle typeinfo-entry)) = lookup(in->fields) +18550 8b/-> *(ebp+8) 1/r32/ecx +18551 (lookup *(ecx+4) *(ecx+8)) # Typeinfo-fields Typeinfo-fields => eax +18552 89/<- %ecx 0/r32/eax +18553 # var num-elems/edx: int = table->write / Typeinfo-fields-row-size +18554 8b/-> *ecx 2/r32/edx # stream-write +18555 c1 5/subop/shift-right-logical %edx 4/imm8 +18556 # var i/ebx: int = 0 +18557 bb/copy-to-ebx 0/imm32 +18558 { +18559 $populate-mu-type-offsets:loop: +18560 39/compare %ebx 2/r32/edx +18561 0f 8d/jump-if->= break/disp32 +18562 #? (write-buffered Stderr "looking up index ") +18563 #? (write-int32-hex-buffered Stderr %ebx) +18564 #? (write-buffered Stderr " in ") +18565 #? (write-int32-hex-buffered Stderr *(ebp+8)) +18566 #? (write-buffered Stderr Newline) +18567 #? (flush Stderr) +18568 # var v/esi: (addr typeinfo-entry) +18569 (locate-typeinfo-entry-with-index %ecx %ebx *(ebp+0xc) *(ebp+0x10)) # => eax +18570 89/<- %esi 0/r32/eax +18571 # if v is null, silently move on; we'll emit a nice error message while type-checking +18572 81 7/subop/compare %esi 0/imm32 # Typeinfo-entry-input-var +18573 74/jump-if-= $populate-mu-type-offsets:end/disp8 +18574 # if (v->input-var == 0) silently ignore v; we'll emit a nice error message while type-checking +18575 81 7/subop/compare *esi 0/imm32 # Typeinfo-entry-input-var +18576 74/jump-if-= $populate-mu-type-offsets:end/disp8 +18577 # v->output-var->offset = curr-offset +18578 # . eax: (addr var) +18579 (lookup *(esi+0xc) *(esi+0x10)) # Typeinfo-entry-output-var Typeinfo-entry-output-var => eax +18580 89/<- *(eax+0x14) 7/r32/edi # Var-offset +18581 # curr-offset += size-of(v->input-var) +18582 (lookup *esi *(esi+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax +18583 (size-of %eax) # => eax +18584 01/add-to %edi 0/r32/eax +18585 # ++i +18586 43/increment-ebx +18587 e9/jump loop/disp32 +18588 } +18589 $populate-mu-type-offsets:end: +18590 # . restore registers +18591 5f/pop-to-edi +18592 5e/pop-to-esi +18593 5b/pop-to-ebx +18594 5a/pop-to-edx +18595 59/pop-to-ecx +18596 58/pop-to-eax +18597 # . epilogue +18598 89/<- %esp 5/r32/ebp +18599 5d/pop-to-ebp +18600 c3/return +18601 +18602 locate-typeinfo-entry-with-index: # table: (addr table (handle array byte) (handle typeinfo-entry)), idx: int, err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: (addr typeinfo-entry) +18603 # . prologue +18604 55/push-ebp +18605 89/<- %ebp 4/r32/esp +18606 # . save registers +18607 51/push-ecx +18608 52/push-edx +18609 53/push-ebx +18610 56/push-esi +18611 57/push-edi +18612 # esi = table +18613 8b/-> *(ebp+8) 6/r32/esi +18614 # var curr/ecx: (addr row (handle array byte) (handle typeinfo-entry)) = table->data +18615 8d/copy-address *(esi+0xc) 1/r32/ecx +18616 # var max/edx: (addr byte) = &table->data[table->write] +18617 8b/-> *esi 2/r32/edx +18618 8d/copy-address *(ecx+edx) 2/r32/edx +18619 { +18620 $locate-typeinfo-entry-with-index:loop: +18621 39/compare %ecx 2/r32/edx +18622 73/jump-if-addr>= break/disp8 +18623 # var v/eax: (addr typeinfo-entry) +18624 (lookup *(ecx+8) *(ecx+0xc)) # => eax +18625 # if (v->index == idx) return v +18626 8b/-> *(eax+8) 3/r32/ebx # Typeinfo-entry-index +18627 #? (write-buffered Stderr "comparing ") +18628 #? (write-int32-hex-buffered Stderr %ebx) +18629 #? (write-buffered Stderr " and ") +18630 #? (write-int32-hex-buffered Stderr *(ebp+0xc)) +18631 #? (write-buffered Stderr Newline) +18632 #? (flush Stderr) +18633 39/compare *(ebp+0xc) 3/r32/ebx +18634 74/jump-if-= $locate-typeinfo-entry-with-index:end/disp8 +18635 # curr += Typeinfo-entry-size +18636 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-entry-size +18637 # +18638 eb/jump loop/disp8 +18639 } +18640 # return 0 +18641 b8/copy-to-eax 0/imm32 +18642 $locate-typeinfo-entry-with-index:end: +18643 #? (write-buffered Stderr "returning ") +18644 #? (write-int32-hex-buffered Stderr %eax) +18645 #? (write-buffered Stderr Newline) +18646 #? (flush Stderr) +18647 # . restore registers +18648 5f/pop-to-edi +18649 5e/pop-to-esi +18650 5b/pop-to-ebx +18651 5a/pop-to-edx +18652 59/pop-to-ecx +18653 # . epilogue +18654 89/<- %esp 5/r32/ebp +18655 5d/pop-to-ebp +18656 c3/return +18657 +18658 dump-typeinfos: # hdr: (addr array byte) +18659 # . prologue +18660 55/push-ebp +18661 89/<- %ebp 4/r32/esp +18662 # . save registers +18663 50/push-eax +18664 # +18665 (write-buffered Stderr *(ebp+8)) +18666 (flush Stderr) +18667 # var curr/eax: (addr typeinfo) = lookup(Program->types) +18668 (lookup *_Program-types *_Program-types->payload) # => eax +18669 { +18670 # if (curr == null) break +18671 3d/compare-eax-and 0/imm32 +18672 74/jump-if-= break/disp8 +18673 (write-buffered Stderr "---\n") +18674 (flush Stderr) +18675 (dump-typeinfo %eax) +18676 # curr = lookup(curr->next) +18677 (lookup *(eax+0x10) *(eax+0x14)) # Typeinfo-next Typeinfo-next => eax +18678 eb/jump loop/disp8 +18679 } +18680 $dump-typeinfos:end: +18681 # . restore registers +18682 58/pop-to-eax +18683 # . epilogue +18684 89/<- %esp 5/r32/ebp +18685 5d/pop-to-ebp +18686 c3/return +18687 +18688 dump-typeinfo: # in: (addr typeinfo) +18689 # . prologue +18690 55/push-ebp +18691 89/<- %ebp 4/r32/esp +18692 # . save registers +18693 50/push-eax +18694 51/push-ecx +18695 52/push-edx +18696 53/push-ebx +18697 56/push-esi +18698 57/push-edi +18699 # esi = in +18700 8b/-> *(ebp+8) 6/r32/esi +18701 # var table/ecx: (addr table (handle array byte) (handle typeinfo-entry)) = lookup(T->fields) +18702 (lookup *(esi+4) *(esi+8)) # Typeinfo-fields Typeinfo-fields => eax +18703 89/<- %ecx 0/r32/eax +18704 (write-buffered Stderr "id:") +18705 (write-int32-hex-buffered Stderr *esi) +18706 (write-buffered Stderr "\n") +18707 (write-buffered Stderr "fields @ ") +18708 (write-int32-hex-buffered Stderr %ecx) +18709 (write-buffered Stderr Newline) +18710 (flush Stderr) +18711 (write-buffered Stderr " write: ") +18712 (write-int32-hex-buffered Stderr *ecx) +18713 (write-buffered Stderr Newline) +18714 (flush Stderr) +18715 (write-buffered Stderr " read: ") +18716 (write-int32-hex-buffered Stderr *(ecx+4)) +18717 (write-buffered Stderr Newline) +18718 (flush Stderr) +18719 (write-buffered Stderr " size: ") +18720 (write-int32-hex-buffered Stderr *(ecx+8)) +18721 (write-buffered Stderr Newline) +18722 (flush Stderr) +18723 # var table-size/edx: int = table->write +18724 8b/-> *ecx 2/r32/edx # stream-write +18725 # var curr/ecx: (addr table_row) = table->data +18726 8d/copy-address *(ecx+0xc) 1/r32/ecx +18727 # var max/edx: (addr table_row) = table->data + table->write +18728 8d/copy-address *(ecx+edx) 2/r32/edx +18729 { +18730 $dump-typeinfo:loop: +18731 # if (curr >= max) break +18732 39/compare %ecx 2/r32/edx +18733 0f 83/jump-if-addr>= break/disp32 +18734 (write-buffered Stderr " row:\n") +18735 (write-buffered Stderr " key: ") +18736 (write-int32-hex-buffered Stderr *ecx) +18737 (write-buffered Stderr ",") +18738 (write-int32-hex-buffered Stderr *(ecx+4)) +18739 (write-buffered Stderr " = '") +18740 (lookup *ecx *(ecx+4)) +18741 (write-buffered Stderr %eax) +18742 (write-buffered Stderr "' @ ") +18743 (write-int32-hex-buffered Stderr %eax) +18744 (write-buffered Stderr Newline) +18745 (flush Stderr) +18746 (write-buffered Stderr " value: ") +18747 (write-int32-hex-buffered Stderr *(ecx+8)) +18748 (write-buffered Stderr ",") +18749 (write-int32-hex-buffered Stderr *(ecx+0xc)) +18750 (write-buffered Stderr " = typeinfo-entry@") +18751 (lookup *(ecx+8) *(ecx+0xc)) +18752 (write-int32-hex-buffered Stderr %eax) +18753 (write-buffered Stderr Newline) +18754 (flush Stderr) +18755 (write-buffered Stderr " input var@") +18756 (dump-var 5 %eax) +18757 (lookup *(ecx+8) *(ecx+0xc)) +18758 (write-buffered Stderr " index: ") +18759 (write-int32-hex-buffered Stderr *(eax+8)) +18760 (write-buffered Stderr Newline) +18761 (flush Stderr) +18762 (write-buffered Stderr " output var@") +18763 8d/copy-address *(eax+0xc) 0/r32/eax # Typeinfo-entry-output-var +18764 (dump-var 5 %eax) +18765 (flush Stderr) +18766 # curr += row-size +18767 81 0/subop/add %ecx 0x10/imm32 # Typeinfo-fields-row-size +18768 # +18769 e9/jump loop/disp32 +18770 } +18771 $dump-typeinfo:end: +18772 # . restore registers +18773 5f/pop-to-edi +18774 5e/pop-to-esi +18775 5b/pop-to-ebx +18776 5a/pop-to-edx +18777 59/pop-to-ecx +18778 58/pop-to-eax +18779 # . epilogue +18780 89/<- %esp 5/r32/ebp +18781 5d/pop-to-ebp +18782 c3/return +18783 +18784 dump-var: # indent: int, v: (addr handle var) +18785 # . prologue +18786 55/push-ebp +18787 89/<- %ebp 4/r32/esp +18788 # . save registers +18789 50/push-eax +18790 53/push-ebx +18791 # eax = v +18792 8b/-> *(ebp+0xc) 0/r32/eax +18793 # +18794 (write-int32-hex-buffered Stderr *eax) +18795 (write-buffered Stderr ",") +18796 (write-int32-hex-buffered Stderr *(eax+4)) +18797 (write-buffered Stderr "->") +18798 (lookup *eax *(eax+4)) +18799 (write-int32-hex-buffered Stderr %eax) +18800 (write-buffered Stderr Newline) +18801 (flush Stderr) +18802 { +18803 3d/compare-eax-and 0/imm32 +18804 0f 84/jump-if-= break/disp32 +18805 (emit-indent Stderr *(ebp+8)) +18806 (write-buffered Stderr "name: ") +18807 89/<- %ebx 0/r32/eax +18808 (write-int32-hex-buffered Stderr *ebx) # Var-name +18809 (write-buffered Stderr ",") +18810 (write-int32-hex-buffered Stderr *(ebx+4)) # Var-name +18811 (write-buffered Stderr "->") +18812 (lookup *ebx *(ebx+4)) # Var-name +18813 (write-int32-hex-buffered Stderr %eax) 18814 { -18815 74/jump-if-= break/disp8 -18816 (lookup *(esi+0xc) *(esi+0x10)) # Type-tree-right Type-tree-right => eax -18817 # if t->right is null, t = t->left -18818 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -18819 { -18820 75/jump-if-!= break/disp8 -18821 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -18822 } -18823 (is-mu-addr-type? %eax) # => eax -18824 3d/compare-eax-and 0/imm32/false -18825 74/jump-if-= $check-mu-numberlike-arg:end/disp8 -18826 } -18827 } -18828 $check-mu-numberlike-arg:output-checks: -18829 (check-mu-numberlike-output *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18)) -18830 $check-mu-numberlike-arg:end: -18831 # . restore registers -18832 5e/pop-to-esi -18833 58/pop-to-eax -18834 # . epilogue -18835 89/<- %esp 5/r32/ebp -18836 5d/pop-to-ebp -18837 c3/return -18838 -18839 check-mu-numberlike-output: # v: (addr stmt-var), stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -18840 # . prologue -18841 55/push-ebp -18842 89/<- %ebp 4/r32/esp -18843 # . save registers -18844 50/push-eax -18845 56/push-esi -18846 # var t/esi: (addr type-tree) = lookup(v->value->type) -18847 8b/-> *(ebp+8) 0/r32/eax -18848 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -18849 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -18850 89/<- %esi 0/r32/eax -18851 $check-mu-numberlike-output:check-int: -18852 # if t is an int, return -18853 (is-simple-mu-type? %esi 1) # int => eax -18854 3d/compare-eax-and 0/imm32/false -18855 0f 85/jump-if-!= $check-mu-numberlike-output:end/disp32 -18856 $check-mu-numberlike-output:check-float: -18857 # if t is a float, return -18858 (is-simple-mu-type? %esi 0xf) # float => eax -18859 3d/compare-eax-and 0/imm32/false -18860 75/jump-if-!= $check-mu-numberlike-output:end/disp8 -18861 $check-mu-numberlike-output:check-boolean: -18862 # if t is a boolean, return -18863 (is-simple-mu-type? %esi 5) # boolean => eax -18864 3d/compare-eax-and 0/imm32/false -18865 75/jump-if-!= $check-mu-numberlike-output:end/disp8 -18866 $check-mu-numberlike-output:check-byte: -18867 # if t is a byte, return -18868 (is-simple-mu-type? %esi 8) # byte => eax -18869 3d/compare-eax-and 0/imm32/false -18870 75/jump-if-!= $check-mu-numberlike-output:end/disp8 -18871 $check-mu-numberlike-output:check-code-point: -18872 # if t is a code-point, return -18873 (is-simple-mu-type? %esi 0xd) # code-point => eax -18874 3d/compare-eax-and 0/imm32/false -18875 75/jump-if-!= $check-mu-numberlike-output:end/disp8 -18876 $check-mu-numberlike-output:check-grapheme: -18877 # if t is a grapheme, return -18878 (is-simple-mu-type? %esi 0xe) # grapheme => eax -18879 3d/compare-eax-and 0/imm32/false -18880 75/jump-if-!= $check-mu-numberlike-output:end/disp8 -18881 e9/jump $check-mu-numberlike-output:fail/disp32 -18882 $check-mu-numberlike-output:end: -18883 # . restore registers -18884 5e/pop-to-esi -18885 58/pop-to-eax -18886 # . epilogue -18887 89/<- %esp 5/r32/ebp -18888 5d/pop-to-ebp -18889 c3/return -18890 -18891 $check-mu-numberlike-output:fail: -18892 # otherwise raise an error -18893 (write-buffered *(ebp+0x14) "fn ") -18894 8b/-> *(ebp+0x10) 0/r32/eax -18895 (lookup *eax *(eax+4)) # Function-name Function-name => eax -18896 (write-buffered *(ebp+0x14) %eax) -18897 (write-buffered *(ebp+0x14) ": stmt ") -18898 8b/-> *(ebp+0xc) 0/r32/eax -18899 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -18900 (write-buffered *(ebp+0x14) %eax) -18901 (write-buffered *(ebp+0x14) ": '") -18902 8b/-> *(ebp+8) 0/r32/eax -18903 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -18904 (lookup *eax *(eax+4)) # Var-name Var-name => eax -18905 (write-buffered *(ebp+0x14) %eax) -18906 (write-buffered *(ebp+0x14) "' must be a non-addr scalar\n") -18907 (flush *(ebp+0x14)) -18908 (stop *(ebp+0x18) 1) -18909 # never gets here -18910 -18911 check-mu-copy-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -18912 # . prologue -18913 55/push-ebp -18914 89/<- %ebp 4/r32/esp -18915 # . save registers -18916 50/push-eax -18917 51/push-ecx -18918 52/push-edx -18919 56/push-esi -18920 57/push-edi -18921 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) -18922 81 5/subop/subtract %esp 0x60/imm32 -18923 68/push 0x60/imm32/size -18924 68/push 0/imm32/read -18925 68/push 0/imm32/write -18926 89/<- %edx 4/r32/esp -18927 $check-mu-copy-stmt:get-output: -18928 # esi = stmt -18929 8b/-> *(ebp+8) 6/r32/esi -18930 # var output/edi: (addr stmt-var) = stmt->outputs -18931 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -18932 89/<- %edi 0/r32/eax -18933 # zero outputs -18934 3d/compare-eax-and 0/imm32 -18935 0f 84/jump-if-= $check-mu-copy-stmt:error-no-output/disp32 -18936 # > 1 output -18937 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -18938 3d/compare-eax-and 0/imm32 -18939 0f 85/jump-if-!= $check-mu-copy-stmt:error-too-many-outputs/disp32 -18940 $check-mu-copy-stmt:get-inout: -18941 # var inout/esi: (addr stmt-var) = stmt->inouts -18942 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -18943 89/<- %esi 0/r32/eax -18944 # zero inouts -18945 3d/compare-eax-and 0/imm32 -18946 0f 84/jump-if-= $check-mu-copy-stmt:error-no-inout/disp32 -18947 # > 1 inout -18948 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -18949 3d/compare-eax-and 0/imm32 -18950 0f 85/jump-if-!= $check-mu-copy-stmt:error-too-many-inouts/disp32 -18951 $check-mu-copy-stmt:types: -18952 # var inout-type/ecx: (addr type-tree) = inout->value->type -18953 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -18954 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -18955 89/<- %ecx 0/r32/eax -18956 # if (inout->is-deref?) inout-type = inout-type->payload -18957 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref -18958 3d/compare-eax-and 0/imm32/false -18959 { -18960 74/jump-if-= break/disp8 -18961 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -18962 # if inout-type->right is null, t = inout-type->left -18963 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -18964 { -18965 75/jump-if-!= break/disp8 -18966 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -18967 } -18968 89/<- %ecx 0/r32/eax -18969 } -18970 # if output not in register, abort -18971 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -18972 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -18973 3d/compare-eax-and 0/imm32 -18974 0f 84/jump-if-= $check-mu-copy-stmt:error-output-not-in-register/disp32 -18975 # if inout is not a scalar, abort -18976 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -18977 (size-of %eax) # => eax -18978 3d/compare-eax-and 4/imm32 -18979 0f 8f/jump-if-> $check-mu-copy-stmt:error-inout-too-large/disp32 -18980 # var output-type/eax: (addr type-tree) = output->value->type -18981 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -18982 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -18983 # if (inout-type == output-type) return -18984 (type-match? %eax %ecx %edx) # => eax -18985 3d/compare-eax-and 0/imm32 -18986 0f 85/jump-if-!= $check-mu-copy-stmt:end/disp32 -18987 # if output is an addr and inout is 0, return -18988 { -18989 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -18990 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -18991 (is-mu-addr-type? %eax) # => eax -18992 3d/compare-eax-and 0/imm32/false -18993 74/jump-if-= break/disp8 -18994 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -18995 (lookup *eax *(eax+4)) # Var-name Var-name => eax -18996 (string-equal? %eax "0") # => eax -18997 3d/compare-eax-and 0/imm32/false -18998 74/jump-if-= break/disp8 -18999 eb/jump $check-mu-copy-stmt:end/disp8 -19000 } -19001 # if output is not number-like, abort -19002 (check-mu-numberlike-output %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -19003 $check-mu-copy-stmt:end: -19004 # . reclaim locals -19005 81 0/subop/add %esp 0x6c/imm32 -19006 # . restore registers -19007 5f/pop-to-edi -19008 5e/pop-to-esi -19009 5a/pop-to-edx -19010 59/pop-to-ecx -19011 58/pop-to-eax -19012 # . epilogue -19013 89/<- %esp 5/r32/ebp -19014 5d/pop-to-ebp -19015 c3/return -19016 -19017 $check-mu-copy-stmt:error-no-inout: -19018 (write-buffered *(ebp+0x10) "fn ") -19019 8b/-> *(ebp+0xc) 0/r32/eax -19020 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19021 (write-buffered *(ebp+0x10) %eax) -19022 (write-buffered *(ebp+0x10) ": stmt 'copy' expects an inout\n") -19023 (flush *(ebp+0x10)) -19024 (stop *(ebp+0x14) 1) -19025 # never gets here -19026 -19027 $check-mu-copy-stmt:error-too-many-inouts: -19028 (write-buffered *(ebp+0x10) "fn ") -19029 8b/-> *(ebp+0xc) 0/r32/eax -19030 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19031 (write-buffered *(ebp+0x10) %eax) -19032 (write-buffered *(ebp+0x10) ": stmt 'copy' must have just one inout\n") -19033 (flush *(ebp+0x10)) -19034 (stop *(ebp+0x14) 1) -19035 # never gets here -19036 -19037 $check-mu-copy-stmt:error-no-output: -19038 (write-buffered *(ebp+0x10) "fn ") -19039 8b/-> *(ebp+0xc) 0/r32/eax -19040 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19041 (write-buffered *(ebp+0x10) %eax) -19042 (write-buffered *(ebp+0x10) ": stmt 'copy' expects an output\n") -19043 (flush *(ebp+0x10)) -19044 (stop *(ebp+0x14) 1) -19045 # never gets here -19046 -19047 $check-mu-copy-stmt:error-output-not-in-register: -19048 (write-buffered *(ebp+0x10) "fn ") -19049 8b/-> *(ebp+0xc) 0/r32/eax -19050 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19051 (write-buffered *(ebp+0x10) %eax) -19052 (write-buffered *(ebp+0x10) ": stmt copy: output '") -19053 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19054 (lookup *eax *(eax+4)) # Var-name Var-name => eax -19055 (write-buffered *(ebp+0x10) %eax) -19056 (write-buffered *(ebp+0x10) "' not in a register\n") -19057 (flush *(ebp+0x10)) -19058 (stop *(ebp+0x14) 1) -19059 # never gets here -19060 -19061 $check-mu-copy-stmt:error-too-many-outputs: -19062 (write-buffered *(ebp+0x10) "fn ") -19063 8b/-> *(ebp+0xc) 0/r32/eax -19064 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19065 (write-buffered *(ebp+0x10) %eax) -19066 (write-buffered *(ebp+0x10) ": stmt 'copy' must have just one output\n") -19067 (flush *(ebp+0x10)) -19068 (stop *(ebp+0x14) 1) -19069 # never gets here -19070 -19071 $check-mu-copy-stmt:error-inout-too-large: -19072 (write-buffered *(ebp+0x10) "fn ") -19073 8b/-> *(ebp+0xc) 0/r32/eax -19074 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19075 (write-buffered *(ebp+0x10) %eax) -19076 (write-buffered *(ebp+0x10) ": stmt copy: '") -19077 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -19078 (lookup *eax *(eax+4)) # Var-name Var-name => eax -19079 (write-buffered *(ebp+0x10) %eax) -19080 (write-buffered *(ebp+0x10) "' is too large to fit in a register\n") -19081 (flush *(ebp+0x10)) -19082 (stop *(ebp+0x14) 1) -19083 # never gets here -19084 -19085 check-mu-copy-to-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -19086 # . prologue -19087 55/push-ebp -19088 89/<- %ebp 4/r32/esp -19089 # . save registers -19090 50/push-eax -19091 51/push-ecx -19092 52/push-edx -19093 53/push-ebx -19094 56/push-esi -19095 57/push-edi -19096 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) -19097 81 5/subop/subtract %esp 0x60/imm32 -19098 68/push 0x60/imm32/size -19099 68/push 0/imm32/read -19100 68/push 0/imm32/write -19101 89/<- %edx 4/r32/esp -19102 # esi = stmt -19103 8b/-> *(ebp+8) 6/r32/esi -19104 $check-mu-copy-to-stmt:check-for-output: -19105 # if stmt->outputs abort -19106 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -19107 3d/compare-eax-and 0/imm32 -19108 0f 85/jump-if-!= $check-mu-copy-to-stmt:error-too-many-outputs/disp32 -19109 $check-mu-copy-to-stmt:get-dest: -19110 # var dest/edi: (addr stmt-var) = stmt->inouts -19111 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -19112 89/<- %edi 0/r32/eax -19113 # zero inouts -19114 3d/compare-eax-and 0/imm32 -19115 0f 84/jump-if-= $check-mu-copy-to-stmt:error-incorrect-inouts/disp32 -19116 $check-mu-copy-to-stmt:get-src: -19117 # var src/esi: (addr stmt-var) = dest->next -19118 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -19119 89/<- %esi 0/r32/eax -19120 # 1 inout -19121 3d/compare-eax-and 0/imm32 -19122 0f 84/jump-if-= $check-mu-copy-to-stmt:error-incorrect-inouts/disp32 -19123 # > 2 inouts -19124 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -19125 3d/compare-eax-and 0/imm32 -19126 0f 85/jump-if-!= $check-mu-copy-to-stmt:error-incorrect-inouts/disp32 -19127 $check-mu-copy-to-stmt:types: -19128 # var src-type/ecx: (addr type-tree) = src->value->type -19129 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -19130 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19131 89/<- %ecx 0/r32/eax -19132 # if src not in register or literal, abort -19133 # (we can't use stack-offset because it hasn't been computed yet) -19134 { -19135 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -19136 (lookup *(eax+0x8) *(eax+0xc)) # Var-type Var-type => eax -19137 (is-simple-mu-type? %eax 0) # => eax -19138 3d/compare-eax-and 0/imm32 -19139 75/jump-if-!= break/disp8 -19140 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -19141 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -19142 3d/compare-eax-and 0/imm32 -19143 75/jump-if-!= break/disp8 -19144 e9/jump $check-mu-copy-to-stmt:error-src-not-literal-or-in-register/disp32 -19145 } -19146 # if src is not a scalar, abort -19147 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -19148 (size-of %eax) # => eax -19149 3d/compare-eax-and 4/imm32 -19150 0f 8f/jump-if-> $check-mu-copy-to-stmt:error-src-too-large/disp32 -19151 # var dest-type/ebx: (addr type-tree) = dest->value->type -19152 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19153 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19154 89/<- %ebx 0/r32/eax -19155 # if (dest->is-deref?) dest-type = dest-type->payload -19156 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref -19157 3d/compare-eax-and 0/imm32/false -19158 { -19159 74/jump-if-= break/disp8 -19160 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -19161 # if dest-type->right is null, dest-type = dest-type->left -19162 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -19163 { -19164 75/jump-if-!= break/disp8 -19165 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -19166 } -19167 89/<- %ebx 0/r32/eax -19168 } -19169 # if (src-type == dest-type) return -19170 (type-match? %ebx %ecx %edx) # => eax -19171 3d/compare-eax-and 0/imm32 -19172 0f 85/jump-if-!= $check-mu-copy-to-stmt:end/disp32 -19173 # if dest is an addr and src is 0, return -19174 { -19175 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19176 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19177 (is-mu-addr-type? %eax) # => eax +18815 3d/compare-eax-and 0/imm32 +18816 74/jump-if-= break/disp8 +18817 (write-buffered Stderr Space) +18818 (write-buffered Stderr %eax) +18819 } +18820 (write-buffered Stderr Newline) +18821 (flush Stderr) +18822 (emit-indent Stderr *(ebp+8)) +18823 (write-buffered Stderr "block depth: ") +18824 (write-int32-hex-buffered Stderr *(ebx+0x10)) # Var-block-depth +18825 (write-buffered Stderr Newline) +18826 (flush Stderr) +18827 (emit-indent Stderr *(ebp+8)) +18828 (write-buffered Stderr "stack offset: ") +18829 (write-int32-hex-buffered Stderr *(ebx+0x14)) # Var-offset +18830 (write-buffered Stderr Newline) +18831 (flush Stderr) +18832 (emit-indent Stderr *(ebp+8)) +18833 (write-buffered Stderr "reg: ") +18834 (write-int32-hex-buffered Stderr *(ebx+0x18)) # Var-register +18835 (write-buffered Stderr ",") +18836 (write-int32-hex-buffered Stderr *(ebx+0x1c)) # Var-register +18837 (write-buffered Stderr "->") +18838 (flush Stderr) +18839 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register +18840 (write-int32-hex-buffered Stderr %eax) +18841 { +18842 3d/compare-eax-and 0/imm32 +18843 74/jump-if-= break/disp8 +18844 (write-buffered Stderr Space) +18845 (write-buffered Stderr %eax) +18846 } +18847 (write-buffered Stderr Newline) +18848 (flush Stderr) +18849 } +18850 $dump-var:end: +18851 # . restore registers +18852 5b/pop-to-ebx +18853 58/pop-to-eax +18854 # . epilogue +18855 89/<- %esp 5/r32/ebp +18856 5d/pop-to-ebp +18857 c3/return +18858 +18859 ####################################################### +18860 # Type-checking +18861 ####################################################### +18862 +18863 check-mu-types: # err: (addr buffered-file), ed: (addr exit-descriptor) +18864 # . prologue +18865 55/push-ebp +18866 89/<- %ebp 4/r32/esp +18867 # . save registers +18868 50/push-eax +18869 # var curr/eax: (addr function) = lookup(Program->functions) +18870 (lookup *_Program-functions *_Program-functions->payload) # => eax +18871 { +18872 $check-mu-types:loop: +18873 # if (curr == null) break +18874 3d/compare-eax-and 0/imm32 +18875 0f 84/jump-if-= break/disp32 +18876 +-- 8 lines: #? # dump curr->name --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +18884 (check-mu-function %eax *(ebp+8) *(ebp+0xc)) +18885 # curr = lookup(curr->next) +18886 (lookup *(eax+0x20) *(eax+0x24)) # Function-next Function-next => eax +18887 e9/jump loop/disp32 +18888 } +18889 $check-mu-types:end: +18890 # . restore registers +18891 58/pop-to-eax +18892 # . epilogue +18893 89/<- %esp 5/r32/ebp +18894 5d/pop-to-ebp +18895 c3/return +18896 +18897 check-mu-function: # fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +18898 # . prologue +18899 55/push-ebp +18900 89/<- %ebp 4/r32/esp +18901 # . save registers +18902 50/push-eax +18903 56/push-esi +18904 # esi = f +18905 8b/-> *(ebp+8) 6/r32/esi +18906 # outputs +18907 (lookup *(esi+0x10) *(esi+0x14)) # Function-outputs Function-outputs => eax +18908 (check-all-unique-registers %eax %esi *(ebp+0xc) *(ebp+0x10)) +18909 # body +18910 (lookup *(esi+0x18) *(esi+0x1c)) # Function-body Function-body => eax +18911 (check-mu-block %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10)) +18912 # if function has no outputs, we're done +18913 81 7/subop/compare *(esi+0x10) 0/imm32 +18914 74/jump-if-= $check-mu-function:end/disp8 +18915 # some final checks on body +18916 (check-final-stmt-is-return %eax %esi *(ebp+0xc) *(ebp+0x10)) +18917 (check-no-breaks %eax %esi *(ebp+0xc) *(ebp+0x10)) +18918 $check-mu-function:end: +18919 # . restore registers +18920 5e/pop-to-esi +18921 58/pop-to-eax +18922 # . epilogue +18923 89/<- %esp 5/r32/ebp +18924 5d/pop-to-ebp +18925 c3/return +18926 +18927 check-mu-block: # block: (addr block), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +18928 # . prologue +18929 55/push-ebp +18930 89/<- %ebp 4/r32/esp +18931 # . save registers +18932 50/push-eax +18933 # eax = block +18934 8b/-> *(ebp+8) 0/r32/eax +18935 # var stmts/eax: (addr list stmt) = lookup(block->statements) +18936 (lookup *(eax+4) *(eax+8)) # Block-stmts Block-stmts => eax +18937 # +18938 { +18939 $check-mu-block:check-empty: +18940 3d/compare-eax-and 0/imm32 +18941 0f 84/jump-if-= break/disp32 +18942 # emit block->statements +18943 (check-mu-stmt-list %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +18944 } +18945 $check-mu-block:end: +18946 # . restore registers +18947 58/pop-to-eax +18948 # . epilogue +18949 89/<- %esp 5/r32/ebp +18950 5d/pop-to-ebp +18951 c3/return +18952 +18953 check-mu-stmt-list: # stmts: (addr list stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +18954 # . prologue +18955 55/push-ebp +18956 89/<- %ebp 4/r32/esp +18957 # . save registers +18958 50/push-eax +18959 56/push-esi +18960 # esi = stmts +18961 8b/-> *(ebp+8) 6/r32/esi +18962 { +18963 $check-mu-stmt-list:loop: +18964 81 7/subop/compare %esi 0/imm32 +18965 0f 84/jump-if-= break/disp32 +18966 # var curr-stmt/eax: (addr stmt) = lookup(stmts->value) +18967 (lookup *esi *(esi+4)) # List-value List-value => eax +18968 { +18969 $check-mu-stmt-list:check-for-block: +18970 81 7/subop/compare *eax 0/imm32/block # Stmt-tag +18971 75/jump-if-!= break/disp8 +18972 $check-mu-stmt-list:block: +18973 (check-mu-block %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +18974 eb/jump $check-mu-stmt-list:continue/disp8 +18975 } +18976 { +18977 $check-mu-stmt-list:check-for-stmt1: +18978 81 7/subop/compare *eax 1/imm32/stmt1 # Stmt-tag +18979 0f 85/jump-if-!= break/disp32 +18980 $check-mu-stmt-list:stmt1: +18981 (check-mu-stmt %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +18982 eb/jump $check-mu-stmt-list:continue/disp8 +18983 } +18984 { +18985 $check-mu-stmt-list:check-for-reg-var-def: +18986 81 7/subop/compare *eax 3/imm32/reg-var-def # Stmt-tag +18987 0f 85/jump-if-!= break/disp32 +18988 $check-mu-stmt-list:reg-var-def: +18989 (check-mu-stmt %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +18990 eb/jump $check-mu-stmt-list:continue/disp8 +18991 } +18992 $check-mu-stmt-list:continue: +18993 # TODO: raise an error on unrecognized Stmt-tag +18994 (lookup *(esi+8) *(esi+0xc)) # List-next List-next => eax +18995 89/<- %esi 0/r32/eax +18996 e9/jump loop/disp32 +18997 } +18998 $check-mu-stmt-list:end: +18999 # . restore registers +19000 5e/pop-to-esi +19001 58/pop-to-eax +19002 # . epilogue +19003 89/<- %esp 5/r32/ebp +19004 5d/pop-to-ebp +19005 c3/return +19006 +19007 check-mu-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +19008 # . prologue +19009 55/push-ebp +19010 89/<- %ebp 4/r32/esp +19011 # . save registers +19012 50/push-eax +19013 # - if stmt's operation matches a primitive, check against it +19014 (has-primitive-name? *(ebp+8)) # => eax +19015 3d/compare-eax-and 0/imm32/false +19016 { +19017 74/jump-if-= break/disp8 +19018 (check-mu-primitive *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19019 e9/jump $check-mu-stmt:end/disp32 +19020 } +19021 # - otherwise find a function to check against +19022 # var f/eax: (addr function) = lookup(*Program->functions) +19023 (lookup *_Program-functions *_Program-functions->payload) # => eax +19024 (find-matching-function %eax *(ebp+8)) # => eax +19025 3d/compare-eax-and 0/imm32 +19026 { +19027 74/jump-if-= break/disp8 +19028 (check-mu-call *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19029 eb/jump $check-mu-stmt:end/disp8 +19030 } +19031 # var f/eax: (addr function) = lookup(*Program->signatures) +19032 (lookup *_Program-signatures *_Program-signatures->payload) # => eax +19033 (find-matching-function %eax *(ebp+8)) # => eax +19034 3d/compare-eax-and 0/imm32 +19035 { +19036 74/jump-if-= break/disp8 +19037 (check-mu-call *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19038 eb/jump $check-mu-stmt:end/disp8 +19039 } +19040 # - otherwise abort +19041 e9/jump $check-mu-stmt:unknown-call/disp32 +19042 $check-mu-stmt:end: +19043 # . restore registers +19044 58/pop-to-eax +19045 # . epilogue +19046 89/<- %esp 5/r32/ebp +19047 5d/pop-to-ebp +19048 c3/return +19049 +19050 $check-mu-stmt:unknown-call: +19051 (write-buffered *(ebp+0x10) "unknown function '") +19052 8b/-> *(ebp+8) 0/r32/eax +19053 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +19054 (write-buffered *(ebp+0x10) %eax) +19055 (write-buffered *(ebp+0x10) "'\n") +19056 (flush *(ebp+0x10)) +19057 (stop *(ebp+0x14) 1) +19058 # never gets here +19059 +19060 has-primitive-name?: # stmt: (addr stmt) -> result/eax: boolean +19061 # . prologue +19062 55/push-ebp +19063 89/<- %ebp 4/r32/esp +19064 # . save registers +19065 51/push-ecx +19066 56/push-esi +19067 # var name/esi: (addr array byte) = lookup(stmt->operation) +19068 8b/-> *(ebp+8) 6/r32/esi +19069 (lookup *(esi+4) *(esi+8)) # Stmt1-operation Stmt1-operation => eax +19070 89/<- %esi 0/r32/eax +19071 # if (name == "return") return true +19072 (string-equal? %esi "return") # => eax +19073 3d/compare-eax-and 0/imm32/false +19074 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +19075 # if (name == "get") return true +19076 (string-equal? %esi "get") # => eax +19077 3d/compare-eax-and 0/imm32/false +19078 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +19079 # if (name == "index") return true +19080 (string-equal? %esi "index") # => eax +19081 3d/compare-eax-and 0/imm32/false +19082 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +19083 # if (name == "length") return true +19084 (string-equal? %esi "length") # => eax +19085 3d/compare-eax-and 0/imm32/false +19086 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +19087 # if (name == "compute-offset") return true +19088 (string-equal? %esi "compute-offset") # => eax +19089 3d/compare-eax-and 0/imm32/false +19090 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +19091 # if (name == "copy-object") return true +19092 (string-equal? %esi "copy-object") # => eax +19093 3d/compare-eax-and 0/imm32/false +19094 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +19095 # if (name == "allocate") return true +19096 (string-equal? %esi "allocate") # => eax +19097 3d/compare-eax-and 0/imm32/false +19098 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +19099 # if (name == "populate") return true +19100 (string-equal? %esi "populate") # => eax +19101 3d/compare-eax-and 0/imm32/false +19102 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +19103 # if (name == "populate-stream") return true +19104 (string-equal? %esi "populate-stream") # => eax +19105 3d/compare-eax-and 0/imm32/false +19106 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +19107 # if (name == "read-from-stream") return true +19108 (string-equal? %esi "read-from-stream") # => eax +19109 3d/compare-eax-and 0/imm32/false +19110 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +19111 # if (name == "write-to-stream") return true +19112 (string-equal? %esi "write-to-stream") # => eax +19113 3d/compare-eax-and 0/imm32/false +19114 0f 85/jump-if-!= $has-primitive-name?:end/disp32 +19115 # var curr/ecx: (addr primitive) = Primitives +19116 b9/copy-to-ecx Primitives/imm32 +19117 { +19118 $has-primitive-name?:loop: +19119 # if (curr == null) break +19120 81 7/subop/compare %ecx 0/imm32 +19121 74/jump-if-= break/disp8 +19122 # if (primitive->name == name) return true +19123 (lookup *ecx *(ecx+4)) # Primitive-name Primitive-name => eax +19124 #? (write-buffered Stderr %eax) +19125 #? (write-buffered Stderr Newline) +19126 #? (flush Stderr) +19127 (string-equal? %esi %eax) # => eax +19128 3d/compare-eax-and 0/imm32/false +19129 75/jump-if-!= $has-primitive-name?:end/disp8 +19130 $has-primitive-name?:next-primitive: +19131 # curr = curr->next +19132 (lookup *(ecx+0x3c) *(ecx+0x40)) # Primitive-next Primitive-next => eax +19133 89/<- %ecx 0/r32/eax +19134 # +19135 e9/jump loop/disp32 +19136 } +19137 # return null +19138 b8/copy-to-eax 0/imm32 +19139 $has-primitive-name?:end: +19140 # . restore registers +19141 5e/pop-to-esi +19142 59/pop-to-ecx +19143 # . epilogue +19144 89/<- %esp 5/r32/ebp +19145 5d/pop-to-ebp +19146 c3/return +19147 +19148 check-mu-primitive: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +19149 # . prologue +19150 55/push-ebp +19151 89/<- %ebp 4/r32/esp +19152 # . save registers +19153 50/push-eax +19154 51/push-ecx +19155 # var op/ecx: (addr array byte) = lookup(stmt->operation) +19156 8b/-> *(ebp+8) 0/r32/eax +19157 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +19158 89/<- %ecx 0/r32/eax +19159 # if (op == "copy") check-mu-copy-stmt +19160 { +19161 (string-equal? %ecx "copy") # => eax +19162 3d/compare-eax-and 0/imm32/false +19163 74/jump-if-= break/disp8 +19164 (check-mu-copy-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19165 e9/jump $check-mu-primitive:end/disp32 +19166 } +19167 # if (op == "copy-to") check-mu-copy-to-stmt +19168 { +19169 (string-equal? %ecx "copy-to") # => eax +19170 3d/compare-eax-and 0/imm32/false +19171 74/jump-if-= break/disp8 +19172 (check-mu-copy-to-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19173 e9/jump $check-mu-primitive:end/disp32 +19174 } +19175 # if (op == "compare") check-mu-compare-stmt +19176 { +19177 (string-equal? %ecx "compare") # => eax 19178 3d/compare-eax-and 0/imm32/false 19179 74/jump-if-= break/disp8 -19180 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -19181 (lookup *eax *(eax+4)) # Var-name Var-name => eax -19182 (string-equal? %eax "0") # => eax -19183 3d/compare-eax-and 0/imm32/false -19184 74/jump-if-= break/disp8 -19185 eb/jump $check-mu-copy-to-stmt:end/disp8 -19186 } -19187 # if dest is not number-like, abort -19188 (check-mu-numberlike-arg %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -19189 $check-mu-copy-to-stmt:end: -19190 # . reclaim locals -19191 81 0/subop/add %esp 0x6c/imm32 -19192 # . restore registers -19193 5f/pop-to-edi -19194 5e/pop-to-esi -19195 5b/pop-to-ebx -19196 5a/pop-to-edx -19197 59/pop-to-ecx -19198 58/pop-to-eax -19199 # . epilogue -19200 89/<- %esp 5/r32/ebp -19201 5d/pop-to-ebp -19202 c3/return -19203 -19204 $check-mu-copy-to-stmt:error-incorrect-inouts: -19205 (write-buffered *(ebp+0x10) "fn ") -19206 8b/-> *(ebp+0xc) 0/r32/eax -19207 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19208 (write-buffered *(ebp+0x10) %eax) -19209 (write-buffered *(ebp+0x10) ": stmt 'copy-to' must have two inouts\n") -19210 (flush *(ebp+0x10)) -19211 (stop *(ebp+0x14) 1) -19212 # never gets here -19213 -19214 $check-mu-copy-to-stmt:error-too-many-outputs: -19215 (write-buffered *(ebp+0x10) "fn ") -19216 8b/-> *(ebp+0xc) 0/r32/eax -19217 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19218 (write-buffered *(ebp+0x10) %eax) -19219 (write-buffered *(ebp+0x10) ": stmt 'copy-to' must not have any outputs\n") -19220 (flush *(ebp+0x10)) -19221 (stop *(ebp+0x14) 1) -19222 # never gets here -19223 -19224 $check-mu-copy-to-stmt:error-src-not-literal-or-in-register: -19225 (write-buffered *(ebp+0x10) "fn ") -19226 8b/-> *(ebp+0xc) 0/r32/eax -19227 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19228 (write-buffered *(ebp+0x10) %eax) -19229 (write-buffered *(ebp+0x10) ": stmt copy-to: source (second inout) is in memory\n") -19230 (flush *(ebp+0x10)) -19231 (stop *(ebp+0x14) 1) -19232 # never gets here -19233 -19234 $check-mu-copy-to-stmt:error-src-too-large: -19235 (write-buffered *(ebp+0x10) "fn ") -19236 8b/-> *(ebp+0xc) 0/r32/eax -19237 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19238 (write-buffered *(ebp+0x10) %eax) -19239 (write-buffered *(ebp+0x10) ": stmt copy-to: '") -19240 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -19241 (lookup *eax *(eax+4)) # Var-name Var-name => eax -19242 (write-buffered *(ebp+0x10) %eax) -19243 (write-buffered *(ebp+0x10) "' is too large to copy\n") -19244 (flush *(ebp+0x10)) -19245 (stop *(ebp+0x14) 1) -19246 # never gets here -19247 -19248 check-mu-compare-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -19249 # . prologue -19250 55/push-ebp -19251 89/<- %ebp 4/r32/esp -19252 # . save registers -19253 50/push-eax -19254 51/push-ecx -19255 52/push-edx -19256 53/push-ebx -19257 56/push-esi -19258 57/push-edi -19259 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) -19260 81 5/subop/subtract %esp 0x60/imm32 -19261 68/push 0x60/imm32/size -19262 68/push 0/imm32/read -19263 68/push 0/imm32/write -19264 89/<- %edx 4/r32/esp -19265 # esi = stmt -19266 8b/-> *(ebp+8) 6/r32/esi -19267 $check-mu-compare-stmt:check-for-output: -19268 # if stmt->outputs abort -19269 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -19270 3d/compare-eax-and 0/imm32 -19271 0f 85/jump-if-!= $check-mu-compare-stmt:error-too-many-outputs/disp32 -19272 $check-mu-compare-stmt:get-left: -19273 # var left/edi: (addr stmt-var) = stmt->inouts -19274 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -19275 89/<- %edi 0/r32/eax -19276 # zero inouts -19277 3d/compare-eax-and 0/imm32 -19278 0f 84/jump-if-= $check-mu-compare-stmt:error-incorrect-inouts/disp32 -19279 $check-mu-compare-stmt:get-right: -19280 # var right/esi: (addr stmt-var) = left->next -19281 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -19282 89/<- %esi 0/r32/eax -19283 # 1 inout -19284 3d/compare-eax-and 0/imm32 -19285 0f 84/jump-if-= $check-mu-compare-stmt:error-incorrect-inouts/disp32 -19286 # > 2 inouts -19287 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -19288 3d/compare-eax-and 0/imm32 -19289 0f 85/jump-if-!= $check-mu-compare-stmt:error-incorrect-inouts/disp32 -19290 # if both inouts are in memory, abort -19291 { -19292 $check-mu-compare-stmt:both-in-mem: -19293 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -19294 (lookup *(eax+0x8) *(eax+0xc)) # Var-type Var-type => eax -19295 (is-simple-mu-type? %eax 0) # => eax -19296 3d/compare-eax-and 0/imm32 -19297 0f 85/jump-if-!= break/disp32 -19298 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -19299 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -19300 3d/compare-eax-and 0/imm32 -19301 75/jump-if-!= break/disp8 -19302 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19303 (lookup *(eax+0x8) *(eax+0xc)) # Var-type Var-type => eax -19304 (is-simple-mu-type? %eax 0) # => eax -19305 3d/compare-eax-and 0/imm32 -19306 75/jump-if-!= break/disp8 -19307 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19308 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -19309 3d/compare-eax-and 0/imm32 -19310 75/jump-if-!= break/disp8 -19311 e9/jump $check-mu-compare-stmt:error-both-in-memory/disp32 -19312 } -19313 $check-mu-compare-stmt:types: -19314 # var right-type/ecx: (addr type-tree) = right->value->type -19315 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -19316 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19317 89/<- %ecx 0/r32/eax -19318 # if (right->is-deref?) right-type = right-type->payload -19319 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref -19320 3d/compare-eax-and 0/imm32/false -19321 { -19322 74/jump-if-= break/disp8 -19323 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -19324 # if right-type->right is null, right-type = right-type->left -19325 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -19326 { -19327 75/jump-if-!= break/disp8 -19328 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -19329 } -19330 89/<- %ecx 0/r32/eax -19331 } -19332 # if right is not a scalar, abort -19333 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -19334 (size-of %eax) # => eax -19335 3d/compare-eax-and 4/imm32 -19336 0f 8f/jump-if-> $check-mu-compare-stmt:error-right-too-large/disp32 -19337 # if left is not a scalar, abort -19338 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19339 (size-of %eax) # => eax -19340 3d/compare-eax-and 4/imm32 -19341 0f 8f/jump-if-> $check-mu-compare-stmt:error-left-too-large/disp32 -19342 # var left-type/ebx: (addr type-tree) = left->value->type -19343 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19344 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19345 89/<- %ebx 0/r32/eax -19346 # if (left->is-deref?) left-type = left-type->payload -19347 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref -19348 3d/compare-eax-and 0/imm32/false -19349 { -19350 74/jump-if-= break/disp8 -19351 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -19352 # if left-type->right is null, left-type = left-type->left -19353 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -19354 { -19355 75/jump-if-!= break/disp8 -19356 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -19357 } -19358 89/<- %ebx 0/r32/eax -19359 } -19360 # if (left-type == right-type) return -19361 (type-match? %ebx %ecx %edx) # => eax -19362 3d/compare-eax-and 0/imm32 -19363 0f 85/jump-if-!= $check-mu-compare-stmt:end/disp32 -19364 # if left is an addr and right is 0, return -19365 { -19366 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19367 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19368 (is-mu-addr-type? %eax) # => eax -19369 3d/compare-eax-and 0/imm32/false -19370 74/jump-if-= break/disp8 -19371 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -19372 (lookup *eax *(eax+4)) # Var-name Var-name => eax -19373 (string-equal? %eax "0") # => eax -19374 3d/compare-eax-and 0/imm32/false -19375 74/jump-if-= break/disp8 -19376 eb/jump $check-mu-compare-stmt:end/disp8 -19377 } -19378 # if left is not number-like, abort -19379 (check-mu-numberlike-arg %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -19380 $check-mu-compare-stmt:end: -19381 # . reclaim locals -19382 81 0/subop/add %esp 0x6c/imm32 -19383 # . restore registers -19384 5f/pop-to-edi -19385 5e/pop-to-esi -19386 5b/pop-to-ebx -19387 5a/pop-to-edx -19388 59/pop-to-ecx -19389 58/pop-to-eax -19390 # . epilogue -19391 89/<- %esp 5/r32/ebp -19392 5d/pop-to-ebp -19393 c3/return -19394 -19395 $check-mu-compare-stmt:error-incorrect-inouts: -19396 (write-buffered *(ebp+0x10) "fn ") -19397 8b/-> *(ebp+0xc) 0/r32/eax -19398 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19399 (write-buffered *(ebp+0x10) %eax) -19400 (write-buffered *(ebp+0x10) ": stmt 'compare' must have two inouts\n") -19401 (flush *(ebp+0x10)) -19402 (stop *(ebp+0x14) 1) -19403 # never gets here -19404 -19405 $check-mu-compare-stmt:error-too-many-outputs: -19406 (write-buffered *(ebp+0x10) "fn ") -19407 8b/-> *(ebp+0xc) 0/r32/eax -19408 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19409 (write-buffered *(ebp+0x10) %eax) -19410 (write-buffered *(ebp+0x10) ": stmt 'compare' must not have any outputs\n") -19411 (flush *(ebp+0x10)) -19412 (stop *(ebp+0x14) 1) -19413 # never gets here -19414 -19415 $check-mu-compare-stmt:error-both-in-memory: -19416 (write-buffered *(ebp+0x10) "fn ") -19417 8b/-> *(ebp+0xc) 0/r32/eax -19418 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19419 (write-buffered *(ebp+0x10) %eax) -19420 (write-buffered *(ebp+0x10) ": stmt compare: both inouts are in memory\n") -19421 (flush *(ebp+0x10)) -19422 (stop *(ebp+0x14) 1) -19423 # never gets here -19424 -19425 $check-mu-compare-stmt:error-left-too-large: -19426 (write-buffered *(ebp+0x10) "fn ") -19427 8b/-> *(ebp+0xc) 0/r32/eax -19428 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19429 (write-buffered *(ebp+0x10) %eax) -19430 (write-buffered *(ebp+0x10) ": stmt compare: '") -19431 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19432 (lookup *eax *(eax+4)) # Var-name Var-name => eax -19433 (write-buffered *(ebp+0x10) %eax) -19434 (write-buffered *(ebp+0x10) "' is too large to compare\n") -19435 (flush *(ebp+0x10)) -19436 (stop *(ebp+0x14) 1) -19437 # never gets here +19180 (check-mu-compare-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19181 e9/jump $check-mu-primitive:end/disp32 +19182 } +19183 # if (op == "address") check-mu-address-stmt +19184 { +19185 (string-equal? %ecx "address") # => eax +19186 3d/compare-eax-and 0/imm32/false +19187 74/jump-if-= break/disp8 +19188 (check-mu-address-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19189 e9/jump $check-mu-primitive:end/disp32 +19190 } +19191 # if (op == "return") check-mu-return-stmt +19192 { +19193 (string-equal? %ecx "return") # => eax +19194 3d/compare-eax-and 0/imm32/false +19195 74/jump-if-= break/disp8 +19196 (check-mu-return-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19197 e9/jump $check-mu-primitive:end/disp32 +19198 } +19199 # if (op == "get") check-mu-get-stmt +19200 { +19201 (string-equal? %ecx "get") # => eax +19202 3d/compare-eax-and 0/imm32/false +19203 74/jump-if-= break/disp8 +19204 (check-mu-get-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19205 e9/jump $check-mu-primitive:end/disp32 +19206 } +19207 # if (op == "index") check-mu-index-stmt +19208 { +19209 (string-equal? %ecx "index") # => eax +19210 3d/compare-eax-and 0/imm32/false +19211 74/jump-if-= break/disp8 +19212 (check-mu-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19213 e9/jump $check-mu-primitive:end/disp32 +19214 } +19215 # if (op == "length") check-mu-length-stmt +19216 { +19217 (string-equal? %ecx "length") # => eax +19218 3d/compare-eax-and 0/imm32/false +19219 74/jump-if-= break/disp8 +19220 (check-mu-length-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19221 e9/jump $check-mu-primitive:end/disp32 +19222 } +19223 # if (op == "compute-offset") check-mu-compute-offset-stmt +19224 { +19225 (string-equal? %ecx "compute-offset") # => eax +19226 3d/compare-eax-and 0/imm32/false +19227 74/jump-if-= break/disp8 +19228 (check-mu-compute-offset-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19229 e9/jump $check-mu-primitive:end/disp32 +19230 } +19231 # if (op == "copy-object") check-mu-copy-object-stmt +19232 { +19233 (string-equal? %ecx "copy-object") # => eax +19234 3d/compare-eax-and 0/imm32/false +19235 74/jump-if-= break/disp8 +19236 (check-mu-copy-object-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19237 e9/jump $check-mu-primitive:end/disp32 +19238 } +19239 # if (op == "allocate") check-mu-allocate-stmt +19240 { +19241 (string-equal? %ecx "allocate") # => eax +19242 3d/compare-eax-and 0/imm32/false +19243 74/jump-if-= break/disp8 +19244 (check-mu-allocate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19245 e9/jump $check-mu-primitive:end/disp32 +19246 } +19247 # if (op == "populate") check-mu-populate-stmt +19248 { +19249 (string-equal? %ecx "populate") # => eax +19250 3d/compare-eax-and 0/imm32/false +19251 74/jump-if-= break/disp8 +19252 (check-mu-populate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19253 e9/jump $check-mu-primitive:end/disp32 +19254 } +19255 # if (op == "populate-stream") check-mu-populate-stream-stmt +19256 { +19257 (string-equal? %ecx "populate-stream") # => eax +19258 3d/compare-eax-and 0/imm32/false +19259 74/jump-if-= break/disp8 +19260 (check-mu-populate-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19261 e9/jump $check-mu-primitive:end/disp32 +19262 } +19263 # if (op == "read-from-stream") check-mu-read-from-stream-stmt +19264 { +19265 (string-equal? %ecx "read-from-stream") # => eax +19266 3d/compare-eax-and 0/imm32/false +19267 74/jump-if-= break/disp8 +19268 (check-mu-read-from-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19269 e9/jump $check-mu-primitive:end/disp32 +19270 } +19271 # if (op == "write-to-stream") check-mu-write-to-stream-stmt +19272 { +19273 (string-equal? %ecx "write-to-stream") # => eax +19274 3d/compare-eax-and 0/imm32/false +19275 74/jump-if-= break/disp8 +19276 (check-mu-write-to-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19277 e9/jump $check-mu-primitive:end/disp32 +19278 } +19279 # if (op == "convert") check-mu-convert-stmt +19280 { +19281 (string-equal? %ecx "convert") # => eax +19282 3d/compare-eax-and 0/imm32/false +19283 74/jump-if-= break/disp8 +19284 (check-mu-convert-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19285 e9/jump $check-mu-primitive:end/disp32 +19286 } +19287 # otherwise check-numberlike-stmt +19288 (check-mu-numberlike-primitive *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19289 $check-mu-primitive:end: +19290 # . restore registers +19291 59/pop-to-ecx +19292 58/pop-to-eax +19293 # . epilogue +19294 89/<- %esp 5/r32/ebp +19295 5d/pop-to-ebp +19296 c3/return +19297 +19298 # by default, Mu primitives should only operate on 'number-like' types +19299 check-mu-numberlike-primitive: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +19300 # . prologue +19301 55/push-ebp +19302 89/<- %ebp 4/r32/esp +19303 # . save registers +19304 50/push-eax +19305 51/push-ecx +19306 56/push-esi +19307 # esi = stmt +19308 8b/-> *(ebp+8) 6/r32/esi +19309 # var gas/ecx: int = 2 +19310 b9/copy-to-ecx 2/imm32 +19311 # - check at most 1 output +19312 # var output/eax: (addr stmt-var) = stmt->outputs +19313 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +19314 { +19315 3d/compare-eax-and 0/imm32 +19316 74/jump-if-= break/disp8 +19317 $check-mu-numberlike-primitive:output: +19318 (check-mu-numberlike-output %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19319 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +19320 3d/compare-eax-and 0/imm32 +19321 0f 85/jump-if-!= $check-mu-numberlike-primitive:error-too-many-outputs/disp32 +19322 # check output is in a register +19323 # --gas +19324 49/decrement-ecx +19325 } +19326 # - check first inout +19327 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +19328 { +19329 3d/compare-eax-and 0/imm32 +19330 0f 84/jump-if-= $check-mu-numberlike-primitive:end/disp32 +19331 $check-mu-numberlike-primitive:first-inout: +19332 (check-mu-numberlike-arg %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19333 # --gas +19334 49/decrement-ecx +19335 } +19336 # - check second inout +19337 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +19338 { +19339 3d/compare-eax-and 0/imm32 +19340 74/jump-if-= $check-mu-numberlike-primitive:end/disp8 +19341 $check-mu-numberlike-primitive:second-inout: +19342 # is a second inout allowed? +19343 81 7/subop/compare %ecx 0/imm32 +19344 0f 84/jump-if-= $check-mu-numberlike-primitive:error-too-many-inouts/disp32 +19345 $check-mu-numberlike-primitive:second-inout-permitted: +19346 (check-mu-numberlike-arg %eax *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19347 } +19348 $check-mu-numberlike-primitive:third-inout: +19349 # if there's a third arg, raise an error +19350 81 7/subop/compare *(eax+8) 0/imm32 # Stmt-var-next +19351 0f 85/jump-if-!= $check-mu-numberlike-primitive:error-too-many-inouts/disp32 +19352 $check-mu-numberlike-primitive:end: +19353 # . restore registers +19354 5e/pop-to-esi +19355 59/pop-to-ecx +19356 58/pop-to-eax +19357 # . epilogue +19358 89/<- %esp 5/r32/ebp +19359 5d/pop-to-ebp +19360 c3/return +19361 +19362 $check-mu-numberlike-primitive:error-too-many-inouts: +19363 (write-buffered *(ebp+0x10) "fn ") +19364 8b/-> *(ebp+0xc) 0/r32/eax +19365 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19366 (write-buffered *(ebp+0x10) %eax) +19367 (write-buffered *(ebp+0x10) ": stmt ") +19368 (lookup *(esi+4) *(esi+8)) # Stmt1-operation Stmt1-operation => eax +19369 (write-buffered *(ebp+0x10) %eax) +19370 (write-buffered *(ebp+0x10) ": too many inouts; most primitives support at most two arguments, across inouts and outputs\n") +19371 (flush *(ebp+0x10)) +19372 (stop *(ebp+0x14) 1) +19373 # never gets here +19374 +19375 $check-mu-numberlike-primitive:error-too-many-outputs: +19376 (write-buffered *(ebp+0x10) "fn ") +19377 8b/-> *(ebp+0xc) 0/r32/eax +19378 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19379 (write-buffered *(ebp+0x10) %eax) +19380 (write-buffered *(ebp+0x10) ": stmt ") +19381 (lookup *(esi+4) *(esi+8)) # Stmt1-operation Stmt1-operation => eax +19382 (write-buffered *(ebp+0x10) %eax) +19383 (write-buffered *(ebp+0x10) ": too many outputs; most primitives support at most one output\n") +19384 (flush *(ebp+0x10)) +19385 (stop *(ebp+0x14) 1) +19386 # never gets here +19387 +19388 check-mu-numberlike-arg: # v: (addr stmt-var), stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +19389 # . prologue +19390 55/push-ebp +19391 89/<- %ebp 4/r32/esp +19392 # . save registers +19393 50/push-eax +19394 56/push-esi +19395 # var t/esi: (addr type-tree) = lookup(v->value->type) +19396 8b/-> *(ebp+8) 0/r32/eax +19397 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +19398 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +19399 89/<- %esi 0/r32/eax +19400 $check-mu-numberlike-arg:check-literal: +19401 # if t is an int, return +19402 (is-simple-mu-type? %esi 0) # literal => eax +19403 3d/compare-eax-and 0/imm32/false +19404 0f 85/jump-if-!= $check-mu-numberlike-arg:end/disp32 +19405 $check-mu-numberlike-arg:check-addr: +19406 # if t is an addr and v is dereferenced, return whether t->payload is an addr +19407 { +19408 (is-mu-addr-type? %esi) # => eax +19409 3d/compare-eax-and 0/imm32/false +19410 74/jump-if-= break/disp8 +19411 8b/-> *(ebp+8) 0/r32/eax +19412 8b/-> *(eax+0x10) 0/r32/eax # Stmt-var-is-deref +19413 3d/compare-eax-and 0/imm32/false +19414 { +19415 74/jump-if-= break/disp8 +19416 (lookup *(esi+0xc) *(esi+0x10)) # Type-tree-right Type-tree-right => eax +19417 # if t->right is null, t = t->left +19418 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +19419 { +19420 75/jump-if-!= break/disp8 +19421 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +19422 } +19423 (is-mu-addr-type? %eax) # => eax +19424 3d/compare-eax-and 0/imm32/false +19425 74/jump-if-= $check-mu-numberlike-arg:end/disp8 +19426 } +19427 } +19428 $check-mu-numberlike-arg:output-checks: +19429 (check-mu-numberlike-output *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18)) +19430 $check-mu-numberlike-arg:end: +19431 # . restore registers +19432 5e/pop-to-esi +19433 58/pop-to-eax +19434 # . epilogue +19435 89/<- %esp 5/r32/ebp +19436 5d/pop-to-ebp +19437 c3/return 19438 -19439 $check-mu-compare-stmt:error-right-too-large: -19440 (write-buffered *(ebp+0x10) "fn ") -19441 8b/-> *(ebp+0xc) 0/r32/eax -19442 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19443 (write-buffered *(ebp+0x10) %eax) -19444 (write-buffered *(ebp+0x10) ": stmt compare: '") -19445 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -19446 (lookup *eax *(eax+4)) # Var-name Var-name => eax -19447 (write-buffered *(ebp+0x10) %eax) -19448 (write-buffered *(ebp+0x10) "' is too large to compare\n") -19449 (flush *(ebp+0x10)) -19450 (stop *(ebp+0x14) 1) -19451 # never gets here -19452 -19453 check-mu-address-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -19454 # . prologue -19455 55/push-ebp -19456 89/<- %ebp 4/r32/esp -19457 # . save registers -19458 50/push-eax -19459 51/push-ecx -19460 52/push-edx -19461 56/push-esi -19462 57/push-edi -19463 $check-mu-address-stmt:get-output: -19464 # esi = stmt -19465 8b/-> *(ebp+8) 6/r32/esi -19466 # var output/edi: (addr stmt-var) = stmt->outputs -19467 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -19468 89/<- %edi 0/r32/eax -19469 # zero outputs -19470 3d/compare-eax-and 0/imm32 -19471 0f 84/jump-if-= $check-mu-address-stmt:error-no-output/disp32 -19472 # > 1 output -19473 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -19474 3d/compare-eax-and 0/imm32 -19475 0f 85/jump-if-!= $check-mu-address-stmt:error-too-many-outputs/disp32 -19476 $check-mu-address-stmt:get-inout: -19477 # var inout/esi: (addr stmt-var) = stmt->inouts -19478 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -19479 89/<- %esi 0/r32/eax -19480 # zero inouts -19481 3d/compare-eax-and 0/imm32 -19482 0f 84/jump-if-= $check-mu-address-stmt:error-no-inout/disp32 -19483 # > 1 inout -19484 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -19485 3d/compare-eax-and 0/imm32 -19486 0f 85/jump-if-!= $check-mu-address-stmt:error-too-many-inouts/disp32 -19487 $check-mu-address-stmt:types: -19488 # if output not in register, abort -19489 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19490 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -19491 3d/compare-eax-and 0/imm32 -19492 0f 84/jump-if-= $check-mu-address-stmt:error-output-not-in-register/disp32 -19493 # var output-type/edx: (addr type-tree) = output->value->type -19494 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19495 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19496 89/<- %edx 0/r32/eax -19497 # if output-type not an addr, abort -19498 (is-mu-addr-type? %edx) # => eax -19499 3d/compare-eax-and 0/imm32/false -19500 0f 84/jump-if-= $check-mu-address-stmt:error-output-not-address/disp32 -19501 # output-type = output-type->right -19502 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax -19503 # if output-type->right is null, output-type = output-type->left -19504 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -19505 { -19506 75/jump-if-!= break/disp8 -19507 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -19508 } -19509 89/<- %edx 0/r32/eax -19510 # var inout-type/ecx: (addr type-tree) = inout->value->type -19511 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -19512 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19513 89/<- %ecx 0/r32/eax -19514 # if (inout->is-deref?) inout-type = inout-type->payload -19515 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref -19516 3d/compare-eax-and 0/imm32/false -19517 { -19518 74/jump-if-= break/disp8 -19519 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -19520 # if inout-type->right is null, t = inout-type->left -19521 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -19522 { -19523 75/jump-if-!= break/disp8 -19524 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -19525 } -19526 89/<- %ecx 0/r32/eax -19527 } -19528 # if (inout-type != output-type) abort -19529 (type-equal-ignoring-capacity? %edx %ecx) # => eax -19530 3d/compare-eax-and 0/imm32 -19531 0f 84/jump-if-= $check-mu-address-stmt:error-type-mismatch/disp32 -19532 $check-mu-address-stmt:end: -19533 # . restore registers -19534 5f/pop-to-edi -19535 5e/pop-to-esi -19536 5a/pop-to-edx -19537 59/pop-to-ecx -19538 58/pop-to-eax -19539 # . epilogue -19540 89/<- %esp 5/r32/ebp -19541 5d/pop-to-ebp -19542 c3/return -19543 -19544 $check-mu-address-stmt:error-no-inout: -19545 (write-buffered *(ebp+0x10) "fn ") -19546 8b/-> *(ebp+0xc) 0/r32/eax -19547 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19548 (write-buffered *(ebp+0x10) %eax) -19549 (write-buffered *(ebp+0x10) ": stmt 'address' expects an inout\n") -19550 (flush *(ebp+0x10)) -19551 (stop *(ebp+0x14) 1) -19552 # never gets here -19553 -19554 $check-mu-address-stmt:error-too-many-inouts: -19555 (write-buffered *(ebp+0x10) "fn ") -19556 8b/-> *(ebp+0xc) 0/r32/eax -19557 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19558 (write-buffered *(ebp+0x10) %eax) -19559 (write-buffered *(ebp+0x10) ": stmt 'address' must have just one inout\n") -19560 (flush *(ebp+0x10)) -19561 (stop *(ebp+0x14) 1) -19562 # never gets here -19563 -19564 $check-mu-address-stmt:error-no-output: -19565 (write-buffered *(ebp+0x10) "fn ") -19566 8b/-> *(ebp+0xc) 0/r32/eax -19567 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19568 (write-buffered *(ebp+0x10) %eax) -19569 (write-buffered *(ebp+0x10) ": stmt 'address' expects an output\n") -19570 (flush *(ebp+0x10)) -19571 (stop *(ebp+0x14) 1) -19572 # never gets here -19573 -19574 $check-mu-address-stmt:error-output-not-in-register: -19575 (write-buffered *(ebp+0x10) "fn ") -19576 8b/-> *(ebp+0xc) 0/r32/eax -19577 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19578 (write-buffered *(ebp+0x10) %eax) -19579 (write-buffered *(ebp+0x10) ": stmt address: output '") -19580 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19581 (lookup *eax *(eax+4)) # Var-name Var-name => eax -19582 (write-buffered *(ebp+0x10) %eax) -19583 (write-buffered *(ebp+0x10) "' not in a register\n") -19584 (flush *(ebp+0x10)) -19585 (stop *(ebp+0x14) 1) -19586 # never gets here -19587 -19588 $check-mu-address-stmt:error-too-many-outputs: -19589 (write-buffered *(ebp+0x10) "fn ") -19590 8b/-> *(ebp+0xc) 0/r32/eax -19591 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19592 (write-buffered *(ebp+0x10) %eax) -19593 (write-buffered *(ebp+0x10) ": stmt 'address' must have just one output\n") -19594 (flush *(ebp+0x10)) -19595 (stop *(ebp+0x14) 1) -19596 # never gets here -19597 -19598 $check-mu-address-stmt:error-output-not-address: -19599 (write-buffered *(ebp+0x10) "fn ") -19600 8b/-> *(ebp+0xc) 0/r32/eax -19601 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19602 (write-buffered *(ebp+0x10) %eax) -19603 (write-buffered *(ebp+0x10) ": stmt address: output '") -19604 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19605 (lookup *eax *(eax+4)) # Var-name Var-name => eax -19606 (write-buffered *(ebp+0x10) %eax) -19607 (write-buffered *(ebp+0x10) "' is not an addr\n") -19608 (flush *(ebp+0x10)) -19609 (stop *(ebp+0x14) 1) -19610 # never gets here -19611 -19612 $check-mu-address-stmt:error-type-mismatch: -19613 (write-buffered *(ebp+0x10) "fn ") -19614 8b/-> *(ebp+0xc) 0/r32/eax -19615 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19616 (write-buffered *(ebp+0x10) %eax) -19617 (write-buffered *(ebp+0x10) ": stmt address: output '") -19618 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19619 (lookup *eax *(eax+4)) # Var-name Var-name => eax -19620 (write-buffered *(ebp+0x10) %eax) -19621 (write-buffered *(ebp+0x10) "' cannot hold address of '") -19622 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -19623 (lookup *eax *(eax+4)) # Var-name Var-name => eax -19624 (write-buffered *(ebp+0x10) %eax) -19625 (write-buffered *(ebp+0x10) "'\n") -19626 (flush *(ebp+0x10)) -19627 (stop *(ebp+0x14) 1) -19628 # never gets here -19629 -19630 type-equal-ignoring-capacity?: # a: (addr type-tree), b: (addr type-tree) -> result/eax: boolean -19631 # . prologue -19632 55/push-ebp -19633 89/<- %ebp 4/r32/esp -19634 # . save registers -19635 51/push-ecx -19636 52/push-edx -19637 53/push-ebx -19638 # var curr-a/ecx: (addr type-tree) = a -19639 8b/-> *(ebp+8) 1/r32/ecx -19640 # var curr-b/ebx: (addr type-tree) = b -19641 8b/-> *(ebp+0xc) 3/r32/ebx -19642 # if (curr-a->is-atom?) fall back to regular equality -19643 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -19644 0f 85/jump-if-!= $type-equal-ignoring-capacity?:base-case/disp32 -19645 # if (curr-a->left != curr-b->left) return false -19646 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -19647 89/<- %edx 0/r32/eax -19648 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -19649 (type-equal? %edx %eax) # => eax -19650 3d/compare-eax-and 0/imm32/false -19651 0f 84/jump-if-= $type-equal-ignoring-capacity?:end/disp32 # eax switches meaning -19652 # if (curr-a->left == "array") curr-a = curr-a->element-type -19653 { -19654 (is-mu-array? %edx) # => eax -19655 3d/compare-eax-and 0/imm32/false -19656 75/jump-if-!= break/disp8 -19657 $type-equal-ignoring-capacity?:array: -19658 # curr-a = curr-a->right->left -19659 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -19660 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -19661 89/<- %ecx 0/r32/eax -19662 # curr-b = curr-b->right->left -19663 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -19664 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -19665 89/<- %ebx 0/r32/eax -19666 eb/jump $type-equal-ignoring-capacity?:base-case/disp8 -19667 } -19668 # if (curr-a->left == "stream") curr-a = curr-a->element-type -19669 { -19670 (is-mu-stream? %edx) # => eax -19671 3d/compare-eax-and 0/imm32/false -19672 75/jump-if-!= break/disp8 -19673 $type-equal-ignoring-capacity?:stream: -19674 # curr-a = curr-a->right->left -19675 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -19676 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -19677 89/<- %ecx 0/r32/eax -19678 # curr-b = curr-b->right->left -19679 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -19680 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -19681 89/<- %ebx 0/r32/eax -19682 eb/jump $type-equal-ignoring-capacity?:base-case/disp8 -19683 } -19684 $type-equal-ignoring-capacity?:base-case: -19685 # return type-equal?(curr-a, curr-b) -19686 (type-equal? %ecx %ebx) # => eax -19687 $type-equal-ignoring-capacity?:end: -19688 # . restore registers -19689 5b/pop-to-ebx -19690 5a/pop-to-edx -19691 59/pop-to-ecx -19692 # . epilogue -19693 89/<- %esp 5/r32/ebp -19694 5d/pop-to-ebp -19695 c3/return -19696 -19697 check-mu-return-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -19698 # . prologue -19699 55/push-ebp -19700 89/<- %ebp 4/r32/esp -19701 # . save registers -19702 50/push-eax -19703 51/push-ecx -19704 52/push-edx -19705 53/push-ebx -19706 56/push-esi -19707 57/push-edi -19708 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) -19709 81 5/subop/subtract %esp 0x60/imm32 -19710 68/push 0x60/imm32/size -19711 68/push 0/imm32/read -19712 68/push 0/imm32/write -19713 89/<- %edx 4/r32/esp -19714 # var template/esi: (addr list var) = fn->outputs -19715 8b/-> *(ebp+0xc) 0/r32/eax -19716 (lookup *(eax+0x10) *(eax+0x14)) # Function-outputs Function-outputs => eax -19717 89/<- %esi 0/r32/eax -19718 # var curr-template/ebx: (addr list var) = fn->outputs -19719 89/<- %ebx 0/r32/eax -19720 # var curr/edi: (addr stmt-var) = stmt->inouts -19721 8b/-> *(ebp+8) 0/r32/eax -19722 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -19723 89/<- %edi 0/r32/eax -19724 { -19725 # if template is null, break -19726 81 7/subop/compare %ebx 0/imm32 -19727 0f 84/jump-if-= break/disp32 -19728 # if curr is null, abort -19729 81 7/subop/compare %edi 0/imm32 -19730 0f 84/jump-if-= $check-mu-return-stmt:error-too-few-inouts/disp32 -19731 # var template-type/ecx: (addr type-tree) = template->value->type -19732 (lookup *ebx *(ebx+4)) # List-value List-value => eax -19733 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19734 89/<- %ecx 0/r32/eax -19735 # var curr-type/eax: (addr type-tree) = curr->value->type -19736 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19737 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -19738 # if (curr->is-deref?) curr-type = payload of curr-type -19739 81 7/subop/compare *(edi+0x10) 0/imm32/false # Stmt-var-is-deref -19740 { -19741 74/jump-if-= break/disp8 -19742 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -19743 # if t->right is null, t = t->left -19744 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -19745 75/jump-if-!= break/disp8 -19746 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -19747 } -19748 # if (curr-type != template-type) abort -19749 (type-match? %ecx %eax %edx) # => eax -19750 3d/compare-eax-and 0/imm32/false -19751 0f 84/jump-if-= $check-mu-return-stmt:error1/disp32 -19752 # if register-within-list-with-conflict?(curr, original template, curr-template, stmt) abort -19753 (register-within-list-with-conflict? %edi %esi %ebx *(ebp+8)) # => eax -19754 3d/compare-eax-and 0/imm32/false -19755 0f 85/jump-if-!= $check-mu-return-stmt:error2/disp32 -19756 # template = template->next -19757 (lookup *(ebx+8) *(ebx+0xc)) # List-next List-next => eax -19758 89/<- %ebx 0/r32/eax -19759 # curr = curr->next -19760 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -19761 89/<- %edi 0/r32/eax -19762 # -19763 e9/jump loop/disp32 -19764 } -19765 # if curr is not null, abort -19766 81 7/subop/compare %edi 0/imm32 -19767 0f 85/jump-if-!= $check-mu-return-stmt:error-too-many-inouts/disp32 -19768 $check-mu-return-stmt:end: -19769 # . reclaim locals -19770 81 0/subop/add %esp 0x6c/imm32 -19771 # . restore registers -19772 5f/pop-to-edi -19773 5e/pop-to-esi -19774 5b/pop-to-ebx -19775 5a/pop-to-edx -19776 59/pop-to-ecx -19777 58/pop-to-eax -19778 # . epilogue -19779 89/<- %esp 5/r32/ebp -19780 5d/pop-to-ebp -19781 c3/return -19782 -19783 $check-mu-return-stmt:error1: -19784 (write-buffered *(ebp+0x10) "fn ") -19785 8b/-> *(ebp+0xc) 0/r32/eax -19786 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19787 (write-buffered *(ebp+0x10) %eax) -19788 (write-buffered *(ebp+0x10) ": return: '") -19789 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19790 (lookup *eax *(eax+4)) # Var-name Var-name => eax -19791 (write-buffered *(ebp+0x10) %eax) -19792 (write-buffered *(ebp+0x10) "' has the wrong type\n") -19793 (flush *(ebp+0x10)) -19794 (stop *(ebp+0x14) 1) -19795 # never gets here -19796 -19797 $check-mu-return-stmt:error2: -19798 (write-buffered *(ebp+0x10) "fn ") -19799 8b/-> *(ebp+0xc) 0/r32/eax -19800 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19801 (write-buffered *(ebp+0x10) %eax) -19802 (write-buffered *(ebp+0x10) ": return: '") -19803 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -19804 (lookup *eax *(eax+4)) # Var-name Var-name => eax -19805 (write-buffered *(ebp+0x10) %eax) -19806 (write-buffered *(ebp+0x10) "' is no longer available\n") -19807 (flush *(ebp+0x10)) -19808 (stop *(ebp+0x14) 1) -19809 # never gets here -19810 -19811 $check-mu-return-stmt:error-too-few-inouts: -19812 (write-buffered *(ebp+0x10) "fn ") -19813 8b/-> *(ebp+0xc) 0/r32/eax -19814 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19815 (write-buffered *(ebp+0x10) %eax) -19816 (write-buffered *(ebp+0x10) ": return: too few inouts\n") -19817 (flush *(ebp+0x10)) -19818 (stop *(ebp+0x14) 1) -19819 # never gets here -19820 -19821 $check-mu-return-stmt:error-too-many-inouts: -19822 (write-buffered *(ebp+0x10) "fn ") -19823 8b/-> *(ebp+0xc) 0/r32/eax -19824 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19825 (write-buffered *(ebp+0x10) %eax) -19826 (write-buffered *(ebp+0x10) ": return: too many inouts\n") -19827 (flush *(ebp+0x10)) -19828 (stop *(ebp+0x14) 1) -19829 # never gets here -19830 -19831 check-all-unique-registers: # outputs: (addr list var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -19832 # . prologue -19833 55/push-ebp -19834 89/<- %ebp 4/r32/esp -19835 # . save registers -19836 50/push-eax -19837 51/push-ecx -19838 56/push-esi -19839 # var table/esi: (addr table (handle array byte) int 8) -19840 81 5/subop/subtract %esp 0x60/imm32 -19841 68/push 0x60/imm32/size -19842 68/push 0/imm32/read -19843 68/push 0/imm32/write -19844 89/<- %esi 4/r32/esp -19845 # var curr/ecx: (addr list var) = outputs -19846 8b/-> *(ebp+8) 1/r32/ecx -19847 { -19848 # if (curr == 0) break -19849 81 7/subop/compare %ecx 0/imm32 -19850 0f 84/jump-if-= break/disp32 -19851 # var reg/eax: (addr array byte) = curr->value->register # guaranteed to exist -19852 (lookup *ecx *(ecx+4)) # List-value List-value => eax -19853 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -19854 # if reg exists in table, abort -19855 (maybe-get %esi %eax 0xc) # => eax -19856 3d/compare-eax-and 0/imm32 -19857 0f 85/jump-if-!= $check-all-unique-registers:abort/disp32 -19858 # insert reg in table -19859 (lookup *ecx *(ecx+4)) # List-value List-value => eax -19860 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -19861 (get-or-insert %esi %eax 0xc Heap) -19862 # curr = curr->next -19863 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -19864 89/<- %ecx 0/r32/eax -19865 e9/jump loop/disp32 -19866 } -19867 $check-all-unique-registers:end: -19868 # . reclaim locals -19869 81 0/subop/add %esp 0x6c/imm32 -19870 # . restore registers -19871 5e/pop-to-esi -19872 59/pop-to-ecx -19873 58/pop-to-eax -19874 # . epilogue -19875 89/<- %esp 5/r32/ebp -19876 5d/pop-to-ebp -19877 c3/return -19878 -19879 $check-all-unique-registers:abort: -19880 (write-buffered *(ebp+0x10) "fn ") -19881 8b/-> *(ebp+0xc) 0/r32/eax -19882 (lookup *eax *(eax+4)) # Function-name Function-name => eax -19883 (write-buffered *(ebp+0x10) %eax) -19884 (write-buffered *(ebp+0x10) ": outputs must be in unique registers\n") -19885 (flush *(ebp+0x10)) -19886 (stop *(ebp+0x14) 1) -19887 # never gets here -19888 -19889 # return false if s's register is not between start (inclusive) and end (exclusive) -19890 # return false if the positionally corresponding register in stmt->inouts (where s comes from) is also s's register -19891 # otherwise return true -19892 register-within-list-with-conflict?: # s: (addr stmt-var), start: (addr list var), end: (addr list var), stmt: (addr stmt) -> result/eax: boolean -19893 # . prologue -19894 55/push-ebp -19895 89/<- %ebp 4/r32/esp -19896 # . save registers -19897 51/push-ecx -19898 52/push-edx -19899 53/push-ebx -19900 56/push-esi -19901 57/push-edi -19902 # var target/ebx: (addr array byte) = s->value->register -19903 8b/-> *(ebp+8) 0/r32/eax -19904 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -19905 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -19906 #? (write-buffered Stderr "AA: ") -19907 #? (write-buffered Stderr %eax) -19908 #? (write-buffered Stderr Newline) -19909 #? (flush Stderr) -19910 # if (var->register == 0) return false -19911 3d/compare-eax-and 0/imm32 -19912 0f 84/jump-if-= $register-within-list-with-conflict?:end/disp32 # eax turns into result -19913 89/<- %ebx 0/r32/eax -19914 # var curr/ecx: (addr list var) = start -19915 8b/-> *(ebp+0xc) 1/r32/ecx -19916 # edx = end -19917 8b/-> *(ebp+0x10) 2/r32/edx -19918 { -19919 # if (curr == 0) break -19920 81 7/subop/compare %edi 0/imm32 -19921 0f 84/jump-if-= break/disp32 -19922 # if (curr == end) break -19923 39/compare %ecx 2/r32/edx -19924 0f 84/jump-if-= break/disp32 -19925 # var curr-reg/eax: (addr array byte) = curr->value->register -19926 (lookup *ecx *(ecx+4)) # List-value List-value => eax -19927 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -19928 # if (curr-reg == 0) continue -19929 3d/compare-eax-and 0/imm32 -19930 74/jump-if-= $register-within-list-with-conflict?:continue/disp8 -19931 # if (curr-reg == target) check for conflict -19932 (string-equal? %eax %ebx) # => eax -19933 3d/compare-eax-and 0/imm32/false -19934 { -19935 74/jump-if-= break/disp8 -19936 #? (write-buffered Stderr "conflict?\n") -19937 #? (flush Stderr) -19938 # var return-inouts/eax: (addr stmt-var) = stmt->inouts -19939 8b/-> *(ebp+0x14) 0/r32/eax -19940 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -19941 (register-conflict? %ebx %eax *(ebp+0xc)) # => eax -19942 eb/jump $register-within-list-with-conflict?:end/disp8 -19943 } -19944 $register-within-list-with-conflict?:continue: -19945 # curr = curr->next -19946 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -19947 89/<- %ecx 0/r32/eax -19948 e9/jump loop/disp32 -19949 } -19950 # return false -19951 b8/copy-to-eax 0/imm32/false -19952 $register-within-list-with-conflict?:end: -19953 # . restore registers -19954 5f/pop-to-edi -19955 5e/pop-to-esi -19956 5b/pop-to-ebx -19957 5a/pop-to-edx -19958 59/pop-to-ecx -19959 # . epilogue -19960 89/<- %esp 5/r32/ebp -19961 5d/pop-to-ebp -19962 c3/return -19963 -19964 # At the first occurrence of register 'reg' in fn-outputs, -19965 # check if the corresponding element of return-inouts has a different register. -19966 # This hacky helper is intended to be called in one specific place. Don't -19967 # reuse it as is. -19968 register-conflict?: # reg: (addr array byte), return-inouts: (addr stmt-var), fn-outputs: (addr list var) => result/eax: boolean -19969 # . prologue -19970 55/push-ebp -19971 89/<- %ebp 4/r32/esp -19972 # . save registers -19973 51/push-ecx -19974 52/push-edx -19975 53/push-ebx -19976 56/push-esi -19977 57/push-edi -19978 #? (write-buffered Stderr "BB: ") -19979 #? (write-buffered Stderr *(ebp+8)) -19980 #? (write-buffered Stderr Newline) -19981 #? (flush Stderr) -19982 # var curr-output/edi: (addr list var) = fn-outputs -19983 8b/-> *(ebp+0x10) 7/r32/edi -19984 # var curr-inout/esi: (addr stmt-var) = return-inouts -19985 8b/-> *(ebp+0xc) 6/r32/esi -19986 { -19987 # if (curr-output == 0) abort -19988 81 7/subop/compare %edi 0/imm32 -19989 0f 84/jump-if-= break/disp32 -19990 # if (curr-output->value->register != reg) continue -19991 (lookup *edi *(edi+4)) # List-value List-value => eax -19992 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -19993 (string-equal? %eax *(ebp+8)) # => eax -19994 3d/compare-eax-and 0/imm32/false -19995 0f 84/jump-if= $register-conflict?:continue/disp32 -19996 #? (write-buffered Stderr "rescan\n") -19997 #? (flush Stderr) -19998 # var curr-reg/eax: (addr array byte) = curr-inout->value->register -19999 (lookup *esi *(esi+4)) # List-value List-value => eax -20000 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -20001 # if (curr-reg == 0) return true -20002 3d/compare-eax-and 0/imm32 +19439 check-mu-numberlike-output: # v: (addr stmt-var), stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +19440 # . prologue +19441 55/push-ebp +19442 89/<- %ebp 4/r32/esp +19443 # . save registers +19444 50/push-eax +19445 # +19446 (is-mu-numberlike-output-var? *(ebp+8)) # => eax +19447 3d/compare-eax-and 0/imm32/false +19448 0f 84/jump-if-= $check-mu-numberlike-output:fail/disp32 +19449 $check-mu-numberlike-output:end: +19450 # . restore registers +19451 58/pop-to-eax +19452 # . epilogue +19453 89/<- %esp 5/r32/ebp +19454 5d/pop-to-ebp +19455 c3/return +19456 +19457 $check-mu-numberlike-output:fail: +19458 # otherwise raise an error +19459 (write-buffered *(ebp+0x14) "fn ") +19460 8b/-> *(ebp+0x10) 0/r32/eax +19461 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19462 (write-buffered *(ebp+0x14) %eax) +19463 (write-buffered *(ebp+0x14) ": stmt ") +19464 8b/-> *(ebp+0xc) 0/r32/eax +19465 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +19466 (write-buffered *(ebp+0x14) %eax) +19467 (write-buffered *(ebp+0x14) ": '") +19468 8b/-> *(ebp+8) 0/r32/eax +19469 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +19470 (lookup *eax *(eax+4)) # Var-name Var-name => eax +19471 (write-buffered *(ebp+0x14) %eax) +19472 (write-buffered *(ebp+0x14) "' must be a non-addr non-offset scalar\n") +19473 (flush *(ebp+0x14)) +19474 (stop *(ebp+0x18) 1) +19475 # never gets here +19476 +19477 is-mu-numberlike-output-var?: # v: (addr stmt-var) -> result/eax: boolean +19478 # . prologue +19479 55/push-ebp +19480 89/<- %ebp 4/r32/esp +19481 # +19482 8b/-> *(ebp+8) 0/r32/eax +19483 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +19484 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +19485 (is-mu-numberlike-output? %eax) # => eax +19486 $is-mu-numberlike-output-var?:end: +19487 # . epilogue +19488 89/<- %esp 5/r32/ebp +19489 5d/pop-to-ebp +19490 c3/return +19491 +19492 is-mu-numberlike-output?: # v: (addr type-tree) -> result/eax: boolean +19493 # . prologue +19494 55/push-ebp +19495 89/<- %ebp 4/r32/esp +19496 # . save registers +19497 56/push-esi +19498 # var t/esi: (addr type-tree) = lookup(v->value->type) +19499 8b/-> *(ebp+8) 6/r32/esi +19500 $is-mu-numberlike-output?:check-int: +19501 # if t is an int, return +19502 (is-simple-mu-type? %esi 1) # int => eax +19503 3d/compare-eax-and 0/imm32/false +19504 0f 85/jump-if-!= $is-mu-numberlike-output?:return-true/disp32 +19505 $is-mu-numberlike-output?:check-float: +19506 # if t is a float, return +19507 (is-simple-mu-type? %esi 0xf) # float => eax +19508 3d/compare-eax-and 0/imm32/false +19509 75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8 +19510 $is-mu-numberlike-output?:check-boolean: +19511 # if t is a boolean, return +19512 (is-simple-mu-type? %esi 5) # boolean => eax +19513 3d/compare-eax-and 0/imm32/false +19514 75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8 +19515 $is-mu-numberlike-output?:check-byte: +19516 # if t is a byte, return +19517 (is-simple-mu-type? %esi 8) # byte => eax +19518 3d/compare-eax-and 0/imm32/false +19519 75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8 +19520 $is-mu-numberlike-output?:check-code-point: +19521 # if t is a code-point, return +19522 (is-simple-mu-type? %esi 0xd) # code-point => eax +19523 3d/compare-eax-and 0/imm32/false +19524 75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8 +19525 $is-mu-numberlike-output?:check-grapheme: +19526 # if t is a grapheme, return +19527 (is-simple-mu-type? %esi 0xe) # grapheme => eax +19528 3d/compare-eax-and 0/imm32/false +19529 75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8 +19530 $is-mu-numberlike-output?:return-false: +19531 b8/copy-to-eax 0/imm32/false +19532 eb/jump $is-mu-numberlike-output?:end/disp8 +19533 $is-mu-numberlike-output?:return-true: +19534 b8/copy-to-eax 1/imm32/true +19535 $is-mu-numberlike-output?:end: +19536 # . restore registers +19537 5e/pop-to-esi +19538 # . epilogue +19539 89/<- %esp 5/r32/ebp +19540 5d/pop-to-ebp +19541 c3/return +19542 +19543 check-mu-copy-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +19544 # . prologue +19545 55/push-ebp +19546 89/<- %ebp 4/r32/esp +19547 # . save registers +19548 50/push-eax +19549 51/push-ecx +19550 52/push-edx +19551 56/push-esi +19552 57/push-edi +19553 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) +19554 81 5/subop/subtract %esp 0x60/imm32 +19555 68/push 0x60/imm32/size +19556 68/push 0/imm32/read +19557 68/push 0/imm32/write +19558 89/<- %edx 4/r32/esp +19559 $check-mu-copy-stmt:get-output: +19560 # esi = stmt +19561 8b/-> *(ebp+8) 6/r32/esi +19562 # var output/edi: (addr stmt-var) = stmt->outputs +19563 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +19564 89/<- %edi 0/r32/eax +19565 # zero outputs +19566 3d/compare-eax-and 0/imm32 +19567 0f 84/jump-if-= $check-mu-copy-stmt:error-no-output/disp32 +19568 # > 1 output +19569 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +19570 3d/compare-eax-and 0/imm32 +19571 0f 85/jump-if-!= $check-mu-copy-stmt:error-too-many-outputs/disp32 +19572 $check-mu-copy-stmt:get-inout: +19573 # var inout/esi: (addr stmt-var) = stmt->inouts +19574 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +19575 89/<- %esi 0/r32/eax +19576 # zero inouts +19577 3d/compare-eax-and 0/imm32 +19578 0f 84/jump-if-= $check-mu-copy-stmt:error-no-inout/disp32 +19579 # > 1 inout +19580 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +19581 3d/compare-eax-and 0/imm32 +19582 0f 85/jump-if-!= $check-mu-copy-stmt:error-too-many-inouts/disp32 +19583 $check-mu-copy-stmt:types: +19584 # var inout-type/ecx: (addr type-tree) = inout->value->type +19585 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +19586 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +19587 89/<- %ecx 0/r32/eax +19588 # if (inout->is-deref?) inout-type = inout-type->payload +19589 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref +19590 3d/compare-eax-and 0/imm32/false +19591 { +19592 74/jump-if-= break/disp8 +19593 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +19594 # if inout-type->right is null, t = inout-type->left +19595 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +19596 { +19597 75/jump-if-!= break/disp8 +19598 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +19599 } +19600 89/<- %ecx 0/r32/eax +19601 } +19602 # if output not in register, abort +19603 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +19604 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +19605 3d/compare-eax-and 0/imm32 +19606 0f 84/jump-if-= $check-mu-copy-stmt:error-output-not-in-register/disp32 +19607 # if inout is not a scalar, abort +19608 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +19609 (size-of %eax) # => eax +19610 3d/compare-eax-and 4/imm32 +19611 0f 8f/jump-if-> $check-mu-copy-stmt:error-inout-too-large/disp32 +19612 # var output-type/eax: (addr type-tree) = output->value->type +19613 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +19614 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +19615 # if (inout-type == output-type) return +19616 (type-match? %eax %ecx %edx) # => eax +19617 3d/compare-eax-and 0/imm32 +19618 0f 85/jump-if-!= $check-mu-copy-stmt:end/disp32 +19619 # if output is an addr and inout is 0, return +19620 { +19621 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +19622 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +19623 (is-mu-addr-type? %eax) # => eax +19624 3d/compare-eax-and 0/imm32/false +19625 74/jump-if-= break/disp8 +19626 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +19627 (lookup *eax *(eax+4)) # Var-name Var-name => eax +19628 (string-equal? %eax "0") # => eax +19629 3d/compare-eax-and 0/imm32/false +19630 74/jump-if-= break/disp8 +19631 e9/jump $check-mu-copy-stmt:end/disp32 +19632 } +19633 # if output is an offset and inout is 0, return +19634 { +19635 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +19636 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +19637 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +19638 75/jump-if-!= break/disp8 +19639 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +19640 (is-simple-mu-type? %eax 7) # offset => eax +19641 3d/compare-eax-and 0/imm32/false +19642 74/jump-if-= break/disp8 +19643 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +19644 (lookup *eax *(eax+4)) # Var-name Var-name => eax +19645 (string-equal? %eax "0") # => eax +19646 3d/compare-eax-and 0/imm32/false +19647 74/jump-if-= break/disp8 +19648 eb/jump $check-mu-copy-stmt:end/disp8 +19649 } +19650 # if output is not number-like, abort +19651 (check-mu-numberlike-output %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19652 $check-mu-copy-stmt:end: +19653 # . reclaim locals +19654 81 0/subop/add %esp 0x6c/imm32 +19655 # . restore registers +19656 5f/pop-to-edi +19657 5e/pop-to-esi +19658 5a/pop-to-edx +19659 59/pop-to-ecx +19660 58/pop-to-eax +19661 # . epilogue +19662 89/<- %esp 5/r32/ebp +19663 5d/pop-to-ebp +19664 c3/return +19665 +19666 $check-mu-copy-stmt:error-no-inout: +19667 (write-buffered *(ebp+0x10) "fn ") +19668 8b/-> *(ebp+0xc) 0/r32/eax +19669 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19670 (write-buffered *(ebp+0x10) %eax) +19671 (write-buffered *(ebp+0x10) ": stmt 'copy' expects an inout\n") +19672 (flush *(ebp+0x10)) +19673 (stop *(ebp+0x14) 1) +19674 # never gets here +19675 +19676 $check-mu-copy-stmt:error-too-many-inouts: +19677 (write-buffered *(ebp+0x10) "fn ") +19678 8b/-> *(ebp+0xc) 0/r32/eax +19679 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19680 (write-buffered *(ebp+0x10) %eax) +19681 (write-buffered *(ebp+0x10) ": stmt 'copy' must have just one inout\n") +19682 (flush *(ebp+0x10)) +19683 (stop *(ebp+0x14) 1) +19684 # never gets here +19685 +19686 $check-mu-copy-stmt:error-no-output: +19687 (write-buffered *(ebp+0x10) "fn ") +19688 8b/-> *(ebp+0xc) 0/r32/eax +19689 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19690 (write-buffered *(ebp+0x10) %eax) +19691 (write-buffered *(ebp+0x10) ": stmt 'copy' expects an output\n") +19692 (flush *(ebp+0x10)) +19693 (stop *(ebp+0x14) 1) +19694 # never gets here +19695 +19696 $check-mu-copy-stmt:error-output-not-in-register: +19697 (write-buffered *(ebp+0x10) "fn ") +19698 8b/-> *(ebp+0xc) 0/r32/eax +19699 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19700 (write-buffered *(ebp+0x10) %eax) +19701 (write-buffered *(ebp+0x10) ": stmt copy: output '") +19702 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +19703 (lookup *eax *(eax+4)) # Var-name Var-name => eax +19704 (write-buffered *(ebp+0x10) %eax) +19705 (write-buffered *(ebp+0x10) "' not in a register\n") +19706 (flush *(ebp+0x10)) +19707 (stop *(ebp+0x14) 1) +19708 # never gets here +19709 +19710 $check-mu-copy-stmt:error-too-many-outputs: +19711 (write-buffered *(ebp+0x10) "fn ") +19712 8b/-> *(ebp+0xc) 0/r32/eax +19713 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19714 (write-buffered *(ebp+0x10) %eax) +19715 (write-buffered *(ebp+0x10) ": stmt 'copy' must have just one output\n") +19716 (flush *(ebp+0x10)) +19717 (stop *(ebp+0x14) 1) +19718 # never gets here +19719 +19720 $check-mu-copy-stmt:error-inout-too-large: +19721 (write-buffered *(ebp+0x10) "fn ") +19722 8b/-> *(ebp+0xc) 0/r32/eax +19723 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19724 (write-buffered *(ebp+0x10) %eax) +19725 (write-buffered *(ebp+0x10) ": stmt copy: '") +19726 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +19727 (lookup *eax *(eax+4)) # Var-name Var-name => eax +19728 (write-buffered *(ebp+0x10) %eax) +19729 (write-buffered *(ebp+0x10) "' is too large to fit in a register\n") +19730 (flush *(ebp+0x10)) +19731 (stop *(ebp+0x14) 1) +19732 # never gets here +19733 +19734 check-mu-copy-to-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +19735 # . prologue +19736 55/push-ebp +19737 89/<- %ebp 4/r32/esp +19738 # . save registers +19739 50/push-eax +19740 51/push-ecx +19741 52/push-edx +19742 53/push-ebx +19743 56/push-esi +19744 57/push-edi +19745 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) +19746 81 5/subop/subtract %esp 0x60/imm32 +19747 68/push 0x60/imm32/size +19748 68/push 0/imm32/read +19749 68/push 0/imm32/write +19750 89/<- %edx 4/r32/esp +19751 # esi = stmt +19752 8b/-> *(ebp+8) 6/r32/esi +19753 $check-mu-copy-to-stmt:check-for-output: +19754 # if stmt->outputs abort +19755 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +19756 3d/compare-eax-and 0/imm32 +19757 0f 85/jump-if-!= $check-mu-copy-to-stmt:error-too-many-outputs/disp32 +19758 $check-mu-copy-to-stmt:get-dest: +19759 # var dest/edi: (addr stmt-var) = stmt->inouts +19760 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +19761 89/<- %edi 0/r32/eax +19762 # zero inouts +19763 3d/compare-eax-and 0/imm32 +19764 0f 84/jump-if-= $check-mu-copy-to-stmt:error-incorrect-inouts/disp32 +19765 $check-mu-copy-to-stmt:get-src: +19766 # var src/esi: (addr stmt-var) = dest->next +19767 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +19768 89/<- %esi 0/r32/eax +19769 # 1 inout +19770 3d/compare-eax-and 0/imm32 +19771 0f 84/jump-if-= $check-mu-copy-to-stmt:error-incorrect-inouts/disp32 +19772 # > 2 inouts +19773 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +19774 3d/compare-eax-and 0/imm32 +19775 0f 85/jump-if-!= $check-mu-copy-to-stmt:error-incorrect-inouts/disp32 +19776 $check-mu-copy-to-stmt:types: +19777 # var src-type/ecx: (addr type-tree) = src->value->type +19778 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +19779 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +19780 89/<- %ecx 0/r32/eax +19781 # if src not in register or literal, abort +19782 # (we can't use stack-offset because it hasn't been computed yet) +19783 { +19784 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +19785 (lookup *(eax+0x8) *(eax+0xc)) # Var-type Var-type => eax +19786 (is-simple-mu-type? %eax 0) # => eax +19787 3d/compare-eax-and 0/imm32 +19788 75/jump-if-!= break/disp8 +19789 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +19790 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +19791 3d/compare-eax-and 0/imm32 +19792 75/jump-if-!= break/disp8 +19793 e9/jump $check-mu-copy-to-stmt:error-src-not-literal-or-in-register/disp32 +19794 } +19795 # if src is not a scalar, abort +19796 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +19797 (size-of %eax) # => eax +19798 3d/compare-eax-and 4/imm32 +19799 0f 8f/jump-if-> $check-mu-copy-to-stmt:error-src-too-large/disp32 +19800 # var dest-type/ebx: (addr type-tree) = dest->value->type +19801 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +19802 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +19803 89/<- %ebx 0/r32/eax +19804 # if (dest->is-deref?) dest-type = dest-type->payload +19805 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref +19806 3d/compare-eax-and 0/imm32/false +19807 { +19808 74/jump-if-= break/disp8 +19809 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +19810 # if dest-type->right is null, dest-type = dest-type->left +19811 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +19812 { +19813 75/jump-if-!= break/disp8 +19814 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +19815 } +19816 89/<- %ebx 0/r32/eax +19817 } +19818 # if (src-type == dest-type) return +19819 (type-match? %ebx %ecx %edx) # => eax +19820 3d/compare-eax-and 0/imm32 +19821 0f 85/jump-if-!= $check-mu-copy-to-stmt:end/disp32 +19822 # if dest is an addr and src is 0, return +19823 { +19824 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +19825 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +19826 (is-mu-addr-type? %eax) # => eax +19827 3d/compare-eax-and 0/imm32/false +19828 74/jump-if-= break/disp8 +19829 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +19830 (lookup *eax *(eax+4)) # Var-name Var-name => eax +19831 (string-equal? %eax "0") # => eax +19832 3d/compare-eax-and 0/imm32/false +19833 74/jump-if-= break/disp8 +19834 eb/jump $check-mu-copy-to-stmt:end/disp8 +19835 } +19836 # if dest is not number-like, abort +19837 (check-mu-numberlike-arg %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +19838 $check-mu-copy-to-stmt:end: +19839 # . reclaim locals +19840 81 0/subop/add %esp 0x6c/imm32 +19841 # . restore registers +19842 5f/pop-to-edi +19843 5e/pop-to-esi +19844 5b/pop-to-ebx +19845 5a/pop-to-edx +19846 59/pop-to-ecx +19847 58/pop-to-eax +19848 # . epilogue +19849 89/<- %esp 5/r32/ebp +19850 5d/pop-to-ebp +19851 c3/return +19852 +19853 $check-mu-copy-to-stmt:error-incorrect-inouts: +19854 (write-buffered *(ebp+0x10) "fn ") +19855 8b/-> *(ebp+0xc) 0/r32/eax +19856 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19857 (write-buffered *(ebp+0x10) %eax) +19858 (write-buffered *(ebp+0x10) ": stmt 'copy-to' must have two inouts\n") +19859 (flush *(ebp+0x10)) +19860 (stop *(ebp+0x14) 1) +19861 # never gets here +19862 +19863 $check-mu-copy-to-stmt:error-too-many-outputs: +19864 (write-buffered *(ebp+0x10) "fn ") +19865 8b/-> *(ebp+0xc) 0/r32/eax +19866 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19867 (write-buffered *(ebp+0x10) %eax) +19868 (write-buffered *(ebp+0x10) ": stmt 'copy-to' must not have any outputs\n") +19869 (flush *(ebp+0x10)) +19870 (stop *(ebp+0x14) 1) +19871 # never gets here +19872 +19873 $check-mu-copy-to-stmt:error-src-not-literal-or-in-register: +19874 (write-buffered *(ebp+0x10) "fn ") +19875 8b/-> *(ebp+0xc) 0/r32/eax +19876 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19877 (write-buffered *(ebp+0x10) %eax) +19878 (write-buffered *(ebp+0x10) ": stmt copy-to: source (second inout) is in memory\n") +19879 (flush *(ebp+0x10)) +19880 (stop *(ebp+0x14) 1) +19881 # never gets here +19882 +19883 $check-mu-copy-to-stmt:error-src-too-large: +19884 (write-buffered *(ebp+0x10) "fn ") +19885 8b/-> *(ebp+0xc) 0/r32/eax +19886 (lookup *eax *(eax+4)) # Function-name Function-name => eax +19887 (write-buffered *(ebp+0x10) %eax) +19888 (write-buffered *(ebp+0x10) ": stmt copy-to: '") +19889 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +19890 (lookup *eax *(eax+4)) # Var-name Var-name => eax +19891 (write-buffered *(ebp+0x10) %eax) +19892 (write-buffered *(ebp+0x10) "' is too large to copy\n") +19893 (flush *(ebp+0x10)) +19894 (stop *(ebp+0x14) 1) +19895 # never gets here +19896 +19897 check-mu-compare-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +19898 # . prologue +19899 55/push-ebp +19900 89/<- %ebp 4/r32/esp +19901 # . save registers +19902 50/push-eax +19903 51/push-ecx +19904 52/push-edx +19905 53/push-ebx +19906 56/push-esi +19907 57/push-edi +19908 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) +19909 81 5/subop/subtract %esp 0x60/imm32 +19910 68/push 0x60/imm32/size +19911 68/push 0/imm32/read +19912 68/push 0/imm32/write +19913 89/<- %edx 4/r32/esp +19914 # esi = stmt +19915 8b/-> *(ebp+8) 6/r32/esi +19916 $check-mu-compare-stmt:check-for-output: +19917 # if stmt->outputs abort +19918 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +19919 3d/compare-eax-and 0/imm32 +19920 0f 85/jump-if-!= $check-mu-compare-stmt:error-too-many-outputs/disp32 +19921 $check-mu-compare-stmt:get-left: +19922 # var left/edi: (addr stmt-var) = stmt->inouts +19923 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +19924 89/<- %edi 0/r32/eax +19925 # zero inouts +19926 3d/compare-eax-and 0/imm32 +19927 0f 84/jump-if-= $check-mu-compare-stmt:error-incorrect-inouts/disp32 +19928 $check-mu-compare-stmt:get-right: +19929 # var right/esi: (addr stmt-var) = left->next +19930 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +19931 89/<- %esi 0/r32/eax +19932 # 1 inout +19933 3d/compare-eax-and 0/imm32 +19934 0f 84/jump-if-= $check-mu-compare-stmt:error-incorrect-inouts/disp32 +19935 # > 2 inouts +19936 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +19937 3d/compare-eax-and 0/imm32 +19938 0f 85/jump-if-!= $check-mu-compare-stmt:error-incorrect-inouts/disp32 +19939 # if both inouts are in memory, abort +19940 { +19941 $check-mu-compare-stmt:both-in-mem: +19942 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +19943 (lookup *(eax+0x8) *(eax+0xc)) # Var-type Var-type => eax +19944 (is-simple-mu-type? %eax 0) # => eax +19945 3d/compare-eax-and 0/imm32 +19946 0f 85/jump-if-!= break/disp32 +19947 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +19948 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +19949 3d/compare-eax-and 0/imm32 +19950 75/jump-if-!= break/disp8 +19951 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +19952 (lookup *(eax+0x8) *(eax+0xc)) # Var-type Var-type => eax +19953 (is-simple-mu-type? %eax 0) # => eax +19954 3d/compare-eax-and 0/imm32 +19955 75/jump-if-!= break/disp8 +19956 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +19957 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +19958 3d/compare-eax-and 0/imm32 +19959 75/jump-if-!= break/disp8 +19960 e9/jump $check-mu-compare-stmt:error-both-in-memory/disp32 +19961 } +19962 $check-mu-compare-stmt:types: +19963 # var right-type/ecx: (addr type-tree) = right->value->type +19964 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +19965 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +19966 89/<- %ecx 0/r32/eax +19967 # if (right->is-deref?) right-type = right-type->payload +19968 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref +19969 3d/compare-eax-and 0/imm32/false +19970 { +19971 74/jump-if-= break/disp8 +19972 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +19973 # if right-type->right is null, right-type = right-type->left +19974 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +19975 { +19976 75/jump-if-!= break/disp8 +19977 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +19978 } +19979 89/<- %ecx 0/r32/eax +19980 } +19981 # if right is not a scalar, abort +19982 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +19983 (size-of %eax) # => eax +19984 3d/compare-eax-and 4/imm32 +19985 0f 8f/jump-if-> $check-mu-compare-stmt:error-right-too-large/disp32 +19986 # if left is not a scalar, abort +19987 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +19988 (size-of %eax) # => eax +19989 3d/compare-eax-and 4/imm32 +19990 0f 8f/jump-if-> $check-mu-compare-stmt:error-left-too-large/disp32 +19991 # var left-type/ebx: (addr type-tree) = left->value->type +19992 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +19993 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +19994 89/<- %ebx 0/r32/eax +19995 # if (left->is-deref?) left-type = left-type->payload +19996 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref +19997 3d/compare-eax-and 0/imm32/false +19998 { +19999 74/jump-if-= break/disp8 +20000 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +20001 # if left-type->right is null, left-type = left-type->left +20002 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right 20003 { 20004 75/jump-if-!= break/disp8 -20005 #? (write-buffered Stderr "no register\n") -20006 #? (flush Stderr) -20007 b8/copy-to-eax 1/imm32/true -20008 e9/jump $register-conflict?:end/disp32 -20009 } -20010 # return (curr-reg != reg) -20011 (string-equal? %eax *(ebp+8)) # => eax -20012 3d/compare-eax-and 0/imm32/false -20013 0f 94/set-if-= %al -20014 #? (write-buffered Stderr "final: ") -20015 #? (write-int32-hex-buffered Stderr %eax) -20016 #? (write-buffered Stderr Newline) -20017 #? (flush Stderr) -20018 eb/jump $register-conflict?:end/disp8 -20019 $register-conflict?:continue: -20020 # curr-output = curr-output->next -20021 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax -20022 89/<- %edi 0/r32/eax -20023 # curr-inout = curr-inout->next -20024 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -20025 89/<- %esi 0/r32/eax -20026 e9/jump loop/disp32 -20027 } -20028 # should never get here -20029 (write-buffered Stderr "register-conflict? misused\n") -20030 (flush Stderr) -20031 e8/call syscall_exit/disp32 -20032 $register-conflict?:end: -20033 # . restore registers -20034 5f/pop-to-edi -20035 5e/pop-to-esi -20036 5b/pop-to-ebx -20037 5a/pop-to-edx -20038 59/pop-to-ecx +20005 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +20006 } +20007 89/<- %ebx 0/r32/eax +20008 } +20009 # if (left-type == right-type) return +20010 (type-match? %ebx %ecx %edx) # => eax +20011 3d/compare-eax-and 0/imm32 +20012 0f 85/jump-if-!= $check-mu-compare-stmt:end/disp32 +20013 # if left is an addr and right is 0, return +20014 { +20015 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +20016 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +20017 (is-mu-addr-type? %eax) # => eax +20018 3d/compare-eax-and 0/imm32/false +20019 74/jump-if-= break/disp8 +20020 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +20021 (lookup *eax *(eax+4)) # Var-name Var-name => eax +20022 (string-equal? %eax "0") # => eax +20023 3d/compare-eax-and 0/imm32/false +20024 74/jump-if-= break/disp8 +20025 eb/jump $check-mu-compare-stmt:end/disp8 +20026 } +20027 # if left is not number-like, abort +20028 (check-mu-numberlike-arg %edi *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +20029 $check-mu-compare-stmt:end: +20030 # . reclaim locals +20031 81 0/subop/add %esp 0x6c/imm32 +20032 # . restore registers +20033 5f/pop-to-edi +20034 5e/pop-to-esi +20035 5b/pop-to-ebx +20036 5a/pop-to-edx +20037 59/pop-to-ecx +20038 58/pop-to-eax 20039 # . epilogue 20040 89/<- %esp 5/r32/ebp 20041 5d/pop-to-ebp 20042 c3/return 20043 -20044 check-final-stmt-is-return: # block: (addr block), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -20045 # . prologue -20046 55/push-ebp -20047 89/<- %ebp 4/r32/esp -20048 # . save registers -20049 50/push-eax -20050 51/push-ecx -20051 # var curr/ecx: (addr list stmt) = block->stmts -20052 8b/-> *(ebp+8) 0/r32/eax -20053 (lookup *(eax+4) *(eax+8)) # Block-stmts Block-stmts => eax -20054 3d/compare-eax-and 0/imm32 -20055 74/jump-if-= $check-final-stmt-is-return:end/disp8 -20056 89/<- %ecx 0/r32/eax -20057 { -20058 # if curr->next == 0, break -20059 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -20060 3d/compare-eax-and 0/imm32 -20061 74/jump-if-= break/disp8 -20062 # curr = curr->next -20063 89/<- %ecx 0/r32/eax -20064 e9/jump loop/disp32 -20065 } -20066 $check-final-stmt-is-return:check-tag: -20067 # if curr->value->tag != Stmt1, abort -20068 (lookup *ecx *(ecx+4)) # List-value List-value => eax -20069 81 7/subop/compare *eax 1/imm32/stmt1 # Stmt-tag -20070 75/jump-if-!= $check-final-stmt-is-return:error/disp8 -20071 $check-final-stmt-is-return:check-operation: -20072 # if curr->operation != "return", abort -20073 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -20074 (string-equal? %eax "return") -20075 3d/compare-eax-and 0/imm32/false -20076 74/jump-if-= $check-final-stmt-is-return:error/disp8 -20077 $check-final-stmt-is-return:end: -20078 # . restore registers -20079 59/pop-to-ecx -20080 58/pop-to-eax -20081 # . epilogue -20082 89/<- %esp 5/r32/ebp -20083 5d/pop-to-ebp -20084 c3/return -20085 -20086 $check-final-stmt-is-return:error: -20087 (write-buffered *(ebp+0x10) "fn ") -20088 8b/-> *(ebp+0xc) 0/r32/eax -20089 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20090 (write-buffered *(ebp+0x10) %eax) -20091 (write-buffered *(ebp+0x10) ": final statement should be a 'return'\n") -20092 (flush *(ebp+0x10)) -20093 (stop *(ebp+0x14) 1) -20094 # never gets here -20095 -20096 check-no-breaks: # block: (addr block), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -20097 # . prologue -20098 55/push-ebp -20099 89/<- %ebp 4/r32/esp -20100 # . save registers -20101 50/push-eax -20102 51/push-ecx -20103 # var curr/ecx: (addr list stmt) = block->stmts -20104 8b/-> *(ebp+8) 0/r32/eax -20105 (lookup *(eax+4) *(eax+8)) # Block-stmts Block-stmts => eax -20106 3d/compare-eax-and 0/imm32 -20107 0f 84/jump-if-= $check-no-breaks:end/disp32 -20108 89/<- %ecx 0/r32/eax -20109 { -20110 # if curr->next == 0, break -20111 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -20112 3d/compare-eax-and 0/imm32 -20113 74/jump-if-= break/disp8 -20114 # if curr->value->tag != Stmt1, continue -20115 (lookup *ecx *(ecx+4)) # List-value List-value => eax -20116 81 7/subop/compare *eax 1/imm32/stmt1 # Stmt-tag -20117 75/jump-if-!= $check-no-breaks:continue/disp8 -20118 # if curr->value->operation starts with "break", abort -20119 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -20120 (string-starts-with? %eax "break") # => eax -20121 3d/compare-eax-and 0/imm32/false -20122 75/jump-if-!= $check-no-breaks:error/disp8 -20123 $check-no-breaks:continue: -20124 # curr = curr->next -20125 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -20126 89/<- %ecx 0/r32/eax -20127 e9/jump loop/disp32 -20128 } -20129 $check-no-breaks:end: -20130 # . restore registers -20131 59/pop-to-ecx -20132 58/pop-to-eax -20133 # . epilogue -20134 89/<- %esp 5/r32/ebp -20135 5d/pop-to-ebp -20136 c3/return -20137 -20138 $check-no-breaks:error: -20139 (write-buffered *(ebp+0x10) "fn ") -20140 8b/-> *(ebp+0xc) 0/r32/eax -20141 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20142 (write-buffered *(ebp+0x10) %eax) -20143 (write-buffered *(ebp+0x10) " has outputs, so you cannot 'break' out of the outermost block. Use 'return'.\n") -20144 (flush *(ebp+0x10)) -20145 (stop *(ebp+0x14) 1) -20146 # never gets here -20147 -20148 check-mu-get-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -20149 # . prologue -20150 55/push-ebp -20151 89/<- %ebp 4/r32/esp -20152 # . save registers -20153 50/push-eax -20154 51/push-ecx -20155 52/push-edx -20156 53/push-ebx -20157 56/push-esi -20158 57/push-edi -20159 # esi = stmt -20160 8b/-> *(ebp+8) 6/r32/esi -20161 # - check for 0 inouts -20162 # var base/ecx: (addr var) = stmt->inouts->value -20163 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -20164 3d/compare-eax-and 0/imm32/false -20165 0f 84/jump-if-= $check-mu-get-stmt:error-too-few-inouts/disp32 -20166 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -20167 89/<- %ecx 0/r32/eax -20168 $check-mu-get-stmt:check-base: -20169 # - check base type -20170 # if it's an 'addr', check that it's in a register -20171 # var base-type/ebx: (addr type-tree) = lookup(base->type) -20172 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -20173 89/<- %ebx 0/r32/eax -20174 { -20175 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -20176 0f 85/jump-if-!= break/disp32 -20177 $check-mu-get-stmt:base-is-compound: -20178 # if (type->left != addr) break -20179 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -20180 (is-simple-mu-type? %eax 2) # addr => eax -20181 3d/compare-eax-and 0/imm32/false -20182 74/jump-if-= break/disp8 -20183 $check-mu-get-stmt:base-is-addr: -20184 # now check for register -20185 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -20186 0f 84/jump-if-= $check-mu-get-stmt:error-base-type-addr-but-not-register/disp32 -20187 $check-mu-get-stmt:base-is-addr-in-register: -20188 # type->left is now an addr; skip it -20189 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -20190 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -20191 0f 85/jump-if-!= $check-mu-get-stmt:error-bad-base/disp32 -20192 $check-mu-get-stmt:base-is-addr-to-atom-in-register: -20193 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -20194 89/<- %ebx 0/r32/eax -20195 } -20196 $check-mu-get-stmt:check-base-typeinfo: -20197 # ensure type is a container -20198 # var base-type-id/ebx: type-id = base-type->value -20199 8b/-> *(ebx+4) 3/r32/ebx # Type-tree-value -20200 (is-container? %ebx) # => eax -20201 3d/compare-eax-and 0/imm32/false -20202 0f 84/jump-if-= $check-mu-get-stmt:error-bad-base/disp32 -20203 # var base-typeinfo/edx: (addr typeinfo) = find-typeinfo(base-type-id) -20204 # . var container/ecx: (handle typeinfo) -20205 68/push 0/imm32 -20206 68/push 0/imm32 -20207 89/<- %ecx 4/r32/esp -20208 # . -20209 (find-typeinfo %ebx %ecx) -20210 (lookup *ecx *(ecx+4)) # => eax -20211 # . reclaim container -20212 81 0/subop/add %esp 8/imm32 -20213 # . -20214 89/<- %edx 0/r32/eax -20215 # var offset/ecx: (addr stmt-var) = stmt->inouts->next -20216 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -20217 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -20218 89/<- %ecx 0/r32/eax -20219 # - check for 1 inout -20220 3d/compare-eax-and 0/imm32/false -20221 0f 84/jump-if-= $check-mu-get-stmt:error-too-few-inouts/disp32 -20222 # var offset/ecx: (addr var) = lookup(offset->value) -20223 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -20224 89/<- %ecx 0/r32/eax -20225 # - check for valid field -20226 81 7/subop/compare *(ecx+0x14) -1/imm32/uninitialized # Var-offset -20227 0f 84/jump-if-= $check-mu-get-stmt:error-bad-field/disp32 -20228 # - check for too many inouts -20229 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -20230 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -20231 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -20232 3d/compare-eax-and 0/imm32/false -20233 0f 85/jump-if-!= $check-mu-get-stmt:error-too-many-inouts/disp32 -20234 # var output/edi: (addr var) = stmt->outputs->value -20235 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -20236 # - check for 0 outputs -20237 3d/compare-eax-and 0/imm32/false -20238 0f 84/jump-if-= $check-mu-get-stmt:error-too-few-outputs/disp32 -20239 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -20240 89/<- %edi 0/r32/eax -20241 $check-mu-get-stmt:check-output-type: -20242 # - check output type -20243 # must be in register -20244 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax -20245 3d/compare-eax-and 0/imm32 -20246 0f 84/jump-if-= $check-mu-get-stmt:error-output-not-in-register/disp32 -20247 # must have a non-atomic type -20248 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -20249 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -20250 0f 85/jump-if-!= $check-mu-get-stmt:error-output-type-not-address/disp32 -20251 # type must start with (addr ...) -20252 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -20253 (is-simple-mu-type? %eax 2) # => eax -20254 3d/compare-eax-and 0/imm32/false -20255 0f 84/jump-if-= $check-mu-get-stmt:error-output-type-not-address/disp32 -20256 $check-mu-get-stmt:check-output-type-match: -20257 # payload of addr type must match 'type' definition -20258 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -20259 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -20260 # if (payload->right == null) payload = payload->left -20261 81 7/subop/compare *(eax+0xc) 0/imm32/null # Type-tree-right -20262 { -20263 75/jump-if-!= break/disp8 -20264 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -20265 } -20266 89/<- %edi 0/r32/eax -20267 # . var output-name/ecx: (addr array byte) -20268 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -20269 89/<- %ecx 0/r32/eax -20270 # . var base-typeinfo-entry/eax: (addr handle typeinfo-entry) -20271 (lookup *(edx+4) *(edx+8)) # Typeinfo-fields Typeinfo-fields => eax -20272 (get %eax %ecx 0x10) # => eax -20273 # . -20274 (lookup *eax *(eax+4)) # => eax -20275 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax -20276 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -20277 # . -20278 (type-equal? %edi %eax) # => eax -20279 3d/compare-eax-and 0/imm32/false -20280 0f 84/jump-if-= $check-mu-get-stmt:error-bad-output-type/disp32 -20281 # - check for too many outputs -20282 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -20283 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -20284 3d/compare-eax-and 0/imm32/false -20285 0f 85/jump-if-!= $check-mu-get-stmt:error-too-many-outputs/disp32 -20286 $check-mu-get-stmt:end: -20287 # . restore registers -20288 5f/pop-to-edi -20289 5e/pop-to-esi -20290 5b/pop-to-ebx -20291 5a/pop-to-edx -20292 59/pop-to-ecx -20293 58/pop-to-eax -20294 # . epilogue -20295 89/<- %esp 5/r32/ebp -20296 5d/pop-to-ebp -20297 c3/return -20298 -20299 $check-mu-get-stmt:error-too-few-inouts: -20300 (write-buffered *(ebp+0x10) "fn ") -20301 8b/-> *(ebp+0xc) 0/r32/eax -20302 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20303 (write-buffered *(ebp+0x10) %eax) -20304 (write-buffered *(ebp+0x10) ": stmt get: too few inouts (2 required)\n") -20305 (flush *(ebp+0x10)) -20306 (stop *(ebp+0x14) 1) -20307 # never gets here -20308 -20309 $check-mu-get-stmt:error-too-many-inouts: -20310 (write-buffered *(ebp+0x10) "fn ") -20311 8b/-> *(ebp+0xc) 0/r32/eax -20312 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20313 (write-buffered *(ebp+0x10) %eax) -20314 (write-buffered *(ebp+0x10) ": stmt get: too many inouts (2 required)\n") -20315 (flush *(ebp+0x10)) -20316 (stop *(ebp+0x14) 1) -20317 # never gets here -20318 -20319 $check-mu-get-stmt:error-too-few-outputs: -20320 (write-buffered *(ebp+0x10) "fn ") -20321 8b/-> *(ebp+0xc) 0/r32/eax -20322 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20323 (write-buffered *(ebp+0x10) %eax) -20324 (write-buffered *(ebp+0x10) ": stmt get: must have an output\n") -20325 (flush *(ebp+0x10)) -20326 (stop *(ebp+0x14) 1) -20327 # never gets here -20328 -20329 $check-mu-get-stmt:error-too-many-outputs: -20330 (write-buffered *(ebp+0x10) "fn ") -20331 8b/-> *(ebp+0xc) 0/r32/eax -20332 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20333 (write-buffered *(ebp+0x10) %eax) -20334 (write-buffered *(ebp+0x10) ": stmt get: too many outputs (1 required)\n") -20335 (flush *(ebp+0x10)) -20336 (stop *(ebp+0x14) 1) -20337 # never gets here -20338 -20339 $check-mu-get-stmt:error-bad-base: -20340 # error("fn " fn ": stmt get: var '" base->name "' must have a 'type' definition\n") -20341 (write-buffered *(ebp+0x10) "fn ") -20342 8b/-> *(ebp+0xc) 0/r32/eax -20343 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20344 (write-buffered *(ebp+0x10) %eax) -20345 (write-buffered *(ebp+0x10) ": stmt get: var '") -20346 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -20347 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -20348 (lookup *eax *(eax+4)) # Var-name Var-name => eax -20349 (write-buffered *(ebp+0x10) %eax) -20350 (write-buffered *(ebp+0x10) "' must have a 'type' definition\n") -20351 (flush *(ebp+0x10)) -20352 (stop *(ebp+0x14) 1) -20353 # never gets here -20354 -20355 $check-mu-get-stmt:error-base-type-addr-but-not-register: -20356 (write-buffered *(ebp+0x10) "fn ") -20357 8b/-> *(ebp+0xc) 0/r32/eax -20358 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20359 (write-buffered *(ebp+0x10) %eax) -20360 (write-buffered *(ebp+0x10) ": stmt get: var '") -20361 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -20362 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -20363 (lookup *eax *(eax+4)) # Var-name Var-name => eax -20364 (write-buffered *(ebp+0x10) %eax) -20365 (write-buffered *(ebp+0x10) "' is an 'addr' type, and so must live in a register\n") -20366 (flush *(ebp+0x10)) -20367 (stop *(ebp+0x14) 1) -20368 # never gets here -20369 -20370 $check-mu-get-stmt:error-bad-field: -20371 # error("fn " fn ": stmt get: type " type " has no member called '" curr->name "'\n") -20372 (write-buffered *(ebp+0x10) "fn ") -20373 8b/-> *(ebp+0xc) 0/r32/eax -20374 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20375 (write-buffered *(ebp+0x10) %eax) -20376 (write-buffered *(ebp+0x10) ": stmt get: type '") -20377 # . write(Type-id->data[tmp]) -20378 bf/copy-to-edi Type-id/imm32 -20379 (write-buffered *(ebp+0x10) *(edi+ebx<<2+0xc)) -20380 # . -20381 (write-buffered *(ebp+0x10) "' has no member called '") -20382 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -20383 (write-buffered *(ebp+0x10) %eax) -20384 (write-buffered *(ebp+0x10) "'\n") -20385 (flush *(ebp+0x10)) -20386 (stop *(ebp+0x14) 1) -20387 # never gets here -20388 -20389 $check-mu-get-stmt:error-output-not-in-register: -20390 (write-buffered *(ebp+0x10) "fn ") -20391 8b/-> *(ebp+0xc) 0/r32/eax -20392 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20393 (write-buffered *(ebp+0x10) %eax) -20394 (write-buffered *(ebp+0x10) ": stmt get: output '") -20395 (lookup *edi *(edi+4)) # Var-name Var-name => eax -20396 (write-buffered *(ebp+0x10) %eax) -20397 (write-buffered *(ebp+0x10) "' is not in a register\n") -20398 (flush *(ebp+0x10)) -20399 (stop *(ebp+0x14) 1) -20400 # never gets here -20401 -20402 $check-mu-get-stmt:error-output-type-not-address: -20403 (write-buffered *(ebp+0x10) "fn ") -20404 8b/-> *(ebp+0xc) 0/r32/eax -20405 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20406 (write-buffered *(ebp+0x10) %eax) -20407 (write-buffered *(ebp+0x10) ": stmt get: output must be an addr\n") -20408 (flush *(ebp+0x10)) -20409 (stop *(ebp+0x14) 1) -20410 # never gets here -20411 -20412 $check-mu-get-stmt:error-bad-output-type: -20413 (write-buffered *(ebp+0x10) "fn ") -20414 8b/-> *(ebp+0xc) 0/r32/eax -20415 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20416 (write-buffered *(ebp+0x10) %eax) -20417 (write-buffered *(ebp+0x10) ": stmt get: wrong output type for member '") -20418 (write-buffered *(ebp+0x10) %ecx) -20419 (write-buffered *(ebp+0x10) "' of type '") -20420 bf/copy-to-edi Type-id/imm32 -20421 (write-buffered *(ebp+0x10) *(edi+ebx<<2+0xc)) -20422 (write-buffered *(ebp+0x10) "'\n") -20423 (flush *(ebp+0x10)) -20424 (stop *(ebp+0x14) 1) -20425 # never gets here -20426 -20427 check-mu-index-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -20428 # . prologue -20429 55/push-ebp -20430 89/<- %ebp 4/r32/esp -20431 # . save registers -20432 50/push-eax -20433 51/push-ecx -20434 52/push-edx -20435 53/push-ebx -20436 56/push-esi -20437 57/push-edi -20438 # esi = stmt -20439 8b/-> *(ebp+8) 6/r32/esi -20440 # - check for 0 inouts -20441 # var base/ecx: (addr var) = stmt->inouts->value -20442 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -20443 $check-mu-index-stmt:check-no-inouts: -20444 3d/compare-eax-and 0/imm32 -20445 0f 84/jump-if-= $check-mu-index-stmt:error-too-few-inouts/disp32 -20446 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -20447 89/<- %ecx 0/r32/eax -20448 # - check base type is either (addr array ...) in register or (array ...) on stack -20449 # var base-type/ebx: (addr type-tree) = lookup(base->type) -20450 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -20451 89/<- %ebx 0/r32/eax -20452 # if base-type is an atom, abort with a precise error -20453 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -20454 { -20455 74/jump-if-= break/disp8 -20456 (is-simple-mu-type? %ebx 3) # array => eax -20457 3d/compare-eax-and 0/imm32/false -20458 0f 85/jump-if-!= $check-mu-index-stmt:error-base-array-atom-type/disp32 -20459 0f 84/jump-if-= $check-mu-index-stmt:error-base-non-array-type/disp32 -20460 } -20461 $check-mu-index-stmt:base-is-compound: -20462 # if type->left not addr or array, abort -20463 { -20464 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -20465 (is-simple-mu-type? %eax 2) # addr => eax -20466 3d/compare-eax-and 0/imm32/false -20467 75/jump-if-!= break/disp8 -20468 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -20469 (is-simple-mu-type? %eax 3) # array => eax -20470 3d/compare-eax-and 0/imm32/false -20471 75/jump-if-!= break/disp8 -20472 e9/jump $check-mu-index-stmt:error-base-non-array-type/disp32 -20473 } -20474 # if (type->left == addr) ensure type->right->left == array and type->register exists -20475 { -20476 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -20477 (is-simple-mu-type? %eax 2) # addr => eax -20478 3d/compare-eax-and 0/imm32/false -20479 74/jump-if-= break/disp8 -20480 $check-mu-index-stmt:base-is-addr: -20481 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -20482 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -20483 (is-simple-mu-type? %eax 3) # array => eax -20484 3d/compare-eax-and 0/imm32/false -20485 0f 84/jump-if-= $check-mu-index-stmt:error-base-non-array-type/disp32 -20486 $check-mu-index-stmt:check-base-addr-is-register: -20487 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -20488 0f 84/jump-if-= $check-mu-index-stmt:error-base-address-array-type-on-stack/disp32 -20489 } -20490 # if (type->left == array) ensure type->register doesn't exist -20491 { -20492 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -20493 (is-simple-mu-type? %eax 3) # array => eax -20494 3d/compare-eax-and 0/imm32/false -20495 74/jump-if-= break/disp8 -20496 $check-mu-index-stmt:base-is-array: -20497 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -20498 0f 85/jump-if-!= $check-mu-index-stmt:error-base-array-type-in-register/disp32 -20499 } -20500 # if (base-type->left == addr) base-type = base-type->right -20501 { -20502 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -20503 (is-simple-mu-type? %eax 2) # addr => eax -20504 3d/compare-eax-and 0/imm32/false -20505 74/jump-if-= break/disp8 -20506 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -20507 89/<- %ebx 0/r32/eax -20508 } -20509 # - check for 1 inout -20510 # var index/ecx: (addr stmt-var) = stmt->inouts->next->value -20511 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -20512 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -20513 $check-mu-index-stmt:check-single-inout: -20514 3d/compare-eax-and 0/imm32 -20515 0f 84/jump-if-= $check-mu-index-stmt:error-too-few-inouts/disp32 -20516 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -20517 89/<- %ecx 0/r32/eax -20518 # - check index is either a literal or register -20519 # var index-type/edx: (addr type-tree) -20520 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -20521 89/<- %edx 0/r32/eax -20522 # if index type is an atom, it must be a literal or int -20523 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom -20524 { -20525 74/jump-if-= break/disp8 -20526 $check-mu-index-stmt:index-type-is-atom: -20527 (is-simple-mu-type? %edx 0) # literal => eax -20528 3d/compare-eax-and 0/imm32/false -20529 75/jump-if-!= $check-mu-index-stmt:index-type-done/disp8 -20530 (is-simple-mu-type? %edx 1) # int => eax -20531 3d/compare-eax-and 0/imm32/false -20532 75/jump-if-!= $check-mu-index-stmt:index-type-done/disp8 -20533 (is-simple-mu-type? %edx 7) # offset => eax -20534 3d/compare-eax-and 0/imm32/false -20535 0f 85/jump-if-!= $check-mu-index-stmt:error-index-offset-atom-type/disp32 -20536 e9/jump $check-mu-index-stmt:error-invalid-index-type/disp32 -20537 } -20538 # if index type is a non-atom: it must be an offset -20539 { -20540 75/jump-if-!= break/disp8 -20541 $check-mu-index-stmt:index-type-is-non-atom: -20542 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -20543 (is-simple-mu-type? %eax 7) # offset => eax -20544 3d/compare-eax-and 0/imm32/false -20545 0f 84/jump-if-= $check-mu-index-stmt:error-invalid-index-type/disp32 -20546 } -20547 $check-mu-index-stmt:index-type-done: -20548 # check index is either a literal or in a register -20549 { -20550 (is-simple-mu-type? %edx 0) # literal => eax -20551 3d/compare-eax-and 0/imm32/false -20552 75/jump-if-!= break/disp8 -20553 $check-mu-index-stmt:check-index-in-register: -20554 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -20555 0f 84/jump-if-= $check-mu-index-stmt:error-index-on-stack/disp32 -20556 } -20557 # - if index is an 'int', check that element type of base has size 1, 2, 4 or 8 bytes. -20558 { -20559 (is-simple-mu-type? %edx 1) # int => eax -20560 3d/compare-eax-and 0/imm32/false -20561 74/jump-if-= break/disp8 -20562 $check-mu-index-stmt:check-index-can-be-int: -20563 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -20564 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -20565 (array-element-size %eax) # => eax -20566 3d/compare-eax-and 1/imm32 -20567 74/jump-if-= break/disp8 -20568 3d/compare-eax-and 2/imm32 -20569 74/jump-if-= break/disp8 -20570 3d/compare-eax-and 4/imm32 -20571 74/jump-if-= break/disp8 -20572 3d/compare-eax-and 8/imm32 -20573 74/jump-if-= break/disp8 -20574 e9/jump $check-mu-index-stmt:error-index-needs-offset/disp32 -20575 } -20576 # - check for too many inouts -20577 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -20578 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -20579 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -20580 3d/compare-eax-and 0/imm32/false -20581 0f 85/jump-if-!= $check-mu-index-stmt:error-too-many-inouts/disp32 -20582 # - check for 0 outputs -20583 # var output/edi: (addr var) = stmt->outputs->value -20584 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -20585 3d/compare-eax-and 0/imm32/false -20586 0f 84/jump-if-= $check-mu-index-stmt:error-too-few-outputs/disp32 -20587 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -20588 89/<- %edi 0/r32/eax -20589 # - check output type -20590 # must have a non-atomic type -20591 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -20592 89/<- %edx 0/r32/eax -20593 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom -20594 0f 85/jump-if-!= $check-mu-index-stmt:error-output-type-not-address/disp32 -20595 # type must start with (addr ...) -20596 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -20597 (is-simple-mu-type? %eax 2) # addr => eax -20598 3d/compare-eax-and 0/imm32/false -20599 0f 84/jump-if-= $check-mu-index-stmt:error-output-type-not-address/disp32 -20600 # if tail(base-type) != tail(output-type) abort -20601 (type-tail %ebx) # => eax -20602 89/<- %ebx 0/r32/eax -20603 (type-tail %edx) # => eax -20604 (type-equal? %ebx %eax) # => eax -20605 3d/compare-eax-and 0/imm32/false -20606 0f 84/jump-if-= $check-mu-index-stmt:error-bad-output-type/disp32 -20607 # - check for too many outputs -20608 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -20609 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -20610 3d/compare-eax-and 0/imm32/false -20611 0f 85/jump-if-!= $check-mu-index-stmt:error-too-many-outputs/disp32 -20612 $check-mu-index-stmt:end: -20613 # . restore registers -20614 5f/pop-to-edi -20615 5e/pop-to-esi -20616 5b/pop-to-ebx -20617 5a/pop-to-edx -20618 59/pop-to-ecx -20619 58/pop-to-eax -20620 # . epilogue -20621 89/<- %esp 5/r32/ebp -20622 5d/pop-to-ebp -20623 c3/return -20624 -20625 $check-mu-index-stmt:error-base-non-array-type: -20626 (write-buffered *(ebp+0x10) "fn ") -20627 8b/-> *(ebp+0xc) 0/r32/eax -20628 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20629 (write-buffered *(ebp+0x10) %eax) -20630 (write-buffered *(ebp+0x10) ": stmt index: var '") -20631 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -20632 (write-buffered *(ebp+0x10) %eax) -20633 (write-buffered *(ebp+0x10) "' is not an array\n") -20634 (flush *(ebp+0x10)) -20635 (stop *(ebp+0x14) 1) -20636 # never gets here -20637 -20638 $check-mu-index-stmt:error-base-array-atom-type: -20639 (write-buffered *(ebp+0x10) "fn ") -20640 8b/-> *(ebp+0xc) 0/r32/eax -20641 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20642 (write-buffered *(ebp+0x10) %eax) -20643 (write-buffered *(ebp+0x10) ": stmt index: array '") -20644 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -20645 (write-buffered *(ebp+0x10) %eax) -20646 (write-buffered *(ebp+0x10) "' must specify the type of its elements\n") -20647 (flush *(ebp+0x10)) -20648 (stop *(ebp+0x14) 1) -20649 # never gets here -20650 -20651 $check-mu-index-stmt:error-base-address-array-type-on-stack: -20652 (write-buffered *(ebp+0x10) "fn ") -20653 8b/-> *(ebp+0xc) 0/r32/eax -20654 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20655 (write-buffered *(ebp+0x10) %eax) -20656 (write-buffered *(ebp+0x10) ": stmt index: var '") -20657 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -20658 (write-buffered *(ebp+0x10) %eax) -20659 (write-buffered *(ebp+0x10) "' is an addr to an array, and so must live in a register\n") -20660 (flush *(ebp+0x10)) -20661 (stop *(ebp+0x14) 1) -20662 # never gets here -20663 -20664 $check-mu-index-stmt:error-base-array-type-in-register: -20665 (write-buffered *(ebp+0x10) "fn ") -20666 8b/-> *(ebp+0xc) 0/r32/eax -20667 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20668 (write-buffered *(ebp+0x10) %eax) -20669 (write-buffered *(ebp+0x10) ": stmt index: var '") -20670 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -20671 (write-buffered *(ebp+0x10) %eax) -20672 (write-buffered *(ebp+0x10) "' is an array, and so must live on the stack\n") -20673 (flush *(ebp+0x10)) -20674 (stop *(ebp+0x14) 1) -20675 # never gets here -20676 -20677 $check-mu-index-stmt:error-too-few-inouts: -20678 (write-buffered *(ebp+0x10) "fn ") -20679 8b/-> *(ebp+0xc) 0/r32/eax -20680 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20681 (write-buffered *(ebp+0x10) %eax) -20682 (write-buffered *(ebp+0x10) ": stmt index: too few inouts (2 required)\n") -20683 (flush *(ebp+0x10)) -20684 (stop *(ebp+0x14) 1) -20685 # never gets here -20686 -20687 $check-mu-index-stmt:error-invalid-index-type: -20688 (write-buffered *(ebp+0x10) "fn ") -20689 8b/-> *(ebp+0xc) 0/r32/eax -20690 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20691 (write-buffered *(ebp+0x10) %eax) -20692 (write-buffered *(ebp+0x10) ": stmt index: second argument '") -20693 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -20694 (write-buffered *(ebp+0x10) %eax) -20695 (write-buffered *(ebp+0x10) "' must be an int or offset\n") -20696 (flush *(ebp+0x10)) -20697 (stop *(ebp+0x14) 1) -20698 # never gets here -20699 -20700 $check-mu-index-stmt:error-index-offset-atom-type: -20701 (write-buffered *(ebp+0x10) "fn ") -20702 8b/-> *(ebp+0xc) 0/r32/eax -20703 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20704 (write-buffered *(ebp+0x10) %eax) -20705 (write-buffered *(ebp+0x10) ": stmt index: offset '") -20706 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -20707 (write-buffered *(ebp+0x10) %eax) -20708 (write-buffered *(ebp+0x10) "' must specify the type of array elements\n") -20709 (flush *(ebp+0x10)) -20710 (stop *(ebp+0x14) 1) -20711 # never gets here -20712 -20713 $check-mu-index-stmt:error-index-on-stack: -20714 (write-buffered *(ebp+0x10) "fn ") -20715 8b/-> *(ebp+0xc) 0/r32/eax -20716 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20717 (write-buffered *(ebp+0x10) %eax) -20718 (write-buffered *(ebp+0x10) ": stmt index: second argument '") -20719 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -20720 (write-buffered *(ebp+0x10) %eax) -20721 (write-buffered *(ebp+0x10) "' must be in a register\n") -20722 (flush *(ebp+0x10)) -20723 (stop *(ebp+0x14) 1) -20724 # never gets here -20725 -20726 $check-mu-index-stmt:error-index-needs-offset: -20727 (write-buffered *(ebp+0x10) "fn ") -20728 8b/-> *(ebp+0xc) 0/r32/eax -20729 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20730 (write-buffered *(ebp+0x10) %eax) -20731 (write-buffered *(ebp+0x10) ": stmt index: cannot take an int for array '") -20732 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -20733 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -20734 (lookup *eax *(eax+4)) # Var-name Var-name => eax -20735 (write-buffered *(ebp+0x10) %eax) -20736 (write-buffered *(ebp+0x10) "'; create an offset instead. See mu.md for details.\n") -20737 (flush *(ebp+0x10)) -20738 (stop *(ebp+0x14) 1) -20739 # never gets here -20740 -20741 $check-mu-index-stmt:error-too-many-inouts: -20742 (write-buffered *(ebp+0x10) "fn ") -20743 8b/-> *(ebp+0xc) 0/r32/eax -20744 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20745 (write-buffered *(ebp+0x10) %eax) -20746 (write-buffered *(ebp+0x10) ": stmt index: too many inouts (2 required)\n") -20747 (flush *(ebp+0x10)) -20748 (stop *(ebp+0x14) 1) -20749 # never gets here -20750 -20751 $check-mu-index-stmt:error-too-few-outputs: -20752 (write-buffered *(ebp+0x10) "fn ") -20753 8b/-> *(ebp+0xc) 0/r32/eax -20754 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20755 (write-buffered *(ebp+0x10) %eax) -20756 (write-buffered *(ebp+0x10) ": stmt index: must have an output\n") -20757 (flush *(ebp+0x10)) -20758 (stop *(ebp+0x14) 1) -20759 # never gets here -20760 -20761 $check-mu-index-stmt:error-too-many-outputs: -20762 (write-buffered *(ebp+0x10) "fn ") -20763 8b/-> *(ebp+0xc) 0/r32/eax -20764 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20765 (write-buffered *(ebp+0x10) %eax) -20766 (write-buffered *(ebp+0x10) ": stmt index: too many outputs (1 required)\n") -20767 (flush *(ebp+0x10)) -20768 (stop *(ebp+0x14) 1) -20769 # never gets here -20770 -20771 $check-mu-index-stmt:error-output-not-in-register: -20772 (write-buffered *(ebp+0x10) "fn ") -20773 8b/-> *(ebp+0xc) 0/r32/eax -20774 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20775 (write-buffered *(ebp+0x10) %eax) -20776 (write-buffered *(ebp+0x10) ": stmt index: output '") -20777 (lookup *edi *(edi+4)) # Var-name Var-name => eax -20778 (write-buffered *(ebp+0x10) %eax) -20779 (write-buffered *(ebp+0x10) "' is not in a register\n") -20780 (flush *(ebp+0x10)) -20781 (stop *(ebp+0x14) 1) -20782 # never gets here -20783 -20784 $check-mu-index-stmt:error-output-type-not-address: -20785 (write-buffered *(ebp+0x10) "fn ") -20786 8b/-> *(ebp+0xc) 0/r32/eax -20787 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20788 (write-buffered *(ebp+0x10) %eax) -20789 (write-buffered *(ebp+0x10) ": stmt index: output '") -20790 (lookup *edi *(edi+4)) # Var-name Var-name => eax +20044 $check-mu-compare-stmt:error-incorrect-inouts: +20045 (write-buffered *(ebp+0x10) "fn ") +20046 8b/-> *(ebp+0xc) 0/r32/eax +20047 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20048 (write-buffered *(ebp+0x10) %eax) +20049 (write-buffered *(ebp+0x10) ": stmt 'compare' must have two inouts\n") +20050 (flush *(ebp+0x10)) +20051 (stop *(ebp+0x14) 1) +20052 # never gets here +20053 +20054 $check-mu-compare-stmt:error-too-many-outputs: +20055 (write-buffered *(ebp+0x10) "fn ") +20056 8b/-> *(ebp+0xc) 0/r32/eax +20057 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20058 (write-buffered *(ebp+0x10) %eax) +20059 (write-buffered *(ebp+0x10) ": stmt 'compare' must not have any outputs\n") +20060 (flush *(ebp+0x10)) +20061 (stop *(ebp+0x14) 1) +20062 # never gets here +20063 +20064 $check-mu-compare-stmt:error-both-in-memory: +20065 (write-buffered *(ebp+0x10) "fn ") +20066 8b/-> *(ebp+0xc) 0/r32/eax +20067 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20068 (write-buffered *(ebp+0x10) %eax) +20069 (write-buffered *(ebp+0x10) ": stmt compare: both inouts are in memory\n") +20070 (flush *(ebp+0x10)) +20071 (stop *(ebp+0x14) 1) +20072 # never gets here +20073 +20074 $check-mu-compare-stmt:error-left-too-large: +20075 (write-buffered *(ebp+0x10) "fn ") +20076 8b/-> *(ebp+0xc) 0/r32/eax +20077 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20078 (write-buffered *(ebp+0x10) %eax) +20079 (write-buffered *(ebp+0x10) ": stmt compare: '") +20080 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +20081 (lookup *eax *(eax+4)) # Var-name Var-name => eax +20082 (write-buffered *(ebp+0x10) %eax) +20083 (write-buffered *(ebp+0x10) "' is too large to compare\n") +20084 (flush *(ebp+0x10)) +20085 (stop *(ebp+0x14) 1) +20086 # never gets here +20087 +20088 $check-mu-compare-stmt:error-right-too-large: +20089 (write-buffered *(ebp+0x10) "fn ") +20090 8b/-> *(ebp+0xc) 0/r32/eax +20091 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20092 (write-buffered *(ebp+0x10) %eax) +20093 (write-buffered *(ebp+0x10) ": stmt compare: '") +20094 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +20095 (lookup *eax *(eax+4)) # Var-name Var-name => eax +20096 (write-buffered *(ebp+0x10) %eax) +20097 (write-buffered *(ebp+0x10) "' is too large to compare\n") +20098 (flush *(ebp+0x10)) +20099 (stop *(ebp+0x14) 1) +20100 # never gets here +20101 +20102 check-mu-address-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +20103 # . prologue +20104 55/push-ebp +20105 89/<- %ebp 4/r32/esp +20106 # . save registers +20107 50/push-eax +20108 51/push-ecx +20109 52/push-edx +20110 56/push-esi +20111 57/push-edi +20112 $check-mu-address-stmt:get-output: +20113 # esi = stmt +20114 8b/-> *(ebp+8) 6/r32/esi +20115 # var output/edi: (addr stmt-var) = stmt->outputs +20116 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +20117 89/<- %edi 0/r32/eax +20118 # zero outputs +20119 3d/compare-eax-and 0/imm32 +20120 0f 84/jump-if-= $check-mu-address-stmt:error-no-output/disp32 +20121 # > 1 output +20122 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +20123 3d/compare-eax-and 0/imm32 +20124 0f 85/jump-if-!= $check-mu-address-stmt:error-too-many-outputs/disp32 +20125 $check-mu-address-stmt:get-inout: +20126 # var inout/esi: (addr stmt-var) = stmt->inouts +20127 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +20128 89/<- %esi 0/r32/eax +20129 # zero inouts +20130 3d/compare-eax-and 0/imm32 +20131 0f 84/jump-if-= $check-mu-address-stmt:error-no-inout/disp32 +20132 # > 1 inout +20133 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +20134 3d/compare-eax-and 0/imm32 +20135 0f 85/jump-if-!= $check-mu-address-stmt:error-too-many-inouts/disp32 +20136 $check-mu-address-stmt:types: +20137 # if output not in register, abort +20138 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +20139 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +20140 3d/compare-eax-and 0/imm32 +20141 0f 84/jump-if-= $check-mu-address-stmt:error-output-not-in-register/disp32 +20142 # var output-type/edx: (addr type-tree) = output->value->type +20143 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +20144 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +20145 89/<- %edx 0/r32/eax +20146 # if output-type not an addr, abort +20147 (is-mu-addr-type? %edx) # => eax +20148 3d/compare-eax-and 0/imm32/false +20149 0f 84/jump-if-= $check-mu-address-stmt:error-output-not-address/disp32 +20150 # output-type = output-type->right +20151 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax +20152 # if output-type->right is null, output-type = output-type->left +20153 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +20154 { +20155 75/jump-if-!= break/disp8 +20156 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +20157 } +20158 89/<- %edx 0/r32/eax +20159 # var inout-type/ecx: (addr type-tree) = inout->value->type +20160 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +20161 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +20162 89/<- %ecx 0/r32/eax +20163 # if (inout->is-deref?) inout-type = inout-type->payload +20164 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref +20165 3d/compare-eax-and 0/imm32/false +20166 { +20167 74/jump-if-= break/disp8 +20168 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +20169 # if inout-type->right is null, t = inout-type->left +20170 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +20171 { +20172 75/jump-if-!= break/disp8 +20173 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +20174 } +20175 89/<- %ecx 0/r32/eax +20176 } +20177 # if (inout-type != output-type) abort +20178 (type-equal-ignoring-capacity? %edx %ecx) # => eax +20179 3d/compare-eax-and 0/imm32 +20180 0f 84/jump-if-= $check-mu-address-stmt:error-type-mismatch/disp32 +20181 $check-mu-address-stmt:end: +20182 # . restore registers +20183 5f/pop-to-edi +20184 5e/pop-to-esi +20185 5a/pop-to-edx +20186 59/pop-to-ecx +20187 58/pop-to-eax +20188 # . epilogue +20189 89/<- %esp 5/r32/ebp +20190 5d/pop-to-ebp +20191 c3/return +20192 +20193 $check-mu-address-stmt:error-no-inout: +20194 (write-buffered *(ebp+0x10) "fn ") +20195 8b/-> *(ebp+0xc) 0/r32/eax +20196 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20197 (write-buffered *(ebp+0x10) %eax) +20198 (write-buffered *(ebp+0x10) ": stmt 'address' expects an inout\n") +20199 (flush *(ebp+0x10)) +20200 (stop *(ebp+0x14) 1) +20201 # never gets here +20202 +20203 $check-mu-address-stmt:error-too-many-inouts: +20204 (write-buffered *(ebp+0x10) "fn ") +20205 8b/-> *(ebp+0xc) 0/r32/eax +20206 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20207 (write-buffered *(ebp+0x10) %eax) +20208 (write-buffered *(ebp+0x10) ": stmt 'address' must have just one inout\n") +20209 (flush *(ebp+0x10)) +20210 (stop *(ebp+0x14) 1) +20211 # never gets here +20212 +20213 $check-mu-address-stmt:error-no-output: +20214 (write-buffered *(ebp+0x10) "fn ") +20215 8b/-> *(ebp+0xc) 0/r32/eax +20216 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20217 (write-buffered *(ebp+0x10) %eax) +20218 (write-buffered *(ebp+0x10) ": stmt 'address' expects an output\n") +20219 (flush *(ebp+0x10)) +20220 (stop *(ebp+0x14) 1) +20221 # never gets here +20222 +20223 $check-mu-address-stmt:error-output-not-in-register: +20224 (write-buffered *(ebp+0x10) "fn ") +20225 8b/-> *(ebp+0xc) 0/r32/eax +20226 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20227 (write-buffered *(ebp+0x10) %eax) +20228 (write-buffered *(ebp+0x10) ": stmt address: output '") +20229 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +20230 (lookup *eax *(eax+4)) # Var-name Var-name => eax +20231 (write-buffered *(ebp+0x10) %eax) +20232 (write-buffered *(ebp+0x10) "' not in a register\n") +20233 (flush *(ebp+0x10)) +20234 (stop *(ebp+0x14) 1) +20235 # never gets here +20236 +20237 $check-mu-address-stmt:error-too-many-outputs: +20238 (write-buffered *(ebp+0x10) "fn ") +20239 8b/-> *(ebp+0xc) 0/r32/eax +20240 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20241 (write-buffered *(ebp+0x10) %eax) +20242 (write-buffered *(ebp+0x10) ": stmt 'address' must have just one output\n") +20243 (flush *(ebp+0x10)) +20244 (stop *(ebp+0x14) 1) +20245 # never gets here +20246 +20247 $check-mu-address-stmt:error-output-not-address: +20248 (write-buffered *(ebp+0x10) "fn ") +20249 8b/-> *(ebp+0xc) 0/r32/eax +20250 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20251 (write-buffered *(ebp+0x10) %eax) +20252 (write-buffered *(ebp+0x10) ": stmt address: output '") +20253 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +20254 (lookup *eax *(eax+4)) # Var-name Var-name => eax +20255 (write-buffered *(ebp+0x10) %eax) +20256 (write-buffered *(ebp+0x10) "' is not an addr\n") +20257 (flush *(ebp+0x10)) +20258 (stop *(ebp+0x14) 1) +20259 # never gets here +20260 +20261 $check-mu-address-stmt:error-type-mismatch: +20262 (write-buffered *(ebp+0x10) "fn ") +20263 8b/-> *(ebp+0xc) 0/r32/eax +20264 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20265 (write-buffered *(ebp+0x10) %eax) +20266 (write-buffered *(ebp+0x10) ": stmt address: output '") +20267 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +20268 (lookup *eax *(eax+4)) # Var-name Var-name => eax +20269 (write-buffered *(ebp+0x10) %eax) +20270 (write-buffered *(ebp+0x10) "' cannot hold address of '") +20271 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +20272 (lookup *eax *(eax+4)) # Var-name Var-name => eax +20273 (write-buffered *(ebp+0x10) %eax) +20274 (write-buffered *(ebp+0x10) "'\n") +20275 (flush *(ebp+0x10)) +20276 (stop *(ebp+0x14) 1) +20277 # never gets here +20278 +20279 type-equal-ignoring-capacity?: # a: (addr type-tree), b: (addr type-tree) -> result/eax: boolean +20280 # . prologue +20281 55/push-ebp +20282 89/<- %ebp 4/r32/esp +20283 # . save registers +20284 51/push-ecx +20285 52/push-edx +20286 53/push-ebx +20287 # var curr-a/ecx: (addr type-tree) = a +20288 8b/-> *(ebp+8) 1/r32/ecx +20289 # var curr-b/ebx: (addr type-tree) = b +20290 8b/-> *(ebp+0xc) 3/r32/ebx +20291 # if (curr-a->is-atom?) fall back to regular equality +20292 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +20293 0f 85/jump-if-!= $type-equal-ignoring-capacity?:base-case/disp32 +20294 # if (curr-a->left != curr-b->left) return false +20295 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +20296 89/<- %edx 0/r32/eax +20297 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +20298 (type-equal? %edx %eax) # => eax +20299 3d/compare-eax-and 0/imm32/false +20300 0f 84/jump-if-= $type-equal-ignoring-capacity?:end/disp32 # eax switches meaning +20301 # if (curr-a->left == "array") curr-a = curr-a->element-type +20302 { +20303 (is-mu-array? %edx) # => eax +20304 3d/compare-eax-and 0/imm32/false +20305 75/jump-if-!= break/disp8 +20306 $type-equal-ignoring-capacity?:array: +20307 # curr-a = curr-a->right->left +20308 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +20309 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +20310 89/<- %ecx 0/r32/eax +20311 # curr-b = curr-b->right->left +20312 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +20313 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +20314 89/<- %ebx 0/r32/eax +20315 eb/jump $type-equal-ignoring-capacity?:base-case/disp8 +20316 } +20317 # if (curr-a->left == "stream") curr-a = curr-a->element-type +20318 { +20319 (is-mu-stream? %edx) # => eax +20320 3d/compare-eax-and 0/imm32/false +20321 75/jump-if-!= break/disp8 +20322 $type-equal-ignoring-capacity?:stream: +20323 # curr-a = curr-a->right->left +20324 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +20325 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +20326 89/<- %ecx 0/r32/eax +20327 # curr-b = curr-b->right->left +20328 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +20329 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +20330 89/<- %ebx 0/r32/eax +20331 eb/jump $type-equal-ignoring-capacity?:base-case/disp8 +20332 } +20333 $type-equal-ignoring-capacity?:base-case: +20334 # return type-equal?(curr-a, curr-b) +20335 (type-equal? %ecx %ebx) # => eax +20336 $type-equal-ignoring-capacity?:end: +20337 # . restore registers +20338 5b/pop-to-ebx +20339 5a/pop-to-edx +20340 59/pop-to-ecx +20341 # . epilogue +20342 89/<- %esp 5/r32/ebp +20343 5d/pop-to-ebp +20344 c3/return +20345 +20346 check-mu-return-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +20347 # . prologue +20348 55/push-ebp +20349 89/<- %ebp 4/r32/esp +20350 # . save registers +20351 50/push-eax +20352 51/push-ecx +20353 52/push-edx +20354 53/push-ebx +20355 56/push-esi +20356 57/push-edi +20357 # var type-parameters/edx: (addr table (handle array byte) (addr type-tree) 8) +20358 81 5/subop/subtract %esp 0x60/imm32 +20359 68/push 0x60/imm32/size +20360 68/push 0/imm32/read +20361 68/push 0/imm32/write +20362 89/<- %edx 4/r32/esp +20363 # var template/esi: (addr list var) = fn->outputs +20364 8b/-> *(ebp+0xc) 0/r32/eax +20365 (lookup *(eax+0x10) *(eax+0x14)) # Function-outputs Function-outputs => eax +20366 89/<- %esi 0/r32/eax +20367 # var curr-template/ebx: (addr list var) = fn->outputs +20368 89/<- %ebx 0/r32/eax +20369 # var curr/edi: (addr stmt-var) = stmt->inouts +20370 8b/-> *(ebp+8) 0/r32/eax +20371 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +20372 89/<- %edi 0/r32/eax +20373 { +20374 # if template is null, break +20375 81 7/subop/compare %ebx 0/imm32 +20376 0f 84/jump-if-= break/disp32 +20377 # if curr is null, abort +20378 81 7/subop/compare %edi 0/imm32 +20379 0f 84/jump-if-= $check-mu-return-stmt:error-too-few-inouts/disp32 +20380 # var template-type/ecx: (addr type-tree) = template->value->type +20381 (lookup *ebx *(ebx+4)) # List-value List-value => eax +20382 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +20383 89/<- %ecx 0/r32/eax +20384 # var curr-type/eax: (addr type-tree) = curr->value->type +20385 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +20386 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +20387 # if (curr->is-deref?) curr-type = payload of curr-type +20388 81 7/subop/compare *(edi+0x10) 0/imm32/false # Stmt-var-is-deref +20389 { +20390 74/jump-if-= break/disp8 +20391 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +20392 # if t->right is null, t = t->left +20393 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +20394 75/jump-if-!= break/disp8 +20395 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +20396 } +20397 # if (curr-type != template-type) abort +20398 (type-match? %ecx %eax %edx) # => eax +20399 3d/compare-eax-and 0/imm32/false +20400 0f 84/jump-if-= $check-mu-return-stmt:error1/disp32 +20401 # if register-within-list-with-conflict?(curr, original template, curr-template, stmt) abort +20402 (register-within-list-with-conflict? %edi %esi %ebx *(ebp+8)) # => eax +20403 3d/compare-eax-and 0/imm32/false +20404 0f 85/jump-if-!= $check-mu-return-stmt:error2/disp32 +20405 # template = template->next +20406 (lookup *(ebx+8) *(ebx+0xc)) # List-next List-next => eax +20407 89/<- %ebx 0/r32/eax +20408 # curr = curr->next +20409 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +20410 89/<- %edi 0/r32/eax +20411 # +20412 e9/jump loop/disp32 +20413 } +20414 # if curr is not null, abort +20415 81 7/subop/compare %edi 0/imm32 +20416 0f 85/jump-if-!= $check-mu-return-stmt:error-too-many-inouts/disp32 +20417 $check-mu-return-stmt:end: +20418 # . reclaim locals +20419 81 0/subop/add %esp 0x6c/imm32 +20420 # . restore registers +20421 5f/pop-to-edi +20422 5e/pop-to-esi +20423 5b/pop-to-ebx +20424 5a/pop-to-edx +20425 59/pop-to-ecx +20426 58/pop-to-eax +20427 # . epilogue +20428 89/<- %esp 5/r32/ebp +20429 5d/pop-to-ebp +20430 c3/return +20431 +20432 $check-mu-return-stmt:error1: +20433 (write-buffered *(ebp+0x10) "fn ") +20434 8b/-> *(ebp+0xc) 0/r32/eax +20435 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20436 (write-buffered *(ebp+0x10) %eax) +20437 (write-buffered *(ebp+0x10) ": return: '") +20438 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +20439 (lookup *eax *(eax+4)) # Var-name Var-name => eax +20440 (write-buffered *(ebp+0x10) %eax) +20441 (write-buffered *(ebp+0x10) "' has the wrong type\n") +20442 (flush *(ebp+0x10)) +20443 (stop *(ebp+0x14) 1) +20444 # never gets here +20445 +20446 $check-mu-return-stmt:error2: +20447 (write-buffered *(ebp+0x10) "fn ") +20448 8b/-> *(ebp+0xc) 0/r32/eax +20449 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20450 (write-buffered *(ebp+0x10) %eax) +20451 (write-buffered *(ebp+0x10) ": return: '") +20452 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +20453 (lookup *eax *(eax+4)) # Var-name Var-name => eax +20454 (write-buffered *(ebp+0x10) %eax) +20455 (write-buffered *(ebp+0x10) "' is no longer available\n") +20456 (flush *(ebp+0x10)) +20457 (stop *(ebp+0x14) 1) +20458 # never gets here +20459 +20460 $check-mu-return-stmt:error-too-few-inouts: +20461 (write-buffered *(ebp+0x10) "fn ") +20462 8b/-> *(ebp+0xc) 0/r32/eax +20463 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20464 (write-buffered *(ebp+0x10) %eax) +20465 (write-buffered *(ebp+0x10) ": return: too few inouts\n") +20466 (flush *(ebp+0x10)) +20467 (stop *(ebp+0x14) 1) +20468 # never gets here +20469 +20470 $check-mu-return-stmt:error-too-many-inouts: +20471 (write-buffered *(ebp+0x10) "fn ") +20472 8b/-> *(ebp+0xc) 0/r32/eax +20473 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20474 (write-buffered *(ebp+0x10) %eax) +20475 (write-buffered *(ebp+0x10) ": return: too many inouts\n") +20476 (flush *(ebp+0x10)) +20477 (stop *(ebp+0x14) 1) +20478 # never gets here +20479 +20480 check-all-unique-registers: # outputs: (addr list var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +20481 # . prologue +20482 55/push-ebp +20483 89/<- %ebp 4/r32/esp +20484 # . save registers +20485 50/push-eax +20486 51/push-ecx +20487 56/push-esi +20488 # var table/esi: (addr table (handle array byte) int 8) +20489 81 5/subop/subtract %esp 0x60/imm32 +20490 68/push 0x60/imm32/size +20491 68/push 0/imm32/read +20492 68/push 0/imm32/write +20493 89/<- %esi 4/r32/esp +20494 # var curr/ecx: (addr list var) = outputs +20495 8b/-> *(ebp+8) 1/r32/ecx +20496 { +20497 # if (curr == 0) break +20498 81 7/subop/compare %ecx 0/imm32 +20499 0f 84/jump-if-= break/disp32 +20500 # var reg/eax: (addr array byte) = curr->value->register # guaranteed to exist +20501 (lookup *ecx *(ecx+4)) # List-value List-value => eax +20502 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +20503 # if reg exists in table, abort +20504 (maybe-get %esi %eax 0xc) # => eax +20505 3d/compare-eax-and 0/imm32 +20506 0f 85/jump-if-!= $check-all-unique-registers:abort/disp32 +20507 # insert reg in table +20508 (lookup *ecx *(ecx+4)) # List-value List-value => eax +20509 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +20510 (get-or-insert %esi %eax 0xc Heap) +20511 # curr = curr->next +20512 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +20513 89/<- %ecx 0/r32/eax +20514 e9/jump loop/disp32 +20515 } +20516 $check-all-unique-registers:end: +20517 # . reclaim locals +20518 81 0/subop/add %esp 0x6c/imm32 +20519 # . restore registers +20520 5e/pop-to-esi +20521 59/pop-to-ecx +20522 58/pop-to-eax +20523 # . epilogue +20524 89/<- %esp 5/r32/ebp +20525 5d/pop-to-ebp +20526 c3/return +20527 +20528 $check-all-unique-registers:abort: +20529 (write-buffered *(ebp+0x10) "fn ") +20530 8b/-> *(ebp+0xc) 0/r32/eax +20531 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20532 (write-buffered *(ebp+0x10) %eax) +20533 (write-buffered *(ebp+0x10) ": outputs must be in unique registers\n") +20534 (flush *(ebp+0x10)) +20535 (stop *(ebp+0x14) 1) +20536 # never gets here +20537 +20538 # return false if s's register is not between start (inclusive) and end (exclusive) +20539 # return false if the positionally corresponding register in stmt->inouts (where s comes from) is also s's register +20540 # otherwise return true +20541 register-within-list-with-conflict?: # s: (addr stmt-var), start: (addr list var), end: (addr list var), stmt: (addr stmt) -> result/eax: boolean +20542 # . prologue +20543 55/push-ebp +20544 89/<- %ebp 4/r32/esp +20545 # . save registers +20546 51/push-ecx +20547 52/push-edx +20548 53/push-ebx +20549 56/push-esi +20550 57/push-edi +20551 # var target/ebx: (addr array byte) = s->value->register +20552 8b/-> *(ebp+8) 0/r32/eax +20553 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +20554 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +20555 #? (write-buffered Stderr "AA: ") +20556 #? (write-buffered Stderr %eax) +20557 #? (write-buffered Stderr Newline) +20558 #? (flush Stderr) +20559 # if (var->register == 0) return false +20560 3d/compare-eax-and 0/imm32 +20561 0f 84/jump-if-= $register-within-list-with-conflict?:end/disp32 # eax turns into result +20562 89/<- %ebx 0/r32/eax +20563 # var curr/ecx: (addr list var) = start +20564 8b/-> *(ebp+0xc) 1/r32/ecx +20565 # edx = end +20566 8b/-> *(ebp+0x10) 2/r32/edx +20567 { +20568 # if (curr == 0) break +20569 81 7/subop/compare %edi 0/imm32 +20570 0f 84/jump-if-= break/disp32 +20571 # if (curr == end) break +20572 39/compare %ecx 2/r32/edx +20573 0f 84/jump-if-= break/disp32 +20574 # var curr-reg/eax: (addr array byte) = curr->value->register +20575 (lookup *ecx *(ecx+4)) # List-value List-value => eax +20576 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +20577 # if (curr-reg == 0) continue +20578 3d/compare-eax-and 0/imm32 +20579 74/jump-if-= $register-within-list-with-conflict?:continue/disp8 +20580 # if (curr-reg == target) check for conflict +20581 (string-equal? %eax %ebx) # => eax +20582 3d/compare-eax-and 0/imm32/false +20583 { +20584 74/jump-if-= break/disp8 +20585 #? (write-buffered Stderr "conflict?\n") +20586 #? (flush Stderr) +20587 # var return-inouts/eax: (addr stmt-var) = stmt->inouts +20588 8b/-> *(ebp+0x14) 0/r32/eax +20589 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +20590 (register-conflict? %ebx %eax *(ebp+0xc)) # => eax +20591 eb/jump $register-within-list-with-conflict?:end/disp8 +20592 } +20593 $register-within-list-with-conflict?:continue: +20594 # curr = curr->next +20595 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +20596 89/<- %ecx 0/r32/eax +20597 e9/jump loop/disp32 +20598 } +20599 # return false +20600 b8/copy-to-eax 0/imm32/false +20601 $register-within-list-with-conflict?:end: +20602 # . restore registers +20603 5f/pop-to-edi +20604 5e/pop-to-esi +20605 5b/pop-to-ebx +20606 5a/pop-to-edx +20607 59/pop-to-ecx +20608 # . epilogue +20609 89/<- %esp 5/r32/ebp +20610 5d/pop-to-ebp +20611 c3/return +20612 +20613 # At the first occurrence of register 'reg' in fn-outputs, +20614 # check if the corresponding element of return-inouts has a different register. +20615 # This hacky helper is intended to be called in one specific place. Don't +20616 # reuse it as is. +20617 register-conflict?: # reg: (addr array byte), return-inouts: (addr stmt-var), fn-outputs: (addr list var) => result/eax: boolean +20618 # . prologue +20619 55/push-ebp +20620 89/<- %ebp 4/r32/esp +20621 # . save registers +20622 51/push-ecx +20623 52/push-edx +20624 53/push-ebx +20625 56/push-esi +20626 57/push-edi +20627 #? (write-buffered Stderr "BB: ") +20628 #? (write-buffered Stderr *(ebp+8)) +20629 #? (write-buffered Stderr Newline) +20630 #? (flush Stderr) +20631 # var curr-output/edi: (addr list var) = fn-outputs +20632 8b/-> *(ebp+0x10) 7/r32/edi +20633 # var curr-inout/esi: (addr stmt-var) = return-inouts +20634 8b/-> *(ebp+0xc) 6/r32/esi +20635 { +20636 # if (curr-output == 0) abort +20637 81 7/subop/compare %edi 0/imm32 +20638 0f 84/jump-if-= break/disp32 +20639 # if (curr-output->value->register != reg) continue +20640 (lookup *edi *(edi+4)) # List-value List-value => eax +20641 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +20642 (string-equal? %eax *(ebp+8)) # => eax +20643 3d/compare-eax-and 0/imm32/false +20644 0f 84/jump-if= $register-conflict?:continue/disp32 +20645 #? (write-buffered Stderr "rescan\n") +20646 #? (flush Stderr) +20647 # var curr-reg/eax: (addr array byte) = curr-inout->value->register +20648 (lookup *esi *(esi+4)) # List-value List-value => eax +20649 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +20650 # if (curr-reg == 0) return true +20651 3d/compare-eax-and 0/imm32 +20652 { +20653 75/jump-if-!= break/disp8 +20654 #? (write-buffered Stderr "no register\n") +20655 #? (flush Stderr) +20656 b8/copy-to-eax 1/imm32/true +20657 e9/jump $register-conflict?:end/disp32 +20658 } +20659 # return (curr-reg != reg) +20660 (string-equal? %eax *(ebp+8)) # => eax +20661 3d/compare-eax-and 0/imm32/false +20662 0f 94/set-if-= %al +20663 #? (write-buffered Stderr "final: ") +20664 #? (write-int32-hex-buffered Stderr %eax) +20665 #? (write-buffered Stderr Newline) +20666 #? (flush Stderr) +20667 eb/jump $register-conflict?:end/disp8 +20668 $register-conflict?:continue: +20669 # curr-output = curr-output->next +20670 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax +20671 89/<- %edi 0/r32/eax +20672 # curr-inout = curr-inout->next +20673 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +20674 89/<- %esi 0/r32/eax +20675 e9/jump loop/disp32 +20676 } +20677 # should never get here +20678 (write-buffered Stderr "register-conflict? misused\n") +20679 (flush Stderr) +20680 e8/call syscall_exit/disp32 +20681 $register-conflict?:end: +20682 # . restore registers +20683 5f/pop-to-edi +20684 5e/pop-to-esi +20685 5b/pop-to-ebx +20686 5a/pop-to-edx +20687 59/pop-to-ecx +20688 # . epilogue +20689 89/<- %esp 5/r32/ebp +20690 5d/pop-to-ebp +20691 c3/return +20692 +20693 check-final-stmt-is-return: # block: (addr block), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +20694 # . prologue +20695 55/push-ebp +20696 89/<- %ebp 4/r32/esp +20697 # . save registers +20698 50/push-eax +20699 51/push-ecx +20700 # var curr/ecx: (addr list stmt) = block->stmts +20701 8b/-> *(ebp+8) 0/r32/eax +20702 (lookup *(eax+4) *(eax+8)) # Block-stmts Block-stmts => eax +20703 3d/compare-eax-and 0/imm32 +20704 74/jump-if-= $check-final-stmt-is-return:end/disp8 +20705 89/<- %ecx 0/r32/eax +20706 { +20707 # if curr->next == 0, break +20708 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +20709 3d/compare-eax-and 0/imm32 +20710 74/jump-if-= break/disp8 +20711 # curr = curr->next +20712 89/<- %ecx 0/r32/eax +20713 e9/jump loop/disp32 +20714 } +20715 $check-final-stmt-is-return:check-tag: +20716 # if curr->value->tag != Stmt1, abort +20717 (lookup *ecx *(ecx+4)) # List-value List-value => eax +20718 81 7/subop/compare *eax 1/imm32/stmt1 # Stmt-tag +20719 75/jump-if-!= $check-final-stmt-is-return:error/disp8 +20720 $check-final-stmt-is-return:check-operation: +20721 # if curr->operation != "return", abort +20722 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +20723 (string-equal? %eax "return") +20724 3d/compare-eax-and 0/imm32/false +20725 74/jump-if-= $check-final-stmt-is-return:error/disp8 +20726 $check-final-stmt-is-return:end: +20727 # . restore registers +20728 59/pop-to-ecx +20729 58/pop-to-eax +20730 # . epilogue +20731 89/<- %esp 5/r32/ebp +20732 5d/pop-to-ebp +20733 c3/return +20734 +20735 $check-final-stmt-is-return:error: +20736 (write-buffered *(ebp+0x10) "fn ") +20737 8b/-> *(ebp+0xc) 0/r32/eax +20738 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20739 (write-buffered *(ebp+0x10) %eax) +20740 (write-buffered *(ebp+0x10) ": final statement should be a 'return'\n") +20741 (flush *(ebp+0x10)) +20742 (stop *(ebp+0x14) 1) +20743 # never gets here +20744 +20745 check-no-breaks: # block: (addr block), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +20746 # . prologue +20747 55/push-ebp +20748 89/<- %ebp 4/r32/esp +20749 # . save registers +20750 50/push-eax +20751 51/push-ecx +20752 # var curr/ecx: (addr list stmt) = block->stmts +20753 8b/-> *(ebp+8) 0/r32/eax +20754 (lookup *(eax+4) *(eax+8)) # Block-stmts Block-stmts => eax +20755 3d/compare-eax-and 0/imm32 +20756 0f 84/jump-if-= $check-no-breaks:end/disp32 +20757 89/<- %ecx 0/r32/eax +20758 { +20759 # if curr->next == 0, break +20760 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +20761 3d/compare-eax-and 0/imm32 +20762 74/jump-if-= break/disp8 +20763 # if curr->value->tag != Stmt1, continue +20764 (lookup *ecx *(ecx+4)) # List-value List-value => eax +20765 81 7/subop/compare *eax 1/imm32/stmt1 # Stmt-tag +20766 75/jump-if-!= $check-no-breaks:continue/disp8 +20767 # if curr->value->operation starts with "break", abort +20768 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +20769 (string-starts-with? %eax "break") # => eax +20770 3d/compare-eax-and 0/imm32/false +20771 75/jump-if-!= $check-no-breaks:error/disp8 +20772 $check-no-breaks:continue: +20773 # curr = curr->next +20774 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +20775 89/<- %ecx 0/r32/eax +20776 e9/jump loop/disp32 +20777 } +20778 $check-no-breaks:end: +20779 # . restore registers +20780 59/pop-to-ecx +20781 58/pop-to-eax +20782 # . epilogue +20783 89/<- %esp 5/r32/ebp +20784 5d/pop-to-ebp +20785 c3/return +20786 +20787 $check-no-breaks:error: +20788 (write-buffered *(ebp+0x10) "fn ") +20789 8b/-> *(ebp+0xc) 0/r32/eax +20790 (lookup *eax *(eax+4)) # Function-name Function-name => eax 20791 (write-buffered *(ebp+0x10) %eax) -20792 (write-buffered *(ebp+0x10) "' must be an addr\n") +20792 (write-buffered *(ebp+0x10) " has outputs, so you cannot 'break' out of the outermost block. Use 'return'.\n") 20793 (flush *(ebp+0x10)) 20794 (stop *(ebp+0x14) 1) 20795 # never gets here 20796 -20797 $check-mu-index-stmt:error-bad-output-type: -20798 (write-buffered *(ebp+0x10) "fn ") -20799 8b/-> *(ebp+0xc) 0/r32/eax -20800 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20801 (write-buffered *(ebp+0x10) %eax) -20802 (write-buffered *(ebp+0x10) ": stmt index: output '") -20803 (lookup *edi *(edi+4)) # Var-name Var-name => eax -20804 (write-buffered *(ebp+0x10) %eax) -20805 (write-buffered *(ebp+0x10) "' does not have the right type\n") -20806 (flush *(ebp+0x10)) -20807 (stop *(ebp+0x14) 1) -20808 # never gets here -20809 -20810 check-mu-length-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -20811 # . prologue -20812 55/push-ebp -20813 89/<- %ebp 4/r32/esp -20814 # . save registers -20815 50/push-eax -20816 51/push-ecx -20817 52/push-edx -20818 53/push-ebx -20819 56/push-esi -20820 57/push-edi -20821 # esi = stmt -20822 8b/-> *(ebp+8) 6/r32/esi -20823 # - check for 0 inouts -20824 # var base/ecx: (addr var) = stmt->inouts->value -20825 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -20826 $check-mu-length-stmt:check-no-inouts: -20827 3d/compare-eax-and 0/imm32 -20828 0f 84/jump-if-= $check-mu-length-stmt:error-too-few-inouts/disp32 -20829 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -20830 89/<- %ecx 0/r32/eax -20831 # - check base type is either (addr array ...) in register or (array ...) on stack -20832 # var base-type/ebx: (addr type-tree) = lookup(base->type) -20833 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -20834 89/<- %ebx 0/r32/eax -20835 # if base-type is an atom, abort with a precise error -20836 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -20837 { -20838 74/jump-if-= break/disp8 -20839 (is-simple-mu-type? %ebx 3) # array => eax -20840 3d/compare-eax-and 0/imm32/false -20841 0f 85/jump-if-!= $check-mu-length-stmt:error-base-array-atom-type/disp32 -20842 0f 84/jump-if-= $check-mu-length-stmt:error-base-non-array-type/disp32 -20843 } -20844 $check-mu-length-stmt:base-is-compound: -20845 # if type->left not addr or array, abort -20846 { -20847 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -20848 (is-simple-mu-type? %eax 2) # addr => eax -20849 3d/compare-eax-and 0/imm32/false -20850 75/jump-if-!= break/disp8 -20851 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -20852 (is-simple-mu-type? %eax 3) # array => eax -20853 3d/compare-eax-and 0/imm32/false -20854 75/jump-if-!= break/disp8 -20855 e9/jump $check-mu-length-stmt:error-base-non-array-type/disp32 -20856 } -20857 # if (type->left == addr) ensure type->right->left == array and type->register exists -20858 { -20859 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -20860 (is-simple-mu-type? %eax 2) # addr => eax -20861 3d/compare-eax-and 0/imm32/false -20862 74/jump-if-= break/disp8 -20863 $check-mu-length-stmt:base-is-addr: -20864 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -20865 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -20866 (is-simple-mu-type? %eax 3) # array => eax -20867 3d/compare-eax-and 0/imm32/false -20868 0f 84/jump-if-= $check-mu-length-stmt:error-base-non-array-type/disp32 -20869 $check-mu-length-stmt:check-base-addr-is-register: -20870 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -20871 0f 84/jump-if-= $check-mu-length-stmt:error-base-address-array-type-on-stack/disp32 -20872 } -20873 # if (type->left == array) ensure type->register doesn't exist -20874 { -20875 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -20876 (is-simple-mu-type? %eax 3) # array => eax -20877 3d/compare-eax-and 0/imm32/false -20878 74/jump-if-= break/disp8 -20879 $check-mu-length-stmt:base-is-array: -20880 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -20881 0f 85/jump-if-!= $check-mu-length-stmt:error-base-array-type-in-register/disp32 -20882 } -20883 # if (base-type->left == addr) base-type = base-type->right -20884 { -20885 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -20886 (is-simple-mu-type? %eax 2) # addr => eax -20887 3d/compare-eax-and 0/imm32/false -20888 74/jump-if-= break/disp8 -20889 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -20890 89/<- %ebx 0/r32/eax -20891 } -20892 # - check for too many inouts -20893 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -20894 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -20895 3d/compare-eax-and 0/imm32/false -20896 0f 85/jump-if-!= $check-mu-length-stmt:error-too-many-inouts/disp32 -20897 # - check for 0 outputs -20898 # var output/edi: (addr var) = stmt->outputs->value -20899 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -20900 3d/compare-eax-and 0/imm32/false -20901 0f 84/jump-if-= $check-mu-length-stmt:error-too-few-outputs/disp32 -20902 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -20903 89/<- %edi 0/r32/eax -20904 # - check output type -20905 # must have a non-atomic type -20906 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -20907 (is-simple-mu-type? %eax 1) # int => eax -20908 3d/compare-eax-and 0/imm32/false -20909 0f 84/jump-if-= $check-mu-length-stmt:error-invalid-output-type/disp32 -20910 # - check for too many outputs -20911 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -20912 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -20913 3d/compare-eax-and 0/imm32/false -20914 0f 85/jump-if-!= $check-mu-length-stmt:error-too-many-outputs/disp32 -20915 $check-mu-length-stmt:end: -20916 # . restore registers -20917 5f/pop-to-edi -20918 5e/pop-to-esi -20919 5b/pop-to-ebx -20920 5a/pop-to-edx -20921 59/pop-to-ecx -20922 58/pop-to-eax -20923 # . epilogue -20924 89/<- %esp 5/r32/ebp -20925 5d/pop-to-ebp -20926 c3/return -20927 -20928 $check-mu-length-stmt:error-base-non-array-type: -20929 (write-buffered *(ebp+0x10) "fn ") -20930 8b/-> *(ebp+0xc) 0/r32/eax -20931 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20932 (write-buffered *(ebp+0x10) %eax) -20933 (write-buffered *(ebp+0x10) ": stmt length: var '") -20934 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -20935 (write-buffered *(ebp+0x10) %eax) -20936 (write-buffered *(ebp+0x10) "' is not an array\n") -20937 (flush *(ebp+0x10)) -20938 (stop *(ebp+0x14) 1) -20939 # never gets here -20940 -20941 $check-mu-length-stmt:error-base-array-atom-type: -20942 (write-buffered *(ebp+0x10) "fn ") -20943 8b/-> *(ebp+0xc) 0/r32/eax -20944 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20945 (write-buffered *(ebp+0x10) %eax) -20946 (write-buffered *(ebp+0x10) ": stmt length: array '") -20947 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -20948 (write-buffered *(ebp+0x10) %eax) -20949 (write-buffered *(ebp+0x10) "' must specify the type of its elements\n") -20950 (flush *(ebp+0x10)) -20951 (stop *(ebp+0x14) 1) -20952 # never gets here +20797 check-mu-get-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +20798 # . prologue +20799 55/push-ebp +20800 89/<- %ebp 4/r32/esp +20801 # . save registers +20802 50/push-eax +20803 51/push-ecx +20804 52/push-edx +20805 53/push-ebx +20806 56/push-esi +20807 57/push-edi +20808 # esi = stmt +20809 8b/-> *(ebp+8) 6/r32/esi +20810 # - check for 0 inouts +20811 # var base/ecx: (addr var) = stmt->inouts->value +20812 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +20813 3d/compare-eax-and 0/imm32/false +20814 0f 84/jump-if-= $check-mu-get-stmt:error-too-few-inouts/disp32 +20815 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +20816 89/<- %ecx 0/r32/eax +20817 $check-mu-get-stmt:check-base: +20818 # - check base type +20819 # if it's an 'addr', check that it's in a register +20820 # var base-type/ebx: (addr type-tree) = lookup(base->type) +20821 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +20822 89/<- %ebx 0/r32/eax +20823 { +20824 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +20825 0f 85/jump-if-!= break/disp32 +20826 $check-mu-get-stmt:base-is-compound: +20827 # if (type->left != addr) break +20828 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +20829 (is-simple-mu-type? %eax 2) # addr => eax +20830 3d/compare-eax-and 0/imm32/false +20831 74/jump-if-= break/disp8 +20832 $check-mu-get-stmt:base-is-addr: +20833 # now check for register +20834 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +20835 0f 84/jump-if-= $check-mu-get-stmt:error-base-type-addr-but-not-register/disp32 +20836 $check-mu-get-stmt:base-is-addr-in-register: +20837 # type->left is now an addr; skip it +20838 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +20839 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +20840 0f 85/jump-if-!= $check-mu-get-stmt:error-bad-base/disp32 +20841 $check-mu-get-stmt:base-is-addr-to-atom-in-register: +20842 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +20843 89/<- %ebx 0/r32/eax +20844 } +20845 $check-mu-get-stmt:check-base-typeinfo: +20846 # ensure type is a container +20847 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +20848 { +20849 75/jump-if-!= break/disp8 +20850 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +20851 89/<- %ebx 0/r32/eax +20852 } +20853 # var base-type-id/ebx: type-id = base-type->value +20854 8b/-> *(ebx+4) 3/r32/ebx # Type-tree-value +20855 (is-container? %ebx) # => eax +20856 3d/compare-eax-and 0/imm32/false +20857 0f 84/jump-if-= $check-mu-get-stmt:error-bad-base/disp32 +20858 # var base-typeinfo/edx: (addr typeinfo) = find-typeinfo(base-type-id) +20859 # . var container/ecx: (handle typeinfo) +20860 68/push 0/imm32 +20861 68/push 0/imm32 +20862 89/<- %ecx 4/r32/esp +20863 # . +20864 (find-typeinfo %ebx %ecx) +20865 (lookup *ecx *(ecx+4)) # => eax +20866 # . reclaim container +20867 81 0/subop/add %esp 8/imm32 +20868 # . +20869 89/<- %edx 0/r32/eax +20870 # var offset/ecx: (addr stmt-var) = stmt->inouts->next +20871 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +20872 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +20873 89/<- %ecx 0/r32/eax +20874 # - check for 1 inout +20875 3d/compare-eax-and 0/imm32/false +20876 0f 84/jump-if-= $check-mu-get-stmt:error-too-few-inouts/disp32 +20877 # var offset/ecx: (addr var) = lookup(offset->value) +20878 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +20879 89/<- %ecx 0/r32/eax +20880 # - check for valid field +20881 81 7/subop/compare *(ecx+0x14) -1/imm32/uninitialized # Var-offset +20882 0f 84/jump-if-= $check-mu-get-stmt:error-bad-field/disp32 +20883 # - check for too many inouts +20884 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +20885 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +20886 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +20887 3d/compare-eax-and 0/imm32/false +20888 0f 85/jump-if-!= $check-mu-get-stmt:error-too-many-inouts/disp32 +20889 # var output/edi: (addr var) = stmt->outputs->value +20890 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +20891 # - check for 0 outputs +20892 3d/compare-eax-and 0/imm32/false +20893 0f 84/jump-if-= $check-mu-get-stmt:error-too-few-outputs/disp32 +20894 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +20895 89/<- %edi 0/r32/eax +20896 $check-mu-get-stmt:check-output-type: +20897 # - check output type +20898 # must be in register +20899 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax +20900 3d/compare-eax-and 0/imm32 +20901 0f 84/jump-if-= $check-mu-get-stmt:error-output-not-in-register/disp32 +20902 # must have a non-atomic type +20903 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +20904 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +20905 0f 85/jump-if-!= $check-mu-get-stmt:error-output-type-not-address/disp32 +20906 # type must start with (addr ...) +20907 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +20908 (is-simple-mu-type? %eax 2) # => eax +20909 3d/compare-eax-and 0/imm32/false +20910 0f 84/jump-if-= $check-mu-get-stmt:error-output-type-not-address/disp32 +20911 $check-mu-get-stmt:check-output-type-match: +20912 # payload of addr type must match 'type' definition +20913 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +20914 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +20915 # if (payload->right == null) payload = payload->left +20916 81 7/subop/compare *(eax+0xc) 0/imm32/null # Type-tree-right +20917 { +20918 75/jump-if-!= break/disp8 +20919 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +20920 } +20921 89/<- %edi 0/r32/eax +20922 # . var output-name/ecx: (addr array byte) +20923 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +20924 89/<- %ecx 0/r32/eax +20925 # . var base-typeinfo-entry/eax: (addr handle typeinfo-entry) +20926 (lookup *(edx+4) *(edx+8)) # Typeinfo-fields Typeinfo-fields => eax +20927 (get %eax %ecx 0x10) # => eax +20928 # . +20929 (lookup *eax *(eax+4)) # => eax +20930 (lookup *eax *(eax+4)) # Typeinfo-entry-input-var Typeinfo-entry-input-var => eax +20931 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +20932 # . +20933 (type-equal? %edi %eax) # => eax +20934 3d/compare-eax-and 0/imm32/false +20935 0f 84/jump-if-= $check-mu-get-stmt:error-bad-output-type/disp32 +20936 # - check for too many outputs +20937 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +20938 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +20939 3d/compare-eax-and 0/imm32/false +20940 0f 85/jump-if-!= $check-mu-get-stmt:error-too-many-outputs/disp32 +20941 $check-mu-get-stmt:end: +20942 # . restore registers +20943 5f/pop-to-edi +20944 5e/pop-to-esi +20945 5b/pop-to-ebx +20946 5a/pop-to-edx +20947 59/pop-to-ecx +20948 58/pop-to-eax +20949 # . epilogue +20950 89/<- %esp 5/r32/ebp +20951 5d/pop-to-ebp +20952 c3/return 20953 -20954 $check-mu-length-stmt:error-base-address-array-type-on-stack: +20954 $check-mu-get-stmt:error-too-few-inouts: 20955 (write-buffered *(ebp+0x10) "fn ") 20956 8b/-> *(ebp+0xc) 0/r32/eax 20957 (lookup *eax *(eax+4)) # Function-name Function-name => eax 20958 (write-buffered *(ebp+0x10) %eax) -20959 (write-buffered *(ebp+0x10) ": stmt length: var '") -20960 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -20961 (write-buffered *(ebp+0x10) %eax) -20962 (write-buffered *(ebp+0x10) "' is an addr to an array, and so must live in a register\n") -20963 (flush *(ebp+0x10)) -20964 (stop *(ebp+0x14) 1) -20965 # never gets here -20966 -20967 $check-mu-length-stmt:error-base-array-type-in-register: -20968 (write-buffered *(ebp+0x10) "fn ") -20969 8b/-> *(ebp+0xc) 0/r32/eax -20970 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20971 (write-buffered *(ebp+0x10) %eax) -20972 (write-buffered *(ebp+0x10) ": stmt length: var '") -20973 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -20974 (write-buffered *(ebp+0x10) %eax) -20975 (write-buffered *(ebp+0x10) "' is an array, and so must live on the stack\n") -20976 (flush *(ebp+0x10)) -20977 (stop *(ebp+0x14) 1) -20978 # never gets here -20979 -20980 $check-mu-length-stmt:error-too-few-inouts: -20981 (write-buffered *(ebp+0x10) "fn ") -20982 8b/-> *(ebp+0xc) 0/r32/eax -20983 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20984 (write-buffered *(ebp+0x10) %eax) -20985 (write-buffered *(ebp+0x10) ": stmt length: too few inouts (1 required)\n") -20986 (flush *(ebp+0x10)) -20987 (stop *(ebp+0x14) 1) -20988 # never gets here -20989 -20990 $check-mu-length-stmt:error-invalid-index-type: -20991 (write-buffered *(ebp+0x10) "fn ") -20992 8b/-> *(ebp+0xc) 0/r32/eax -20993 (lookup *eax *(eax+4)) # Function-name Function-name => eax -20994 (write-buffered *(ebp+0x10) %eax) -20995 (write-buffered *(ebp+0x10) ": stmt length: second argument '") -20996 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -20997 (write-buffered *(ebp+0x10) %eax) -20998 (write-buffered *(ebp+0x10) "' must be an int or offset\n") -20999 (flush *(ebp+0x10)) -21000 (stop *(ebp+0x14) 1) -21001 # never gets here -21002 -21003 $check-mu-length-stmt:error-index-offset-atom-type: -21004 (write-buffered *(ebp+0x10) "fn ") -21005 8b/-> *(ebp+0xc) 0/r32/eax -21006 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21007 (write-buffered *(ebp+0x10) %eax) -21008 (write-buffered *(ebp+0x10) ": stmt length: offset '") -21009 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -21010 (write-buffered *(ebp+0x10) %eax) -21011 (write-buffered *(ebp+0x10) "' must specify the type of array elements\n") -21012 (flush *(ebp+0x10)) -21013 (stop *(ebp+0x14) 1) -21014 # never gets here -21015 -21016 $check-mu-length-stmt:error-index-on-stack: -21017 (write-buffered *(ebp+0x10) "fn ") -21018 8b/-> *(ebp+0xc) 0/r32/eax -21019 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21020 (write-buffered *(ebp+0x10) %eax) -21021 (write-buffered *(ebp+0x10) ": stmt length: second argument '") -21022 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -21023 (write-buffered *(ebp+0x10) %eax) -21024 (write-buffered *(ebp+0x10) "' must be in a register\n") -21025 (flush *(ebp+0x10)) -21026 (stop *(ebp+0x14) 1) -21027 # never gets here -21028 -21029 $check-mu-length-stmt:error-index-needs-offset: -21030 (write-buffered *(ebp+0x10) "fn ") -21031 8b/-> *(ebp+0xc) 0/r32/eax -21032 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21033 (write-buffered *(ebp+0x10) %eax) -21034 (write-buffered *(ebp+0x10) ": stmt length: cannot take an int for array '") -21035 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21036 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -21037 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21038 (write-buffered *(ebp+0x10) %eax) -21039 (write-buffered *(ebp+0x10) "'; create an offset instead. See mu.md for details.\n") -21040 (flush *(ebp+0x10)) -21041 (stop *(ebp+0x14) 1) -21042 # never gets here -21043 -21044 $check-mu-length-stmt:error-too-many-inouts: -21045 (write-buffered *(ebp+0x10) "fn ") -21046 8b/-> *(ebp+0xc) 0/r32/eax -21047 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21048 (write-buffered *(ebp+0x10) %eax) -21049 (write-buffered *(ebp+0x10) ": stmt length: too many inouts (1 required)\n") -21050 (flush *(ebp+0x10)) -21051 (stop *(ebp+0x14) 1) -21052 # never gets here -21053 -21054 $check-mu-length-stmt:error-too-few-outputs: -21055 (write-buffered *(ebp+0x10) "fn ") -21056 8b/-> *(ebp+0xc) 0/r32/eax -21057 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21058 (write-buffered *(ebp+0x10) %eax) -21059 (write-buffered *(ebp+0x10) ": stmt length: must have an output\n") -21060 (flush *(ebp+0x10)) -21061 (stop *(ebp+0x14) 1) -21062 # never gets here -21063 -21064 $check-mu-length-stmt:error-too-many-outputs: -21065 (write-buffered *(ebp+0x10) "fn ") -21066 8b/-> *(ebp+0xc) 0/r32/eax -21067 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21068 (write-buffered *(ebp+0x10) %eax) -21069 (write-buffered *(ebp+0x10) ": stmt length: too many outputs (1 required)\n") -21070 (flush *(ebp+0x10)) -21071 (stop *(ebp+0x14) 1) -21072 # never gets here -21073 -21074 $check-mu-length-stmt:error-output-not-in-register: -21075 (write-buffered *(ebp+0x10) "fn ") -21076 8b/-> *(ebp+0xc) 0/r32/eax -21077 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21078 (write-buffered *(ebp+0x10) %eax) -21079 (write-buffered *(ebp+0x10) ": stmt length: output '") -21080 (lookup *edi *(edi+4)) # Var-name Var-name => eax -21081 (write-buffered *(ebp+0x10) %eax) -21082 (write-buffered *(ebp+0x10) "' is not in a register\n") -21083 (flush *(ebp+0x10)) -21084 (stop *(ebp+0x14) 1) -21085 # never gets here -21086 -21087 $check-mu-length-stmt:error-invalid-output-type: -21088 (write-buffered *(ebp+0x10) "fn ") -21089 8b/-> *(ebp+0xc) 0/r32/eax -21090 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21091 (write-buffered *(ebp+0x10) %eax) -21092 (write-buffered *(ebp+0x10) ": stmt length: output '") -21093 (lookup *edi *(edi+4)) # Var-name Var-name => eax -21094 (write-buffered *(ebp+0x10) %eax) -21095 (write-buffered *(ebp+0x10) "' does not have the right type\n") -21096 (flush *(ebp+0x10)) -21097 (stop *(ebp+0x14) 1) -21098 # never gets here -21099 -21100 check-mu-compute-offset-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -21101 # . prologue -21102 55/push-ebp -21103 89/<- %ebp 4/r32/esp -21104 # . save registers -21105 50/push-eax -21106 51/push-ecx -21107 52/push-edx -21108 53/push-ebx -21109 56/push-esi -21110 57/push-edi -21111 # esi = stmt -21112 8b/-> *(ebp+8) 6/r32/esi -21113 # - check for 0 inouts -21114 # var base/ecx: (addr var) = stmt->inouts->value -21115 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21116 $check-mu-compute-offset-stmt:check-no-inouts: -21117 3d/compare-eax-and 0/imm32 -21118 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-too-few-inouts/disp32 -21119 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -21120 89/<- %ecx 0/r32/eax -21121 # - check base type is either (addr array ...) in register or (array ...) on stack -21122 # var base-type/ebx: (addr type-tree) = lookup(base->type) -21123 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -21124 89/<- %ebx 0/r32/eax -21125 # if base-type is an atom, abort with a precise error -21126 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -21127 { -21128 74/jump-if-= break/disp8 -21129 (is-simple-mu-type? %ebx 3) # array => eax -21130 3d/compare-eax-and 0/imm32/false -21131 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-base-array-atom-type/disp32 -21132 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-base-non-array-type/disp32 -21133 } -21134 $check-mu-compute-offset-stmt:base-is-compound: -21135 # if type->left not addr or array, abort -21136 { -21137 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -21138 (is-simple-mu-type? %eax 2) # addr => eax -21139 3d/compare-eax-and 0/imm32/false -21140 75/jump-if-!= break/disp8 +20959 (write-buffered *(ebp+0x10) ": stmt get: too few inouts (2 required)\n") +20960 (flush *(ebp+0x10)) +20961 (stop *(ebp+0x14) 1) +20962 # never gets here +20963 +20964 $check-mu-get-stmt:error-too-many-inouts: +20965 (write-buffered *(ebp+0x10) "fn ") +20966 8b/-> *(ebp+0xc) 0/r32/eax +20967 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20968 (write-buffered *(ebp+0x10) %eax) +20969 (write-buffered *(ebp+0x10) ": stmt get: too many inouts (2 required)\n") +20970 (flush *(ebp+0x10)) +20971 (stop *(ebp+0x14) 1) +20972 # never gets here +20973 +20974 $check-mu-get-stmt:error-too-few-outputs: +20975 (write-buffered *(ebp+0x10) "fn ") +20976 8b/-> *(ebp+0xc) 0/r32/eax +20977 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20978 (write-buffered *(ebp+0x10) %eax) +20979 (write-buffered *(ebp+0x10) ": stmt get: must have an output\n") +20980 (flush *(ebp+0x10)) +20981 (stop *(ebp+0x14) 1) +20982 # never gets here +20983 +20984 $check-mu-get-stmt:error-too-many-outputs: +20985 (write-buffered *(ebp+0x10) "fn ") +20986 8b/-> *(ebp+0xc) 0/r32/eax +20987 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20988 (write-buffered *(ebp+0x10) %eax) +20989 (write-buffered *(ebp+0x10) ": stmt get: too many outputs (1 required)\n") +20990 (flush *(ebp+0x10)) +20991 (stop *(ebp+0x14) 1) +20992 # never gets here +20993 +20994 $check-mu-get-stmt:error-bad-base: +20995 # error("fn " fn ": stmt get: var '" base->name "' must have a 'type' definition\n") +20996 (write-buffered *(ebp+0x10) "fn ") +20997 8b/-> *(ebp+0xc) 0/r32/eax +20998 (lookup *eax *(eax+4)) # Function-name Function-name => eax +20999 (write-buffered *(ebp+0x10) %eax) +21000 (write-buffered *(ebp+0x10) ": stmt get: var '") +21001 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +21002 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21003 (lookup *eax *(eax+4)) # Var-name Var-name => eax +21004 (write-buffered *(ebp+0x10) %eax) +21005 (write-buffered *(ebp+0x10) "' must have a 'type' definition\n") +21006 (flush *(ebp+0x10)) +21007 (stop *(ebp+0x14) 1) +21008 # never gets here +21009 +21010 $check-mu-get-stmt:error-base-type-addr-but-not-register: +21011 (write-buffered *(ebp+0x10) "fn ") +21012 8b/-> *(ebp+0xc) 0/r32/eax +21013 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21014 (write-buffered *(ebp+0x10) %eax) +21015 (write-buffered *(ebp+0x10) ": stmt get: var '") +21016 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +21017 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21018 (lookup *eax *(eax+4)) # Var-name Var-name => eax +21019 (write-buffered *(ebp+0x10) %eax) +21020 (write-buffered *(ebp+0x10) "' is an 'addr' type, and so must live in a register\n") +21021 (flush *(ebp+0x10)) +21022 (stop *(ebp+0x14) 1) +21023 # never gets here +21024 +21025 $check-mu-get-stmt:error-bad-field: +21026 # error("fn " fn ": stmt get: type " type " has no member called '" curr->name "'\n") +21027 (write-buffered *(ebp+0x10) "fn ") +21028 8b/-> *(ebp+0xc) 0/r32/eax +21029 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21030 (write-buffered *(ebp+0x10) %eax) +21031 (write-buffered *(ebp+0x10) ": stmt get: type '") +21032 # . write(Type-id->data[tmp]) +21033 bf/copy-to-edi Type-id/imm32 +21034 8b/-> *(edi+ebx<<2+0xc) 6/r32/esi +21035 { +21036 81 7/subop/compare %esi 0/imm32 +21037 74/jump-if-= break/disp8 +21038 (write-buffered *(ebp+0x10) %esi) +21039 } +21040 # . +21041 (write-buffered *(ebp+0x10) "' has no member called '") +21042 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21043 (write-buffered *(ebp+0x10) %eax) +21044 (write-buffered *(ebp+0x10) "'\n") +21045 (flush *(ebp+0x10)) +21046 (stop *(ebp+0x14) 1) +21047 # never gets here +21048 +21049 $check-mu-get-stmt:error-output-not-in-register: +21050 (write-buffered *(ebp+0x10) "fn ") +21051 8b/-> *(ebp+0xc) 0/r32/eax +21052 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21053 (write-buffered *(ebp+0x10) %eax) +21054 (write-buffered *(ebp+0x10) ": stmt get: output '") +21055 (lookup *edi *(edi+4)) # Var-name Var-name => eax +21056 (write-buffered *(ebp+0x10) %eax) +21057 (write-buffered *(ebp+0x10) "' is not in a register\n") +21058 (flush *(ebp+0x10)) +21059 (stop *(ebp+0x14) 1) +21060 # never gets here +21061 +21062 $check-mu-get-stmt:error-output-type-not-address: +21063 (write-buffered *(ebp+0x10) "fn ") +21064 8b/-> *(ebp+0xc) 0/r32/eax +21065 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21066 (write-buffered *(ebp+0x10) %eax) +21067 (write-buffered *(ebp+0x10) ": stmt get: output must be an addr\n") +21068 (flush *(ebp+0x10)) +21069 (stop *(ebp+0x14) 1) +21070 # never gets here +21071 +21072 $check-mu-get-stmt:error-bad-output-type: +21073 (write-buffered *(ebp+0x10) "fn ") +21074 8b/-> *(ebp+0xc) 0/r32/eax +21075 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21076 (write-buffered *(ebp+0x10) %eax) +21077 (write-buffered *(ebp+0x10) ": stmt get: wrong output type for member '") +21078 (write-buffered *(ebp+0x10) %ecx) +21079 (write-buffered *(ebp+0x10) "' of type '") +21080 bf/copy-to-edi Type-id/imm32 +21081 8b/-> *(edi+ebx<<2+0xc) 6/r32/esi +21082 { +21083 81 7/subop/compare %esi 0/imm32 +21084 74/jump-if-= break/disp8 +21085 (write-buffered *(ebp+0x10) %esi) +21086 } +21087 (write-buffered *(ebp+0x10) "'\n") +21088 (flush *(ebp+0x10)) +21089 (stop *(ebp+0x14) 1) +21090 # never gets here +21091 +21092 check-mu-index-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +21093 # . prologue +21094 55/push-ebp +21095 89/<- %ebp 4/r32/esp +21096 # . save registers +21097 50/push-eax +21098 51/push-ecx +21099 52/push-edx +21100 53/push-ebx +21101 56/push-esi +21102 57/push-edi +21103 # esi = stmt +21104 8b/-> *(ebp+8) 6/r32/esi +21105 # - check for 0 inouts +21106 # var base/ecx: (addr var) = stmt->inouts->value +21107 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +21108 $check-mu-index-stmt:check-no-inouts: +21109 3d/compare-eax-and 0/imm32 +21110 0f 84/jump-if-= $check-mu-index-stmt:error-too-few-inouts/disp32 +21111 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21112 89/<- %ecx 0/r32/eax +21113 # - check base type is either (addr array ...) in register or (array ...) on stack +21114 # var base-type/ebx: (addr type-tree) = lookup(base->type) +21115 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +21116 89/<- %ebx 0/r32/eax +21117 # if base-type is an atom, abort with a precise error +21118 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +21119 { +21120 74/jump-if-= break/disp8 +21121 (is-simple-mu-type? %ebx 3) # array => eax +21122 3d/compare-eax-and 0/imm32/false +21123 0f 85/jump-if-!= $check-mu-index-stmt:error-base-array-atom-type/disp32 +21124 0f 84/jump-if-= $check-mu-index-stmt:error-base-non-array-type/disp32 +21125 } +21126 $check-mu-index-stmt:base-is-compound: +21127 # if type->left not addr or array, abort +21128 { +21129 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +21130 (is-simple-mu-type? %eax 2) # addr => eax +21131 3d/compare-eax-and 0/imm32/false +21132 75/jump-if-!= break/disp8 +21133 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +21134 (is-simple-mu-type? %eax 3) # array => eax +21135 3d/compare-eax-and 0/imm32/false +21136 75/jump-if-!= break/disp8 +21137 e9/jump $check-mu-index-stmt:error-base-non-array-type/disp32 +21138 } +21139 # if (type->left == addr) ensure type->right->left == array and type->register exists +21140 { 21141 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -21142 (is-simple-mu-type? %eax 3) # array => eax +21142 (is-simple-mu-type? %eax 2) # addr => eax 21143 3d/compare-eax-and 0/imm32/false -21144 75/jump-if-!= break/disp8 -21145 e9/jump $check-mu-compute-offset-stmt:error-base-non-array-type/disp32 -21146 } -21147 # if (type->left == addr) ensure type->right->left == array and type->register exists -21148 { -21149 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -21150 (is-simple-mu-type? %eax 2) # addr => eax -21151 3d/compare-eax-and 0/imm32/false -21152 74/jump-if-= break/disp8 -21153 $check-mu-compute-offset-stmt:base-is-addr: -21154 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21155 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21156 (is-simple-mu-type? %eax 3) # array => eax -21157 3d/compare-eax-and 0/imm32/false -21158 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-base-non-array-type/disp32 -21159 } -21160 # if (base-type->left == addr) base-type = base-type->right -21161 { -21162 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -21163 (is-simple-mu-type? %eax 2) # addr => eax -21164 3d/compare-eax-and 0/imm32/false -21165 74/jump-if-= break/disp8 -21166 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21167 89/<- %ebx 0/r32/eax -21168 } -21169 # - check for 1 inout -21170 # var index/ecx: (addr stmt-var) = stmt->inouts->next->value -21171 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21172 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -21173 $check-mu-compute-offset-stmt:check-single-inout: -21174 3d/compare-eax-and 0/imm32 -21175 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-too-few-inouts/disp32 -21176 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -21177 89/<- %ecx 0/r32/eax -21178 # - check index is either a literal or register -21179 # var index-type/edx: (addr type-tree) -21180 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -21181 89/<- %edx 0/r32/eax -21182 # index type must be a literal or int -21183 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom -21184 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-invalid-index-type/disp32 -21185 { -21186 $check-mu-compute-offset-stmt:index-type-is-atom: -21187 (is-simple-mu-type? %edx 0) # literal => eax -21188 3d/compare-eax-and 0/imm32/false -21189 75/jump-if-!= break/disp8 -21190 (is-simple-mu-type? %edx 1) # int => eax -21191 3d/compare-eax-and 0/imm32/false -21192 75/jump-if-!= break/disp8 -21193 e9/jump $check-mu-compute-offset-stmt:error-invalid-index-type/disp32 -21194 } -21195 # - check for too many inouts -21196 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21197 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -21198 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -21199 3d/compare-eax-and 0/imm32/false -21200 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-too-many-inouts/disp32 -21201 # - check for 0 outputs -21202 # var output/edi: (addr var) = stmt->outputs->value -21203 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -21204 3d/compare-eax-and 0/imm32/false -21205 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-too-few-outputs/disp32 -21206 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -21207 89/<- %edi 0/r32/eax -21208 # - check output type -21209 # must have a non-atomic type -21210 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -21211 89/<- %edx 0/r32/eax -21212 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom -21213 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-output-type-not-offset/disp32 -21214 # type must start with (offset ...) -21215 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -21216 (is-simple-mu-type? %eax 7) # offset => eax -21217 3d/compare-eax-and 0/imm32/false -21218 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-output-type-not-offset/disp32 -21219 # if tail(base-type) != tail(output-type) abort -21220 (type-tail %ebx) # => eax -21221 89/<- %ebx 0/r32/eax -21222 (type-tail %edx) # => eax -21223 (type-equal? %ebx %eax) # => eax -21224 3d/compare-eax-and 0/imm32/false -21225 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-bad-output-type/disp32 -21226 # - check for too many outputs -21227 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -21228 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -21229 3d/compare-eax-and 0/imm32/false -21230 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-too-many-outputs/disp32 -21231 $check-mu-compute-offset-stmt:end: -21232 # . restore registers -21233 5f/pop-to-edi -21234 5e/pop-to-esi -21235 5b/pop-to-ebx -21236 5a/pop-to-edx -21237 59/pop-to-ecx -21238 58/pop-to-eax -21239 # . epilogue -21240 89/<- %esp 5/r32/ebp -21241 5d/pop-to-ebp -21242 c3/return -21243 -21244 $check-mu-compute-offset-stmt:error-base-non-array-type: -21245 (write-buffered *(ebp+0x10) "fn ") -21246 8b/-> *(ebp+0xc) 0/r32/eax -21247 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21248 (write-buffered *(ebp+0x10) %eax) -21249 (write-buffered *(ebp+0x10) ": stmt compute-offset: var '") -21250 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -21251 (write-buffered *(ebp+0x10) %eax) -21252 (write-buffered *(ebp+0x10) "' is not an array\n") -21253 (flush *(ebp+0x10)) -21254 (stop *(ebp+0x14) 1) -21255 # never gets here -21256 -21257 $check-mu-compute-offset-stmt:error-base-array-atom-type: -21258 (write-buffered *(ebp+0x10) "fn ") -21259 8b/-> *(ebp+0xc) 0/r32/eax -21260 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21261 (write-buffered *(ebp+0x10) %eax) -21262 (write-buffered *(ebp+0x10) ": stmt compute-offset: array '") -21263 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -21264 (write-buffered *(ebp+0x10) %eax) -21265 (write-buffered *(ebp+0x10) "' must specify the type of its elements\n") -21266 (flush *(ebp+0x10)) -21267 (stop *(ebp+0x14) 1) -21268 # never gets here -21269 -21270 $check-mu-compute-offset-stmt:error-too-few-inouts: -21271 (write-buffered *(ebp+0x10) "fn ") -21272 8b/-> *(ebp+0xc) 0/r32/eax -21273 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21274 (write-buffered *(ebp+0x10) %eax) -21275 (write-buffered *(ebp+0x10) ": stmt compute-offset: too few inouts (2 required)\n") -21276 (flush *(ebp+0x10)) -21277 (stop *(ebp+0x14) 1) -21278 # never gets here -21279 -21280 $check-mu-compute-offset-stmt:error-invalid-index-type: -21281 (write-buffered *(ebp+0x10) "fn ") -21282 8b/-> *(ebp+0xc) 0/r32/eax -21283 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21284 (write-buffered *(ebp+0x10) %eax) -21285 (write-buffered *(ebp+0x10) ": stmt compute-offset: second argument '") -21286 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -21287 (write-buffered *(ebp+0x10) %eax) -21288 (write-buffered *(ebp+0x10) "' must be an int\n") -21289 (flush *(ebp+0x10)) -21290 (stop *(ebp+0x14) 1) -21291 # never gets here -21292 -21293 $check-mu-compute-offset-stmt:error-index-offset-atom-type: -21294 (write-buffered *(ebp+0x10) "fn ") -21295 8b/-> *(ebp+0xc) 0/r32/eax -21296 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21144 74/jump-if-= break/disp8 +21145 $check-mu-index-stmt:base-is-addr: +21146 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +21147 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +21148 (is-simple-mu-type? %eax 3) # array => eax +21149 3d/compare-eax-and 0/imm32/false +21150 0f 84/jump-if-= $check-mu-index-stmt:error-base-non-array-type/disp32 +21151 $check-mu-index-stmt:check-base-addr-is-register: +21152 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +21153 0f 84/jump-if-= $check-mu-index-stmt:error-base-address-array-type-on-stack/disp32 +21154 } +21155 # if (type->left == array) ensure type->register doesn't exist +21156 { +21157 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +21158 (is-simple-mu-type? %eax 3) # array => eax +21159 3d/compare-eax-and 0/imm32/false +21160 74/jump-if-= break/disp8 +21161 $check-mu-index-stmt:base-is-array: +21162 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +21163 0f 85/jump-if-!= $check-mu-index-stmt:error-base-array-type-in-register/disp32 +21164 } +21165 # if (base-type->left == addr) base-type = base-type->right +21166 { +21167 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +21168 (is-simple-mu-type? %eax 2) # addr => eax +21169 3d/compare-eax-and 0/imm32/false +21170 74/jump-if-= break/disp8 +21171 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +21172 89/<- %ebx 0/r32/eax +21173 } +21174 # - check for 1 inout +21175 # var index/ecx: (addr stmt-var) = stmt->inouts->next->value +21176 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +21177 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +21178 $check-mu-index-stmt:check-single-inout: +21179 3d/compare-eax-and 0/imm32 +21180 0f 84/jump-if-= $check-mu-index-stmt:error-too-few-inouts/disp32 +21181 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21182 89/<- %ecx 0/r32/eax +21183 # - check index is either a literal or register +21184 # var index-type/edx: (addr type-tree) +21185 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +21186 89/<- %edx 0/r32/eax +21187 # if index type is an atom, it must be a literal or int +21188 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom +21189 { +21190 74/jump-if-= break/disp8 +21191 $check-mu-index-stmt:index-type-is-atom: +21192 (is-simple-mu-type? %edx 0) # literal => eax +21193 3d/compare-eax-and 0/imm32/false +21194 75/jump-if-!= $check-mu-index-stmt:index-type-done/disp8 +21195 (is-simple-mu-type? %edx 1) # int => eax +21196 3d/compare-eax-and 0/imm32/false +21197 75/jump-if-!= $check-mu-index-stmt:index-type-done/disp8 +21198 (is-simple-mu-type? %edx 7) # offset => eax +21199 3d/compare-eax-and 0/imm32/false +21200 0f 85/jump-if-!= $check-mu-index-stmt:error-index-offset-atom-type/disp32 +21201 e9/jump $check-mu-index-stmt:error-invalid-index-type/disp32 +21202 } +21203 # if index type is a non-atom: it must be an offset +21204 { +21205 75/jump-if-!= break/disp8 +21206 $check-mu-index-stmt:index-type-is-non-atom: +21207 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +21208 (is-simple-mu-type? %eax 7) # offset => eax +21209 3d/compare-eax-and 0/imm32/false +21210 0f 84/jump-if-= $check-mu-index-stmt:error-invalid-index-type/disp32 +21211 } +21212 $check-mu-index-stmt:index-type-done: +21213 # check index is either a literal or in a register +21214 { +21215 (is-simple-mu-type? %edx 0) # literal => eax +21216 3d/compare-eax-and 0/imm32/false +21217 75/jump-if-!= break/disp8 +21218 $check-mu-index-stmt:check-index-in-register: +21219 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +21220 0f 84/jump-if-= $check-mu-index-stmt:error-index-on-stack/disp32 +21221 } +21222 # - if index is an 'int', check that element type of base has size 1, 2, 4 or 8 bytes. +21223 { +21224 (is-simple-mu-type? %edx 1) # int => eax +21225 3d/compare-eax-and 0/imm32/false +21226 74/jump-if-= break/disp8 +21227 $check-mu-index-stmt:check-index-can-be-int: +21228 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +21229 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21230 (array-element-size %eax) # => eax +21231 3d/compare-eax-and 1/imm32 +21232 74/jump-if-= break/disp8 +21233 3d/compare-eax-and 2/imm32 +21234 74/jump-if-= break/disp8 +21235 3d/compare-eax-and 4/imm32 +21236 74/jump-if-= break/disp8 +21237 3d/compare-eax-and 8/imm32 +21238 74/jump-if-= break/disp8 +21239 e9/jump $check-mu-index-stmt:error-index-needs-offset/disp32 +21240 } +21241 # - check for too many inouts +21242 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +21243 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +21244 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +21245 3d/compare-eax-and 0/imm32/false +21246 0f 85/jump-if-!= $check-mu-index-stmt:error-too-many-inouts/disp32 +21247 # - check for 0 outputs +21248 # var output/edi: (addr var) = stmt->outputs->value +21249 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +21250 3d/compare-eax-and 0/imm32/false +21251 0f 84/jump-if-= $check-mu-index-stmt:error-too-few-outputs/disp32 +21252 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21253 89/<- %edi 0/r32/eax +21254 # - check output type +21255 # must have a non-atomic type +21256 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +21257 89/<- %edx 0/r32/eax +21258 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom +21259 0f 85/jump-if-!= $check-mu-index-stmt:error-output-type-not-address/disp32 +21260 # type must start with (addr ...) +21261 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +21262 (is-simple-mu-type? %eax 2) # addr => eax +21263 3d/compare-eax-and 0/imm32/false +21264 0f 84/jump-if-= $check-mu-index-stmt:error-output-type-not-address/disp32 +21265 # if tail(base-type) != tail(output-type) abort +21266 (type-tail %ebx) # => eax +21267 89/<- %ebx 0/r32/eax +21268 (type-tail %edx) # => eax +21269 (type-equal? %ebx %eax) # => eax +21270 3d/compare-eax-and 0/imm32/false +21271 0f 84/jump-if-= $check-mu-index-stmt:error-bad-output-type/disp32 +21272 # - check for too many outputs +21273 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +21274 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +21275 3d/compare-eax-and 0/imm32/false +21276 0f 85/jump-if-!= $check-mu-index-stmt:error-too-many-outputs/disp32 +21277 $check-mu-index-stmt:end: +21278 # . restore registers +21279 5f/pop-to-edi +21280 5e/pop-to-esi +21281 5b/pop-to-ebx +21282 5a/pop-to-edx +21283 59/pop-to-ecx +21284 58/pop-to-eax +21285 # . epilogue +21286 89/<- %esp 5/r32/ebp +21287 5d/pop-to-ebp +21288 c3/return +21289 +21290 $check-mu-index-stmt:error-base-non-array-type: +21291 (write-buffered *(ebp+0x10) "fn ") +21292 8b/-> *(ebp+0xc) 0/r32/eax +21293 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21294 (write-buffered *(ebp+0x10) %eax) +21295 (write-buffered *(ebp+0x10) ": stmt index: var '") +21296 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax 21297 (write-buffered *(ebp+0x10) %eax) -21298 (write-buffered *(ebp+0x10) ": stmt compute-offset: offset '") -21299 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -21300 (write-buffered *(ebp+0x10) %eax) -21301 (write-buffered *(ebp+0x10) "' must specify the type of array elements\n") -21302 (flush *(ebp+0x10)) -21303 (stop *(ebp+0x14) 1) -21304 # never gets here -21305 -21306 $check-mu-compute-offset-stmt:error-index-on-stack: -21307 (write-buffered *(ebp+0x10) "fn ") -21308 8b/-> *(ebp+0xc) 0/r32/eax -21309 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21298 (write-buffered *(ebp+0x10) "' is not an array\n") +21299 (flush *(ebp+0x10)) +21300 (stop *(ebp+0x14) 1) +21301 # never gets here +21302 +21303 $check-mu-index-stmt:error-base-array-atom-type: +21304 (write-buffered *(ebp+0x10) "fn ") +21305 8b/-> *(ebp+0xc) 0/r32/eax +21306 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21307 (write-buffered *(ebp+0x10) %eax) +21308 (write-buffered *(ebp+0x10) ": stmt index: array '") +21309 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax 21310 (write-buffered *(ebp+0x10) %eax) -21311 (write-buffered *(ebp+0x10) ": stmt compute-offset: second argument '") -21312 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -21313 (write-buffered *(ebp+0x10) %eax) -21314 (write-buffered *(ebp+0x10) "' must be in a register\n") -21315 (flush *(ebp+0x10)) -21316 (stop *(ebp+0x14) 1) -21317 # never gets here -21318 -21319 $check-mu-compute-offset-stmt:error-too-many-inouts: -21320 (write-buffered *(ebp+0x10) "fn ") -21321 8b/-> *(ebp+0xc) 0/r32/eax -21322 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21311 (write-buffered *(ebp+0x10) "' must specify the type of its elements\n") +21312 (flush *(ebp+0x10)) +21313 (stop *(ebp+0x14) 1) +21314 # never gets here +21315 +21316 $check-mu-index-stmt:error-base-address-array-type-on-stack: +21317 (write-buffered *(ebp+0x10) "fn ") +21318 8b/-> *(ebp+0xc) 0/r32/eax +21319 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21320 (write-buffered *(ebp+0x10) %eax) +21321 (write-buffered *(ebp+0x10) ": stmt index: var '") +21322 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax 21323 (write-buffered *(ebp+0x10) %eax) -21324 (write-buffered *(ebp+0x10) ": stmt compute-offset: too many inouts (2 required)\n") +21324 (write-buffered *(ebp+0x10) "' is an addr to an array, and so must live in a register\n") 21325 (flush *(ebp+0x10)) 21326 (stop *(ebp+0x14) 1) 21327 # never gets here 21328 -21329 $check-mu-compute-offset-stmt:error-too-few-outputs: +21329 $check-mu-index-stmt:error-base-array-type-in-register: 21330 (write-buffered *(ebp+0x10) "fn ") 21331 8b/-> *(ebp+0xc) 0/r32/eax 21332 (lookup *eax *(eax+4)) # Function-name Function-name => eax 21333 (write-buffered *(ebp+0x10) %eax) -21334 (write-buffered *(ebp+0x10) ": stmt compute-offset: must have an output\n") -21335 (flush *(ebp+0x10)) -21336 (stop *(ebp+0x14) 1) -21337 # never gets here -21338 -21339 $check-mu-compute-offset-stmt:error-too-many-outputs: -21340 (write-buffered *(ebp+0x10) "fn ") -21341 8b/-> *(ebp+0xc) 0/r32/eax -21342 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21343 (write-buffered *(ebp+0x10) %eax) -21344 (write-buffered *(ebp+0x10) ": stmt compute-offset: too many outputs (1 required)\n") -21345 (flush *(ebp+0x10)) -21346 (stop *(ebp+0x14) 1) -21347 # never gets here -21348 -21349 $check-mu-compute-offset-stmt:error-output-not-in-register: -21350 (write-buffered *(ebp+0x10) "fn ") -21351 8b/-> *(ebp+0xc) 0/r32/eax -21352 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21353 (write-buffered *(ebp+0x10) %eax) -21354 (write-buffered *(ebp+0x10) ": stmt compute-offset: output '") -21355 (lookup *edi *(edi+4)) # Var-name Var-name => eax +21334 (write-buffered *(ebp+0x10) ": stmt index: var '") +21335 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21336 (write-buffered *(ebp+0x10) %eax) +21337 (write-buffered *(ebp+0x10) "' is an array, and so must live on the stack\n") +21338 (flush *(ebp+0x10)) +21339 (stop *(ebp+0x14) 1) +21340 # never gets here +21341 +21342 $check-mu-index-stmt:error-too-few-inouts: +21343 (write-buffered *(ebp+0x10) "fn ") +21344 8b/-> *(ebp+0xc) 0/r32/eax +21345 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21346 (write-buffered *(ebp+0x10) %eax) +21347 (write-buffered *(ebp+0x10) ": stmt index: too few inouts (2 required)\n") +21348 (flush *(ebp+0x10)) +21349 (stop *(ebp+0x14) 1) +21350 # never gets here +21351 +21352 $check-mu-index-stmt:error-invalid-index-type: +21353 (write-buffered *(ebp+0x10) "fn ") +21354 8b/-> *(ebp+0xc) 0/r32/eax +21355 (lookup *eax *(eax+4)) # Function-name Function-name => eax 21356 (write-buffered *(ebp+0x10) %eax) -21357 (write-buffered *(ebp+0x10) "' is not in a register\n") -21358 (flush *(ebp+0x10)) -21359 (stop *(ebp+0x14) 1) -21360 # never gets here -21361 -21362 $check-mu-compute-offset-stmt:error-output-type-not-offset: -21363 (write-buffered *(ebp+0x10) "fn ") -21364 8b/-> *(ebp+0xc) 0/r32/eax -21365 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21366 (write-buffered *(ebp+0x10) %eax) -21367 (write-buffered *(ebp+0x10) ": stmt compute-offset: output '") -21368 (lookup *edi *(edi+4)) # Var-name Var-name => eax +21357 (write-buffered *(ebp+0x10) ": stmt index: second argument '") +21358 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21359 (write-buffered *(ebp+0x10) %eax) +21360 (write-buffered *(ebp+0x10) "' must be an int or offset\n") +21361 (flush *(ebp+0x10)) +21362 (stop *(ebp+0x14) 1) +21363 # never gets here +21364 +21365 $check-mu-index-stmt:error-index-offset-atom-type: +21366 (write-buffered *(ebp+0x10) "fn ") +21367 8b/-> *(ebp+0xc) 0/r32/eax +21368 (lookup *eax *(eax+4)) # Function-name Function-name => eax 21369 (write-buffered *(ebp+0x10) %eax) -21370 (write-buffered *(ebp+0x10) "' must be an offset\n") -21371 (flush *(ebp+0x10)) -21372 (stop *(ebp+0x14) 1) -21373 # never gets here -21374 -21375 $check-mu-compute-offset-stmt:error-bad-output-type: -21376 (write-buffered *(ebp+0x10) "fn ") -21377 8b/-> *(ebp+0xc) 0/r32/eax -21378 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21379 (write-buffered *(ebp+0x10) %eax) -21380 (write-buffered *(ebp+0x10) ": stmt compute-offset: output '") -21381 (lookup *edi *(edi+4)) # Var-name Var-name => eax +21370 (write-buffered *(ebp+0x10) ": stmt index: offset '") +21371 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21372 (write-buffered *(ebp+0x10) %eax) +21373 (write-buffered *(ebp+0x10) "' must specify the type of array elements\n") +21374 (flush *(ebp+0x10)) +21375 (stop *(ebp+0x14) 1) +21376 # never gets here +21377 +21378 $check-mu-index-stmt:error-index-on-stack: +21379 (write-buffered *(ebp+0x10) "fn ") +21380 8b/-> *(ebp+0xc) 0/r32/eax +21381 (lookup *eax *(eax+4)) # Function-name Function-name => eax 21382 (write-buffered *(ebp+0x10) %eax) -21383 (write-buffered *(ebp+0x10) "' does not have the right type\n") -21384 (flush *(ebp+0x10)) -21385 (stop *(ebp+0x14) 1) -21386 # never gets here -21387 -21388 check-mu-copy-object-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -21389 # . prologue -21390 55/push-ebp -21391 89/<- %ebp 4/r32/esp -21392 # . save registers -21393 50/push-eax -21394 51/push-ecx -21395 53/push-ebx -21396 56/push-esi -21397 57/push-edi -21398 # esi = stmt -21399 8b/-> *(ebp+8) 6/r32/esi -21400 $check-mu-copy-object-stmt:check-for-output: -21401 # if stmt->outputs abort -21402 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -21403 3d/compare-eax-and 0/imm32 -21404 0f 85/jump-if-!= $check-mu-copy-object-stmt:error-too-many-outputs/disp32 -21405 $check-mu-copy-object-stmt:get-left: -21406 # var dest/edi: (addr stmt-var) = stmt->inouts -21407 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21408 89/<- %edi 0/r32/eax -21409 # zero inouts -21410 3d/compare-eax-and 0/imm32 -21411 0f 84/jump-if-= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 -21412 $check-mu-copy-object-stmt:get-src: -21413 # var src/esi: (addr stmt-var) = dest->next -21414 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -21415 89/<- %esi 0/r32/eax -21416 # 1 inout -21417 3d/compare-eax-and 0/imm32 -21418 0f 84/jump-if-= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 -21419 # > 2 inouts -21420 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -21421 3d/compare-eax-and 0/imm32 -21422 0f 85/jump-if-!= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 -21423 $check-mu-copy-object-stmt:types: -21424 # var src-type/ecx: (addr type-tree) = src->value->type -21425 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21426 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21427 89/<- %ecx 0/r32/eax -21428 # if (src->is-deref?) src-type = src-type->payload -21429 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref -21430 3d/compare-eax-and 0/imm32/false -21431 { -21432 74/jump-if-= break/disp8 -21433 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -21434 # if src-type->right is null, src-type = src-type->left -21435 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -21436 { -21437 75/jump-if-!= break/disp8 -21438 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21439 } -21440 89/<- %ecx 0/r32/eax -21441 } -21442 # if src-type is not addr, abort -21443 (is-mu-addr-type? %ecx) # => eax -21444 3d/compare-eax-and 0/imm32/false -21445 0f 84/jump-if-= $check-mu-copy-object-stmt:error-invalid-types/disp32 -21446 # var dest-type/ebx: (addr type-tree) = dest->value->type -21447 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21448 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21449 89/<- %ebx 0/r32/eax -21450 # if (dest->is-deref?) dest-type = dest-type->payload -21451 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref -21452 3d/compare-eax-and 0/imm32/false -21453 { -21454 74/jump-if-= break/disp8 -21455 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21456 # if dest-type->right is null, dest-type = dest-type->left -21457 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -21458 { -21459 75/jump-if-!= break/disp8 -21460 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21461 } -21462 89/<- %ebx 0/r32/eax -21463 } -21464 # if (dest-type != src-type) abort -21465 (type-equal? %ecx %ebx) # => eax -21466 3d/compare-eax-and 0/imm32 -21467 0f 84/jump-if-= $check-mu-copy-object-stmt:error-invalid-types/disp32 -21468 $check-mu-copy-object-stmt:end: -21469 # . restore registers -21470 5f/pop-to-edi -21471 5e/pop-to-esi -21472 5b/pop-to-ebx -21473 59/pop-to-ecx -21474 58/pop-to-eax -21475 # . epilogue -21476 89/<- %esp 5/r32/ebp -21477 5d/pop-to-ebp -21478 c3/return -21479 -21480 $check-mu-copy-object-stmt:error-incorrect-inouts: -21481 (write-buffered *(ebp+0x10) "fn ") -21482 8b/-> *(ebp+0xc) 0/r32/eax -21483 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21484 (write-buffered *(ebp+0x10) %eax) -21485 (write-buffered *(ebp+0x10) ": stmt 'copy-object' must have two inouts\n") -21486 (flush *(ebp+0x10)) -21487 (stop *(ebp+0x14) 1) -21488 # never gets here -21489 -21490 $check-mu-copy-object-stmt:error-too-many-outputs: -21491 (write-buffered *(ebp+0x10) "fn ") -21492 8b/-> *(ebp+0xc) 0/r32/eax -21493 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21494 (write-buffered *(ebp+0x10) %eax) -21495 (write-buffered *(ebp+0x10) ": stmt 'copy-object' must not have any outputs\n") -21496 (flush *(ebp+0x10)) -21497 (stop *(ebp+0x14) 1) -21498 # never gets here -21499 -21500 $check-mu-copy-object-stmt:error-invalid-types: -21501 (write-buffered *(ebp+0x10) "fn ") -21502 8b/-> *(ebp+0xc) 0/r32/eax -21503 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21504 (write-buffered *(ebp+0x10) %eax) -21505 (write-buffered *(ebp+0x10) ": stmt copy-object: two inouts with identical addr types expected\n") -21506 (flush *(ebp+0x10)) -21507 (stop *(ebp+0x14) 1) -21508 # never gets here -21509 -21510 check-mu-allocate-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -21511 # . prologue -21512 55/push-ebp -21513 89/<- %ebp 4/r32/esp -21514 # . save registers -21515 50/push-eax -21516 53/push-ebx -21517 56/push-esi -21518 57/push-edi -21519 # esi = stmt -21520 8b/-> *(ebp+8) 6/r32/esi -21521 $check-mu-allocate-stmt:check-for-output: -21522 # if stmt->outputs abort -21523 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -21524 3d/compare-eax-and 0/imm32 -21525 0f 85/jump-if-!= $check-mu-allocate-stmt:error-too-many-outputs/disp32 -21526 $check-mu-allocate-stmt:get-target: -21527 # var target/edi: (addr stmt-var) = stmt->inouts -21528 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21529 89/<- %edi 0/r32/eax -21530 # zero inouts -21531 3d/compare-eax-and 0/imm32 -21532 0f 84/jump-if-= $check-mu-allocate-stmt:error-incorrect-inouts/disp32 -21533 # > 1 inouts -21534 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -21535 3d/compare-eax-and 0/imm32 -21536 0f 85/jump-if-!= $check-mu-allocate-stmt:error-incorrect-inouts/disp32 -21537 $check-mu-allocate-stmt:check-type: -21538 # var target-type/ebx: (addr type-tree) = target->value->type -21539 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21540 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21541 89/<- %ebx 0/r32/eax -21542 # if (target->is-deref?) target-type = target-type->payload -21543 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref -21544 3d/compare-eax-and 0/imm32/false -21545 { -21546 74/jump-if-= break/disp8 -21547 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21548 # if target-type->right is null, target-type = target-type->left -21549 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -21550 { -21551 75/jump-if-!= break/disp8 -21552 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21553 } -21554 89/<- %ebx 0/r32/eax -21555 } -21556 # if target-type is not addr, abort -21557 (is-mu-addr-type? %ebx) # => eax -21558 3d/compare-eax-and 0/imm32/false -21559 0f 84/jump-if-= $check-mu-allocate-stmt:error-invalid-type/disp32 -21560 # if target-type->right is an atom, abort -21561 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21562 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -21563 0f 85/jump-if-!= $check-mu-allocate-stmt:error-invalid-type/disp32 -21564 # if target-type->right->left is not handle, abort -21565 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21566 (is-simple-mu-type? %eax 4) # handle => eax -21567 3d/compare-eax-and 0/imm32/false -21568 0f 84/jump-if-= $check-mu-allocate-stmt:error-invalid-type/disp32 -21569 $check-mu-allocate-stmt:end: -21570 # . restore registers -21571 5f/pop-to-edi -21572 5e/pop-to-esi -21573 5b/pop-to-ebx -21574 58/pop-to-eax -21575 # . epilogue -21576 89/<- %esp 5/r32/ebp -21577 5d/pop-to-ebp -21578 c3/return -21579 -21580 $check-mu-allocate-stmt:error-incorrect-inouts: -21581 (write-buffered *(ebp+0x10) "fn ") -21582 8b/-> *(ebp+0xc) 0/r32/eax -21583 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21584 (write-buffered *(ebp+0x10) %eax) -21585 (write-buffered *(ebp+0x10) ": stmt 'allocate' must have a single inout\n") -21586 (flush *(ebp+0x10)) -21587 (stop *(ebp+0x14) 1) -21588 # never gets here -21589 -21590 $check-mu-allocate-stmt:error-too-many-outputs: -21591 (write-buffered *(ebp+0x10) "fn ") -21592 8b/-> *(ebp+0xc) 0/r32/eax -21593 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21594 (write-buffered *(ebp+0x10) %eax) -21595 (write-buffered *(ebp+0x10) ": stmt 'allocate' must not have any outputs\n") -21596 (flush *(ebp+0x10)) -21597 (stop *(ebp+0x14) 1) -21598 # never gets here -21599 -21600 $check-mu-allocate-stmt:error-invalid-type: -21601 (write-buffered *(ebp+0x10) "fn ") -21602 8b/-> *(ebp+0xc) 0/r32/eax -21603 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21604 (write-buffered *(ebp+0x10) %eax) -21605 (write-buffered *(ebp+0x10) ": stmt allocate: inout '") -21606 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21607 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21608 (write-buffered *(ebp+0x10) %eax) -21609 (write-buffered *(ebp+0x10) "' must have type (addr handle ...)\n") -21610 (flush *(ebp+0x10)) -21611 (stop *(ebp+0x14) 1) -21612 # never gets here -21613 -21614 check-mu-populate-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -21615 # . prologue -21616 55/push-ebp -21617 89/<- %ebp 4/r32/esp -21618 # . save registers -21619 50/push-eax -21620 53/push-ebx -21621 56/push-esi -21622 57/push-edi -21623 # esi = stmt -21624 8b/-> *(ebp+8) 6/r32/esi -21625 $check-mu-populate-stmt:check-for-output: -21626 # if stmt->outputs abort -21627 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -21628 3d/compare-eax-and 0/imm32 -21629 0f 85/jump-if-!= $check-mu-populate-stmt:error-too-many-outputs/disp32 -21630 $check-mu-populate-stmt:get-target: -21631 # var target/edi: (addr stmt-var) = stmt->inouts -21632 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21633 89/<- %edi 0/r32/eax -21634 # zero inouts -21635 3d/compare-eax-and 0/imm32 -21636 0f 84/jump-if-= $check-mu-populate-stmt:error-incorrect-inouts/disp32 -21637 $check-mu-populate-stmt:get-length: -21638 # var length/esi: (addr stmt-var) = dest->next -21639 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -21640 89/<- %esi 0/r32/eax -21641 # 1 inout -21642 3d/compare-eax-and 0/imm32 -21643 0f 84/jump-if-= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 -21644 # > 2 inouts -21645 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -21646 3d/compare-eax-and 0/imm32 -21647 0f 85/jump-if-!= $check-mu-populate-stmt:error-incorrect-inouts/disp32 -21648 $check-mu-populate-stmt:check-target-type: -21649 # var target-type/ebx: (addr type-tree) = target->value->type -21650 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21651 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21652 89/<- %ebx 0/r32/eax -21653 $check-mu-populate-stmt:check-target-type-deref: -21654 # if (target->is-deref?) target-type = target-type->payload -21655 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref -21656 3d/compare-eax-and 0/imm32/false -21657 { -21658 74/jump-if-= break/disp8 -21659 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21660 # if target-type->right is null, target-type = target-type->left -21661 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -21662 { -21663 75/jump-if-!= break/disp8 -21664 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21665 } -21666 89/<- %ebx 0/r32/eax -21667 } -21668 $check-mu-populate-stmt:check-target-type-addr: -21669 # if target-type is not addr, abort -21670 (is-mu-addr-type? %ebx) # => eax -21671 3d/compare-eax-and 0/imm32/false -21672 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-target-type/disp32 -21673 # if target-type->right is an atom, abort -21674 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21675 89/<- %ebx 0/r32/eax -21676 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -21677 0f 85/jump-if-!= $check-mu-populate-stmt:error-invalid-target-type/disp32 -21678 $check-mu-populate-stmt:check-target-type-handle: -21679 # if target-type->right->left is not handle, abort -21680 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -21681 (is-simple-mu-type? %eax 4) # handle => eax -21682 3d/compare-eax-and 0/imm32/false -21683 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-target-type/disp32 -21684 # if target-type->right->right is an atom, abort -21685 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21686 89/<- %ebx 0/r32/eax -21687 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -21688 0f 85/jump-if-!= $check-mu-populate-stmt:error-invalid-target-type/disp32 -21689 $check-mu-populate-stmt:check-target-type-array: -21690 # if target-type->right->right->left is not array, abort -21691 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -21692 (is-simple-mu-type? %eax 3) # array => eax -21693 3d/compare-eax-and 0/imm32/false -21694 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-target-type/disp32 -21695 $check-mu-populate-stmt:check-length-type: -21696 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21697 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21698 89/<- %ebx 0/r32/eax -21699 (is-simple-mu-type? %ebx 0) # literal => eax -21700 3d/compare-eax-and 0/imm32/false -21701 75/jump-if-!= $check-mu-populate-stmt:end/disp8 -21702 (is-simple-mu-type? %ebx 1) # int => eax -21703 3d/compare-eax-and 0/imm32/false -21704 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-length-type/disp32 -21705 $check-mu-populate-stmt:end: -21706 # . restore registers -21707 5f/pop-to-edi -21708 5e/pop-to-esi -21709 5b/pop-to-ebx -21710 58/pop-to-eax -21711 # . epilogue -21712 89/<- %esp 5/r32/ebp -21713 5d/pop-to-ebp -21714 c3/return -21715 -21716 $check-mu-populate-stmt:error-incorrect-inouts: -21717 (write-buffered *(ebp+0x10) "fn ") -21718 8b/-> *(ebp+0xc) 0/r32/eax -21719 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21720 (write-buffered *(ebp+0x10) %eax) -21721 (write-buffered *(ebp+0x10) ": stmt 'populate' must have two inouts\n") -21722 (flush *(ebp+0x10)) -21723 (stop *(ebp+0x14) 1) -21724 # never gets here -21725 -21726 $check-mu-populate-stmt:error-too-many-outputs: -21727 (write-buffered *(ebp+0x10) "fn ") -21728 8b/-> *(ebp+0xc) 0/r32/eax -21729 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21730 (write-buffered *(ebp+0x10) %eax) -21731 (write-buffered *(ebp+0x10) ": stmt 'populate' must not have any outputs\n") -21732 (flush *(ebp+0x10)) -21733 (stop *(ebp+0x14) 1) -21734 # never gets here -21735 -21736 $check-mu-populate-stmt:error-invalid-target-type: -21737 (write-buffered *(ebp+0x10) "fn ") -21738 8b/-> *(ebp+0xc) 0/r32/eax -21739 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21740 (write-buffered *(ebp+0x10) %eax) -21741 (write-buffered *(ebp+0x10) ": stmt populate: first inout '") -21742 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21743 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21744 (write-buffered *(ebp+0x10) %eax) -21745 (write-buffered *(ebp+0x10) "' must have type (addr handle array ...)\n") -21746 (flush *(ebp+0x10)) -21747 (stop *(ebp+0x14) 1) -21748 # never gets here -21749 -21750 $check-mu-populate-stmt:error-invalid-length-type: -21751 (write-buffered *(ebp+0x10) "fn ") -21752 8b/-> *(ebp+0xc) 0/r32/eax -21753 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21754 (write-buffered *(ebp+0x10) %eax) -21755 (write-buffered *(ebp+0x10) ": stmt populate: second inout '") -21756 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21757 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21758 (write-buffered *(ebp+0x10) %eax) -21759 (write-buffered *(ebp+0x10) "' must be an int\n") -21760 (flush *(ebp+0x10)) -21761 (stop *(ebp+0x14) 1) -21762 # never gets here -21763 -21764 check-mu-populate-stream-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -21765 # . prologue -21766 55/push-ebp -21767 89/<- %ebp 4/r32/esp -21768 # . save registers -21769 50/push-eax -21770 53/push-ebx -21771 56/push-esi -21772 57/push-edi -21773 # esi = stmt -21774 8b/-> *(ebp+8) 6/r32/esi -21775 $check-mu-populate-stream-stmt:check-for-output: -21776 # if stmt->outputs abort -21777 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -21778 3d/compare-eax-and 0/imm32 -21779 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-too-many-outputs/disp32 -21780 $check-mu-populate-stream-stmt:get-target: -21781 # var target/edi: (addr stmt-var) = stmt->inouts -21782 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21783 89/<- %edi 0/r32/eax -21784 # zero inouts -21785 3d/compare-eax-and 0/imm32 -21786 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-incorrect-inouts/disp32 -21787 $check-mu-populate-stream-stmt:get-length: -21788 # var length/esi: (addr stmt-var) = dest->next -21789 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -21790 89/<- %esi 0/r32/eax -21791 # 1 inout -21792 3d/compare-eax-and 0/imm32 -21793 0f 84/jump-if-= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 -21794 # > 2 inouts -21795 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -21796 3d/compare-eax-and 0/imm32 -21797 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-incorrect-inouts/disp32 -21798 $check-mu-populate-stream-stmt:check-target-type: -21799 # var target-type/ebx: (addr type-tree) = target->value->type -21800 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21801 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21802 89/<- %ebx 0/r32/eax -21803 $check-mu-populate-stream-stmt:check-target-type-deref: -21804 # if (target->is-deref?) target-type = target-type->payload -21805 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref -21806 3d/compare-eax-and 0/imm32/false -21807 { -21808 74/jump-if-= break/disp8 -21809 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21810 # if target-type->right is null, target-type = target-type->left -21811 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right -21812 { -21813 75/jump-if-!= break/disp8 -21814 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21815 } -21816 89/<- %ebx 0/r32/eax -21817 } -21818 $check-mu-populate-stream-stmt:check-target-type-addr: -21819 # if target-type is not addr, abort -21820 (is-mu-addr-type? %ebx) # => eax -21821 3d/compare-eax-and 0/imm32/false -21822 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 -21823 # if target-type->right is an atom, abort -21824 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21825 89/<- %ebx 0/r32/eax -21826 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -21827 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 -21828 $check-mu-populate-stream-stmt:check-target-type-handle: -21829 # if target-type->right->left is not handle, abort -21830 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -21831 (is-simple-mu-type? %eax 4) # handle => eax -21832 3d/compare-eax-and 0/imm32/false -21833 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 -21834 # if target-type->right->right is an atom, abort -21835 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21836 89/<- %ebx 0/r32/eax -21837 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -21838 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 -21839 $check-mu-populate-stream-stmt:check-target-type-stream: -21840 # if target-type->right->right->left is not stream, abort -21841 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -21842 (is-simple-mu-type? %eax 0xb) # stream => eax -21843 3d/compare-eax-and 0/imm32/false -21844 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 -21845 $check-mu-populate-stream-stmt:check-length-type: -21846 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21847 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -21848 89/<- %ebx 0/r32/eax -21849 (is-simple-mu-type? %ebx 0) # literal => eax -21850 3d/compare-eax-and 0/imm32/false -21851 75/jump-if-!= $check-mu-populate-stream-stmt:end/disp8 -21852 (is-simple-mu-type? %ebx 1) # int => eax -21853 3d/compare-eax-and 0/imm32/false -21854 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-length-type/disp32 -21855 $check-mu-populate-stream-stmt:end: -21856 # . restore registers -21857 5f/pop-to-edi -21858 5e/pop-to-esi -21859 5b/pop-to-ebx -21860 58/pop-to-eax -21861 # . epilogue -21862 89/<- %esp 5/r32/ebp -21863 5d/pop-to-ebp -21864 c3/return -21865 -21866 $check-mu-populate-stream-stmt:error-incorrect-inouts: -21867 (write-buffered *(ebp+0x10) "fn ") -21868 8b/-> *(ebp+0xc) 0/r32/eax -21869 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21870 (write-buffered *(ebp+0x10) %eax) -21871 (write-buffered *(ebp+0x10) ": stmt 'populate-stream' must have two inouts\n") -21872 (flush *(ebp+0x10)) -21873 (stop *(ebp+0x14) 1) -21874 # never gets here -21875 -21876 $check-mu-populate-stream-stmt:error-too-many-outputs: -21877 (write-buffered *(ebp+0x10) "fn ") -21878 8b/-> *(ebp+0xc) 0/r32/eax -21879 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21880 (write-buffered *(ebp+0x10) %eax) -21881 (write-buffered *(ebp+0x10) ": stmt 'populate-stream' must not have any outputs\n") -21882 (flush *(ebp+0x10)) -21883 (stop *(ebp+0x14) 1) -21884 # never gets here -21885 -21886 $check-mu-populate-stream-stmt:error-invalid-target-type: -21887 (write-buffered *(ebp+0x10) "fn ") -21888 8b/-> *(ebp+0xc) 0/r32/eax -21889 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21890 (write-buffered *(ebp+0x10) %eax) -21891 (write-buffered *(ebp+0x10) ": stmt populate-stream: first inout '") -21892 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax -21893 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21894 (write-buffered *(ebp+0x10) %eax) -21895 (write-buffered *(ebp+0x10) "' must have type (addr handle stream ...)\n") -21896 (flush *(ebp+0x10)) -21897 (stop *(ebp+0x14) 1) -21898 # never gets here -21899 -21900 $check-mu-populate-stream-stmt:error-invalid-length-type: -21901 (write-buffered *(ebp+0x10) "fn ") -21902 8b/-> *(ebp+0xc) 0/r32/eax -21903 (lookup *eax *(eax+4)) # Function-name Function-name => eax -21904 (write-buffered *(ebp+0x10) %eax) -21905 (write-buffered *(ebp+0x10) ": stmt populate-stream: second inout '") -21906 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -21907 (lookup *eax *(eax+4)) # Var-name Var-name => eax -21908 (write-buffered *(ebp+0x10) %eax) -21909 (write-buffered *(ebp+0x10) "' must be an int\n") -21910 (flush *(ebp+0x10)) -21911 (stop *(ebp+0x14) 1) -21912 # never gets here -21913 -21914 check-mu-read-from-stream-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -21915 # . prologue -21916 55/push-ebp -21917 89/<- %ebp 4/r32/esp -21918 # . save registers -21919 50/push-eax -21920 51/push-ecx -21921 52/push-edx -21922 53/push-ebx -21923 56/push-esi -21924 57/push-edi -21925 # esi = stmt -21926 8b/-> *(ebp+8) 6/r32/esi -21927 # - check for 0 inouts -21928 # var base/ecx: (addr var) = stmt->inouts->value -21929 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21930 $check-mu-read-from-stream-stmt:check-no-inouts: -21931 3d/compare-eax-and 0/imm32 -21932 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-too-few-inouts/disp32 -21933 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -21934 89/<- %ecx 0/r32/eax -21935 # - check base type is (addr stream T) -21936 # var base-type/ebx: (addr type-tree) = lookup(base->type) -21937 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -21938 89/<- %ebx 0/r32/eax -21939 $check-mu-read-from-stream-stmt:check-base-is-compound: -21940 # if base-type is an atom, abort -21941 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -21942 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-invalid-base-type/disp32 -21943 $check-mu-read-from-stream-stmt:check-base-is-addr: -21944 # if type->left not addr, abort -21945 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -21946 (is-simple-mu-type? %eax 2) # addr => eax -21947 3d/compare-eax-and 0/imm32/false -21948 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-invalid-base-type/disp32 -21949 $check-mu-read-from-stream-stmt:check-base-is-addr-to-stream: -21950 # base-type = base-type->right -21951 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -21952 89/<- %ebx 0/r32/eax -21953 # ensure base-type->left == stream -21954 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -21955 (is-simple-mu-type? %eax 0xb) # stream => eax -21956 3d/compare-eax-and 0/imm32/false -21957 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-invalid-base-type/disp32 -21958 # - check target type is (addr T) -21959 # var target/ecx: (addr stmt-var) = stmt->inouts->next->value -21960 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21961 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -21962 $check-mu-read-from-stream-stmt:check-single-inout: -21963 3d/compare-eax-and 0/imm32 -21964 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-too-few-inouts/disp32 -21965 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -21966 89/<- %ecx 0/r32/eax -21967 # var target-type/edx: (addr type-tree) -21968 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -21969 89/<- %edx 0/r32/eax -21970 # if target-type is an atom, it must be a literal or int -21971 $check-mu-read-from-stream-stmt:check-target-is-compound: -21972 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom -21973 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-target-type-not-address/disp32 -21974 $check-mu-read-from-stream-stmt:check-target-type: -21975 # target type must start with (addr ...) -21976 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -21977 (is-simple-mu-type? %eax 2) # addr => eax -21978 3d/compare-eax-and 0/imm32/false -21979 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-target-type-not-address/disp32 -21980 # if tail(base-type) != tail(target-type) abort -21981 (type-tail %ebx) # => eax -21982 89/<- %ebx 0/r32/eax -21983 (type-tail %edx) # => eax -21984 (type-equal? %ebx %eax) # => eax -21985 3d/compare-eax-and 0/imm32/false -21986 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-invalid-target-type/disp32 -21987 $check-mu-read-from-stream-stmt:check-too-many-inouts: -21988 # - check for too many inouts -21989 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -21990 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -21991 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -21992 3d/compare-eax-and 0/imm32/false -21993 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-too-many-inouts/disp32 -21994 $check-mu-read-from-stream-stmt:check-unexpected-output: -21995 # - check for any output -21996 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -21997 3d/compare-eax-and 0/imm32/false -21998 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-unexpected-output/disp32 -21999 $check-mu-read-from-stream-stmt:end: -22000 # . restore registers -22001 5f/pop-to-edi -22002 5e/pop-to-esi -22003 5b/pop-to-ebx -22004 5a/pop-to-edx -22005 59/pop-to-ecx -22006 58/pop-to-eax -22007 # . epilogue -22008 89/<- %esp 5/r32/ebp -22009 5d/pop-to-ebp -22010 c3/return -22011 -22012 $check-mu-read-from-stream-stmt:error-invalid-base-type: -22013 (write-buffered *(ebp+0x10) "fn ") -22014 8b/-> *(ebp+0xc) 0/r32/eax -22015 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22016 (write-buffered *(ebp+0x10) %eax) -22017 (write-buffered *(ebp+0x10) ": stmt read-from-stream: var '") -22018 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22019 (write-buffered *(ebp+0x10) %eax) -22020 (write-buffered *(ebp+0x10) "' must be an addr to a stream\n") -22021 (flush *(ebp+0x10)) -22022 (stop *(ebp+0x14) 1) -22023 # never gets here -22024 -22025 $check-mu-read-from-stream-stmt:error-too-few-inouts: -22026 (write-buffered *(ebp+0x10) "fn ") -22027 8b/-> *(ebp+0xc) 0/r32/eax -22028 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22029 (write-buffered *(ebp+0x10) %eax) -22030 (write-buffered *(ebp+0x10) ": stmt read-from-stream: too few inouts (2 required)\n") -22031 (flush *(ebp+0x10)) -22032 (stop *(ebp+0x14) 1) -22033 # never gets here -22034 -22035 $check-mu-read-from-stream-stmt:error-target-type-not-address: -22036 (write-buffered *(ebp+0x10) "fn ") -22037 8b/-> *(ebp+0xc) 0/r32/eax -22038 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22039 (write-buffered *(ebp+0x10) %eax) -22040 (write-buffered *(ebp+0x10) ": stmt read-from-stream: target '") -22041 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22042 (write-buffered *(ebp+0x10) %eax) -22043 (write-buffered *(ebp+0x10) "' must be an addr\n") -22044 (flush *(ebp+0x10)) -22045 (stop *(ebp+0x14) 1) -22046 # never gets here -22047 -22048 $check-mu-read-from-stream-stmt:error-invalid-target-type: -22049 (write-buffered *(ebp+0x10) "fn ") -22050 8b/-> *(ebp+0xc) 0/r32/eax -22051 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22052 (write-buffered *(ebp+0x10) %eax) -22053 (write-buffered *(ebp+0x10) ": stmt read-from-stream: second inout '") -22054 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22055 (write-buffered *(ebp+0x10) %eax) -22056 (write-buffered *(ebp+0x10) "' does not have the right type\n") -22057 (flush *(ebp+0x10)) -22058 (stop *(ebp+0x14) 1) -22059 # never gets here -22060 -22061 $check-mu-read-from-stream-stmt:error-too-many-inouts: -22062 (write-buffered *(ebp+0x10) "fn ") -22063 8b/-> *(ebp+0xc) 0/r32/eax -22064 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22065 (write-buffered *(ebp+0x10) %eax) -22066 (write-buffered *(ebp+0x10) ": stmt read-from-stream: too many inouts (2 required)\n") -22067 (flush *(ebp+0x10)) -22068 (stop *(ebp+0x14) 1) -22069 # never gets here -22070 -22071 $check-mu-read-from-stream-stmt:error-unexpected-output: -22072 (write-buffered *(ebp+0x10) "fn ") -22073 8b/-> *(ebp+0xc) 0/r32/eax -22074 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22075 (write-buffered *(ebp+0x10) %eax) -22076 (write-buffered *(ebp+0x10) ": stmt read-from-stream: unexpected output\n") -22077 (flush *(ebp+0x10)) -22078 (stop *(ebp+0x14) 1) -22079 # never gets here -22080 -22081 check-mu-write-to-stream-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -22082 # . prologue -22083 55/push-ebp -22084 89/<- %ebp 4/r32/esp -22085 # . save registers -22086 50/push-eax -22087 51/push-ecx -22088 52/push-edx -22089 53/push-ebx -22090 56/push-esi -22091 57/push-edi -22092 # esi = stmt -22093 8b/-> *(ebp+8) 6/r32/esi -22094 # - check for 0 inouts -22095 # var base/ecx: (addr var) = stmt->inouts->value -22096 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22097 $check-mu-write-to-stream-stmt:check-no-inouts: -22098 3d/compare-eax-and 0/imm32 -22099 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-too-few-inouts/disp32 -22100 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -22101 89/<- %ecx 0/r32/eax -22102 # - check base type is (addr stream T) -22103 # var base-type/ebx: (addr type-tree) = lookup(base->type) -22104 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -22105 89/<- %ebx 0/r32/eax -22106 $check-mu-write-to-stream-stmt:check-base-is-compound: -22107 # if base-type is an atom, abort -22108 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom -22109 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-invalid-base-type/disp32 -22110 $check-mu-write-to-stream-stmt:check-base-is-addr: -22111 # if type->left not addr, abort -22112 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -22113 (is-simple-mu-type? %eax 2) # addr => eax -22114 3d/compare-eax-and 0/imm32/false -22115 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-invalid-base-type/disp32 -22116 $check-mu-write-to-stream-stmt:check-base-is-addr-to-stream: -22117 # base-type = base-type->right -22118 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -22119 89/<- %ebx 0/r32/eax -22120 # ensure base-type->left == stream -22121 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -22122 (is-simple-mu-type? %eax 0xb) # stream => eax -22123 3d/compare-eax-and 0/imm32/false -22124 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-invalid-base-type/disp32 -22125 # - check target type is (addr T) -22126 # var target/ecx: (addr stmt-var) = stmt->inouts->next->value -22127 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22128 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -22129 $check-mu-write-to-stream-stmt:check-single-inout: -22130 3d/compare-eax-and 0/imm32 -22131 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-too-few-inouts/disp32 -22132 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -22133 89/<- %ecx 0/r32/eax -22134 # var target-type/edx: (addr type-tree) -22135 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -22136 89/<- %edx 0/r32/eax -22137 # if target-type is an atom, it must be a literal or int -22138 $check-mu-write-to-stream-stmt:check-target-is-compound: -22139 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom -22140 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-target-type-not-address/disp32 -22141 $check-mu-write-to-stream-stmt:check-target-type: -22142 # target type must start with (addr ...) -22143 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -22144 (is-simple-mu-type? %eax 2) # addr => eax -22145 3d/compare-eax-and 0/imm32/false -22146 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-target-type-not-address/disp32 -22147 # if tail(base-type) != tail(target-type) abort -22148 (type-tail %ebx) # => eax -22149 89/<- %ebx 0/r32/eax -22150 (type-tail %edx) # => eax -22151 (type-equal? %ebx %eax) # => eax -22152 3d/compare-eax-and 0/imm32/false -22153 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-invalid-target-type/disp32 -22154 $check-mu-write-to-stream-stmt:check-too-many-inouts: -22155 # - check for too many inouts -22156 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22157 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -22158 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -22159 3d/compare-eax-and 0/imm32/false -22160 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-too-many-inouts/disp32 -22161 $check-mu-write-to-stream-stmt:check-unexpected-output: -22162 # - check for any output -22163 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -22164 3d/compare-eax-and 0/imm32/false -22165 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-unexpected-output/disp32 -22166 $check-mu-write-to-stream-stmt:end: -22167 # . restore registers -22168 5f/pop-to-edi -22169 5e/pop-to-esi -22170 5b/pop-to-ebx -22171 5a/pop-to-edx -22172 59/pop-to-ecx -22173 58/pop-to-eax -22174 # . epilogue -22175 89/<- %esp 5/r32/ebp -22176 5d/pop-to-ebp -22177 c3/return -22178 -22179 $check-mu-write-to-stream-stmt:error-invalid-base-type: -22180 (write-buffered *(ebp+0x10) "fn ") -22181 8b/-> *(ebp+0xc) 0/r32/eax -22182 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22183 (write-buffered *(ebp+0x10) %eax) -22184 (write-buffered *(ebp+0x10) ": stmt write-to-stream: var '") -22185 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22186 (write-buffered *(ebp+0x10) %eax) -22187 (write-buffered *(ebp+0x10) "' must be an addr to a stream\n") -22188 (flush *(ebp+0x10)) -22189 (stop *(ebp+0x14) 1) -22190 # never gets here -22191 -22192 $check-mu-write-to-stream-stmt:error-too-few-inouts: -22193 (write-buffered *(ebp+0x10) "fn ") -22194 8b/-> *(ebp+0xc) 0/r32/eax -22195 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22196 (write-buffered *(ebp+0x10) %eax) -22197 (write-buffered *(ebp+0x10) ": stmt write-to-stream: too few inouts (2 required)\n") -22198 (flush *(ebp+0x10)) -22199 (stop *(ebp+0x14) 1) -22200 # never gets here -22201 -22202 $check-mu-write-to-stream-stmt:error-target-type-not-address: -22203 (write-buffered *(ebp+0x10) "fn ") -22204 8b/-> *(ebp+0xc) 0/r32/eax -22205 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22206 (write-buffered *(ebp+0x10) %eax) -22207 (write-buffered *(ebp+0x10) ": stmt write-to-stream: target '") -22208 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22209 (write-buffered *(ebp+0x10) %eax) -22210 (write-buffered *(ebp+0x10) "' must be an addr\n") -22211 (flush *(ebp+0x10)) -22212 (stop *(ebp+0x14) 1) -22213 # never gets here -22214 -22215 $check-mu-write-to-stream-stmt:error-invalid-target-type: -22216 (write-buffered *(ebp+0x10) "fn ") -22217 8b/-> *(ebp+0xc) 0/r32/eax -22218 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22219 (write-buffered *(ebp+0x10) %eax) -22220 (write-buffered *(ebp+0x10) ": stmt write-to-stream: second inout '") -22221 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -22222 (write-buffered *(ebp+0x10) %eax) -22223 (write-buffered *(ebp+0x10) "' does not have the right type\n") -22224 (flush *(ebp+0x10)) -22225 (stop *(ebp+0x14) 1) -22226 # never gets here -22227 -22228 $check-mu-write-to-stream-stmt:error-too-many-inouts: -22229 (write-buffered *(ebp+0x10) "fn ") -22230 8b/-> *(ebp+0xc) 0/r32/eax -22231 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22232 (write-buffered *(ebp+0x10) %eax) -22233 (write-buffered *(ebp+0x10) ": stmt write-to-stream: too many inouts (2 required)\n") -22234 (flush *(ebp+0x10)) -22235 (stop *(ebp+0x14) 1) -22236 # never gets here -22237 -22238 $check-mu-write-to-stream-stmt:error-unexpected-output: -22239 (write-buffered *(ebp+0x10) "fn ") -22240 8b/-> *(ebp+0xc) 0/r32/eax -22241 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22242 (write-buffered *(ebp+0x10) %eax) -22243 (write-buffered *(ebp+0x10) ": stmt write-to-stream: unexpected output\n") -22244 (flush *(ebp+0x10)) -22245 (stop *(ebp+0x14) 1) -22246 # never gets here -22247 -22248 check-mu-convert-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -22249 # . prologue -22250 55/push-ebp -22251 89/<- %ebp 4/r32/esp -22252 # . save registers -22253 $check-mu-convert-stmt:end: -22254 # . restore registers -22255 # . epilogue -22256 89/<- %esp 5/r32/ebp -22257 5d/pop-to-ebp -22258 c3/return -22259 -22260 check-mu-call: # stmt: (addr stmt), callee: (addr function), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -22261 # . prologue -22262 55/push-ebp -22263 89/<- %ebp 4/r32/esp -22264 # var type-parameters: (addr table (handle array byte) (addr type-tree) 8) -22265 68/push 0/imm32 -22266 # var type-parameters-storage: (table (handle array byte) (addr type-tree) 8) -22267 81 5/subop/subtract %esp 0x60/imm32 -22268 68/push 0x60/imm32/size -22269 68/push 0/imm32/read -22270 68/push 0/imm32/write -22271 # save a pointer to type-parameters-storage at type-parameters -22272 89/<- *(ebp-4) 4/r32/esp -22273 (clear-stream *(ebp-4)) -22274 # . save registers -22275 50/push-eax -22276 51/push-ecx -22277 52/push-edx -22278 53/push-ebx -22279 56/push-esi -22280 57/push-edi -22281 # esi = stmt -22282 8b/-> *(ebp+8) 6/r32/esi -22283 # edi = callee -22284 8b/-> *(ebp+0xc) 7/r32/edi -22285 # var inouts/ecx: (addr stmt-var) = lookup(stmt->inouts) -22286 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -22287 89/<- %ecx 0/r32/eax -22288 # var expected/edx: (addr list var) = lookup(f->inouts) -22289 (lookup *(edi+8) *(edi+0xc)) # Function-inouts Function-inouts => eax -22290 89/<- %edx 0/r32/eax -22291 { -22292 $check-mu-call:check-for-inouts: -22293 # if (inouts == 0) break -22294 81 7/subop/compare %ecx 0/imm32 -22295 0f 84/jump-if-= break/disp32 -22296 # if (expected == 0) error -22297 81 7/subop/compare %edx 0/imm32 -22298 0f 84/jump-if-= break/disp32 -22299 $check-mu-call:check-inout-type: -22300 # var v/eax: (addr v) = lookup(inouts->value) -22301 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -22302 # var t/ebx: (addr type-tree) = lookup(v->type) -22303 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -22304 89/<- %ebx 0/r32/eax -22305 # if (inouts->is-deref?) t = t->right # TODO: check that t->left is an addr -22306 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -22307 { -22308 74/jump-if-= break/disp8 -22309 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -22310 89/<- %ebx 0/r32/eax -22311 # if t->right is null, t = t->left -22312 81 7/subop/compare *(ebx+0xc) 0/imm32 # Type-tree-right -22313 75/jump-if-!= break/disp8 -22314 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax -22315 89/<- %ebx 0/r32/eax -22316 } -22317 # var v2/eax: (addr v) = lookup(expected->value) -22318 (lookup *edx *(edx+4)) # List-value List-value => eax -22319 # var t2/eax: (addr type-tree) = lookup(v2->type) -22320 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -22321 # if (t != t2) error -22322 (type-match? %eax %ebx *(ebp-4)) # => eax -22323 3d/compare-eax-and 0/imm32/false -22324 { -22325 0f 85/jump-if-!= break/disp32 -22326 (write-buffered *(ebp+0x14) "fn ") -22327 8b/-> *(ebp+0x10) 0/r32/eax -22328 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22329 (write-buffered *(ebp+0x14) %eax) -22330 (write-buffered *(ebp+0x14) ": call ") -22331 (lookup *edi *(edi+4)) # Function-name Function-name => eax -22332 (write-buffered *(ebp+0x14) %eax) -22333 (write-buffered *(ebp+0x14) ": type for inout '") -22334 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -22335 (lookup *eax *(eax+4)) # Var-name Var-name => eax -22336 (write-buffered *(ebp+0x14) %eax) -22337 (write-buffered *(ebp+0x14) "' is not right\n") -22338 (flush *(ebp+0x14)) -22339 (stop *(ebp+0x18) 1) -22340 } -22341 $check-mu-call:continue-to-next-inout: -22342 # inouts = lookup(inouts->next) -22343 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax -22344 89/<- %ecx 0/r32/eax -22345 # expected = lookup(expected->next) -22346 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax -22347 89/<- %edx 0/r32/eax -22348 # -22349 e9/jump loop/disp32 -22350 } -22351 $check-mu-call:check-inout-count: -22352 # if (inouts == expected) proceed -22353 39/compare %ecx 2/r32/edx -22354 { -22355 0f 84/jump-if-= break/disp32 -22356 # exactly one of the two is null -22357 # if (inouts == 0) error("too many inouts") -22358 { -22359 81 7/subop/compare %ecx 0/imm32 -22360 0f 84/jump-if-= break/disp32 -22361 (write-buffered *(ebp+0x14) "fn ") -22362 8b/-> *(ebp+0x10) 0/r32/eax -22363 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22364 (write-buffered *(ebp+0x14) %eax) -22365 (write-buffered *(ebp+0x14) ": call ") -22366 (lookup *edi *(edi+4)) # Function-name Function-name => eax -22367 (write-buffered *(ebp+0x14) %eax) -22368 (write-buffered *(ebp+0x14) ": too many inouts\n") -22369 (flush *(ebp+0x14)) -22370 (stop *(ebp+0x18) 1) -22371 } -22372 # if (expected == 0) error("too few inouts") -22373 { -22374 81 7/subop/compare %edx 0/imm32 -22375 0f 84/jump-if-= break/disp32 -22376 (write-buffered *(ebp+0x14) "fn ") -22377 8b/-> *(ebp+0x10) 0/r32/eax -22378 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22379 (write-buffered *(ebp+0x14) %eax) -22380 (write-buffered *(ebp+0x14) ": call ") -22381 (lookup *edi *(edi+4)) # Function-name Function-name => eax -22382 (write-buffered *(ebp+0x14) %eax) -22383 (write-buffered *(ebp+0x14) ": too few inouts\n") -22384 (flush *(ebp+0x14)) -22385 (stop *(ebp+0x18) 1) -22386 } -22387 } -22388 $check-mu-call:check-outputs: -22389 # var outputs/ecx: (addr stmt-var) = lookup(stmt->outputs) -22390 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -22391 89/<- %ecx 0/r32/eax -22392 # var expected/edx: (addr list var) = lookup(f->outputs) -22393 (lookup *(edi+0x10) *(edi+0x14)) # Function-outputs Function-outputs => eax -22394 89/<- %edx 0/r32/eax -22395 { -22396 $check-mu-call:check-for-outputs: -22397 # if (outputs == 0) break -22398 81 7/subop/compare %ecx 0/imm32 -22399 0f 84/jump-if-= break/disp32 -22400 # if (expected == 0) error -22401 81 7/subop/compare %edx 0/imm32 -22402 0f 84/jump-if-= break/disp32 -22403 $check-mu-call:check-output-type: -22404 # var v/eax: (addr v) = lookup(outputs->value) -22405 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -22406 # var t/ebx: (addr type-tree) = lookup(v->type) -22407 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -22408 89/<- %ebx 0/r32/eax -22409 # if (outputs->is-deref?) t = t->right # TODO: check that t->left is an addr -22410 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -22411 { -22412 74/jump-if-= break/disp8 -22413 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -22414 89/<- %ebx 0/r32/eax -22415 } -22416 # var v2/eax: (addr v) = lookup(expected->value) -22417 (lookup *edx *(edx+4)) # List-value List-value => eax -22418 # var t2/eax: (addr type-tree) = lookup(v2->type) -22419 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -22420 # if (t != t2) error -22421 (type-match? %eax %ebx *(ebp-4)) # => eax -22422 3d/compare-eax-and 0/imm32/false -22423 { -22424 0f 85/jump-if-!= break/disp32 -22425 (write-buffered *(ebp+0x14) "fn ") -22426 8b/-> *(ebp+0x10) 0/r32/eax -22427 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22428 (write-buffered *(ebp+0x14) %eax) -22429 (write-buffered *(ebp+0x14) ": call ") -22430 (lookup *edi *(edi+4)) # Function-name Function-name => eax -22431 (write-buffered *(ebp+0x14) %eax) -22432 (write-buffered *(ebp+0x14) ": type for output '") -22433 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -22434 (lookup *eax *(eax+4)) # Var-name Var-name => eax -22435 (write-buffered *(ebp+0x14) %eax) -22436 (write-buffered *(ebp+0x14) "' is not right\n") -22437 (flush *(ebp+0x14)) -22438 (stop *(ebp+0x18) 1) -22439 } -22440 $check-mu-call:check-output-register: -22441 # var v/eax: (addr v) = lookup(outputs->value) -22442 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -22443 # var r/ebx: (addr array byte) = lookup(v->register) -22444 (lookup *(eax+18) *(eax+0x1c)) # Var-register Var-register => eax -22445 89/<- %ebx 0/r32/eax -22446 # if (r == 0) error -22447 3d/compare-eax-and 0/imm32 -22448 { -22449 0f 85/jump-if-!= break/disp32 -22450 (write-buffered *(ebp+0x14) "fn ") -22451 8b/-> *(ebp+0x10) 0/r32/eax -22452 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22453 (write-buffered *(ebp+0x14) %eax) -22454 (write-buffered *(ebp+0x14) ": call ") -22455 (lookup *edi *(edi+4)) # Function-name Function-name => eax -22456 (write-buffered *(ebp+0x14) %eax) -22457 (write-buffered *(ebp+0x14) ": output '") -22458 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -22459 (lookup *eax *(eax+4)) # Var-name Var-name => eax -22460 (write-buffered *(ebp+0x14) %eax) -22461 (write-buffered *(ebp+0x14) "' is not in a register\n") -22462 (flush *(ebp+0x14)) -22463 (stop *(ebp+0x18) 1) -22464 } -22465 # var v2/eax: (addr v) = lookup(expected->value) -22466 (lookup *edx *(edx+4)) # Stmt-var-value Stmt-var-value => eax -22467 # var r2/eax: (addr array byte) = lookup(v2->register) -22468 (lookup *(eax+18) *(eax+0x1c)) # Var-register Var-register => eax -22469 # if (r != r2) error -22470 (string-equal? %eax %ebx) # => eax -22471 3d/compare-eax-and 0/imm32/false -22472 { -22473 0f 85/jump-if-!= break/disp32 -22474 (write-buffered *(ebp+0x14) "fn ") -22475 8b/-> *(ebp+0x10) 0/r32/eax -22476 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22477 (write-buffered *(ebp+0x14) %eax) -22478 (write-buffered *(ebp+0x14) ": call ") -22479 (lookup *edi *(edi+4)) # Function-name Function-name => eax -22480 (write-buffered *(ebp+0x14) %eax) -22481 (write-buffered *(ebp+0x14) ": register for output '") -22482 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -22483 (lookup *eax *(eax+4)) # Var-name Var-name => eax -22484 (write-buffered *(ebp+0x14) %eax) -22485 (write-buffered *(ebp+0x14) "' is not right\n") -22486 (flush *(ebp+0x14)) -22487 (stop *(ebp+0x18) 1) -22488 } -22489 $check-mu-call:continue-to-next-output: -22490 # outputs = lookup(outputs->next) -22491 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax -22492 89/<- %ecx 0/r32/eax -22493 # expected = lookup(expected->next) -22494 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax -22495 89/<- %edx 0/r32/eax -22496 # -22497 e9/jump loop/disp32 -22498 } -22499 $check-mu-call:check-output-count: -22500 # if (outputs == expected) proceed -22501 39/compare %ecx 2/r32/edx -22502 { -22503 0f 84/jump-if-= break/disp32 -22504 # exactly one of the two is null -22505 # if (outputs == 0) error("too many outputs") -22506 { -22507 81 7/subop/compare %ecx 0/imm32 -22508 0f 84/jump-if-= break/disp32 -22509 (write-buffered *(ebp+0x14) "fn ") -22510 8b/-> *(ebp+0x10) 0/r32/eax -22511 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22512 (write-buffered *(ebp+0x14) %eax) -22513 (write-buffered *(ebp+0x14) ": call ") -22514 (lookup *edi *(edi+4)) # Function-name Function-name => eax -22515 (write-buffered *(ebp+0x14) %eax) -22516 (write-buffered *(ebp+0x14) ": too many outputs\n") -22517 (flush *(ebp+0x14)) -22518 (stop *(ebp+0x18) 1) -22519 } -22520 # if (expected == 0) error("too few outputs") -22521 { -22522 81 7/subop/compare %edx 0/imm32 -22523 0f 84/jump-if-= break/disp32 -22524 (write-buffered *(ebp+0x14) "fn ") -22525 8b/-> *(ebp+0x10) 0/r32/eax -22526 (lookup *eax *(eax+4)) # Function-name Function-name => eax -22527 (write-buffered *(ebp+0x14) %eax) -22528 (write-buffered *(ebp+0x14) ": call ") -22529 (lookup *edi *(edi+4)) # Function-name Function-name => eax -22530 (write-buffered *(ebp+0x14) %eax) -22531 (write-buffered *(ebp+0x14) ": too few outputs\n") -22532 (flush *(ebp+0x14)) -22533 (stop *(ebp+0x18) 1) -22534 } -22535 } -22536 $check-mu-call:end: -22537 # . restore registers -22538 5f/pop-to-edi -22539 5e/pop-to-esi -22540 5b/pop-to-ebx -22541 5a/pop-to-edx -22542 59/pop-to-ecx -22543 58/pop-to-eax -22544 # . reclaim locals exclusively on the stack -22545 81 0/subop/add %esp 0x70/imm32 -22546 # . epilogue -22547 89/<- %esp 5/r32/ebp -22548 5d/pop-to-ebp -22549 c3/return +21383 (write-buffered *(ebp+0x10) ": stmt index: second argument '") +21384 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21385 (write-buffered *(ebp+0x10) %eax) +21386 (write-buffered *(ebp+0x10) "' must be in a register\n") +21387 (flush *(ebp+0x10)) +21388 (stop *(ebp+0x14) 1) +21389 # never gets here +21390 +21391 $check-mu-index-stmt:error-index-needs-offset: +21392 (write-buffered *(ebp+0x10) "fn ") +21393 8b/-> *(ebp+0xc) 0/r32/eax +21394 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21395 (write-buffered *(ebp+0x10) %eax) +21396 (write-buffered *(ebp+0x10) ": stmt index: cannot take an int for array '") +21397 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +21398 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21399 (lookup *eax *(eax+4)) # Var-name Var-name => eax +21400 (write-buffered *(ebp+0x10) %eax) +21401 (write-buffered *(ebp+0x10) "'; create an offset instead. See mu.md for details.\n") +21402 (flush *(ebp+0x10)) +21403 (stop *(ebp+0x14) 1) +21404 # never gets here +21405 +21406 $check-mu-index-stmt:error-too-many-inouts: +21407 (write-buffered *(ebp+0x10) "fn ") +21408 8b/-> *(ebp+0xc) 0/r32/eax +21409 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21410 (write-buffered *(ebp+0x10) %eax) +21411 (write-buffered *(ebp+0x10) ": stmt index: too many inouts (2 required)\n") +21412 (flush *(ebp+0x10)) +21413 (stop *(ebp+0x14) 1) +21414 # never gets here +21415 +21416 $check-mu-index-stmt:error-too-few-outputs: +21417 (write-buffered *(ebp+0x10) "fn ") +21418 8b/-> *(ebp+0xc) 0/r32/eax +21419 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21420 (write-buffered *(ebp+0x10) %eax) +21421 (write-buffered *(ebp+0x10) ": stmt index: must have an output\n") +21422 (flush *(ebp+0x10)) +21423 (stop *(ebp+0x14) 1) +21424 # never gets here +21425 +21426 $check-mu-index-stmt:error-too-many-outputs: +21427 (write-buffered *(ebp+0x10) "fn ") +21428 8b/-> *(ebp+0xc) 0/r32/eax +21429 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21430 (write-buffered *(ebp+0x10) %eax) +21431 (write-buffered *(ebp+0x10) ": stmt index: too many outputs (1 required)\n") +21432 (flush *(ebp+0x10)) +21433 (stop *(ebp+0x14) 1) +21434 # never gets here +21435 +21436 $check-mu-index-stmt:error-output-not-in-register: +21437 (write-buffered *(ebp+0x10) "fn ") +21438 8b/-> *(ebp+0xc) 0/r32/eax +21439 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21440 (write-buffered *(ebp+0x10) %eax) +21441 (write-buffered *(ebp+0x10) ": stmt index: output '") +21442 (lookup *edi *(edi+4)) # Var-name Var-name => eax +21443 (write-buffered *(ebp+0x10) %eax) +21444 (write-buffered *(ebp+0x10) "' is not in a register\n") +21445 (flush *(ebp+0x10)) +21446 (stop *(ebp+0x14) 1) +21447 # never gets here +21448 +21449 $check-mu-index-stmt:error-output-type-not-address: +21450 (write-buffered *(ebp+0x10) "fn ") +21451 8b/-> *(ebp+0xc) 0/r32/eax +21452 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21453 (write-buffered *(ebp+0x10) %eax) +21454 (write-buffered *(ebp+0x10) ": stmt index: output '") +21455 (lookup *edi *(edi+4)) # Var-name Var-name => eax +21456 (write-buffered *(ebp+0x10) %eax) +21457 (write-buffered *(ebp+0x10) "' must be an addr\n") +21458 (flush *(ebp+0x10)) +21459 (stop *(ebp+0x14) 1) +21460 # never gets here +21461 +21462 $check-mu-index-stmt:error-bad-output-type: +21463 (write-buffered *(ebp+0x10) "fn ") +21464 8b/-> *(ebp+0xc) 0/r32/eax +21465 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21466 (write-buffered *(ebp+0x10) %eax) +21467 (write-buffered *(ebp+0x10) ": stmt index: output '") +21468 (lookup *edi *(edi+4)) # Var-name Var-name => eax +21469 (write-buffered *(ebp+0x10) %eax) +21470 (write-buffered *(ebp+0x10) "' does not have the right type\n") +21471 (flush *(ebp+0x10)) +21472 (stop *(ebp+0x14) 1) +21473 # never gets here +21474 +21475 check-mu-length-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +21476 # . prologue +21477 55/push-ebp +21478 89/<- %ebp 4/r32/esp +21479 # . save registers +21480 50/push-eax +21481 51/push-ecx +21482 52/push-edx +21483 53/push-ebx +21484 56/push-esi +21485 57/push-edi +21486 # esi = stmt +21487 8b/-> *(ebp+8) 6/r32/esi +21488 # - check for 0 inouts +21489 # var base/ecx: (addr var) = stmt->inouts->value +21490 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +21491 $check-mu-length-stmt:check-no-inouts: +21492 3d/compare-eax-and 0/imm32 +21493 0f 84/jump-if-= $check-mu-length-stmt:error-too-few-inouts/disp32 +21494 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21495 89/<- %ecx 0/r32/eax +21496 # - check base type is either (addr array ...) in register or (array ...) on stack +21497 # var base-type/ebx: (addr type-tree) = lookup(base->type) +21498 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +21499 89/<- %ebx 0/r32/eax +21500 # if base-type is an atom, abort with a precise error +21501 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +21502 { +21503 74/jump-if-= break/disp8 +21504 (is-simple-mu-type? %ebx 3) # array => eax +21505 3d/compare-eax-and 0/imm32/false +21506 0f 85/jump-if-!= $check-mu-length-stmt:error-base-array-atom-type/disp32 +21507 0f 84/jump-if-= $check-mu-length-stmt:error-base-non-array-type/disp32 +21508 } +21509 $check-mu-length-stmt:base-is-compound: +21510 # if type->left not addr or array, abort +21511 { +21512 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +21513 (is-simple-mu-type? %eax 2) # addr => eax +21514 3d/compare-eax-and 0/imm32/false +21515 75/jump-if-!= break/disp8 +21516 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +21517 (is-simple-mu-type? %eax 3) # array => eax +21518 3d/compare-eax-and 0/imm32/false +21519 75/jump-if-!= break/disp8 +21520 e9/jump $check-mu-length-stmt:error-base-non-array-type/disp32 +21521 } +21522 # if (type->left == addr) ensure type->right->left == array and type->register exists +21523 { +21524 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +21525 (is-simple-mu-type? %eax 2) # addr => eax +21526 3d/compare-eax-and 0/imm32/false +21527 74/jump-if-= break/disp8 +21528 $check-mu-length-stmt:base-is-addr: +21529 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +21530 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +21531 (is-simple-mu-type? %eax 3) # array => eax +21532 3d/compare-eax-and 0/imm32/false +21533 0f 84/jump-if-= $check-mu-length-stmt:error-base-non-array-type/disp32 +21534 $check-mu-length-stmt:check-base-addr-is-register: +21535 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +21536 0f 84/jump-if-= $check-mu-length-stmt:error-base-address-array-type-on-stack/disp32 +21537 } +21538 # if (type->left == array) ensure type->register doesn't exist +21539 { +21540 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +21541 (is-simple-mu-type? %eax 3) # array => eax +21542 3d/compare-eax-and 0/imm32/false +21543 74/jump-if-= break/disp8 +21544 $check-mu-length-stmt:base-is-array: +21545 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +21546 0f 85/jump-if-!= $check-mu-length-stmt:error-base-array-type-in-register/disp32 +21547 } +21548 # if (base-type->left == addr) base-type = base-type->right +21549 { +21550 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +21551 (is-simple-mu-type? %eax 2) # addr => eax +21552 3d/compare-eax-and 0/imm32/false +21553 74/jump-if-= break/disp8 +21554 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +21555 89/<- %ebx 0/r32/eax +21556 } +21557 # - check for too many inouts +21558 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +21559 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +21560 3d/compare-eax-and 0/imm32/false +21561 0f 85/jump-if-!= $check-mu-length-stmt:error-too-many-inouts/disp32 +21562 # - check for 0 outputs +21563 # var output/edi: (addr var) = stmt->outputs->value +21564 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +21565 3d/compare-eax-and 0/imm32/false +21566 0f 84/jump-if-= $check-mu-length-stmt:error-too-few-outputs/disp32 +21567 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21568 89/<- %edi 0/r32/eax +21569 # - check output type +21570 # must have a non-atomic type +21571 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +21572 (is-simple-mu-type? %eax 1) # int => eax +21573 3d/compare-eax-and 0/imm32/false +21574 0f 84/jump-if-= $check-mu-length-stmt:error-invalid-output-type/disp32 +21575 # - check for too many outputs +21576 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +21577 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +21578 3d/compare-eax-and 0/imm32/false +21579 0f 85/jump-if-!= $check-mu-length-stmt:error-too-many-outputs/disp32 +21580 $check-mu-length-stmt:end: +21581 # . restore registers +21582 5f/pop-to-edi +21583 5e/pop-to-esi +21584 5b/pop-to-ebx +21585 5a/pop-to-edx +21586 59/pop-to-ecx +21587 58/pop-to-eax +21588 # . epilogue +21589 89/<- %esp 5/r32/ebp +21590 5d/pop-to-ebp +21591 c3/return +21592 +21593 $check-mu-length-stmt:error-base-non-array-type: +21594 (write-buffered *(ebp+0x10) "fn ") +21595 8b/-> *(ebp+0xc) 0/r32/eax +21596 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21597 (write-buffered *(ebp+0x10) %eax) +21598 (write-buffered *(ebp+0x10) ": stmt length: var '") +21599 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21600 (write-buffered *(ebp+0x10) %eax) +21601 (write-buffered *(ebp+0x10) "' is not an array\n") +21602 (flush *(ebp+0x10)) +21603 (stop *(ebp+0x14) 1) +21604 # never gets here +21605 +21606 $check-mu-length-stmt:error-base-array-atom-type: +21607 (write-buffered *(ebp+0x10) "fn ") +21608 8b/-> *(ebp+0xc) 0/r32/eax +21609 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21610 (write-buffered *(ebp+0x10) %eax) +21611 (write-buffered *(ebp+0x10) ": stmt length: array '") +21612 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21613 (write-buffered *(ebp+0x10) %eax) +21614 (write-buffered *(ebp+0x10) "' must specify the type of its elements\n") +21615 (flush *(ebp+0x10)) +21616 (stop *(ebp+0x14) 1) +21617 # never gets here +21618 +21619 $check-mu-length-stmt:error-base-address-array-type-on-stack: +21620 (write-buffered *(ebp+0x10) "fn ") +21621 8b/-> *(ebp+0xc) 0/r32/eax +21622 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21623 (write-buffered *(ebp+0x10) %eax) +21624 (write-buffered *(ebp+0x10) ": stmt length: var '") +21625 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21626 (write-buffered *(ebp+0x10) %eax) +21627 (write-buffered *(ebp+0x10) "' is an addr to an array, and so must live in a register\n") +21628 (flush *(ebp+0x10)) +21629 (stop *(ebp+0x14) 1) +21630 # never gets here +21631 +21632 $check-mu-length-stmt:error-base-array-type-in-register: +21633 (write-buffered *(ebp+0x10) "fn ") +21634 8b/-> *(ebp+0xc) 0/r32/eax +21635 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21636 (write-buffered *(ebp+0x10) %eax) +21637 (write-buffered *(ebp+0x10) ": stmt length: var '") +21638 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21639 (write-buffered *(ebp+0x10) %eax) +21640 (write-buffered *(ebp+0x10) "' is an array, and so must live on the stack\n") +21641 (flush *(ebp+0x10)) +21642 (stop *(ebp+0x14) 1) +21643 # never gets here +21644 +21645 $check-mu-length-stmt:error-too-few-inouts: +21646 (write-buffered *(ebp+0x10) "fn ") +21647 8b/-> *(ebp+0xc) 0/r32/eax +21648 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21649 (write-buffered *(ebp+0x10) %eax) +21650 (write-buffered *(ebp+0x10) ": stmt length: too few inouts (1 required)\n") +21651 (flush *(ebp+0x10)) +21652 (stop *(ebp+0x14) 1) +21653 # never gets here +21654 +21655 $check-mu-length-stmt:error-invalid-index-type: +21656 (write-buffered *(ebp+0x10) "fn ") +21657 8b/-> *(ebp+0xc) 0/r32/eax +21658 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21659 (write-buffered *(ebp+0x10) %eax) +21660 (write-buffered *(ebp+0x10) ": stmt length: second argument '") +21661 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21662 (write-buffered *(ebp+0x10) %eax) +21663 (write-buffered *(ebp+0x10) "' must be an int or offset\n") +21664 (flush *(ebp+0x10)) +21665 (stop *(ebp+0x14) 1) +21666 # never gets here +21667 +21668 $check-mu-length-stmt:error-index-offset-atom-type: +21669 (write-buffered *(ebp+0x10) "fn ") +21670 8b/-> *(ebp+0xc) 0/r32/eax +21671 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21672 (write-buffered *(ebp+0x10) %eax) +21673 (write-buffered *(ebp+0x10) ": stmt length: offset '") +21674 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21675 (write-buffered *(ebp+0x10) %eax) +21676 (write-buffered *(ebp+0x10) "' must specify the type of array elements\n") +21677 (flush *(ebp+0x10)) +21678 (stop *(ebp+0x14) 1) +21679 # never gets here +21680 +21681 $check-mu-length-stmt:error-index-on-stack: +21682 (write-buffered *(ebp+0x10) "fn ") +21683 8b/-> *(ebp+0xc) 0/r32/eax +21684 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21685 (write-buffered *(ebp+0x10) %eax) +21686 (write-buffered *(ebp+0x10) ": stmt length: second argument '") +21687 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21688 (write-buffered *(ebp+0x10) %eax) +21689 (write-buffered *(ebp+0x10) "' must be in a register\n") +21690 (flush *(ebp+0x10)) +21691 (stop *(ebp+0x14) 1) +21692 # never gets here +21693 +21694 $check-mu-length-stmt:error-index-needs-offset: +21695 (write-buffered *(ebp+0x10) "fn ") +21696 8b/-> *(ebp+0xc) 0/r32/eax +21697 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21698 (write-buffered *(ebp+0x10) %eax) +21699 (write-buffered *(ebp+0x10) ": stmt length: cannot take an int for array '") +21700 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +21701 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21702 (lookup *eax *(eax+4)) # Var-name Var-name => eax +21703 (write-buffered *(ebp+0x10) %eax) +21704 (write-buffered *(ebp+0x10) "'; create an offset instead. See mu.md for details.\n") +21705 (flush *(ebp+0x10)) +21706 (stop *(ebp+0x14) 1) +21707 # never gets here +21708 +21709 $check-mu-length-stmt:error-too-many-inouts: +21710 (write-buffered *(ebp+0x10) "fn ") +21711 8b/-> *(ebp+0xc) 0/r32/eax +21712 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21713 (write-buffered *(ebp+0x10) %eax) +21714 (write-buffered *(ebp+0x10) ": stmt length: too many inouts (1 required)\n") +21715 (flush *(ebp+0x10)) +21716 (stop *(ebp+0x14) 1) +21717 # never gets here +21718 +21719 $check-mu-length-stmt:error-too-few-outputs: +21720 (write-buffered *(ebp+0x10) "fn ") +21721 8b/-> *(ebp+0xc) 0/r32/eax +21722 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21723 (write-buffered *(ebp+0x10) %eax) +21724 (write-buffered *(ebp+0x10) ": stmt length: must have an output\n") +21725 (flush *(ebp+0x10)) +21726 (stop *(ebp+0x14) 1) +21727 # never gets here +21728 +21729 $check-mu-length-stmt:error-too-many-outputs: +21730 (write-buffered *(ebp+0x10) "fn ") +21731 8b/-> *(ebp+0xc) 0/r32/eax +21732 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21733 (write-buffered *(ebp+0x10) %eax) +21734 (write-buffered *(ebp+0x10) ": stmt length: too many outputs (1 required)\n") +21735 (flush *(ebp+0x10)) +21736 (stop *(ebp+0x14) 1) +21737 # never gets here +21738 +21739 $check-mu-length-stmt:error-output-not-in-register: +21740 (write-buffered *(ebp+0x10) "fn ") +21741 8b/-> *(ebp+0xc) 0/r32/eax +21742 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21743 (write-buffered *(ebp+0x10) %eax) +21744 (write-buffered *(ebp+0x10) ": stmt length: output '") +21745 (lookup *edi *(edi+4)) # Var-name Var-name => eax +21746 (write-buffered *(ebp+0x10) %eax) +21747 (write-buffered *(ebp+0x10) "' is not in a register\n") +21748 (flush *(ebp+0x10)) +21749 (stop *(ebp+0x14) 1) +21750 # never gets here +21751 +21752 $check-mu-length-stmt:error-invalid-output-type: +21753 (write-buffered *(ebp+0x10) "fn ") +21754 8b/-> *(ebp+0xc) 0/r32/eax +21755 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21756 (write-buffered *(ebp+0x10) %eax) +21757 (write-buffered *(ebp+0x10) ": stmt length: output '") +21758 (lookup *edi *(edi+4)) # Var-name Var-name => eax +21759 (write-buffered *(ebp+0x10) %eax) +21760 (write-buffered *(ebp+0x10) "' does not have the right type\n") +21761 (flush *(ebp+0x10)) +21762 (stop *(ebp+0x14) 1) +21763 # never gets here +21764 +21765 check-mu-compute-offset-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +21766 # . prologue +21767 55/push-ebp +21768 89/<- %ebp 4/r32/esp +21769 # . save registers +21770 50/push-eax +21771 51/push-ecx +21772 52/push-edx +21773 53/push-ebx +21774 56/push-esi +21775 57/push-edi +21776 # esi = stmt +21777 8b/-> *(ebp+8) 6/r32/esi +21778 # - check for 0 inouts +21779 # var base/ecx: (addr var) = stmt->inouts->value +21780 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +21781 $check-mu-compute-offset-stmt:check-no-inouts: +21782 3d/compare-eax-and 0/imm32 +21783 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-too-few-inouts/disp32 +21784 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21785 89/<- %ecx 0/r32/eax +21786 # - check base type is either (addr array ...) in register or (array ...) on stack +21787 # var base-type/ebx: (addr type-tree) = lookup(base->type) +21788 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +21789 89/<- %ebx 0/r32/eax +21790 # if base-type is an atom, abort with a precise error +21791 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +21792 { +21793 74/jump-if-= break/disp8 +21794 (is-simple-mu-type? %ebx 3) # array => eax +21795 3d/compare-eax-and 0/imm32/false +21796 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-base-array-atom-type/disp32 +21797 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-base-non-array-type/disp32 +21798 } +21799 $check-mu-compute-offset-stmt:base-is-compound: +21800 # if type->left not addr or array, abort +21801 { +21802 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +21803 (is-simple-mu-type? %eax 2) # addr => eax +21804 3d/compare-eax-and 0/imm32/false +21805 75/jump-if-!= break/disp8 +21806 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +21807 (is-simple-mu-type? %eax 3) # array => eax +21808 3d/compare-eax-and 0/imm32/false +21809 75/jump-if-!= break/disp8 +21810 e9/jump $check-mu-compute-offset-stmt:error-base-non-array-type/disp32 +21811 } +21812 # if (type->left == addr) ensure type->right->left == array and type->register exists +21813 { +21814 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +21815 (is-simple-mu-type? %eax 2) # addr => eax +21816 3d/compare-eax-and 0/imm32/false +21817 74/jump-if-= break/disp8 +21818 $check-mu-compute-offset-stmt:base-is-addr: +21819 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +21820 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +21821 (is-simple-mu-type? %eax 3) # array => eax +21822 3d/compare-eax-and 0/imm32/false +21823 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-base-non-array-type/disp32 +21824 } +21825 # if (base-type->left == addr) base-type = base-type->right +21826 { +21827 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +21828 (is-simple-mu-type? %eax 2) # addr => eax +21829 3d/compare-eax-and 0/imm32/false +21830 74/jump-if-= break/disp8 +21831 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +21832 89/<- %ebx 0/r32/eax +21833 } +21834 # - check for 1 inout +21835 # var index/ecx: (addr stmt-var) = stmt->inouts->next->value +21836 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +21837 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +21838 $check-mu-compute-offset-stmt:check-single-inout: +21839 3d/compare-eax-and 0/imm32 +21840 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-too-few-inouts/disp32 +21841 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21842 89/<- %ecx 0/r32/eax +21843 # - check index is either a literal or register +21844 # var index-type/edx: (addr type-tree) +21845 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +21846 89/<- %edx 0/r32/eax +21847 # index type must be a literal or int +21848 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom +21849 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-invalid-index-type/disp32 +21850 { +21851 $check-mu-compute-offset-stmt:index-type-is-atom: +21852 (is-simple-mu-type? %edx 0) # literal => eax +21853 3d/compare-eax-and 0/imm32/false +21854 75/jump-if-!= break/disp8 +21855 (is-simple-mu-type? %edx 1) # int => eax +21856 3d/compare-eax-and 0/imm32/false +21857 75/jump-if-!= break/disp8 +21858 e9/jump $check-mu-compute-offset-stmt:error-invalid-index-type/disp32 +21859 } +21860 # - check for too many inouts +21861 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +21862 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +21863 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +21864 3d/compare-eax-and 0/imm32/false +21865 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-too-many-inouts/disp32 +21866 # - check for 0 outputs +21867 # var output/edi: (addr var) = stmt->outputs->value +21868 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +21869 3d/compare-eax-and 0/imm32/false +21870 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-too-few-outputs/disp32 +21871 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +21872 89/<- %edi 0/r32/eax +21873 # - check output type +21874 # must have a non-atomic type +21875 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +21876 89/<- %edx 0/r32/eax +21877 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom +21878 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-output-type-not-offset/disp32 +21879 # type must start with (offset ...) +21880 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +21881 (is-simple-mu-type? %eax 7) # offset => eax +21882 3d/compare-eax-and 0/imm32/false +21883 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-output-type-not-offset/disp32 +21884 # if tail(base-type) != tail(output-type) abort +21885 (type-tail %ebx) # => eax +21886 89/<- %ebx 0/r32/eax +21887 (type-tail %edx) # => eax +21888 (type-equal? %ebx %eax) # => eax +21889 3d/compare-eax-and 0/imm32/false +21890 0f 84/jump-if-= $check-mu-compute-offset-stmt:error-bad-output-type/disp32 +21891 # - check for too many outputs +21892 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +21893 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +21894 3d/compare-eax-and 0/imm32/false +21895 0f 85/jump-if-!= $check-mu-compute-offset-stmt:error-too-many-outputs/disp32 +21896 $check-mu-compute-offset-stmt:end: +21897 # . restore registers +21898 5f/pop-to-edi +21899 5e/pop-to-esi +21900 5b/pop-to-ebx +21901 5a/pop-to-edx +21902 59/pop-to-ecx +21903 58/pop-to-eax +21904 # . epilogue +21905 89/<- %esp 5/r32/ebp +21906 5d/pop-to-ebp +21907 c3/return +21908 +21909 $check-mu-compute-offset-stmt:error-base-non-array-type: +21910 (write-buffered *(ebp+0x10) "fn ") +21911 8b/-> *(ebp+0xc) 0/r32/eax +21912 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21913 (write-buffered *(ebp+0x10) %eax) +21914 (write-buffered *(ebp+0x10) ": stmt compute-offset: var '") +21915 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21916 (write-buffered *(ebp+0x10) %eax) +21917 (write-buffered *(ebp+0x10) "' is not an array\n") +21918 (flush *(ebp+0x10)) +21919 (stop *(ebp+0x14) 1) +21920 # never gets here +21921 +21922 $check-mu-compute-offset-stmt:error-base-array-atom-type: +21923 (write-buffered *(ebp+0x10) "fn ") +21924 8b/-> *(ebp+0xc) 0/r32/eax +21925 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21926 (write-buffered *(ebp+0x10) %eax) +21927 (write-buffered *(ebp+0x10) ": stmt compute-offset: array '") +21928 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21929 (write-buffered *(ebp+0x10) %eax) +21930 (write-buffered *(ebp+0x10) "' must specify the type of its elements\n") +21931 (flush *(ebp+0x10)) +21932 (stop *(ebp+0x14) 1) +21933 # never gets here +21934 +21935 $check-mu-compute-offset-stmt:error-too-few-inouts: +21936 (write-buffered *(ebp+0x10) "fn ") +21937 8b/-> *(ebp+0xc) 0/r32/eax +21938 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21939 (write-buffered *(ebp+0x10) %eax) +21940 (write-buffered *(ebp+0x10) ": stmt compute-offset: too few inouts (2 required)\n") +21941 (flush *(ebp+0x10)) +21942 (stop *(ebp+0x14) 1) +21943 # never gets here +21944 +21945 $check-mu-compute-offset-stmt:error-invalid-index-type: +21946 (write-buffered *(ebp+0x10) "fn ") +21947 8b/-> *(ebp+0xc) 0/r32/eax +21948 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21949 (write-buffered *(ebp+0x10) %eax) +21950 (write-buffered *(ebp+0x10) ": stmt compute-offset: second argument '") +21951 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21952 (write-buffered *(ebp+0x10) %eax) +21953 (write-buffered *(ebp+0x10) "' must be an int\n") +21954 (flush *(ebp+0x10)) +21955 (stop *(ebp+0x14) 1) +21956 # never gets here +21957 +21958 $check-mu-compute-offset-stmt:error-index-offset-atom-type: +21959 (write-buffered *(ebp+0x10) "fn ") +21960 8b/-> *(ebp+0xc) 0/r32/eax +21961 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21962 (write-buffered *(ebp+0x10) %eax) +21963 (write-buffered *(ebp+0x10) ": stmt compute-offset: offset '") +21964 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21965 (write-buffered *(ebp+0x10) %eax) +21966 (write-buffered *(ebp+0x10) "' must specify the type of array elements\n") +21967 (flush *(ebp+0x10)) +21968 (stop *(ebp+0x14) 1) +21969 # never gets here +21970 +21971 $check-mu-compute-offset-stmt:error-index-on-stack: +21972 (write-buffered *(ebp+0x10) "fn ") +21973 8b/-> *(ebp+0xc) 0/r32/eax +21974 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21975 (write-buffered *(ebp+0x10) %eax) +21976 (write-buffered *(ebp+0x10) ": stmt compute-offset: second argument '") +21977 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +21978 (write-buffered *(ebp+0x10) %eax) +21979 (write-buffered *(ebp+0x10) "' must be in a register\n") +21980 (flush *(ebp+0x10)) +21981 (stop *(ebp+0x14) 1) +21982 # never gets here +21983 +21984 $check-mu-compute-offset-stmt:error-too-many-inouts: +21985 (write-buffered *(ebp+0x10) "fn ") +21986 8b/-> *(ebp+0xc) 0/r32/eax +21987 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21988 (write-buffered *(ebp+0x10) %eax) +21989 (write-buffered *(ebp+0x10) ": stmt compute-offset: too many inouts (2 required)\n") +21990 (flush *(ebp+0x10)) +21991 (stop *(ebp+0x14) 1) +21992 # never gets here +21993 +21994 $check-mu-compute-offset-stmt:error-too-few-outputs: +21995 (write-buffered *(ebp+0x10) "fn ") +21996 8b/-> *(ebp+0xc) 0/r32/eax +21997 (lookup *eax *(eax+4)) # Function-name Function-name => eax +21998 (write-buffered *(ebp+0x10) %eax) +21999 (write-buffered *(ebp+0x10) ": stmt compute-offset: must have an output\n") +22000 (flush *(ebp+0x10)) +22001 (stop *(ebp+0x14) 1) +22002 # never gets here +22003 +22004 $check-mu-compute-offset-stmt:error-too-many-outputs: +22005 (write-buffered *(ebp+0x10) "fn ") +22006 8b/-> *(ebp+0xc) 0/r32/eax +22007 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22008 (write-buffered *(ebp+0x10) %eax) +22009 (write-buffered *(ebp+0x10) ": stmt compute-offset: too many outputs (1 required)\n") +22010 (flush *(ebp+0x10)) +22011 (stop *(ebp+0x14) 1) +22012 # never gets here +22013 +22014 $check-mu-compute-offset-stmt:error-output-not-in-register: +22015 (write-buffered *(ebp+0x10) "fn ") +22016 8b/-> *(ebp+0xc) 0/r32/eax +22017 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22018 (write-buffered *(ebp+0x10) %eax) +22019 (write-buffered *(ebp+0x10) ": stmt compute-offset: output '") +22020 (lookup *edi *(edi+4)) # Var-name Var-name => eax +22021 (write-buffered *(ebp+0x10) %eax) +22022 (write-buffered *(ebp+0x10) "' is not in a register\n") +22023 (flush *(ebp+0x10)) +22024 (stop *(ebp+0x14) 1) +22025 # never gets here +22026 +22027 $check-mu-compute-offset-stmt:error-output-type-not-offset: +22028 (write-buffered *(ebp+0x10) "fn ") +22029 8b/-> *(ebp+0xc) 0/r32/eax +22030 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22031 (write-buffered *(ebp+0x10) %eax) +22032 (write-buffered *(ebp+0x10) ": stmt compute-offset: output '") +22033 (lookup *edi *(edi+4)) # Var-name Var-name => eax +22034 (write-buffered *(ebp+0x10) %eax) +22035 (write-buffered *(ebp+0x10) "' must be an offset\n") +22036 (flush *(ebp+0x10)) +22037 (stop *(ebp+0x14) 1) +22038 # never gets here +22039 +22040 $check-mu-compute-offset-stmt:error-bad-output-type: +22041 (write-buffered *(ebp+0x10) "fn ") +22042 8b/-> *(ebp+0xc) 0/r32/eax +22043 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22044 (write-buffered *(ebp+0x10) %eax) +22045 (write-buffered *(ebp+0x10) ": stmt compute-offset: output '") +22046 (lookup *edi *(edi+4)) # Var-name Var-name => eax +22047 (write-buffered *(ebp+0x10) %eax) +22048 (write-buffered *(ebp+0x10) "' does not have the right type\n") +22049 (flush *(ebp+0x10)) +22050 (stop *(ebp+0x14) 1) +22051 # never gets here +22052 +22053 check-mu-copy-object-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +22054 # . prologue +22055 55/push-ebp +22056 89/<- %ebp 4/r32/esp +22057 # . save registers +22058 50/push-eax +22059 51/push-ecx +22060 53/push-ebx +22061 56/push-esi +22062 57/push-edi +22063 # esi = stmt +22064 8b/-> *(ebp+8) 6/r32/esi +22065 $check-mu-copy-object-stmt:check-for-output: +22066 # if stmt->outputs abort +22067 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +22068 3d/compare-eax-and 0/imm32 +22069 0f 85/jump-if-!= $check-mu-copy-object-stmt:error-too-many-outputs/disp32 +22070 $check-mu-copy-object-stmt:get-left: +22071 # var dest/edi: (addr stmt-var) = stmt->inouts +22072 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22073 89/<- %edi 0/r32/eax +22074 # zero inouts +22075 3d/compare-eax-and 0/imm32 +22076 0f 84/jump-if-= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 +22077 $check-mu-copy-object-stmt:get-src: +22078 # var src/esi: (addr stmt-var) = dest->next +22079 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +22080 89/<- %esi 0/r32/eax +22081 # 1 inout +22082 3d/compare-eax-and 0/imm32 +22083 0f 84/jump-if-= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 +22084 # > 2 inouts +22085 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +22086 3d/compare-eax-and 0/imm32 +22087 0f 85/jump-if-!= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 +22088 $check-mu-copy-object-stmt:types: +22089 # var src-type/ecx: (addr type-tree) = src->value->type +22090 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22091 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22092 89/<- %ecx 0/r32/eax +22093 # if (src->is-deref?) src-type = src-type->payload +22094 8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref +22095 3d/compare-eax-and 0/imm32/false +22096 { +22097 74/jump-if-= break/disp8 +22098 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +22099 # if src-type->right is null, src-type = src-type->left +22100 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +22101 { +22102 75/jump-if-!= break/disp8 +22103 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22104 } +22105 89/<- %ecx 0/r32/eax +22106 } +22107 # if src-type is not addr, abort +22108 (is-mu-addr-type? %ecx) # => eax +22109 3d/compare-eax-and 0/imm32/false +22110 0f 84/jump-if-= $check-mu-copy-object-stmt:error-invalid-types/disp32 +22111 # var dest-type/ebx: (addr type-tree) = dest->value->type +22112 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22113 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22114 89/<- %ebx 0/r32/eax +22115 # if (dest->is-deref?) dest-type = dest-type->payload +22116 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref +22117 3d/compare-eax-and 0/imm32/false +22118 { +22119 74/jump-if-= break/disp8 +22120 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22121 # if dest-type->right is null, dest-type = dest-type->left +22122 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +22123 { +22124 75/jump-if-!= break/disp8 +22125 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22126 } +22127 89/<- %ebx 0/r32/eax +22128 } +22129 # if (dest-type != src-type) abort +22130 (type-equal? %ecx %ebx) # => eax +22131 3d/compare-eax-and 0/imm32 +22132 0f 84/jump-if-= $check-mu-copy-object-stmt:error-invalid-types/disp32 +22133 $check-mu-copy-object-stmt:end: +22134 # . restore registers +22135 5f/pop-to-edi +22136 5e/pop-to-esi +22137 5b/pop-to-ebx +22138 59/pop-to-ecx +22139 58/pop-to-eax +22140 # . epilogue +22141 89/<- %esp 5/r32/ebp +22142 5d/pop-to-ebp +22143 c3/return +22144 +22145 $check-mu-copy-object-stmt:error-incorrect-inouts: +22146 (write-buffered *(ebp+0x10) "fn ") +22147 8b/-> *(ebp+0xc) 0/r32/eax +22148 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22149 (write-buffered *(ebp+0x10) %eax) +22150 (write-buffered *(ebp+0x10) ": stmt 'copy-object' must have two inouts\n") +22151 (flush *(ebp+0x10)) +22152 (stop *(ebp+0x14) 1) +22153 # never gets here +22154 +22155 $check-mu-copy-object-stmt:error-too-many-outputs: +22156 (write-buffered *(ebp+0x10) "fn ") +22157 8b/-> *(ebp+0xc) 0/r32/eax +22158 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22159 (write-buffered *(ebp+0x10) %eax) +22160 (write-buffered *(ebp+0x10) ": stmt 'copy-object' must not have any outputs\n") +22161 (flush *(ebp+0x10)) +22162 (stop *(ebp+0x14) 1) +22163 # never gets here +22164 +22165 $check-mu-copy-object-stmt:error-invalid-types: +22166 (write-buffered *(ebp+0x10) "fn ") +22167 8b/-> *(ebp+0xc) 0/r32/eax +22168 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22169 (write-buffered *(ebp+0x10) %eax) +22170 (write-buffered *(ebp+0x10) ": stmt copy-object: two inouts with identical addr types expected\n") +22171 (flush *(ebp+0x10)) +22172 (stop *(ebp+0x14) 1) +22173 # never gets here +22174 +22175 check-mu-allocate-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +22176 # . prologue +22177 55/push-ebp +22178 89/<- %ebp 4/r32/esp +22179 # . save registers +22180 50/push-eax +22181 53/push-ebx +22182 56/push-esi +22183 57/push-edi +22184 # esi = stmt +22185 8b/-> *(ebp+8) 6/r32/esi +22186 $check-mu-allocate-stmt:check-for-output: +22187 # if stmt->outputs abort +22188 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +22189 3d/compare-eax-and 0/imm32 +22190 0f 85/jump-if-!= $check-mu-allocate-stmt:error-too-many-outputs/disp32 +22191 $check-mu-allocate-stmt:get-target: +22192 # var target/edi: (addr stmt-var) = stmt->inouts +22193 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22194 89/<- %edi 0/r32/eax +22195 # zero inouts +22196 3d/compare-eax-and 0/imm32 +22197 0f 84/jump-if-= $check-mu-allocate-stmt:error-incorrect-inouts/disp32 +22198 # > 1 inouts +22199 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +22200 3d/compare-eax-and 0/imm32 +22201 0f 85/jump-if-!= $check-mu-allocate-stmt:error-incorrect-inouts/disp32 +22202 $check-mu-allocate-stmt:check-type: +22203 # var target-type/ebx: (addr type-tree) = target->value->type +22204 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22205 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22206 89/<- %ebx 0/r32/eax +22207 # if (target->is-deref?) target-type = target-type->payload +22208 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref +22209 3d/compare-eax-and 0/imm32/false +22210 { +22211 74/jump-if-= break/disp8 +22212 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22213 # if target-type->right is null, target-type = target-type->left +22214 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +22215 { +22216 75/jump-if-!= break/disp8 +22217 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22218 } +22219 89/<- %ebx 0/r32/eax +22220 } +22221 # if target-type is not addr, abort +22222 (is-mu-addr-type? %ebx) # => eax +22223 3d/compare-eax-and 0/imm32/false +22224 0f 84/jump-if-= $check-mu-allocate-stmt:error-invalid-type/disp32 +22225 # if target-type->right is an atom, abort +22226 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22227 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +22228 0f 85/jump-if-!= $check-mu-allocate-stmt:error-invalid-type/disp32 +22229 # if target-type->right->left is not handle, abort +22230 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22231 (is-simple-mu-type? %eax 4) # handle => eax +22232 3d/compare-eax-and 0/imm32/false +22233 0f 84/jump-if-= $check-mu-allocate-stmt:error-invalid-type/disp32 +22234 $check-mu-allocate-stmt:end: +22235 # . restore registers +22236 5f/pop-to-edi +22237 5e/pop-to-esi +22238 5b/pop-to-ebx +22239 58/pop-to-eax +22240 # . epilogue +22241 89/<- %esp 5/r32/ebp +22242 5d/pop-to-ebp +22243 c3/return +22244 +22245 $check-mu-allocate-stmt:error-incorrect-inouts: +22246 (write-buffered *(ebp+0x10) "fn ") +22247 8b/-> *(ebp+0xc) 0/r32/eax +22248 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22249 (write-buffered *(ebp+0x10) %eax) +22250 (write-buffered *(ebp+0x10) ": stmt 'allocate' must have a single inout\n") +22251 (flush *(ebp+0x10)) +22252 (stop *(ebp+0x14) 1) +22253 # never gets here +22254 +22255 $check-mu-allocate-stmt:error-too-many-outputs: +22256 (write-buffered *(ebp+0x10) "fn ") +22257 8b/-> *(ebp+0xc) 0/r32/eax +22258 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22259 (write-buffered *(ebp+0x10) %eax) +22260 (write-buffered *(ebp+0x10) ": stmt 'allocate' must not have any outputs\n") +22261 (flush *(ebp+0x10)) +22262 (stop *(ebp+0x14) 1) +22263 # never gets here +22264 +22265 $check-mu-allocate-stmt:error-invalid-type: +22266 (write-buffered *(ebp+0x10) "fn ") +22267 8b/-> *(ebp+0xc) 0/r32/eax +22268 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22269 (write-buffered *(ebp+0x10) %eax) +22270 (write-buffered *(ebp+0x10) ": stmt allocate: inout '") +22271 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22272 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22273 (write-buffered *(ebp+0x10) %eax) +22274 (write-buffered *(ebp+0x10) "' must have type (addr handle ...)\n") +22275 (flush *(ebp+0x10)) +22276 (stop *(ebp+0x14) 1) +22277 # never gets here +22278 +22279 check-mu-populate-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +22280 # . prologue +22281 55/push-ebp +22282 89/<- %ebp 4/r32/esp +22283 # . save registers +22284 50/push-eax +22285 53/push-ebx +22286 56/push-esi +22287 57/push-edi +22288 # esi = stmt +22289 8b/-> *(ebp+8) 6/r32/esi +22290 $check-mu-populate-stmt:check-for-output: +22291 # if stmt->outputs abort +22292 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +22293 3d/compare-eax-and 0/imm32 +22294 0f 85/jump-if-!= $check-mu-populate-stmt:error-too-many-outputs/disp32 +22295 $check-mu-populate-stmt:get-target: +22296 # var target/edi: (addr stmt-var) = stmt->inouts +22297 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22298 89/<- %edi 0/r32/eax +22299 # zero inouts +22300 3d/compare-eax-and 0/imm32 +22301 0f 84/jump-if-= $check-mu-populate-stmt:error-incorrect-inouts/disp32 +22302 $check-mu-populate-stmt:get-length: +22303 # var length/esi: (addr stmt-var) = dest->next +22304 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +22305 89/<- %esi 0/r32/eax +22306 # 1 inout +22307 3d/compare-eax-and 0/imm32 +22308 0f 84/jump-if-= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 +22309 # > 2 inouts +22310 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +22311 3d/compare-eax-and 0/imm32 +22312 0f 85/jump-if-!= $check-mu-populate-stmt:error-incorrect-inouts/disp32 +22313 $check-mu-populate-stmt:check-target-type: +22314 # var target-type/ebx: (addr type-tree) = target->value->type +22315 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22316 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22317 89/<- %ebx 0/r32/eax +22318 $check-mu-populate-stmt:check-target-type-deref: +22319 # if (target->is-deref?) target-type = target-type->payload +22320 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref +22321 3d/compare-eax-and 0/imm32/false +22322 { +22323 74/jump-if-= break/disp8 +22324 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22325 # if target-type->right is null, target-type = target-type->left +22326 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +22327 { +22328 75/jump-if-!= break/disp8 +22329 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22330 } +22331 89/<- %ebx 0/r32/eax +22332 } +22333 $check-mu-populate-stmt:check-target-type-addr: +22334 # if target-type is not addr, abort +22335 (is-mu-addr-type? %ebx) # => eax +22336 3d/compare-eax-and 0/imm32/false +22337 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-target-type/disp32 +22338 # if target-type->right is an atom, abort +22339 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22340 89/<- %ebx 0/r32/eax +22341 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +22342 0f 85/jump-if-!= $check-mu-populate-stmt:error-invalid-target-type/disp32 +22343 $check-mu-populate-stmt:check-target-type-handle: +22344 # if target-type->right->left is not handle, abort +22345 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +22346 (is-simple-mu-type? %eax 4) # handle => eax +22347 3d/compare-eax-and 0/imm32/false +22348 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-target-type/disp32 +22349 # if target-type->right->right is an atom, abort +22350 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22351 89/<- %ebx 0/r32/eax +22352 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +22353 0f 85/jump-if-!= $check-mu-populate-stmt:error-invalid-target-type/disp32 +22354 $check-mu-populate-stmt:check-target-type-array: +22355 # if target-type->right->right->left is not array, abort +22356 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +22357 (is-simple-mu-type? %eax 3) # array => eax +22358 3d/compare-eax-and 0/imm32/false +22359 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-target-type/disp32 +22360 $check-mu-populate-stmt:check-length-type: +22361 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22362 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22363 89/<- %ebx 0/r32/eax +22364 (is-simple-mu-type? %ebx 0) # literal => eax +22365 3d/compare-eax-and 0/imm32/false +22366 75/jump-if-!= $check-mu-populate-stmt:end/disp8 +22367 (is-simple-mu-type? %ebx 1) # int => eax +22368 3d/compare-eax-and 0/imm32/false +22369 0f 84/jump-if-= $check-mu-populate-stmt:error-invalid-length-type/disp32 +22370 $check-mu-populate-stmt:end: +22371 # . restore registers +22372 5f/pop-to-edi +22373 5e/pop-to-esi +22374 5b/pop-to-ebx +22375 58/pop-to-eax +22376 # . epilogue +22377 89/<- %esp 5/r32/ebp +22378 5d/pop-to-ebp +22379 c3/return +22380 +22381 $check-mu-populate-stmt:error-incorrect-inouts: +22382 (write-buffered *(ebp+0x10) "fn ") +22383 8b/-> *(ebp+0xc) 0/r32/eax +22384 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22385 (write-buffered *(ebp+0x10) %eax) +22386 (write-buffered *(ebp+0x10) ": stmt 'populate' must have two inouts\n") +22387 (flush *(ebp+0x10)) +22388 (stop *(ebp+0x14) 1) +22389 # never gets here +22390 +22391 $check-mu-populate-stmt:error-too-many-outputs: +22392 (write-buffered *(ebp+0x10) "fn ") +22393 8b/-> *(ebp+0xc) 0/r32/eax +22394 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22395 (write-buffered *(ebp+0x10) %eax) +22396 (write-buffered *(ebp+0x10) ": stmt 'populate' must not have any outputs\n") +22397 (flush *(ebp+0x10)) +22398 (stop *(ebp+0x14) 1) +22399 # never gets here +22400 +22401 $check-mu-populate-stmt:error-invalid-target-type: +22402 (write-buffered *(ebp+0x10) "fn ") +22403 8b/-> *(ebp+0xc) 0/r32/eax +22404 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22405 (write-buffered *(ebp+0x10) %eax) +22406 (write-buffered *(ebp+0x10) ": stmt populate: first inout '") +22407 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22408 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22409 (write-buffered *(ebp+0x10) %eax) +22410 (write-buffered *(ebp+0x10) "' must have type (addr handle array ...)\n") +22411 (flush *(ebp+0x10)) +22412 (stop *(ebp+0x14) 1) +22413 # never gets here +22414 +22415 $check-mu-populate-stmt:error-invalid-length-type: +22416 (write-buffered *(ebp+0x10) "fn ") +22417 8b/-> *(ebp+0xc) 0/r32/eax +22418 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22419 (write-buffered *(ebp+0x10) %eax) +22420 (write-buffered *(ebp+0x10) ": stmt populate: second inout '") +22421 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22422 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22423 (write-buffered *(ebp+0x10) %eax) +22424 (write-buffered *(ebp+0x10) "' must be an int\n") +22425 (flush *(ebp+0x10)) +22426 (stop *(ebp+0x14) 1) +22427 # never gets here +22428 +22429 check-mu-populate-stream-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +22430 # . prologue +22431 55/push-ebp +22432 89/<- %ebp 4/r32/esp +22433 # . save registers +22434 50/push-eax +22435 53/push-ebx +22436 56/push-esi +22437 57/push-edi +22438 # esi = stmt +22439 8b/-> *(ebp+8) 6/r32/esi +22440 $check-mu-populate-stream-stmt:check-for-output: +22441 # if stmt->outputs abort +22442 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +22443 3d/compare-eax-and 0/imm32 +22444 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-too-many-outputs/disp32 +22445 $check-mu-populate-stream-stmt:get-target: +22446 # var target/edi: (addr stmt-var) = stmt->inouts +22447 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22448 89/<- %edi 0/r32/eax +22449 # zero inouts +22450 3d/compare-eax-and 0/imm32 +22451 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-incorrect-inouts/disp32 +22452 $check-mu-populate-stream-stmt:get-length: +22453 # var length/esi: (addr stmt-var) = dest->next +22454 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +22455 89/<- %esi 0/r32/eax +22456 # 1 inout +22457 3d/compare-eax-and 0/imm32 +22458 0f 84/jump-if-= $check-mu-copy-object-stmt:error-incorrect-inouts/disp32 +22459 # > 2 inouts +22460 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +22461 3d/compare-eax-and 0/imm32 +22462 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-incorrect-inouts/disp32 +22463 $check-mu-populate-stream-stmt:check-target-type: +22464 # var target-type/ebx: (addr type-tree) = target->value->type +22465 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22466 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22467 89/<- %ebx 0/r32/eax +22468 $check-mu-populate-stream-stmt:check-target-type-deref: +22469 # if (target->is-deref?) target-type = target-type->payload +22470 8b/-> *(edi+0x10) 0/r32/eax # Stmt-var-is-deref +22471 3d/compare-eax-and 0/imm32/false +22472 { +22473 74/jump-if-= break/disp8 +22474 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22475 # if target-type->right is null, target-type = target-type->left +22476 81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right +22477 { +22478 75/jump-if-!= break/disp8 +22479 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22480 } +22481 89/<- %ebx 0/r32/eax +22482 } +22483 $check-mu-populate-stream-stmt:check-target-type-addr: +22484 # if target-type is not addr, abort +22485 (is-mu-addr-type? %ebx) # => eax +22486 3d/compare-eax-and 0/imm32/false +22487 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 +22488 # if target-type->right is an atom, abort +22489 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22490 89/<- %ebx 0/r32/eax +22491 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +22492 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 +22493 $check-mu-populate-stream-stmt:check-target-type-handle: +22494 # if target-type->right->left is not handle, abort +22495 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +22496 (is-simple-mu-type? %eax 4) # handle => eax +22497 3d/compare-eax-and 0/imm32/false +22498 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 +22499 # if target-type->right->right is an atom, abort +22500 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22501 89/<- %ebx 0/r32/eax +22502 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +22503 0f 85/jump-if-!= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 +22504 $check-mu-populate-stream-stmt:check-target-type-stream: +22505 # if target-type->right->right->left is not stream, abort +22506 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +22507 (is-simple-mu-type? %eax 0xb) # stream => eax +22508 3d/compare-eax-and 0/imm32/false +22509 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-target-type/disp32 +22510 $check-mu-populate-stream-stmt:check-length-type: +22511 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22512 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22513 89/<- %ebx 0/r32/eax +22514 (is-simple-mu-type? %ebx 0) # literal => eax +22515 3d/compare-eax-and 0/imm32/false +22516 75/jump-if-!= $check-mu-populate-stream-stmt:end/disp8 +22517 (is-simple-mu-type? %ebx 1) # int => eax +22518 3d/compare-eax-and 0/imm32/false +22519 0f 84/jump-if-= $check-mu-populate-stream-stmt:error-invalid-length-type/disp32 +22520 $check-mu-populate-stream-stmt:end: +22521 # . restore registers +22522 5f/pop-to-edi +22523 5e/pop-to-esi +22524 5b/pop-to-ebx +22525 58/pop-to-eax +22526 # . epilogue +22527 89/<- %esp 5/r32/ebp +22528 5d/pop-to-ebp +22529 c3/return +22530 +22531 $check-mu-populate-stream-stmt:error-incorrect-inouts: +22532 (write-buffered *(ebp+0x10) "fn ") +22533 8b/-> *(ebp+0xc) 0/r32/eax +22534 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22535 (write-buffered *(ebp+0x10) %eax) +22536 (write-buffered *(ebp+0x10) ": stmt 'populate-stream' must have two inouts\n") +22537 (flush *(ebp+0x10)) +22538 (stop *(ebp+0x14) 1) +22539 # never gets here +22540 +22541 $check-mu-populate-stream-stmt:error-too-many-outputs: +22542 (write-buffered *(ebp+0x10) "fn ") +22543 8b/-> *(ebp+0xc) 0/r32/eax +22544 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22545 (write-buffered *(ebp+0x10) %eax) +22546 (write-buffered *(ebp+0x10) ": stmt 'populate-stream' must not have any outputs\n") +22547 (flush *(ebp+0x10)) +22548 (stop *(ebp+0x14) 1) +22549 # never gets here 22550 -22551 # like type-equal? but takes literals into account -22552 type-match?: # def: (addr type-tree), call: (addr type-tree), type-parameters: (addr table (handle array byte) (addr type-tree)) -> result/eax: boolean -22553 # . prologue -22554 55/push-ebp -22555 89/<- %ebp 4/r32/esp -22556 # if (call == literal) return true # TODO: more precise -22557 (is-simple-mu-type? *(ebp+0xc) 0) # literal => eax -22558 3d/compare-eax-and 0/imm32/false -22559 b8/copy-to-eax 1/imm32/true -22560 75/jump-if-!= $type-match?:end/disp8 -22561 $type-match?:baseline: -22562 # otherwise fall back -22563 (type-component-match? *(ebp+8) *(ebp+0xc) *(ebp+0x10)) # => eax -22564 $type-match?:end: -22565 # . epilogue -22566 89/<- %esp 5/r32/ebp -22567 5d/pop-to-ebp -22568 c3/return -22569 -22570 type-component-match?: # def: (addr type-tree), call: (addr type-tree), type-parameters: (addr table (handle array byte) (addr type-tree)) -> result/eax: boolean -22571 # . prologue -22572 55/push-ebp -22573 89/<- %ebp 4/r32/esp -22574 # . save registers -22575 51/push-ecx -22576 52/push-edx -22577 53/push-ebx -22578 # ecx = def -22579 8b/-> *(ebp+8) 1/r32/ecx -22580 # edx = call -22581 8b/-> *(ebp+0xc) 2/r32/edx -22582 $type-component-match?:compare-addr: -22583 # if (def == call) return true -22584 8b/-> %ecx 0/r32/eax # Var-type -22585 39/compare %edx 0/r32/eax # Var-type -22586 b8/copy-to-eax 1/imm32/true -22587 0f 84/jump-if-= $type-component-match?:end/disp32 -22588 # if (def == 0) return false -22589 b8/copy-to-eax 0/imm32/false -22590 81 7/subop/compare %ecx 0/imm32 # Type-tree-is-atom -22591 0f 84/jump-if-= $type-component-match?:end/disp32 -22592 # if (call == 0) return false -22593 81 7/subop/compare %edx 0/imm32 # Type-tree-is-atom -22594 0f 84/jump-if-= $type-component-match?:end/disp32 -22595 # if def is a type parameter, just check in type-parameters -22596 { -22597 $type-component-match?:check-type-parameter: -22598 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -22599 74/jump-if-= break/disp8 -22600 81 7/subop/compare *(ecx+4) 0xa/imm32/type-parameter # Type-tree-value -22601 75/jump-if-!= break/disp8 -22602 $type-component-match?:type-parameter: -22603 (type-parameter-match? *(ecx+8) *(ecx+0xc) %edx *(ebp+0x10)) # => eax -22604 e9/jump $type-component-match?:end/disp32 -22605 } -22606 # if def is a list containing just a type parameter, just check in type-parameters -22607 { -22608 $type-component-match?:check-list-type-parameter: -22609 # if def is a list.. -22610 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -22611 75/jump-if-!= break/disp8 -22612 # ..that's a singleton -22613 81 7/subop/compare *(ecx+0xc) 0/imm32 # Type-tree-left -22614 75/jump-if-!= break/disp8 -22615 # ..and whose head is a type parameter -22616 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -22617 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -22618 74/jump-if-= break/disp8 -22619 81 7/subop/compare *(eax+4) 0xa/imm32/type-parameter # Type-tree-value -22620 75/jump-if-!= break/disp8 -22621 $type-component-match?:list-type-parameter: -22622 (type-parameter-match? *(eax+8) *(eax+0xc) %edx *(ebp+0x10)) # => eax -22623 e9/jump $type-component-match?:end/disp32 -22624 } -22625 $type-component-match?:compare-atom-state: -22626 # if (def->is-atom? != call->is-atom?) return false -22627 8b/-> *ecx 3/r32/ebx # Type-tree-is-atom -22628 39/compare *edx 3/r32/ebx # Type-tree-is-atom -22629 b8/copy-to-eax 0/imm32/false -22630 0f 85/jump-if-!= $type-component-match?:end/disp32 -22631 # if def->is-atom? return (def->value == call->value) -22632 { -22633 $type-component-match?:check-atom: -22634 81 7/subop/compare %ebx 0/imm32/false -22635 74/jump-if-= break/disp8 -22636 $type-component-match?:is-atom: -22637 8b/-> *(ecx+4) 0/r32/eax # Type-tree-value -22638 39/compare *(edx+4) 0/r32/eax # Type-tree-value -22639 0f 94/set-if-= %al -22640 81 4/subop/and %eax 0xff/imm32 -22641 e9/jump $type-component-match?:end/disp32 -22642 } -22643 $type-component-match?:check-left: -22644 # if (!type-component-match?(def->left, call->left)) return false -22645 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -22646 89/<- %ebx 0/r32/eax -22647 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -22648 (type-component-match? %ebx %eax *(ebp+0x10)) # => eax -22649 3d/compare-eax-and 0/imm32/false -22650 74/jump-if-= $type-component-match?:end/disp8 -22651 $type-component-match?:check-right: -22652 # return type-component-match?(def->right, call->right) -22653 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -22654 89/<- %ebx 0/r32/eax -22655 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax -22656 (type-component-match? %ebx %eax *(ebp+0x10)) # => eax -22657 $type-component-match?:end: -22658 # . restore registers -22659 5b/pop-to-ebx -22660 5a/pop-to-edx -22661 59/pop-to-ecx -22662 # . epilogue -22663 89/<- %esp 5/r32/ebp -22664 5d/pop-to-ebp -22665 c3/return -22666 -22667 type-parameter-match?: # type-parameter-name: (handle array byte), type: (addr type-tree), type-parameters: (addr table (handle array byte) (addr type-tree)) -> result/eax: boolean -22668 # . prologue -22669 55/push-ebp -22670 89/<- %ebp 4/r32/esp -22671 # . save registers -22672 51/push-ecx -22673 # -22674 (get-or-insert-handle *(ebp+0x14) *(ebp+8) *(ebp+0xc) 0xc) # => eax -22675 # if parameter wasn't saved, save it -22676 { -22677 81 7/subop/compare *eax 0/imm32 -22678 75/jump-if-!= break/disp8 -22679 8b/-> *(ebp+0x10) 1/r32/ecx -22680 89/<- *eax 1/r32/ecx -22681 } -22682 # -22683 (type-equal? *(ebp+0x10) *eax) # => eax -22684 $type-parameter-match?:end: -22685 # . restore registers -22686 59/pop-to-ecx -22687 # . epilogue -22688 89/<- %esp 5/r32/ebp -22689 5d/pop-to-ebp -22690 c3/return -22691 -22692 size-of: # v: (addr var) -> result/eax: int -22693 # . prologue -22694 55/push-ebp -22695 89/<- %ebp 4/r32/esp -22696 # . save registers -22697 51/push-ecx -22698 # var t/ecx: (addr type-tree) = lookup(v->type) -22699 8b/-> *(ebp+8) 1/r32/ecx -22700 #? (write-buffered Stderr "size-of ") -22701 #? (write-int32-hex-buffered Stderr %ecx) -22702 #? (write-buffered Stderr Newline) -22703 #? (write-buffered Stderr "type allocid: ") -22704 #? (write-int32-hex-buffered Stderr *(ecx+8)) -22705 #? (write-buffered Stderr Newline) -22706 #? (flush Stderr) -22707 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -22708 89/<- %ecx 0/r32/eax -22709 # if is-mu-array?(t) return size-of-array(t) -22710 { -22711 (is-mu-array? %ecx) # => eax -22712 3d/compare-eax-and 0/imm32/false -22713 74/jump-if-= break/disp8 -22714 (size-of-array %ecx) # => eax -22715 eb/jump $size-of:end/disp8 -22716 } -22717 # if is-mu-stream?(t) return size-of-stream(t) -22718 { -22719 (is-mu-stream? %ecx) # => eax -22720 3d/compare-eax-and 0/imm32/false -22721 74/jump-if-= break/disp8 -22722 (size-of-stream %ecx) # => eax -22723 eb/jump $size-of:end/disp8 -22724 } -22725 # if (!t->is-atom?) t = lookup(t->left) -22726 { -22727 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -22728 75/jump-if-!= break/disp8 -22729 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -22730 89/<- %ecx 0/r32/eax -22731 } -22732 # TODO: assert t->is-atom? -22733 (size-of-type-id *(ecx+4)) # Type-tree-value => eax -22734 $size-of:end: -22735 # . restore registers -22736 59/pop-to-ecx -22737 # . epilogue -22738 89/<- %esp 5/r32/ebp -22739 5d/pop-to-ebp -22740 c3/return -22741 -22742 size-of-deref: # v: (addr var) -> result/eax: int -22743 # . prologue -22744 55/push-ebp -22745 89/<- %ebp 4/r32/esp -22746 # . save registers -22747 51/push-ecx -22748 # var t/ecx: (addr type-tree) = lookup(v->type) -22749 8b/-> *(ebp+8) 1/r32/ecx -22750 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -22751 89/<- %ecx 0/r32/eax -22752 # TODO: assert(t is an addr) -22753 # t = lookup(t->right) -22754 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -22755 89/<- %ecx 0/r32/eax -22756 # if is-mu-array?(t) return size-of-array(t) -22757 { -22758 (is-mu-array? %ecx) # => eax -22759 3d/compare-eax-and 0/imm32/false -22760 74/jump-if-= break/disp8 -22761 (size-of-array %ecx) # => eax -22762 eb/jump $size-of-deref:end/disp8 -22763 } -22764 # if is-mu-stream?(t) return size-of-stream(t) -22765 { -22766 (is-mu-stream? %ecx) # => eax -22767 3d/compare-eax-and 0/imm32/false -22768 74/jump-if-= break/disp8 -22769 (size-of-stream %ecx) # => eax -22770 eb/jump $size-of-deref:end/disp8 -22771 } -22772 # if (!t->is-atom?) t = lookup(t->left) -22773 { -22774 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -22775 75/jump-if-!= break/disp8 -22776 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -22777 89/<- %ecx 0/r32/eax -22778 } -22779 # TODO: assert t->is-atom? -22780 (size-of-type-id *(ecx+4)) # Type-tree-value => eax -22781 $size-of-deref:end: -22782 # . restore registers -22783 59/pop-to-ecx -22784 # . epilogue -22785 89/<- %esp 5/r32/ebp -22786 5d/pop-to-ebp -22787 c3/return -22788 -22789 is-mu-array?: # t: (addr type-tree) -> result/eax: boolean -22790 # . prologue -22791 55/push-ebp -22792 89/<- %ebp 4/r32/esp -22793 # . save registers -22794 51/push-ecx -22795 # ecx = t -22796 8b/-> *(ebp+8) 1/r32/ecx -22797 # if t->is-atom?, return false -22798 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -22799 75/jump-if-!= $is-mu-array?:return-false/disp8 -22800 # if !t->left->is-atom?, return false -22801 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -22802 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -22803 74/jump-if-= $is-mu-array?:return-false/disp8 -22804 # return t->left->value == array -22805 81 7/subop/compare *(eax+4) 3/imm32/array-type-id # Type-tree-value -22806 0f 94/set-if-= %al -22807 81 4/subop/and %eax 0xff/imm32 -22808 eb/jump $is-mu-array?:end/disp8 -22809 $is-mu-array?:return-false: -22810 b8/copy-to-eax 0/imm32/false -22811 $is-mu-array?:end: -22812 # . restore registers -22813 59/pop-to-ecx -22814 # . epilogue -22815 89/<- %esp 5/r32/ebp -22816 5d/pop-to-ebp -22817 c3/return -22818 -22819 # size of a statically allocated array where the size is part of the type expression -22820 size-of-array: # a: (addr type-tree) -> result/eax: int -22821 # . prologue -22822 55/push-ebp -22823 89/<- %ebp 4/r32/esp -22824 # . save registers -22825 51/push-ecx -22826 52/push-edx -22827 # -22828 8b/-> *(ebp+8) 1/r32/ecx -22829 # TODO: assert that a->left is 'array' -22830 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -22831 89/<- %ecx 0/r32/eax -22832 # var elem-type/edx: type-id = a->right->left->value -22833 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -22834 8b/-> *(eax+4) 2/r32/edx # Type-tree-value -22835 # TODO: assert that a->right->right->left->value == size -22836 # var array-size/ecx: int = a->right->right->left->value-size -22837 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -22838 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -22839 8b/-> *(eax+8) 1/r32/ecx # Type-tree-value-size -22840 # return 4 + array-size * size-of(elem-type) -22841 (size-of-type-id-as-array-element %edx) # => eax -22842 f7 4/subop/multiply-into-edx-eax %ecx -22843 05/add-to-eax 4/imm32 # for array size -22844 # TODO: check edx for overflow -22845 $size-of-array:end: -22846 # . restore registers -22847 5a/pop-to-edx -22848 59/pop-to-ecx -22849 # . epilogue -22850 89/<- %esp 5/r32/ebp -22851 5d/pop-to-ebp -22852 c3/return -22853 -22854 is-mu-stream?: # t: (addr type-tree) -> result/eax: boolean -22855 # . prologue -22856 55/push-ebp -22857 89/<- %ebp 4/r32/esp -22858 # . save registers -22859 51/push-ecx -22860 # ecx = t -22861 8b/-> *(ebp+8) 1/r32/ecx -22862 # if t->is-atom?, return false -22863 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -22864 75/jump-if-!= $is-mu-stream?:return-false/disp8 -22865 # if !t->left->is-atom?, return false -22866 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -22867 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -22868 74/jump-if-= $is-mu-stream?:return-false/disp8 -22869 # return t->left->value == stream -22870 81 7/subop/compare *(eax+4) 0xb/imm32/stream-type-id # Type-tree-value -22871 0f 94/set-if-= %al -22872 81 4/subop/and %eax 0xff/imm32 -22873 eb/jump $is-mu-stream?:end/disp8 -22874 $is-mu-stream?:return-false: -22875 b8/copy-to-eax 0/imm32/false -22876 $is-mu-stream?:end: -22877 # . restore registers -22878 59/pop-to-ecx -22879 # . epilogue -22880 89/<- %esp 5/r32/ebp -22881 5d/pop-to-ebp -22882 c3/return -22883 -22884 # size of a statically allocated stream where the size is part of the type expression -22885 size-of-stream: # a: (addr type-tree) -> result/eax: int -22886 # . prologue -22887 55/push-ebp -22888 89/<- %ebp 4/r32/esp -22889 # -22890 (size-of-array *(ebp+8)) # assumes we ignore the actual type name 'array' in the type -22891 05/add-to-eax 8/imm32 # for read/write pointers -22892 $size-of-stream:end: -22893 # . epilogue -22894 89/<- %esp 5/r32/ebp -22895 5d/pop-to-ebp -22896 c3/return -22897 -22898 size-of-type-id: # t: type-id -> result/eax: int -22899 # . prologue -22900 55/push-ebp -22901 89/<- %ebp 4/r32/esp -22902 # . save registers -22903 51/push-ecx -22904 # var out/ecx: (handle typeinfo) -22905 68/push 0/imm32 -22906 68/push 0/imm32 -22907 89/<- %ecx 4/r32/esp -22908 # eax = t -22909 8b/-> *(ebp+8) 0/r32/eax -22910 # if t is a literal, return 0 -22911 3d/compare-eax-and 0/imm32 -22912 0f 84/jump-if-= $size-of-type-id:end/disp32 # eax changes type from type-id to int -22913 # if t is a byte, return 4 (because we don't really support non-multiples of 4) -22914 3d/compare-eax-and 8/imm32/byte -22915 { -22916 75/jump-if-!= break/disp8 -22917 b8/copy-to-eax 4/imm32 -22918 eb/jump $size-of-type-id:end/disp8 -22919 } -22920 # if t is a handle, return 8 -22921 3d/compare-eax-and 4/imm32/handle -22922 { -22923 75/jump-if-!= break/disp8 -22924 b8/copy-to-eax 8/imm32 -22925 eb/jump $size-of-type-id:end/disp8 # eax changes type from type-id to int -22926 } -22927 # if t is a slice, return 8 -22928 3d/compare-eax-and 0xc/imm32/slice -22929 { -22930 75/jump-if-!= break/disp8 -22931 b8/copy-to-eax 8/imm32 -22932 eb/jump $size-of-type-id:end/disp8 # eax changes type from type-id to int -22933 } -22934 # if t is a user-defined type, return its size -22935 # TODO: support non-atom type -22936 (find-typeinfo %eax %ecx) -22937 { -22938 81 7/subop/compare *ecx 0/imm32 -22939 74/jump-if-= break/disp8 -22940 $size-of-type-id:user-defined: -22941 (lookup *ecx *(ecx+4)) # => eax -22942 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes -22943 eb/jump $size-of-type-id:end/disp8 -22944 } -22945 # otherwise return the word size -22946 b8/copy-to-eax 4/imm32 -22947 $size-of-type-id:end: -22948 # . reclaim locals -22949 81 0/subop/add %esp 8/imm32 -22950 # . restore registers -22951 59/pop-to-ecx -22952 # . epilogue -22953 89/<- %esp 5/r32/ebp -22954 5d/pop-to-ebp -22955 c3/return -22956 -22957 # Minor violation of our type system since it returns an addr. But we could -22958 # replace it with a handle some time. -22959 # Returns null if t is an atom. -22960 type-tail: # t: (addr type-tree) -> out/eax: (addr type-tree) -22961 # . prologue -22962 55/push-ebp -22963 89/<- %ebp 4/r32/esp -22964 # . save registers -22965 51/push-ecx -22966 # eax = 0 -22967 b8/copy-to-eax 0/imm32 -22968 # ecx = t -22969 8b/-> *(ebp+8) 1/r32/ecx -22970 $type-tail:check-atom: -22971 # if t->is-atom? return 0 -22972 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom -22973 0f 85/jump-if-!= $type-tail:end/disp32 -22974 # var tail = t->right -22975 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -22976 89/<- %ecx 0/r32/eax -22977 $type-tail:check-singleton: -22978 # if (tail->right == 0) return tail->left -22979 { -22980 81 7/subop/compare *(ecx+0xc) 0/imm32 # Type-tree-right -22981 75/jump-if-!= break/disp8 -22982 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -22983 e9/jump $type-tail:end/disp32 -22984 } -22985 # if tail->right->left is an array-capacity, return tail->left -22986 { -22987 $type-tail:check-array-capacity: -22988 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -22989 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -22990 75/jump-if-!= break/disp8 -22991 $type-tail:check-array-capacity-1: -22992 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -22993 3d/compare-eax-and 0/imm32 -22994 74/jump-if-= break/disp8 -22995 $type-tail:check-array-capacity-2: -22996 (is-simple-mu-type? %eax 9) # array-capacity => eax -22997 3d/compare-eax-and 0/imm32/false -22998 74/jump-if-= break/disp8 -22999 $type-tail:array-capacity: -23000 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -23001 eb/jump $type-tail:end/disp8 -23002 } -23003 $type-tail:check-compound-left: -23004 # if !tail->left->is-atom? return tail->left -23005 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -23006 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -23007 74/jump-if-= $type-tail:end/disp8 -23008 $type-tail:return-tail: -23009 # return tail -23010 89/<- %eax 1/r32/ecx -23011 $type-tail:end: -23012 # . restore registers -23013 59/pop-to-ecx -23014 # . epilogue -23015 89/<- %esp 5/r32/ebp -23016 5d/pop-to-ebp -23017 c3/return -23018 -23019 type-equal?: # a: (addr type-tree), b: (addr type-tree) -> result/eax: boolean -23020 # . prologue -23021 55/push-ebp -23022 89/<- %ebp 4/r32/esp -23023 # . save registers -23024 51/push-ecx -23025 52/push-edx -23026 53/push-ebx -23027 # ecx = a -23028 8b/-> *(ebp+8) 1/r32/ecx -23029 # edx = b -23030 8b/-> *(ebp+0xc) 2/r32/edx -23031 $type-equal?:compare-addr: -23032 # if (a == b) return true -23033 8b/-> %ecx 0/r32/eax # Var-type -23034 39/compare %edx 0/r32/eax # Var-type -23035 b8/copy-to-eax 1/imm32/true -23036 0f 84/jump-if-= $type-equal?:end/disp32 -23037 $type-equal?:compare-null-a: -23038 # if (a == 0) return false -23039 b8/copy-to-eax 0/imm32/false -23040 81 7/subop/compare %ecx 0/imm32 -23041 0f 84/jump-if-= $type-equal?:end/disp32 -23042 $type-equal?:compare-null-b: -23043 # if (b == 0) return false -23044 81 7/subop/compare %edx 0/imm32 -23045 0f 84/jump-if-= $type-equal?:end/disp32 -23046 $type-equal?:compare-atom-state: -23047 # if (a->is-atom? != b->is-atom?) return false -23048 8b/-> *ecx 3/r32/ebx # Type-tree-is-atom -23049 39/compare *edx 3/r32/ebx # Type-tree-is-atom -23050 b8/copy-to-eax 0/imm32/false -23051 0f 85/jump-if-!= $type-equal?:end/disp32 -23052 # if a->is-atom? return (a->value == b->value) -23053 { -23054 $type-equal?:check-atom: -23055 81 7/subop/compare %ebx 0/imm32/false -23056 74/jump-if-= break/disp8 -23057 $type-equal?:is-atom: -23058 8b/-> *(ecx+4) 0/r32/eax # Type-tree-value -23059 39/compare *(edx+4) 0/r32/eax # Type-tree-value -23060 0f 94/set-if-= %al -23061 81 4/subop/and %eax 0xff/imm32 -23062 e9/jump $type-equal?:end/disp32 -23063 } -23064 $type-equal?:check-left: -23065 # if (!type-equal?(a->left, b->left)) return false -23066 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax -23067 89/<- %ebx 0/r32/eax -23068 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax -23069 (type-equal? %eax %ebx) # => eax -23070 3d/compare-eax-and 0/imm32/false -23071 74/jump-if-= $type-equal?:end/disp8 -23072 $type-equal?:check-right: -23073 # return type-equal?(a->right, b->right) -23074 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax -23075 89/<- %ebx 0/r32/eax -23076 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax -23077 (type-equal? %eax %ebx) # => eax -23078 $type-equal?:end: -23079 # . restore registers -23080 5b/pop-to-ebx -23081 5a/pop-to-edx -23082 59/pop-to-ecx -23083 # . epilogue -23084 89/<- %esp 5/r32/ebp -23085 5d/pop-to-ebp -23086 c3/return -23087 -23088 ####################################################### -23089 # Code-generation -23090 ####################################################### -23091 -23092 == data -23093 -23094 # Global state added to each var record when performing code-generation. -23095 Curr-local-stack-offset: # (addr int) -23096 0/imm32 -23097 -23098 == code -23099 -23100 emit-subx: # out: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) -23101 # . prologue -23102 55/push-ebp -23103 89/<- %ebp 4/r32/esp -23104 # . save registers -23105 50/push-eax -23106 # var curr/eax: (addr function) = *Program->functions -23107 (lookup *_Program-functions *_Program-functions->payload) # => eax -23108 { -23109 # if (curr == null) break -23110 3d/compare-eax-and 0/imm32 -23111 0f 84/jump-if-= break/disp32 -23112 (emit-subx-function *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10)) -23113 # curr = lookup(curr->next) -23114 (lookup *(eax+0x20) *(eax+0x24)) # Function-next Function-next => eax -23115 e9/jump loop/disp32 -23116 } -23117 $emit-subx:end: -23118 # . restore registers -23119 58/pop-to-eax -23120 # . epilogue -23121 89/<- %esp 5/r32/ebp -23122 5d/pop-to-ebp -23123 c3/return -23124 -23125 emit-subx-function: # out: (addr buffered-file), f: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -23126 # . prologue -23127 55/push-ebp -23128 89/<- %ebp 4/r32/esp -23129 # some preprocessing -23130 (populate-mu-type-offsets-in-inouts *(ebp+0xc)) -23131 # . save registers -23132 50/push-eax -23133 51/push-ecx -23134 52/push-edx -23135 # initialize some global state -23136 c7 0/subop/copy *Curr-block-depth 1/imm32 # Important: keep this in sync with the parse phase -23137 c7 0/subop/copy *Curr-local-stack-offset 0/imm32 -23138 # ecx = f -23139 8b/-> *(ebp+0xc) 1/r32/ecx -23140 # var vars/edx: (stack (addr var) 256) -23141 81 5/subop/subtract %esp 0xc00/imm32 -23142 68/push 0xc00/imm32/size -23143 68/push 0/imm32/top -23144 89/<- %edx 4/r32/esp -23145 # var name/eax: (addr array byte) = lookup(f->name) -23146 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax -23147 # -23148 (write-buffered *(ebp+8) %eax) -23149 (write-buffered *(ebp+8) ":\n") -23150 (emit-subx-prologue *(ebp+8)) -23151 # var body/eax: (addr block) = lookup(f->body) -23152 (lookup *(ecx+0x18) *(ecx+0x1c)) # Function-body Function-body => eax -23153 # -23154 (emit-subx-block *(ebp+8) %eax %edx *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -23155 (emit-subx-epilogue *(ebp+8)) -23156 # TODO: validate that *Curr-block-depth and *Curr-local-stack-offset have -23157 # been cleaned up -23158 $emit-subx-function:end: -23159 # . reclaim locals -23160 81 0/subop/add %esp 0xc08/imm32 -23161 # . restore registers -23162 5a/pop-to-edx -23163 59/pop-to-ecx -23164 58/pop-to-eax -23165 # . epilogue -23166 89/<- %esp 5/r32/ebp -23167 5d/pop-to-ebp -23168 c3/return -23169 -23170 populate-mu-type-offsets-in-inouts: # f: (addr function) -23171 # . prologue -23172 55/push-ebp -23173 89/<- %ebp 4/r32/esp -23174 # . save registers -23175 50/push-eax -23176 51/push-ecx -23177 52/push-edx -23178 53/push-ebx -23179 57/push-edi -23180 # var next-offset/edx: int = 8 -23181 ba/copy-to-edx 8/imm32 -23182 # var curr/ecx: (addr list var) = lookup(f->inouts) -23183 8b/-> *(ebp+8) 1/r32/ecx -23184 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax -23185 89/<- %ecx 0/r32/eax -23186 { -23187 $populate-mu-type-offsets-in-inouts:loop: -23188 81 7/subop/compare %ecx 0/imm32 -23189 74/jump-if-= break/disp8 -23190 # var v/ebx: (addr var) = lookup(curr->value) -23191 (lookup *ecx *(ecx+4)) # List-value List-value => eax -23192 89/<- %ebx 0/r32/eax -23193 #? (lookup *ebx *(ebx+4)) -23194 #? (write-buffered Stderr "setting offset of fn inout ") -23195 #? (write-buffered Stderr %eax) -23196 #? (write-buffered Stderr "@") -23197 #? (write-int32-hex-buffered Stderr %ebx) -23198 #? (write-buffered Stderr " to ") -23199 #? (write-int32-hex-buffered Stderr %edx) -23200 #? (write-buffered Stderr Newline) -23201 #? (flush Stderr) -23202 # v->offset = next-offset -23203 89/<- *(ebx+0x14) 2/r32/edx # Var-offset -23204 # next-offset += size-of(v) -23205 (size-of %ebx) # => eax -23206 01/add-to %edx 0/r32/eax -23207 # curr = lookup(curr->next) -23208 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -23209 89/<- %ecx 0/r32/eax -23210 # -23211 eb/jump loop/disp8 -23212 } -23213 $populate-mu-type-offsets-in-inouts:end: -23214 # . restore registers -23215 5f/pop-to-edi -23216 5b/pop-to-ebx -23217 5a/pop-to-edx -23218 59/pop-to-ecx -23219 58/pop-to-eax -23220 # . epilogue -23221 89/<- %esp 5/r32/ebp -23222 5d/pop-to-ebp -23223 c3/return -23224 -23225 emit-subx-stmt-list: # out: (addr buffered-file), stmts: (addr list stmt), vars: (addr stack live-var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -23226 # . prologue -23227 55/push-ebp -23228 89/<- %ebp 4/r32/esp -23229 # . save registers -23230 50/push-eax -23231 51/push-ecx -23232 53/push-ebx -23233 56/push-esi -23234 # esi = stmts -23235 8b/-> *(ebp+0xc) 6/r32/esi -23236 # -23237 { -23238 $emit-subx-stmt-list:loop: -23239 81 7/subop/compare %esi 0/imm32 -23240 0f 84/jump-if-= break/disp32 -23241 # var curr-stmt/ecx: (addr stmt) = lookup(stmts->value) -23242 (lookup *esi *(esi+4)) # List-value List-value => eax -23243 89/<- %ecx 0/r32/eax -23244 { -23245 $emit-subx-stmt-list:check-for-block: -23246 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag -23247 75/jump-if-!= break/disp8 -23248 $emit-subx-stmt-list:block: -23249 (emit-subx-block *(ebp+8) %ecx *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -23250 } -23251 { -23252 $emit-subx-stmt-list:check-for-stmt: -23253 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag -23254 0f 85/jump-if-!= break/disp32 -23255 $emit-subx-stmt-list:stmt1: -23256 { -23257 (is-mu-branch? %ecx) # => eax -23258 3d/compare-eax-and 0/imm32/false -23259 0f 84/jump-if-= break/disp32 -23260 $emit-subx-stmt-list:branch-stmt: -23261 +-- 25 lines: # unconditional return ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -23286 +-- 27 lines: # unconditional loops ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -23313 +-- 16 lines: # unconditional breaks ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -23329 +-- 38 lines: # simple conditional branches without a target ----------------------------------------------------------------------------------------------------------------------------------------------------- -23367 +-- 19 lines: # conditional branches with an explicit target ----------------------------------------------------------------------------------------------------------------------------------------------------- -23386 } -23387 $emit-subx-stmt-list:1-to-1: -23388 (emit-subx-stmt *(ebp+8) %ecx Primitives *(ebp+0x18) *(ebp+0x1c)) -23389 e9/jump $emit-subx-stmt-list:continue/disp32 -23390 } -23391 { -23392 $emit-subx-stmt-list:check-for-var-def: -23393 81 7/subop/compare *ecx 2/imm32/var-def # Stmt-tag -23394 75/jump-if-!= break/disp8 -23395 $emit-subx-stmt-list:var-def: -23396 (emit-subx-var-def *(ebp+8) %ecx) -23397 (push *(ebp+0x10) *(ecx+4)) # Vardef-var -23398 (push *(ebp+0x10) *(ecx+8)) # Vardef-var -23399 (push *(ebp+0x10) 0) # Live-var-register-spilled = 0 for vars on the stack -23400 # -23401 eb/jump $emit-subx-stmt-list:continue/disp8 -23402 } -23403 { -23404 $emit-subx-stmt-list:check-for-reg-var-def: -23405 81 7/subop/compare *ecx 3/imm32/reg-var-def # Stmt-tag -23406 0f 85/jump-if-!= break/disp32 -23407 $emit-subx-stmt-list:reg-var-def: -23408 # TODO: ensure that there's exactly one output -23409 (push-output-and-maybe-emit-spill *(ebp+8) %ecx *(ebp+0x10) %esi *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -23410 # emit the instruction as usual -23411 (emit-subx-stmt *(ebp+8) %ecx Primitives *(ebp+0x18) *(ebp+0x1c)) -23412 # -23413 eb/jump $emit-subx-stmt-list:continue/disp8 -23414 } -23415 $emit-subx-stmt-list:continue: -23416 # TODO: raise an error on unrecognized Stmt-tag -23417 (lookup *(esi+8) *(esi+0xc)) # List-next List-next => eax -23418 89/<- %esi 0/r32/eax -23419 e9/jump loop/disp32 -23420 } -23421 $emit-subx-stmt-list:emit-cleanup: -23422 (emit-cleanup-code-until-depth *(ebp+8) *(ebp+0x10) *Curr-block-depth) -23423 $emit-subx-stmt-list:clean-up: -23424 (clean-up-stack-offset-state *(ebp+0x10) *Curr-block-depth) -23425 (clean-up-blocks *(ebp+0x10) *Curr-block-depth *(ebp+0x14)) -23426 $emit-subx-stmt-list:end: -23427 # . restore registers -23428 5e/pop-to-esi -23429 5b/pop-to-ebx -23430 59/pop-to-ecx -23431 58/pop-to-eax -23432 # . epilogue -23433 89/<- %esp 5/r32/ebp -23434 5d/pop-to-ebp -23435 c3/return -23436 -23437 # 'later-stmts' includes 'stmt', but will behave the same even without it; reg-var-def stmts are guaranteed not to write to function outputs. -23438 push-output-and-maybe-emit-spill: # out: (addr buffered-file), stmt: (addr reg-var-def), vars: (addr stack (handle var)), later-stmts: (addr list stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -23439 # . prologue -23440 55/push-ebp -23441 89/<- %ebp 4/r32/esp -23442 # . save registers -23443 50/push-eax -23444 51/push-ecx -23445 52/push-edx -23446 # ecx = stmt -23447 8b/-> *(ebp+0xc) 1/r32/ecx -23448 # var sv/eax: (addr stmt-var) = lookup(curr-stmt->outputs) -23449 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax -23450 # TODO: assert !sv->is-deref? -23451 # var v/ecx: (addr var) = lookup(sv->value) -23452 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -23453 89/<- %ecx 0/r32/eax -23454 # v->block-depth = *Curr-block-depth -23455 8b/-> *Curr-block-depth 0/r32/eax -23456 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth -23457 #? (write-buffered Stderr "var ") -23458 #? (lookup *ecx *(ecx+4)) -23459 #? (write-buffered Stderr %eax) -23460 #? (write-buffered Stderr " at depth ") -23461 #? (write-int32-hex-buffered Stderr *(ecx+0x10)) -23462 #? (write-buffered Stderr Newline) -23463 #? (flush Stderr) -23464 # ensure that v is in a register -23465 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -23466 0f 84/jump-if-= $push-output-and-maybe-emit-spill:abort/disp32 -23467 # var emit-spill?/edx: boolean = not-yet-spilled-this-block? && will-not-write-some-register?(fn) -23468 (not-yet-spilled-this-block? %ecx *(ebp+0x10)) # => eax -23469 89/<- %edx 0/r32/eax -23470 3d/compare-eax-and 0/imm32/false -23471 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 -23472 (will-not-write-some-register? %ecx *(ebp+0x14) *(ebp+0x18)) # => eax -23473 89/<- %edx 0/r32/eax -23474 # check emit-spill? -23475 3d/compare-eax-and 0/imm32/false -23476 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 -23477 # TODO: assert(size-of(output) == 4) -23478 # *Curr-local-stack-offset -= 4 -23479 81 5/subop/subtract *Curr-local-stack-offset 4/imm32 -23480 # emit spill -23481 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax -23482 (emit-push-register *(ebp+8) %eax) -23483 $push-output-and-maybe-emit-spill:push: -23484 8b/-> *(ebp+0xc) 1/r32/ecx -23485 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax -23486 # push(vars, {sv->value, emit-spill?}) -23487 (push *(ebp+0x10) *eax) # Stmt-var-value -23488 (push *(ebp+0x10) *(eax+4)) # Stmt-var-value -23489 (push *(ebp+0x10) %edx) -23490 $push-output-and-maybe-emit-spill:end: -23491 # . restore registers -23492 5a/pop-to-edx -23493 59/pop-to-ecx -23494 58/pop-to-eax -23495 # . epilogue -23496 89/<- %esp 5/r32/ebp -23497 5d/pop-to-ebp -23498 c3/return -23499 -23500 $push-output-and-maybe-emit-spill:abort: -23501 # error("var '" var->name "' initialized from an instruction must live in a register\n") -23502 (write-buffered *(ebp+0x1c) "var '") -23503 (write-buffered *(ebp+0x1c) *eax) # Var-name -23504 (write-buffered *(ebp+0x1c) "' initialized from an instruction must live in a register\n") -23505 (flush *(ebp+0x1c)) -23506 (stop *(ebp+0x20) 1) -23507 # never gets here +22551 $check-mu-populate-stream-stmt:error-invalid-target-type: +22552 (write-buffered *(ebp+0x10) "fn ") +22553 8b/-> *(ebp+0xc) 0/r32/eax +22554 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22555 (write-buffered *(ebp+0x10) %eax) +22556 (write-buffered *(ebp+0x10) ": stmt populate-stream: first inout '") +22557 (lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax +22558 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22559 (write-buffered *(ebp+0x10) %eax) +22560 (write-buffered *(ebp+0x10) "' must have type (addr handle stream ...)\n") +22561 (flush *(ebp+0x10)) +22562 (stop *(ebp+0x14) 1) +22563 # never gets here +22564 +22565 $check-mu-populate-stream-stmt:error-invalid-length-type: +22566 (write-buffered *(ebp+0x10) "fn ") +22567 8b/-> *(ebp+0xc) 0/r32/eax +22568 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22569 (write-buffered *(ebp+0x10) %eax) +22570 (write-buffered *(ebp+0x10) ": stmt populate-stream: second inout '") +22571 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +22572 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22573 (write-buffered *(ebp+0x10) %eax) +22574 (write-buffered *(ebp+0x10) "' must be an int\n") +22575 (flush *(ebp+0x10)) +22576 (stop *(ebp+0x14) 1) +22577 # never gets here +22578 +22579 check-mu-read-from-stream-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +22580 # . prologue +22581 55/push-ebp +22582 89/<- %ebp 4/r32/esp +22583 # . save registers +22584 50/push-eax +22585 51/push-ecx +22586 52/push-edx +22587 53/push-ebx +22588 56/push-esi +22589 57/push-edi +22590 # esi = stmt +22591 8b/-> *(ebp+8) 6/r32/esi +22592 # - check for 0 inouts +22593 # var base/ecx: (addr var) = stmt->inouts->value +22594 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22595 $check-mu-read-from-stream-stmt:check-no-inouts: +22596 3d/compare-eax-and 0/imm32 +22597 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-too-few-inouts/disp32 +22598 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +22599 89/<- %ecx 0/r32/eax +22600 # - check base type is (addr stream T) +22601 # var base-type/ebx: (addr type-tree) = lookup(base->type) +22602 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +22603 89/<- %ebx 0/r32/eax +22604 $check-mu-read-from-stream-stmt:check-base-is-compound: +22605 # if base-type is an atom, abort +22606 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +22607 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-invalid-base-type/disp32 +22608 $check-mu-read-from-stream-stmt:check-base-is-addr: +22609 # if type->left not addr, abort +22610 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +22611 (is-simple-mu-type? %eax 2) # addr => eax +22612 3d/compare-eax-and 0/imm32/false +22613 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-invalid-base-type/disp32 +22614 $check-mu-read-from-stream-stmt:check-base-is-addr-to-stream: +22615 # base-type = base-type->right +22616 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22617 89/<- %ebx 0/r32/eax +22618 # ensure base-type->left == stream +22619 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22620 (is-simple-mu-type? %eax 0xb) # stream => eax +22621 3d/compare-eax-and 0/imm32/false +22622 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-invalid-base-type/disp32 +22623 # - check target type is (addr T) +22624 # var target/ecx: (addr stmt-var) = stmt->inouts->next->value +22625 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22626 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +22627 $check-mu-read-from-stream-stmt:check-single-inout: +22628 3d/compare-eax-and 0/imm32 +22629 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-too-few-inouts/disp32 +22630 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +22631 89/<- %ecx 0/r32/eax +22632 # var target-type/edx: (addr type-tree) +22633 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +22634 89/<- %edx 0/r32/eax +22635 # if target-type is an atom, it must be a literal or int +22636 $check-mu-read-from-stream-stmt:check-target-is-compound: +22637 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom +22638 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-target-type-not-address/disp32 +22639 $check-mu-read-from-stream-stmt:check-target-type: +22640 # target type must start with (addr ...) +22641 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +22642 (is-simple-mu-type? %eax 2) # addr => eax +22643 3d/compare-eax-and 0/imm32/false +22644 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-target-type-not-address/disp32 +22645 # if tail(base-type) != tail(target-type) abort +22646 (type-tail %ebx) # => eax +22647 89/<- %ebx 0/r32/eax +22648 (type-tail %edx) # => eax +22649 (type-equal? %ebx %eax) # => eax +22650 3d/compare-eax-and 0/imm32/false +22651 0f 84/jump-if-= $check-mu-read-from-stream-stmt:error-invalid-target-type/disp32 +22652 $check-mu-read-from-stream-stmt:check-too-many-inouts: +22653 # - check for too many inouts +22654 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22655 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +22656 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +22657 3d/compare-eax-and 0/imm32/false +22658 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-too-many-inouts/disp32 +22659 $check-mu-read-from-stream-stmt:check-unexpected-output: +22660 # - check for any output +22661 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +22662 3d/compare-eax-and 0/imm32/false +22663 0f 85/jump-if-!= $check-mu-read-from-stream-stmt:error-unexpected-output/disp32 +22664 $check-mu-read-from-stream-stmt:end: +22665 # . restore registers +22666 5f/pop-to-edi +22667 5e/pop-to-esi +22668 5b/pop-to-ebx +22669 5a/pop-to-edx +22670 59/pop-to-ecx +22671 58/pop-to-eax +22672 # . epilogue +22673 89/<- %esp 5/r32/ebp +22674 5d/pop-to-ebp +22675 c3/return +22676 +22677 $check-mu-read-from-stream-stmt:error-invalid-base-type: +22678 (write-buffered *(ebp+0x10) "fn ") +22679 8b/-> *(ebp+0xc) 0/r32/eax +22680 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22681 (write-buffered *(ebp+0x10) %eax) +22682 (write-buffered *(ebp+0x10) ": stmt read-from-stream: var '") +22683 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +22684 (write-buffered *(ebp+0x10) %eax) +22685 (write-buffered *(ebp+0x10) "' must be an addr to a stream\n") +22686 (flush *(ebp+0x10)) +22687 (stop *(ebp+0x14) 1) +22688 # never gets here +22689 +22690 $check-mu-read-from-stream-stmt:error-too-few-inouts: +22691 (write-buffered *(ebp+0x10) "fn ") +22692 8b/-> *(ebp+0xc) 0/r32/eax +22693 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22694 (write-buffered *(ebp+0x10) %eax) +22695 (write-buffered *(ebp+0x10) ": stmt read-from-stream: too few inouts (2 required)\n") +22696 (flush *(ebp+0x10)) +22697 (stop *(ebp+0x14) 1) +22698 # never gets here +22699 +22700 $check-mu-read-from-stream-stmt:error-target-type-not-address: +22701 (write-buffered *(ebp+0x10) "fn ") +22702 8b/-> *(ebp+0xc) 0/r32/eax +22703 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22704 (write-buffered *(ebp+0x10) %eax) +22705 (write-buffered *(ebp+0x10) ": stmt read-from-stream: target '") +22706 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +22707 (write-buffered *(ebp+0x10) %eax) +22708 (write-buffered *(ebp+0x10) "' must be an addr\n") +22709 (flush *(ebp+0x10)) +22710 (stop *(ebp+0x14) 1) +22711 # never gets here +22712 +22713 $check-mu-read-from-stream-stmt:error-invalid-target-type: +22714 (write-buffered *(ebp+0x10) "fn ") +22715 8b/-> *(ebp+0xc) 0/r32/eax +22716 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22717 (write-buffered *(ebp+0x10) %eax) +22718 (write-buffered *(ebp+0x10) ": stmt read-from-stream: second inout '") +22719 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +22720 (write-buffered *(ebp+0x10) %eax) +22721 (write-buffered *(ebp+0x10) "' does not have the right type\n") +22722 (flush *(ebp+0x10)) +22723 (stop *(ebp+0x14) 1) +22724 # never gets here +22725 +22726 $check-mu-read-from-stream-stmt:error-too-many-inouts: +22727 (write-buffered *(ebp+0x10) "fn ") +22728 8b/-> *(ebp+0xc) 0/r32/eax +22729 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22730 (write-buffered *(ebp+0x10) %eax) +22731 (write-buffered *(ebp+0x10) ": stmt read-from-stream: too many inouts (2 required)\n") +22732 (flush *(ebp+0x10)) +22733 (stop *(ebp+0x14) 1) +22734 # never gets here +22735 +22736 $check-mu-read-from-stream-stmt:error-unexpected-output: +22737 (write-buffered *(ebp+0x10) "fn ") +22738 8b/-> *(ebp+0xc) 0/r32/eax +22739 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22740 (write-buffered *(ebp+0x10) %eax) +22741 (write-buffered *(ebp+0x10) ": stmt read-from-stream: unexpected output\n") +22742 (flush *(ebp+0x10)) +22743 (stop *(ebp+0x14) 1) +22744 # never gets here +22745 +22746 check-mu-write-to-stream-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +22747 # . prologue +22748 55/push-ebp +22749 89/<- %ebp 4/r32/esp +22750 # . save registers +22751 50/push-eax +22752 51/push-ecx +22753 52/push-edx +22754 53/push-ebx +22755 56/push-esi +22756 57/push-edi +22757 # esi = stmt +22758 8b/-> *(ebp+8) 6/r32/esi +22759 # - check for 0 inouts +22760 # var base/ecx: (addr var) = stmt->inouts->value +22761 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22762 $check-mu-write-to-stream-stmt:check-no-inouts: +22763 3d/compare-eax-and 0/imm32 +22764 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-too-few-inouts/disp32 +22765 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +22766 89/<- %ecx 0/r32/eax +22767 # - check base type is (addr stream T) +22768 # var base-type/ebx: (addr type-tree) = lookup(base->type) +22769 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +22770 89/<- %ebx 0/r32/eax +22771 $check-mu-write-to-stream-stmt:check-base-is-compound: +22772 # if base-type is an atom, abort +22773 81 7/subop/compare *ebx 0/imm32/false # Type-tree-is-atom +22774 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-invalid-base-type/disp32 +22775 $check-mu-write-to-stream-stmt:check-base-is-addr: +22776 # if type->left not addr, abort +22777 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +22778 (is-simple-mu-type? %eax 2) # addr => eax +22779 3d/compare-eax-and 0/imm32/false +22780 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-invalid-base-type/disp32 +22781 $check-mu-write-to-stream-stmt:check-base-is-addr-to-stream: +22782 # base-type = base-type->right +22783 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22784 89/<- %ebx 0/r32/eax +22785 # ensure base-type->left == stream +22786 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +22787 (is-simple-mu-type? %eax 0xb) # stream => eax +22788 3d/compare-eax-and 0/imm32/false +22789 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-invalid-base-type/disp32 +22790 # - check target type is (addr T) +22791 # var target/ecx: (addr stmt-var) = stmt->inouts->next->value +22792 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22793 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +22794 $check-mu-write-to-stream-stmt:check-single-inout: +22795 3d/compare-eax-and 0/imm32 +22796 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-too-few-inouts/disp32 +22797 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +22798 89/<- %ecx 0/r32/eax +22799 # var target-type/edx: (addr type-tree) +22800 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +22801 89/<- %edx 0/r32/eax +22802 # if target-type is an atom, it must be a literal or int +22803 $check-mu-write-to-stream-stmt:check-target-is-compound: +22804 81 7/subop/compare *edx 0/imm32/false # Type-tree-is-atom +22805 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-target-type-not-address/disp32 +22806 $check-mu-write-to-stream-stmt:check-target-type: +22807 # target type must start with (addr ...) +22808 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +22809 (is-simple-mu-type? %eax 2) # addr => eax +22810 3d/compare-eax-and 0/imm32/false +22811 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-target-type-not-address/disp32 +22812 # if tail(base-type) != tail(target-type) abort +22813 (type-tail %ebx) # => eax +22814 89/<- %ebx 0/r32/eax +22815 (type-tail %edx) # => eax +22816 (type-equal? %ebx %eax) # => eax +22817 3d/compare-eax-and 0/imm32/false +22818 0f 84/jump-if-= $check-mu-write-to-stream-stmt:error-invalid-target-type/disp32 +22819 $check-mu-write-to-stream-stmt:check-too-many-inouts: +22820 # - check for too many inouts +22821 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22822 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +22823 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +22824 3d/compare-eax-and 0/imm32/false +22825 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-too-many-inouts/disp32 +22826 $check-mu-write-to-stream-stmt:check-unexpected-output: +22827 # - check for any output +22828 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +22829 3d/compare-eax-and 0/imm32/false +22830 0f 85/jump-if-!= $check-mu-write-to-stream-stmt:error-unexpected-output/disp32 +22831 $check-mu-write-to-stream-stmt:end: +22832 # . restore registers +22833 5f/pop-to-edi +22834 5e/pop-to-esi +22835 5b/pop-to-ebx +22836 5a/pop-to-edx +22837 59/pop-to-ecx +22838 58/pop-to-eax +22839 # . epilogue +22840 89/<- %esp 5/r32/ebp +22841 5d/pop-to-ebp +22842 c3/return +22843 +22844 $check-mu-write-to-stream-stmt:error-invalid-base-type: +22845 (write-buffered *(ebp+0x10) "fn ") +22846 8b/-> *(ebp+0xc) 0/r32/eax +22847 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22848 (write-buffered *(ebp+0x10) %eax) +22849 (write-buffered *(ebp+0x10) ": stmt write-to-stream: var '") +22850 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +22851 (write-buffered *(ebp+0x10) %eax) +22852 (write-buffered *(ebp+0x10) "' must be an addr to a stream\n") +22853 (flush *(ebp+0x10)) +22854 (stop *(ebp+0x14) 1) +22855 # never gets here +22856 +22857 $check-mu-write-to-stream-stmt:error-too-few-inouts: +22858 (write-buffered *(ebp+0x10) "fn ") +22859 8b/-> *(ebp+0xc) 0/r32/eax +22860 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22861 (write-buffered *(ebp+0x10) %eax) +22862 (write-buffered *(ebp+0x10) ": stmt write-to-stream: too few inouts (2 required)\n") +22863 (flush *(ebp+0x10)) +22864 (stop *(ebp+0x14) 1) +22865 # never gets here +22866 +22867 $check-mu-write-to-stream-stmt:error-target-type-not-address: +22868 (write-buffered *(ebp+0x10) "fn ") +22869 8b/-> *(ebp+0xc) 0/r32/eax +22870 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22871 (write-buffered *(ebp+0x10) %eax) +22872 (write-buffered *(ebp+0x10) ": stmt write-to-stream: target '") +22873 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +22874 (write-buffered *(ebp+0x10) %eax) +22875 (write-buffered *(ebp+0x10) "' must be an addr\n") +22876 (flush *(ebp+0x10)) +22877 (stop *(ebp+0x14) 1) +22878 # never gets here +22879 +22880 $check-mu-write-to-stream-stmt:error-invalid-target-type: +22881 (write-buffered *(ebp+0x10) "fn ") +22882 8b/-> *(ebp+0xc) 0/r32/eax +22883 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22884 (write-buffered *(ebp+0x10) %eax) +22885 (write-buffered *(ebp+0x10) ": stmt write-to-stream: second inout '") +22886 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +22887 (write-buffered *(ebp+0x10) %eax) +22888 (write-buffered *(ebp+0x10) "' does not have the right type\n") +22889 (flush *(ebp+0x10)) +22890 (stop *(ebp+0x14) 1) +22891 # never gets here +22892 +22893 $check-mu-write-to-stream-stmt:error-too-many-inouts: +22894 (write-buffered *(ebp+0x10) "fn ") +22895 8b/-> *(ebp+0xc) 0/r32/eax +22896 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22897 (write-buffered *(ebp+0x10) %eax) +22898 (write-buffered *(ebp+0x10) ": stmt write-to-stream: too many inouts (2 required)\n") +22899 (flush *(ebp+0x10)) +22900 (stop *(ebp+0x14) 1) +22901 # never gets here +22902 +22903 $check-mu-write-to-stream-stmt:error-unexpected-output: +22904 (write-buffered *(ebp+0x10) "fn ") +22905 8b/-> *(ebp+0xc) 0/r32/eax +22906 (lookup *eax *(eax+4)) # Function-name Function-name => eax +22907 (write-buffered *(ebp+0x10) %eax) +22908 (write-buffered *(ebp+0x10) ": stmt write-to-stream: unexpected output\n") +22909 (flush *(ebp+0x10)) +22910 (stop *(ebp+0x14) 1) +22911 # never gets here +22912 +22913 check-mu-convert-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +22914 # . prologue +22915 55/push-ebp +22916 89/<- %ebp 4/r32/esp +22917 # . save registers +22918 $check-mu-convert-stmt:end: +22919 # . restore registers +22920 # . epilogue +22921 89/<- %esp 5/r32/ebp +22922 5d/pop-to-ebp +22923 c3/return +22924 +22925 check-mu-call: # stmt: (addr stmt), callee: (addr function), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +22926 # . prologue +22927 55/push-ebp +22928 89/<- %ebp 4/r32/esp +22929 # var type-parameters: (addr table (handle array byte) (addr type-tree) 8) +22930 68/push 0/imm32 +22931 # var type-parameters-storage: (table (handle array byte) (addr type-tree) 8) +22932 81 5/subop/subtract %esp 0x60/imm32 +22933 68/push 0x60/imm32/size +22934 68/push 0/imm32/read +22935 68/push 0/imm32/write +22936 # save a pointer to type-parameters-storage at type-parameters +22937 89/<- *(ebp-4) 4/r32/esp +22938 (clear-stream *(ebp-4)) +22939 # . save registers +22940 50/push-eax +22941 51/push-ecx +22942 52/push-edx +22943 53/push-ebx +22944 56/push-esi +22945 57/push-edi +22946 # esi = stmt +22947 8b/-> *(ebp+8) 6/r32/esi +22948 # edi = callee +22949 8b/-> *(ebp+0xc) 7/r32/edi +22950 # var inouts/ecx: (addr stmt-var) = lookup(stmt->inouts) +22951 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +22952 89/<- %ecx 0/r32/eax +22953 # var expected/edx: (addr list var) = lookup(f->inouts) +22954 (lookup *(edi+8) *(edi+0xc)) # Function-inouts Function-inouts => eax +22955 89/<- %edx 0/r32/eax +22956 { +22957 $check-mu-call:check-for-inouts: +22958 # if (inouts == 0) break +22959 81 7/subop/compare %ecx 0/imm32 +22960 0f 84/jump-if-= break/disp32 +22961 # if (expected == 0) error +22962 81 7/subop/compare %edx 0/imm32 +22963 0f 84/jump-if-= break/disp32 +22964 $check-mu-call:check-null-addr: +22965 # if (inouts->value->name == "0") continue +22966 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +22967 (lookup *eax *(eax+4)) # Var-name Var-name => eax +22968 (string-equal? %eax "0") # => eax +22969 3d/compare-eax-and 0/imm32/false +22970 0f 85/jump-if-!= $check-mu-call:continue-to-next-inout/disp32 +22971 $check-mu-call:check-inout-type: +22972 # var t/ebx: (addr type-tree) = inouts->value->type +22973 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +22974 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22975 89/<- %ebx 0/r32/eax +22976 # if (inouts->is-deref?) t = t->right +22977 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +22978 { +22979 74/jump-if-= break/disp8 +22980 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +22981 89/<- %ebx 0/r32/eax +22982 # if t->right is null, t = t->left +22983 81 7/subop/compare *(ebx+0xc) 0/imm32 # Type-tree-right +22984 75/jump-if-!= break/disp8 +22985 (lookup *(ebx+4) *(ebx+8)) # Type-tree-left Type-tree-left => eax +22986 89/<- %ebx 0/r32/eax +22987 } +22988 # var v2/eax: (addr v) = lookup(expected->value) +22989 (lookup *edx *(edx+4)) # List-value List-value => eax +22990 # var t2/eax: (addr type-tree) = lookup(v2->type) +22991 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +22992 # if (t != t2) error +22993 (type-match? %eax %ebx *(ebp-4)) # => eax +22994 3d/compare-eax-and 0/imm32/false +22995 { +22996 0f 85/jump-if-!= break/disp32 +22997 (write-buffered *(ebp+0x14) "fn ") +22998 8b/-> *(ebp+0x10) 0/r32/eax +22999 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23000 (write-buffered *(ebp+0x14) %eax) +23001 (write-buffered *(ebp+0x14) ": call ") +23002 (lookup *edi *(edi+4)) # Function-name Function-name => eax +23003 (write-buffered *(ebp+0x14) %eax) +23004 (write-buffered *(ebp+0x14) ": type for inout '") +23005 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +23006 (lookup *eax *(eax+4)) # Var-name Var-name => eax +23007 (write-buffered *(ebp+0x14) %eax) +23008 (write-buffered *(ebp+0x14) "' is not right\n") +23009 (flush *(ebp+0x14)) +23010 (stop *(ebp+0x18) 1) +23011 } +23012 $check-mu-call:continue-to-next-inout: +23013 # inouts = lookup(inouts->next) +23014 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax +23015 89/<- %ecx 0/r32/eax +23016 # expected = lookup(expected->next) +23017 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax +23018 89/<- %edx 0/r32/eax +23019 # +23020 e9/jump loop/disp32 +23021 } +23022 $check-mu-call:check-inout-count: +23023 # if (inouts == expected) proceed +23024 39/compare %ecx 2/r32/edx +23025 { +23026 0f 84/jump-if-= break/disp32 +23027 # exactly one of the two is null +23028 # if (inouts == 0) error("too many inouts") +23029 { +23030 81 7/subop/compare %ecx 0/imm32 +23031 0f 84/jump-if-= break/disp32 +23032 (write-buffered *(ebp+0x14) "fn ") +23033 8b/-> *(ebp+0x10) 0/r32/eax +23034 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23035 (write-buffered *(ebp+0x14) %eax) +23036 (write-buffered *(ebp+0x14) ": call ") +23037 (lookup *edi *(edi+4)) # Function-name Function-name => eax +23038 (write-buffered *(ebp+0x14) %eax) +23039 (write-buffered *(ebp+0x14) ": too many inouts\n") +23040 (flush *(ebp+0x14)) +23041 (stop *(ebp+0x18) 1) +23042 } +23043 # if (expected == 0) error("too few inouts") +23044 { +23045 81 7/subop/compare %edx 0/imm32 +23046 0f 84/jump-if-= break/disp32 +23047 (write-buffered *(ebp+0x14) "fn ") +23048 8b/-> *(ebp+0x10) 0/r32/eax +23049 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23050 (write-buffered *(ebp+0x14) %eax) +23051 (write-buffered *(ebp+0x14) ": call ") +23052 (lookup *edi *(edi+4)) # Function-name Function-name => eax +23053 (write-buffered *(ebp+0x14) %eax) +23054 (write-buffered *(ebp+0x14) ": too few inouts\n") +23055 (flush *(ebp+0x14)) +23056 (stop *(ebp+0x18) 1) +23057 } +23058 } +23059 $check-mu-call:check-outputs: +23060 # var outputs/ecx: (addr stmt-var) = lookup(stmt->outputs) +23061 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +23062 89/<- %ecx 0/r32/eax +23063 # var expected/edx: (addr list var) = lookup(f->outputs) +23064 (lookup *(edi+0x10) *(edi+0x14)) # Function-outputs Function-outputs => eax +23065 89/<- %edx 0/r32/eax +23066 { +23067 $check-mu-call:check-for-outputs: +23068 # if (outputs == 0) break +23069 81 7/subop/compare %ecx 0/imm32 +23070 0f 84/jump-if-= break/disp32 +23071 # if (expected == 0) error +23072 81 7/subop/compare %edx 0/imm32 +23073 0f 84/jump-if-= break/disp32 +23074 $check-mu-call:check-output-type: +23075 # var v/eax: (addr v) = lookup(outputs->value) +23076 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +23077 # var t/ebx: (addr type-tree) = lookup(v->type) +23078 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +23079 89/<- %ebx 0/r32/eax +23080 # if (outputs->is-deref?) t = t->right # TODO: check that t->left is an addr +23081 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +23082 { +23083 74/jump-if-= break/disp8 +23084 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +23085 89/<- %ebx 0/r32/eax +23086 } +23087 # var v2/eax: (addr v) = lookup(expected->value) +23088 (lookup *edx *(edx+4)) # List-value List-value => eax +23089 # var t2/eax: (addr type-tree) = lookup(v2->type) +23090 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +23091 # if (t != t2) error +23092 (type-match? %eax %ebx *(ebp-4)) # => eax +23093 3d/compare-eax-and 0/imm32/false +23094 { +23095 0f 85/jump-if-!= break/disp32 +23096 (write-buffered *(ebp+0x14) "fn ") +23097 8b/-> *(ebp+0x10) 0/r32/eax +23098 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23099 (write-buffered *(ebp+0x14) %eax) +23100 (write-buffered *(ebp+0x14) ": call ") +23101 (lookup *edi *(edi+4)) # Function-name Function-name => eax +23102 (write-buffered *(ebp+0x14) %eax) +23103 (write-buffered *(ebp+0x14) ": type for output '") +23104 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +23105 (lookup *eax *(eax+4)) # Var-name Var-name => eax +23106 (write-buffered *(ebp+0x14) %eax) +23107 (write-buffered *(ebp+0x14) "' is not right\n") +23108 (flush *(ebp+0x14)) +23109 (stop *(ebp+0x18) 1) +23110 } +23111 $check-mu-call:check-output-register: +23112 # var v/eax: (addr v) = lookup(outputs->value) +23113 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +23114 # var r/ebx: (addr array byte) = lookup(v->register) +23115 (lookup *(eax+18) *(eax+0x1c)) # Var-register Var-register => eax +23116 89/<- %ebx 0/r32/eax +23117 # if (r == 0) error +23118 3d/compare-eax-and 0/imm32 +23119 { +23120 0f 85/jump-if-!= break/disp32 +23121 (write-buffered *(ebp+0x14) "fn ") +23122 8b/-> *(ebp+0x10) 0/r32/eax +23123 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23124 (write-buffered *(ebp+0x14) %eax) +23125 (write-buffered *(ebp+0x14) ": call ") +23126 (lookup *edi *(edi+4)) # Function-name Function-name => eax +23127 (write-buffered *(ebp+0x14) %eax) +23128 (write-buffered *(ebp+0x14) ": output '") +23129 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +23130 (lookup *eax *(eax+4)) # Var-name Var-name => eax +23131 (write-buffered *(ebp+0x14) %eax) +23132 (write-buffered *(ebp+0x14) "' is not in a register\n") +23133 (flush *(ebp+0x14)) +23134 (stop *(ebp+0x18) 1) +23135 } +23136 # var v2/eax: (addr v) = lookup(expected->value) +23137 (lookup *edx *(edx+4)) # Stmt-var-value Stmt-var-value => eax +23138 # var r2/eax: (addr array byte) = lookup(v2->register) +23139 (lookup *(eax+18) *(eax+0x1c)) # Var-register Var-register => eax +23140 # if (r != r2) error +23141 (string-equal? %eax %ebx) # => eax +23142 3d/compare-eax-and 0/imm32/false +23143 { +23144 0f 85/jump-if-!= break/disp32 +23145 (write-buffered *(ebp+0x14) "fn ") +23146 8b/-> *(ebp+0x10) 0/r32/eax +23147 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23148 (write-buffered *(ebp+0x14) %eax) +23149 (write-buffered *(ebp+0x14) ": call ") +23150 (lookup *edi *(edi+4)) # Function-name Function-name => eax +23151 (write-buffered *(ebp+0x14) %eax) +23152 (write-buffered *(ebp+0x14) ": register for output '") +23153 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +23154 (lookup *eax *(eax+4)) # Var-name Var-name => eax +23155 (write-buffered *(ebp+0x14) %eax) +23156 (write-buffered *(ebp+0x14) "' is not right\n") +23157 (flush *(ebp+0x14)) +23158 (stop *(ebp+0x18) 1) +23159 } +23160 $check-mu-call:continue-to-next-output: +23161 # outputs = lookup(outputs->next) +23162 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax +23163 89/<- %ecx 0/r32/eax +23164 # expected = lookup(expected->next) +23165 (lookup *(edx+8) *(edx+0xc)) # List-next List-next => eax +23166 89/<- %edx 0/r32/eax +23167 # +23168 e9/jump loop/disp32 +23169 } +23170 $check-mu-call:check-output-count: +23171 # if (outputs == expected) proceed +23172 39/compare %ecx 2/r32/edx +23173 { +23174 0f 84/jump-if-= break/disp32 +23175 # exactly one of the two is null +23176 # if (outputs == 0) error("too many outputs") +23177 { +23178 81 7/subop/compare %ecx 0/imm32 +23179 0f 84/jump-if-= break/disp32 +23180 (write-buffered *(ebp+0x14) "fn ") +23181 8b/-> *(ebp+0x10) 0/r32/eax +23182 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23183 (write-buffered *(ebp+0x14) %eax) +23184 (write-buffered *(ebp+0x14) ": call ") +23185 (lookup *edi *(edi+4)) # Function-name Function-name => eax +23186 (write-buffered *(ebp+0x14) %eax) +23187 (write-buffered *(ebp+0x14) ": too many outputs\n") +23188 (flush *(ebp+0x14)) +23189 (stop *(ebp+0x18) 1) +23190 } +23191 # if (expected == 0) error("too few outputs") +23192 { +23193 81 7/subop/compare %edx 0/imm32 +23194 0f 84/jump-if-= break/disp32 +23195 (write-buffered *(ebp+0x14) "fn ") +23196 8b/-> *(ebp+0x10) 0/r32/eax +23197 (lookup *eax *(eax+4)) # Function-name Function-name => eax +23198 (write-buffered *(ebp+0x14) %eax) +23199 (write-buffered *(ebp+0x14) ": call ") +23200 (lookup *edi *(edi+4)) # Function-name Function-name => eax +23201 (write-buffered *(ebp+0x14) %eax) +23202 (write-buffered *(ebp+0x14) ": too few outputs\n") +23203 (flush *(ebp+0x14)) +23204 (stop *(ebp+0x18) 1) +23205 } +23206 } +23207 $check-mu-call:end: +23208 # . restore registers +23209 5f/pop-to-edi +23210 5e/pop-to-esi +23211 5b/pop-to-ebx +23212 5a/pop-to-edx +23213 59/pop-to-ecx +23214 58/pop-to-eax +23215 # . reclaim locals exclusively on the stack +23216 81 0/subop/add %esp 0x70/imm32 +23217 # . epilogue +23218 89/<- %esp 5/r32/ebp +23219 5d/pop-to-ebp +23220 c3/return +23221 +23222 # like type-equal? but takes literals type parameters into account +23223 type-match?: # def: (addr type-tree), call: (addr type-tree), type-parameters: (addr table (handle array byte) (addr type-tree)) -> result/eax: boolean +23224 # . prologue +23225 55/push-ebp +23226 89/<- %ebp 4/r32/esp +23227 # if (call is literal and def is numberlike) return true +23228 { +23229 $type-match?:check-literal-int: +23230 (is-simple-mu-type? *(ebp+0xc) 0) # literal => eax +23231 3d/compare-eax-and 0/imm32/false +23232 74/jump-if-= break/disp8 +23233 (is-mu-numberlike-output? *(ebp+8)) # => eax +23234 3d/compare-eax-and 0/imm32/false +23235 74/jump-if-= break/disp8 +23236 b8/copy-to-eax 1/imm32/true +23237 e9/jump $type-match?:end/disp32 +23238 } +23239 # if (call is literal-string and def is string) return true +23240 { +23241 $type-match?:check-literal-string: +23242 (is-simple-mu-type? *(ebp+0xc) 0x10) # literal-string => eax +23243 3d/compare-eax-and 0/imm32/false +23244 74/jump-if-= break/disp8 +23245 (is-mu-string-type? *(ebp+8)) # => eax +23246 3d/compare-eax-and 0/imm32/false +23247 74/jump-if-= break/disp8 +23248 b8/copy-to-eax 1/imm32/true +23249 e9/jump $type-match?:end/disp32 +23250 } +23251 $type-match?:baseline: +23252 # otherwise fall back +23253 (type-component-match? *(ebp+8) *(ebp+0xc) *(ebp+0x10)) # => eax +23254 $type-match?:end: +23255 # . epilogue +23256 89/<- %esp 5/r32/ebp +23257 5d/pop-to-ebp +23258 c3/return +23259 +23260 type-component-match?: # def: (addr type-tree), call: (addr type-tree), type-parameters: (addr table (handle array byte) (addr type-tree)) -> result/eax: boolean +23261 # . prologue +23262 55/push-ebp +23263 89/<- %ebp 4/r32/esp +23264 # . save registers +23265 51/push-ecx +23266 52/push-edx +23267 53/push-ebx +23268 # ecx = def +23269 8b/-> *(ebp+8) 1/r32/ecx +23270 # edx = call +23271 8b/-> *(ebp+0xc) 2/r32/edx +23272 $type-component-match?:compare-addr: +23273 # if (def == call) return true +23274 8b/-> %ecx 0/r32/eax # Var-type +23275 39/compare %edx 0/r32/eax # Var-type +23276 b8/copy-to-eax 1/imm32/true +23277 0f 84/jump-if-= $type-component-match?:end/disp32 +23278 # if (def == 0) return false +23279 b8/copy-to-eax 0/imm32/false +23280 81 7/subop/compare %ecx 0/imm32 # Type-tree-is-atom +23281 0f 84/jump-if-= $type-component-match?:end/disp32 +23282 # if (call == 0) return false +23283 81 7/subop/compare %edx 0/imm32 # Type-tree-is-atom +23284 0f 84/jump-if-= $type-component-match?:end/disp32 +23285 # if def is a type parameter, just check in type-parameters +23286 { +23287 $type-component-match?:check-type-parameter: +23288 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +23289 74/jump-if-= break/disp8 +23290 81 7/subop/compare *(ecx+4) 0xa/imm32/type-parameter # Type-tree-value +23291 75/jump-if-!= break/disp8 +23292 $type-component-match?:type-parameter: +23293 (type-parameter-match? *(ecx+8) *(ecx+0xc) %edx *(ebp+0x10)) # => eax +23294 e9/jump $type-component-match?:end/disp32 +23295 } +23296 # if def is a list containing just a type parameter, just check in type-parameters +23297 { +23298 $type-component-match?:check-list-type-parameter: +23299 # if def is a list.. +23300 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +23301 75/jump-if-!= break/disp8 +23302 # ..that's a singleton +23303 81 7/subop/compare *(ecx+0xc) 0/imm32 # Type-tree-left +23304 75/jump-if-!= break/disp8 +23305 # ..and whose head is a type parameter +23306 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +23307 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +23308 74/jump-if-= break/disp8 +23309 81 7/subop/compare *(eax+4) 0xa/imm32/type-parameter # Type-tree-value +23310 75/jump-if-!= break/disp8 +23311 $type-component-match?:list-type-parameter: +23312 (type-parameter-match? *(eax+8) *(eax+0xc) %edx *(ebp+0x10)) # => eax +23313 e9/jump $type-component-match?:end/disp32 +23314 } +23315 $type-component-match?:compare-atom-state: +23316 # if (def->is-atom? != call->is-atom?) return false +23317 8b/-> *ecx 3/r32/ebx # Type-tree-is-atom +23318 39/compare *edx 3/r32/ebx # Type-tree-is-atom +23319 b8/copy-to-eax 0/imm32/false +23320 0f 85/jump-if-!= $type-component-match?:end/disp32 +23321 # if def->is-atom? return (def->value == call->value) +23322 { +23323 $type-component-match?:check-atom: +23324 81 7/subop/compare %ebx 0/imm32/false +23325 74/jump-if-= break/disp8 +23326 $type-component-match?:is-atom: +23327 8b/-> *(ecx+4) 0/r32/eax # Type-tree-value +23328 39/compare *(edx+4) 0/r32/eax # Type-tree-value +23329 0f 94/set-if-= %al +23330 81 4/subop/and %eax 0xff/imm32 +23331 e9/jump $type-component-match?:end/disp32 +23332 } +23333 $type-component-match?:check-left: +23334 # if (!type-component-match?(def->left, call->left)) return false +23335 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +23336 89/<- %ebx 0/r32/eax +23337 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +23338 (type-component-match? %ebx %eax *(ebp+0x10)) # => eax +23339 3d/compare-eax-and 0/imm32/false +23340 74/jump-if-= $type-component-match?:end/disp8 +23341 $type-component-match?:check-right: +23342 # return type-component-match?(def->right, call->right) +23343 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +23344 89/<- %ebx 0/r32/eax +23345 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax +23346 (type-component-match? %ebx %eax *(ebp+0x10)) # => eax +23347 $type-component-match?:end: +23348 # . restore registers +23349 5b/pop-to-ebx +23350 5a/pop-to-edx +23351 59/pop-to-ecx +23352 # . epilogue +23353 89/<- %esp 5/r32/ebp +23354 5d/pop-to-ebp +23355 c3/return +23356 +23357 type-parameter-match?: # type-parameter-name: (handle array byte), type: (addr type-tree), type-parameters: (addr table (handle array byte) (addr type-tree)) -> result/eax: boolean +23358 # . prologue +23359 55/push-ebp +23360 89/<- %ebp 4/r32/esp +23361 # . save registers +23362 51/push-ecx +23363 # +23364 (get-or-insert-handle *(ebp+0x14) *(ebp+8) *(ebp+0xc) 0xc) # => eax +23365 # if parameter wasn't saved, save it +23366 { +23367 81 7/subop/compare *eax 0/imm32 +23368 75/jump-if-!= break/disp8 +23369 8b/-> *(ebp+0x10) 1/r32/ecx +23370 89/<- *eax 1/r32/ecx +23371 } +23372 # +23373 (type-equal? *(ebp+0x10) *eax) # => eax +23374 $type-parameter-match?:end: +23375 # . restore registers +23376 59/pop-to-ecx +23377 # . epilogue +23378 89/<- %esp 5/r32/ebp +23379 5d/pop-to-ebp +23380 c3/return +23381 +23382 size-of: # v: (addr var) -> result/eax: int +23383 # . prologue +23384 55/push-ebp +23385 89/<- %ebp 4/r32/esp +23386 # . save registers +23387 51/push-ecx +23388 # var t/ecx: (addr type-tree) = lookup(v->type) +23389 8b/-> *(ebp+8) 1/r32/ecx +23390 #? (write-buffered Stderr "size-of ") +23391 #? (write-int32-hex-buffered Stderr %ecx) +23392 #? (write-buffered Stderr Newline) +23393 #? (write-buffered Stderr "type allocid: ") +23394 #? (write-int32-hex-buffered Stderr *(ecx+8)) +23395 #? (write-buffered Stderr Newline) +23396 #? (flush Stderr) +23397 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +23398 89/<- %ecx 0/r32/eax +23399 # if is-mu-array?(t) return size-of-array(t) +23400 { +23401 (is-mu-array? %ecx) # => eax +23402 3d/compare-eax-and 0/imm32/false +23403 74/jump-if-= break/disp8 +23404 (size-of-array %ecx) # => eax +23405 eb/jump $size-of:end/disp8 +23406 } +23407 # if is-mu-stream?(t) return size-of-stream(t) +23408 { +23409 (is-mu-stream? %ecx) # => eax +23410 3d/compare-eax-and 0/imm32/false +23411 74/jump-if-= break/disp8 +23412 (size-of-stream %ecx) # => eax +23413 eb/jump $size-of:end/disp8 +23414 } +23415 # if (!t->is-atom?) t = lookup(t->left) +23416 { +23417 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +23418 75/jump-if-!= break/disp8 +23419 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +23420 89/<- %ecx 0/r32/eax +23421 } +23422 # TODO: assert t->is-atom? +23423 (size-of-type-id *(ecx+4)) # Type-tree-value => eax +23424 $size-of:end: +23425 # . restore registers +23426 59/pop-to-ecx +23427 # . epilogue +23428 89/<- %esp 5/r32/ebp +23429 5d/pop-to-ebp +23430 c3/return +23431 +23432 size-of-deref: # v: (addr var) -> result/eax: int +23433 # . prologue +23434 55/push-ebp +23435 89/<- %ebp 4/r32/esp +23436 # . save registers +23437 51/push-ecx +23438 # var t/ecx: (addr type-tree) = lookup(v->type) +23439 8b/-> *(ebp+8) 1/r32/ecx +23440 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +23441 89/<- %ecx 0/r32/eax +23442 # TODO: assert(t is an addr) +23443 # t = lookup(t->right) +23444 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +23445 89/<- %ecx 0/r32/eax +23446 # if is-mu-array?(t) return size-of-array(t) +23447 { +23448 (is-mu-array? %ecx) # => eax +23449 3d/compare-eax-and 0/imm32/false +23450 74/jump-if-= break/disp8 +23451 (size-of-array %ecx) # => eax +23452 eb/jump $size-of-deref:end/disp8 +23453 } +23454 # if is-mu-stream?(t) return size-of-stream(t) +23455 { +23456 (is-mu-stream? %ecx) # => eax +23457 3d/compare-eax-and 0/imm32/false +23458 74/jump-if-= break/disp8 +23459 (size-of-stream %ecx) # => eax +23460 eb/jump $size-of-deref:end/disp8 +23461 } +23462 # if (!t->is-atom?) t = lookup(t->left) +23463 { +23464 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +23465 75/jump-if-!= break/disp8 +23466 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +23467 89/<- %ecx 0/r32/eax +23468 } +23469 # TODO: assert t->is-atom? +23470 (size-of-type-id *(ecx+4)) # Type-tree-value => eax +23471 $size-of-deref:end: +23472 # . restore registers +23473 59/pop-to-ecx +23474 # . epilogue +23475 89/<- %esp 5/r32/ebp +23476 5d/pop-to-ebp +23477 c3/return +23478 +23479 is-mu-array?: # t: (addr type-tree) -> result/eax: boolean +23480 # . prologue +23481 55/push-ebp +23482 89/<- %ebp 4/r32/esp +23483 # . save registers +23484 51/push-ecx +23485 # ecx = t +23486 8b/-> *(ebp+8) 1/r32/ecx +23487 # if t->is-atom?, return false +23488 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +23489 75/jump-if-!= $is-mu-array?:return-false/disp8 +23490 # if !t->left->is-atom?, return false +23491 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +23492 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +23493 74/jump-if-= $is-mu-array?:return-false/disp8 +23494 # return t->left->value == array +23495 81 7/subop/compare *(eax+4) 3/imm32/array-type-id # Type-tree-value +23496 0f 94/set-if-= %al +23497 81 4/subop/and %eax 0xff/imm32 +23498 eb/jump $is-mu-array?:end/disp8 +23499 $is-mu-array?:return-false: +23500 b8/copy-to-eax 0/imm32/false +23501 $is-mu-array?:end: +23502 # . restore registers +23503 59/pop-to-ecx +23504 # . epilogue +23505 89/<- %esp 5/r32/ebp +23506 5d/pop-to-ebp +23507 c3/return 23508 -23509 emit-subx-cleanup-and-unconditional-nonlocal-branch: # out: (addr buffered-file), stmt: (addr stmt1), vars: (addr stack live-var) -23510 # . prologue -23511 55/push-ebp -23512 89/<- %ebp 4/r32/esp -23513 # . save registers -23514 50/push-eax +23509 # size of a statically allocated array where the size is part of the type expression +23510 size-of-array: # a: (addr type-tree) -> result/eax: int +23511 # . prologue +23512 55/push-ebp +23513 89/<- %ebp 4/r32/esp +23514 # . save registers 23515 51/push-ecx -23516 # ecx = stmt -23517 8b/-> *(ebp+0xc) 1/r32/ecx -23518 # var target/eax: (addr array byte) = curr-stmt->inouts->value->name -23519 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -23520 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -23521 (lookup *eax *(eax+4)) # Var-name Var-name => eax -23522 # clean up until target block -23523 (emit-cleanup-code-until-target *(ebp+8) *(ebp+0x10) %eax) -23524 # emit jump to target block -23525 (emit-indent *(ebp+8) *Curr-block-depth) -23526 (write-buffered *(ebp+8) "e9/jump ") -23527 (write-buffered *(ebp+8) %eax) -23528 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax -23529 (string-starts-with? %eax "break") -23530 3d/compare-eax-and 0/imm32/false -23531 { -23532 74/jump-if-= break/disp8 -23533 (write-buffered *(ebp+8) ":break/disp32\n") -23534 eb/jump $emit-subx-cleanup-and-unconditional-nonlocal-branch:end/disp8 -23535 } -23536 (write-buffered *(ebp+8) ":loop/disp32\n") -23537 $emit-subx-cleanup-and-unconditional-nonlocal-branch:end: -23538 # . restore registers -23539 59/pop-to-ecx -23540 58/pop-to-eax -23541 # . epilogue -23542 89/<- %esp 5/r32/ebp -23543 5d/pop-to-ebp -23544 c3/return -23545 -23546 emit-outputs: # out: (addr buffered-file), return-stmt: (addr stmt1), fn: (addr function) -23547 # pseudocode: -23548 # for every inout, output in return-stmt, fn->outputs -23549 # if inout is a literal -23550 # c7 0/subop/copy %output inout/imm32 -23551 # otherwise -23552 # 8b/-> inout %output -23553 # -23554 # . prologue -23555 55/push-ebp -23556 89/<- %ebp 4/r32/esp -23557 # . save registers -23558 50/push-eax -23559 51/push-ecx -23560 56/push-esi -23561 57/push-edi -23562 # var curr-inout/esi: (addr stmt-var) = return-stmt->inouts -23563 8b/-> *(ebp+0xc) 0/r32/eax -23564 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -23565 89/<- %esi 0/r32/eax -23566 # var curr-output/edi: (addr list var) = fn->outputs -23567 8b/-> *(ebp+0x10) 0/r32/eax -23568 (lookup *(eax+0x10) *(eax+0x14)) # Function-outputs Function-outputs => eax -23569 89/<- %edi 0/r32/eax -23570 { -23571 $emit-outputs:loop: -23572 81 7/subop/compare %esi 0/imm32 -23573 0f 84/jump-if-= break/disp32 -23574 # emit copy to output register -23575 # var curr-var/ecx = lookup(curr-inout->value) -23576 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax -23577 89/<- %ecx 0/r32/eax -23578 # if curr-var is a literal, emit copy of a literal to the output -23579 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -23580 (is-simple-mu-type? %eax 0) # literal => eax -23581 { -23582 3d/compare-eax-and 0/imm32/false -23583 0f 84/jump-if-= break/disp32 -23584 (emit-indent *(ebp+8) *Curr-block-depth) -23585 (write-buffered *(ebp+8) "c7 0/subop/copy %") -23586 (lookup *edi *(edi+4)) # List-value List-value => eax -23587 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -23588 (write-buffered *(ebp+8) %eax) -23589 (write-buffered *(ebp+8) " ") -23590 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -23591 (write-buffered *(ebp+8) %eax) -23592 (write-buffered *(ebp+8) "/imm32\n") -23593 e9/jump $emit-outputs:continue/disp32 -23594 } -23595 # if the non-literal is a register starting with "x", emit a floating-point copy -23596 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax -23597 { -23598 3d/compare-eax-and 0/imm32 -23599 0f 84/jump-if-= break/disp32 -23600 8a/copy-byte *(eax+4) 0/r32/AL -23601 81 4/subop/and %eax 0xff/imm32 -23602 3d/compare-eax-and 0x78/imm32/x -23603 0f 85/jump-if-!= break/disp32 -23604 (emit-indent *(ebp+8) *Curr-block-depth) -23605 (write-buffered *(ebp+8) "f3 0f 10/->") -23606 (emit-subx-var-as-rm32 *(ebp+8) %esi) -23607 (write-buffered *(ebp+8) " ") -23608 (lookup *edi *(edi+4)) # List-value List-value => eax -23609 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -23610 (get Mu-registers %eax 0xc "Mu-registers") # => eax -23611 (write-int32-hex-buffered *(ebp+8) *eax) -23612 (write-buffered *(ebp+8) "/x32\n") -23613 e9/jump $emit-outputs:continue/disp32 -23614 } -23615 # otherwise emit an integer copy -23616 (emit-indent *(ebp+8) *Curr-block-depth) -23617 (write-buffered *(ebp+8) "8b/->") -23618 (emit-subx-var-as-rm32 *(ebp+8) %esi) -23619 (write-buffered *(ebp+8) " ") -23620 (lookup *edi *(edi+4)) # List-value List-value => eax -23621 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -23622 (get Mu-registers %eax 0xc "Mu-registers") # => eax -23623 (write-int32-hex-buffered *(ebp+8) *eax) -23624 (write-buffered *(ebp+8) "/r32\n") -23625 $emit-outputs:continue: -23626 # curr-inout = curr-inout->next -23627 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -23628 89/<- %esi 0/r32/eax -23629 # curr-output = curr-output->next -23630 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax -23631 89/<- %edi 0/r32/eax -23632 # -23633 e9/jump loop/disp32 +23516 52/push-edx +23517 # +23518 8b/-> *(ebp+8) 1/r32/ecx +23519 # TODO: assert that a->left is 'array' +23520 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +23521 89/<- %ecx 0/r32/eax +23522 # var elem-type/edx: type-id = a->right->left->value +23523 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +23524 8b/-> *(eax+4) 2/r32/edx # Type-tree-value +23525 # TODO: assert that a->right->right->left->value == size +23526 # var array-size/ecx: int = a->right->right->left->value-size +23527 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +23528 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +23529 8b/-> *(eax+8) 1/r32/ecx # Type-tree-value-size +23530 # return 4 + array-size * size-of(elem-type) +23531 (size-of-type-id-as-array-element %edx) # => eax +23532 f7 4/subop/multiply-into-edx-eax %ecx +23533 05/add-to-eax 4/imm32 # for array size +23534 # TODO: check edx for overflow +23535 $size-of-array:end: +23536 # . restore registers +23537 5a/pop-to-edx +23538 59/pop-to-ecx +23539 # . epilogue +23540 89/<- %esp 5/r32/ebp +23541 5d/pop-to-ebp +23542 c3/return +23543 +23544 is-mu-stream?: # t: (addr type-tree) -> result/eax: boolean +23545 # . prologue +23546 55/push-ebp +23547 89/<- %ebp 4/r32/esp +23548 # . save registers +23549 51/push-ecx +23550 # ecx = t +23551 8b/-> *(ebp+8) 1/r32/ecx +23552 # if t->is-atom?, return false +23553 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +23554 75/jump-if-!= $is-mu-stream?:return-false/disp8 +23555 # if !t->left->is-atom?, return false +23556 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +23557 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +23558 74/jump-if-= $is-mu-stream?:return-false/disp8 +23559 # return t->left->value == stream +23560 81 7/subop/compare *(eax+4) 0xb/imm32/stream-type-id # Type-tree-value +23561 0f 94/set-if-= %al +23562 81 4/subop/and %eax 0xff/imm32 +23563 eb/jump $is-mu-stream?:end/disp8 +23564 $is-mu-stream?:return-false: +23565 b8/copy-to-eax 0/imm32/false +23566 $is-mu-stream?:end: +23567 # . restore registers +23568 59/pop-to-ecx +23569 # . epilogue +23570 89/<- %esp 5/r32/ebp +23571 5d/pop-to-ebp +23572 c3/return +23573 +23574 # size of a statically allocated stream where the size is part of the type expression +23575 size-of-stream: # a: (addr type-tree) -> result/eax: int +23576 # . prologue +23577 55/push-ebp +23578 89/<- %ebp 4/r32/esp +23579 # +23580 (size-of-array *(ebp+8)) # assumes we ignore the actual type name 'array' in the type +23581 05/add-to-eax 8/imm32 # for read/write pointers +23582 $size-of-stream:end: +23583 # . epilogue +23584 89/<- %esp 5/r32/ebp +23585 5d/pop-to-ebp +23586 c3/return +23587 +23588 size-of-type-id: # t: type-id -> result/eax: int +23589 # . prologue +23590 55/push-ebp +23591 89/<- %ebp 4/r32/esp +23592 # . save registers +23593 51/push-ecx +23594 # var out/ecx: (handle typeinfo) +23595 68/push 0/imm32 +23596 68/push 0/imm32 +23597 89/<- %ecx 4/r32/esp +23598 # eax = t +23599 8b/-> *(ebp+8) 0/r32/eax +23600 # if t is a literal, return 0 +23601 3d/compare-eax-and 0/imm32 +23602 0f 84/jump-if-= $size-of-type-id:end/disp32 # eax changes type from type-id to int +23603 # if t is a byte, return 4 (because we don't really support non-multiples of 4) +23604 3d/compare-eax-and 8/imm32/byte +23605 { +23606 75/jump-if-!= break/disp8 +23607 b8/copy-to-eax 4/imm32 +23608 eb/jump $size-of-type-id:end/disp8 +23609 } +23610 # if t is a handle, return 8 +23611 3d/compare-eax-and 4/imm32/handle +23612 { +23613 75/jump-if-!= break/disp8 +23614 b8/copy-to-eax 8/imm32 +23615 eb/jump $size-of-type-id:end/disp8 # eax changes type from type-id to int +23616 } +23617 # if t is a slice, return 8 +23618 3d/compare-eax-and 0xc/imm32/slice +23619 { +23620 75/jump-if-!= break/disp8 +23621 b8/copy-to-eax 8/imm32 +23622 eb/jump $size-of-type-id:end/disp8 # eax changes type from type-id to int +23623 } +23624 # if t is a user-defined type, return its size +23625 # TODO: support non-atom type +23626 (find-typeinfo %eax %ecx) +23627 { +23628 81 7/subop/compare *ecx 0/imm32 +23629 74/jump-if-= break/disp8 +23630 $size-of-type-id:user-defined: +23631 (lookup *ecx *(ecx+4)) # => eax +23632 8b/-> *(eax+0xc) 0/r32/eax # Typeinfo-total-size-in-bytes +23633 eb/jump $size-of-type-id:end/disp8 23634 } -23635 $emit-outputs:end: -23636 # . restore registers -23637 5f/pop-to-edi -23638 5e/pop-to-esi -23639 59/pop-to-ecx -23640 58/pop-to-eax -23641 # . epilogue -23642 89/<- %esp 5/r32/ebp -23643 5d/pop-to-ebp -23644 c3/return -23645 -23646 is-mu-branch?: # stmt: (addr stmt1) -> result/eax: boolean -23647 # . prologue -23648 55/push-ebp -23649 89/<- %ebp 4/r32/esp -23650 # . save registers -23651 51/push-ecx -23652 # ecx = lookup(stmt->operation) -23653 8b/-> *(ebp+8) 1/r32/ecx -23654 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax -23655 89/<- %ecx 0/r32/eax -23656 # if (stmt->operation starts with "loop") return true -23657 (string-starts-with? %ecx "loop") # => eax -23658 3d/compare-eax-and 0/imm32/false -23659 75/jump-if-not-equal $is-mu-branch?:end/disp8 -23660 # if (stmt->operation starts with "break") return true -23661 (string-starts-with? %ecx "break") # => eax -23662 3d/compare-eax-and 0/imm32/false -23663 75/jump-if-not-equal $is-mu-branch?:end/disp8 -23664 # otherwise return (stmt->operation starts with "return") -23665 (string-starts-with? %ecx "return") # => eax -23666 $is-mu-branch?:end: -23667 # . restore registers -23668 59/pop-to-ecx -23669 # . epilogue -23670 89/<- %esp 5/r32/ebp -23671 5d/pop-to-ebp -23672 c3/return -23673 -23674 emit-reverse-break: # out: (addr buffered-file), stmt: (addr stmt1) -23675 # . prologue -23676 55/push-ebp -23677 89/<- %ebp 4/r32/esp -23678 # . save registers -23679 50/push-eax -23680 # eax = stmt -23681 8b/-> *(ebp+0xc) 0/r32/eax -23682 # -23683 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -23684 (get Reverse-branch %eax 0x10 "reverse-branch: ") # => eax: (addr handle array byte) -23685 (emit-indent *(ebp+8) *Curr-block-depth) -23686 (lookup *eax *(eax+4)) # => eax -23687 (write-buffered *(ebp+8) %eax) -23688 (write-buffered *(ebp+8) " break/disp32\n") -23689 $emit-reverse-break:end: -23690 # . restore registers -23691 58/pop-to-eax -23692 # . epilogue -23693 89/<- %esp 5/r32/ebp -23694 5d/pop-to-ebp -23695 c3/return -23696 -23697 == data -23698 -23699 # Table from Mu branch instructions to the reverse SubX opcodes for them. -23700 Reverse-branch: # (table (handle array byte) (handle array byte)) -23701 # a table is a stream -23702 0x1c0/imm32/write -23703 0/imm32/read -23704 0x1c0/imm32/size -23705 # data -23706 0x11/imm32/alloc-id _string-break-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 -23707 0x11/imm32/alloc-id _string-loop-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 -23708 0x11/imm32/alloc-id _string-break-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 -23709 0x11/imm32/alloc-id _string-loop-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 -23710 0x11/imm32/alloc-id _string-break-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 -23711 0x11/imm32/alloc-id _string-loop-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 -23712 0x11/imm32/alloc-id _string-break-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 -23713 0x11/imm32/alloc-id _string-loop-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 -23714 0x11/imm32/alloc-id _string-break-if-<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 -23715 0x11/imm32/alloc-id _string-loop-if-<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 -23716 0x11/imm32/alloc-id _string-break-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 -23717 0x11/imm32/alloc-id _string-loop-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 -23718 0x11/imm32/alloc-id _string-break-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 -23719 0x11/imm32/alloc-id _string-loop-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 -23720 0x11/imm32/alloc-id _string-break-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 -23721 0x11/imm32/alloc-id _string-loop-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 -23722 0x11/imm32/alloc-id _string-break-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 -23723 0x11/imm32/alloc-id _string-loop-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 -23724 0x11/imm32/alloc-id _string-break-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 -23725 0x11/imm32/alloc-id _string-loop-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 -23726 0x11/imm32/alloc-id _string-break-if-float</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 -23727 0x11/imm32/alloc-id _string-loop-if-float</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 -23728 0x11/imm32/alloc-id _string-break-if-float>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 -23729 0x11/imm32/alloc-id _string-loop-if-float>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 -23730 0x11/imm32/alloc-id _string-break-if-float<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 -23731 0x11/imm32/alloc-id _string-loop-if-float<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 -23732 0x11/imm32/alloc-id _string-break-if-float>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 -23733 0x11/imm32/alloc-id _string-loop-if-float>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 -23734 -23735 == code -23736 -23737 emit-unconditional-jump-to-depth: # out: (addr buffered-file), vars: (addr stack live-var), depth: int, label-suffix: (addr array byte) -23738 # . prologue -23739 55/push-ebp -23740 89/<- %ebp 4/r32/esp -23741 # . save registers -23742 50/push-eax -23743 51/push-ecx -23744 52/push-edx -23745 53/push-ebx -23746 56/push-esi -23747 # ecx = vars -23748 8b/-> *(ebp+0xc) 1/r32/ecx -23749 # var eax: int = vars->top -23750 8b/-> *ecx 0/r32/eax -23751 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] -23752 8d/copy-address *(ecx+eax-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size -23753 # var min/ecx: (addr handle var) = vars->data -23754 8d/copy-address *(ecx+8) 1/r32/ecx -23755 # edx = depth -23756 8b/-> *(ebp+0x10) 2/r32/edx -23757 { -23758 $emit-unconditional-jump-to-depth:loop: -23759 # if (curr < min) break -23760 39/compare %esi 1/r32/ecx -23761 0f 82/jump-if-addr< break/disp32 -23762 # var v/ebx: (addr var) = lookup(*curr) -23763 (lookup *esi *(esi+4)) # => eax -23764 89/<- %ebx 0/r32/eax -23765 # if (v->block-depth < until-block-depth) break -23766 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth -23767 0f 8c/jump-if-< break/disp32 -23768 { -23769 $emit-unconditional-jump-to-depth:check: -23770 # if v->block-depth != until-block-depth, continue -23771 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth -23772 0f 85/jump-if-!= break/disp32 -23773 $emit-unconditional-jump-to-depth:depth-found: -23774 # if v is not a literal, continue -23775 (size-of %ebx) # => eax -23776 3d/compare-eax-and 0/imm32 -23777 0f 85/jump-if-!= break/disp32 -23778 $emit-unconditional-jump-to-depth:label-found: -23779 # emit unconditional jump, then return -23780 (emit-indent *(ebp+8) *Curr-block-depth) -23781 (write-buffered *(ebp+8) "e9/jump ") -23782 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -23783 (write-buffered *(ebp+8) %eax) -23784 (write-buffered *(ebp+8) ":") -23785 (write-buffered *(ebp+8) *(ebp+0x14)) -23786 (write-buffered *(ebp+8) "/disp32\n") -23787 eb/jump $emit-unconditional-jump-to-depth:end/disp8 -23788 } -23789 # curr -= 12 -23790 81 5/subop/subtract %esi 0xc/imm32 -23791 e9/jump loop/disp32 -23792 } -23793 # TODO: error if no label at 'depth' was found -23794 $emit-unconditional-jump-to-depth:end: -23795 # . restore registers -23796 5e/pop-to-esi -23797 5b/pop-to-ebx -23798 5a/pop-to-edx -23799 59/pop-to-ecx -23800 58/pop-to-eax -23801 # . epilogue -23802 89/<- %esp 5/r32/ebp -23803 5d/pop-to-ebp -23804 c3/return -23805 -23806 # emit clean-up code for 'vars' until some block depth -23807 # doesn't actually modify 'vars' so we need traverse manually inside the stack -23808 emit-cleanup-code-until-depth: # out: (addr buffered-file), vars: (addr stack live-var), until-block-depth: int -23809 # . prologue -23810 55/push-ebp -23811 89/<- %ebp 4/r32/esp -23812 # . save registers -23813 50/push-eax -23814 51/push-ecx -23815 52/push-edx -23816 53/push-ebx -23817 56/push-esi -23818 #? (write-buffered Stderr "--- cleanup\n") -23819 #? (flush Stderr) -23820 # ecx = vars -23821 8b/-> *(ebp+0xc) 1/r32/ecx -23822 # var esi: int = vars->top -23823 8b/-> *ecx 6/r32/esi -23824 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] -23825 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size -23826 # var min/ecx: (addr handle var) = vars->data -23827 81 0/subop/add %ecx 8/imm32 -23828 # edx = until-block-depth -23829 8b/-> *(ebp+0x10) 2/r32/edx -23830 { -23831 $emit-cleanup-code-until-depth:loop: -23832 # if (curr < min) break -23833 39/compare %esi 1/r32/ecx -23834 0f 82/jump-if-addr< break/disp32 -23835 # var v/ebx: (addr var) = lookup(*curr) -23836 (lookup *esi *(esi+4)) # => eax -23837 89/<- %ebx 0/r32/eax -23838 #? (lookup *ebx *(ebx+4)) # Var-name -23839 #? (write-buffered Stderr "var ") -23840 #? (write-buffered Stderr %eax) -23841 #? (write-buffered Stderr Newline) -23842 #? (flush Stderr) -23843 # if (v->block-depth < until-block-depth) break -23844 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth -23845 0f 8c/jump-if-< break/disp32 -23846 # if v is in a register -23847 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register -23848 { -23849 0f 84/jump-if-= break/disp32 -23850 { -23851 $emit-cleanup-code-until-depth:check-for-previous-spill: -23852 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled -23853 3d/compare-eax-and 0/imm32/false -23854 74/jump-if-= break/disp8 -23855 $emit-cleanup-code-until-depth:reclaim-var-in-register: -23856 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -23857 (emit-pop-register *(ebp+8) %eax) -23858 } -23859 eb/jump $emit-cleanup-code-until-depth:continue/disp8 -23860 } -23861 # otherwise v is on the stack -23862 { -23863 75/jump-if-!= break/disp8 -23864 $emit-cleanup-code-until-depth:var-on-stack: -23865 (size-of %ebx) # => eax -23866 # don't emit code for labels -23867 3d/compare-eax-and 0/imm32 -23868 74/jump-if-= break/disp8 -23869 $emit-cleanup-code-until-depth:reclaim-var-on-stack: -23870 (emit-indent *(ebp+8) *Curr-block-depth) -23871 (write-buffered *(ebp+8) "81 0/subop/add %esp ") -23872 (write-int32-hex-buffered *(ebp+8) %eax) -23873 (write-buffered *(ebp+8) "/imm32\n") -23874 } -23875 $emit-cleanup-code-until-depth:continue: -23876 # curr -= 12 -23877 81 5/subop/subtract %esi 0xc/imm32 -23878 e9/jump loop/disp32 -23879 } -23880 $emit-cleanup-code-until-depth:end: -23881 # . restore registers -23882 5e/pop-to-esi -23883 5b/pop-to-ebx -23884 5a/pop-to-edx -23885 59/pop-to-ecx -23886 58/pop-to-eax -23887 # . epilogue -23888 89/<- %esp 5/r32/ebp -23889 5d/pop-to-ebp -23890 c3/return -23891 -23892 # emit clean-up code for 'vars' that don't conflict with output registers -23893 # doesn't actually modify 'vars' so we need traverse manually inside the stack -23894 emit-cleanup-code-for-non-outputs: # out: (addr buffered-file), vars: (addr stack live-var), fn: (addr function) -23895 # . prologue -23896 55/push-ebp -23897 89/<- %ebp 4/r32/esp -23898 # . save registers -23899 50/push-eax -23900 51/push-ecx -23901 52/push-edx -23902 53/push-ebx -23903 56/push-esi -23904 57/push-edi -23905 # ecx = vars -23906 8b/-> *(ebp+0xc) 1/r32/ecx -23907 # var esi: int = vars->top -23908 8b/-> *ecx 6/r32/esi -23909 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] -23910 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size -23911 # var min/ecx: (addr handle var) = vars->data -23912 81 0/subop/add %ecx 8/imm32 -23913 { -23914 $emit-cleanup-code-for-non-outputs:loop: -23915 # if (curr < min) break -23916 39/compare %esi 1/r32/ecx -23917 0f 82/jump-if-addr< break/disp32 -23918 # var v/ebx: (addr var) = lookup(*curr) -23919 (lookup *esi *(esi+4)) # => eax -23920 89/<- %ebx 0/r32/eax -23921 # if v is in a register -23922 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register -23923 { -23924 0f 84/jump-if-= break/disp32 -23925 { -23926 $emit-cleanup-code-for-non-outputs:check-for-previous-spill: -23927 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled -23928 3d/compare-eax-and 0/imm32/false -23929 0f 84/jump-if-= break/disp32 -23930 $emit-cleanup-code-for-non-outputs:reclaim-var-in-register: -23931 # var reg/edi: (addr array name) = v->register -23932 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -23933 89/<- %edi 0/r32/eax -23934 # if reg is not in function outputs, emit a pop -23935 (reg-in-function-outputs? *(ebp+0x10) %edi) # => eax -23936 3d/compare-eax-and 0/imm32/false -23937 { -23938 75/jump-if-!= break/disp8 -23939 (emit-pop-register *(ebp+8) %edi) -23940 eb/jump $emit-cleanup-code-for-non-outputs:reclaim-var-in-register-done/disp8 -23941 } -23942 # otherwise just drop it from the stack -23943 (emit-indent *(ebp+8) *Curr-block-depth) -23944 (write-buffered *(ebp+8) "81 0/subop/add %esp 4/imm32\n") -23945 } -23946 $emit-cleanup-code-for-non-outputs:reclaim-var-in-register-done: -23947 eb/jump $emit-cleanup-code-for-non-outputs:continue/disp8 -23948 } -23949 # otherwise v is on the stack -23950 { -23951 75/jump-if-!= break/disp8 -23952 $emit-cleanup-code-for-non-outputs:var-on-stack: -23953 (size-of %ebx) # => eax -23954 # don't emit code for labels -23955 3d/compare-eax-and 0/imm32 -23956 74/jump-if-= break/disp8 -23957 $emit-cleanup-code-for-non-outputs:reclaim-var-on-stack: -23958 (emit-indent *(ebp+8) *Curr-block-depth) -23959 (write-buffered *(ebp+8) "81 0/subop/add %esp ") -23960 (write-int32-hex-buffered *(ebp+8) %eax) -23961 (write-buffered *(ebp+8) "/imm32\n") -23962 } -23963 $emit-cleanup-code-for-non-outputs:continue: -23964 # curr -= 12 -23965 81 5/subop/subtract %esi 0xc/imm32 -23966 e9/jump loop/disp32 -23967 } -23968 $emit-cleanup-code-for-non-outputs:end: -23969 # . restore registers -23970 5f/pop-to-edi -23971 5e/pop-to-esi -23972 5b/pop-to-ebx -23973 5a/pop-to-edx -23974 59/pop-to-ecx -23975 58/pop-to-eax -23976 # . epilogue -23977 89/<- %esp 5/r32/ebp -23978 5d/pop-to-ebp -23979 c3/return -23980 -23981 emit-push-register: # out: (addr buffered-file), reg: (addr array byte) -23982 # . prologue -23983 55/push-ebp -23984 89/<- %ebp 4/r32/esp -23985 # eax = reg -23986 8b/-> *(ebp+0xc) 0/r32/eax -23987 # var prefix/eax: byte = reg->data[0] -23988 8a/copy-byte *(eax+4) 0/r32/AL -23989 81 4/subop/and %eax 0xff/imm32 -23990 # if (prefix == 'x') push xmm register -23991 { -23992 3d/compare-eax-and 0x78/imm32/x -23993 0f 85/jump-if-!= break/disp32 -23994 # TODO validate register -23995 (emit-indent *(ebp+8) *Curr-block-depth) -23996 (write-buffered *(ebp+8) "81 5/subop/subtract %esp 4/imm32\n") -23997 (emit-indent *(ebp+8) *Curr-block-depth) -23998 (write-buffered *(ebp+8) "f3 0f 11/<- *esp ") -23999 # var prefix/eax: byte = reg->data[3] -24000 8b/-> *(ebp+0xc) 0/r32/eax -24001 8a/copy-byte *(eax+7) 0/r32/AL -24002 81 4/subop/and %eax 0xff/imm32 -24003 (write-byte-buffered *(ebp+8) %eax) -24004 (write-buffered *(ebp+8) "/x32\n") -24005 e9/jump $emit-push-register:end/disp32 -24006 } -24007 # otherwise push gp register -24008 (emit-indent *(ebp+8) *Curr-block-depth) -24009 (write-buffered *(ebp+8) "ff 6/subop/push %") -24010 (write-buffered *(ebp+8) *(ebp+0xc)) -24011 (write-buffered *(ebp+8) Newline) -24012 $emit-push-register:end: -24013 # . epilogue -24014 89/<- %esp 5/r32/ebp -24015 5d/pop-to-ebp -24016 c3/return -24017 -24018 emit-pop-register: # out: (addr buffered-file), reg: (addr array byte) -24019 # . prologue -24020 55/push-ebp -24021 89/<- %ebp 4/r32/esp -24022 # . save registers -24023 50/push-eax -24024 # eax = reg -24025 8b/-> *(ebp+0xc) 0/r32/eax -24026 # var prefix/eax: byte = reg->data[0] -24027 8a/copy-byte *(eax+4) 0/r32/AL -24028 81 4/subop/and %eax 0xff/imm32 -24029 # if (prefix == 'x') pop to xmm register -24030 { -24031 3d/compare-eax-and 0x78/imm32/x -24032 0f 85/jump-if-!= break/disp32 -24033 # TODO validate register -24034 (emit-indent *(ebp+8) *Curr-block-depth) -24035 (write-buffered *(ebp+8) "f3 0f 10/-> *esp ") -24036 # var prefix/eax: byte = reg->data[3] -24037 8b/-> *(ebp+0xc) 0/r32/eax -24038 8a/copy-byte *(eax+7) 0/r32/AL -24039 81 4/subop/and %eax 0xff/imm32 -24040 (write-byte-buffered *(ebp+8) %eax) -24041 (write-buffered *(ebp+8) "/x32\n") -24042 (emit-indent *(ebp+8) *Curr-block-depth) -24043 (write-buffered *(ebp+8) "81 0/subop/add %esp 4/imm32\n") -24044 e9/jump $emit-pop-register:end/disp32 -24045 } -24046 # otherwise pop to gp register -24047 (emit-indent *(ebp+8) *Curr-block-depth) -24048 (write-buffered *(ebp+8) "8f 0/subop/pop %") -24049 (write-buffered *(ebp+8) *(ebp+0xc)) -24050 (write-buffered *(ebp+8) Newline) -24051 $emit-pop-register:end: -24052 # . restore registers -24053 58/pop-to-eax -24054 # . epilogue -24055 89/<- %esp 5/r32/ebp -24056 5d/pop-to-ebp -24057 c3/return -24058 -24059 # emit clean-up code for 'vars' until a given label is encountered -24060 # doesn't actually modify 'vars' so we need traverse manually inside the stack -24061 emit-cleanup-code-until-target: # out: (addr buffered-file), vars: (addr stack live-var), until-block-label: (addr array byte) -24062 # . prologue -24063 55/push-ebp -24064 89/<- %ebp 4/r32/esp -24065 # . save registers -24066 50/push-eax -24067 51/push-ecx -24068 52/push-edx -24069 53/push-ebx -24070 # ecx = vars -24071 8b/-> *(ebp+0xc) 1/r32/ecx -24072 # var eax: int = vars->top -24073 8b/-> *ecx 0/r32/eax -24074 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] -24075 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size -24076 # var min/ecx: (addr handle var) = vars->data -24077 81 0/subop/add %ecx 8/imm32 -24078 { -24079 $emit-cleanup-code-until-target:loop: -24080 # if (curr < min) break -24081 39/compare %edx 1/r32/ecx -24082 0f 82/jump-if-addr< break/disp32 -24083 # var v/ebx: (handle var) = lookup(*curr) -24084 (lookup *edx *(edx+4)) # => eax -24085 89/<- %ebx 0/r32/eax -24086 # if (v->name == until-block-label) break -24087 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax -24088 (string-equal? %eax *(ebp+0x10)) # => eax -24089 3d/compare-eax-and 0/imm32/false -24090 0f 85/jump-if-!= break/disp32 -24091 # if v is in a register -24092 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register +23635 # otherwise return the word size +23636 b8/copy-to-eax 4/imm32 +23637 $size-of-type-id:end: +23638 # . reclaim locals +23639 81 0/subop/add %esp 8/imm32 +23640 # . restore registers +23641 59/pop-to-ecx +23642 # . epilogue +23643 89/<- %esp 5/r32/ebp +23644 5d/pop-to-ebp +23645 c3/return +23646 +23647 # Minor violation of our type system since it returns an addr. But we could +23648 # replace it with a handle some time. +23649 # Returns null if t is an atom. +23650 type-tail: # t: (addr type-tree) -> out/eax: (addr type-tree) +23651 # . prologue +23652 55/push-ebp +23653 89/<- %ebp 4/r32/esp +23654 # . save registers +23655 51/push-ecx +23656 # eax = 0 +23657 b8/copy-to-eax 0/imm32 +23658 # ecx = t +23659 8b/-> *(ebp+8) 1/r32/ecx +23660 $type-tail:check-atom: +23661 # if t->is-atom? return 0 +23662 81 7/subop/compare *ecx 0/imm32/false # Type-tree-is-atom +23663 0f 85/jump-if-!= $type-tail:end/disp32 +23664 # var tail = t->right +23665 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +23666 89/<- %ecx 0/r32/eax +23667 $type-tail:check-singleton: +23668 # if (tail->right == 0) return tail->left +23669 { +23670 81 7/subop/compare *(ecx+0xc) 0/imm32 # Type-tree-right +23671 75/jump-if-!= break/disp8 +23672 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +23673 e9/jump $type-tail:end/disp32 +23674 } +23675 # if tail->right->left is an array-capacity, return tail->left +23676 { +23677 $type-tail:check-array-capacity: +23678 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +23679 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +23680 75/jump-if-!= break/disp8 +23681 $type-tail:check-array-capacity-1: +23682 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +23683 3d/compare-eax-and 0/imm32 +23684 74/jump-if-= break/disp8 +23685 $type-tail:check-array-capacity-2: +23686 (is-simple-mu-type? %eax 9) # array-capacity => eax +23687 3d/compare-eax-and 0/imm32/false +23688 74/jump-if-= break/disp8 +23689 $type-tail:array-capacity: +23690 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +23691 eb/jump $type-tail:end/disp8 +23692 } +23693 $type-tail:check-compound-left: +23694 # if !tail->left->is-atom? return tail->left +23695 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +23696 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +23697 74/jump-if-= $type-tail:end/disp8 +23698 $type-tail:return-tail: +23699 # return tail +23700 89/<- %eax 1/r32/ecx +23701 $type-tail:end: +23702 # . restore registers +23703 59/pop-to-ecx +23704 # . epilogue +23705 89/<- %esp 5/r32/ebp +23706 5d/pop-to-ebp +23707 c3/return +23708 +23709 type-equal?: # a: (addr type-tree), b: (addr type-tree) -> result/eax: boolean +23710 # . prologue +23711 55/push-ebp +23712 89/<- %ebp 4/r32/esp +23713 # . save registers +23714 51/push-ecx +23715 52/push-edx +23716 53/push-ebx +23717 # ecx = a +23718 8b/-> *(ebp+8) 1/r32/ecx +23719 # edx = b +23720 8b/-> *(ebp+0xc) 2/r32/edx +23721 $type-equal?:compare-addr: +23722 # if (a == b) return true +23723 8b/-> %ecx 0/r32/eax # Var-type +23724 39/compare %edx 0/r32/eax # Var-type +23725 b8/copy-to-eax 1/imm32/true +23726 0f 84/jump-if-= $type-equal?:end/disp32 +23727 $type-equal?:compare-null-a: +23728 # if (a == 0) return false +23729 b8/copy-to-eax 0/imm32/false +23730 81 7/subop/compare %ecx 0/imm32 +23731 0f 84/jump-if-= $type-equal?:end/disp32 +23732 $type-equal?:compare-null-b: +23733 # if (b == 0) return false +23734 81 7/subop/compare %edx 0/imm32 +23735 0f 84/jump-if-= $type-equal?:end/disp32 +23736 $type-equal?:compare-atom-state: +23737 # if (a->is-atom? != b->is-atom?) return false +23738 8b/-> *ecx 3/r32/ebx # Type-tree-is-atom +23739 39/compare *edx 3/r32/ebx # Type-tree-is-atom +23740 b8/copy-to-eax 0/imm32/false +23741 0f 85/jump-if-!= $type-equal?:end/disp32 +23742 # if a->is-atom? return (a->value == b->value) +23743 { +23744 $type-equal?:check-atom: +23745 81 7/subop/compare %ebx 0/imm32/false +23746 74/jump-if-= break/disp8 +23747 $type-equal?:is-atom: +23748 8b/-> *(ecx+4) 0/r32/eax # Type-tree-value +23749 39/compare *(edx+4) 0/r32/eax # Type-tree-value +23750 0f 94/set-if-= %al +23751 81 4/subop/and %eax 0xff/imm32 +23752 e9/jump $type-equal?:end/disp32 +23753 } +23754 $type-equal?:check-left: +23755 # if (!type-equal?(a->left, b->left)) return false +23756 (lookup *(ecx+4) *(ecx+8)) # Type-tree-left Type-tree-left => eax +23757 89/<- %ebx 0/r32/eax +23758 (lookup *(edx+4) *(edx+8)) # Type-tree-left Type-tree-left => eax +23759 (type-equal? %eax %ebx) # => eax +23760 3d/compare-eax-and 0/imm32/false +23761 74/jump-if-= $type-equal?:end/disp8 +23762 $type-equal?:check-right: +23763 # return type-equal?(a->right, b->right) +23764 (lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax +23765 89/<- %ebx 0/r32/eax +23766 (lookup *(edx+0xc) *(edx+0x10)) # Type-tree-right Type-tree-right => eax +23767 (type-equal? %eax %ebx) # => eax +23768 $type-equal?:end: +23769 # . restore registers +23770 5b/pop-to-ebx +23771 5a/pop-to-edx +23772 59/pop-to-ecx +23773 # . epilogue +23774 89/<- %esp 5/r32/ebp +23775 5d/pop-to-ebp +23776 c3/return +23777 +23778 ####################################################### +23779 # Code-generation +23780 ####################################################### +23781 +23782 == data +23783 +23784 # Global state added to each var record when performing code-generation. +23785 Curr-local-stack-offset: # (addr int) +23786 0/imm32 +23787 +23788 == code +23789 +23790 emit-subx: # out: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) +23791 # . prologue +23792 55/push-ebp +23793 89/<- %ebp 4/r32/esp +23794 # . save registers +23795 50/push-eax +23796 # var curr/eax: (addr function) = *Program->functions +23797 (lookup *_Program-functions *_Program-functions->payload) # => eax +23798 { +23799 # if (curr == null) break +23800 3d/compare-eax-and 0/imm32 +23801 0f 84/jump-if-= break/disp32 +23802 (emit-subx-function *(ebp+8) %eax *(ebp+0xc) *(ebp+0x10)) +23803 # curr = lookup(curr->next) +23804 (lookup *(eax+0x20) *(eax+0x24)) # Function-next Function-next => eax +23805 e9/jump loop/disp32 +23806 } +23807 $emit-subx:end: +23808 # . restore registers +23809 58/pop-to-eax +23810 # . epilogue +23811 89/<- %esp 5/r32/ebp +23812 5d/pop-to-ebp +23813 c3/return +23814 +23815 emit-subx-function: # out: (addr buffered-file), f: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +23816 # . prologue +23817 55/push-ebp +23818 89/<- %ebp 4/r32/esp +23819 # some preprocessing +23820 (populate-mu-type-offsets-in-inouts *(ebp+0xc)) +23821 # . save registers +23822 50/push-eax +23823 51/push-ecx +23824 52/push-edx +23825 # initialize some global state +23826 c7 0/subop/copy *Curr-block-depth 1/imm32 # Important: keep this in sync with the parse phase +23827 c7 0/subop/copy *Curr-local-stack-offset 0/imm32 +23828 # ecx = f +23829 8b/-> *(ebp+0xc) 1/r32/ecx +23830 # var vars/edx: (stack (addr var) 256) +23831 81 5/subop/subtract %esp 0xc00/imm32 +23832 68/push 0xc00/imm32/size +23833 68/push 0/imm32/top +23834 89/<- %edx 4/r32/esp +23835 # var name/eax: (addr array byte) = lookup(f->name) +23836 (lookup *ecx *(ecx+4)) # Function-name Function-name => eax +23837 # +23838 (write-buffered *(ebp+8) %eax) +23839 (write-buffered *(ebp+8) ":\n") +23840 (emit-subx-prologue *(ebp+8)) +23841 # var body/eax: (addr block) = lookup(f->body) +23842 (lookup *(ecx+0x18) *(ecx+0x1c)) # Function-body Function-body => eax +23843 # +23844 (emit-subx-block *(ebp+8) %eax %edx *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +23845 (emit-subx-epilogue *(ebp+8)) +23846 # TODO: validate that *Curr-block-depth and *Curr-local-stack-offset have +23847 # been cleaned up +23848 $emit-subx-function:end: +23849 # . reclaim locals +23850 81 0/subop/add %esp 0xc08/imm32 +23851 # . restore registers +23852 5a/pop-to-edx +23853 59/pop-to-ecx +23854 58/pop-to-eax +23855 # . epilogue +23856 89/<- %esp 5/r32/ebp +23857 5d/pop-to-ebp +23858 c3/return +23859 +23860 populate-mu-type-offsets-in-inouts: # f: (addr function) +23861 # . prologue +23862 55/push-ebp +23863 89/<- %ebp 4/r32/esp +23864 # . save registers +23865 50/push-eax +23866 51/push-ecx +23867 52/push-edx +23868 53/push-ebx +23869 57/push-edi +23870 # var next-offset/edx: int = 8 +23871 ba/copy-to-edx 8/imm32 +23872 # var curr/ecx: (addr list var) = lookup(f->inouts) +23873 8b/-> *(ebp+8) 1/r32/ecx +23874 (lookup *(ecx+8) *(ecx+0xc)) # Function-inouts Function-inouts => eax +23875 89/<- %ecx 0/r32/eax +23876 { +23877 $populate-mu-type-offsets-in-inouts:loop: +23878 81 7/subop/compare %ecx 0/imm32 +23879 74/jump-if-= break/disp8 +23880 # var v/ebx: (addr var) = lookup(curr->value) +23881 (lookup *ecx *(ecx+4)) # List-value List-value => eax +23882 89/<- %ebx 0/r32/eax +23883 #? (lookup *ebx *(ebx+4)) +23884 #? (write-buffered Stderr "setting offset of fn inout ") +23885 #? (write-buffered Stderr %eax) +23886 #? (write-buffered Stderr "@") +23887 #? (write-int32-hex-buffered Stderr %ebx) +23888 #? (write-buffered Stderr " to ") +23889 #? (write-int32-hex-buffered Stderr %edx) +23890 #? (write-buffered Stderr Newline) +23891 #? (flush Stderr) +23892 # v->offset = next-offset +23893 89/<- *(ebx+0x14) 2/r32/edx # Var-offset +23894 # next-offset += size-of(v) +23895 (size-of %ebx) # => eax +23896 01/add-to %edx 0/r32/eax +23897 # curr = lookup(curr->next) +23898 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +23899 89/<- %ecx 0/r32/eax +23900 # +23901 eb/jump loop/disp8 +23902 } +23903 $populate-mu-type-offsets-in-inouts:end: +23904 # . restore registers +23905 5f/pop-to-edi +23906 5b/pop-to-ebx +23907 5a/pop-to-edx +23908 59/pop-to-ecx +23909 58/pop-to-eax +23910 # . epilogue +23911 89/<- %esp 5/r32/ebp +23912 5d/pop-to-ebp +23913 c3/return +23914 +23915 emit-subx-stmt-list: # out: (addr buffered-file), stmts: (addr list stmt), vars: (addr stack live-var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +23916 # . prologue +23917 55/push-ebp +23918 89/<- %ebp 4/r32/esp +23919 # . save registers +23920 50/push-eax +23921 51/push-ecx +23922 53/push-ebx +23923 56/push-esi +23924 # esi = stmts +23925 8b/-> *(ebp+0xc) 6/r32/esi +23926 # +23927 { +23928 $emit-subx-stmt-list:loop: +23929 81 7/subop/compare %esi 0/imm32 +23930 0f 84/jump-if-= break/disp32 +23931 # var curr-stmt/ecx: (addr stmt) = lookup(stmts->value) +23932 (lookup *esi *(esi+4)) # List-value List-value => eax +23933 89/<- %ecx 0/r32/eax +23934 { +23935 $emit-subx-stmt-list:check-for-block: +23936 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag +23937 75/jump-if-!= break/disp8 +23938 $emit-subx-stmt-list:block: +23939 (emit-subx-block *(ebp+8) %ecx *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +23940 } +23941 { +23942 $emit-subx-stmt-list:check-for-stmt: +23943 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag +23944 0f 85/jump-if-!= break/disp32 +23945 $emit-subx-stmt-list:stmt1: +23946 { +23947 (is-mu-branch? %ecx) # => eax +23948 3d/compare-eax-and 0/imm32/false +23949 0f 84/jump-if-= break/disp32 +23950 $emit-subx-stmt-list:branch-stmt: +23951 +-- 25 lines: # unconditional return ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +23976 +-- 27 lines: # unconditional loops -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +24003 +-- 16 lines: # unconditional breaks ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +24019 +-- 38 lines: # simple conditional branches without a target ------------------------------------------------------------------------------------------------------------------------------------------------------- +24057 +-- 19 lines: # conditional branches with an explicit target ------------------------------------------------------------------------------------------------------------------------------------------------------- +24076 } +24077 $emit-subx-stmt-list:1-to-1: +24078 (emit-subx-stmt *(ebp+8) %ecx Primitives *(ebp+0x18) *(ebp+0x1c)) +24079 e9/jump $emit-subx-stmt-list:continue/disp32 +24080 } +24081 { +24082 $emit-subx-stmt-list:check-for-var-def: +24083 81 7/subop/compare *ecx 2/imm32/var-def # Stmt-tag +24084 75/jump-if-!= break/disp8 +24085 $emit-subx-stmt-list:var-def: +24086 (emit-subx-var-def *(ebp+8) %ecx) +24087 (push *(ebp+0x10) *(ecx+4)) # Vardef-var +24088 (push *(ebp+0x10) *(ecx+8)) # Vardef-var +24089 (push *(ebp+0x10) 0) # Live-var-register-spilled = 0 for vars on the stack +24090 # +24091 eb/jump $emit-subx-stmt-list:continue/disp8 +24092 } 24093 { -24094 0f 84/jump-if-= break/disp32 -24095 { -24096 $emit-cleanup-code-until-target:check-for-previous-spill: -24097 8b/-> *(edx+8) 0/r32/eax # Live-var-register-spilled -24098 3d/compare-eax-and 0/imm32/false -24099 74/jump-if-= break/disp8 -24100 $emit-cleanup-code-until-target:reclaim-var-in-register: -24101 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -24102 (emit-pop-register *(ebp+8) %eax) -24103 } -24104 eb/jump $emit-cleanup-code-until-target:continue/disp8 -24105 } -24106 # otherwise v is on the stack -24107 { -24108 75/jump-if-!= break/disp8 -24109 $emit-cleanup-code-until-target:reclaim-var-on-stack: -24110 (size-of %ebx) # => eax -24111 # don't emit code for labels -24112 3d/compare-eax-and 0/imm32 -24113 74/jump-if-= break/disp8 -24114 # -24115 (emit-indent *(ebp+8) *Curr-block-depth) -24116 (write-buffered *(ebp+8) "81 0/subop/add %esp ") -24117 (write-int32-hex-buffered *(ebp+8) %eax) -24118 (write-buffered *(ebp+8) "/imm32\n") -24119 } -24120 $emit-cleanup-code-until-target:continue: -24121 # curr -= 12 -24122 81 5/subop/subtract %edx 0xc/imm32 -24123 e9/jump loop/disp32 -24124 } -24125 $emit-cleanup-code-until-target:end: -24126 # . restore registers -24127 5b/pop-to-ebx -24128 5a/pop-to-edx -24129 59/pop-to-ecx -24130 58/pop-to-eax -24131 # . epilogue -24132 89/<- %esp 5/r32/ebp -24133 5d/pop-to-ebp -24134 c3/return -24135 -24136 # update Curr-local-stack-offset assuming vars until some block depth are popped -24137 # doesn't actually modify 'vars', so we need traverse manually inside the stack -24138 clean-up-stack-offset-state: # vars: (addr stack live-var), until-block-depth: int -24139 # . prologue -24140 55/push-ebp -24141 89/<- %ebp 4/r32/esp -24142 # . save registers -24143 50/push-eax -24144 51/push-ecx -24145 52/push-edx -24146 53/push-ebx -24147 56/push-esi -24148 # ecx = vars -24149 8b/-> *(ebp+8) 1/r32/ecx -24150 # var esi: int = vars->top -24151 8b/-> *ecx 6/r32/esi -24152 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] -24153 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size -24154 # var min/ecx: (addr handle var) = vars->data -24155 81 0/subop/add %ecx 8/imm32 -24156 # edx = until-block-depth -24157 8b/-> *(ebp+0xc) 2/r32/edx -24158 { -24159 $clean-up-stack-offset-state:loop: -24160 # if (curr < min) break -24161 39/compare %esi 1/r32/ecx -24162 0f 82/jump-if-addr< break/disp32 -24163 # var v/ebx: (addr var) = lookup(*curr) -24164 (lookup *esi *(esi+4)) # => eax -24165 89/<- %ebx 0/r32/eax -24166 # if (v->block-depth < until-block-depth) break -24167 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth -24168 0f 8c/jump-if-< break/disp32 -24169 # if v is in a register -24170 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register -24171 { -24172 0f 84/jump-if-= break/disp32 -24173 { -24174 $clean-up-stack-offset-state:check-for-previous-spill: -24175 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled -24176 3d/compare-eax-and 0/imm32/false -24177 74/jump-if-= break/disp8 -24178 $clean-up-stack-offset-state:reclaim-var-in-register: -24179 81 0/subop/add *Curr-local-stack-offset 4/imm32 -24180 } -24181 eb/jump $clean-up-stack-offset-state:continue/disp8 -24182 } -24183 # otherwise v is on the stack -24184 { -24185 75/jump-if-!= break/disp8 -24186 $clean-up-stack-offset-state:var-on-stack: -24187 (size-of %ebx) # => eax -24188 01/add-to *Curr-local-stack-offset 0/r32/eax -24189 } -24190 $clean-up-stack-offset-state:continue: -24191 # curr -= 12 -24192 81 5/subop/subtract %esi 0xc/imm32 -24193 e9/jump loop/disp32 -24194 } -24195 $clean-up-stack-offset-state:end: -24196 # . restore registers -24197 5e/pop-to-esi -24198 5b/pop-to-ebx -24199 5a/pop-to-edx -24200 59/pop-to-ecx -24201 58/pop-to-eax -24202 # . epilogue -24203 89/<- %esp 5/r32/ebp -24204 5d/pop-to-ebp -24205 c3/return -24206 -24207 # Return true if there isn't a variable in 'vars' with the same block-depth -24208 # and register as 'v'. -24209 # 'v' is guaranteed not to be within 'vars'. -24210 not-yet-spilled-this-block?: # v: (addr var), vars: (addr stack live-var) -> result/eax: boolean -24211 # . prologue -24212 55/push-ebp -24213 89/<- %ebp 4/r32/esp -24214 # . save registers -24215 51/push-ecx -24216 52/push-edx -24217 53/push-ebx -24218 56/push-esi -24219 57/push-edi -24220 # ecx = vars -24221 8b/-> *(ebp+0xc) 1/r32/ecx -24222 # var eax: int = vars->top -24223 8b/-> *ecx 0/r32/eax -24224 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] -24225 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size -24226 # var min/ecx: (addr handle var) = vars->data -24227 8d/copy-address *(ecx+8) 1/r32/ecx -24228 # var depth/ebx: int = v->block-depth -24229 8b/-> *(ebp+8) 3/r32/ebx -24230 8b/-> *(ebx+0x10) 3/r32/ebx # Var-block-depth -24231 # var needle/esi: (addr array byte) = v->register -24232 8b/-> *(ebp+8) 6/r32/esi -24233 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -24234 89/<- %esi 0/r32/eax -24235 { -24236 $not-yet-spilled-this-block?:loop: -24237 # if (curr < min) break -24238 39/compare %edx 1/r32/ecx -24239 0f 82/jump-if-addr< break/disp32 -24240 # var cand/edi: (addr var) = lookup(*curr) -24241 (lookup *edx *(edx+4)) # => eax -24242 89/<- %edi 0/r32/eax -24243 # if (cand->block-depth < depth) break -24244 39/compare *(edi+0x10) 3/r32/ebx # Var-block-depth -24245 0f 8c/jump-if-< break/disp32 -24246 # var cand-reg/edi: (array array byte) = cand->reg -24247 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax -24248 89/<- %edi 0/r32/eax -24249 # if (cand-reg == null) continue -24250 { -24251 $not-yet-spilled-this-block?:check-reg: -24252 81 7/subop/compare %edi 0/imm32 -24253 0f 84/jump-if-= break/disp32 -24254 # if (cand-reg == needle) return true -24255 (string-equal? %esi %edi) # => eax -24256 3d/compare-eax-and 0/imm32/false -24257 74/jump-if-= break/disp8 -24258 $not-yet-spilled-this-block?:return-false: -24259 b8/copy-to-eax 0/imm32/false -24260 eb/jump $not-yet-spilled-this-block?:end/disp8 -24261 } -24262 $not-yet-spilled-this-block?:continue: -24263 # curr -= 12 -24264 81 5/subop/subtract %edx 0xc/imm32 -24265 e9/jump loop/disp32 -24266 } -24267 $not-yet-spilled-this-block?:return-true: -24268 # return true -24269 b8/copy-to-eax 1/imm32/true -24270 $not-yet-spilled-this-block?:end: -24271 # . restore registers -24272 5f/pop-to-edi -24273 5e/pop-to-esi -24274 5b/pop-to-ebx -24275 5a/pop-to-edx -24276 59/pop-to-ecx -24277 # . epilogue -24278 89/<- %esp 5/r32/ebp -24279 5d/pop-to-ebp -24280 c3/return -24281 -24282 # could the register of 'v' ever be written to by one of the vars in fn-outputs? -24283 will-not-write-some-register?: # v: (addr var), stmts: (addr list stmt), fn: (addr function) -> result/eax: boolean -24284 # . prologue -24285 55/push-ebp -24286 89/<- %ebp 4/r32/esp -24287 # eax = v -24288 8b/-> *(ebp+8) 0/r32/eax -24289 # var reg/eax: (addr array byte) = lookup(v->register) -24290 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -24291 # var target/eax: (addr var) = find-register(fn-outputs, reg) -24292 (find-register *(ebp+0x10) %eax) # => eax -24293 # if (target == 0) return true -24294 { -24295 3d/compare-eax-and 0/imm32 -24296 75/jump-if-!= break/disp8 -24297 b8/copy-to-eax 1/imm32/true -24298 eb/jump $will-not-write-some-register?:end/disp8 -24299 } -24300 # return !assigns-in-stmts?(stmts, target) -24301 (assigns-in-stmts? *(ebp+0xc) %eax) # => eax -24302 3d/compare-eax-and 0/imm32/false -24303 # assume: true = 1, so no need to mask with 0x000000ff -24304 0f 94/set-if-= %al -24305 $will-not-write-some-register?:end: -24306 # . epilogue -24307 89/<- %esp 5/r32/ebp -24308 5d/pop-to-ebp -24309 c3/return -24310 -24311 # return fn output with matching register -24312 # always returns false if 'reg' is null -24313 find-register: # fn: (addr function), reg: (addr array byte) -> result/eax: (addr var) -24314 # . prologue -24315 55/push-ebp -24316 89/<- %ebp 4/r32/esp -24317 # . save registers -24318 51/push-ecx -24319 # var curr/ecx: (addr list var) = lookup(fn->outputs) -24320 8b/-> *(ebp+8) 1/r32/ecx -24321 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax -24322 89/<- %ecx 0/r32/eax -24323 { -24324 $find-register:loop: -24325 # if (curr == 0) break -24326 81 7/subop/compare %ecx 0/imm32 -24327 74/jump-if-= break/disp8 -24328 # eax = curr->value->register -24329 (lookup *ecx *(ecx+4)) # List-value List-value => eax -24330 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -24331 # if (eax == reg) return curr->value -24332 $find-register:compare: -24333 (string-equal? *(ebp+0xc) %eax) # => eax -24334 { -24335 3d/compare-eax-and 0/imm32/false -24336 74/jump-if-= break/disp8 -24337 $find-register:found: -24338 (lookup *ecx *(ecx+4)) # List-value List-value => eax -24339 eb/jump $find-register:end/disp8 -24340 } -24341 # curr = lookup(curr->next) -24342 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -24343 89/<- %ecx 0/r32/eax -24344 # -24345 eb/jump loop/disp8 -24346 } -24347 $find-register:end: -24348 # . restore registers -24349 59/pop-to-ecx -24350 # . epilogue -24351 89/<- %esp 5/r32/ebp -24352 5d/pop-to-ebp -24353 c3/return -24354 -24355 assigns-in-stmts?: # stmts: (addr list stmt), v: (addr var) -> result/eax: boolean -24356 # . prologue -24357 55/push-ebp -24358 89/<- %ebp 4/r32/esp -24359 # . save registers -24360 51/push-ecx -24361 # var curr/ecx: (addr list stmt) = stmts -24362 8b/-> *(ebp+8) 1/r32/ecx -24363 { -24364 # if (curr == 0) break -24365 81 7/subop/compare %ecx 0/imm32 -24366 74/jump-if-= break/disp8 -24367 # if assigns-in-stmt?(curr->value, v) return true -24368 (lookup *ecx *(ecx+4)) # List-value List-value => eax -24369 (assigns-in-stmt? %eax *(ebp+0xc)) # => eax -24370 3d/compare-eax-and 0/imm32/false -24371 75/jump-if-!= break/disp8 -24372 # curr = lookup(curr->next) -24373 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -24374 89/<- %ecx 0/r32/eax -24375 # -24376 eb/jump loop/disp8 -24377 } -24378 $assigns-in-stmts?:end: -24379 # . restore registers -24380 59/pop-to-ecx -24381 # . epilogue -24382 89/<- %esp 5/r32/ebp -24383 5d/pop-to-ebp -24384 c3/return -24385 -24386 assigns-in-stmt?: # stmt: (addr stmt), v: (addr var) -> result/eax: boolean -24387 # . prologue -24388 55/push-ebp -24389 89/<- %ebp 4/r32/esp -24390 # . save registers -24391 51/push-ecx -24392 # ecx = stmt -24393 8b/-> *(ebp+8) 1/r32/ecx -24394 # if stmt is a stmt1, return assigns-in-stmt-vars?(stmt->outputs, v) -24395 { -24396 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag -24397 75/jump-if-!= break/disp8 -24398 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -24399 (assigns-in-stmt-vars? %eax *(ebp+0xc)) # => eax -24400 eb/jump $assigns-in-stmt?:end/disp8 -24401 } -24402 # if stmt is a block, return assigns-in-stmts?(stmt->stmts, v) -24403 { -24404 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag -24405 75/jump-if-!= break/disp8 -24406 (lookup *(ecx+4) *(ecx+8)) # Block-stmts Block-stmts => eax -24407 (assigns-in-stmts? %eax *(ebp+0xc)) # => eax -24408 eb/jump $assigns-in-stmt?:end/disp8 -24409 } -24410 # otherwise return false -24411 b8/copy 0/imm32/false -24412 $assigns-in-stmt?:end: -24413 # . restore registers -24414 59/pop-to-ecx -24415 # . epilogue -24416 89/<- %esp 5/r32/ebp -24417 5d/pop-to-ebp -24418 c3/return -24419 -24420 assigns-in-stmt-vars?: # stmt-var: (addr stmt-var), v: (addr var) -> result/eax: boolean -24421 # . prologue -24422 55/push-ebp -24423 89/<- %ebp 4/r32/esp -24424 # . save registers -24425 51/push-ecx -24426 # var curr/ecx: (addr stmt-var) = stmt-var -24427 8b/-> *(ebp+8) 1/r32/ecx -24428 { -24429 # if (curr == 0) break -24430 81 7/subop/compare %ecx 0/imm32 -24431 74/jump-if-= break/disp8 -24432 # eax = lookup(curr->value) -24433 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -24434 # if (eax == v && curr->is-deref? == false) return true -24435 { -24436 39/compare *(ebp+0xc) 0/r32/eax -24437 75/jump-if-!= break/disp8 -24438 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -24439 75/jump-if-!= break/disp8 -24440 b8/copy-to-eax 1/imm32/true -24441 eb/jump $assigns-in-stmt-vars?:end/disp8 -24442 } -24443 # curr = lookup(curr->next) -24444 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax -24445 89/<- %ecx 0/r32/eax -24446 # -24447 eb/jump loop/disp8 -24448 } -24449 $assigns-in-stmt-vars?:end: -24450 # . restore registers -24451 59/pop-to-ecx -24452 # . epilogue -24453 89/<- %esp 5/r32/ebp -24454 5d/pop-to-ebp -24455 c3/return -24456 -24457 # is there a var before 'v' with the same block-depth and register on the 'vars' stack? -24458 # v is guaranteed to be within vars -24459 # 'start' is provided as an optimization, a pointer within vars -24460 # *start == v -24461 same-register-spilled-before?: # v: (addr var), vars: (addr stack (handle var)), start: (addr var) -> result/eax: boolean -24462 # . prologue -24463 55/push-ebp -24464 89/<- %ebp 4/r32/esp -24465 # . save registers -24466 51/push-ecx -24467 52/push-edx -24468 53/push-ebx -24469 56/push-esi -24470 57/push-edi -24471 # ecx = v -24472 8b/-> *(ebp+8) 1/r32/ecx -24473 # var reg/edx: (addr array byte) = lookup(v->register) -24474 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax -24475 89/<- %edx 0/r32/eax -24476 # var depth/ebx: int = v->block-depth -24477 8b/-> *(ecx+0x10) 3/r32/ebx # Var-block-depth -24478 # var min/ecx: (addr handle var) = vars->data -24479 8b/-> *(ebp+0xc) 1/r32/ecx -24480 81 0/subop/add %ecx 8/imm32 -24481 # TODO: check that start >= min and start < &vars->data[top] -24482 # TODO: check that *start == v -24483 # var curr/esi: (addr handle var) = start -24484 8b/-> *(ebp+0x10) 6/r32/esi -24485 # curr -= 8 -24486 81 5/subop/subtract %esi 8/imm32 -24487 { -24488 $same-register-spilled-before?:loop: -24489 # if (curr < min) break -24490 39/compare %esi 1/r32/ecx -24491 0f 82/jump-if-addr< break/disp32 -24492 # var x/eax: (addr var) = lookup(*curr) -24493 (lookup *esi *(esi+4)) # => eax -24494 # if (x->block-depth < depth) break -24495 39/compare *(eax+0x10) 3/r32/ebx # Var-block-depth -24496 0f 8c/jump-if-< break/disp32 -24497 # if (x->register == 0) continue -24498 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -24499 74/jump-if-= $same-register-spilled-before?:continue/disp8 -24500 # if (x->register == reg) return true -24501 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -24502 (string-equal? %eax %edx) # => eax -24503 3d/compare-eax-and 0/imm32/false -24504 b8/copy-to-eax 1/imm32/true -24505 75/jump-if-!= $same-register-spilled-before?:end/disp8 -24506 $same-register-spilled-before?:continue: -24507 # curr -= 8 -24508 81 5/subop/subtract %esi 8/imm32 -24509 e9/jump loop/disp32 -24510 } -24511 $same-register-spilled-before?:false: -24512 b8/copy-to-eax 0/imm32/false -24513 $same-register-spilled-before?:end: -24514 # . restore registers -24515 5f/pop-to-edi -24516 5e/pop-to-esi -24517 5b/pop-to-ebx -24518 5a/pop-to-edx -24519 59/pop-to-ecx -24520 # . epilogue -24521 89/<- %esp 5/r32/ebp -24522 5d/pop-to-ebp -24523 c3/return -24524 -24525 # clean up global state for 'vars' until some block depth (inclusive) -24526 clean-up-blocks: # vars: (addr stack live-var), until-block-depth: int, fn: (addr function) -24527 # . prologue -24528 55/push-ebp -24529 89/<- %ebp 4/r32/esp -24530 # . save registers -24531 50/push-eax -24532 51/push-ecx -24533 56/push-esi -24534 # esi = vars -24535 8b/-> *(ebp+8) 6/r32/esi -24536 # ecx = until-block-depth -24537 8b/-> *(ebp+0xc) 1/r32/ecx -24538 { -24539 $clean-up-blocks:reclaim-loop: -24540 # if (vars->top <= 0) break -24541 8b/-> *esi 0/r32/eax # Stack-top -24542 3d/compare-eax-and 0/imm32 -24543 0f 8e/jump-if-<= break/disp32 -24544 # var v/eax: (addr var) = lookup(vars[vars->top-12]) -24545 (lookup *(esi+eax-4) *(esi+eax)) # vars + 8 + vars->top - 12 => eax -24546 # if (v->block-depth < until-block-depth) break -24547 39/compare *(eax+0x10) 1/r32/ecx # Var-block-depth -24548 0f 8c/jump-if-< break/disp32 -24549 (pop %esi) # => eax -24550 (pop %esi) # => eax -24551 (pop %esi) # => eax -24552 e9/jump loop/disp32 -24553 } -24554 $clean-up-blocks:end: -24555 # . restore registers -24556 5e/pop-to-esi -24557 59/pop-to-ecx -24558 58/pop-to-eax -24559 # . epilogue -24560 89/<- %esp 5/r32/ebp -24561 5d/pop-to-ebp -24562 c3/return -24563 -24564 reg-in-function-outputs?: # fn: (addr function), target: (addr array byte) -> result/eax: boolean -24565 # . prologue -24566 55/push-ebp -24567 89/<- %ebp 4/r32/esp -24568 # . save registers -24569 51/push-ecx -24570 # var curr/ecx: (addr list var) = lookup(fn->outputs) -24571 8b/-> *(ebp+8) 0/r32/eax -24572 (lookup *(eax+0x10) *(eax+0x14)) # Function-outputs Function-outputs => eax -24573 89/<- %ecx 0/r32/eax -24574 # while curr != null -24575 { -24576 81 7/subop/compare %ecx 0/imm32 -24577 74/jump-if-= break/disp8 -24578 # var v/eax: (addr var) = lookup(curr->value) -24579 (lookup *ecx *(ecx+4)) # List-value List-value => eax -24580 # var reg/eax: (addr array byte) = lookup(v->register) -24581 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -24582 # if (reg == target) return true -24583 (string-equal? %eax *(ebp+0xc)) # => eax -24584 3d/compare-eax-and 0/imm32/false -24585 75/jump-if-!= $reg-in-function-outputs?:end/disp8 -24586 # curr = curr->next -24587 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax -24588 89/<- %ecx 0/r32/eax -24589 # -24590 eb/jump loop/disp8 -24591 } -24592 # return false -24593 b8/copy-to-eax 0/imm32 -24594 $reg-in-function-outputs?:end: -24595 # . restore registers -24596 59/pop-to-ecx -24597 # . epilogue -24598 89/<- %esp 5/r32/ebp -24599 5d/pop-to-ebp -24600 c3/return -24601 -24602 emit-subx-var-def: # out: (addr buffered-file), stmt: (addr stmt) -24603 # . prologue -24604 55/push-ebp -24605 89/<- %ebp 4/r32/esp -24606 # . save registers -24607 50/push-eax -24608 51/push-ecx -24609 52/push-edx -24610 # eax = stmt -24611 8b/-> *(ebp+0xc) 0/r32/eax -24612 # var v/ecx: (addr var) -24613 (lookup *(eax+4) *(eax+8)) # Vardef-var Vardef-var => eax -24614 89/<- %ecx 0/r32/eax -24615 # v->block-depth = *Curr-block-depth -24616 8b/-> *Curr-block-depth 0/r32/eax -24617 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth -24618 # var n/edx: int = size-of(stmt->var) -24619 (size-of %ecx) # => eax -24620 89/<- %edx 0/r32/eax -24621 # *Curr-local-stack-offset -= n -24622 29/subtract-from *Curr-local-stack-offset 2/r32/edx -24623 # v->offset = *Curr-local-stack-offset -24624 8b/-> *Curr-local-stack-offset 0/r32/eax -24625 89/<- *(ecx+0x14) 0/r32/eax # Var-offset -24626 # if v is an array, do something special to initialize it -24627 { -24628 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -24629 (is-mu-array? %eax) # => eax -24630 3d/compare-eax-and 0/imm32/false -24631 0f 84/jump-if-= break/disp32 -24632 # var array-size-without-size/edx: int = n-4 -24633 81 5/subop/subtract %edx 4/imm32 -24634 # -24635 (emit-array-data-initialization *(ebp+8) %edx) -24636 e9/jump $emit-subx-var-def:end/disp32 -24637 } -24638 # another special-case for initializing streams -24639 # a stream is an array with 2 extra pointers -24640 { -24641 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax -24642 (is-mu-stream? %eax) # => eax -24643 3d/compare-eax-and 0/imm32/false -24644 0f 84/jump-if-= break/disp32 -24645 # var array-size-without-size/edx: int = n-12 -24646 81 5/subop/subtract %edx 0xc/imm32 -24647 (emit-array-data-initialization *(ebp+8) %edx) -24648 # emit read and write pointers -24649 (emit-indent *(ebp+8) *Curr-block-depth) -24650 (write-buffered *(ebp+8) "68/push 0/imm32\n") -24651 (emit-indent *(ebp+8) *Curr-block-depth) -24652 (write-buffered *(ebp+8) "68/push 0/imm32\n") -24653 # -24654 eb/jump $emit-subx-var-def:end/disp8 -24655 } -24656 # while n > 0 -24657 { -24658 81 7/subop/compare %edx 0/imm32 -24659 7e/jump-if-<= break/disp8 -24660 (emit-indent *(ebp+8) *Curr-block-depth) -24661 (write-buffered *(ebp+8) "68/push 0/imm32\n") -24662 # n -= 4 -24663 81 5/subop/subtract %edx 4/imm32 -24664 # -24665 eb/jump loop/disp8 -24666 } -24667 $emit-subx-var-def:end: -24668 # . restore registers -24669 5a/pop-to-edx -24670 59/pop-to-ecx -24671 58/pop-to-eax -24672 # . epilogue -24673 89/<- %esp 5/r32/ebp -24674 5d/pop-to-ebp -24675 c3/return -24676 -24677 emit-array-data-initialization: # out: (addr buffered-file), n: int -24678 # . prologue -24679 55/push-ebp -24680 89/<- %ebp 4/r32/esp -24681 # -24682 (emit-indent *(ebp+8) *Curr-block-depth) -24683 (write-buffered *(ebp+8) "(push-n-zero-bytes ") -24684 (write-int32-hex-buffered *(ebp+8) *(ebp+0xc)) -24685 (write-buffered *(ebp+8) ")\n") -24686 (emit-indent *(ebp+8) *Curr-block-depth) -24687 (write-buffered *(ebp+8) "68/push ") -24688 (write-int32-hex-buffered *(ebp+8) *(ebp+0xc)) -24689 (write-buffered *(ebp+8) "/imm32\n") -24690 $emit-array-data-initialization:end: -24691 # . epilogue -24692 89/<- %esp 5/r32/ebp -24693 5d/pop-to-ebp -24694 c3/return -24695 -24696 emit-subx-stmt: # out: (addr buffered-file), stmt: (addr stmt), primitives: (addr primitive), err: (addr buffered-file), ed: (addr exit-descriptor) -24697 # . prologue -24698 55/push-ebp -24699 89/<- %ebp 4/r32/esp -24700 # . save registers -24701 50/push-eax -24702 51/push-ecx -24703 # - some special-case primitives that don't actually use the 'primitives' data structure -24704 # var op/ecx: (addr array byte) = lookup(stmt->operation) -24705 8b/-> *(ebp+0xc) 1/r32/ecx -24706 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax -24707 89/<- %ecx 0/r32/eax -24708 # array size -24709 { -24710 # if (!string-equal?(stmt->operation, "length")) break -24711 (string-equal? %ecx "length") # => eax -24712 3d/compare-eax-and 0/imm32 -24713 0f 84/jump-if-= break/disp32 -24714 (translate-mu-length-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) -24715 e9/jump $emit-subx-stmt:end/disp32 -24716 } -24717 # index into array -24718 { -24719 # if (!string-equal?(stmt->operation, "index")) break -24720 (string-equal? %ecx "index") # => eax -24721 3d/compare-eax-and 0/imm32 -24722 0f 84/jump-if-= break/disp32 -24723 (translate-mu-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) -24724 e9/jump $emit-subx-stmt:end/disp32 -24725 } -24726 # compute-offset for index into array -24727 { -24728 # if (!string-equal?(stmt->operation, "compute-offset")) break -24729 (string-equal? %ecx "compute-offset") # => eax -24730 3d/compare-eax-and 0/imm32 -24731 0f 84/jump-if-= break/disp32 -24732 (translate-mu-compute-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) -24733 e9/jump $emit-subx-stmt:end/disp32 -24734 } -24735 # get field from record -24736 { -24737 # if (!string-equal?(stmt->operation, "get")) break -24738 (string-equal? %ecx "get") # => eax -24739 3d/compare-eax-and 0/imm32 -24740 0f 84/jump-if-= break/disp32 -24741 (translate-mu-get-stmt *(ebp+8) *(ebp+0xc)) -24742 e9/jump $emit-subx-stmt:end/disp32 -24743 } -24744 # allocate scalar -24745 { -24746 # if (!string-equal?(stmt->operation, "allocate")) break -24747 (string-equal? %ecx "allocate") # => eax -24748 3d/compare-eax-and 0/imm32 -24749 0f 84/jump-if-= break/disp32 -24750 (translate-mu-allocate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) -24751 e9/jump $emit-subx-stmt:end/disp32 -24752 } -24753 # copy-object -24754 { -24755 # if (!string-equal?(stmt->operation, "copy-object")) break -24756 (string-equal? %ecx "copy-object") # => eax -24757 3d/compare-eax-and 0/imm32 -24758 0f 84/jump-if-= break/disp32 -24759 (translate-mu-copy-object-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) -24760 e9/jump $emit-subx-stmt:end/disp32 -24761 } -24762 # allocate array -24763 { -24764 # if (!string-equal?(stmt->operation, "populate")) break -24765 (string-equal? %ecx "populate") # => eax -24766 3d/compare-eax-and 0/imm32 -24767 0f 84/jump-if-= break/disp32 -24768 (translate-mu-populate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) -24769 e9/jump $emit-subx-stmt:end/disp32 -24770 } -24771 # allocate stream -24772 { -24773 # if (!string-equal?(stmt->operation, "populate-stream")) break -24774 (string-equal? %ecx "populate-stream") # => eax -24775 3d/compare-eax-and 0/imm32 -24776 0f 84/jump-if-= break/disp32 -24777 (translate-mu-populate-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) -24778 e9/jump $emit-subx-stmt:end/disp32 -24779 } -24780 # read from stream -24781 { -24782 # if (!string-equal?(stmt->operation, "read-from-stream")) break -24783 (string-equal? %ecx "read-from-stream") # => eax -24784 3d/compare-eax-and 0/imm32 -24785 0f 84/jump-if-= break/disp32 -24786 (translate-mu-read-from-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) -24787 e9/jump $emit-subx-stmt:end/disp32 -24788 } -24789 # write to stream -24790 { -24791 # if (!string-equal?(stmt->operation, "write-to-stream")) break -24792 (string-equal? %ecx "write-to-stream") # => eax -24793 3d/compare-eax-and 0/imm32 -24794 0f 84/jump-if-= break/disp32 -24795 (translate-mu-write-to-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) -24796 e9/jump $emit-subx-stmt:end/disp32 -24797 } -24798 # - if stmt matches a primitive, emit it -24799 { -24800 $emit-subx-stmt:check-for-primitive: -24801 # var curr/eax: (addr primitive) -24802 (find-matching-primitive *(ebp+0x10) *(ebp+0xc)) # primitives, stmt => eax -24803 3d/compare-eax-and 0/imm32 -24804 74/jump-if-= break/disp8 -24805 $emit-subx-stmt:primitive: -24806 (emit-subx-primitive *(ebp+8) *(ebp+0xc) %eax) # out, stmt, curr -24807 e9/jump $emit-subx-stmt:end/disp32 -24808 } -24809 # - otherwise emit a call -24810 # TODO: type-checking -24811 $emit-subx-stmt:call: -24812 (emit-call *(ebp+8) *(ebp+0xc)) -24813 $emit-subx-stmt:end: -24814 # . restore registers -24815 59/pop-to-ecx -24816 58/pop-to-eax -24817 # . epilogue -24818 89/<- %esp 5/r32/ebp -24819 5d/pop-to-ebp -24820 c3/return -24821 -24822 translate-mu-length-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -24823 # . prologue -24824 55/push-ebp -24825 89/<- %ebp 4/r32/esp -24826 # . save registers -24827 50/push-eax -24828 51/push-ecx -24829 52/push-edx -24830 53/push-ebx -24831 56/push-esi -24832 # esi = stmt -24833 8b/-> *(ebp+0xc) 6/r32/esi -24834 # var base/ebx: (addr var) = stmt->inouts[0]->value -24835 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -24836 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -24837 89/<- %ebx 0/r32/eax -24838 # var elemsize/ecx: int = array-element-size(base) -24839 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax -24840 89/<- %ecx 0/r32/eax -24841 # var outreg/edx: (addr array byte) = stmt->outputs[0]->value->register -24842 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax -24843 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -24844 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -24845 89/<- %edx 0/r32/eax -24846 # if elemsize == 1 -24847 { -24848 81 7/subop/compare %ecx 1/imm32 -24849 75/jump-if-!= break/disp8 -24850 $translate-mu-length-stmt:size-1: -24851 (emit-save-size-to *(ebp+8) %ebx %edx) -24852 e9/jump $translate-mu-length-stmt:end/disp32 -24853 } -24854 # if elemsize is a power of 2 less than 256 -24855 { -24856 (power-of-2? %ecx *(ebp+0x10) *(ebp+0x14)) # => eax -24857 3d/compare-eax-and 0/imm32/false -24858 74/jump-if-= break/disp8 -24859 81 7/subop/compare %ecx 0xff/imm32 -24860 7f/jump-if-> break/disp8 -24861 $translate-mu-length-stmt:size-power-of-2: -24862 (emit-save-size-to *(ebp+8) %ebx %edx) -24863 (emit-divide-by-shift-right *(ebp+8) %edx %ecx) -24864 e9/jump $translate-mu-length-stmt:end/disp32 -24865 } -24866 # otherwise, the complex case -24867 # . emit register spills -24868 { -24869 $translate-mu-length-stmt:complex: -24870 (string-equal? %edx "eax") # => eax -24871 3d/compare-eax-and 0/imm32/false -24872 75/break-if-!= break/disp8 -24873 (emit-indent *(ebp+8) *Curr-block-depth) -24874 (write-buffered *(ebp+8) "50/push-eax\n") -24875 } -24876 { -24877 (string-equal? %edx "ecx") # => eax -24878 3d/compare-eax-and 0/imm32/false -24879 75/break-if-!= break/disp8 -24880 (emit-indent *(ebp+8) *Curr-block-depth) -24881 (write-buffered *(ebp+8) "51/push-ecx\n") -24882 } -24883 { -24884 (string-equal? %edx "edx") # => eax -24885 3d/compare-eax-and 0/imm32/false -24886 75/break-if-!= break/disp8 -24887 (emit-indent *(ebp+8) *Curr-block-depth) -24888 (write-buffered *(ebp+8) "52/push-edx\n") -24889 } -24890 # . -24891 (emit-save-size-to *(ebp+8) %ebx "eax") -24892 (emit-indent *(ebp+8) *Curr-block-depth) -24893 (write-buffered *(ebp+8) "31/xor %edx 2/r32/edx\n") -24894 (emit-indent *(ebp+8) *Curr-block-depth) -24895 (write-buffered *(ebp+8) "b9/copy-to-ecx ") -24896 (write-int32-hex-buffered *(ebp+8) %ecx) -24897 (write-buffered *(ebp+8) "/imm32\n") -24898 (emit-indent *(ebp+8) *Curr-block-depth) -24899 (write-buffered *(ebp+8) "f7 7/subop/idiv-eax-edx-by %ecx\n") -24900 { -24901 (string-equal? %edx "eax") # => eax -24902 3d/compare-eax-and 0/imm32/false -24903 75/break-if-!= break/disp8 -24904 (emit-indent *(ebp+8) *Curr-block-depth) -24905 (write-buffered *(ebp+8) "89/<- %") -24906 (write-buffered *(ebp+8) %edx) -24907 (write-buffered *(ebp+8) " 0/r32/eax\n") -24908 } -24909 # . emit register restores -24910 { -24911 (string-equal? %edx "edx") # => eax -24912 3d/compare-eax-and 0/imm32/false -24913 75/break-if-!= break/disp8 -24914 (emit-indent *(ebp+8) *Curr-block-depth) -24915 (write-buffered *(ebp+8) "5a/pop-to-edx\n") -24916 } -24917 { -24918 (string-equal? %edx "ecx") # => eax -24919 3d/compare-eax-and 0/imm32/false -24920 75/break-if-!= break/disp8 -24921 (emit-indent *(ebp+8) *Curr-block-depth) -24922 (write-buffered *(ebp+8) "59/pop-to-ecx\n") -24923 } -24924 { -24925 (string-equal? %edx "eax") # => eax -24926 3d/compare-eax-and 0/imm32/false -24927 75/break-if-!= break/disp8 -24928 (emit-indent *(ebp+8) *Curr-block-depth) -24929 (write-buffered *(ebp+8) "58/pop-to-eax\n") -24930 } -24931 $translate-mu-length-stmt:end: -24932 # . restore registers -24933 5e/pop-to-esi -24934 5b/pop-to-ebx -24935 5a/pop-to-edx -24936 59/pop-to-ecx -24937 58/pop-to-eax -24938 # . epilogue -24939 89/<- %esp 5/r32/ebp -24940 5d/pop-to-ebp -24941 c3/return -24942 -24943 array-element-size: # arr: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int -24944 # . prologue -24945 55/push-ebp -24946 89/<- %ebp 4/r32/esp -24947 # -24948 (array-element-type-id *(ebp+8) *(ebp+0xc) *(ebp+0x10)) # => eax -24949 (size-of-type-id-as-array-element %eax) # => eax -24950 $array-element-size:end: -24951 # . epilogue -24952 89/<- %esp 5/r32/ebp -24953 5d/pop-to-ebp -24954 c3/return -24955 -24956 array-element-type-id: # v: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: type-id -24957 # precondition: n is positive -24958 # . prologue -24959 55/push-ebp -24960 89/<- %ebp 4/r32/esp -24961 # -24962 8b/-> *(ebp+8) 0/r32/eax -24963 # var t/eax: (addr type-tree) -24964 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -24965 # if t == 0 abort -24966 3d/compare-eax-with 0/imm32 -24967 0f 84/jump-if-== $array-element-type-id:error0/disp32 -24968 # if t->is-atom? abort -24969 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -24970 0f 85/jump-if-!= $array-element-type-id:error1/disp32 -24971 # if (t->left == addr) t = t->right -24972 { -24973 50/push-eax -24974 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -24975 (is-simple-mu-type? %eax 2) # addr => eax -24976 3d/compare-eax-with 0/imm32/false -24977 58/pop-to-eax -24978 74/jump-if-= break/disp8 -24979 $array-element-type-id:skip-addr: -24980 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -24981 } -24982 # if t == 0 abort -24983 3d/compare-eax-with 0/imm32 -24984 0f 84/jump-if-= $array-element-type-id:error2/disp32 -24985 # if t->is-atom? abort -24986 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -24987 0f 85/jump-if-!= $array-element-type-id:error2/disp32 -24988 # if t->left != array abort -24989 { -24990 50/push-eax -24991 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -24992 (is-simple-mu-type? %eax 3) # array => eax -24993 3d/compare-eax-with 0/imm32/false -24994 58/pop-to-eax -24995 $array-element-type-id:no-array: -24996 0f 84/jump-if-= $array-element-type-id:error2/disp32 -24997 } -24998 $array-element-type-id:skip-array: -24999 # t = t->right -25000 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -25001 # if t == 0 abort -25002 3d/compare-eax-with 0/imm32 -25003 0f 84/jump-if-= $array-element-type-id:error2/disp32 -25004 # if t->is-atom? abort -25005 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -25006 0f 85/jump-if-!= $array-element-type-id:error2/disp32 -25007 # t = t->left -25008 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -25009 # if (!t->is-atom?) t = t->left # TODO: assumes array element size can be determined from just first word of array element type -25010 # if (t->is-atom == false) t = lookup(t->left) -25011 { -25012 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -25013 75/jump-if-!= break/disp8 -25014 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -25015 } -25016 # return t->value -25017 8b/-> *(eax+4) 0/r32/eax # Type-tree-value -25018 $array-element-type-id:end: -25019 # . epilogue -25020 89/<- %esp 5/r32/ebp -25021 5d/pop-to-ebp -25022 c3/return -25023 -25024 $array-element-type-id:error0: -25025 (write-buffered *(ebp+0xc) "array-element-type-id: var '") -25026 50/push-eax -25027 8b/-> *(ebp+8) 0/r32/eax -25028 (lookup *eax *(eax+4)) # Var-name Var-name => eax -25029 (write-buffered *(ebp+0xc) %eax) -25030 58/pop-to-eax -25031 (write-buffered *(ebp+0xc) "' has no type\n") -25032 (flush *(ebp+0xc)) -25033 (stop *(ebp+0x10) 1) -25034 # never gets here -25035 -25036 $array-element-type-id:error1: -25037 (write-buffered *(ebp+0xc) "array-element-type-id: var '") -25038 50/push-eax -25039 8b/-> *(ebp+8) 0/r32/eax -25040 (lookup *eax *(eax+4)) # Var-name Var-name => eax -25041 (write-buffered *(ebp+0xc) %eax) -25042 58/pop-to-eax -25043 (write-buffered *(ebp+0xc) "' has atomic type ") -25044 (write-int32-hex-buffered *(ebp+0xc) *(eax+4)) # Type-tree-value -25045 (write-buffered *(ebp+0xc) Newline) -25046 (flush *(ebp+0xc)) -25047 (stop *(ebp+0x10) 1) -25048 # never gets here -25049 -25050 $array-element-type-id:error2: -25051 (write-buffered *(ebp+0xc) "array-element-type-id: var '") -25052 50/push-eax -25053 8b/-> *(ebp+8) 0/r32/eax -25054 (lookup *eax *(eax+4)) # Var-name Var-name => eax -25055 (write-buffered *(ebp+0xc) %eax) -25056 58/pop-to-eax -25057 (write-buffered *(ebp+0xc) "' has non-array type\n") -25058 (flush *(ebp+0xc)) -25059 (stop *(ebp+0x10) 1) -25060 # never gets here -25061 -25062 size-of-type-id-as-array-element: # t: type-id -> result/eax: int -25063 # . prologue -25064 55/push-ebp -25065 89/<- %ebp 4/r32/esp -25066 # eax = t -25067 8b/-> *(ebp+8) 0/r32/eax -25068 # if t is 'byte', size is 1 -25069 3d/compare-eax-and 8/imm32/byte -25070 { -25071 75/jump-if-!= break/disp8 -25072 b8/copy-to-eax 1/imm32 -25073 eb/jump $size-of-type-id-as-array-element:end/disp8 -25074 } -25075 # otherwise proceed as usual -25076 (size-of-type-id %eax) # => eax -25077 $size-of-type-id-as-array-element:end: -25078 # . epilogue -25079 89/<- %esp 5/r32/ebp -25080 5d/pop-to-ebp -25081 c3/return -25082 -25083 emit-save-size-to: # out: (addr buffered-file), base: (addr var), outreg: (addr array byte) -25084 # . prologue -25085 55/push-ebp -25086 89/<- %ebp 4/r32/esp -25087 # . save registers -25088 50/push-eax -25089 53/push-ebx -25090 # ebx = base -25091 8b/-> *(ebp+0xc) 3/r32/ebx -25092 (emit-indent *(ebp+8) *Curr-block-depth) -25093 (write-buffered *(ebp+8) "8b/-> *") -25094 # if base is an (addr array ...) in a register -25095 { -25096 81 7/subop/compare *(ebx+0x18)) 0/imm32 # Var-register -25097 74/jump-if-= break/disp8 -25098 $emit-save-size-to:emit-base-from-register: -25099 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -25100 (write-buffered *(ebp+8) %eax) -25101 eb/jump $emit-save-size-to:emit-output/disp8 -25102 } -25103 # otherwise if base is an (array ...) on the stack -25104 { -25105 81 7/subop/compare *(ebx+0x14)) 0/imm32 # Var-offset -25106 74/jump-if-= break/disp8 -25107 $emit-save-size-to:emit-base-from-stack: -25108 (write-buffered *(ebp+8) "(ebp+") -25109 (write-int32-hex-buffered *(ebp+8) *(ebx+0x14)) # Var-offset -25110 (write-buffered *(ebp+8) ")") -25111 } -25112 $emit-save-size-to:emit-output: -25113 (write-buffered *(ebp+8) " ") -25114 (get Mu-registers *(ebp+0x10) 0xc "Mu-registers") # => eax -25115 (write-int32-hex-buffered *(ebp+8) *eax) -25116 (write-buffered *(ebp+8) "/r32\n") -25117 $emit-save-size-to:end: -25118 # . restore registers -25119 5b/pop-to-ebx -25120 58/pop-to-eax -25121 # . epilogue -25122 89/<- %esp 5/r32/ebp -25123 5d/pop-to-ebp -25124 c3/return -25125 -25126 emit-divide-by-shift-right: # out: (addr buffered-file), reg: (addr array byte), size: int -25127 # . prologue -25128 55/push-ebp -25129 89/<- %ebp 4/r32/esp -25130 # . save registers -25131 50/push-eax -25132 # -25133 (emit-indent *(ebp+8) *Curr-block-depth) -25134 (write-buffered *(ebp+8) "c1/shift 5/subop/>> %") -25135 (write-buffered *(ebp+8) *(ebp+0xc)) -25136 (write-buffered *(ebp+8) Space) -25137 (num-shift-rights *(ebp+0x10)) # => eax -25138 (write-int32-hex-buffered *(ebp+8) %eax) -25139 (write-buffered *(ebp+8) "/imm8\n") -25140 $emit-divide-by-shift-right:end: -25141 # . restore registers -25142 58/pop-to-eax -25143 # . epilogue -25144 89/<- %esp 5/r32/ebp -25145 5d/pop-to-ebp -25146 c3/return -25147 -25148 translate-mu-index-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -25149 # . prologue -25150 55/push-ebp -25151 89/<- %ebp 4/r32/esp -25152 # . save registers -25153 51/push-ecx -25154 # ecx = stmt -25155 8b/-> *(ebp+0xc) 1/r32/ecx -25156 # var base/ecx: (addr var) = stmt->inouts[0] -25157 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -25158 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25159 89/<- %ecx 0/r32/eax -25160 # if (var->register) do one thing -25161 { -25162 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register -25163 74/jump-if-= break/disp8 -25164 # TODO: ensure there's no dereference -25165 (translate-mu-index-stmt-with-array-in-register *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -25166 eb/jump $translate-mu-index-stmt:end/disp8 -25167 } -25168 # if (var->offset) do a different thing -25169 { -25170 81 7/subop/compare *(ecx+0x14) 0/imm32 # Var-offset -25171 74/jump-if-= break/disp8 -25172 # TODO: ensure there's no dereference -25173 (translate-mu-index-stmt-with-array-on-stack *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) -25174 eb/jump $translate-mu-index-stmt:end/disp8 -25175 } -25176 $translate-mu-index-stmt:end: -25177 # . restore registers -25178 59/pop-to-ecx -25179 # . epilogue -25180 89/<- %esp 5/r32/ebp -25181 5d/pop-to-ebp -25182 c3/return -25183 -25184 $translate-mu-index-stmt-with-array:error1: -25185 (write-buffered *(ebp+0x10) "couldn't translate an index instruction. second (index) input must either lie in a register or be a literal\n") -25186 (flush *(ebp+0x10)) -25187 (stop *(ebp+0x14) 1) -25188 # never gets here -25189 -25190 $translate-mu-index-stmt-with-array:error2: -25191 (write-buffered *(ebp+0x10) "couldn't translate an index instruction. second (index) input when in a register must be an int or offset\n") -25192 (flush *(ebp+0x10)) -25193 (stop *(ebp+0x14) 1) -25194 # never gets here -25195 -25196 translate-mu-index-stmt-with-array-in-register: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -25197 # . prologue -25198 55/push-ebp -25199 89/<- %ebp 4/r32/esp -25200 # . save registers -25201 50/push-eax -25202 51/push-ecx -25203 52/push-edx -25204 53/push-ebx -25205 # -25206 (emit-indent *(ebp+8) *Curr-block-depth) -25207 (write-buffered *(ebp+8) "8d/copy-address *(") -25208 # TODO: ensure inouts[0] is in a register and not dereferenced -25209 $translate-mu-index-stmt-with-array-in-register:emit-base: -25210 # ecx = stmt -25211 8b/-> *(ebp+0xc) 1/r32/ecx -25212 # var base/ebx: (addr var) = inouts[0] -25213 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -25214 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25215 89/<- %ebx 0/r32/eax -25216 # print base->register " + " -25217 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax -25218 (write-buffered *(ebp+8) %eax) -25219 (write-buffered *(ebp+8) " + ") -25220 # var index/edx: (addr var) = inouts[1] -25221 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -25222 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -25223 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25224 89/<- %edx 0/r32/eax -25225 # if index->register -25226 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register -25227 { -25228 0f 84/jump-if-= break/disp32 -25229 $translate-mu-index-stmt-with-array-in-register:emit-register-index: -25230 # if index is an int -25231 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -25232 (is-simple-mu-type? %eax 1) # int => eax -25233 3d/compare-eax-and 0/imm32/false -25234 { -25235 0f 84/jump-if-= break/disp32 -25236 $translate-mu-index-stmt-with-array-in-register:emit-int-register-index: -25237 # print index->register "<<" log2(array-element-size(base)) " + 4) " -25238 # . index->register "<<" -25239 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -25240 (write-buffered *(ebp+8) %eax) -25241 (write-buffered *(ebp+8) "<<") -25242 # . log2(array-element-size(base->type)) -25243 # TODO: ensure size is a power of 2 -25244 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax -25245 (num-shift-rights %eax) # => eax -25246 (write-int32-hex-buffered *(ebp+8) %eax) -25247 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-register-index-done/disp32 -25248 } -25249 # if index->type is any other atom, abort -25250 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -25251 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -25252 0f 85/jump-if-!= $translate-mu-index-stmt-with-array:error2/disp32 -25253 # if index has type (offset ...) -25254 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -25255 (is-simple-mu-type? %eax 7) # => eax -25256 3d/compare-eax-and 0/imm32/false -25257 { -25258 0f 84/jump-if-= break/disp32 -25259 # print index->register -25260 $translate-mu-index-stmt-with-array-in-register:emit-offset-register-index: -25261 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -25262 (write-buffered *(ebp+8) %eax) -25263 } -25264 $translate-mu-index-stmt-with-array-in-register:emit-register-index-done: -25265 (write-buffered *(ebp+8) " + 4) ") -25266 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 -25267 } -25268 # otherwise if index is a literal -25269 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -25270 (is-simple-mu-type? %eax 0) # => eax -25271 3d/compare-eax-and 0/imm32/false -25272 { -25273 0f 84/jump-if-= break/disp32 -25274 $translate-mu-index-stmt-with-array-in-register:emit-literal-index: -25275 # var index-value/edx: int = parse-hex-int(index->name) -25276 (lookup *edx *(edx+4)) # Var-name Var-name => eax -25277 (parse-hex-int %eax) # => eax -25278 89/<- %edx 0/r32/eax -25279 # offset = idx-value * array-element-size(base->type) -25280 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax -25281 f7 4/subop/multiply-into-edx-eax %edx # clobbers edx -25282 # offset += 4 for array size -25283 05/add-to-eax 4/imm32 -25284 # TODO: check edx for overflow -25285 # print offset -25286 (write-int32-hex-buffered *(ebp+8) %eax) -25287 (write-buffered *(ebp+8) ") ") -25288 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 -25289 } -25290 # otherwise abort -25291 e9/jump $translate-mu-index-stmt-with-array:error1/disp32 -25292 $translate-mu-index-stmt-with-array-in-register:emit-output: -25293 # outputs[0] "/r32" -25294 8b/-> *(ebp+0xc) 1/r32/ecx -25295 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -25296 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25297 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -25298 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) -25299 (write-int32-hex-buffered *(ebp+8) *eax) -25300 (write-buffered *(ebp+8) "/r32\n") -25301 $translate-mu-index-stmt-with-array-in-register:end: -25302 # . restore registers -25303 5b/pop-to-ebx -25304 5a/pop-to-edx -25305 59/pop-to-ecx -25306 58/pop-to-eax -25307 # . epilogue -25308 89/<- %esp 5/r32/ebp -25309 5d/pop-to-ebp -25310 c3/return -25311 -25312 translate-mu-index-stmt-with-array-on-stack: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -25313 # . prologue -25314 55/push-ebp -25315 89/<- %ebp 4/r32/esp -25316 # . save registers -25317 50/push-eax -25318 51/push-ecx -25319 52/push-edx -25320 53/push-ebx -25321 # -25322 (emit-indent *(ebp+8) *Curr-block-depth) -25323 (write-buffered *(ebp+8) "8d/copy-address *(ebp + ") -25324 # var curr/edx: (addr stmt-var) = lookup(stmt->inouts) -25325 8b/-> *(ebp+0xc) 0/r32/eax -25326 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -25327 89/<- %edx 0/r32/eax -25328 # var base/ecx: (addr var) = lookup(curr->value) -25329 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25330 89/<- %ecx 0/r32/eax -25331 # var curr2/eax: (addr stmt-var) = lookup(curr->next) -25332 (lookup *(edx+8) *(edx+0xc)) # Stmt-var-next Stmt-var-next => eax -25333 # var index/edx: (handle var) = curr2->value -25334 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25335 89/<- %edx 0/r32/eax -25336 # if index->register -25337 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register -25338 { -25339 0f 84/jump-if-= break/disp32 -25340 $translate-mu-index-stmt-with-array-on-stack:emit-register-index: -25341 # if index is an int -25342 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -25343 (is-simple-mu-type? %eax 1) # int => eax -25344 3d/compare-eax-and 0/imm32/false -25345 { -25346 0f 84/jump-if-= break/disp32 -25347 $translate-mu-index-stmt-with-array-on-stack:emit-int-register-index: -25348 # print index->register "<<" log2(array-element-size(base)) " + " base->offset+4 -25349 # . inouts[1]->register "<<" -25350 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -25351 (write-buffered *(ebp+8) %eax) -25352 (write-buffered *(ebp+8) "<<") -25353 # . log2(array-element-size(base)) -25354 # TODO: ensure size is a power of 2 -25355 (array-element-size %ecx *(ebp+0x10) *(ebp+0x14)) # => eax -25356 (num-shift-rights %eax) # => eax -25357 (write-int32-hex-buffered *(ebp+8) %eax) -25358 # -25359 (write-buffered *(ebp+8) " + ") -25360 # -25361 8b/-> *(ecx+0x14) 0/r32/eax # Var-offset -25362 05/add-to-eax 4/imm32 # for array length -25363 (write-int32-hex-buffered *(ebp+8) %eax) -25364 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done/disp32 -25365 } -25366 # if index->type is any other atom, abort -25367 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -25368 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -25369 0f 85/jump-if-!= $translate-mu-index-stmt-with-array:error2/disp32 -25370 # if index has type (offset ...) -25371 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -25372 (is-simple-mu-type? %eax 7) # => eax -25373 3d/compare-eax-and 0/imm32/false -25374 { -25375 0f 84/jump-if-= break/disp32 -25376 # print index->register -25377 $translate-mu-index-stmt-with-array-on-stack:emit-offset-register-index: -25378 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax -25379 (write-buffered *(ebp+8) %eax) -25380 } -25381 $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done: -25382 (write-buffered *(ebp+8) ") ") -25383 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 -25384 } -25385 # otherwise if index is a literal -25386 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax -25387 (is-simple-mu-type? %eax 0) # => eax -25388 3d/compare-eax-and 0/imm32/false -25389 { -25390 0f 84/jump-if-= break/disp32 -25391 $translate-mu-index-stmt-with-array-on-stack:emit-literal-index: -25392 # var idx-value/edx: int = parse-hex-int(index->name) -25393 (lookup *edx *(edx+4)) # Var-name Var-name => eax -25394 (parse-hex-int %eax) # Var-name => eax -25395 89/<- %edx 0/r32/eax -25396 # offset = idx-value * array-element-size(base) -25397 (array-element-size %ecx *(ebp+0x10) *(ebp+0x14)) # => eax -25398 f7 4/subop/multiply-into-edx-eax %edx # clobbers edx -25399 # offset += base->offset -25400 03/add *(ecx+0x14) 0/r32/eax # Var-offset -25401 # offset += 4 for array size -25402 05/add-to-eax 4/imm32 -25403 # TODO: check edx for overflow -25404 # print offset -25405 (write-int32-hex-buffered *(ebp+8) %eax) -25406 (write-buffered *(ebp+8) ") ") -25407 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 -25408 } -25409 # otherwise abort -25410 e9/jump $translate-mu-index-stmt-with-array:error1/disp32 -25411 $translate-mu-index-stmt-with-array-on-stack:emit-output: -25412 # outputs[0] "/r32" -25413 8b/-> *(ebp+0xc) 0/r32/eax -25414 (lookup *(eax+0x14) *(eax+0x18)) # Stmt1-outputs Stmt1-outputs => eax -25415 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25416 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -25417 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) -25418 (write-int32-hex-buffered *(ebp+8) *eax) -25419 (write-buffered *(ebp+8) "/r32\n") -25420 $translate-mu-index-stmt-with-array-on-stack:end: -25421 # . restore registers -25422 5b/pop-to-ebx -25423 5a/pop-to-edx -25424 59/pop-to-ecx -25425 58/pop-to-eax -25426 # . epilogue -25427 89/<- %esp 5/r32/ebp -25428 5d/pop-to-ebp -25429 c3/return -25430 -25431 translate-mu-compute-index-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -25432 # . prologue -25433 55/push-ebp -25434 89/<- %ebp 4/r32/esp -25435 # . save registers -25436 50/push-eax -25437 51/push-ecx -25438 52/push-edx -25439 53/push-ebx -25440 # -25441 (emit-indent *(ebp+8) *Curr-block-depth) -25442 (write-buffered *(ebp+8) "69/multiply") -25443 # ecx = stmt -25444 8b/-> *(ebp+0xc) 1/r32/ecx -25445 # var first-inout/ebx: (addr stmt-var) = stmt->inouts[0] -25446 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -25447 89/<- %ebx 0/r32/eax -25448 $translate-mu-compute-index-stmt:emit-index: -25449 (lookup *(ebx+8) *(ebx+0xc)) # Stmt-var-next Stmt-var-next => eax -25450 (emit-subx-var-as-rm32 *(ebp+8) %eax) -25451 (write-buffered *(ebp+8) Space) -25452 $translate-mu-compute-index-stmt:emit-elem-size: -25453 # var base/ebx: (addr var) -25454 (lookup *ebx *(ebx+4)) # Stmt-var-value Stmt-var-value => eax -25455 89/<- %ebx 0/r32/eax -25456 # print array-element-size(base) -25457 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax -25458 (write-int32-hex-buffered *(ebp+8) %eax) -25459 (write-buffered *(ebp+8) "/imm32 ") -25460 $translate-mu-compute-index-stmt:emit-output: -25461 # outputs[0] "/r32" -25462 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -25463 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25464 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -25465 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) -25466 (write-int32-hex-buffered *(ebp+8) *eax) -25467 (write-buffered *(ebp+8) "/r32\n") -25468 $translate-mu-compute-index-stmt:end: -25469 # . restore registers -25470 5b/pop-to-ebx -25471 5a/pop-to-edx -25472 59/pop-to-ecx -25473 58/pop-to-eax -25474 # . epilogue -25475 89/<- %esp 5/r32/ebp -25476 5d/pop-to-ebp -25477 c3/return -25478 -25479 translate-mu-get-stmt: # out: (addr buffered-file), stmt: (addr stmt) -25480 # . prologue -25481 55/push-ebp -25482 89/<- %ebp 4/r32/esp -25483 # . save registers -25484 50/push-eax -25485 51/push-ecx -25486 52/push-edx -25487 # -25488 (emit-indent *(ebp+8) *Curr-block-depth) -25489 (write-buffered *(ebp+8) "8d/copy-address ") -25490 # ecx = stmt -25491 8b/-> *(ebp+0xc) 1/r32/ecx -25492 # var offset/edx: int = get offset of stmt -25493 (mu-get-offset %ecx) # => eax -25494 89/<- %edx 0/r32/eax -25495 # var base/eax: (addr var) = stmt->inouts->value -25496 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -25497 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25498 # if base is in a register -25499 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register -25500 { -25501 0f 84/jump-if-= break/disp32 -25502 $translate-mu-get-stmt:emit-register-input: -25503 # emit "*(" base->register " + " offset ") " -25504 (write-buffered *(ebp+8) "*(") -25505 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -25506 (write-buffered *(ebp+8) %eax) -25507 (write-buffered *(ebp+8) " + ") -25508 (write-int32-hex-buffered *(ebp+8) %edx) -25509 (write-buffered *(ebp+8) ") ") -25510 e9/jump $translate-mu-get-stmt:emit-output/disp32 -25511 } -25512 # otherwise base is on the stack -25513 { -25514 $translate-mu-get-stmt:emit-stack-input: -25515 # emit "*(ebp + " inouts[0]->stack-offset + offset ") " -25516 (write-buffered *(ebp+8) "*(ebp+") -25517 03/add *(eax+0x14) 2/r32/edx # Var-offset -25518 (write-int32-hex-buffered *(ebp+8) %edx) -25519 (write-buffered *(ebp+8) ") ") -25520 eb/jump $translate-mu-get-stmt:emit-output/disp8 -25521 } -25522 $translate-mu-get-stmt:emit-output: -25523 # var output/eax: (addr var) = stmt->outputs->value -25524 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -25525 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25526 # emit offset->register "/r32" -25527 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -25528 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) -25529 (write-int32-hex-buffered *(ebp+8) *eax) -25530 (write-buffered *(ebp+8) "/r32\n") -25531 $translate-mu-get-stmt:end: -25532 # . restore registers -25533 5a/pop-to-edx -25534 59/pop-to-ecx -25535 58/pop-to-eax -25536 # . epilogue -25537 89/<- %esp 5/r32/ebp -25538 5d/pop-to-ebp -25539 c3/return -25540 -25541 translate-mu-copy-object-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -25542 # . prologue -25543 55/push-ebp -25544 89/<- %ebp 4/r32/esp -25545 # . save registers -25546 50/push-eax -25547 # -25548 (emit-indent *(ebp+8) *Curr-block-depth) -25549 (write-buffered *(ebp+8) "(copy-bytes") -25550 # eax = stmt -25551 8b/-> *(ebp+0xc) 0/r32/eax -25552 # var first-inout/eax: (addr stmt-var) = stmt->inouts[0] -25553 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -25554 (emit-subx-call-operand *(ebp+8) %eax) -25555 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -25556 (emit-subx-call-operand *(ebp+8) %eax) -25557 (write-buffered *(ebp+8) Space) -25558 (addr-payload-size %eax *(ebp+0x10) *(ebp+0x14)) # => eax -25559 (write-int32-hex-buffered *(ebp+8) %eax) -25560 (write-buffered *(ebp+8) ")\n") -25561 $translate-mu-copy-object-stmt:end: -25562 # . restore registers -25563 58/pop-to-eax -25564 # . epilogue -25565 89/<- %esp 5/r32/ebp -25566 5d/pop-to-ebp -25567 c3/return -25568 -25569 translate-mu-allocate-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -25570 # . prologue -25571 55/push-ebp -25572 89/<- %ebp 4/r32/esp -25573 # . save registers -25574 50/push-eax -25575 56/push-esi -25576 57/push-edi -25577 # esi = stmt -25578 8b/-> *(ebp+0xc) 6/r32/esi -25579 # var target/edi: (addr stmt-var) = stmt->inouts[0] -25580 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -25581 89/<- %edi 0/r32/eax -25582 # -25583 (emit-indent *(ebp+8) *Curr-block-depth) -25584 (write-buffered *(ebp+8) "(allocate Heap ") -25585 (addr-handle-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax -25586 (write-int32-hex-buffered *(ebp+8) %eax) -25587 (emit-subx-call-operand *(ebp+8) %edi) -25588 (write-buffered *(ebp+8) ")\n") -25589 $translate-mu-allocate-stmt:end: -25590 # . restore registers -25591 5f/pop-to-edi -25592 5e/pop-to-esi -25593 58/pop-to-eax -25594 # . epilogue -25595 89/<- %esp 5/r32/ebp -25596 5d/pop-to-ebp -25597 c3/return -25598 -25599 addr-handle-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int -25600 # . prologue -25601 55/push-ebp -25602 89/<- %ebp 4/r32/esp -25603 # var t/eax: (addr type-tree) = s->value->type -25604 8b/-> *(ebp+8) 0/r32/eax -25605 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25606 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -25607 # TODO: check eax != 0 -25608 # TODO: check !t->is-atom? -25609 # TODO: check t->left == addr -25610 # t = t->right -25611 $addr-handle-payload-size:skip-addr: -25612 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -25613 # TODO: check eax != 0 -25614 # TODO: check !t->is-atom? -25615 # TODO: check t->left == handle -25616 # t = t->right -25617 $addr-handle-payload-size:skip-handle: -25618 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -25619 # TODO: check eax != 0 -25620 # if !t->is-atom? t = t->left -25621 81 7/subop/compare *eax 0/imm32/false -25622 { -25623 75/jump-if-!= break/disp8 -25624 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -25625 } -25626 # TODO: check t->is-atom? -25627 # return size(t->value) -25628 (size-of-type-id *(eax+4)) # Type-tree-value => eax -25629 $addr-handle-payload-size:end: -25630 # . epilogue -25631 89/<- %esp 5/r32/ebp -25632 5d/pop-to-ebp -25633 c3/return -25634 -25635 addr-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int -25636 # . prologue -25637 55/push-ebp -25638 89/<- %ebp 4/r32/esp -25639 # var t/eax: (addr type-tree) = s->value->type -25640 8b/-> *(ebp+8) 0/r32/eax -25641 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25642 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -25643 # TODO: check eax != 0 -25644 # TODO: check !t->is-atom? -25645 # TODO: check t->left == addr -25646 # t = t->right -25647 $addr-payload-size:skip-addr: -25648 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -25649 # TODO: check eax != 0 -25650 # if !t->is-atom? t = t->left -25651 81 7/subop/compare *eax 0/imm32/false -25652 { -25653 75/jump-if-!= break/disp8 -25654 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -25655 } -25656 # TODO: check t->is-atom? -25657 # return size(t->value) -25658 (size-of-type-id *(eax+4)) # Type-tree-value => eax -25659 $addr-payload-size:end: -25660 # . epilogue -25661 89/<- %esp 5/r32/ebp -25662 5d/pop-to-ebp -25663 c3/return -25664 -25665 translate-mu-populate-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -25666 # . prologue -25667 55/push-ebp -25668 89/<- %ebp 4/r32/esp -25669 # . save registers -25670 50/push-eax -25671 51/push-ecx -25672 56/push-esi -25673 57/push-edi -25674 # esi = stmt -25675 8b/-> *(ebp+0xc) 6/r32/esi -25676 # var target/edi: (addr stmt-var) = stmt->inouts[0] -25677 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -25678 89/<- %edi 0/r32/eax -25679 # var len/ecx: (addr stmt-var) = stmt->inouts[1] -25680 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -25681 89/<- %ecx 0/r32/eax -25682 # -25683 (emit-indent *(ebp+8) *Curr-block-depth) -25684 (write-buffered *(ebp+8) "(allocate-array2 Heap ") -25685 (addr-handle-array-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax -25686 (write-int32-hex-buffered *(ebp+8) %eax) -25687 (emit-subx-call-operand *(ebp+8) %ecx) -25688 (emit-subx-call-operand *(ebp+8) %edi) -25689 (write-buffered *(ebp+8) ")\n") -25690 $translate-mu-populate-stmt:end: -25691 # . restore registers -25692 5f/pop-to-edi -25693 5e/pop-to-esi -25694 59/pop-to-ecx -25695 58/pop-to-eax -25696 # . epilogue -25697 89/<- %esp 5/r32/ebp -25698 5d/pop-to-ebp -25699 c3/return -25700 -25701 translate-mu-populate-stream-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -25702 # . prologue -25703 55/push-ebp -25704 89/<- %ebp 4/r32/esp -25705 # . save registers -25706 50/push-eax -25707 51/push-ecx -25708 56/push-esi -25709 57/push-edi -25710 # esi = stmt -25711 8b/-> *(ebp+0xc) 6/r32/esi -25712 # var target/edi: (addr stmt-var) = stmt->inouts[0] -25713 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -25714 89/<- %edi 0/r32/eax -25715 # var len/ecx: (addr stmt-var) = stmt->inouts[1] -25716 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax -25717 89/<- %ecx 0/r32/eax -25718 # -25719 (emit-indent *(ebp+8) *Curr-block-depth) -25720 (write-buffered *(ebp+8) "(new-stream Heap ") -25721 (addr-handle-stream-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax -25722 (write-int32-hex-buffered *(ebp+8) %eax) -25723 (emit-subx-call-operand *(ebp+8) %ecx) -25724 (emit-subx-call-operand *(ebp+8) %edi) -25725 (write-buffered *(ebp+8) ")\n") -25726 $translate-mu-populate-stream-stmt:end: -25727 # . restore registers -25728 5f/pop-to-edi -25729 5e/pop-to-esi -25730 59/pop-to-ecx -25731 58/pop-to-eax -25732 # . epilogue -25733 89/<- %esp 5/r32/ebp -25734 5d/pop-to-ebp -25735 c3/return -25736 -25737 translate-mu-read-from-stream-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -25738 # . prologue -25739 55/push-ebp -25740 89/<- %ebp 4/r32/esp -25741 # . save registers +24094 $emit-subx-stmt-list:check-for-reg-var-def: +24095 81 7/subop/compare *ecx 3/imm32/reg-var-def # Stmt-tag +24096 0f 85/jump-if-!= break/disp32 +24097 $emit-subx-stmt-list:reg-var-def: +24098 # TODO: ensure that there's exactly one output +24099 (push-output-and-maybe-emit-spill *(ebp+8) %ecx *(ebp+0x10) %esi *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +24100 # emit the instruction as usual +24101 (emit-subx-stmt *(ebp+8) %ecx Primitives *(ebp+0x18) *(ebp+0x1c)) +24102 # +24103 eb/jump $emit-subx-stmt-list:continue/disp8 +24104 } +24105 $emit-subx-stmt-list:continue: +24106 # TODO: raise an error on unrecognized Stmt-tag +24107 (lookup *(esi+8) *(esi+0xc)) # List-next List-next => eax +24108 89/<- %esi 0/r32/eax +24109 e9/jump loop/disp32 +24110 } +24111 $emit-subx-stmt-list:emit-cleanup: +24112 (emit-cleanup-code-until-depth *(ebp+8) *(ebp+0x10) *Curr-block-depth) +24113 $emit-subx-stmt-list:clean-up: +24114 (clean-up-stack-offset-state *(ebp+0x10) *Curr-block-depth) +24115 (clean-up-blocks *(ebp+0x10) *Curr-block-depth *(ebp+0x14)) +24116 $emit-subx-stmt-list:end: +24117 # . restore registers +24118 5e/pop-to-esi +24119 5b/pop-to-ebx +24120 59/pop-to-ecx +24121 58/pop-to-eax +24122 # . epilogue +24123 89/<- %esp 5/r32/ebp +24124 5d/pop-to-ebp +24125 c3/return +24126 +24127 # 'later-stmts' includes 'stmt', but will behave the same even without it; reg-var-def stmts are guaranteed not to write to function outputs. +24128 push-output-and-maybe-emit-spill: # out: (addr buffered-file), stmt: (addr reg-var-def), vars: (addr stack (handle var)), later-stmts: (addr list stmt), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +24129 # . prologue +24130 55/push-ebp +24131 89/<- %ebp 4/r32/esp +24132 # . save registers +24133 50/push-eax +24134 51/push-ecx +24135 52/push-edx +24136 # ecx = stmt +24137 8b/-> *(ebp+0xc) 1/r32/ecx +24138 # var sv/eax: (addr stmt-var) = lookup(curr-stmt->outputs) +24139 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax +24140 # TODO: assert !sv->is-deref? +24141 # var v/ecx: (addr var) = lookup(sv->value) +24142 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +24143 89/<- %ecx 0/r32/eax +24144 # v->block-depth = *Curr-block-depth +24145 8b/-> *Curr-block-depth 0/r32/eax +24146 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth +24147 #? (write-buffered Stderr "var ") +24148 #? (lookup *ecx *(ecx+4)) +24149 #? (write-buffered Stderr %eax) +24150 #? (write-buffered Stderr " at depth ") +24151 #? (write-int32-hex-buffered Stderr *(ecx+0x10)) +24152 #? (write-buffered Stderr Newline) +24153 #? (flush Stderr) +24154 # ensure that v is in a register +24155 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +24156 0f 84/jump-if-= $push-output-and-maybe-emit-spill:abort/disp32 +24157 # var emit-spill?/edx: boolean = not-yet-spilled-this-block? && will-not-write-some-register?(fn) +24158 (not-yet-spilled-this-block? %ecx *(ebp+0x10)) # => eax +24159 89/<- %edx 0/r32/eax +24160 3d/compare-eax-and 0/imm32/false +24161 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 +24162 (will-not-write-some-register? %ecx *(ebp+0x14) *(ebp+0x18)) # => eax +24163 89/<- %edx 0/r32/eax +24164 # check emit-spill? +24165 3d/compare-eax-and 0/imm32/false +24166 0f 84/jump-if-= $push-output-and-maybe-emit-spill:push/disp32 +24167 # TODO: assert(size-of(output) == 4) +24168 # *Curr-local-stack-offset -= 4 +24169 81 5/subop/subtract *Curr-local-stack-offset 4/imm32 +24170 # emit spill +24171 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax +24172 (emit-push-register *(ebp+8) %eax) +24173 $push-output-and-maybe-emit-spill:push: +24174 8b/-> *(ebp+0xc) 1/r32/ecx +24175 (lookup *(ecx+0x14) *(ecx+0x18)) # Regvardef-outputs Regvardef-outputs => eax +24176 # push(vars, {sv->value, emit-spill?}) +24177 (push *(ebp+0x10) *eax) # Stmt-var-value +24178 (push *(ebp+0x10) *(eax+4)) # Stmt-var-value +24179 (push *(ebp+0x10) %edx) +24180 $push-output-and-maybe-emit-spill:end: +24181 # . restore registers +24182 5a/pop-to-edx +24183 59/pop-to-ecx +24184 58/pop-to-eax +24185 # . epilogue +24186 89/<- %esp 5/r32/ebp +24187 5d/pop-to-ebp +24188 c3/return +24189 +24190 $push-output-and-maybe-emit-spill:abort: +24191 # error("var '" var->name "' initialized from an instruction must live in a register\n") +24192 (write-buffered *(ebp+0x1c) "var '") +24193 (write-buffered *(ebp+0x1c) *eax) # Var-name +24194 (write-buffered *(ebp+0x1c) "' initialized from an instruction must live in a register\n") +24195 (flush *(ebp+0x1c)) +24196 (stop *(ebp+0x20) 1) +24197 # never gets here +24198 +24199 emit-subx-cleanup-and-unconditional-nonlocal-branch: # out: (addr buffered-file), stmt: (addr stmt1), vars: (addr stack live-var) +24200 # . prologue +24201 55/push-ebp +24202 89/<- %ebp 4/r32/esp +24203 # . save registers +24204 50/push-eax +24205 51/push-ecx +24206 # ecx = stmt +24207 8b/-> *(ebp+0xc) 1/r32/ecx +24208 # var target/eax: (addr array byte) = curr-stmt->inouts->value->name +24209 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +24210 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +24211 (lookup *eax *(eax+4)) # Var-name Var-name => eax +24212 # clean up until target block +24213 (emit-cleanup-code-until-target *(ebp+8) *(ebp+0x10) %eax) +24214 # emit jump to target block +24215 (emit-indent *(ebp+8) *Curr-block-depth) +24216 (write-buffered *(ebp+8) "e9/jump ") +24217 (write-buffered *(ebp+8) %eax) +24218 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +24219 (string-starts-with? %eax "break") +24220 3d/compare-eax-and 0/imm32/false +24221 { +24222 74/jump-if-= break/disp8 +24223 (write-buffered *(ebp+8) ":break/disp32\n") +24224 eb/jump $emit-subx-cleanup-and-unconditional-nonlocal-branch:end/disp8 +24225 } +24226 (write-buffered *(ebp+8) ":loop/disp32\n") +24227 $emit-subx-cleanup-and-unconditional-nonlocal-branch:end: +24228 # . restore registers +24229 59/pop-to-ecx +24230 58/pop-to-eax +24231 # . epilogue +24232 89/<- %esp 5/r32/ebp +24233 5d/pop-to-ebp +24234 c3/return +24235 +24236 emit-outputs: # out: (addr buffered-file), return-stmt: (addr stmt1), fn: (addr function) +24237 # pseudocode: +24238 # for every inout, output in return-stmt, fn->outputs +24239 # if inout is a literal +24240 # c7 0/subop/copy %output inout/imm32 +24241 # otherwise +24242 # 8b/-> inout %output +24243 # +24244 # . prologue +24245 55/push-ebp +24246 89/<- %ebp 4/r32/esp +24247 # . save registers +24248 50/push-eax +24249 51/push-ecx +24250 56/push-esi +24251 57/push-edi +24252 # var curr-inout/esi: (addr stmt-var) = return-stmt->inouts +24253 8b/-> *(ebp+0xc) 0/r32/eax +24254 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +24255 89/<- %esi 0/r32/eax +24256 # var curr-output/edi: (addr list var) = fn->outputs +24257 8b/-> *(ebp+0x10) 0/r32/eax +24258 (lookup *(eax+0x10) *(eax+0x14)) # Function-outputs Function-outputs => eax +24259 89/<- %edi 0/r32/eax +24260 { +24261 $emit-outputs:loop: +24262 81 7/subop/compare %esi 0/imm32 +24263 0f 84/jump-if-= break/disp32 +24264 # emit copy to output register +24265 # var curr-var/ecx = lookup(curr-inout->value) +24266 (lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax +24267 89/<- %ecx 0/r32/eax +24268 # if curr-var is a literal, emit copy of a literal to the output +24269 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +24270 (is-simple-mu-type? %eax 0) # literal => eax +24271 { +24272 3d/compare-eax-and 0/imm32/false +24273 0f 84/jump-if-= break/disp32 +24274 (emit-indent *(ebp+8) *Curr-block-depth) +24275 (write-buffered *(ebp+8) "c7 0/subop/copy %") +24276 (lookup *edi *(edi+4)) # List-value List-value => eax +24277 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +24278 (write-buffered *(ebp+8) %eax) +24279 (write-buffered *(ebp+8) " ") +24280 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +24281 (write-buffered *(ebp+8) %eax) +24282 (write-buffered *(ebp+8) "/imm32\n") +24283 e9/jump $emit-outputs:continue/disp32 +24284 } +24285 # if the non-literal is a register starting with "x", emit a floating-point copy +24286 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax +24287 { +24288 3d/compare-eax-and 0/imm32 +24289 0f 84/jump-if-= break/disp32 +24290 8a/copy-byte *(eax+4) 0/r32/AL +24291 81 4/subop/and %eax 0xff/imm32 +24292 3d/compare-eax-and 0x78/imm32/x +24293 0f 85/jump-if-!= break/disp32 +24294 (emit-indent *(ebp+8) *Curr-block-depth) +24295 (write-buffered *(ebp+8) "f3 0f 10/->") +24296 (emit-subx-var-as-rm32 *(ebp+8) %esi) +24297 (write-buffered *(ebp+8) " ") +24298 (lookup *edi *(edi+4)) # List-value List-value => eax +24299 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +24300 (get Mu-registers %eax 0xc "Mu-registers") # => eax +24301 (write-int32-hex-buffered *(ebp+8) *eax) +24302 (write-buffered *(ebp+8) "/x32\n") +24303 e9/jump $emit-outputs:continue/disp32 +24304 } +24305 # otherwise emit an integer copy +24306 (emit-indent *(ebp+8) *Curr-block-depth) +24307 (write-buffered *(ebp+8) "8b/->") +24308 (emit-subx-var-as-rm32 *(ebp+8) %esi) +24309 (write-buffered *(ebp+8) " ") +24310 (lookup *edi *(edi+4)) # List-value List-value => eax +24311 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +24312 (get Mu-registers %eax 0xc "Mu-registers") # => eax +24313 (write-int32-hex-buffered *(ebp+8) *eax) +24314 (write-buffered *(ebp+8) "/r32\n") +24315 $emit-outputs:continue: +24316 # curr-inout = curr-inout->next +24317 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +24318 89/<- %esi 0/r32/eax +24319 # curr-output = curr-output->next +24320 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax +24321 89/<- %edi 0/r32/eax +24322 # +24323 e9/jump loop/disp32 +24324 } +24325 $emit-outputs:end: +24326 # . restore registers +24327 5f/pop-to-edi +24328 5e/pop-to-esi +24329 59/pop-to-ecx +24330 58/pop-to-eax +24331 # . epilogue +24332 89/<- %esp 5/r32/ebp +24333 5d/pop-to-ebp +24334 c3/return +24335 +24336 is-mu-branch?: # stmt: (addr stmt1) -> result/eax: boolean +24337 # . prologue +24338 55/push-ebp +24339 89/<- %ebp 4/r32/esp +24340 # . save registers +24341 51/push-ecx +24342 # ecx = lookup(stmt->operation) +24343 8b/-> *(ebp+8) 1/r32/ecx +24344 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +24345 89/<- %ecx 0/r32/eax +24346 # if (stmt->operation starts with "loop") return true +24347 (string-starts-with? %ecx "loop") # => eax +24348 3d/compare-eax-and 0/imm32/false +24349 75/jump-if-not-equal $is-mu-branch?:end/disp8 +24350 # if (stmt->operation starts with "break") return true +24351 (string-starts-with? %ecx "break") # => eax +24352 3d/compare-eax-and 0/imm32/false +24353 75/jump-if-not-equal $is-mu-branch?:end/disp8 +24354 # otherwise return (stmt->operation starts with "return") +24355 (string-starts-with? %ecx "return") # => eax +24356 $is-mu-branch?:end: +24357 # . restore registers +24358 59/pop-to-ecx +24359 # . epilogue +24360 89/<- %esp 5/r32/ebp +24361 5d/pop-to-ebp +24362 c3/return +24363 +24364 emit-reverse-break: # out: (addr buffered-file), stmt: (addr stmt1) +24365 # . prologue +24366 55/push-ebp +24367 89/<- %ebp 4/r32/esp +24368 # . save registers +24369 50/push-eax +24370 # eax = stmt +24371 8b/-> *(ebp+0xc) 0/r32/eax +24372 # +24373 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +24374 (get Reverse-branch %eax 0x10 "reverse-branch: ") # => eax: (addr handle array byte) +24375 (emit-indent *(ebp+8) *Curr-block-depth) +24376 (lookup *eax *(eax+4)) # => eax +24377 (write-buffered *(ebp+8) %eax) +24378 (write-buffered *(ebp+8) " break/disp32\n") +24379 $emit-reverse-break:end: +24380 # . restore registers +24381 58/pop-to-eax +24382 # . epilogue +24383 89/<- %esp 5/r32/ebp +24384 5d/pop-to-ebp +24385 c3/return +24386 +24387 == data +24388 +24389 # Table from Mu branch instructions to the reverse SubX opcodes for them. +24390 Reverse-branch: # (table (handle array byte) (handle array byte)) +24391 # a table is a stream +24392 0x1c0/imm32/write +24393 0/imm32/read +24394 0x1c0/imm32/size +24395 # data +24396 0x11/imm32/alloc-id _string-break-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 +24397 0x11/imm32/alloc-id _string-loop-if-=/imm32 0x11/imm32/alloc-id _string_0f_85_jump_label/imm32 +24398 0x11/imm32/alloc-id _string-break-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 +24399 0x11/imm32/alloc-id _string-loop-if-!=/imm32 0x11/imm32/alloc-id _string_0f_84_jump_label/imm32 +24400 0x11/imm32/alloc-id _string-break-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 +24401 0x11/imm32/alloc-id _string-loop-if-</imm32 0x11/imm32/alloc-id _string_0f_8d_jump_label/imm32 +24402 0x11/imm32/alloc-id _string-break-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 +24403 0x11/imm32/alloc-id _string-loop-if->/imm32 0x11/imm32/alloc-id _string_0f_8e_jump_label/imm32 +24404 0x11/imm32/alloc-id _string-break-if-<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 +24405 0x11/imm32/alloc-id _string-loop-if-<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 +24406 0x11/imm32/alloc-id _string-break-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 +24407 0x11/imm32/alloc-id _string-loop-if->=/imm32 0x11/imm32/alloc-id _string_0f_8c_jump_label/imm32 +24408 0x11/imm32/alloc-id _string-break-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 +24409 0x11/imm32/alloc-id _string-loop-if-addr</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 +24410 0x11/imm32/alloc-id _string-break-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 +24411 0x11/imm32/alloc-id _string-loop-if-addr>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 +24412 0x11/imm32/alloc-id _string-break-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 +24413 0x11/imm32/alloc-id _string-loop-if-addr<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 +24414 0x11/imm32/alloc-id _string-break-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 +24415 0x11/imm32/alloc-id _string-loop-if-addr>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 +24416 0x11/imm32/alloc-id _string-break-if-float</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 +24417 0x11/imm32/alloc-id _string-loop-if-float</imm32 0x11/imm32/alloc-id _string_0f_83_jump_label/imm32 +24418 0x11/imm32/alloc-id _string-break-if-float>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 +24419 0x11/imm32/alloc-id _string-loop-if-float>/imm32 0x11/imm32/alloc-id _string_0f_86_jump_label/imm32 +24420 0x11/imm32/alloc-id _string-break-if-float<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 +24421 0x11/imm32/alloc-id _string-loop-if-float<=/imm32 0x11/imm32/alloc-id _string_0f_87_jump_label/imm32 +24422 0x11/imm32/alloc-id _string-break-if-float>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 +24423 0x11/imm32/alloc-id _string-loop-if-float>=/imm32 0x11/imm32/alloc-id _string_0f_82_jump_label/imm32 +24424 +24425 == code +24426 +24427 emit-unconditional-jump-to-depth: # out: (addr buffered-file), vars: (addr stack live-var), depth: int, label-suffix: (addr array byte) +24428 # . prologue +24429 55/push-ebp +24430 89/<- %ebp 4/r32/esp +24431 # . save registers +24432 50/push-eax +24433 51/push-ecx +24434 52/push-edx +24435 53/push-ebx +24436 56/push-esi +24437 # ecx = vars +24438 8b/-> *(ebp+0xc) 1/r32/ecx +24439 # var eax: int = vars->top +24440 8b/-> *ecx 0/r32/eax +24441 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] +24442 8d/copy-address *(ecx+eax-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size +24443 # var min/ecx: (addr handle var) = vars->data +24444 8d/copy-address *(ecx+8) 1/r32/ecx +24445 # edx = depth +24446 8b/-> *(ebp+0x10) 2/r32/edx +24447 { +24448 $emit-unconditional-jump-to-depth:loop: +24449 # if (curr < min) break +24450 39/compare %esi 1/r32/ecx +24451 0f 82/jump-if-addr< break/disp32 +24452 # var v/ebx: (addr var) = lookup(*curr) +24453 (lookup *esi *(esi+4)) # => eax +24454 89/<- %ebx 0/r32/eax +24455 # if (v->block-depth < until-block-depth) break +24456 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth +24457 0f 8c/jump-if-< break/disp32 +24458 { +24459 $emit-unconditional-jump-to-depth:check: +24460 # if v->block-depth != until-block-depth, continue +24461 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth +24462 0f 85/jump-if-!= break/disp32 +24463 $emit-unconditional-jump-to-depth:depth-found: +24464 # if v is not a literal, continue +24465 (size-of %ebx) # => eax +24466 3d/compare-eax-and 0/imm32 +24467 0f 85/jump-if-!= break/disp32 +24468 $emit-unconditional-jump-to-depth:label-found: +24469 # emit unconditional jump, then return +24470 (emit-indent *(ebp+8) *Curr-block-depth) +24471 (write-buffered *(ebp+8) "e9/jump ") +24472 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +24473 (write-buffered *(ebp+8) %eax) +24474 (write-buffered *(ebp+8) ":") +24475 (write-buffered *(ebp+8) *(ebp+0x14)) +24476 (write-buffered *(ebp+8) "/disp32\n") +24477 eb/jump $emit-unconditional-jump-to-depth:end/disp8 +24478 } +24479 # curr -= 12 +24480 81 5/subop/subtract %esi 0xc/imm32 +24481 e9/jump loop/disp32 +24482 } +24483 # TODO: error if no label at 'depth' was found +24484 $emit-unconditional-jump-to-depth:end: +24485 # . restore registers +24486 5e/pop-to-esi +24487 5b/pop-to-ebx +24488 5a/pop-to-edx +24489 59/pop-to-ecx +24490 58/pop-to-eax +24491 # . epilogue +24492 89/<- %esp 5/r32/ebp +24493 5d/pop-to-ebp +24494 c3/return +24495 +24496 # emit clean-up code for 'vars' until some block depth +24497 # doesn't actually modify 'vars' so we need traverse manually inside the stack +24498 emit-cleanup-code-until-depth: # out: (addr buffered-file), vars: (addr stack live-var), until-block-depth: int +24499 # . prologue +24500 55/push-ebp +24501 89/<- %ebp 4/r32/esp +24502 # . save registers +24503 50/push-eax +24504 51/push-ecx +24505 52/push-edx +24506 53/push-ebx +24507 56/push-esi +24508 #? (write-buffered Stderr "--- cleanup\n") +24509 #? (flush Stderr) +24510 # ecx = vars +24511 8b/-> *(ebp+0xc) 1/r32/ecx +24512 # var esi: int = vars->top +24513 8b/-> *ecx 6/r32/esi +24514 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] +24515 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size +24516 # var min/ecx: (addr handle var) = vars->data +24517 81 0/subop/add %ecx 8/imm32 +24518 # edx = until-block-depth +24519 8b/-> *(ebp+0x10) 2/r32/edx +24520 { +24521 $emit-cleanup-code-until-depth:loop: +24522 # if (curr < min) break +24523 39/compare %esi 1/r32/ecx +24524 0f 82/jump-if-addr< break/disp32 +24525 # var v/ebx: (addr var) = lookup(*curr) +24526 (lookup *esi *(esi+4)) # => eax +24527 89/<- %ebx 0/r32/eax +24528 #? (lookup *ebx *(ebx+4)) # Var-name +24529 #? (write-buffered Stderr "var ") +24530 #? (write-buffered Stderr %eax) +24531 #? (write-buffered Stderr Newline) +24532 #? (flush Stderr) +24533 # if (v->block-depth < until-block-depth) break +24534 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth +24535 0f 8c/jump-if-< break/disp32 +24536 # if v is in a register +24537 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register +24538 { +24539 0f 84/jump-if-= break/disp32 +24540 { +24541 $emit-cleanup-code-until-depth:check-for-previous-spill: +24542 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled +24543 3d/compare-eax-and 0/imm32/false +24544 74/jump-if-= break/disp8 +24545 $emit-cleanup-code-until-depth:reclaim-var-in-register: +24546 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +24547 (emit-pop-register *(ebp+8) %eax) +24548 } +24549 eb/jump $emit-cleanup-code-until-depth:continue/disp8 +24550 } +24551 # otherwise v is on the stack +24552 { +24553 75/jump-if-!= break/disp8 +24554 $emit-cleanup-code-until-depth:var-on-stack: +24555 (size-of %ebx) # => eax +24556 # don't emit code for labels +24557 3d/compare-eax-and 0/imm32 +24558 74/jump-if-= break/disp8 +24559 $emit-cleanup-code-until-depth:reclaim-var-on-stack: +24560 (emit-indent *(ebp+8) *Curr-block-depth) +24561 (write-buffered *(ebp+8) "81 0/subop/add %esp ") +24562 (write-int32-hex-buffered *(ebp+8) %eax) +24563 (write-buffered *(ebp+8) "/imm32\n") +24564 } +24565 $emit-cleanup-code-until-depth:continue: +24566 # curr -= 12 +24567 81 5/subop/subtract %esi 0xc/imm32 +24568 e9/jump loop/disp32 +24569 } +24570 $emit-cleanup-code-until-depth:end: +24571 # . restore registers +24572 5e/pop-to-esi +24573 5b/pop-to-ebx +24574 5a/pop-to-edx +24575 59/pop-to-ecx +24576 58/pop-to-eax +24577 # . epilogue +24578 89/<- %esp 5/r32/ebp +24579 5d/pop-to-ebp +24580 c3/return +24581 +24582 # emit clean-up code for 'vars' that don't conflict with output registers +24583 # doesn't actually modify 'vars' so we need traverse manually inside the stack +24584 emit-cleanup-code-for-non-outputs: # out: (addr buffered-file), vars: (addr stack live-var), fn: (addr function) +24585 # . prologue +24586 55/push-ebp +24587 89/<- %ebp 4/r32/esp +24588 # . save registers +24589 50/push-eax +24590 51/push-ecx +24591 52/push-edx +24592 53/push-ebx +24593 56/push-esi +24594 57/push-edi +24595 # ecx = vars +24596 8b/-> *(ebp+0xc) 1/r32/ecx +24597 # var esi: int = vars->top +24598 8b/-> *ecx 6/r32/esi +24599 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] +24600 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size +24601 # var min/ecx: (addr handle var) = vars->data +24602 81 0/subop/add %ecx 8/imm32 +24603 { +24604 $emit-cleanup-code-for-non-outputs:loop: +24605 # if (curr < min) break +24606 39/compare %esi 1/r32/ecx +24607 0f 82/jump-if-addr< break/disp32 +24608 # var v/ebx: (addr var) = lookup(*curr) +24609 (lookup *esi *(esi+4)) # => eax +24610 89/<- %ebx 0/r32/eax +24611 # if v is in a register +24612 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register +24613 { +24614 0f 84/jump-if-= break/disp32 +24615 { +24616 $emit-cleanup-code-for-non-outputs:check-for-previous-spill: +24617 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled +24618 3d/compare-eax-and 0/imm32/false +24619 0f 84/jump-if-= break/disp32 +24620 $emit-cleanup-code-for-non-outputs:reclaim-var-in-register: +24621 # var reg/edi: (addr array name) = v->register +24622 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +24623 89/<- %edi 0/r32/eax +24624 # if reg is not in function outputs, emit a pop +24625 (reg-in-function-outputs? *(ebp+0x10) %edi) # => eax +24626 3d/compare-eax-and 0/imm32/false +24627 { +24628 75/jump-if-!= break/disp8 +24629 (emit-pop-register *(ebp+8) %edi) +24630 eb/jump $emit-cleanup-code-for-non-outputs:reclaim-var-in-register-done/disp8 +24631 } +24632 # otherwise just drop it from the stack +24633 (emit-indent *(ebp+8) *Curr-block-depth) +24634 (write-buffered *(ebp+8) "81 0/subop/add %esp 4/imm32\n") +24635 } +24636 $emit-cleanup-code-for-non-outputs:reclaim-var-in-register-done: +24637 eb/jump $emit-cleanup-code-for-non-outputs:continue/disp8 +24638 } +24639 # otherwise v is on the stack +24640 { +24641 75/jump-if-!= break/disp8 +24642 $emit-cleanup-code-for-non-outputs:var-on-stack: +24643 (size-of %ebx) # => eax +24644 # don't emit code for labels +24645 3d/compare-eax-and 0/imm32 +24646 74/jump-if-= break/disp8 +24647 $emit-cleanup-code-for-non-outputs:reclaim-var-on-stack: +24648 (emit-indent *(ebp+8) *Curr-block-depth) +24649 (write-buffered *(ebp+8) "81 0/subop/add %esp ") +24650 (write-int32-hex-buffered *(ebp+8) %eax) +24651 (write-buffered *(ebp+8) "/imm32\n") +24652 } +24653 $emit-cleanup-code-for-non-outputs:continue: +24654 # curr -= 12 +24655 81 5/subop/subtract %esi 0xc/imm32 +24656 e9/jump loop/disp32 +24657 } +24658 $emit-cleanup-code-for-non-outputs:end: +24659 # . restore registers +24660 5f/pop-to-edi +24661 5e/pop-to-esi +24662 5b/pop-to-ebx +24663 5a/pop-to-edx +24664 59/pop-to-ecx +24665 58/pop-to-eax +24666 # . epilogue +24667 89/<- %esp 5/r32/ebp +24668 5d/pop-to-ebp +24669 c3/return +24670 +24671 emit-push-register: # out: (addr buffered-file), reg: (addr array byte) +24672 # . prologue +24673 55/push-ebp +24674 89/<- %ebp 4/r32/esp +24675 # eax = reg +24676 8b/-> *(ebp+0xc) 0/r32/eax +24677 # var prefix/eax: byte = reg->data[0] +24678 8a/copy-byte *(eax+4) 0/r32/AL +24679 81 4/subop/and %eax 0xff/imm32 +24680 # if (prefix == 'x') push xmm register +24681 { +24682 3d/compare-eax-and 0x78/imm32/x +24683 0f 85/jump-if-!= break/disp32 +24684 # TODO validate register +24685 (emit-indent *(ebp+8) *Curr-block-depth) +24686 (write-buffered *(ebp+8) "81 5/subop/subtract %esp 4/imm32\n") +24687 (emit-indent *(ebp+8) *Curr-block-depth) +24688 (write-buffered *(ebp+8) "f3 0f 11/<- *esp ") +24689 # var prefix/eax: byte = reg->data[3] +24690 8b/-> *(ebp+0xc) 0/r32/eax +24691 8a/copy-byte *(eax+7) 0/r32/AL +24692 81 4/subop/and %eax 0xff/imm32 +24693 (write-byte-buffered *(ebp+8) %eax) +24694 (write-buffered *(ebp+8) "/x32\n") +24695 e9/jump $emit-push-register:end/disp32 +24696 } +24697 # otherwise push gp register +24698 (emit-indent *(ebp+8) *Curr-block-depth) +24699 (write-buffered *(ebp+8) "ff 6/subop/push %") +24700 (write-buffered *(ebp+8) *(ebp+0xc)) +24701 (write-buffered *(ebp+8) Newline) +24702 $emit-push-register:end: +24703 # . epilogue +24704 89/<- %esp 5/r32/ebp +24705 5d/pop-to-ebp +24706 c3/return +24707 +24708 emit-pop-register: # out: (addr buffered-file), reg: (addr array byte) +24709 # . prologue +24710 55/push-ebp +24711 89/<- %ebp 4/r32/esp +24712 # . save registers +24713 50/push-eax +24714 # eax = reg +24715 8b/-> *(ebp+0xc) 0/r32/eax +24716 # var prefix/eax: byte = reg->data[0] +24717 8a/copy-byte *(eax+4) 0/r32/AL +24718 81 4/subop/and %eax 0xff/imm32 +24719 # if (prefix == 'x') pop to xmm register +24720 { +24721 3d/compare-eax-and 0x78/imm32/x +24722 0f 85/jump-if-!= break/disp32 +24723 # TODO validate register +24724 (emit-indent *(ebp+8) *Curr-block-depth) +24725 (write-buffered *(ebp+8) "f3 0f 10/-> *esp ") +24726 # var prefix/eax: byte = reg->data[3] +24727 8b/-> *(ebp+0xc) 0/r32/eax +24728 8a/copy-byte *(eax+7) 0/r32/AL +24729 81 4/subop/and %eax 0xff/imm32 +24730 (write-byte-buffered *(ebp+8) %eax) +24731 (write-buffered *(ebp+8) "/x32\n") +24732 (emit-indent *(ebp+8) *Curr-block-depth) +24733 (write-buffered *(ebp+8) "81 0/subop/add %esp 4/imm32\n") +24734 e9/jump $emit-pop-register:end/disp32 +24735 } +24736 # otherwise pop to gp register +24737 (emit-indent *(ebp+8) *Curr-block-depth) +24738 (write-buffered *(ebp+8) "8f 0/subop/pop %") +24739 (write-buffered *(ebp+8) *(ebp+0xc)) +24740 (write-buffered *(ebp+8) Newline) +24741 $emit-pop-register:end: +24742 # . restore registers +24743 58/pop-to-eax +24744 # . epilogue +24745 89/<- %esp 5/r32/ebp +24746 5d/pop-to-ebp +24747 c3/return +24748 +24749 # emit clean-up code for 'vars' until a given label is encountered +24750 # doesn't actually modify 'vars' so we need traverse manually inside the stack +24751 emit-cleanup-code-until-target: # out: (addr buffered-file), vars: (addr stack live-var), until-block-label: (addr array byte) +24752 # . prologue +24753 55/push-ebp +24754 89/<- %ebp 4/r32/esp +24755 # . save registers +24756 50/push-eax +24757 51/push-ecx +24758 52/push-edx +24759 53/push-ebx +24760 # ecx = vars +24761 8b/-> *(ebp+0xc) 1/r32/ecx +24762 # var eax: int = vars->top +24763 8b/-> *ecx 0/r32/eax +24764 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] +24765 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size +24766 # var min/ecx: (addr handle var) = vars->data +24767 81 0/subop/add %ecx 8/imm32 +24768 { +24769 $emit-cleanup-code-until-target:loop: +24770 # if (curr < min) break +24771 39/compare %edx 1/r32/ecx +24772 0f 82/jump-if-addr< break/disp32 +24773 # var v/ebx: (handle var) = lookup(*curr) +24774 (lookup *edx *(edx+4)) # => eax +24775 89/<- %ebx 0/r32/eax +24776 # if (v->name == until-block-label) break +24777 (lookup *ebx *(ebx+4)) # Var-name Var-name => eax +24778 (string-equal? %eax *(ebp+0x10)) # => eax +24779 3d/compare-eax-and 0/imm32/false +24780 0f 85/jump-if-!= break/disp32 +24781 # if v is in a register +24782 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register +24783 { +24784 0f 84/jump-if-= break/disp32 +24785 { +24786 $emit-cleanup-code-until-target:check-for-previous-spill: +24787 8b/-> *(edx+8) 0/r32/eax # Live-var-register-spilled +24788 3d/compare-eax-and 0/imm32/false +24789 74/jump-if-= break/disp8 +24790 $emit-cleanup-code-until-target:reclaim-var-in-register: +24791 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +24792 (emit-pop-register *(ebp+8) %eax) +24793 } +24794 eb/jump $emit-cleanup-code-until-target:continue/disp8 +24795 } +24796 # otherwise v is on the stack +24797 { +24798 75/jump-if-!= break/disp8 +24799 $emit-cleanup-code-until-target:reclaim-var-on-stack: +24800 (size-of %ebx) # => eax +24801 # don't emit code for labels +24802 3d/compare-eax-and 0/imm32 +24803 74/jump-if-= break/disp8 +24804 # +24805 (emit-indent *(ebp+8) *Curr-block-depth) +24806 (write-buffered *(ebp+8) "81 0/subop/add %esp ") +24807 (write-int32-hex-buffered *(ebp+8) %eax) +24808 (write-buffered *(ebp+8) "/imm32\n") +24809 } +24810 $emit-cleanup-code-until-target:continue: +24811 # curr -= 12 +24812 81 5/subop/subtract %edx 0xc/imm32 +24813 e9/jump loop/disp32 +24814 } +24815 $emit-cleanup-code-until-target:end: +24816 # . restore registers +24817 5b/pop-to-ebx +24818 5a/pop-to-edx +24819 59/pop-to-ecx +24820 58/pop-to-eax +24821 # . epilogue +24822 89/<- %esp 5/r32/ebp +24823 5d/pop-to-ebp +24824 c3/return +24825 +24826 # update Curr-local-stack-offset assuming vars until some block depth are popped +24827 # doesn't actually modify 'vars', so we need traverse manually inside the stack +24828 clean-up-stack-offset-state: # vars: (addr stack live-var), until-block-depth: int +24829 # . prologue +24830 55/push-ebp +24831 89/<- %ebp 4/r32/esp +24832 # . save registers +24833 50/push-eax +24834 51/push-ecx +24835 52/push-edx +24836 53/push-ebx +24837 56/push-esi +24838 # ecx = vars +24839 8b/-> *(ebp+8) 1/r32/ecx +24840 # var esi: int = vars->top +24841 8b/-> *ecx 6/r32/esi +24842 # var curr/esi: (addr handle var) = &vars->data[vars->top - 12] +24843 8d/copy-address *(ecx+esi-4) 6/r32/esi # vars + 8 + vars->top - 12/Live-var-size +24844 # var min/ecx: (addr handle var) = vars->data +24845 81 0/subop/add %ecx 8/imm32 +24846 # edx = until-block-depth +24847 8b/-> *(ebp+0xc) 2/r32/edx +24848 { +24849 $clean-up-stack-offset-state:loop: +24850 # if (curr < min) break +24851 39/compare %esi 1/r32/ecx +24852 0f 82/jump-if-addr< break/disp32 +24853 # var v/ebx: (addr var) = lookup(*curr) +24854 (lookup *esi *(esi+4)) # => eax +24855 89/<- %ebx 0/r32/eax +24856 # if (v->block-depth < until-block-depth) break +24857 39/compare *(ebx+0x10) 2/r32/edx # Var-block-depth +24858 0f 8c/jump-if-< break/disp32 +24859 # if v is in a register +24860 81 7/subop/compare *(ebx+0x18) 0/imm32 # Var-register +24861 { +24862 0f 84/jump-if-= break/disp32 +24863 { +24864 $clean-up-stack-offset-state:check-for-previous-spill: +24865 8b/-> *(esi+8) 0/r32/eax # Live-var-register-spilled +24866 3d/compare-eax-and 0/imm32/false +24867 74/jump-if-= break/disp8 +24868 $clean-up-stack-offset-state:reclaim-var-in-register: +24869 81 0/subop/add *Curr-local-stack-offset 4/imm32 +24870 } +24871 eb/jump $clean-up-stack-offset-state:continue/disp8 +24872 } +24873 # otherwise v is on the stack +24874 { +24875 75/jump-if-!= break/disp8 +24876 $clean-up-stack-offset-state:var-on-stack: +24877 (size-of %ebx) # => eax +24878 01/add-to *Curr-local-stack-offset 0/r32/eax +24879 } +24880 $clean-up-stack-offset-state:continue: +24881 # curr -= 12 +24882 81 5/subop/subtract %esi 0xc/imm32 +24883 e9/jump loop/disp32 +24884 } +24885 $clean-up-stack-offset-state:end: +24886 # . restore registers +24887 5e/pop-to-esi +24888 5b/pop-to-ebx +24889 5a/pop-to-edx +24890 59/pop-to-ecx +24891 58/pop-to-eax +24892 # . epilogue +24893 89/<- %esp 5/r32/ebp +24894 5d/pop-to-ebp +24895 c3/return +24896 +24897 # Return true if there isn't a variable in 'vars' with the same block-depth +24898 # and register as 'v'. +24899 # 'v' is guaranteed not to be within 'vars'. +24900 not-yet-spilled-this-block?: # v: (addr var), vars: (addr stack live-var) -> result/eax: boolean +24901 # . prologue +24902 55/push-ebp +24903 89/<- %ebp 4/r32/esp +24904 # . save registers +24905 51/push-ecx +24906 52/push-edx +24907 53/push-ebx +24908 56/push-esi +24909 57/push-edi +24910 # ecx = vars +24911 8b/-> *(ebp+0xc) 1/r32/ecx +24912 # var eax: int = vars->top +24913 8b/-> *ecx 0/r32/eax +24914 # var curr/edx: (addr handle var) = &vars->data[vars->top - 12] +24915 8d/copy-address *(ecx+eax-4) 2/r32/edx # vars + 8 + vars->top - 12/Live-var-size +24916 # var min/ecx: (addr handle var) = vars->data +24917 8d/copy-address *(ecx+8) 1/r32/ecx +24918 # var depth/ebx: int = v->block-depth +24919 8b/-> *(ebp+8) 3/r32/ebx +24920 8b/-> *(ebx+0x10) 3/r32/ebx # Var-block-depth +24921 # var needle/esi: (addr array byte) = v->register +24922 8b/-> *(ebp+8) 6/r32/esi +24923 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +24924 89/<- %esi 0/r32/eax +24925 { +24926 $not-yet-spilled-this-block?:loop: +24927 # if (curr < min) break +24928 39/compare %edx 1/r32/ecx +24929 0f 82/jump-if-addr< break/disp32 +24930 # var cand/edi: (addr var) = lookup(*curr) +24931 (lookup *edx *(edx+4)) # => eax +24932 89/<- %edi 0/r32/eax +24933 # if (cand->block-depth < depth) break +24934 39/compare *(edi+0x10) 3/r32/ebx # Var-block-depth +24935 0f 8c/jump-if-< break/disp32 +24936 # var cand-reg/edi: (array array byte) = cand->reg +24937 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax +24938 89/<- %edi 0/r32/eax +24939 # if (cand-reg == null) continue +24940 { +24941 $not-yet-spilled-this-block?:check-reg: +24942 81 7/subop/compare %edi 0/imm32 +24943 0f 84/jump-if-= break/disp32 +24944 # if (cand-reg == needle) return true +24945 (string-equal? %esi %edi) # => eax +24946 3d/compare-eax-and 0/imm32/false +24947 74/jump-if-= break/disp8 +24948 $not-yet-spilled-this-block?:return-false: +24949 b8/copy-to-eax 0/imm32/false +24950 eb/jump $not-yet-spilled-this-block?:end/disp8 +24951 } +24952 $not-yet-spilled-this-block?:continue: +24953 # curr -= 12 +24954 81 5/subop/subtract %edx 0xc/imm32 +24955 e9/jump loop/disp32 +24956 } +24957 $not-yet-spilled-this-block?:return-true: +24958 # return true +24959 b8/copy-to-eax 1/imm32/true +24960 $not-yet-spilled-this-block?:end: +24961 # . restore registers +24962 5f/pop-to-edi +24963 5e/pop-to-esi +24964 5b/pop-to-ebx +24965 5a/pop-to-edx +24966 59/pop-to-ecx +24967 # . epilogue +24968 89/<- %esp 5/r32/ebp +24969 5d/pop-to-ebp +24970 c3/return +24971 +24972 # could the register of 'v' ever be written to by one of the vars in fn-outputs? +24973 will-not-write-some-register?: # v: (addr var), stmts: (addr list stmt), fn: (addr function) -> result/eax: boolean +24974 # . prologue +24975 55/push-ebp +24976 89/<- %ebp 4/r32/esp +24977 # eax = v +24978 8b/-> *(ebp+8) 0/r32/eax +24979 # var reg/eax: (addr array byte) = lookup(v->register) +24980 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +24981 # var target/eax: (addr var) = find-register(fn-outputs, reg) +24982 (find-register *(ebp+0x10) %eax) # => eax +24983 # if (target == 0) return true +24984 { +24985 3d/compare-eax-and 0/imm32 +24986 75/jump-if-!= break/disp8 +24987 b8/copy-to-eax 1/imm32/true +24988 eb/jump $will-not-write-some-register?:end/disp8 +24989 } +24990 # return !assigns-in-stmts?(stmts, target) +24991 (assigns-in-stmts? *(ebp+0xc) %eax) # => eax +24992 3d/compare-eax-and 0/imm32/false +24993 # assume: true = 1, so no need to mask with 0x000000ff +24994 0f 94/set-if-= %al +24995 $will-not-write-some-register?:end: +24996 # . epilogue +24997 89/<- %esp 5/r32/ebp +24998 5d/pop-to-ebp +24999 c3/return +25000 +25001 # return fn output with matching register +25002 # always returns false if 'reg' is null +25003 find-register: # fn: (addr function), reg: (addr array byte) -> result/eax: (addr var) +25004 # . prologue +25005 55/push-ebp +25006 89/<- %ebp 4/r32/esp +25007 # . save registers +25008 51/push-ecx +25009 # var curr/ecx: (addr list var) = lookup(fn->outputs) +25010 8b/-> *(ebp+8) 1/r32/ecx +25011 (lookup *(ecx+0x10) *(ecx+0x14)) # Function-outputs Function-outputs => eax +25012 89/<- %ecx 0/r32/eax +25013 { +25014 $find-register:loop: +25015 # if (curr == 0) break +25016 81 7/subop/compare %ecx 0/imm32 +25017 74/jump-if-= break/disp8 +25018 # eax = curr->value->register +25019 (lookup *ecx *(ecx+4)) # List-value List-value => eax +25020 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +25021 # if (eax == reg) return curr->value +25022 $find-register:compare: +25023 (string-equal? *(ebp+0xc) %eax) # => eax +25024 { +25025 3d/compare-eax-and 0/imm32/false +25026 74/jump-if-= break/disp8 +25027 $find-register:found: +25028 (lookup *ecx *(ecx+4)) # List-value List-value => eax +25029 eb/jump $find-register:end/disp8 +25030 } +25031 # curr = lookup(curr->next) +25032 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +25033 89/<- %ecx 0/r32/eax +25034 # +25035 eb/jump loop/disp8 +25036 } +25037 $find-register:end: +25038 # . restore registers +25039 59/pop-to-ecx +25040 # . epilogue +25041 89/<- %esp 5/r32/ebp +25042 5d/pop-to-ebp +25043 c3/return +25044 +25045 assigns-in-stmts?: # stmts: (addr list stmt), v: (addr var) -> result/eax: boolean +25046 # . prologue +25047 55/push-ebp +25048 89/<- %ebp 4/r32/esp +25049 # . save registers +25050 51/push-ecx +25051 # var curr/ecx: (addr list stmt) = stmts +25052 8b/-> *(ebp+8) 1/r32/ecx +25053 { +25054 # if (curr == 0) break +25055 81 7/subop/compare %ecx 0/imm32 +25056 74/jump-if-= break/disp8 +25057 # if assigns-in-stmt?(curr->value, v) return true +25058 (lookup *ecx *(ecx+4)) # List-value List-value => eax +25059 (assigns-in-stmt? %eax *(ebp+0xc)) # => eax +25060 3d/compare-eax-and 0/imm32/false +25061 75/jump-if-!= break/disp8 +25062 # curr = lookup(curr->next) +25063 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +25064 89/<- %ecx 0/r32/eax +25065 # +25066 eb/jump loop/disp8 +25067 } +25068 $assigns-in-stmts?:end: +25069 # . restore registers +25070 59/pop-to-ecx +25071 # . epilogue +25072 89/<- %esp 5/r32/ebp +25073 5d/pop-to-ebp +25074 c3/return +25075 +25076 assigns-in-stmt?: # stmt: (addr stmt), v: (addr var) -> result/eax: boolean +25077 # . prologue +25078 55/push-ebp +25079 89/<- %ebp 4/r32/esp +25080 # . save registers +25081 51/push-ecx +25082 # ecx = stmt +25083 8b/-> *(ebp+8) 1/r32/ecx +25084 # if stmt is a stmt1, return assigns-in-stmt-vars?(stmt->outputs, v) +25085 { +25086 81 7/subop/compare *ecx 1/imm32/stmt1 # Stmt-tag +25087 75/jump-if-!= break/disp8 +25088 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +25089 (assigns-in-stmt-vars? %eax *(ebp+0xc)) # => eax +25090 eb/jump $assigns-in-stmt?:end/disp8 +25091 } +25092 # if stmt is a block, return assigns-in-stmts?(stmt->stmts, v) +25093 { +25094 81 7/subop/compare *ecx 0/imm32/block # Stmt-tag +25095 75/jump-if-!= break/disp8 +25096 (lookup *(ecx+4) *(ecx+8)) # Block-stmts Block-stmts => eax +25097 (assigns-in-stmts? %eax *(ebp+0xc)) # => eax +25098 eb/jump $assigns-in-stmt?:end/disp8 +25099 } +25100 # otherwise return false +25101 b8/copy 0/imm32/false +25102 $assigns-in-stmt?:end: +25103 # . restore registers +25104 59/pop-to-ecx +25105 # . epilogue +25106 89/<- %esp 5/r32/ebp +25107 5d/pop-to-ebp +25108 c3/return +25109 +25110 assigns-in-stmt-vars?: # stmt-var: (addr stmt-var), v: (addr var) -> result/eax: boolean +25111 # . prologue +25112 55/push-ebp +25113 89/<- %ebp 4/r32/esp +25114 # . save registers +25115 51/push-ecx +25116 # var curr/ecx: (addr stmt-var) = stmt-var +25117 8b/-> *(ebp+8) 1/r32/ecx +25118 { +25119 # if (curr == 0) break +25120 81 7/subop/compare %ecx 0/imm32 +25121 74/jump-if-= break/disp8 +25122 # eax = lookup(curr->value) +25123 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +25124 # if (eax == v && curr->is-deref? == false) return true +25125 { +25126 39/compare *(ebp+0xc) 0/r32/eax +25127 75/jump-if-!= break/disp8 +25128 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +25129 75/jump-if-!= break/disp8 +25130 b8/copy-to-eax 1/imm32/true +25131 eb/jump $assigns-in-stmt-vars?:end/disp8 +25132 } +25133 # curr = lookup(curr->next) +25134 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax +25135 89/<- %ecx 0/r32/eax +25136 # +25137 eb/jump loop/disp8 +25138 } +25139 $assigns-in-stmt-vars?:end: +25140 # . restore registers +25141 59/pop-to-ecx +25142 # . epilogue +25143 89/<- %esp 5/r32/ebp +25144 5d/pop-to-ebp +25145 c3/return +25146 +25147 # is there a var before 'v' with the same block-depth and register on the 'vars' stack? +25148 # v is guaranteed to be within vars +25149 # 'start' is provided as an optimization, a pointer within vars +25150 # *start == v +25151 same-register-spilled-before?: # v: (addr var), vars: (addr stack (handle var)), start: (addr var) -> result/eax: boolean +25152 # . prologue +25153 55/push-ebp +25154 89/<- %ebp 4/r32/esp +25155 # . save registers +25156 51/push-ecx +25157 52/push-edx +25158 53/push-ebx +25159 56/push-esi +25160 57/push-edi +25161 # ecx = v +25162 8b/-> *(ebp+8) 1/r32/ecx +25163 # var reg/edx: (addr array byte) = lookup(v->register) +25164 (lookup *(ecx+0x18) *(ecx+0x1c)) # Var-register Var-register => eax +25165 89/<- %edx 0/r32/eax +25166 # var depth/ebx: int = v->block-depth +25167 8b/-> *(ecx+0x10) 3/r32/ebx # Var-block-depth +25168 # var min/ecx: (addr handle var) = vars->data +25169 8b/-> *(ebp+0xc) 1/r32/ecx +25170 81 0/subop/add %ecx 8/imm32 +25171 # TODO: check that start >= min and start < &vars->data[top] +25172 # TODO: check that *start == v +25173 # var curr/esi: (addr handle var) = start +25174 8b/-> *(ebp+0x10) 6/r32/esi +25175 # curr -= 8 +25176 81 5/subop/subtract %esi 8/imm32 +25177 { +25178 $same-register-spilled-before?:loop: +25179 # if (curr < min) break +25180 39/compare %esi 1/r32/ecx +25181 0f 82/jump-if-addr< break/disp32 +25182 # var x/eax: (addr var) = lookup(*curr) +25183 (lookup *esi *(esi+4)) # => eax +25184 # if (x->block-depth < depth) break +25185 39/compare *(eax+0x10) 3/r32/ebx # Var-block-depth +25186 0f 8c/jump-if-< break/disp32 +25187 # if (x->register == 0) continue +25188 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +25189 74/jump-if-= $same-register-spilled-before?:continue/disp8 +25190 # if (x->register == reg) return true +25191 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +25192 (string-equal? %eax %edx) # => eax +25193 3d/compare-eax-and 0/imm32/false +25194 b8/copy-to-eax 1/imm32/true +25195 75/jump-if-!= $same-register-spilled-before?:end/disp8 +25196 $same-register-spilled-before?:continue: +25197 # curr -= 8 +25198 81 5/subop/subtract %esi 8/imm32 +25199 e9/jump loop/disp32 +25200 } +25201 $same-register-spilled-before?:false: +25202 b8/copy-to-eax 0/imm32/false +25203 $same-register-spilled-before?:end: +25204 # . restore registers +25205 5f/pop-to-edi +25206 5e/pop-to-esi +25207 5b/pop-to-ebx +25208 5a/pop-to-edx +25209 59/pop-to-ecx +25210 # . epilogue +25211 89/<- %esp 5/r32/ebp +25212 5d/pop-to-ebp +25213 c3/return +25214 +25215 # clean up global state for 'vars' until some block depth (inclusive) +25216 clean-up-blocks: # vars: (addr stack live-var), until-block-depth: int, fn: (addr function) +25217 # . prologue +25218 55/push-ebp +25219 89/<- %ebp 4/r32/esp +25220 # . save registers +25221 50/push-eax +25222 51/push-ecx +25223 56/push-esi +25224 # esi = vars +25225 8b/-> *(ebp+8) 6/r32/esi +25226 # ecx = until-block-depth +25227 8b/-> *(ebp+0xc) 1/r32/ecx +25228 { +25229 $clean-up-blocks:reclaim-loop: +25230 # if (vars->top <= 0) break +25231 8b/-> *esi 0/r32/eax # Stack-top +25232 3d/compare-eax-and 0/imm32 +25233 0f 8e/jump-if-<= break/disp32 +25234 # var v/eax: (addr var) = lookup(vars[vars->top-12]) +25235 (lookup *(esi+eax-4) *(esi+eax)) # vars + 8 + vars->top - 12 => eax +25236 # if (v->block-depth < until-block-depth) break +25237 39/compare *(eax+0x10) 1/r32/ecx # Var-block-depth +25238 0f 8c/jump-if-< break/disp32 +25239 (pop %esi) # => eax +25240 (pop %esi) # => eax +25241 (pop %esi) # => eax +25242 e9/jump loop/disp32 +25243 } +25244 $clean-up-blocks:end: +25245 # . restore registers +25246 5e/pop-to-esi +25247 59/pop-to-ecx +25248 58/pop-to-eax +25249 # . epilogue +25250 89/<- %esp 5/r32/ebp +25251 5d/pop-to-ebp +25252 c3/return +25253 +25254 reg-in-function-outputs?: # fn: (addr function), target: (addr array byte) -> result/eax: boolean +25255 # . prologue +25256 55/push-ebp +25257 89/<- %ebp 4/r32/esp +25258 # . save registers +25259 51/push-ecx +25260 # var curr/ecx: (addr list var) = lookup(fn->outputs) +25261 8b/-> *(ebp+8) 0/r32/eax +25262 (lookup *(eax+0x10) *(eax+0x14)) # Function-outputs Function-outputs => eax +25263 89/<- %ecx 0/r32/eax +25264 # while curr != null +25265 { +25266 81 7/subop/compare %ecx 0/imm32 +25267 74/jump-if-= break/disp8 +25268 # var v/eax: (addr var) = lookup(curr->value) +25269 (lookup *ecx *(ecx+4)) # List-value List-value => eax +25270 # var reg/eax: (addr array byte) = lookup(v->register) +25271 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +25272 # if (reg == target) return true +25273 (string-equal? %eax *(ebp+0xc)) # => eax +25274 3d/compare-eax-and 0/imm32/false +25275 75/jump-if-!= $reg-in-function-outputs?:end/disp8 +25276 # curr = curr->next +25277 (lookup *(ecx+8) *(ecx+0xc)) # List-next List-next => eax +25278 89/<- %ecx 0/r32/eax +25279 # +25280 eb/jump loop/disp8 +25281 } +25282 # return false +25283 b8/copy-to-eax 0/imm32 +25284 $reg-in-function-outputs?:end: +25285 # . restore registers +25286 59/pop-to-ecx +25287 # . epilogue +25288 89/<- %esp 5/r32/ebp +25289 5d/pop-to-ebp +25290 c3/return +25291 +25292 emit-subx-var-def: # out: (addr buffered-file), stmt: (addr stmt) +25293 # . prologue +25294 55/push-ebp +25295 89/<- %ebp 4/r32/esp +25296 # . save registers +25297 50/push-eax +25298 51/push-ecx +25299 52/push-edx +25300 # eax = stmt +25301 8b/-> *(ebp+0xc) 0/r32/eax +25302 # var v/ecx: (addr var) +25303 (lookup *(eax+4) *(eax+8)) # Vardef-var Vardef-var => eax +25304 89/<- %ecx 0/r32/eax +25305 # v->block-depth = *Curr-block-depth +25306 8b/-> *Curr-block-depth 0/r32/eax +25307 89/<- *(ecx+0x10) 0/r32/eax # Var-block-depth +25308 # var n/edx: int = size-of(stmt->var) +25309 (size-of %ecx) # => eax +25310 89/<- %edx 0/r32/eax +25311 # *Curr-local-stack-offset -= n +25312 29/subtract-from *Curr-local-stack-offset 2/r32/edx +25313 # v->offset = *Curr-local-stack-offset +25314 8b/-> *Curr-local-stack-offset 0/r32/eax +25315 89/<- *(ecx+0x14) 0/r32/eax # Var-offset +25316 # if v is an array, do something special to initialize it +25317 { +25318 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +25319 (is-mu-array? %eax) # => eax +25320 3d/compare-eax-and 0/imm32/false +25321 0f 84/jump-if-= break/disp32 +25322 # var array-size-without-size/edx: int = n-4 +25323 81 5/subop/subtract %edx 4/imm32 +25324 # +25325 (emit-array-data-initialization *(ebp+8) %edx) +25326 e9/jump $emit-subx-var-def:end/disp32 +25327 } +25328 # another special-case for initializing streams +25329 # a stream is an array with 2 extra pointers +25330 { +25331 (lookup *(ecx+8) *(ecx+0xc)) # Var-type Var-type => eax +25332 (is-mu-stream? %eax) # => eax +25333 3d/compare-eax-and 0/imm32/false +25334 0f 84/jump-if-= break/disp32 +25335 # var array-size-without-size/edx: int = n-12 +25336 81 5/subop/subtract %edx 0xc/imm32 +25337 (emit-array-data-initialization *(ebp+8) %edx) +25338 # emit read and write pointers +25339 (emit-indent *(ebp+8) *Curr-block-depth) +25340 (write-buffered *(ebp+8) "68/push 0/imm32\n") +25341 (emit-indent *(ebp+8) *Curr-block-depth) +25342 (write-buffered *(ebp+8) "68/push 0/imm32\n") +25343 # +25344 eb/jump $emit-subx-var-def:end/disp8 +25345 } +25346 # while n > 0 +25347 { +25348 81 7/subop/compare %edx 0/imm32 +25349 7e/jump-if-<= break/disp8 +25350 (emit-indent *(ebp+8) *Curr-block-depth) +25351 (write-buffered *(ebp+8) "68/push 0/imm32\n") +25352 # n -= 4 +25353 81 5/subop/subtract %edx 4/imm32 +25354 # +25355 eb/jump loop/disp8 +25356 } +25357 $emit-subx-var-def:end: +25358 # . restore registers +25359 5a/pop-to-edx +25360 59/pop-to-ecx +25361 58/pop-to-eax +25362 # . epilogue +25363 89/<- %esp 5/r32/ebp +25364 5d/pop-to-ebp +25365 c3/return +25366 +25367 emit-array-data-initialization: # out: (addr buffered-file), n: int +25368 # . prologue +25369 55/push-ebp +25370 89/<- %ebp 4/r32/esp +25371 # +25372 (emit-indent *(ebp+8) *Curr-block-depth) +25373 (write-buffered *(ebp+8) "(push-n-zero-bytes ") +25374 (write-int32-hex-buffered *(ebp+8) *(ebp+0xc)) +25375 (write-buffered *(ebp+8) ")\n") +25376 (emit-indent *(ebp+8) *Curr-block-depth) +25377 (write-buffered *(ebp+8) "68/push ") +25378 (write-int32-hex-buffered *(ebp+8) *(ebp+0xc)) +25379 (write-buffered *(ebp+8) "/imm32\n") +25380 $emit-array-data-initialization:end: +25381 # . epilogue +25382 89/<- %esp 5/r32/ebp +25383 5d/pop-to-ebp +25384 c3/return +25385 +25386 emit-subx-stmt: # out: (addr buffered-file), stmt: (addr stmt), primitives: (addr primitive), err: (addr buffered-file), ed: (addr exit-descriptor) +25387 # . prologue +25388 55/push-ebp +25389 89/<- %ebp 4/r32/esp +25390 # . save registers +25391 50/push-eax +25392 51/push-ecx +25393 # - some special-case primitives that don't actually use the 'primitives' data structure +25394 # var op/ecx: (addr array byte) = lookup(stmt->operation) +25395 8b/-> *(ebp+0xc) 1/r32/ecx +25396 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +25397 89/<- %ecx 0/r32/eax +25398 # array size +25399 { +25400 # if (!string-equal?(stmt->operation, "length")) break +25401 (string-equal? %ecx "length") # => eax +25402 3d/compare-eax-and 0/imm32 +25403 0f 84/jump-if-= break/disp32 +25404 (translate-mu-length-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) +25405 e9/jump $emit-subx-stmt:end/disp32 +25406 } +25407 # index into array +25408 { +25409 # if (!string-equal?(stmt->operation, "index")) break +25410 (string-equal? %ecx "index") # => eax +25411 3d/compare-eax-and 0/imm32 +25412 0f 84/jump-if-= break/disp32 +25413 (translate-mu-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) +25414 e9/jump $emit-subx-stmt:end/disp32 +25415 } +25416 # compute-offset for index into array +25417 { +25418 # if (!string-equal?(stmt->operation, "compute-offset")) break +25419 (string-equal? %ecx "compute-offset") # => eax +25420 3d/compare-eax-and 0/imm32 +25421 0f 84/jump-if-= break/disp32 +25422 (translate-mu-compute-index-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) +25423 e9/jump $emit-subx-stmt:end/disp32 +25424 } +25425 # get field from record +25426 { +25427 # if (!string-equal?(stmt->operation, "get")) break +25428 (string-equal? %ecx "get") # => eax +25429 3d/compare-eax-and 0/imm32 +25430 0f 84/jump-if-= break/disp32 +25431 (translate-mu-get-stmt *(ebp+8) *(ebp+0xc)) +25432 e9/jump $emit-subx-stmt:end/disp32 +25433 } +25434 # allocate scalar +25435 { +25436 # if (!string-equal?(stmt->operation, "allocate")) break +25437 (string-equal? %ecx "allocate") # => eax +25438 3d/compare-eax-and 0/imm32 +25439 0f 84/jump-if-= break/disp32 +25440 (translate-mu-allocate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) +25441 e9/jump $emit-subx-stmt:end/disp32 +25442 } +25443 # copy-object +25444 { +25445 # if (!string-equal?(stmt->operation, "copy-object")) break +25446 (string-equal? %ecx "copy-object") # => eax +25447 3d/compare-eax-and 0/imm32 +25448 0f 84/jump-if-= break/disp32 +25449 (translate-mu-copy-object-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) +25450 e9/jump $emit-subx-stmt:end/disp32 +25451 } +25452 # allocate array +25453 { +25454 # if (!string-equal?(stmt->operation, "populate")) break +25455 (string-equal? %ecx "populate") # => eax +25456 3d/compare-eax-and 0/imm32 +25457 0f 84/jump-if-= break/disp32 +25458 (translate-mu-populate-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) +25459 e9/jump $emit-subx-stmt:end/disp32 +25460 } +25461 # allocate stream +25462 { +25463 # if (!string-equal?(stmt->operation, "populate-stream")) break +25464 (string-equal? %ecx "populate-stream") # => eax +25465 3d/compare-eax-and 0/imm32 +25466 0f 84/jump-if-= break/disp32 +25467 (translate-mu-populate-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) +25468 e9/jump $emit-subx-stmt:end/disp32 +25469 } +25470 # read from stream +25471 { +25472 # if (!string-equal?(stmt->operation, "read-from-stream")) break +25473 (string-equal? %ecx "read-from-stream") # => eax +25474 3d/compare-eax-and 0/imm32 +25475 0f 84/jump-if-= break/disp32 +25476 (translate-mu-read-from-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) +25477 e9/jump $emit-subx-stmt:end/disp32 +25478 } +25479 # write to stream +25480 { +25481 # if (!string-equal?(stmt->operation, "write-to-stream")) break +25482 (string-equal? %ecx "write-to-stream") # => eax +25483 3d/compare-eax-and 0/imm32 +25484 0f 84/jump-if-= break/disp32 +25485 (translate-mu-write-to-stream-stmt *(ebp+8) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) +25486 e9/jump $emit-subx-stmt:end/disp32 +25487 } +25488 # - if stmt matches a primitive, emit it +25489 { +25490 $emit-subx-stmt:check-for-primitive: +25491 # var curr/eax: (addr primitive) +25492 (find-matching-primitive *(ebp+0x10) *(ebp+0xc)) # primitives, stmt => eax +25493 3d/compare-eax-and 0/imm32 +25494 74/jump-if-= break/disp8 +25495 $emit-subx-stmt:primitive: +25496 (emit-subx-primitive *(ebp+8) *(ebp+0xc) %eax) # out, stmt, curr +25497 e9/jump $emit-subx-stmt:end/disp32 +25498 } +25499 # - otherwise emit a call +25500 # TODO: type-checking +25501 $emit-subx-stmt:call: +25502 (emit-call *(ebp+8) *(ebp+0xc)) +25503 $emit-subx-stmt:end: +25504 # . restore registers +25505 59/pop-to-ecx +25506 58/pop-to-eax +25507 # . epilogue +25508 89/<- %esp 5/r32/ebp +25509 5d/pop-to-ebp +25510 c3/return +25511 +25512 translate-mu-length-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +25513 # . prologue +25514 55/push-ebp +25515 89/<- %ebp 4/r32/esp +25516 # . save registers +25517 50/push-eax +25518 51/push-ecx +25519 52/push-edx +25520 53/push-ebx +25521 56/push-esi +25522 # esi = stmt +25523 8b/-> *(ebp+0xc) 6/r32/esi +25524 # var base/ebx: (addr var) = stmt->inouts[0]->value +25525 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +25526 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +25527 89/<- %ebx 0/r32/eax +25528 # var elemsize/ecx: int = array-element-size(base) +25529 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax +25530 89/<- %ecx 0/r32/eax +25531 # var outreg/edx: (addr array byte) = stmt->outputs[0]->value->register +25532 (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax +25533 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +25534 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +25535 89/<- %edx 0/r32/eax +25536 # if elemsize == 1 +25537 { +25538 81 7/subop/compare %ecx 1/imm32 +25539 75/jump-if-!= break/disp8 +25540 $translate-mu-length-stmt:size-1: +25541 (emit-save-size-to *(ebp+8) %ebx %edx) +25542 e9/jump $translate-mu-length-stmt:end/disp32 +25543 } +25544 # if elemsize is a power of 2 less than 256 +25545 { +25546 (power-of-2? %ecx *(ebp+0x10) *(ebp+0x14)) # => eax +25547 3d/compare-eax-and 0/imm32/false +25548 74/jump-if-= break/disp8 +25549 81 7/subop/compare %ecx 0xff/imm32 +25550 7f/jump-if-> break/disp8 +25551 $translate-mu-length-stmt:size-power-of-2: +25552 (emit-save-size-to *(ebp+8) %ebx %edx) +25553 (emit-divide-by-shift-right *(ebp+8) %edx %ecx) +25554 e9/jump $translate-mu-length-stmt:end/disp32 +25555 } +25556 # otherwise, the complex case +25557 # . emit register spills +25558 { +25559 $translate-mu-length-stmt:complex: +25560 (string-equal? %edx "eax") # => eax +25561 3d/compare-eax-and 0/imm32/false +25562 75/break-if-!= break/disp8 +25563 (emit-indent *(ebp+8) *Curr-block-depth) +25564 (write-buffered *(ebp+8) "50/push-eax\n") +25565 } +25566 { +25567 (string-equal? %edx "ecx") # => eax +25568 3d/compare-eax-and 0/imm32/false +25569 75/break-if-!= break/disp8 +25570 (emit-indent *(ebp+8) *Curr-block-depth) +25571 (write-buffered *(ebp+8) "51/push-ecx\n") +25572 } +25573 { +25574 (string-equal? %edx "edx") # => eax +25575 3d/compare-eax-and 0/imm32/false +25576 75/break-if-!= break/disp8 +25577 (emit-indent *(ebp+8) *Curr-block-depth) +25578 (write-buffered *(ebp+8) "52/push-edx\n") +25579 } +25580 # . +25581 (emit-save-size-to *(ebp+8) %ebx "eax") +25582 (emit-indent *(ebp+8) *Curr-block-depth) +25583 (write-buffered *(ebp+8) "31/xor %edx 2/r32/edx\n") +25584 (emit-indent *(ebp+8) *Curr-block-depth) +25585 (write-buffered *(ebp+8) "b9/copy-to-ecx ") +25586 (write-int32-hex-buffered *(ebp+8) %ecx) +25587 (write-buffered *(ebp+8) "/imm32\n") +25588 (emit-indent *(ebp+8) *Curr-block-depth) +25589 (write-buffered *(ebp+8) "f7 7/subop/idiv-eax-edx-by %ecx\n") +25590 { +25591 (string-equal? %edx "eax") # => eax +25592 3d/compare-eax-and 0/imm32/false +25593 75/break-if-!= break/disp8 +25594 (emit-indent *(ebp+8) *Curr-block-depth) +25595 (write-buffered *(ebp+8) "89/<- %") +25596 (write-buffered *(ebp+8) %edx) +25597 (write-buffered *(ebp+8) " 0/r32/eax\n") +25598 } +25599 # . emit register restores +25600 { +25601 (string-equal? %edx "edx") # => eax +25602 3d/compare-eax-and 0/imm32/false +25603 75/break-if-!= break/disp8 +25604 (emit-indent *(ebp+8) *Curr-block-depth) +25605 (write-buffered *(ebp+8) "5a/pop-to-edx\n") +25606 } +25607 { +25608 (string-equal? %edx "ecx") # => eax +25609 3d/compare-eax-and 0/imm32/false +25610 75/break-if-!= break/disp8 +25611 (emit-indent *(ebp+8) *Curr-block-depth) +25612 (write-buffered *(ebp+8) "59/pop-to-ecx\n") +25613 } +25614 { +25615 (string-equal? %edx "eax") # => eax +25616 3d/compare-eax-and 0/imm32/false +25617 75/break-if-!= break/disp8 +25618 (emit-indent *(ebp+8) *Curr-block-depth) +25619 (write-buffered *(ebp+8) "58/pop-to-eax\n") +25620 } +25621 $translate-mu-length-stmt:end: +25622 # . restore registers +25623 5e/pop-to-esi +25624 5b/pop-to-ebx +25625 5a/pop-to-edx +25626 59/pop-to-ecx +25627 58/pop-to-eax +25628 # . epilogue +25629 89/<- %esp 5/r32/ebp +25630 5d/pop-to-ebp +25631 c3/return +25632 +25633 array-element-size: # arr: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int +25634 # . prologue +25635 55/push-ebp +25636 89/<- %ebp 4/r32/esp +25637 # +25638 (array-element-type-id *(ebp+8) *(ebp+0xc) *(ebp+0x10)) # => eax +25639 (size-of-type-id-as-array-element %eax) # => eax +25640 $array-element-size:end: +25641 # . epilogue +25642 89/<- %esp 5/r32/ebp +25643 5d/pop-to-ebp +25644 c3/return +25645 +25646 array-element-type-id: # v: (addr var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: type-id +25647 # precondition: n is positive +25648 # . prologue +25649 55/push-ebp +25650 89/<- %ebp 4/r32/esp +25651 # +25652 8b/-> *(ebp+8) 0/r32/eax +25653 # var t/eax: (addr type-tree) +25654 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +25655 # if t == 0 abort +25656 3d/compare-eax-with 0/imm32 +25657 0f 84/jump-if-== $array-element-type-id:error0/disp32 +25658 # if t->is-atom? abort +25659 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +25660 0f 85/jump-if-!= $array-element-type-id:error1/disp32 +25661 # if (t->left == addr) t = t->right +25662 { +25663 50/push-eax +25664 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +25665 (is-simple-mu-type? %eax 2) # addr => eax +25666 3d/compare-eax-with 0/imm32/false +25667 58/pop-to-eax +25668 74/jump-if-= break/disp8 +25669 $array-element-type-id:skip-addr: +25670 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +25671 } +25672 # if t == 0 abort +25673 3d/compare-eax-with 0/imm32 +25674 0f 84/jump-if-= $array-element-type-id:error2/disp32 +25675 # if t->is-atom? abort +25676 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +25677 0f 85/jump-if-!= $array-element-type-id:error2/disp32 +25678 # if t->left != array abort +25679 { +25680 50/push-eax +25681 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +25682 (is-simple-mu-type? %eax 3) # array => eax +25683 3d/compare-eax-with 0/imm32/false +25684 58/pop-to-eax +25685 $array-element-type-id:no-array: +25686 0f 84/jump-if-= $array-element-type-id:error2/disp32 +25687 } +25688 $array-element-type-id:skip-array: +25689 # t = t->right +25690 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +25691 # if t == 0 abort +25692 3d/compare-eax-with 0/imm32 +25693 0f 84/jump-if-= $array-element-type-id:error2/disp32 +25694 # if t->is-atom? abort +25695 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +25696 0f 85/jump-if-!= $array-element-type-id:error2/disp32 +25697 # t = t->left +25698 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +25699 # if (!t->is-atom?) t = t->left # TODO: assumes array element size can be determined from just first word of array element type +25700 # if (t->is-atom == false) t = lookup(t->left) +25701 { +25702 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +25703 75/jump-if-!= break/disp8 +25704 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +25705 } +25706 # return t->value +25707 8b/-> *(eax+4) 0/r32/eax # Type-tree-value +25708 $array-element-type-id:end: +25709 # . epilogue +25710 89/<- %esp 5/r32/ebp +25711 5d/pop-to-ebp +25712 c3/return +25713 +25714 $array-element-type-id:error0: +25715 (write-buffered *(ebp+0xc) "array-element-type-id: var '") +25716 50/push-eax +25717 8b/-> *(ebp+8) 0/r32/eax +25718 (lookup *eax *(eax+4)) # Var-name Var-name => eax +25719 (write-buffered *(ebp+0xc) %eax) +25720 58/pop-to-eax +25721 (write-buffered *(ebp+0xc) "' has no type\n") +25722 (flush *(ebp+0xc)) +25723 (stop *(ebp+0x10) 1) +25724 # never gets here +25725 +25726 $array-element-type-id:error1: +25727 (write-buffered *(ebp+0xc) "array-element-type-id: var '") +25728 50/push-eax +25729 8b/-> *(ebp+8) 0/r32/eax +25730 (lookup *eax *(eax+4)) # Var-name Var-name => eax +25731 (write-buffered *(ebp+0xc) %eax) +25732 58/pop-to-eax +25733 (write-buffered *(ebp+0xc) "' has atomic type ") +25734 (write-int32-hex-buffered *(ebp+0xc) *(eax+4)) # Type-tree-value +25735 (write-buffered *(ebp+0xc) Newline) +25736 (flush *(ebp+0xc)) +25737 (stop *(ebp+0x10) 1) +25738 # never gets here +25739 +25740 $array-element-type-id:error2: +25741 (write-buffered *(ebp+0xc) "array-element-type-id: var '") 25742 50/push-eax -25743 51/push-ecx -25744 56/push-esi -25745 57/push-edi -25746 # esi = stmt -25747 8b/-> *(ebp+0xc) 6/r32/esi -25748 # var stream/ecx: (addr stmt-var) = stmt->inouts[0] -25749 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -25750 89/<- %ecx 0/r32/eax -25751 # var target/edi: (addr stmt-var) = stmt->inouts[1] -25752 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax -25753 89/<- %edi 0/r32/eax -25754 # -25755 (emit-indent *(ebp+8) *Curr-block-depth) -25756 (write-buffered *(ebp+8) "(read-from-stream") -25757 (emit-subx-call-operand *(ebp+8) %ecx) -25758 (emit-subx-call-operand *(ebp+8) %edi) -25759 (write-buffered *(ebp+8) Space) -25760 (addr-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax -25761 (write-int32-hex-buffered *(ebp+8) %eax) -25762 (write-buffered *(ebp+8) ")\n") -25763 $translate-mu-read-from-stream-stmt:end: -25764 # . restore registers -25765 5f/pop-to-edi -25766 5e/pop-to-esi -25767 59/pop-to-ecx -25768 58/pop-to-eax -25769 # . epilogue -25770 89/<- %esp 5/r32/ebp -25771 5d/pop-to-ebp -25772 c3/return -25773 -25774 translate-mu-write-to-stream-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -25775 # . prologue -25776 55/push-ebp -25777 89/<- %ebp 4/r32/esp -25778 # . save registers -25779 50/push-eax -25780 51/push-ecx -25781 56/push-esi -25782 57/push-edi -25783 # esi = stmt -25784 8b/-> *(ebp+0xc) 6/r32/esi -25785 # var stream/ecx: (addr stmt-var) = stmt->inouts[0] -25786 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax -25787 89/<- %ecx 0/r32/eax -25788 # var target/edi: (addr stmt-var) = stmt->inouts[1] -25789 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax -25790 89/<- %edi 0/r32/eax -25791 # -25792 (emit-indent *(ebp+8) *Curr-block-depth) -25793 (write-buffered *(ebp+8) "(write-to-stream") -25794 (emit-subx-call-operand *(ebp+8) %ecx) -25795 (flush *(ebp+8)) -25796 (emit-subx-call-operand *(ebp+8) %edi) -25797 (flush *(ebp+8)) -25798 (write-buffered *(ebp+8) Space) -25799 (flush *(ebp+8)) -25800 (addr-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax -25801 (write-int32-hex-buffered *(ebp+8) %eax) -25802 (write-buffered *(ebp+8) ")\n") -25803 $translate-mu-write-to-stream-stmt:end: -25804 # . restore registers -25805 5f/pop-to-edi -25806 5e/pop-to-esi -25807 59/pop-to-ecx -25808 58/pop-to-eax -25809 # . epilogue -25810 89/<- %esp 5/r32/ebp -25811 5d/pop-to-ebp -25812 c3/return -25813 -25814 addr-handle-array-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int -25815 # . prologue -25816 55/push-ebp -25817 89/<- %ebp 4/r32/esp -25818 # var t/eax: (addr type-tree) = s->value->type -25819 8b/-> *(ebp+8) 0/r32/eax -25820 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25821 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -25822 # TODO: check eax != 0 -25823 # TODO: check !t->is-atom? -25824 # TODO: check t->left == addr -25825 # t = t->right -25826 $addr-handle-array-payload-size:skip-addr: -25827 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -25828 # TODO: check eax != 0 -25829 # TODO: check !t->is-atom? -25830 # TODO: check t->left == handle -25831 # t = t->right -25832 $addr-handle-array-payload-size:skip-handle: -25833 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -25834 # TODO: check eax != 0 -25835 # TODO: check !t->is-atom? -25836 # TODO: check t->left == array -25837 # t = t->right -25838 $addr-handle-array-payload-size:skip-array: -25839 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -25840 # TODO: check eax != 0 -25841 # if !t->is-atom? t = t->left -25842 81 7/subop/compare *eax 0/imm32/false -25843 { -25844 75/jump-if-!= break/disp8 -25845 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -25846 } -25847 $addr-handle-array-payload-size:compute-size: -25848 # TODO: check t->is-atom? -25849 # return size(t->value) -25850 (size-of-type-id-as-array-element *(eax+4)) # Type-tree-value => eax -25851 $addr-handle-array-payload-size:end: -25852 # . epilogue -25853 89/<- %esp 5/r32/ebp -25854 5d/pop-to-ebp -25855 c3/return -25856 -25857 addr-handle-stream-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int -25858 # . prologue -25859 55/push-ebp -25860 89/<- %ebp 4/r32/esp -25861 # var t/eax: (addr type-tree) = s->value->type -25862 8b/-> *(ebp+8) 0/r32/eax -25863 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25864 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax -25865 # TODO: check eax != 0 -25866 # TODO: check !t->is-atom? -25867 # TODO: check t->left == addr -25868 # t = t->right -25869 $addr-handle-stream-payload-size:skip-addr: -25870 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -25871 # TODO: check eax != 0 -25872 # TODO: check !t->is-atom? -25873 # TODO: check t->left == handle -25874 # t = t->right -25875 $addr-handle-stream-payload-size:skip-handle: -25876 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -25877 # TODO: check eax != 0 -25878 # TODO: check !t->is-atom? -25879 # TODO: check t->left == stream -25880 # t = t->right -25881 $addr-handle-stream-payload-size:skip-stream: -25882 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax -25883 # TODO: check eax != 0 -25884 # if !t->is-atom? t = t->left -25885 81 7/subop/compare *eax 0/imm32/false -25886 { -25887 75/jump-if-!= break/disp8 -25888 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -25889 } -25890 $addr-handle-stream-payload-size:compute-size: -25891 # TODO: check t->is-atom? -25892 # return size(t->value) -25893 (size-of-type-id-as-array-element *(eax+4)) # Type-tree-value => eax -25894 $addr-handle-stream-payload-size:end: -25895 # . epilogue -25896 89/<- %esp 5/r32/ebp -25897 5d/pop-to-ebp -25898 c3/return -25899 -25900 power-of-2?: # n: int, err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: boolean -25901 # precondition: n is positive -25902 # . prologue -25903 55/push-ebp -25904 89/<- %ebp 4/r32/esp -25905 # eax = n -25906 8b/-> *(ebp+8) 0/r32/eax -25907 # if (n < 0) abort -25908 3d/compare-eax-with 0/imm32 -25909 0f 8c/jump-if-< $power-of-2?:abort/disp32 -25910 # var tmp/eax: int = n-1 -25911 48/decrement-eax -25912 # var tmp2/eax: int = n & tmp -25913 23/and-> *(ebp+8) 0/r32/eax -25914 # return (tmp2 == 0) -25915 3d/compare-eax-and 0/imm32 -25916 0f 94/set-byte-if-= %al -25917 81 4/subop/and %eax 0xff/imm32 -25918 $power-of-2?:end: -25919 # . epilogue -25920 89/<- %esp 5/r32/ebp -25921 5d/pop-to-ebp -25922 c3/return -25923 -25924 $power-of-2?:abort: -25925 (write-buffered *(ebp+0xc) "power-of-2?: negative number\n") -25926 (flush *(ebp+0xc)) -25927 (stop *(ebp+0x10) 1) -25928 # never gets here -25929 -25930 num-shift-rights: # n: int -> result/eax: int -25931 # precondition: n is a positive power of 2 -25932 # . prologue -25933 55/push-ebp -25934 89/<- %ebp 4/r32/esp -25935 # . save registers -25936 51/push-ecx -25937 # var curr/ecx: int = n -25938 8b/-> *(ebp+8) 1/r32/ecx -25939 # result = 0 -25940 b8/copy-to-eax 0/imm32 -25941 { -25942 # if (curr <= 1) break -25943 81 7/subop/compare %ecx 1/imm32 -25944 7e/jump-if-<= break/disp8 -25945 40/increment-eax -25946 c1/shift 5/subop/arithmetic-right %ecx 1/imm8 -25947 eb/jump loop/disp8 -25948 } -25949 $num-shift-rights:end: -25950 # . restore registers -25951 59/pop-to-ecx -25952 # . epilogue -25953 89/<- %esp 5/r32/ebp -25954 5d/pop-to-ebp -25955 c3/return -25956 -25957 mu-get-offset: # stmt: (addr stmt) -> result/eax: int -25958 # . prologue -25959 55/push-ebp -25960 89/<- %ebp 4/r32/esp -25961 # var second-inout/eax: (addr stmt-var) = stmt->inouts->next -25962 8b/-> *(ebp+8) 0/r32/eax -25963 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax -25964 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -25965 # var output-var/eax: (addr var) = second-inout->value -25966 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -25967 #? (write-buffered Stderr "mu-get-offset: ") -25968 #? (write-int32-hex-buffered Stderr %eax) -25969 #? (write-buffered Stderr " name: ") -25970 #? 50/push-eax -25971 #? (lookup *eax *(eax+4)) # Var-name -25972 #? (write-buffered Stderr %eax) -25973 #? 58/pop-to-eax -25974 #? (write-buffered Stderr Newline) -25975 #? (flush Stderr) -25976 # return output-var->stack-offset -25977 8b/-> *(eax+0x14) 0/r32/eax # Var-offset -25978 #? (write-buffered Stderr "=> ") -25979 #? (write-int32-hex-buffered Stderr %eax) -25980 #? (write-buffered Stderr Newline) -25981 #? (flush Stderr) -25982 $emit-get-offset:end: -25983 # . epilogue -25984 89/<- %esp 5/r32/ebp -25985 5d/pop-to-ebp -25986 c3/return -25987 -25988 emit-subx-block: # out: (addr buffered-file), block: (addr block), vars: (addr stack live-var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) -25989 # . prologue -25990 55/push-ebp -25991 89/<- %ebp 4/r32/esp -25992 # . save registers -25993 50/push-eax -25994 51/push-ecx -25995 56/push-esi -25996 # esi = block -25997 8b/-> *(ebp+0xc) 6/r32/esi -25998 # block->var->block-depth = *Curr-block-depth -25999 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax -26000 8b/-> *Curr-block-depth 1/r32/ecx -26001 89/<- *(eax+0x10) 1/r32/ecx # Var-block-depth -26002 # var stmts/eax: (addr list stmt) = lookup(block->statements) -26003 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax -26004 # -26005 { -26006 $emit-subx-block:check-empty: -26007 3d/compare-eax-and 0/imm32 -26008 0f 84/jump-if-= break/disp32 -26009 (emit-indent *(ebp+8) *Curr-block-depth) -26010 (write-buffered *(ebp+8) "{\n") -26011 # var v/ecx: (addr var) = lookup(block->var) -26012 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax -26013 89/<- %ecx 0/r32/eax -26014 # -26015 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -26016 (write-buffered *(ebp+8) %eax) -26017 (write-buffered *(ebp+8) ":loop:\n") -26018 ff 0/subop/increment *Curr-block-depth -26019 (push *(ebp+0x10) *(esi+0xc)) # Block-var -26020 (push *(ebp+0x10) *(esi+0x10)) # Block-var -26021 (push *(ebp+0x10) 0) # false -26022 # emit block->statements -26023 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax -26024 (emit-subx-stmt-list *(ebp+8) %eax *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) -26025 (pop *(ebp+0x10)) # => eax -26026 (pop *(ebp+0x10)) # => eax -26027 (pop *(ebp+0x10)) # => eax -26028 ff 1/subop/decrement *Curr-block-depth -26029 (emit-indent *(ebp+8) *Curr-block-depth) -26030 (write-buffered *(ebp+8) "}\n") -26031 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax -26032 (write-buffered *(ebp+8) %eax) -26033 (write-buffered *(ebp+8) ":break:\n") -26034 } -26035 $emit-subx-block:end: -26036 # . restore registers -26037 5e/pop-to-esi -26038 59/pop-to-ecx -26039 58/pop-to-eax -26040 # . epilogue -26041 89/<- %esp 5/r32/ebp -26042 5d/pop-to-ebp -26043 c3/return -26044 -26045 # Primitives supported -26046 # See mu_instructions for a summary of this linked-list data structure. -26047 # -26048 # For each operation, put variants with hard-coded registers before flexible ones. -26049 # -26050 # Unfortunately, our restrictions on addresses require that various fields in -26051 # primitives be handles, which complicates these definitions. -26052 # - we need to insert dummy fields all over the place for fake alloc-ids -26053 # - we can't use our syntax sugar of quoted literals for string fields -26054 # -26055 # Fake alloc-ids are needed because our type definitions up top require -26056 # handles but it's clearer to statically allocate these long-lived objects. -26057 # Fake alloc-ids are perfectly safe, but they can't be reclaimed. -26058 # -26059 # Every 'object' below starts with a fake alloc-id. It may also contain other -26060 # fake alloc-ids for various handle fields. -26061 # -26062 # I think of objects starting with a fake alloc-id as having type 'payload'. -26063 # It's not really intended to be created dynamically; for that use `allocate` -26064 # as usual. -26065 # -26066 # Idea for a notation to simplify such definitions: -26067 # _Primitive-increment-eax: # (payload primitive) -26068 # 0x11/alloc-id:fake:payload -26069 # 0x11 @(0x11 "increment") # name -26070 # 0 0 # inouts -26071 # 0x11 @(0x11/payload -26072 # 0x11 @(0x11/payload # List-value -26073 # 0 0 # Var-name -26074 # 0x11 @(0x11 # Var-type -26075 # 1/is-atom -26076 # 1/value 0/unused # Type-tree-left -26077 # 0 0 # Type-tree-right -26078 # ) -26079 # 1 # block-depth -26080 # 0 # stack-offset -26081 # 0x11 @(0x11 "eax") # Var-register -26082 # ) -26083 # 0 0) # List-next -26084 # ... -26085 # _Primitive-increment-ecx/imm32/next -26086 # ... -26087 # Awfully complex and non-obvious. But also clearly signals there's something -26088 # to learn here, so may be worth trying. -26089 # -26090 # '@' is just an initial thought. Punctuation used so far in Mu: () * % # / " -26091 # -26092 # For now we'll continue to just use comments and manually ensure they stay up -26093 # to date. -26094 == data -26095 Primitives: # (addr primitive) -26096 # - increment/decrement -26097 _Primitive-increment-eax: # (addr primitive) -26098 # var/eax <- increment => 40/increment-eax -26099 0x11/imm32/alloc-id:fake -26100 _string-increment/imm32/name -26101 0/imm32/no-inouts -26102 0/imm32/no-inouts -26103 0x11/imm32/alloc-id:fake -26104 Single-int-var-in-eax/imm32/outputs -26105 0x11/imm32/alloc-id:fake -26106 _string_40_increment_eax/imm32/subx-name -26107 0/imm32/no-rm32 -26108 0/imm32/no-r32 -26109 0/imm32/no-imm32 -26110 0/imm32/no-imm8 -26111 0/imm32/no-disp32 -26112 0/imm32/no-xm32 -26113 0/imm32/no-x32 -26114 0x11/imm32/alloc-id:fake -26115 _Primitive-increment-ecx/imm32/next -26116 _Primitive-increment-ecx: # (payload primitive) -26117 0x11/imm32/alloc-id:fake:payload -26118 # var/ecx <- increment => 41/increment-ecx -26119 0x11/imm32/alloc-id:fake -26120 _string-increment/imm32/name -26121 0/imm32/no-inouts -26122 0/imm32/no-inouts -26123 0x11/imm32/alloc-id:fake -26124 Single-int-var-in-ecx/imm32/outputs -26125 0x11/imm32/alloc-id:fake -26126 _string_41_increment_ecx/imm32/subx-name -26127 0/imm32/no-rm32 -26128 0/imm32/no-r32 -26129 0/imm32/no-imm32 -26130 0/imm32/no-imm8 -26131 0/imm32/no-disp32 -26132 0/imm32/no-xm32 -26133 0/imm32/no-x32 -26134 0x11/imm32/alloc-id:fake -26135 _Primitive-increment-edx/imm32/next -26136 _Primitive-increment-edx: # (payload primitive) -26137 0x11/imm32/alloc-id:fake:payload -26138 # var/edx <- increment => 42/increment-edx -26139 0x11/imm32/alloc-id:fake -26140 _string-increment/imm32/name -26141 0/imm32/no-inouts -26142 0/imm32/no-inouts -26143 0x11/imm32/alloc-id:fake -26144 Single-int-var-in-edx/imm32/outputs -26145 0x11/imm32/alloc-id:fake -26146 _string_42_increment_edx/imm32/subx-name -26147 0/imm32/no-rm32 -26148 0/imm32/no-r32 -26149 0/imm32/no-imm32 -26150 0/imm32/no-imm8 -26151 0/imm32/no-disp32 -26152 0/imm32/no-xm32 -26153 0/imm32/no-x32 -26154 0x11/imm32/alloc-id:fake -26155 _Primitive-increment-ebx/imm32/next -26156 _Primitive-increment-ebx: # (payload primitive) -26157 0x11/imm32/alloc-id:fake:payload -26158 # var/ebx <- increment => 43/increment-ebx -26159 0x11/imm32/alloc-id:fake -26160 _string-increment/imm32/name -26161 0/imm32/no-inouts -26162 0/imm32/no-inouts -26163 0x11/imm32/alloc-id:fake -26164 Single-int-var-in-ebx/imm32/outputs -26165 0x11/imm32/alloc-id:fake -26166 _string_43_increment_ebx/imm32/subx-name -26167 0/imm32/no-rm32 -26168 0/imm32/no-r32 -26169 0/imm32/no-imm32 -26170 0/imm32/no-imm8 -26171 0/imm32/no-disp32 -26172 0/imm32/no-xm32 -26173 0/imm32/no-x32 -26174 0x11/imm32/alloc-id:fake -26175 _Primitive-increment-esi/imm32/next -26176 _Primitive-increment-esi: # (payload primitive) -26177 0x11/imm32/alloc-id:fake:payload -26178 # var/esi <- increment => 46/increment-esi -26179 0x11/imm32/alloc-id:fake -26180 _string-increment/imm32/name -26181 0/imm32/no-inouts -26182 0/imm32/no-inouts -26183 0x11/imm32/alloc-id:fake -26184 Single-int-var-in-esi/imm32/outputs -26185 0x11/imm32/alloc-id:fake -26186 _string_46_increment_esi/imm32/subx-name -26187 0/imm32/no-rm32 -26188 0/imm32/no-r32 -26189 0/imm32/no-imm32 -26190 0/imm32/no-imm8 -26191 0/imm32/no-disp32 -26192 0/imm32/no-xm32 -26193 0/imm32/no-x32 -26194 0x11/imm32/alloc-id:fake -26195 _Primitive-increment-edi/imm32/next -26196 _Primitive-increment-edi: # (payload primitive) -26197 0x11/imm32/alloc-id:fake:payload -26198 # var/edi <- increment => 47/increment-edi -26199 0x11/imm32/alloc-id:fake -26200 _string-increment/imm32/name -26201 0/imm32/no-inouts -26202 0/imm32/no-inouts -26203 0x11/imm32/alloc-id:fake -26204 Single-int-var-in-edi/imm32/outputs -26205 0x11/imm32/alloc-id:fake -26206 _string_47_increment_edi/imm32/subx-name -26207 0/imm32/no-rm32 -26208 0/imm32/no-r32 -26209 0/imm32/no-imm32 -26210 0/imm32/no-imm8 -26211 0/imm32/no-disp32 -26212 0/imm32/no-xm32 -26213 0/imm32/no-x32 -26214 0x11/imm32/alloc-id:fake -26215 _Primitive-decrement-eax/imm32/next -26216 _Primitive-decrement-eax: # (payload primitive) -26217 0x11/imm32/alloc-id:fake:payload -26218 # var/eax <- decrement => 48/decrement-eax -26219 0x11/imm32/alloc-id:fake -26220 _string-decrement/imm32/name -26221 0/imm32/no-inouts -26222 0/imm32/no-inouts -26223 0x11/imm32/alloc-id:fake -26224 Single-int-var-in-eax/imm32/outputs -26225 0x11/imm32/alloc-id:fake -26226 _string_48_decrement_eax/imm32/subx-name -26227 0/imm32/no-rm32 -26228 0/imm32/no-r32 -26229 0/imm32/no-imm32 -26230 0/imm32/no-imm8 -26231 0/imm32/no-disp32 -26232 0/imm32/no-xm32 -26233 0/imm32/no-x32 -26234 0x11/imm32/alloc-id:fake -26235 _Primitive-decrement-ecx/imm32/next -26236 _Primitive-decrement-ecx: # (payload primitive) -26237 0x11/imm32/alloc-id:fake:payload -26238 # var/ecx <- decrement => 49/decrement-ecx -26239 0x11/imm32/alloc-id:fake -26240 _string-decrement/imm32/name -26241 0/imm32/no-inouts -26242 0/imm32/no-inouts -26243 0x11/imm32/alloc-id:fake -26244 Single-int-var-in-ecx/imm32/outputs -26245 0x11/imm32/alloc-id:fake -26246 _string_49_decrement_ecx/imm32/subx-name -26247 0/imm32/no-rm32 -26248 0/imm32/no-r32 -26249 0/imm32/no-imm32 -26250 0/imm32/no-imm8 -26251 0/imm32/no-disp32 -26252 0/imm32/no-xm32 -26253 0/imm32/no-x32 -26254 0x11/imm32/alloc-id:fake -26255 _Primitive-decrement-edx/imm32/next -26256 _Primitive-decrement-edx: # (payload primitive) -26257 0x11/imm32/alloc-id:fake:payload -26258 # var/edx <- decrement => 4a/decrement-edx -26259 0x11/imm32/alloc-id:fake -26260 _string-decrement/imm32/name -26261 0/imm32/no-inouts -26262 0/imm32/no-inouts -26263 0x11/imm32/alloc-id:fake -26264 Single-int-var-in-edx/imm32/outputs -26265 0x11/imm32/alloc-id:fake -26266 _string_4a_decrement_edx/imm32/subx-name -26267 0/imm32/no-rm32 -26268 0/imm32/no-r32 -26269 0/imm32/no-imm32 -26270 0/imm32/no-imm8 -26271 0/imm32/no-disp32 -26272 0/imm32/no-xm32 -26273 0/imm32/no-x32 -26274 0x11/imm32/alloc-id:fake -26275 _Primitive-decrement-ebx/imm32/next -26276 _Primitive-decrement-ebx: # (payload primitive) -26277 0x11/imm32/alloc-id:fake:payload -26278 # var/ebx <- decrement => 4b/decrement-ebx -26279 0x11/imm32/alloc-id:fake -26280 _string-decrement/imm32/name -26281 0/imm32/no-inouts -26282 0/imm32/no-inouts -26283 0x11/imm32/alloc-id:fake -26284 Single-int-var-in-ebx/imm32/outputs -26285 0x11/imm32/alloc-id:fake -26286 _string_4b_decrement_ebx/imm32/subx-name -26287 0/imm32/no-rm32 -26288 0/imm32/no-r32 -26289 0/imm32/no-imm32 -26290 0/imm32/no-imm8 -26291 0/imm32/no-disp32 -26292 0/imm32/no-xm32 -26293 0/imm32/no-x32 -26294 0x11/imm32/alloc-id:fake -26295 _Primitive-decrement-esi/imm32/next -26296 _Primitive-decrement-esi: # (payload primitive) -26297 0x11/imm32/alloc-id:fake:payload -26298 # var/esi <- decrement => 4e/decrement-esi -26299 0x11/imm32/alloc-id:fake -26300 _string-decrement/imm32/name -26301 0/imm32/no-inouts -26302 0/imm32/no-inouts -26303 0x11/imm32/alloc-id:fake -26304 Single-int-var-in-esi/imm32/outputs -26305 0x11/imm32/alloc-id:fake -26306 _string_4e_decrement_esi/imm32/subx-name -26307 0/imm32/no-rm32 -26308 0/imm32/no-r32 -26309 0/imm32/no-imm32 -26310 0/imm32/no-imm8 -26311 0/imm32/no-disp32 -26312 0/imm32/no-xm32 -26313 0/imm32/no-x32 -26314 0x11/imm32/alloc-id:fake -26315 _Primitive-decrement-edi/imm32/next -26316 _Primitive-decrement-edi: # (payload primitive) -26317 0x11/imm32/alloc-id:fake:payload -26318 # var/edi <- decrement => 4f/decrement-edi -26319 0x11/imm32/alloc-id:fake -26320 _string-decrement/imm32/name -26321 0/imm32/no-inouts -26322 0/imm32/no-inouts -26323 0x11/imm32/alloc-id:fake -26324 Single-int-var-in-edi/imm32/outputs -26325 0x11/imm32/alloc-id:fake -26326 _string_4f_decrement_edi/imm32/subx-name -26327 0/imm32/no-rm32 -26328 0/imm32/no-r32 -26329 0/imm32/no-imm32 -26330 0/imm32/no-imm8 -26331 0/imm32/no-disp32 -26332 0/imm32/no-xm32 -26333 0/imm32/no-x32 -26334 0x11/imm32/alloc-id:fake -26335 _Primitive-increment-mem/imm32/next -26336 _Primitive-increment-mem: # (payload primitive) -26337 0x11/imm32/alloc-id:fake:payload -26338 # increment var => ff 0/subop/increment *(ebp+__) -26339 0x11/imm32/alloc-id:fake -26340 _string-increment/imm32/name -26341 0x11/imm32/alloc-id:fake -26342 Single-int-var-in-mem/imm32/inouts -26343 0/imm32/no-outputs -26344 0/imm32/no-outputs -26345 0x11/imm32/alloc-id:fake -26346 _string_ff_subop_increment/imm32/subx-name -26347 1/imm32/rm32-is-first-inout -26348 0/imm32/no-r32 -26349 0/imm32/no-imm32 -26350 0/imm32/no-imm8 -26351 0/imm32/no-disp32 -26352 0/imm32/no-xm32 -26353 0/imm32/no-x32 -26354 0x11/imm32/alloc-id:fake -26355 _Primitive-increment-reg/imm32/next -26356 _Primitive-increment-reg: # (payload primitive) -26357 0x11/imm32/alloc-id:fake:payload -26358 # var/reg <- increment => ff 0/subop/increment %__ -26359 0x11/imm32/alloc-id:fake -26360 _string-increment/imm32/name -26361 0/imm32/no-inouts -26362 0/imm32/no-inouts -26363 0x11/imm32/alloc-id:fake -26364 Single-int-var-in-some-register/imm32/outputs -26365 0x11/imm32/alloc-id:fake -26366 _string_ff_subop_increment/imm32/subx-name -26367 3/imm32/rm32-is-first-output -26368 0/imm32/no-r32 -26369 0/imm32/no-imm32 -26370 0/imm32/no-imm8 -26371 0/imm32/no-disp32 -26372 0/imm32/no-xm32 -26373 0/imm32/no-x32 -26374 0x11/imm32/alloc-id:fake -26375 _Primitive-decrement-mem/imm32/next -26376 _Primitive-decrement-mem: # (payload primitive) -26377 0x11/imm32/alloc-id:fake:payload -26378 # decrement var => ff 1/subop/decrement *(ebp+__) -26379 0x11/imm32/alloc-id:fake -26380 _string-decrement/imm32/name -26381 0x11/imm32/alloc-id:fake -26382 Single-int-var-in-mem/imm32/inouts -26383 0/imm32/no-outputs -26384 0/imm32/no-outputs -26385 0x11/imm32/alloc-id:fake -26386 _string_ff_subop_decrement/imm32/subx-name -26387 1/imm32/rm32-is-first-inout -26388 0/imm32/no-r32 -26389 0/imm32/no-imm32 -26390 0/imm32/no-imm8 -26391 0/imm32/no-disp32 -26392 0/imm32/no-xm32 -26393 0/imm32/no-x32 -26394 0x11/imm32/alloc-id:fake -26395 _Primitive-decrement-reg/imm32/next -26396 _Primitive-decrement-reg: # (payload primitive) -26397 0x11/imm32/alloc-id:fake:payload -26398 # var/reg <- decrement => ff 1/subop/decrement %__ -26399 0x11/imm32/alloc-id:fake -26400 _string-decrement/imm32/name -26401 0/imm32/no-inouts -26402 0/imm32/no-inouts -26403 0x11/imm32/alloc-id:fake -26404 Single-int-var-in-some-register/imm32/outputs -26405 0x11/imm32/alloc-id:fake -26406 _string_ff_subop_decrement/imm32/subx-name -26407 3/imm32/rm32-is-first-output -26408 0/imm32/no-r32 -26409 0/imm32/no-imm32 -26410 0/imm32/no-imm8 -26411 0/imm32/no-disp32 -26412 0/imm32/no-xm32 -26413 0/imm32/no-x32 -26414 0x11/imm32/alloc-id:fake -26415 _Primitive-add-to-eax/imm32/next -26416 # - add -26417 _Primitive-add-to-eax: # (payload primitive) -26418 0x11/imm32/alloc-id:fake:payload -26419 # var/eax <- add lit => 05/add-to-eax lit/imm32 -26420 0x11/imm32/alloc-id:fake -26421 _string-add/imm32/name -26422 0x11/imm32/alloc-id:fake -26423 Single-lit-var/imm32/inouts -26424 0x11/imm32/alloc-id:fake -26425 Single-int-var-in-eax/imm32/outputs -26426 0x11/imm32/alloc-id:fake -26427 _string_05_add_to_eax/imm32/subx-name -26428 0/imm32/no-rm32 -26429 0/imm32/no-r32 -26430 1/imm32/imm32-is-first-inout -26431 0/imm32/no-imm8 -26432 0/imm32/no-disp32 -26433 0/imm32/no-xm32 -26434 0/imm32/no-x32 -26435 0x11/imm32/alloc-id:fake -26436 _Primitive-add-reg-to-reg/imm32/next -26437 _Primitive-add-reg-to-reg: # (payload primitive) -26438 0x11/imm32/alloc-id:fake:payload -26439 # var1/reg <- add var2/reg => 01/add-to var1/rm32 var2/r32 -26440 0x11/imm32/alloc-id:fake -26441 _string-add/imm32/name -26442 0x11/imm32/alloc-id:fake -26443 Single-int-var-in-some-register/imm32/inouts -26444 0x11/imm32/alloc-id:fake -26445 Single-int-var-in-some-register/imm32/outputs -26446 0x11/imm32/alloc-id:fake -26447 _string_01_add_to/imm32/subx-name -26448 3/imm32/rm32-is-first-output -26449 1/imm32/r32-is-first-inout -26450 0/imm32/no-imm32 -26451 0/imm32/no-imm8 -26452 0/imm32/no-disp32 -26453 0/imm32/no-xm32 -26454 0/imm32/no-x32 -26455 0x11/imm32/alloc-id:fake -26456 _Primitive-add-reg-to-mem/imm32/next -26457 _Primitive-add-reg-to-mem: # (payload primitive) -26458 0x11/imm32/alloc-id:fake:payload -26459 # add-to var1 var2/reg => 01/add-to var1 var2/r32 -26460 0x11/imm32/alloc-id:fake -26461 _string-add-to/imm32/name -26462 0x11/imm32/alloc-id:fake -26463 Two-args-int-stack-int-reg/imm32/inouts -26464 0/imm32/no-outputs -26465 0/imm32/no-outputs -26466 0x11/imm32/alloc-id:fake -26467 _string_01_add_to/imm32/subx-name -26468 1/imm32/rm32-is-first-inout -26469 2/imm32/r32-is-second-inout -26470 0/imm32/no-imm32 -26471 0/imm32/no-imm8 -26472 0/imm32/no-disp32 -26473 0/imm32/no-xm32 -26474 0/imm32/no-x32 -26475 0x11/imm32/alloc-id:fake -26476 _Primitive-add-mem-to-reg/imm32/next -26477 _Primitive-add-mem-to-reg: # (payload primitive) -26478 0x11/imm32/alloc-id:fake:payload -26479 # var1/reg <- add var2 => 03/add var2/rm32 var1/r32 -26480 0x11/imm32/alloc-id:fake -26481 _string-add/imm32/name -26482 0x11/imm32/alloc-id:fake -26483 Single-int-var-in-mem/imm32/inouts -26484 0x11/imm32/alloc-id:fake -26485 Single-int-var-in-some-register/imm32/outputs -26486 0x11/imm32/alloc-id:fake -26487 _string_03_add/imm32/subx-name -26488 1/imm32/rm32-is-first-inout -26489 3/imm32/r32-is-first-output -26490 0/imm32/no-imm32 -26491 0/imm32/no-imm8 -26492 0/imm32/no-disp32 -26493 0/imm32/no-xm32 -26494 0/imm32/no-x32 -26495 0x11/imm32/alloc-id:fake -26496 _Primitive-add-lit-to-reg/imm32/next -26497 _Primitive-add-lit-to-reg: # (payload primitive) -26498 0x11/imm32/alloc-id:fake:payload -26499 # var1/reg <- add lit => 81 0/subop/add var1/rm32 lit/imm32 -26500 0x11/imm32/alloc-id:fake -26501 _string-add/imm32/name -26502 0x11/imm32/alloc-id:fake -26503 Single-lit-var/imm32/inouts -26504 0x11/imm32/alloc-id:fake -26505 Single-int-var-in-some-register/imm32/outputs -26506 0x11/imm32/alloc-id:fake -26507 _string_81_subop_add/imm32/subx-name -26508 3/imm32/rm32-is-first-output -26509 0/imm32/no-r32 -26510 1/imm32/imm32-is-first-inout -26511 0/imm32/no-imm8 -26512 0/imm32/no-disp32 -26513 0/imm32/no-xm32 -26514 0/imm32/no-x32 -26515 0x11/imm32/alloc-id:fake -26516 _Primitive-add-lit-to-mem/imm32/next -26517 _Primitive-add-lit-to-mem: # (payload primitive) -26518 0x11/imm32/alloc-id:fake:payload -26519 # add-to var1, lit => 81 0/subop/add var1/rm32 lit/imm32 -26520 0x11/imm32/alloc-id:fake -26521 _string-add-to/imm32/name -26522 0x11/imm32/alloc-id:fake -26523 Int-var-and-literal/imm32/inouts -26524 0/imm32/no-outputs -26525 0/imm32/no-outputs -26526 0x11/imm32/alloc-id:fake -26527 _string_81_subop_add/imm32/subx-name -26528 1/imm32/rm32-is-first-inout -26529 0/imm32/no-r32 -26530 2/imm32/imm32-is-second-inout -26531 0/imm32/no-imm8 -26532 0/imm32/no-disp32 -26533 0/imm32/no-xm32 -26534 0/imm32/no-x32 -26535 0x11/imm32/alloc-id:fake -26536 _Primitive-subtract-from-eax/imm32/next -26537 # - subtract -26538 _Primitive-subtract-from-eax: # (payload primitive) -26539 0x11/imm32/alloc-id:fake:payload -26540 # var/eax <- subtract lit => 2d/subtract-from-eax lit/imm32 -26541 0x11/imm32/alloc-id:fake -26542 _string-subtract/imm32/name -26543 0x11/imm32/alloc-id:fake -26544 Single-lit-var/imm32/inouts -26545 0x11/imm32/alloc-id:fake -26546 Single-int-var-in-eax/imm32/outputs -26547 0x11/imm32/alloc-id:fake -26548 _string_2d_subtract_from_eax/imm32/subx-name -26549 0/imm32/no-rm32 -26550 0/imm32/no-r32 -26551 1/imm32/imm32-is-first-inout -26552 0/imm32/no-imm8 -26553 0/imm32/no-disp32 -26554 0/imm32/no-xm32 -26555 0/imm32/no-x32 -26556 0x11/imm32/alloc-id:fake -26557 _Primitive-subtract-reg-from-reg/imm32/next -26558 _Primitive-subtract-reg-from-reg: # (payload primitive) -26559 0x11/imm32/alloc-id:fake:payload -26560 # var1/reg <- subtract var2/reg => 29/subtract-from var1/rm32 var2/r32 -26561 0x11/imm32/alloc-id:fake -26562 _string-subtract/imm32/name -26563 0x11/imm32/alloc-id:fake -26564 Single-int-var-in-some-register/imm32/inouts -26565 0x11/imm32/alloc-id:fake -26566 Single-int-var-in-some-register/imm32/outputs -26567 0x11/imm32/alloc-id:fake -26568 _string_29_subtract_from/imm32/subx-name -26569 3/imm32/rm32-is-first-output -26570 1/imm32/r32-is-first-inout -26571 0/imm32/no-imm32 -26572 0/imm32/no-imm8 -26573 0/imm32/no-disp32 -26574 0/imm32/no-xm32 -26575 0/imm32/no-x32 -26576 0x11/imm32/alloc-id:fake -26577 _Primitive-subtract-reg-from-mem/imm32/next -26578 _Primitive-subtract-reg-from-mem: # (payload primitive) -26579 0x11/imm32/alloc-id:fake:payload -26580 # subtract-from var1 var2/reg => 29/subtract-from var1 var2/r32 -26581 0x11/imm32/alloc-id:fake -26582 _string-subtract-from/imm32/name -26583 0x11/imm32/alloc-id:fake -26584 Two-args-int-stack-int-reg/imm32/inouts -26585 0/imm32/no-outputs -26586 0/imm32/no-outputs -26587 0x11/imm32/alloc-id:fake -26588 _string_29_subtract_from/imm32/subx-name -26589 1/imm32/rm32-is-first-inout -26590 2/imm32/r32-is-second-inout -26591 0/imm32/no-imm32 -26592 0/imm32/no-imm8 -26593 0/imm32/no-disp32 -26594 0/imm32/no-xm32 -26595 0/imm32/no-x32 -26596 0x11/imm32/alloc-id:fake -26597 _Primitive-subtract-mem-from-reg/imm32/next -26598 _Primitive-subtract-mem-from-reg: # (payload primitive) -26599 0x11/imm32/alloc-id:fake:payload -26600 # var1/reg <- subtract var2 => 2b/subtract var2/rm32 var1/r32 -26601 0x11/imm32/alloc-id:fake -26602 _string-subtract/imm32/name -26603 0x11/imm32/alloc-id:fake -26604 Single-int-var-in-mem/imm32/inouts -26605 0x11/imm32/alloc-id:fake -26606 Single-int-var-in-some-register/imm32/outputs -26607 0x11/imm32/alloc-id:fake -26608 _string_2b_subtract/imm32/subx-name -26609 1/imm32/rm32-is-first-inout -26610 3/imm32/r32-is-first-output -26611 0/imm32/no-imm32 -26612 0/imm32/no-imm8 -26613 0/imm32/no-disp32 -26614 0/imm32/no-xm32 -26615 0/imm32/no-x32 -26616 0x11/imm32/alloc-id:fake -26617 _Primitive-subtract-lit-from-reg/imm32/next -26618 _Primitive-subtract-lit-from-reg: # (payload primitive) -26619 0x11/imm32/alloc-id:fake:payload -26620 # var1/reg <- subtract lit => 81 5/subop/subtract var1/rm32 lit/imm32 -26621 0x11/imm32/alloc-id:fake -26622 _string-subtract/imm32/name -26623 0x11/imm32/alloc-id:fake -26624 Single-lit-var/imm32/inouts -26625 0x11/imm32/alloc-id:fake -26626 Single-int-var-in-some-register/imm32/outputs -26627 0x11/imm32/alloc-id:fake -26628 _string_81_subop_subtract/imm32/subx-name -26629 3/imm32/rm32-is-first-output -26630 0/imm32/no-r32 -26631 1/imm32/imm32-is-first-inout -26632 0/imm32/no-imm8 -26633 0/imm32/no-disp32 -26634 0/imm32/no-xm32 -26635 0/imm32/no-x32 -26636 0x11/imm32/alloc-id:fake -26637 _Primitive-subtract-lit-from-mem/imm32/next -26638 _Primitive-subtract-lit-from-mem: # (payload primitive) -26639 0x11/imm32/alloc-id:fake:payload -26640 # subtract-from var1, lit => 81 5/subop/subtract var1/rm32 lit/imm32 -26641 0x11/imm32/alloc-id:fake -26642 _string-subtract-from/imm32/name -26643 0x11/imm32/alloc-id:fake -26644 Int-var-and-literal/imm32/inouts -26645 0/imm32/no-outputs -26646 0/imm32/no-outputs -26647 0x11/imm32/alloc-id:fake -26648 _string_81_subop_subtract/imm32/subx-name -26649 1/imm32/rm32-is-first-inout -26650 0/imm32/no-r32 -26651 2/imm32/imm32-is-second-inout -26652 0/imm32/no-imm8 -26653 0/imm32/no-disp32 -26654 0/imm32/no-xm32 -26655 0/imm32/no-x32 -26656 0x11/imm32/alloc-id:fake -26657 _Primitive-and-with-eax/imm32/next -26658 # - and -26659 _Primitive-and-with-eax: # (payload primitive) -26660 0x11/imm32/alloc-id:fake:payload -26661 # var/eax <- and lit => 25/and-with-eax lit/imm32 -26662 0x11/imm32/alloc-id:fake -26663 _string-and/imm32/name -26664 0x11/imm32/alloc-id:fake -26665 Single-lit-var/imm32/inouts -26666 0x11/imm32/alloc-id:fake -26667 Single-int-var-in-eax/imm32/outputs -26668 0x11/imm32/alloc-id:fake -26669 _string_25_and_with_eax/imm32/subx-name -26670 0/imm32/no-rm32 -26671 0/imm32/no-r32 -26672 1/imm32/imm32-is-first-inout -26673 0/imm32/no-imm8 -26674 0/imm32/no-disp32 -26675 0/imm32/no-xm32 -26676 0/imm32/no-x32 -26677 0x11/imm32/alloc-id:fake -26678 _Primitive-and-reg-with-reg/imm32/next -26679 _Primitive-and-reg-with-reg: # (payload primitive) -26680 0x11/imm32/alloc-id:fake:payload -26681 # var1/reg <- and var2/reg => 21/and-with var1/rm32 var2/r32 -26682 0x11/imm32/alloc-id:fake -26683 _string-and/imm32/name -26684 0x11/imm32/alloc-id:fake -26685 Single-int-var-in-some-register/imm32/inouts -26686 0x11/imm32/alloc-id:fake -26687 Single-int-var-in-some-register/imm32/outputs -26688 0x11/imm32/alloc-id:fake -26689 _string_21_and_with/imm32/subx-name -26690 3/imm32/rm32-is-first-output -26691 1/imm32/r32-is-first-inout -26692 0/imm32/no-imm32 -26693 0/imm32/no-imm8 -26694 0/imm32/no-disp32 -26695 0/imm32/no-xm32 -26696 0/imm32/no-x32 -26697 0x11/imm32/alloc-id:fake -26698 _Primitive-and-reg-with-mem/imm32/next -26699 _Primitive-and-reg-with-mem: # (payload primitive) -26700 0x11/imm32/alloc-id:fake:payload -26701 # and-with var1 var2/reg => 21/and-with var1 var2/r32 -26702 0x11/imm32/alloc-id:fake -26703 _string-and-with/imm32/name -26704 0x11/imm32/alloc-id:fake -26705 Two-args-int-stack-int-reg/imm32/inouts -26706 0/imm32/no-outputs -26707 0/imm32/no-outputs -26708 0x11/imm32/alloc-id:fake -26709 _string_21_and_with/imm32/subx-name -26710 1/imm32/rm32-is-first-inout -26711 2/imm32/r32-is-second-inout -26712 0/imm32/no-imm32 -26713 0/imm32/no-imm8 -26714 0/imm32/no-disp32 -26715 0/imm32/no-xm32 -26716 0/imm32/no-x32 -26717 0x11/imm32/alloc-id:fake -26718 _Primitive-and-mem-with-reg/imm32/next -26719 _Primitive-and-mem-with-reg: # (payload primitive) -26720 0x11/imm32/alloc-id:fake:payload -26721 # var1/reg <- and var2 => 23/and var2/rm32 var1/r32 -26722 0x11/imm32/alloc-id:fake -26723 _string-and/imm32/name -26724 0x11/imm32/alloc-id:fake -26725 Single-int-var-in-mem/imm32/inouts -26726 0x11/imm32/alloc-id:fake -26727 Single-int-var-in-some-register/imm32/outputs -26728 0x11/imm32/alloc-id:fake -26729 _string_23_and/imm32/subx-name -26730 1/imm32/rm32-is-first-inout -26731 3/imm32/r32-is-first-output -26732 0/imm32/no-imm32 -26733 0/imm32/no-imm8 -26734 0/imm32/no-disp32 -26735 0/imm32/no-xm32 -26736 0/imm32/no-x32 -26737 0x11/imm32/alloc-id:fake -26738 _Primitive-and-lit-with-reg/imm32/next -26739 _Primitive-and-lit-with-reg: # (payload primitive) -26740 0x11/imm32/alloc-id:fake:payload -26741 # var1/reg <- and lit => 81 4/subop/and var1/rm32 lit/imm32 -26742 0x11/imm32/alloc-id:fake -26743 _string-and/imm32/name -26744 0x11/imm32/alloc-id:fake -26745 Single-lit-var/imm32/inouts -26746 0x11/imm32/alloc-id:fake -26747 Single-int-var-in-some-register/imm32/outputs -26748 0x11/imm32/alloc-id:fake -26749 _string_81_subop_and/imm32/subx-name -26750 3/imm32/rm32-is-first-output -26751 0/imm32/no-r32 -26752 1/imm32/imm32-is-first-inout -26753 0/imm32/no-imm8 -26754 0/imm32/no-disp32 -26755 0/imm32/no-xm32 -26756 0/imm32/no-x32 -26757 0x11/imm32/alloc-id:fake -26758 _Primitive-and-lit-with-mem/imm32/next -26759 _Primitive-and-lit-with-mem: # (payload primitive) -26760 0x11/imm32/alloc-id:fake:payload -26761 # and-with var1, lit => 81 4/subop/and var1/rm32 lit/imm32 -26762 0x11/imm32/alloc-id:fake -26763 _string-and-with/imm32/name -26764 0x11/imm32/alloc-id:fake -26765 Int-var-and-literal/imm32/inouts -26766 0/imm32/no-outputs -26767 0/imm32/no-outputs -26768 0x11/imm32/alloc-id:fake -26769 _string_81_subop_and/imm32/subx-name -26770 1/imm32/rm32-is-first-inout -26771 0/imm32/no-r32 -26772 2/imm32/imm32-is-second-inout -26773 0/imm32/no-imm8 -26774 0/imm32/no-disp32 -26775 0/imm32/no-xm32 -26776 0/imm32/no-x32 -26777 0x11/imm32/alloc-id:fake -26778 _Primitive-or-with-eax/imm32/next -26779 # - or -26780 _Primitive-or-with-eax: # (payload primitive) -26781 0x11/imm32/alloc-id:fake:payload -26782 # var/eax <- or lit => 0d/or-with-eax lit/imm32 -26783 0x11/imm32/alloc-id:fake -26784 _string-or/imm32/name -26785 0x11/imm32/alloc-id:fake -26786 Single-lit-var/imm32/inouts -26787 0x11/imm32/alloc-id:fake -26788 Single-int-var-in-eax/imm32/outputs +25743 8b/-> *(ebp+8) 0/r32/eax +25744 (lookup *eax *(eax+4)) # Var-name Var-name => eax +25745 (write-buffered *(ebp+0xc) %eax) +25746 58/pop-to-eax +25747 (write-buffered *(ebp+0xc) "' has non-array type\n") +25748 (flush *(ebp+0xc)) +25749 (stop *(ebp+0x10) 1) +25750 # never gets here +25751 +25752 size-of-type-id-as-array-element: # t: type-id -> result/eax: int +25753 # . prologue +25754 55/push-ebp +25755 89/<- %ebp 4/r32/esp +25756 # eax = t +25757 8b/-> *(ebp+8) 0/r32/eax +25758 # if t is 'byte', size is 1 +25759 3d/compare-eax-and 8/imm32/byte +25760 { +25761 75/jump-if-!= break/disp8 +25762 b8/copy-to-eax 1/imm32 +25763 eb/jump $size-of-type-id-as-array-element:end/disp8 +25764 } +25765 # otherwise proceed as usual +25766 (size-of-type-id %eax) # => eax +25767 $size-of-type-id-as-array-element:end: +25768 # . epilogue +25769 89/<- %esp 5/r32/ebp +25770 5d/pop-to-ebp +25771 c3/return +25772 +25773 emit-save-size-to: # out: (addr buffered-file), base: (addr var), outreg: (addr array byte) +25774 # . prologue +25775 55/push-ebp +25776 89/<- %ebp 4/r32/esp +25777 # . save registers +25778 50/push-eax +25779 53/push-ebx +25780 # ebx = base +25781 8b/-> *(ebp+0xc) 3/r32/ebx +25782 (emit-indent *(ebp+8) *Curr-block-depth) +25783 (write-buffered *(ebp+8) "8b/-> *") +25784 # if base is an (addr array ...) in a register +25785 { +25786 81 7/subop/compare *(ebx+0x18)) 0/imm32 # Var-register +25787 74/jump-if-= break/disp8 +25788 $emit-save-size-to:emit-base-from-register: +25789 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +25790 (write-buffered *(ebp+8) %eax) +25791 eb/jump $emit-save-size-to:emit-output/disp8 +25792 } +25793 # otherwise if base is an (array ...) on the stack +25794 { +25795 81 7/subop/compare *(ebx+0x14)) 0/imm32 # Var-offset +25796 74/jump-if-= break/disp8 +25797 $emit-save-size-to:emit-base-from-stack: +25798 (write-buffered *(ebp+8) "(ebp+") +25799 (write-int32-hex-buffered *(ebp+8) *(ebx+0x14)) # Var-offset +25800 (write-buffered *(ebp+8) ")") +25801 } +25802 $emit-save-size-to:emit-output: +25803 (write-buffered *(ebp+8) " ") +25804 (get Mu-registers *(ebp+0x10) 0xc "Mu-registers") # => eax +25805 (write-int32-hex-buffered *(ebp+8) *eax) +25806 (write-buffered *(ebp+8) "/r32\n") +25807 $emit-save-size-to:end: +25808 # . restore registers +25809 5b/pop-to-ebx +25810 58/pop-to-eax +25811 # . epilogue +25812 89/<- %esp 5/r32/ebp +25813 5d/pop-to-ebp +25814 c3/return +25815 +25816 emit-divide-by-shift-right: # out: (addr buffered-file), reg: (addr array byte), size: int +25817 # . prologue +25818 55/push-ebp +25819 89/<- %ebp 4/r32/esp +25820 # . save registers +25821 50/push-eax +25822 # +25823 (emit-indent *(ebp+8) *Curr-block-depth) +25824 (write-buffered *(ebp+8) "c1/shift 5/subop/>> %") +25825 (write-buffered *(ebp+8) *(ebp+0xc)) +25826 (write-buffered *(ebp+8) Space) +25827 (num-shift-rights *(ebp+0x10)) # => eax +25828 (write-int32-hex-buffered *(ebp+8) %eax) +25829 (write-buffered *(ebp+8) "/imm8\n") +25830 $emit-divide-by-shift-right:end: +25831 # . restore registers +25832 58/pop-to-eax +25833 # . epilogue +25834 89/<- %esp 5/r32/ebp +25835 5d/pop-to-ebp +25836 c3/return +25837 +25838 translate-mu-index-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +25839 # . prologue +25840 55/push-ebp +25841 89/<- %ebp 4/r32/esp +25842 # . save registers +25843 51/push-ecx +25844 # ecx = stmt +25845 8b/-> *(ebp+0xc) 1/r32/ecx +25846 # var base/ecx: (addr var) = stmt->inouts[0] +25847 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +25848 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +25849 89/<- %ecx 0/r32/eax +25850 # if (var->register) do one thing +25851 { +25852 81 7/subop/compare *(ecx+0x18) 0/imm32 # Var-register +25853 74/jump-if-= break/disp8 +25854 # TODO: ensure there's no dereference +25855 (translate-mu-index-stmt-with-array-in-register *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +25856 eb/jump $translate-mu-index-stmt:end/disp8 +25857 } +25858 # if (var->offset) do a different thing +25859 { +25860 81 7/subop/compare *(ecx+0x14) 0/imm32 # Var-offset +25861 74/jump-if-= break/disp8 +25862 # TODO: ensure there's no dereference +25863 (translate-mu-index-stmt-with-array-on-stack *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14)) +25864 eb/jump $translate-mu-index-stmt:end/disp8 +25865 } +25866 $translate-mu-index-stmt:end: +25867 # . restore registers +25868 59/pop-to-ecx +25869 # . epilogue +25870 89/<- %esp 5/r32/ebp +25871 5d/pop-to-ebp +25872 c3/return +25873 +25874 $translate-mu-index-stmt-with-array:error1: +25875 (write-buffered *(ebp+0x10) "couldn't translate an index instruction. second (index) input must either lie in a register or be a literal\n") +25876 (flush *(ebp+0x10)) +25877 (stop *(ebp+0x14) 1) +25878 # never gets here +25879 +25880 $translate-mu-index-stmt-with-array:error2: +25881 (write-buffered *(ebp+0x10) "couldn't translate an index instruction. second (index) input when in a register must be an int or offset\n") +25882 (flush *(ebp+0x10)) +25883 (stop *(ebp+0x14) 1) +25884 # never gets here +25885 +25886 translate-mu-index-stmt-with-array-in-register: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +25887 # . prologue +25888 55/push-ebp +25889 89/<- %ebp 4/r32/esp +25890 # . save registers +25891 50/push-eax +25892 51/push-ecx +25893 52/push-edx +25894 53/push-ebx +25895 # +25896 (emit-indent *(ebp+8) *Curr-block-depth) +25897 (write-buffered *(ebp+8) "8d/copy-address *(") +25898 # TODO: ensure inouts[0] is in a register and not dereferenced +25899 $translate-mu-index-stmt-with-array-in-register:emit-base: +25900 # ecx = stmt +25901 8b/-> *(ebp+0xc) 1/r32/ecx +25902 # var base/ebx: (addr var) = inouts[0] +25903 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +25904 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +25905 89/<- %ebx 0/r32/eax +25906 # print base->register " + " +25907 (lookup *(ebx+0x18) *(ebx+0x1c)) # Var-register Var-register => eax +25908 (write-buffered *(ebp+8) %eax) +25909 (write-buffered *(ebp+8) " + ") +25910 # var index/edx: (addr var) = inouts[1] +25911 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +25912 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +25913 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +25914 89/<- %edx 0/r32/eax +25915 # if index->register +25916 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register +25917 { +25918 0f 84/jump-if-= break/disp32 +25919 $translate-mu-index-stmt-with-array-in-register:emit-register-index: +25920 # if index is an int +25921 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +25922 (is-simple-mu-type? %eax 1) # int => eax +25923 3d/compare-eax-and 0/imm32/false +25924 { +25925 0f 84/jump-if-= break/disp32 +25926 $translate-mu-index-stmt-with-array-in-register:emit-int-register-index: +25927 # print index->register "<<" log2(array-element-size(base)) " + 4) " +25928 # . index->register "<<" +25929 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +25930 (write-buffered *(ebp+8) %eax) +25931 (write-buffered *(ebp+8) "<<") +25932 # . log2(array-element-size(base->type)) +25933 # TODO: ensure size is a power of 2 +25934 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax +25935 (num-shift-rights %eax) # => eax +25936 (write-int32-hex-buffered *(ebp+8) %eax) +25937 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-register-index-done/disp32 +25938 } +25939 # if index->type is any other atom, abort +25940 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +25941 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +25942 0f 85/jump-if-!= $translate-mu-index-stmt-with-array:error2/disp32 +25943 # if index has type (offset ...) +25944 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +25945 (is-simple-mu-type? %eax 7) # => eax +25946 3d/compare-eax-and 0/imm32/false +25947 { +25948 0f 84/jump-if-= break/disp32 +25949 # print index->register +25950 $translate-mu-index-stmt-with-array-in-register:emit-offset-register-index: +25951 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +25952 (write-buffered *(ebp+8) %eax) +25953 } +25954 $translate-mu-index-stmt-with-array-in-register:emit-register-index-done: +25955 (write-buffered *(ebp+8) " + 4) ") +25956 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 +25957 } +25958 # otherwise if index is a literal +25959 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +25960 (is-simple-mu-type? %eax 0) # => eax +25961 3d/compare-eax-and 0/imm32/false +25962 { +25963 0f 84/jump-if-= break/disp32 +25964 $translate-mu-index-stmt-with-array-in-register:emit-literal-index: +25965 # var index-value/edx: int = parse-hex-int(index->name) +25966 (lookup *edx *(edx+4)) # Var-name Var-name => eax +25967 (parse-hex-int %eax) # => eax +25968 89/<- %edx 0/r32/eax +25969 # offset = idx-value * array-element-size(base->type) +25970 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax +25971 f7 4/subop/multiply-into-edx-eax %edx # clobbers edx +25972 # offset += 4 for array size +25973 05/add-to-eax 4/imm32 +25974 # TODO: check edx for overflow +25975 # print offset +25976 (write-int32-hex-buffered *(ebp+8) %eax) +25977 (write-buffered *(ebp+8) ") ") +25978 e9/jump $translate-mu-index-stmt-with-array-in-register:emit-output/disp32 +25979 } +25980 # otherwise abort +25981 e9/jump $translate-mu-index-stmt-with-array:error1/disp32 +25982 $translate-mu-index-stmt-with-array-in-register:emit-output: +25983 # outputs[0] "/r32" +25984 8b/-> *(ebp+0xc) 1/r32/ecx +25985 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +25986 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +25987 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +25988 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) +25989 (write-int32-hex-buffered *(ebp+8) *eax) +25990 (write-buffered *(ebp+8) "/r32\n") +25991 $translate-mu-index-stmt-with-array-in-register:end: +25992 # . restore registers +25993 5b/pop-to-ebx +25994 5a/pop-to-edx +25995 59/pop-to-ecx +25996 58/pop-to-eax +25997 # . epilogue +25998 89/<- %esp 5/r32/ebp +25999 5d/pop-to-ebp +26000 c3/return +26001 +26002 translate-mu-index-stmt-with-array-on-stack: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +26003 # . prologue +26004 55/push-ebp +26005 89/<- %ebp 4/r32/esp +26006 # . save registers +26007 50/push-eax +26008 51/push-ecx +26009 52/push-edx +26010 53/push-ebx +26011 # +26012 (emit-indent *(ebp+8) *Curr-block-depth) +26013 (write-buffered *(ebp+8) "8d/copy-address *(ebp + ") +26014 # var curr/edx: (addr stmt-var) = lookup(stmt->inouts) +26015 8b/-> *(ebp+0xc) 0/r32/eax +26016 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +26017 89/<- %edx 0/r32/eax +26018 # var base/ecx: (addr var) = lookup(curr->value) +26019 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +26020 89/<- %ecx 0/r32/eax +26021 # var curr2/eax: (addr stmt-var) = lookup(curr->next) +26022 (lookup *(edx+8) *(edx+0xc)) # Stmt-var-next Stmt-var-next => eax +26023 # var index/edx: (handle var) = curr2->value +26024 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +26025 89/<- %edx 0/r32/eax +26026 # if index->register +26027 81 7/subop/compare *(edx+0x18) 0/imm32 # Var-register +26028 { +26029 0f 84/jump-if-= break/disp32 +26030 $translate-mu-index-stmt-with-array-on-stack:emit-register-index: +26031 # if index is an int +26032 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +26033 (is-simple-mu-type? %eax 1) # int => eax +26034 3d/compare-eax-and 0/imm32/false +26035 { +26036 0f 84/jump-if-= break/disp32 +26037 $translate-mu-index-stmt-with-array-on-stack:emit-int-register-index: +26038 # print index->register "<<" log2(array-element-size(base)) " + " base->offset+4 +26039 # . inouts[1]->register "<<" +26040 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +26041 (write-buffered *(ebp+8) %eax) +26042 (write-buffered *(ebp+8) "<<") +26043 # . log2(array-element-size(base)) +26044 # TODO: ensure size is a power of 2 +26045 (array-element-size %ecx *(ebp+0x10) *(ebp+0x14)) # => eax +26046 (num-shift-rights %eax) # => eax +26047 (write-int32-hex-buffered *(ebp+8) %eax) +26048 # +26049 (write-buffered *(ebp+8) " + ") +26050 # +26051 8b/-> *(ecx+0x14) 0/r32/eax # Var-offset +26052 05/add-to-eax 4/imm32 # for array length +26053 (write-int32-hex-buffered *(ebp+8) %eax) +26054 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done/disp32 +26055 } +26056 # if index->type is any other atom, abort +26057 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +26058 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +26059 0f 85/jump-if-!= $translate-mu-index-stmt-with-array:error2/disp32 +26060 # if index has type (offset ...) +26061 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +26062 (is-simple-mu-type? %eax 7) # => eax +26063 3d/compare-eax-and 0/imm32/false +26064 { +26065 0f 84/jump-if-= break/disp32 +26066 # print index->register +26067 $translate-mu-index-stmt-with-array-on-stack:emit-offset-register-index: +26068 (lookup *(edx+0x18) *(edx+0x1c)) # Var-register Var-register => eax +26069 (write-buffered *(ebp+8) %eax) +26070 } +26071 $translate-mu-index-stmt-with-array-on-stack:emit-register-index-done: +26072 (write-buffered *(ebp+8) ") ") +26073 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 +26074 } +26075 # otherwise if index is a literal +26076 (lookup *(edx+8) *(edx+0xc)) # Var-type Var-type => eax +26077 (is-simple-mu-type? %eax 0) # => eax +26078 3d/compare-eax-and 0/imm32/false +26079 { +26080 0f 84/jump-if-= break/disp32 +26081 $translate-mu-index-stmt-with-array-on-stack:emit-literal-index: +26082 # var idx-value/edx: int = parse-hex-int(index->name) +26083 (lookup *edx *(edx+4)) # Var-name Var-name => eax +26084 (parse-hex-int %eax) # Var-name => eax +26085 89/<- %edx 0/r32/eax +26086 # offset = idx-value * array-element-size(base) +26087 (array-element-size %ecx *(ebp+0x10) *(ebp+0x14)) # => eax +26088 f7 4/subop/multiply-into-edx-eax %edx # clobbers edx +26089 # offset += base->offset +26090 03/add *(ecx+0x14) 0/r32/eax # Var-offset +26091 # offset += 4 for array size +26092 05/add-to-eax 4/imm32 +26093 # TODO: check edx for overflow +26094 # print offset +26095 (write-int32-hex-buffered *(ebp+8) %eax) +26096 (write-buffered *(ebp+8) ") ") +26097 e9/jump $translate-mu-index-stmt-with-array-on-stack:emit-output/disp32 +26098 } +26099 # otherwise abort +26100 e9/jump $translate-mu-index-stmt-with-array:error1/disp32 +26101 $translate-mu-index-stmt-with-array-on-stack:emit-output: +26102 # outputs[0] "/r32" +26103 8b/-> *(ebp+0xc) 0/r32/eax +26104 (lookup *(eax+0x14) *(eax+0x18)) # Stmt1-outputs Stmt1-outputs => eax +26105 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +26106 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +26107 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) +26108 (write-int32-hex-buffered *(ebp+8) *eax) +26109 (write-buffered *(ebp+8) "/r32\n") +26110 $translate-mu-index-stmt-with-array-on-stack:end: +26111 # . restore registers +26112 5b/pop-to-ebx +26113 5a/pop-to-edx +26114 59/pop-to-ecx +26115 58/pop-to-eax +26116 # . epilogue +26117 89/<- %esp 5/r32/ebp +26118 5d/pop-to-ebp +26119 c3/return +26120 +26121 translate-mu-compute-index-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +26122 # . prologue +26123 55/push-ebp +26124 89/<- %ebp 4/r32/esp +26125 # . save registers +26126 50/push-eax +26127 51/push-ecx +26128 52/push-edx +26129 53/push-ebx +26130 # +26131 (emit-indent *(ebp+8) *Curr-block-depth) +26132 (write-buffered *(ebp+8) "69/multiply") +26133 # ecx = stmt +26134 8b/-> *(ebp+0xc) 1/r32/ecx +26135 # var first-inout/ebx: (addr stmt-var) = stmt->inouts[0] +26136 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +26137 89/<- %ebx 0/r32/eax +26138 $translate-mu-compute-index-stmt:emit-index: +26139 (lookup *(ebx+8) *(ebx+0xc)) # Stmt-var-next Stmt-var-next => eax +26140 (emit-subx-var-as-rm32 *(ebp+8) %eax) +26141 (write-buffered *(ebp+8) Space) +26142 $translate-mu-compute-index-stmt:emit-elem-size: +26143 # var base/ebx: (addr var) +26144 (lookup *ebx *(ebx+4)) # Stmt-var-value Stmt-var-value => eax +26145 89/<- %ebx 0/r32/eax +26146 # print array-element-size(base) +26147 (array-element-size %ebx *(ebp+0x10) *(ebp+0x14)) # => eax +26148 (write-int32-hex-buffered *(ebp+8) %eax) +26149 (write-buffered *(ebp+8) "/imm32 ") +26150 $translate-mu-compute-index-stmt:emit-output: +26151 # outputs[0] "/r32" +26152 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +26153 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +26154 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +26155 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) +26156 (write-int32-hex-buffered *(ebp+8) *eax) +26157 (write-buffered *(ebp+8) "/r32\n") +26158 $translate-mu-compute-index-stmt:end: +26159 # . restore registers +26160 5b/pop-to-ebx +26161 5a/pop-to-edx +26162 59/pop-to-ecx +26163 58/pop-to-eax +26164 # . epilogue +26165 89/<- %esp 5/r32/ebp +26166 5d/pop-to-ebp +26167 c3/return +26168 +26169 translate-mu-get-stmt: # out: (addr buffered-file), stmt: (addr stmt) +26170 # . prologue +26171 55/push-ebp +26172 89/<- %ebp 4/r32/esp +26173 # . save registers +26174 50/push-eax +26175 51/push-ecx +26176 52/push-edx +26177 # +26178 (emit-indent *(ebp+8) *Curr-block-depth) +26179 (write-buffered *(ebp+8) "8d/copy-address ") +26180 # ecx = stmt +26181 8b/-> *(ebp+0xc) 1/r32/ecx +26182 # var offset/edx: int = get offset of stmt +26183 (mu-get-offset %ecx) # => eax +26184 89/<- %edx 0/r32/eax +26185 # var base/eax: (addr var) = stmt->inouts->value +26186 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +26187 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +26188 # if base is in a register +26189 81 7/subop/compare *(eax+0x18) 0/imm32 # Var-register +26190 { +26191 0f 84/jump-if-= break/disp32 +26192 $translate-mu-get-stmt:emit-register-input: +26193 # emit "*(" base->register " + " offset ") " +26194 (write-buffered *(ebp+8) "*(") +26195 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +26196 (write-buffered *(ebp+8) %eax) +26197 (write-buffered *(ebp+8) " + ") +26198 (write-int32-hex-buffered *(ebp+8) %edx) +26199 (write-buffered *(ebp+8) ") ") +26200 e9/jump $translate-mu-get-stmt:emit-output/disp32 +26201 } +26202 # otherwise base is on the stack +26203 { +26204 $translate-mu-get-stmt:emit-stack-input: +26205 # emit "*(ebp + " inouts[0]->stack-offset + offset ") " +26206 (write-buffered *(ebp+8) "*(ebp+") +26207 03/add *(eax+0x14) 2/r32/edx # Var-offset +26208 (write-int32-hex-buffered *(ebp+8) %edx) +26209 (write-buffered *(ebp+8) ") ") +26210 eb/jump $translate-mu-get-stmt:emit-output/disp8 +26211 } +26212 $translate-mu-get-stmt:emit-output: +26213 # var output/eax: (addr var) = stmt->outputs->value +26214 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +26215 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +26216 # emit offset->register "/r32" +26217 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +26218 (get Mu-registers %eax 0xc "Mu-registers") # => eax: (addr int) +26219 (write-int32-hex-buffered *(ebp+8) *eax) +26220 (write-buffered *(ebp+8) "/r32\n") +26221 $translate-mu-get-stmt:end: +26222 # . restore registers +26223 5a/pop-to-edx +26224 59/pop-to-ecx +26225 58/pop-to-eax +26226 # . epilogue +26227 89/<- %esp 5/r32/ebp +26228 5d/pop-to-ebp +26229 c3/return +26230 +26231 translate-mu-copy-object-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +26232 # . prologue +26233 55/push-ebp +26234 89/<- %ebp 4/r32/esp +26235 # . save registers +26236 50/push-eax +26237 # +26238 (emit-indent *(ebp+8) *Curr-block-depth) +26239 (write-buffered *(ebp+8) "(copy-bytes") +26240 # eax = stmt +26241 8b/-> *(ebp+0xc) 0/r32/eax +26242 # var first-inout/eax: (addr stmt-var) = stmt->inouts[0] +26243 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +26244 (emit-subx-call-operand *(ebp+8) %eax) +26245 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +26246 (emit-subx-call-operand *(ebp+8) %eax) +26247 (write-buffered *(ebp+8) Space) +26248 (addr-payload-size %eax *(ebp+0x10) *(ebp+0x14)) # => eax +26249 (write-int32-hex-buffered *(ebp+8) %eax) +26250 (write-buffered *(ebp+8) ")\n") +26251 $translate-mu-copy-object-stmt:end: +26252 # . restore registers +26253 58/pop-to-eax +26254 # . epilogue +26255 89/<- %esp 5/r32/ebp +26256 5d/pop-to-ebp +26257 c3/return +26258 +26259 translate-mu-allocate-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +26260 # . prologue +26261 55/push-ebp +26262 89/<- %ebp 4/r32/esp +26263 # . save registers +26264 50/push-eax +26265 56/push-esi +26266 57/push-edi +26267 # esi = stmt +26268 8b/-> *(ebp+0xc) 6/r32/esi +26269 # var target/edi: (addr stmt-var) = stmt->inouts[0] +26270 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +26271 89/<- %edi 0/r32/eax +26272 # +26273 (emit-indent *(ebp+8) *Curr-block-depth) +26274 (write-buffered *(ebp+8) "(allocate Heap ") +26275 (addr-handle-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax +26276 (write-int32-hex-buffered *(ebp+8) %eax) +26277 (emit-subx-call-operand *(ebp+8) %edi) +26278 (write-buffered *(ebp+8) ")\n") +26279 $translate-mu-allocate-stmt:end: +26280 # . restore registers +26281 5f/pop-to-edi +26282 5e/pop-to-esi +26283 58/pop-to-eax +26284 # . epilogue +26285 89/<- %esp 5/r32/ebp +26286 5d/pop-to-ebp +26287 c3/return +26288 +26289 addr-handle-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int +26290 # . prologue +26291 55/push-ebp +26292 89/<- %ebp 4/r32/esp +26293 # var t/eax: (addr type-tree) = s->value->type +26294 8b/-> *(ebp+8) 0/r32/eax +26295 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +26296 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +26297 # TODO: check eax != 0 +26298 # TODO: check !t->is-atom? +26299 # TODO: check t->left == addr +26300 # t = t->right +26301 $addr-handle-payload-size:skip-addr: +26302 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +26303 # TODO: check eax != 0 +26304 # TODO: check !t->is-atom? +26305 # TODO: check t->left == handle +26306 # t = t->right +26307 $addr-handle-payload-size:skip-handle: +26308 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +26309 # TODO: check eax != 0 +26310 # if !t->is-atom? t = t->left +26311 81 7/subop/compare *eax 0/imm32/false +26312 { +26313 75/jump-if-!= break/disp8 +26314 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +26315 } +26316 # TODO: check t->is-atom? +26317 # return size(t->value) +26318 (size-of-type-id *(eax+4)) # Type-tree-value => eax +26319 $addr-handle-payload-size:end: +26320 # . epilogue +26321 89/<- %esp 5/r32/ebp +26322 5d/pop-to-ebp +26323 c3/return +26324 +26325 addr-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int +26326 # . prologue +26327 55/push-ebp +26328 89/<- %ebp 4/r32/esp +26329 # var t/eax: (addr type-tree) = s->value->type +26330 8b/-> *(ebp+8) 0/r32/eax +26331 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +26332 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +26333 # TODO: check eax != 0 +26334 # TODO: check !t->is-atom? +26335 # TODO: check t->left == addr +26336 # t = t->right +26337 $addr-payload-size:skip-addr: +26338 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +26339 # TODO: check eax != 0 +26340 # if !t->is-atom? t = t->left +26341 81 7/subop/compare *eax 0/imm32/false +26342 { +26343 75/jump-if-!= break/disp8 +26344 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +26345 } +26346 # TODO: check t->is-atom? +26347 # return size(t->value) +26348 (size-of-type-id *(eax+4)) # Type-tree-value => eax +26349 $addr-payload-size:end: +26350 # . epilogue +26351 89/<- %esp 5/r32/ebp +26352 5d/pop-to-ebp +26353 c3/return +26354 +26355 translate-mu-populate-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +26356 # . prologue +26357 55/push-ebp +26358 89/<- %ebp 4/r32/esp +26359 # . save registers +26360 50/push-eax +26361 51/push-ecx +26362 56/push-esi +26363 57/push-edi +26364 # esi = stmt +26365 8b/-> *(ebp+0xc) 6/r32/esi +26366 # var target/edi: (addr stmt-var) = stmt->inouts[0] +26367 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +26368 89/<- %edi 0/r32/eax +26369 # var len/ecx: (addr stmt-var) = stmt->inouts[1] +26370 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +26371 89/<- %ecx 0/r32/eax +26372 # +26373 (emit-indent *(ebp+8) *Curr-block-depth) +26374 (write-buffered *(ebp+8) "(allocate-array2 Heap ") +26375 (addr-handle-array-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax +26376 (write-int32-hex-buffered *(ebp+8) %eax) +26377 (emit-subx-call-operand *(ebp+8) %ecx) +26378 (emit-subx-call-operand *(ebp+8) %edi) +26379 (write-buffered *(ebp+8) ")\n") +26380 $translate-mu-populate-stmt:end: +26381 # . restore registers +26382 5f/pop-to-edi +26383 5e/pop-to-esi +26384 59/pop-to-ecx +26385 58/pop-to-eax +26386 # . epilogue +26387 89/<- %esp 5/r32/ebp +26388 5d/pop-to-ebp +26389 c3/return +26390 +26391 translate-mu-populate-stream-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +26392 # . prologue +26393 55/push-ebp +26394 89/<- %ebp 4/r32/esp +26395 # . save registers +26396 50/push-eax +26397 51/push-ecx +26398 56/push-esi +26399 57/push-edi +26400 # esi = stmt +26401 8b/-> *(ebp+0xc) 6/r32/esi +26402 # var target/edi: (addr stmt-var) = stmt->inouts[0] +26403 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +26404 89/<- %edi 0/r32/eax +26405 # var len/ecx: (addr stmt-var) = stmt->inouts[1] +26406 (lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax +26407 89/<- %ecx 0/r32/eax +26408 # +26409 (emit-indent *(ebp+8) *Curr-block-depth) +26410 (write-buffered *(ebp+8) "(new-stream Heap ") +26411 (addr-handle-stream-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax +26412 (write-int32-hex-buffered *(ebp+8) %eax) +26413 (emit-subx-call-operand *(ebp+8) %ecx) +26414 (emit-subx-call-operand *(ebp+8) %edi) +26415 (write-buffered *(ebp+8) ")\n") +26416 $translate-mu-populate-stream-stmt:end: +26417 # . restore registers +26418 5f/pop-to-edi +26419 5e/pop-to-esi +26420 59/pop-to-ecx +26421 58/pop-to-eax +26422 # . epilogue +26423 89/<- %esp 5/r32/ebp +26424 5d/pop-to-ebp +26425 c3/return +26426 +26427 translate-mu-read-from-stream-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +26428 # . prologue +26429 55/push-ebp +26430 89/<- %ebp 4/r32/esp +26431 # . save registers +26432 50/push-eax +26433 51/push-ecx +26434 56/push-esi +26435 57/push-edi +26436 # esi = stmt +26437 8b/-> *(ebp+0xc) 6/r32/esi +26438 # var stream/ecx: (addr stmt-var) = stmt->inouts[0] +26439 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +26440 89/<- %ecx 0/r32/eax +26441 # var target/edi: (addr stmt-var) = stmt->inouts[1] +26442 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax +26443 89/<- %edi 0/r32/eax +26444 # +26445 (emit-indent *(ebp+8) *Curr-block-depth) +26446 (write-buffered *(ebp+8) "(read-from-stream") +26447 (emit-subx-call-operand *(ebp+8) %ecx) +26448 (emit-subx-call-operand *(ebp+8) %edi) +26449 (write-buffered *(ebp+8) Space) +26450 (addr-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax +26451 (write-int32-hex-buffered *(ebp+8) %eax) +26452 (write-buffered *(ebp+8) ")\n") +26453 $translate-mu-read-from-stream-stmt:end: +26454 # . restore registers +26455 5f/pop-to-edi +26456 5e/pop-to-esi +26457 59/pop-to-ecx +26458 58/pop-to-eax +26459 # . epilogue +26460 89/<- %esp 5/r32/ebp +26461 5d/pop-to-ebp +26462 c3/return +26463 +26464 translate-mu-write-to-stream-stmt: # out: (addr buffered-file), stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +26465 # . prologue +26466 55/push-ebp +26467 89/<- %ebp 4/r32/esp +26468 # . save registers +26469 50/push-eax +26470 51/push-ecx +26471 56/push-esi +26472 57/push-edi +26473 # esi = stmt +26474 8b/-> *(ebp+0xc) 6/r32/esi +26475 # var stream/ecx: (addr stmt-var) = stmt->inouts[0] +26476 (lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax +26477 89/<- %ecx 0/r32/eax +26478 # var target/edi: (addr stmt-var) = stmt->inouts[1] +26479 (lookup *(ecx+8) *(ecx+0xc)) # Stmt-var-next Stmt-var-next => eax +26480 89/<- %edi 0/r32/eax +26481 # +26482 (emit-indent *(ebp+8) *Curr-block-depth) +26483 (write-buffered *(ebp+8) "(write-to-stream") +26484 (emit-subx-call-operand *(ebp+8) %ecx) +26485 (flush *(ebp+8)) +26486 (emit-subx-call-operand *(ebp+8) %edi) +26487 (flush *(ebp+8)) +26488 (write-buffered *(ebp+8) Space) +26489 (flush *(ebp+8)) +26490 (addr-payload-size %edi *(ebp+0x10) *(ebp+0x14)) # => eax +26491 (write-int32-hex-buffered *(ebp+8) %eax) +26492 (write-buffered *(ebp+8) ")\n") +26493 $translate-mu-write-to-stream-stmt:end: +26494 # . restore registers +26495 5f/pop-to-edi +26496 5e/pop-to-esi +26497 59/pop-to-ecx +26498 58/pop-to-eax +26499 # . epilogue +26500 89/<- %esp 5/r32/ebp +26501 5d/pop-to-ebp +26502 c3/return +26503 +26504 addr-handle-array-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int +26505 # . prologue +26506 55/push-ebp +26507 89/<- %ebp 4/r32/esp +26508 # var t/eax: (addr type-tree) = s->value->type +26509 8b/-> *(ebp+8) 0/r32/eax +26510 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +26511 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +26512 # TODO: check eax != 0 +26513 # TODO: check !t->is-atom? +26514 # TODO: check t->left == addr +26515 # t = t->right +26516 $addr-handle-array-payload-size:skip-addr: +26517 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +26518 # TODO: check eax != 0 +26519 # TODO: check !t->is-atom? +26520 # TODO: check t->left == handle +26521 # t = t->right +26522 $addr-handle-array-payload-size:skip-handle: +26523 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +26524 # TODO: check eax != 0 +26525 # TODO: check !t->is-atom? +26526 # TODO: check t->left == array +26527 # t = t->right +26528 $addr-handle-array-payload-size:skip-array: +26529 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +26530 # TODO: check eax != 0 +26531 # if !t->is-atom? t = t->left +26532 81 7/subop/compare *eax 0/imm32/false +26533 { +26534 75/jump-if-!= break/disp8 +26535 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +26536 } +26537 $addr-handle-array-payload-size:compute-size: +26538 # TODO: check t->is-atom? +26539 # return size(t->value) +26540 (size-of-type-id-as-array-element *(eax+4)) # Type-tree-value => eax +26541 $addr-handle-array-payload-size:end: +26542 # . epilogue +26543 89/<- %esp 5/r32/ebp +26544 5d/pop-to-ebp +26545 c3/return +26546 +26547 addr-handle-stream-payload-size: # s: (addr stmt-var), err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: int +26548 # . prologue +26549 55/push-ebp +26550 89/<- %ebp 4/r32/esp +26551 # var t/eax: (addr type-tree) = s->value->type +26552 8b/-> *(ebp+8) 0/r32/eax +26553 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +26554 (lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax +26555 # TODO: check eax != 0 +26556 # TODO: check !t->is-atom? +26557 # TODO: check t->left == addr +26558 # t = t->right +26559 $addr-handle-stream-payload-size:skip-addr: +26560 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +26561 # TODO: check eax != 0 +26562 # TODO: check !t->is-atom? +26563 # TODO: check t->left == handle +26564 # t = t->right +26565 $addr-handle-stream-payload-size:skip-handle: +26566 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +26567 # TODO: check eax != 0 +26568 # TODO: check !t->is-atom? +26569 # TODO: check t->left == stream +26570 # t = t->right +26571 $addr-handle-stream-payload-size:skip-stream: +26572 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +26573 # TODO: check eax != 0 +26574 # if !t->is-atom? t = t->left +26575 81 7/subop/compare *eax 0/imm32/false +26576 { +26577 75/jump-if-!= break/disp8 +26578 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +26579 } +26580 $addr-handle-stream-payload-size:compute-size: +26581 # TODO: check t->is-atom? +26582 # return size(t->value) +26583 (size-of-type-id-as-array-element *(eax+4)) # Type-tree-value => eax +26584 $addr-handle-stream-payload-size:end: +26585 # . epilogue +26586 89/<- %esp 5/r32/ebp +26587 5d/pop-to-ebp +26588 c3/return +26589 +26590 power-of-2?: # n: int, err: (addr buffered-file), ed: (addr exit-descriptor) -> result/eax: boolean +26591 # precondition: n is positive +26592 # . prologue +26593 55/push-ebp +26594 89/<- %ebp 4/r32/esp +26595 # eax = n +26596 8b/-> *(ebp+8) 0/r32/eax +26597 # if (n < 0) abort +26598 3d/compare-eax-with 0/imm32 +26599 0f 8c/jump-if-< $power-of-2?:abort/disp32 +26600 # var tmp/eax: int = n-1 +26601 48/decrement-eax +26602 # var tmp2/eax: int = n & tmp +26603 23/and-> *(ebp+8) 0/r32/eax +26604 # return (tmp2 == 0) +26605 3d/compare-eax-and 0/imm32 +26606 0f 94/set-byte-if-= %al +26607 81 4/subop/and %eax 0xff/imm32 +26608 $power-of-2?:end: +26609 # . epilogue +26610 89/<- %esp 5/r32/ebp +26611 5d/pop-to-ebp +26612 c3/return +26613 +26614 $power-of-2?:abort: +26615 (write-buffered *(ebp+0xc) "power-of-2?: negative number\n") +26616 (flush *(ebp+0xc)) +26617 (stop *(ebp+0x10) 1) +26618 # never gets here +26619 +26620 num-shift-rights: # n: int -> result/eax: int +26621 # precondition: n is a positive power of 2 +26622 # . prologue +26623 55/push-ebp +26624 89/<- %ebp 4/r32/esp +26625 # . save registers +26626 51/push-ecx +26627 # var curr/ecx: int = n +26628 8b/-> *(ebp+8) 1/r32/ecx +26629 # result = 0 +26630 b8/copy-to-eax 0/imm32 +26631 { +26632 # if (curr <= 1) break +26633 81 7/subop/compare %ecx 1/imm32 +26634 7e/jump-if-<= break/disp8 +26635 40/increment-eax +26636 c1/shift 5/subop/arithmetic-right %ecx 1/imm8 +26637 eb/jump loop/disp8 +26638 } +26639 $num-shift-rights:end: +26640 # . restore registers +26641 59/pop-to-ecx +26642 # . epilogue +26643 89/<- %esp 5/r32/ebp +26644 5d/pop-to-ebp +26645 c3/return +26646 +26647 mu-get-offset: # stmt: (addr stmt) -> result/eax: int +26648 # . prologue +26649 55/push-ebp +26650 89/<- %ebp 4/r32/esp +26651 # var second-inout/eax: (addr stmt-var) = stmt->inouts->next +26652 8b/-> *(ebp+8) 0/r32/eax +26653 (lookup *(eax+0xc) *(eax+0x10)) # Stmt1-inouts Stmt1-inouts => eax +26654 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +26655 # var output-var/eax: (addr var) = second-inout->value +26656 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +26657 #? (write-buffered Stderr "mu-get-offset: ") +26658 #? (write-int32-hex-buffered Stderr %eax) +26659 #? (write-buffered Stderr " name: ") +26660 #? 50/push-eax +26661 #? (lookup *eax *(eax+4)) # Var-name +26662 #? (write-buffered Stderr %eax) +26663 #? 58/pop-to-eax +26664 #? (write-buffered Stderr Newline) +26665 #? (flush Stderr) +26666 # return output-var->stack-offset +26667 8b/-> *(eax+0x14) 0/r32/eax # Var-offset +26668 #? (write-buffered Stderr "=> ") +26669 #? (write-int32-hex-buffered Stderr %eax) +26670 #? (write-buffered Stderr Newline) +26671 #? (flush Stderr) +26672 $emit-get-offset:end: +26673 # . epilogue +26674 89/<- %esp 5/r32/ebp +26675 5d/pop-to-ebp +26676 c3/return +26677 +26678 emit-subx-block: # out: (addr buffered-file), block: (addr block), vars: (addr stack live-var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) +26679 # . prologue +26680 55/push-ebp +26681 89/<- %ebp 4/r32/esp +26682 # . save registers +26683 50/push-eax +26684 51/push-ecx +26685 56/push-esi +26686 # esi = block +26687 8b/-> *(ebp+0xc) 6/r32/esi +26688 # block->var->block-depth = *Curr-block-depth +26689 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax +26690 8b/-> *Curr-block-depth 1/r32/ecx +26691 89/<- *(eax+0x10) 1/r32/ecx # Var-block-depth +26692 # var stmts/eax: (addr list stmt) = lookup(block->statements) +26693 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax +26694 # +26695 { +26696 $emit-subx-block:check-empty: +26697 3d/compare-eax-and 0/imm32 +26698 0f 84/jump-if-= break/disp32 +26699 (emit-indent *(ebp+8) *Curr-block-depth) +26700 (write-buffered *(ebp+8) "{\n") +26701 # var v/ecx: (addr var) = lookup(block->var) +26702 (lookup *(esi+0xc) *(esi+0x10)) # Block-var Block-var => eax +26703 89/<- %ecx 0/r32/eax +26704 # +26705 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +26706 (write-buffered *(ebp+8) %eax) +26707 (write-buffered *(ebp+8) ":loop:\n") +26708 ff 0/subop/increment *Curr-block-depth +26709 (push *(ebp+0x10) *(esi+0xc)) # Block-var +26710 (push *(ebp+0x10) *(esi+0x10)) # Block-var +26711 (push *(ebp+0x10) 0) # false +26712 # emit block->statements +26713 (lookup *(esi+4) *(esi+8)) # Block-stmts Block-stmts => eax +26714 (emit-subx-stmt-list *(ebp+8) %eax *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) +26715 (pop *(ebp+0x10)) # => eax +26716 (pop *(ebp+0x10)) # => eax +26717 (pop *(ebp+0x10)) # => eax +26718 ff 1/subop/decrement *Curr-block-depth +26719 (emit-indent *(ebp+8) *Curr-block-depth) +26720 (write-buffered *(ebp+8) "}\n") +26721 (lookup *ecx *(ecx+4)) # Var-name Var-name => eax +26722 (write-buffered *(ebp+8) %eax) +26723 (write-buffered *(ebp+8) ":break:\n") +26724 } +26725 $emit-subx-block:end: +26726 # . restore registers +26727 5e/pop-to-esi +26728 59/pop-to-ecx +26729 58/pop-to-eax +26730 # . epilogue +26731 89/<- %esp 5/r32/ebp +26732 5d/pop-to-ebp +26733 c3/return +26734 +26735 # Primitives supported +26736 # See mu_instructions for a summary of this linked-list data structure. +26737 # +26738 # For each operation, put variants with hard-coded registers before flexible ones. +26739 # +26740 # Unfortunately, our restrictions on addresses require that various fields in +26741 # primitives be handles, which complicates these definitions. +26742 # - we need to insert dummy fields all over the place for fake alloc-ids +26743 # - we can't use our syntax sugar of quoted literals for string fields +26744 # +26745 # Fake alloc-ids are needed because our type definitions up top require +26746 # handles but it's clearer to statically allocate these long-lived objects. +26747 # Fake alloc-ids are perfectly safe, but they can't be reclaimed. +26748 # +26749 # Every 'object' below starts with a fake alloc-id. It may also contain other +26750 # fake alloc-ids for various handle fields. +26751 # +26752 # I think of objects starting with a fake alloc-id as having type 'payload'. +26753 # It's not really intended to be created dynamically; for that use `allocate` +26754 # as usual. +26755 # +26756 # Idea for a notation to simplify such definitions: +26757 # _Primitive-increment-eax: # (payload primitive) +26758 # 0x11/alloc-id:fake:payload +26759 # 0x11 @(0x11 "increment") # name +26760 # 0 0 # inouts +26761 # 0x11 @(0x11/payload +26762 # 0x11 @(0x11/payload # List-value +26763 # 0 0 # Var-name +26764 # 0x11 @(0x11 # Var-type +26765 # 1/is-atom +26766 # 1/value 0/unused # Type-tree-left +26767 # 0 0 # Type-tree-right +26768 # ) +26769 # 1 # block-depth +26770 # 0 # stack-offset +26771 # 0x11 @(0x11 "eax") # Var-register +26772 # ) +26773 # 0 0) # List-next +26774 # ... +26775 # _Primitive-increment-ecx/imm32/next +26776 # ... +26777 # Awfully complex and non-obvious. But also clearly signals there's something +26778 # to learn here, so may be worth trying. +26779 # +26780 # '@' is just an initial thought. Punctuation used so far in Mu: () * % # / " +26781 # +26782 # For now we'll continue to just use comments and manually ensure they stay up +26783 # to date. +26784 == data +26785 Primitives: # (addr primitive) +26786 # - increment/decrement +26787 _Primitive-increment-eax: # (addr primitive) +26788 # var/eax <- increment => 40/increment-eax 26789 0x11/imm32/alloc-id:fake -26790 _string_0d_or_with_eax/imm32/subx-name -26791 0/imm32/no-rm32 -26792 0/imm32/no-r32 -26793 1/imm32/imm32-is-first-inout -26794 0/imm32/no-imm8 -26795 0/imm32/no-disp32 -26796 0/imm32/no-xm32 -26797 0/imm32/no-x32 -26798 0x11/imm32/alloc-id:fake -26799 _Primitive-or-reg-with-reg/imm32/next -26800 _Primitive-or-reg-with-reg: # (payload primitive) -26801 0x11/imm32/alloc-id:fake:payload -26802 # var1/reg <- or var2/reg => 09/or-with var1/rm32 var2/r32 -26803 0x11/imm32/alloc-id:fake -26804 _string-or/imm32/name -26805 0x11/imm32/alloc-id:fake -26806 Single-int-var-in-some-register/imm32/inouts -26807 0x11/imm32/alloc-id:fake -26808 Single-int-var-in-some-register/imm32/outputs +26790 _string-increment/imm32/name +26791 0/imm32/no-inouts +26792 0/imm32/no-inouts +26793 0x11/imm32/alloc-id:fake +26794 Single-int-var-in-eax/imm32/outputs +26795 0x11/imm32/alloc-id:fake +26796 _string_40_increment_eax/imm32/subx-name +26797 0/imm32/no-rm32 +26798 0/imm32/no-r32 +26799 0/imm32/no-imm32 +26800 0/imm32/no-imm8 +26801 0/imm32/no-disp32 +26802 0/imm32/no-xm32 +26803 0/imm32/no-x32 +26804 0x11/imm32/alloc-id:fake +26805 _Primitive-increment-ecx/imm32/next +26806 _Primitive-increment-ecx: # (payload primitive) +26807 0x11/imm32/alloc-id:fake:payload +26808 # var/ecx <- increment => 41/increment-ecx 26809 0x11/imm32/alloc-id:fake -26810 _string_09_or_with/imm32/subx-name -26811 3/imm32/rm32-is-first-output -26812 1/imm32/r32-is-first-inout -26813 0/imm32/no-imm32 -26814 0/imm32/no-imm8 -26815 0/imm32/no-disp32 -26816 0/imm32/no-xm32 -26817 0/imm32/no-x32 -26818 0x11/imm32/alloc-id:fake -26819 _Primitive-or-reg-with-mem/imm32/next -26820 _Primitive-or-reg-with-mem: # (payload primitive) -26821 0x11/imm32/alloc-id:fake:payload -26822 # or-with var1 var2/reg => 09/or-with var1 var2/r32 -26823 0x11/imm32/alloc-id:fake -26824 _string-or-with/imm32/name -26825 0x11/imm32/alloc-id:fake -26826 Two-args-int-stack-int-reg/imm32/inouts -26827 0/imm32/no-outputs -26828 0/imm32/no-outputs +26810 _string-increment/imm32/name +26811 0/imm32/no-inouts +26812 0/imm32/no-inouts +26813 0x11/imm32/alloc-id:fake +26814 Single-int-var-in-ecx/imm32/outputs +26815 0x11/imm32/alloc-id:fake +26816 _string_41_increment_ecx/imm32/subx-name +26817 0/imm32/no-rm32 +26818 0/imm32/no-r32 +26819 0/imm32/no-imm32 +26820 0/imm32/no-imm8 +26821 0/imm32/no-disp32 +26822 0/imm32/no-xm32 +26823 0/imm32/no-x32 +26824 0x11/imm32/alloc-id:fake +26825 _Primitive-increment-edx/imm32/next +26826 _Primitive-increment-edx: # (payload primitive) +26827 0x11/imm32/alloc-id:fake:payload +26828 # var/edx <- increment => 42/increment-edx 26829 0x11/imm32/alloc-id:fake -26830 _string_09_or_with/imm32/subx-name -26831 1/imm32/rm32-is-first-inout -26832 2/imm32/r32-is-second-inout -26833 0/imm32/no-imm32 -26834 0/imm32/no-imm8 -26835 0/imm32/no-disp32 -26836 0/imm32/no-xm32 -26837 0/imm32/no-x32 -26838 0x11/imm32/alloc-id:fake -26839 _Primitive-or-mem-with-reg/imm32/next -26840 _Primitive-or-mem-with-reg: # (payload primitive) -26841 0x11/imm32/alloc-id:fake:payload -26842 # var1/reg <- or var2 => 0b/or var2/rm32 var1/r32 -26843 0x11/imm32/alloc-id:fake -26844 _string-or/imm32/name -26845 0x11/imm32/alloc-id:fake -26846 Single-int-var-in-mem/imm32/inouts -26847 0x11/imm32/alloc-id:fake -26848 Single-int-var-in-some-register/imm32/outputs +26830 _string-increment/imm32/name +26831 0/imm32/no-inouts +26832 0/imm32/no-inouts +26833 0x11/imm32/alloc-id:fake +26834 Single-int-var-in-edx/imm32/outputs +26835 0x11/imm32/alloc-id:fake +26836 _string_42_increment_edx/imm32/subx-name +26837 0/imm32/no-rm32 +26838 0/imm32/no-r32 +26839 0/imm32/no-imm32 +26840 0/imm32/no-imm8 +26841 0/imm32/no-disp32 +26842 0/imm32/no-xm32 +26843 0/imm32/no-x32 +26844 0x11/imm32/alloc-id:fake +26845 _Primitive-increment-ebx/imm32/next +26846 _Primitive-increment-ebx: # (payload primitive) +26847 0x11/imm32/alloc-id:fake:payload +26848 # var/ebx <- increment => 43/increment-ebx 26849 0x11/imm32/alloc-id:fake -26850 _string_0b_or/imm32/subx-name -26851 1/imm32/rm32-is-first-inout -26852 3/imm32/r32-is-first-output -26853 0/imm32/no-imm32 -26854 0/imm32/no-imm8 -26855 0/imm32/no-disp32 -26856 0/imm32/no-xm32 -26857 0/imm32/no-x32 -26858 0x11/imm32/alloc-id:fake -26859 _Primitive-or-lit-with-reg/imm32/next -26860 _Primitive-or-lit-with-reg: # (payload primitive) -26861 0x11/imm32/alloc-id:fake:payload -26862 # var1/reg <- or lit => 81 1/subop/or var1/rm32 lit/imm32 -26863 0x11/imm32/alloc-id:fake -26864 _string-or/imm32/name -26865 0x11/imm32/alloc-id:fake -26866 Single-lit-var/imm32/inouts -26867 0x11/imm32/alloc-id:fake -26868 Single-int-var-in-some-register/imm32/outputs +26850 _string-increment/imm32/name +26851 0/imm32/no-inouts +26852 0/imm32/no-inouts +26853 0x11/imm32/alloc-id:fake +26854 Single-int-var-in-ebx/imm32/outputs +26855 0x11/imm32/alloc-id:fake +26856 _string_43_increment_ebx/imm32/subx-name +26857 0/imm32/no-rm32 +26858 0/imm32/no-r32 +26859 0/imm32/no-imm32 +26860 0/imm32/no-imm8 +26861 0/imm32/no-disp32 +26862 0/imm32/no-xm32 +26863 0/imm32/no-x32 +26864 0x11/imm32/alloc-id:fake +26865 _Primitive-increment-esi/imm32/next +26866 _Primitive-increment-esi: # (payload primitive) +26867 0x11/imm32/alloc-id:fake:payload +26868 # var/esi <- increment => 46/increment-esi 26869 0x11/imm32/alloc-id:fake -26870 _string_81_subop_or/imm32/subx-name -26871 3/imm32/rm32-is-first-output -26872 0/imm32/no-r32 -26873 1/imm32/imm32-is-first-inout -26874 0/imm32/no-imm8 -26875 0/imm32/no-disp32 -26876 0/imm32/no-xm32 -26877 0/imm32/no-x32 -26878 0x11/imm32/alloc-id:fake -26879 _Primitive-or-lit-with-mem/imm32/next -26880 _Primitive-or-lit-with-mem: # (payload primitive) -26881 0x11/imm32/alloc-id:fake:payload -26882 # or-with var1, lit => 81 1/subop/or var1/rm32 lit/imm32 -26883 0x11/imm32/alloc-id:fake -26884 _string-or-with/imm32/name -26885 0x11/imm32/alloc-id:fake -26886 Int-var-and-literal/imm32/inouts -26887 0/imm32/no-outputs -26888 0/imm32/no-outputs +26870 _string-increment/imm32/name +26871 0/imm32/no-inouts +26872 0/imm32/no-inouts +26873 0x11/imm32/alloc-id:fake +26874 Single-int-var-in-esi/imm32/outputs +26875 0x11/imm32/alloc-id:fake +26876 _string_46_increment_esi/imm32/subx-name +26877 0/imm32/no-rm32 +26878 0/imm32/no-r32 +26879 0/imm32/no-imm32 +26880 0/imm32/no-imm8 +26881 0/imm32/no-disp32 +26882 0/imm32/no-xm32 +26883 0/imm32/no-x32 +26884 0x11/imm32/alloc-id:fake +26885 _Primitive-increment-edi/imm32/next +26886 _Primitive-increment-edi: # (payload primitive) +26887 0x11/imm32/alloc-id:fake:payload +26888 # var/edi <- increment => 47/increment-edi 26889 0x11/imm32/alloc-id:fake -26890 _string_81_subop_or/imm32/subx-name -26891 1/imm32/rm32-is-first-inout -26892 0/imm32/no-r32 -26893 2/imm32/imm32-is-second-inout -26894 0/imm32/no-imm8 -26895 0/imm32/no-disp32 -26896 0/imm32/no-xm32 -26897 0/imm32/no-x32 -26898 0x11/imm32/alloc-id:fake -26899 _Primitive-xor-with-eax/imm32/next -26900 # - xor -26901 _Primitive-xor-with-eax: # (payload primitive) -26902 0x11/imm32/alloc-id:fake:payload -26903 # var/eax <- xor lit => 35/xor-with-eax lit/imm32 +26890 _string-increment/imm32/name +26891 0/imm32/no-inouts +26892 0/imm32/no-inouts +26893 0x11/imm32/alloc-id:fake +26894 Single-int-var-in-edi/imm32/outputs +26895 0x11/imm32/alloc-id:fake +26896 _string_47_increment_edi/imm32/subx-name +26897 0/imm32/no-rm32 +26898 0/imm32/no-r32 +26899 0/imm32/no-imm32 +26900 0/imm32/no-imm8 +26901 0/imm32/no-disp32 +26902 0/imm32/no-xm32 +26903 0/imm32/no-x32 26904 0x11/imm32/alloc-id:fake -26905 _string-xor/imm32/name -26906 0x11/imm32/alloc-id:fake -26907 Single-lit-var/imm32/inouts -26908 0x11/imm32/alloc-id:fake -26909 Single-int-var-in-eax/imm32/outputs -26910 0x11/imm32/alloc-id:fake -26911 _string_35_xor_with_eax/imm32/subx-name -26912 0/imm32/no-rm32 -26913 0/imm32/no-r32 -26914 1/imm32/imm32-is-first-inout -26915 0/imm32/no-imm8 -26916 0/imm32/no-disp32 -26917 0/imm32/no-xm32 -26918 0/imm32/no-x32 -26919 0x11/imm32/alloc-id:fake -26920 _Primitive-xor-reg-with-reg/imm32/next -26921 _Primitive-xor-reg-with-reg: # (payload primitive) -26922 0x11/imm32/alloc-id:fake:payload -26923 # var1/reg <- xor var2/reg => 31/xor-with var1/rm32 var2/r32 +26905 _Primitive-decrement-eax/imm32/next +26906 _Primitive-decrement-eax: # (payload primitive) +26907 0x11/imm32/alloc-id:fake:payload +26908 # var/eax <- decrement => 48/decrement-eax +26909 0x11/imm32/alloc-id:fake +26910 _string-decrement/imm32/name +26911 0/imm32/no-inouts +26912 0/imm32/no-inouts +26913 0x11/imm32/alloc-id:fake +26914 Single-int-var-in-eax/imm32/outputs +26915 0x11/imm32/alloc-id:fake +26916 _string_48_decrement_eax/imm32/subx-name +26917 0/imm32/no-rm32 +26918 0/imm32/no-r32 +26919 0/imm32/no-imm32 +26920 0/imm32/no-imm8 +26921 0/imm32/no-disp32 +26922 0/imm32/no-xm32 +26923 0/imm32/no-x32 26924 0x11/imm32/alloc-id:fake -26925 _string-xor/imm32/name -26926 0x11/imm32/alloc-id:fake -26927 Single-int-var-in-some-register/imm32/inouts -26928 0x11/imm32/alloc-id:fake -26929 Single-int-var-in-some-register/imm32/outputs -26930 0x11/imm32/alloc-id:fake -26931 _string_31_xor_with/imm32/subx-name -26932 3/imm32/rm32-is-first-output -26933 1/imm32/r32-is-first-inout -26934 0/imm32/no-imm32 -26935 0/imm32/no-imm8 -26936 0/imm32/no-disp32 -26937 0/imm32/no-xm32 -26938 0/imm32/no-x32 -26939 0x11/imm32/alloc-id:fake -26940 _Primitive-xor-reg-with-mem/imm32/next -26941 _Primitive-xor-reg-with-mem: # (payload primitive) -26942 0x11/imm32/alloc-id:fake:payload -26943 # xor-with var1 var2/reg => 31/xor-with var1 var2/r32 +26925 _Primitive-decrement-ecx/imm32/next +26926 _Primitive-decrement-ecx: # (payload primitive) +26927 0x11/imm32/alloc-id:fake:payload +26928 # var/ecx <- decrement => 49/decrement-ecx +26929 0x11/imm32/alloc-id:fake +26930 _string-decrement/imm32/name +26931 0/imm32/no-inouts +26932 0/imm32/no-inouts +26933 0x11/imm32/alloc-id:fake +26934 Single-int-var-in-ecx/imm32/outputs +26935 0x11/imm32/alloc-id:fake +26936 _string_49_decrement_ecx/imm32/subx-name +26937 0/imm32/no-rm32 +26938 0/imm32/no-r32 +26939 0/imm32/no-imm32 +26940 0/imm32/no-imm8 +26941 0/imm32/no-disp32 +26942 0/imm32/no-xm32 +26943 0/imm32/no-x32 26944 0x11/imm32/alloc-id:fake -26945 _string-xor-with/imm32/name -26946 0x11/imm32/alloc-id:fake -26947 Two-args-int-stack-int-reg/imm32/inouts -26948 0/imm32/no-outputs -26949 0/imm32/no-outputs -26950 0x11/imm32/alloc-id:fake -26951 _string_31_xor_with/imm32/subx-name -26952 1/imm32/rm32-is-first-inout -26953 2/imm32/r32-is-second-inout -26954 0/imm32/no-imm32 -26955 0/imm32/no-imm8 -26956 0/imm32/no-disp32 -26957 0/imm32/no-xm32 -26958 0/imm32/no-x32 -26959 0x11/imm32/alloc-id:fake -26960 _Primitive-xor-mem-with-reg/imm32/next -26961 _Primitive-xor-mem-with-reg: # (payload primitive) -26962 0x11/imm32/alloc-id:fake:payload -26963 # var1/reg <- xor var2 => 33/xor var2/rm32 var1/r32 +26945 _Primitive-decrement-edx/imm32/next +26946 _Primitive-decrement-edx: # (payload primitive) +26947 0x11/imm32/alloc-id:fake:payload +26948 # var/edx <- decrement => 4a/decrement-edx +26949 0x11/imm32/alloc-id:fake +26950 _string-decrement/imm32/name +26951 0/imm32/no-inouts +26952 0/imm32/no-inouts +26953 0x11/imm32/alloc-id:fake +26954 Single-int-var-in-edx/imm32/outputs +26955 0x11/imm32/alloc-id:fake +26956 _string_4a_decrement_edx/imm32/subx-name +26957 0/imm32/no-rm32 +26958 0/imm32/no-r32 +26959 0/imm32/no-imm32 +26960 0/imm32/no-imm8 +26961 0/imm32/no-disp32 +26962 0/imm32/no-xm32 +26963 0/imm32/no-x32 26964 0x11/imm32/alloc-id:fake -26965 _string-xor/imm32/name -26966 0x11/imm32/alloc-id:fake -26967 Single-int-var-in-mem/imm32/inouts -26968 0x11/imm32/alloc-id:fake -26969 Single-int-var-in-some-register/imm32/outputs -26970 0x11/imm32/alloc-id:fake -26971 _string_33_xor/imm32/subx-name -26972 1/imm32/rm32-is-first-inout -26973 3/imm32/r32-is-first-output -26974 0/imm32/no-imm32 -26975 0/imm32/no-imm8 -26976 0/imm32/no-disp32 -26977 0/imm32/no-xm32 -26978 0/imm32/no-x32 -26979 0x11/imm32/alloc-id:fake -26980 _Primitive-xor-lit-with-reg/imm32/next -26981 _Primitive-xor-lit-with-reg: # (payload primitive) -26982 0x11/imm32/alloc-id:fake:payload -26983 # var1/reg <- xor lit => 81 6/subop/xor var1/rm32 lit/imm32 +26965 _Primitive-decrement-ebx/imm32/next +26966 _Primitive-decrement-ebx: # (payload primitive) +26967 0x11/imm32/alloc-id:fake:payload +26968 # var/ebx <- decrement => 4b/decrement-ebx +26969 0x11/imm32/alloc-id:fake +26970 _string-decrement/imm32/name +26971 0/imm32/no-inouts +26972 0/imm32/no-inouts +26973 0x11/imm32/alloc-id:fake +26974 Single-int-var-in-ebx/imm32/outputs +26975 0x11/imm32/alloc-id:fake +26976 _string_4b_decrement_ebx/imm32/subx-name +26977 0/imm32/no-rm32 +26978 0/imm32/no-r32 +26979 0/imm32/no-imm32 +26980 0/imm32/no-imm8 +26981 0/imm32/no-disp32 +26982 0/imm32/no-xm32 +26983 0/imm32/no-x32 26984 0x11/imm32/alloc-id:fake -26985 _string-xor/imm32/name -26986 0x11/imm32/alloc-id:fake -26987 Single-lit-var/imm32/inouts -26988 0x11/imm32/alloc-id:fake -26989 Single-int-var-in-some-register/imm32/outputs -26990 0x11/imm32/alloc-id:fake -26991 _string_81_subop_xor/imm32/subx-name -26992 3/imm32/rm32-is-first-output -26993 0/imm32/no-r32 -26994 1/imm32/imm32-is-first-inout -26995 0/imm32/no-imm8 -26996 0/imm32/no-disp32 -26997 0/imm32/no-xm32 -26998 0/imm32/no-x32 -26999 0x11/imm32/alloc-id:fake -27000 _Primitive-xor-lit-with-mem/imm32/next -27001 _Primitive-xor-lit-with-mem: # (payload primitive) -27002 0x11/imm32/alloc-id:fake:payload -27003 # xor-with var1, lit => 81 6/subop/xor var1/rm32 lit/imm32 +26985 _Primitive-decrement-esi/imm32/next +26986 _Primitive-decrement-esi: # (payload primitive) +26987 0x11/imm32/alloc-id:fake:payload +26988 # var/esi <- decrement => 4e/decrement-esi +26989 0x11/imm32/alloc-id:fake +26990 _string-decrement/imm32/name +26991 0/imm32/no-inouts +26992 0/imm32/no-inouts +26993 0x11/imm32/alloc-id:fake +26994 Single-int-var-in-esi/imm32/outputs +26995 0x11/imm32/alloc-id:fake +26996 _string_4e_decrement_esi/imm32/subx-name +26997 0/imm32/no-rm32 +26998 0/imm32/no-r32 +26999 0/imm32/no-imm32 +27000 0/imm32/no-imm8 +27001 0/imm32/no-disp32 +27002 0/imm32/no-xm32 +27003 0/imm32/no-x32 27004 0x11/imm32/alloc-id:fake -27005 _string-xor-with/imm32/name -27006 0x11/imm32/alloc-id:fake -27007 Int-var-and-literal/imm32/inouts -27008 0/imm32/no-outputs -27009 0/imm32/no-outputs -27010 0x11/imm32/alloc-id:fake -27011 _string_81_subop_xor/imm32/subx-name -27012 1/imm32/rm32-is-first-inout -27013 0/imm32/no-r32 -27014 2/imm32/imm32-is-second-inout -27015 0/imm32/no-imm8 -27016 0/imm32/no-disp32 -27017 0/imm32/no-xm32 -27018 0/imm32/no-x32 -27019 0x11/imm32/alloc-id:fake -27020 _Primitive-shift-reg-left-by-lit/imm32/next -27021 _Primitive-shift-reg-left-by-lit: # (payload primitive) -27022 0x11/imm32/alloc-id:fake:payload -27023 # var1/reg <- shift-left lit => c1/shift 4/subop/left var1/rm32 lit/imm32 +27005 _Primitive-decrement-edi/imm32/next +27006 _Primitive-decrement-edi: # (payload primitive) +27007 0x11/imm32/alloc-id:fake:payload +27008 # var/edi <- decrement => 4f/decrement-edi +27009 0x11/imm32/alloc-id:fake +27010 _string-decrement/imm32/name +27011 0/imm32/no-inouts +27012 0/imm32/no-inouts +27013 0x11/imm32/alloc-id:fake +27014 Single-int-var-in-edi/imm32/outputs +27015 0x11/imm32/alloc-id:fake +27016 _string_4f_decrement_edi/imm32/subx-name +27017 0/imm32/no-rm32 +27018 0/imm32/no-r32 +27019 0/imm32/no-imm32 +27020 0/imm32/no-imm8 +27021 0/imm32/no-disp32 +27022 0/imm32/no-xm32 +27023 0/imm32/no-x32 27024 0x11/imm32/alloc-id:fake -27025 _string-shift-left/imm32/name -27026 0x11/imm32/alloc-id:fake -27027 Single-lit-var/imm32/inouts -27028 0x11/imm32/alloc-id:fake -27029 Single-int-var-in-some-register/imm32/outputs -27030 0x11/imm32/alloc-id:fake -27031 _string_c1_subop_shift_left/imm32/subx-name -27032 3/imm32/rm32-is-first-output -27033 0/imm32/no-r32 -27034 0/imm32/no-imm32 -27035 1/imm32/imm8-is-first-inout -27036 0/imm32/no-disp32 -27037 0/imm32/no-xm32 -27038 0/imm32/no-x32 -27039 0x11/imm32/alloc-id:fake -27040 _Primitive-shift-reg-right-by-lit/imm32/next -27041 _Primitive-shift-reg-right-by-lit: # (payload primitive) -27042 0x11/imm32/alloc-id:fake:payload -27043 # var1/reg <- shift-right lit => c1/shift 5/subop/right var1/rm32 lit/imm32 +27025 _Primitive-increment-mem/imm32/next +27026 _Primitive-increment-mem: # (payload primitive) +27027 0x11/imm32/alloc-id:fake:payload +27028 # increment var => ff 0/subop/increment *(ebp+__) +27029 0x11/imm32/alloc-id:fake +27030 _string-increment/imm32/name +27031 0x11/imm32/alloc-id:fake +27032 Single-int-var-in-mem/imm32/inouts +27033 0/imm32/no-outputs +27034 0/imm32/no-outputs +27035 0x11/imm32/alloc-id:fake +27036 _string_ff_subop_increment/imm32/subx-name +27037 1/imm32/rm32-is-first-inout +27038 0/imm32/no-r32 +27039 0/imm32/no-imm32 +27040 0/imm32/no-imm8 +27041 0/imm32/no-disp32 +27042 0/imm32/no-xm32 +27043 0/imm32/no-x32 27044 0x11/imm32/alloc-id:fake -27045 _string-shift-right/imm32/name -27046 0x11/imm32/alloc-id:fake -27047 Single-lit-var/imm32/inouts -27048 0x11/imm32/alloc-id:fake -27049 Single-int-var-in-some-register/imm32/outputs -27050 0x11/imm32/alloc-id:fake -27051 _string_c1_subop_shift_right_padding_zeroes/imm32/subx-name -27052 3/imm32/rm32-is-first-output -27053 0/imm32/no-r32 -27054 0/imm32/no-imm32 -27055 1/imm32/imm8-is-first-inout -27056 0/imm32/no-disp32 -27057 0/imm32/no-xm32 -27058 0/imm32/no-x32 -27059 0x11/imm32/alloc-id:fake -27060 _Primitive-shift-reg-right-signed-by-lit/imm32/next -27061 _Primitive-shift-reg-right-signed-by-lit: # (payload primitive) -27062 0x11/imm32/alloc-id:fake:payload -27063 # var1/reg <- shift-right-signed lit => c1/shift 7/subop/right-preserving-sign var1/rm32 lit/imm32 +27045 _Primitive-increment-reg/imm32/next +27046 _Primitive-increment-reg: # (payload primitive) +27047 0x11/imm32/alloc-id:fake:payload +27048 # var/reg <- increment => ff 0/subop/increment %__ +27049 0x11/imm32/alloc-id:fake +27050 _string-increment/imm32/name +27051 0/imm32/no-inouts +27052 0/imm32/no-inouts +27053 0x11/imm32/alloc-id:fake +27054 Single-int-var-in-some-register/imm32/outputs +27055 0x11/imm32/alloc-id:fake +27056 _string_ff_subop_increment/imm32/subx-name +27057 3/imm32/rm32-is-first-output +27058 0/imm32/no-r32 +27059 0/imm32/no-imm32 +27060 0/imm32/no-imm8 +27061 0/imm32/no-disp32 +27062 0/imm32/no-xm32 +27063 0/imm32/no-x32 27064 0x11/imm32/alloc-id:fake -27065 _string-shift-right-signed/imm32/name -27066 0x11/imm32/alloc-id:fake -27067 Single-lit-var/imm32/inouts -27068 0x11/imm32/alloc-id:fake -27069 Single-int-var-in-some-register/imm32/outputs -27070 0x11/imm32/alloc-id:fake -27071 _string_c1_subop_shift_right_preserving_sign/imm32/subx-name -27072 3/imm32/rm32-is-first-output -27073 0/imm32/no-r32 -27074 0/imm32/no-imm32 -27075 1/imm32/imm8-is-first-inout -27076 0/imm32/no-disp32 -27077 0/imm32/no-xm32 -27078 0/imm32/no-x32 -27079 0x11/imm32/alloc-id:fake -27080 _Primitive-shift-mem-left-by-lit/imm32/next -27081 _Primitive-shift-mem-left-by-lit: # (payload primitive) -27082 0x11/imm32/alloc-id:fake:payload -27083 # shift-left var1, lit => c1/shift 4/subop/left var1/rm32 lit/imm32 +27065 _Primitive-decrement-mem/imm32/next +27066 _Primitive-decrement-mem: # (payload primitive) +27067 0x11/imm32/alloc-id:fake:payload +27068 # decrement var => ff 1/subop/decrement *(ebp+__) +27069 0x11/imm32/alloc-id:fake +27070 _string-decrement/imm32/name +27071 0x11/imm32/alloc-id:fake +27072 Single-int-var-in-mem/imm32/inouts +27073 0/imm32/no-outputs +27074 0/imm32/no-outputs +27075 0x11/imm32/alloc-id:fake +27076 _string_ff_subop_decrement/imm32/subx-name +27077 1/imm32/rm32-is-first-inout +27078 0/imm32/no-r32 +27079 0/imm32/no-imm32 +27080 0/imm32/no-imm8 +27081 0/imm32/no-disp32 +27082 0/imm32/no-xm32 +27083 0/imm32/no-x32 27084 0x11/imm32/alloc-id:fake -27085 _string-shift-left/imm32/name -27086 0x11/imm32/alloc-id:fake -27087 Int-var-and-literal/imm32/inouts -27088 0/imm32/no-outputs -27089 0/imm32/no-outputs -27090 0x11/imm32/alloc-id:fake -27091 _string_c1_subop_shift_left/imm32/subx-name -27092 1/imm32/rm32-is-first-inout -27093 0/imm32/no-r32 -27094 0/imm32/no-imm32 -27095 2/imm32/imm8-is-second-inout -27096 0/imm32/no-disp32 -27097 0/imm32/no-xm32 -27098 0/imm32/no-x32 -27099 0x11/imm32/alloc-id:fake -27100 _Primitive-shift-mem-right-by-lit/imm32/next -27101 _Primitive-shift-mem-right-by-lit: # (payload primitive) -27102 0x11/imm32/alloc-id:fake:payload -27103 # shift-right var1, lit => c1/shift 5/subop/right var1/rm32 lit/imm32 +27085 _Primitive-decrement-reg/imm32/next +27086 _Primitive-decrement-reg: # (payload primitive) +27087 0x11/imm32/alloc-id:fake:payload +27088 # var/reg <- decrement => ff 1/subop/decrement %__ +27089 0x11/imm32/alloc-id:fake +27090 _string-decrement/imm32/name +27091 0/imm32/no-inouts +27092 0/imm32/no-inouts +27093 0x11/imm32/alloc-id:fake +27094 Single-int-var-in-some-register/imm32/outputs +27095 0x11/imm32/alloc-id:fake +27096 _string_ff_subop_decrement/imm32/subx-name +27097 3/imm32/rm32-is-first-output +27098 0/imm32/no-r32 +27099 0/imm32/no-imm32 +27100 0/imm32/no-imm8 +27101 0/imm32/no-disp32 +27102 0/imm32/no-xm32 +27103 0/imm32/no-x32 27104 0x11/imm32/alloc-id:fake -27105 _string-shift-right/imm32/name -27106 0x11/imm32/alloc-id:fake -27107 Int-var-and-literal/imm32/inouts -27108 0/imm32/no-outputs -27109 0/imm32/no-outputs +27105 _Primitive-add-to-eax/imm32/next +27106 # - add +27107 _Primitive-add-to-eax: # (payload primitive) +27108 0x11/imm32/alloc-id:fake:payload +27109 # var/eax <- add lit => 05/add-to-eax lit/imm32 27110 0x11/imm32/alloc-id:fake -27111 _string_c1_subop_shift_right_padding_zeroes/imm32/subx-name -27112 1/imm32/rm32-is-first-inout -27113 0/imm32/no-r32 -27114 0/imm32/no-imm32 -27115 2/imm32/imm8-is-second-inout -27116 0/imm32/no-disp32 -27117 0/imm32/no-xm32 -27118 0/imm32/no-x32 -27119 0x11/imm32/alloc-id:fake -27120 _Primitive-shift-mem-right-signed-by-lit/imm32/next -27121 _Primitive-shift-mem-right-signed-by-lit: # (payload primitive) -27122 0x11/imm32/alloc-id:fake:payload -27123 # shift-right-signed var1, lit => c1/shift 7/subop/right-preserving-sign var1/rm32 lit/imm32 -27124 0x11/imm32/alloc-id:fake -27125 _string-shift-right-signed/imm32/name -27126 0x11/imm32/alloc-id:fake -27127 Int-var-and-literal/imm32/inouts -27128 0/imm32/no-outputs -27129 0/imm32/no-outputs +27111 _string-add/imm32/name +27112 0x11/imm32/alloc-id:fake +27113 Single-lit-var/imm32/inouts +27114 0x11/imm32/alloc-id:fake +27115 Single-int-var-in-eax/imm32/outputs +27116 0x11/imm32/alloc-id:fake +27117 _string_05_add_to_eax/imm32/subx-name +27118 0/imm32/no-rm32 +27119 0/imm32/no-r32 +27120 1/imm32/imm32-is-first-inout +27121 0/imm32/no-imm8 +27122 0/imm32/no-disp32 +27123 0/imm32/no-xm32 +27124 0/imm32/no-x32 +27125 0x11/imm32/alloc-id:fake +27126 _Primitive-add-reg-to-reg/imm32/next +27127 _Primitive-add-reg-to-reg: # (payload primitive) +27128 0x11/imm32/alloc-id:fake:payload +27129 # var1/reg <- add var2/reg => 01/add-to var1/rm32 var2/r32 27130 0x11/imm32/alloc-id:fake -27131 _string_c1_subop_shift_right_preserving_sign/imm32/subx-name -27132 1/imm32/rm32-is-first-inout -27133 0/imm32/no-r32 -27134 0/imm32/no-imm32 -27135 2/imm32/imm8-is-second-inout -27136 0/imm32/no-disp32 -27137 0/imm32/no-xm32 -27138 0/imm32/no-x32 -27139 0x11/imm32/alloc-id:fake -27140 _Primitive-copy-to-eax/imm32/next -27141 # - copy -27142 _Primitive-copy-to-eax: # (payload primitive) -27143 0x11/imm32/alloc-id:fake:payload -27144 # var/eax <- copy lit => b8/copy-to-eax lit/imm32 +27131 _string-add/imm32/name +27132 0x11/imm32/alloc-id:fake +27133 Single-int-var-in-some-register/imm32/inouts +27134 0x11/imm32/alloc-id:fake +27135 Single-int-var-in-some-register/imm32/outputs +27136 0x11/imm32/alloc-id:fake +27137 _string_01_add_to/imm32/subx-name +27138 3/imm32/rm32-is-first-output +27139 1/imm32/r32-is-first-inout +27140 0/imm32/no-imm32 +27141 0/imm32/no-imm8 +27142 0/imm32/no-disp32 +27143 0/imm32/no-xm32 +27144 0/imm32/no-x32 27145 0x11/imm32/alloc-id:fake -27146 _string-copy/imm32/name -27147 0x11/imm32/alloc-id:fake -27148 Single-lit-var/imm32/inouts -27149 0x11/imm32/alloc-id:fake -27150 Single-int-var-in-eax/imm32/outputs -27151 0x11/imm32/alloc-id:fake -27152 _string_b8_copy_to_eax/imm32/subx-name -27153 0/imm32/no-rm32 -27154 0/imm32/no-r32 -27155 1/imm32/imm32-is-first-inout -27156 0/imm32/no-imm8 -27157 0/imm32/no-disp32 -27158 0/imm32/no-xm32 -27159 0/imm32/no-x32 -27160 0x11/imm32/alloc-id:fake -27161 _Primitive-copy-to-ecx/imm32/next -27162 _Primitive-copy-to-ecx: # (payload primitive) -27163 0x11/imm32/alloc-id:fake:payload -27164 # var/ecx <- copy lit => b9/copy-to-ecx lit/imm32 +27146 _Primitive-add-reg-to-mem/imm32/next +27147 _Primitive-add-reg-to-mem: # (payload primitive) +27148 0x11/imm32/alloc-id:fake:payload +27149 # add-to var1 var2/reg => 01/add-to var1 var2/r32 +27150 0x11/imm32/alloc-id:fake +27151 _string-add-to/imm32/name +27152 0x11/imm32/alloc-id:fake +27153 Two-args-int-stack-int-reg/imm32/inouts +27154 0/imm32/no-outputs +27155 0/imm32/no-outputs +27156 0x11/imm32/alloc-id:fake +27157 _string_01_add_to/imm32/subx-name +27158 1/imm32/rm32-is-first-inout +27159 2/imm32/r32-is-second-inout +27160 0/imm32/no-imm32 +27161 0/imm32/no-imm8 +27162 0/imm32/no-disp32 +27163 0/imm32/no-xm32 +27164 0/imm32/no-x32 27165 0x11/imm32/alloc-id:fake -27166 _string-copy/imm32/name -27167 0x11/imm32/alloc-id:fake -27168 Single-lit-var/imm32/inouts -27169 0x11/imm32/alloc-id:fake -27170 Single-int-var-in-ecx/imm32/outputs -27171 0x11/imm32/alloc-id:fake -27172 _string_b9_copy_to_ecx/imm32/subx-name -27173 0/imm32/no-rm32 -27174 0/imm32/no-r32 -27175 1/imm32/imm32-is-first-inout -27176 0/imm32/no-imm8 -27177 0/imm32/no-disp32 -27178 0/imm32/no-xm32 -27179 0/imm32/no-x32 -27180 0x11/imm32/alloc-id:fake -27181 _Primitive-copy-to-edx/imm32/next -27182 _Primitive-copy-to-edx: # (payload primitive) -27183 0x11/imm32/alloc-id:fake:payload -27184 # var/edx <- copy lit => ba/copy-to-edx lit/imm32 +27166 _Primitive-add-mem-to-reg/imm32/next +27167 _Primitive-add-mem-to-reg: # (payload primitive) +27168 0x11/imm32/alloc-id:fake:payload +27169 # var1/reg <- add var2 => 03/add var2/rm32 var1/r32 +27170 0x11/imm32/alloc-id:fake +27171 _string-add/imm32/name +27172 0x11/imm32/alloc-id:fake +27173 Single-int-var-in-mem/imm32/inouts +27174 0x11/imm32/alloc-id:fake +27175 Single-int-var-in-some-register/imm32/outputs +27176 0x11/imm32/alloc-id:fake +27177 _string_03_add/imm32/subx-name +27178 1/imm32/rm32-is-first-inout +27179 3/imm32/r32-is-first-output +27180 0/imm32/no-imm32 +27181 0/imm32/no-imm8 +27182 0/imm32/no-disp32 +27183 0/imm32/no-xm32 +27184 0/imm32/no-x32 27185 0x11/imm32/alloc-id:fake -27186 _string-copy/imm32/name -27187 0x11/imm32/alloc-id:fake -27188 Single-lit-var/imm32/inouts -27189 0x11/imm32/alloc-id:fake -27190 Single-int-var-in-edx/imm32/outputs -27191 0x11/imm32/alloc-id:fake -27192 _string_ba_copy_to_edx/imm32/subx-name -27193 0/imm32/no-rm32 -27194 0/imm32/no-r32 -27195 1/imm32/imm32-is-first-inout -27196 0/imm32/no-imm8 -27197 0/imm32/no-disp32 -27198 0/imm32/no-xm32 -27199 0/imm32/no-x32 -27200 0x11/imm32/alloc-id:fake -27201 _Primitive-copy-to-ebx/imm32/next -27202 _Primitive-copy-to-ebx: # (payload primitive) -27203 0x11/imm32/alloc-id:fake:payload -27204 # var/ebx <- copy lit => bb/copy-to-ebx lit/imm32 +27186 _Primitive-add-lit-to-reg/imm32/next +27187 _Primitive-add-lit-to-reg: # (payload primitive) +27188 0x11/imm32/alloc-id:fake:payload +27189 # var1/reg <- add lit => 81 0/subop/add var1/rm32 lit/imm32 +27190 0x11/imm32/alloc-id:fake +27191 _string-add/imm32/name +27192 0x11/imm32/alloc-id:fake +27193 Single-lit-var/imm32/inouts +27194 0x11/imm32/alloc-id:fake +27195 Single-int-var-in-some-register/imm32/outputs +27196 0x11/imm32/alloc-id:fake +27197 _string_81_subop_add/imm32/subx-name +27198 3/imm32/rm32-is-first-output +27199 0/imm32/no-r32 +27200 1/imm32/imm32-is-first-inout +27201 0/imm32/no-imm8 +27202 0/imm32/no-disp32 +27203 0/imm32/no-xm32 +27204 0/imm32/no-x32 27205 0x11/imm32/alloc-id:fake -27206 _string-copy/imm32/name -27207 0x11/imm32/alloc-id:fake -27208 Single-lit-var/imm32/inouts -27209 0x11/imm32/alloc-id:fake -27210 Single-int-var-in-ebx/imm32/outputs -27211 0x11/imm32/alloc-id:fake -27212 _string_bb_copy_to_ebx/imm32/subx-name -27213 0/imm32/no-rm32 -27214 0/imm32/no-r32 -27215 1/imm32/imm32-is-first-inout -27216 0/imm32/no-imm8 -27217 0/imm32/no-disp32 -27218 0/imm32/no-xm32 -27219 0/imm32/no-x32 -27220 0x11/imm32/alloc-id:fake -27221 _Primitive-copy-to-esi/imm32/next -27222 _Primitive-copy-to-esi: # (payload primitive) -27223 0x11/imm32/alloc-id:fake:payload -27224 # var/esi <- copy lit => be/copy-to-esi lit/imm32 +27206 _Primitive-add-lit-to-mem/imm32/next +27207 _Primitive-add-lit-to-mem: # (payload primitive) +27208 0x11/imm32/alloc-id:fake:payload +27209 # add-to var1, lit => 81 0/subop/add var1/rm32 lit/imm32 +27210 0x11/imm32/alloc-id:fake +27211 _string-add-to/imm32/name +27212 0x11/imm32/alloc-id:fake +27213 Int-var-and-literal/imm32/inouts +27214 0/imm32/no-outputs +27215 0/imm32/no-outputs +27216 0x11/imm32/alloc-id:fake +27217 _string_81_subop_add/imm32/subx-name +27218 1/imm32/rm32-is-first-inout +27219 0/imm32/no-r32 +27220 2/imm32/imm32-is-second-inout +27221 0/imm32/no-imm8 +27222 0/imm32/no-disp32 +27223 0/imm32/no-xm32 +27224 0/imm32/no-x32 27225 0x11/imm32/alloc-id:fake -27226 _string-copy/imm32/name -27227 0x11/imm32/alloc-id:fake -27228 Single-lit-var/imm32/inouts -27229 0x11/imm32/alloc-id:fake -27230 Single-int-var-in-esi/imm32/outputs +27226 _Primitive-subtract-from-eax/imm32/next +27227 # - subtract +27228 _Primitive-subtract-from-eax: # (payload primitive) +27229 0x11/imm32/alloc-id:fake:payload +27230 # var/eax <- subtract lit => 2d/subtract-from-eax lit/imm32 27231 0x11/imm32/alloc-id:fake -27232 _string_be_copy_to_esi/imm32/subx-name -27233 0/imm32/no-rm32 -27234 0/imm32/no-r32 -27235 1/imm32/imm32-is-first-inout -27236 0/imm32/no-imm8 -27237 0/imm32/no-disp32 -27238 0/imm32/no-xm32 -27239 0/imm32/no-x32 -27240 0x11/imm32/alloc-id:fake -27241 _Primitive-copy-to-edi/imm32/next -27242 _Primitive-copy-to-edi: # (payload primitive) -27243 0x11/imm32/alloc-id:fake:payload -27244 # var/edi <- copy lit => bf/copy-to-edi lit/imm32 -27245 0x11/imm32/alloc-id:fake -27246 _string-copy/imm32/name -27247 0x11/imm32/alloc-id:fake -27248 Single-lit-var/imm32/inouts -27249 0x11/imm32/alloc-id:fake -27250 Single-int-var-in-edi/imm32/outputs +27232 _string-subtract/imm32/name +27233 0x11/imm32/alloc-id:fake +27234 Single-lit-var/imm32/inouts +27235 0x11/imm32/alloc-id:fake +27236 Single-int-var-in-eax/imm32/outputs +27237 0x11/imm32/alloc-id:fake +27238 _string_2d_subtract_from_eax/imm32/subx-name +27239 0/imm32/no-rm32 +27240 0/imm32/no-r32 +27241 1/imm32/imm32-is-first-inout +27242 0/imm32/no-imm8 +27243 0/imm32/no-disp32 +27244 0/imm32/no-xm32 +27245 0/imm32/no-x32 +27246 0x11/imm32/alloc-id:fake +27247 _Primitive-subtract-reg-from-reg/imm32/next +27248 _Primitive-subtract-reg-from-reg: # (payload primitive) +27249 0x11/imm32/alloc-id:fake:payload +27250 # var1/reg <- subtract var2/reg => 29/subtract-from var1/rm32 var2/r32 27251 0x11/imm32/alloc-id:fake -27252 _string_bf_copy_to_edi/imm32/subx-name -27253 0/imm32/no-rm32 -27254 0/imm32/no-r32 -27255 1/imm32/imm32-is-first-inout -27256 0/imm32/no-imm8 -27257 0/imm32/no-disp32 -27258 0/imm32/no-xm32 -27259 0/imm32/no-x32 -27260 0x11/imm32/alloc-id:fake -27261 _Primitive-copy-reg-to-reg/imm32/next -27262 _Primitive-copy-reg-to-reg: # (payload primitive) -27263 0x11/imm32/alloc-id:fake:payload -27264 # var1/reg <- copy var2/reg => 89/<- var1/rm32 var2/r32 -27265 0x11/imm32/alloc-id:fake -27266 _string-copy/imm32/name -27267 0x11/imm32/alloc-id:fake -27268 Single-int-var-in-some-register/imm32/inouts -27269 0x11/imm32/alloc-id:fake -27270 Single-int-var-in-some-register/imm32/outputs +27252 _string-subtract/imm32/name +27253 0x11/imm32/alloc-id:fake +27254 Single-int-var-in-some-register/imm32/inouts +27255 0x11/imm32/alloc-id:fake +27256 Single-int-var-in-some-register/imm32/outputs +27257 0x11/imm32/alloc-id:fake +27258 _string_29_subtract_from/imm32/subx-name +27259 3/imm32/rm32-is-first-output +27260 1/imm32/r32-is-first-inout +27261 0/imm32/no-imm32 +27262 0/imm32/no-imm8 +27263 0/imm32/no-disp32 +27264 0/imm32/no-xm32 +27265 0/imm32/no-x32 +27266 0x11/imm32/alloc-id:fake +27267 _Primitive-subtract-reg-from-mem/imm32/next +27268 _Primitive-subtract-reg-from-mem: # (payload primitive) +27269 0x11/imm32/alloc-id:fake:payload +27270 # subtract-from var1 var2/reg => 29/subtract-from var1 var2/r32 27271 0x11/imm32/alloc-id:fake -27272 _string_89_<-/imm32/subx-name -27273 3/imm32/rm32-is-first-output -27274 1/imm32/r32-is-first-inout -27275 0/imm32/no-imm32 -27276 0/imm32/no-imm8 -27277 0/imm32/no-disp32 -27278 0/imm32/no-xm32 -27279 0/imm32/no-x32 -27280 0x11/imm32/alloc-id:fake -27281 _Primitive-copy-reg-to-mem/imm32/next -27282 _Primitive-copy-reg-to-mem: # (payload primitive) -27283 0x11/imm32/alloc-id:fake:payload -27284 # copy-to var1 var2/reg => 89/<- var1 var2/r32 -27285 0x11/imm32/alloc-id:fake -27286 _string-copy-to/imm32/name -27287 0x11/imm32/alloc-id:fake -27288 Two-args-int-stack-int-reg/imm32/inouts -27289 0/imm32/no-outputs -27290 0/imm32/no-outputs +27272 _string-subtract-from/imm32/name +27273 0x11/imm32/alloc-id:fake +27274 Two-args-int-stack-int-reg/imm32/inouts +27275 0/imm32/no-outputs +27276 0/imm32/no-outputs +27277 0x11/imm32/alloc-id:fake +27278 _string_29_subtract_from/imm32/subx-name +27279 1/imm32/rm32-is-first-inout +27280 2/imm32/r32-is-second-inout +27281 0/imm32/no-imm32 +27282 0/imm32/no-imm8 +27283 0/imm32/no-disp32 +27284 0/imm32/no-xm32 +27285 0/imm32/no-x32 +27286 0x11/imm32/alloc-id:fake +27287 _Primitive-subtract-mem-from-reg/imm32/next +27288 _Primitive-subtract-mem-from-reg: # (payload primitive) +27289 0x11/imm32/alloc-id:fake:payload +27290 # var1/reg <- subtract var2 => 2b/subtract var2/rm32 var1/r32 27291 0x11/imm32/alloc-id:fake -27292 _string_89_<-/imm32/subx-name -27293 1/imm32/rm32-is-first-inout -27294 2/imm32/r32-is-second-inout -27295 0/imm32/no-imm32 -27296 0/imm32/no-imm8 -27297 0/imm32/no-disp32 -27298 0/imm32/no-xm32 -27299 0/imm32/no-x32 -27300 0x11/imm32/alloc-id:fake -27301 _Primitive-copy-mem-to-reg/imm32/next -27302 _Primitive-copy-mem-to-reg: # (payload primitive) -27303 0x11/imm32/alloc-id:fake:payload -27304 # var1/reg <- copy var2 => 8b/-> var2/rm32 var1/r32 -27305 0x11/imm32/alloc-id:fake -27306 _string-copy/imm32/name -27307 0x11/imm32/alloc-id:fake -27308 Single-int-var-in-mem/imm32/inouts -27309 0x11/imm32/alloc-id:fake -27310 Single-int-var-in-some-register/imm32/outputs +27292 _string-subtract/imm32/name +27293 0x11/imm32/alloc-id:fake +27294 Single-int-var-in-mem/imm32/inouts +27295 0x11/imm32/alloc-id:fake +27296 Single-int-var-in-some-register/imm32/outputs +27297 0x11/imm32/alloc-id:fake +27298 _string_2b_subtract/imm32/subx-name +27299 1/imm32/rm32-is-first-inout +27300 3/imm32/r32-is-first-output +27301 0/imm32/no-imm32 +27302 0/imm32/no-imm8 +27303 0/imm32/no-disp32 +27304 0/imm32/no-xm32 +27305 0/imm32/no-x32 +27306 0x11/imm32/alloc-id:fake +27307 _Primitive-subtract-lit-from-reg/imm32/next +27308 _Primitive-subtract-lit-from-reg: # (payload primitive) +27309 0x11/imm32/alloc-id:fake:payload +27310 # var1/reg <- subtract lit => 81 5/subop/subtract var1/rm32 lit/imm32 27311 0x11/imm32/alloc-id:fake -27312 _string_8b_->/imm32/subx-name -27313 1/imm32/rm32-is-first-inout -27314 3/imm32/r32-is-first-output -27315 0/imm32/no-imm32 -27316 0/imm32/no-imm8 -27317 0/imm32/no-disp32 -27318 0/imm32/no-xm32 -27319 0/imm32/no-x32 -27320 0x11/imm32/alloc-id:fake -27321 _Primitive-copy-lit-to-reg/imm32/next -27322 _Primitive-copy-lit-to-reg: # (payload primitive) -27323 0x11/imm32/alloc-id:fake:payload -27324 # var1/reg <- copy lit => c7 0/subop/copy var1/rm32 lit/imm32 -27325 0x11/imm32/alloc-id:fake -27326 _string-copy/imm32/name -27327 0x11/imm32/alloc-id:fake -27328 Single-lit-var/imm32/inouts -27329 0x11/imm32/alloc-id:fake -27330 Single-int-var-in-some-register/imm32/outputs +27312 _string-subtract/imm32/name +27313 0x11/imm32/alloc-id:fake +27314 Single-lit-var/imm32/inouts +27315 0x11/imm32/alloc-id:fake +27316 Single-int-var-in-some-register/imm32/outputs +27317 0x11/imm32/alloc-id:fake +27318 _string_81_subop_subtract/imm32/subx-name +27319 3/imm32/rm32-is-first-output +27320 0/imm32/no-r32 +27321 1/imm32/imm32-is-first-inout +27322 0/imm32/no-imm8 +27323 0/imm32/no-disp32 +27324 0/imm32/no-xm32 +27325 0/imm32/no-x32 +27326 0x11/imm32/alloc-id:fake +27327 _Primitive-subtract-lit-from-mem/imm32/next +27328 _Primitive-subtract-lit-from-mem: # (payload primitive) +27329 0x11/imm32/alloc-id:fake:payload +27330 # subtract-from var1, lit => 81 5/subop/subtract var1/rm32 lit/imm32 27331 0x11/imm32/alloc-id:fake -27332 _string_c7_subop_copy/imm32/subx-name -27333 3/imm32/rm32-is-first-output -27334 0/imm32/no-r32 -27335 1/imm32/imm32-is-first-inout -27336 0/imm32/no-imm8 -27337 0/imm32/no-disp32 -27338 0/imm32/no-xm32 -27339 0/imm32/no-x32 -27340 0x11/imm32/alloc-id:fake -27341 _Primitive-copy-lit-to-mem/imm32/next -27342 _Primitive-copy-lit-to-mem: # (payload primitive) -27343 0x11/imm32/alloc-id:fake:payload -27344 # copy-to var1, lit => c7 0/subop/copy var1/rm32 lit/imm32 -27345 0x11/imm32/alloc-id:fake -27346 _string-copy-to/imm32/name -27347 0x11/imm32/alloc-id:fake -27348 Int-var-and-literal/imm32/inouts -27349 0/imm32/no-outputs -27350 0/imm32/no-outputs -27351 0x11/imm32/alloc-id:fake -27352 _string_c7_subop_copy/imm32/subx-name -27353 1/imm32/rm32-is-first-inout -27354 0/imm32/no-r32 -27355 2/imm32/imm32-is-second-inout -27356 0/imm32/no-imm8 -27357 0/imm32/no-disp32 -27358 0/imm32/no-xm32 -27359 0/imm32/no-x32 -27360 0x11/imm32/alloc-id:fake -27361 _Primitive-copy-byte-from-reg/imm32/next -27362 # - copy byte -27363 _Primitive-copy-byte-from-reg: -27364 0x11/imm32/alloc-id:fake:payload -27365 # var/reg <- copy-byte var2/reg2 => 8a/byte-> %var2 var/r32 -27366 0x11/imm32/alloc-id:fake -27367 _string-copy-byte/imm32/name -27368 0x11/imm32/alloc-id:fake -27369 Single-byte-var-in-some-register/imm32/inouts -27370 0x11/imm32/alloc-id:fake -27371 Single-byte-var-in-some-register/imm32/outputs +27332 _string-subtract-from/imm32/name +27333 0x11/imm32/alloc-id:fake +27334 Int-var-and-literal/imm32/inouts +27335 0/imm32/no-outputs +27336 0/imm32/no-outputs +27337 0x11/imm32/alloc-id:fake +27338 _string_81_subop_subtract/imm32/subx-name +27339 1/imm32/rm32-is-first-inout +27340 0/imm32/no-r32 +27341 2/imm32/imm32-is-second-inout +27342 0/imm32/no-imm8 +27343 0/imm32/no-disp32 +27344 0/imm32/no-xm32 +27345 0/imm32/no-x32 +27346 0x11/imm32/alloc-id:fake +27347 _Primitive-and-with-eax/imm32/next +27348 # - and +27349 _Primitive-and-with-eax: # (payload primitive) +27350 0x11/imm32/alloc-id:fake:payload +27351 # var/eax <- and lit => 25/and-with-eax lit/imm32 +27352 0x11/imm32/alloc-id:fake +27353 _string-and/imm32/name +27354 0x11/imm32/alloc-id:fake +27355 Single-lit-var/imm32/inouts +27356 0x11/imm32/alloc-id:fake +27357 Single-int-var-in-eax/imm32/outputs +27358 0x11/imm32/alloc-id:fake +27359 _string_25_and_with_eax/imm32/subx-name +27360 0/imm32/no-rm32 +27361 0/imm32/no-r32 +27362 1/imm32/imm32-is-first-inout +27363 0/imm32/no-imm8 +27364 0/imm32/no-disp32 +27365 0/imm32/no-xm32 +27366 0/imm32/no-x32 +27367 0x11/imm32/alloc-id:fake +27368 _Primitive-and-reg-with-reg/imm32/next +27369 _Primitive-and-reg-with-reg: # (payload primitive) +27370 0x11/imm32/alloc-id:fake:payload +27371 # var1/reg <- and var2/reg => 21/and-with var1/rm32 var2/r32 27372 0x11/imm32/alloc-id:fake -27373 _string_8a_copy_byte/imm32/subx-name -27374 1/imm32/rm32-is-first-inout -27375 3/imm32/r32-is-first-output -27376 0/imm32/no-imm32 -27377 0/imm32/no-imm8 -27378 0/imm32/no-disp32 -27379 0/imm32/no-xm32 -27380 0/imm32/no-x32 -27381 0x11/imm32/alloc-id:fake -27382 _Primitive-copy-byte-from-mem/imm32/next -27383 _Primitive-copy-byte-from-mem: -27384 0x11/imm32/alloc-id:fake:payload -27385 # var/reg <- copy-byte *var2/reg2 => 8a/byte-> *var2 var/r32 -27386 0x11/imm32/alloc-id:fake -27387 _string-copy-byte/imm32/name -27388 0x11/imm32/alloc-id:fake -27389 Single-byte-var-in-mem/imm32/inouts -27390 0x11/imm32/alloc-id:fake -27391 Single-byte-var-in-some-register/imm32/outputs +27373 _string-and/imm32/name +27374 0x11/imm32/alloc-id:fake +27375 Single-int-var-in-some-register/imm32/inouts +27376 0x11/imm32/alloc-id:fake +27377 Single-int-var-in-some-register/imm32/outputs +27378 0x11/imm32/alloc-id:fake +27379 _string_21_and_with/imm32/subx-name +27380 3/imm32/rm32-is-first-output +27381 1/imm32/r32-is-first-inout +27382 0/imm32/no-imm32 +27383 0/imm32/no-imm8 +27384 0/imm32/no-disp32 +27385 0/imm32/no-xm32 +27386 0/imm32/no-x32 +27387 0x11/imm32/alloc-id:fake +27388 _Primitive-and-reg-with-mem/imm32/next +27389 _Primitive-and-reg-with-mem: # (payload primitive) +27390 0x11/imm32/alloc-id:fake:payload +27391 # and-with var1 var2/reg => 21/and-with var1 var2/r32 27392 0x11/imm32/alloc-id:fake -27393 _string_8a_copy_byte/imm32/subx-name -27394 1/imm32/rm32-is-first-inout -27395 3/imm32/r32-is-first-output -27396 0/imm32/no-imm32 -27397 0/imm32/no-imm8 -27398 0/imm32/no-disp32 -27399 0/imm32/no-xm32 -27400 0/imm32/no-x32 -27401 0x11/imm32/alloc-id:fake -27402 _Primitive-copy-byte-to-mem/imm32/next -27403 _Primitive-copy-byte-to-mem: -27404 0x11/imm32/alloc-id:fake:payload -27405 # copy-byte-to *var1/reg1, var2/reg2 => 88/byte<- *reg1 reg2/r32 -27406 0x11/imm32/alloc-id:fake -27407 _string-copy-byte-to/imm32/name -27408 0x11/imm32/alloc-id:fake -27409 Two-args-byte-stack-byte-reg/imm32/inouts -27410 0/imm32/no-outputs -27411 0/imm32/no-outputs +27393 _string-and-with/imm32/name +27394 0x11/imm32/alloc-id:fake +27395 Two-args-int-stack-int-reg/imm32/inouts +27396 0/imm32/no-outputs +27397 0/imm32/no-outputs +27398 0x11/imm32/alloc-id:fake +27399 _string_21_and_with/imm32/subx-name +27400 1/imm32/rm32-is-first-inout +27401 2/imm32/r32-is-second-inout +27402 0/imm32/no-imm32 +27403 0/imm32/no-imm8 +27404 0/imm32/no-disp32 +27405 0/imm32/no-xm32 +27406 0/imm32/no-x32 +27407 0x11/imm32/alloc-id:fake +27408 _Primitive-and-mem-with-reg/imm32/next +27409 _Primitive-and-mem-with-reg: # (payload primitive) +27410 0x11/imm32/alloc-id:fake:payload +27411 # var1/reg <- and var2 => 23/and var2/rm32 var1/r32 27412 0x11/imm32/alloc-id:fake -27413 _string_88_copy_byte/imm32/subx-name -27414 1/imm32/rm32-is-first-inout -27415 2/imm32/r32-is-second-inout -27416 0/imm32/no-imm32 -27417 0/imm32/no-imm8 -27418 0/imm32/no-disp32 -27419 0/imm32/no-xm32 -27420 0/imm32/no-x32 -27421 0x11/imm32/alloc-id:fake -27422 _Primitive-address/imm32/next -27423 # - address -27424 _Primitive-address: # (payload primitive) -27425 0x11/imm32/alloc-id:fake:payload -27426 # var1/reg <- address var2 => 8d/copy-address var2/rm32 var1/r32 +27413 _string-and/imm32/name +27414 0x11/imm32/alloc-id:fake +27415 Single-int-var-in-mem/imm32/inouts +27416 0x11/imm32/alloc-id:fake +27417 Single-int-var-in-some-register/imm32/outputs +27418 0x11/imm32/alloc-id:fake +27419 _string_23_and/imm32/subx-name +27420 1/imm32/rm32-is-first-inout +27421 3/imm32/r32-is-first-output +27422 0/imm32/no-imm32 +27423 0/imm32/no-imm8 +27424 0/imm32/no-disp32 +27425 0/imm32/no-xm32 +27426 0/imm32/no-x32 27427 0x11/imm32/alloc-id:fake -27428 _string-address/imm32/name -27429 0x11/imm32/alloc-id:fake -27430 Single-int-var-in-mem/imm32/inouts -27431 0x11/imm32/alloc-id:fake -27432 Single-addr-var-in-some-register/imm32/outputs -27433 0x11/imm32/alloc-id:fake -27434 _string_8d_copy_address/imm32/subx-name -27435 1/imm32/rm32-is-first-inout -27436 3/imm32/r32-is-first-output -27437 0/imm32/no-imm32 -27438 0/imm32/no-imm8 -27439 0/imm32/no-disp32 -27440 0/imm32/no-xm32 -27441 0/imm32/no-x32 -27442 0x11/imm32/alloc-id:fake -27443 _Primitive-compare-reg-with-reg/imm32/next -27444 # - compare -27445 _Primitive-compare-reg-with-reg: # (payload primitive) -27446 0x11/imm32/alloc-id:fake:payload -27447 # compare var1/reg1 var2/reg2 => 39/compare var1/rm32 var2/r32 -27448 0x11/imm32/alloc-id:fake -27449 _string-compare/imm32/name -27450 0x11/imm32/alloc-id:fake -27451 Two-int-args-in-regs/imm32/inouts -27452 0/imm32/no-outputs -27453 0/imm32/no-outputs +27428 _Primitive-and-lit-with-reg/imm32/next +27429 _Primitive-and-lit-with-reg: # (payload primitive) +27430 0x11/imm32/alloc-id:fake:payload +27431 # var1/reg <- and lit => 81 4/subop/and var1/rm32 lit/imm32 +27432 0x11/imm32/alloc-id:fake +27433 _string-and/imm32/name +27434 0x11/imm32/alloc-id:fake +27435 Single-lit-var/imm32/inouts +27436 0x11/imm32/alloc-id:fake +27437 Single-int-var-in-some-register/imm32/outputs +27438 0x11/imm32/alloc-id:fake +27439 _string_81_subop_and/imm32/subx-name +27440 3/imm32/rm32-is-first-output +27441 0/imm32/no-r32 +27442 1/imm32/imm32-is-first-inout +27443 0/imm32/no-imm8 +27444 0/imm32/no-disp32 +27445 0/imm32/no-xm32 +27446 0/imm32/no-x32 +27447 0x11/imm32/alloc-id:fake +27448 _Primitive-and-lit-with-mem/imm32/next +27449 _Primitive-and-lit-with-mem: # (payload primitive) +27450 0x11/imm32/alloc-id:fake:payload +27451 # and-with var1, lit => 81 4/subop/and var1/rm32 lit/imm32 +27452 0x11/imm32/alloc-id:fake +27453 _string-and-with/imm32/name 27454 0x11/imm32/alloc-id:fake -27455 _string_39_compare->/imm32/subx-name -27456 1/imm32/rm32-is-first-inout -27457 2/imm32/r32-is-second-inout -27458 0/imm32/no-imm32 -27459 0/imm32/no-imm8 -27460 0/imm32/no-disp32 -27461 0/imm32/no-xm32 -27462 0/imm32/no-x32 -27463 0x11/imm32/alloc-id:fake -27464 _Primitive-compare-mem-with-reg/imm32/next -27465 _Primitive-compare-mem-with-reg: # (payload primitive) -27466 0x11/imm32/alloc-id:fake:payload -27467 # compare var1 var2/reg => 39/compare var1/rm32 var2/r32 -27468 0x11/imm32/alloc-id:fake -27469 _string-compare/imm32/name -27470 0x11/imm32/alloc-id:fake -27471 Two-args-int-stack-int-reg/imm32/inouts -27472 0/imm32/no-outputs -27473 0/imm32/no-outputs -27474 0x11/imm32/alloc-id:fake -27475 _string_39_compare->/imm32/subx-name -27476 1/imm32/rm32-is-first-inout -27477 2/imm32/r32-is-second-inout -27478 0/imm32/no-imm32 -27479 0/imm32/no-imm8 -27480 0/imm32/no-disp32 -27481 0/imm32/no-xm32 -27482 0/imm32/no-x32 -27483 0x11/imm32/alloc-id:fake -27484 _Primitive-compare-reg-with-mem/imm32/next -27485 _Primitive-compare-reg-with-mem: # (payload primitive) -27486 0x11/imm32/alloc-id:fake:payload -27487 # compare var1/reg var2 => 3b/compare<- var2/rm32 var1/r32 +27455 Int-var-and-literal/imm32/inouts +27456 0/imm32/no-outputs +27457 0/imm32/no-outputs +27458 0x11/imm32/alloc-id:fake +27459 _string_81_subop_and/imm32/subx-name +27460 1/imm32/rm32-is-first-inout +27461 0/imm32/no-r32 +27462 2/imm32/imm32-is-second-inout +27463 0/imm32/no-imm8 +27464 0/imm32/no-disp32 +27465 0/imm32/no-xm32 +27466 0/imm32/no-x32 +27467 0x11/imm32/alloc-id:fake +27468 _Primitive-or-with-eax/imm32/next +27469 # - or +27470 _Primitive-or-with-eax: # (payload primitive) +27471 0x11/imm32/alloc-id:fake:payload +27472 # var/eax <- or lit => 0d/or-with-eax lit/imm32 +27473 0x11/imm32/alloc-id:fake +27474 _string-or/imm32/name +27475 0x11/imm32/alloc-id:fake +27476 Single-lit-var/imm32/inouts +27477 0x11/imm32/alloc-id:fake +27478 Single-int-var-in-eax/imm32/outputs +27479 0x11/imm32/alloc-id:fake +27480 _string_0d_or_with_eax/imm32/subx-name +27481 0/imm32/no-rm32 +27482 0/imm32/no-r32 +27483 1/imm32/imm32-is-first-inout +27484 0/imm32/no-imm8 +27485 0/imm32/no-disp32 +27486 0/imm32/no-xm32 +27487 0/imm32/no-x32 27488 0x11/imm32/alloc-id:fake -27489 _string-compare/imm32/name -27490 0x11/imm32/alloc-id:fake -27491 Two-args-int-reg-int-stack/imm32/inouts -27492 0/imm32/no-outputs -27493 0/imm32/no-outputs -27494 0x11/imm32/alloc-id:fake -27495 _string_3b_compare<-/imm32/subx-name -27496 2/imm32/rm32-is-second-inout -27497 1/imm32/r32-is-first-inout -27498 0/imm32/no-imm32 -27499 0/imm32/no-imm8 -27500 0/imm32/no-disp32 -27501 0/imm32/no-xm32 -27502 0/imm32/no-x32 -27503 0x11/imm32/alloc-id:fake -27504 _Primitive-compare-eax-with-literal/imm32/next -27505 _Primitive-compare-eax-with-literal: # (payload primitive) -27506 0x11/imm32/alloc-id:fake:payload -27507 # compare var1/eax n => 3d/compare-eax-with n/imm32 +27489 _Primitive-or-reg-with-reg/imm32/next +27490 _Primitive-or-reg-with-reg: # (payload primitive) +27491 0x11/imm32/alloc-id:fake:payload +27492 # var1/reg <- or var2/reg => 09/or-with var1/rm32 var2/r32 +27493 0x11/imm32/alloc-id:fake +27494 _string-or/imm32/name +27495 0x11/imm32/alloc-id:fake +27496 Single-int-var-in-some-register/imm32/inouts +27497 0x11/imm32/alloc-id:fake +27498 Single-int-var-in-some-register/imm32/outputs +27499 0x11/imm32/alloc-id:fake +27500 _string_09_or_with/imm32/subx-name +27501 3/imm32/rm32-is-first-output +27502 1/imm32/r32-is-first-inout +27503 0/imm32/no-imm32 +27504 0/imm32/no-imm8 +27505 0/imm32/no-disp32 +27506 0/imm32/no-xm32 +27507 0/imm32/no-x32 27508 0x11/imm32/alloc-id:fake -27509 _string-compare/imm32/name -27510 0x11/imm32/alloc-id:fake -27511 Two-args-int-eax-int-literal/imm32/inouts -27512 0/imm32/no-outputs -27513 0/imm32/no-outputs -27514 0x11/imm32/alloc-id:fake -27515 _string_3d_compare_eax_with/imm32/subx-name -27516 0/imm32/no-rm32 -27517 0/imm32/no-r32 -27518 2/imm32/imm32-is-second-inout -27519 0/imm32/no-imm8 -27520 0/imm32/no-disp32 -27521 0/imm32/no-xm32 -27522 0/imm32/no-x32 -27523 0x11/imm32/alloc-id:fake -27524 _Primitive-compare-reg-with-literal/imm32/next -27525 _Primitive-compare-reg-with-literal: # (payload primitive) -27526 0x11/imm32/alloc-id:fake:payload -27527 # compare var1/reg n => 81 7/subop/compare %reg n/imm32 +27509 _Primitive-or-reg-with-mem/imm32/next +27510 _Primitive-or-reg-with-mem: # (payload primitive) +27511 0x11/imm32/alloc-id:fake:payload +27512 # or-with var1 var2/reg => 09/or-with var1 var2/r32 +27513 0x11/imm32/alloc-id:fake +27514 _string-or-with/imm32/name +27515 0x11/imm32/alloc-id:fake +27516 Two-args-int-stack-int-reg/imm32/inouts +27517 0/imm32/no-outputs +27518 0/imm32/no-outputs +27519 0x11/imm32/alloc-id:fake +27520 _string_09_or_with/imm32/subx-name +27521 1/imm32/rm32-is-first-inout +27522 2/imm32/r32-is-second-inout +27523 0/imm32/no-imm32 +27524 0/imm32/no-imm8 +27525 0/imm32/no-disp32 +27526 0/imm32/no-xm32 +27527 0/imm32/no-x32 27528 0x11/imm32/alloc-id:fake -27529 _string-compare/imm32/name -27530 0x11/imm32/alloc-id:fake -27531 Int-var-in-register-and-literal/imm32/inouts -27532 0/imm32/no-outputs -27533 0/imm32/no-outputs -27534 0x11/imm32/alloc-id:fake -27535 _string_81_subop_compare/imm32/subx-name -27536 1/imm32/rm32-is-first-inout -27537 0/imm32/no-r32 -27538 2/imm32/imm32-is-second-inout -27539 0/imm32/no-imm8 -27540 0/imm32/no-disp32 -27541 0/imm32/no-xm32 -27542 0/imm32/no-x32 -27543 0x11/imm32/alloc-id:fake -27544 _Primitive-compare-mem-with-literal/imm32/next -27545 _Primitive-compare-mem-with-literal: # (payload primitive) -27546 0x11/imm32/alloc-id:fake:payload -27547 # compare var1 n => 81 7/subop/compare *(ebp+___) n/imm32 +27529 _Primitive-or-mem-with-reg/imm32/next +27530 _Primitive-or-mem-with-reg: # (payload primitive) +27531 0x11/imm32/alloc-id:fake:payload +27532 # var1/reg <- or var2 => 0b/or var2/rm32 var1/r32 +27533 0x11/imm32/alloc-id:fake +27534 _string-or/imm32/name +27535 0x11/imm32/alloc-id:fake +27536 Single-int-var-in-mem/imm32/inouts +27537 0x11/imm32/alloc-id:fake +27538 Single-int-var-in-some-register/imm32/outputs +27539 0x11/imm32/alloc-id:fake +27540 _string_0b_or/imm32/subx-name +27541 1/imm32/rm32-is-first-inout +27542 3/imm32/r32-is-first-output +27543 0/imm32/no-imm32 +27544 0/imm32/no-imm8 +27545 0/imm32/no-disp32 +27546 0/imm32/no-xm32 +27547 0/imm32/no-x32 27548 0x11/imm32/alloc-id:fake -27549 _string-compare/imm32/name -27550 0x11/imm32/alloc-id:fake -27551 Int-var-and-literal/imm32/inouts -27552 0/imm32/no-outputs -27553 0/imm32/no-outputs -27554 0x11/imm32/alloc-id:fake -27555 _string_81_subop_compare/imm32/subx-name -27556 1/imm32/rm32-is-first-inout -27557 0/imm32/no-r32 -27558 2/imm32/imm32-is-second-inout -27559 0/imm32/no-imm8 -27560 0/imm32/no-disp32 -27561 0/imm32/no-xm32 -27562 0/imm32/no-x32 -27563 0x11/imm32/alloc-id:fake -27564 _Primitive-negate-reg/imm32/next -27565 # - negate -27566 _Primitive-negate-reg: # (payload primitive) -27567 0x11/imm32/alloc-id:fake:payload -27568 # var1/reg <- negate => f7 3/subop/negate var1/rm32 -27569 0x11/imm32/alloc-id:fake -27570 _string-negate/imm32/name -27571 0/imm32/no-inouts -27572 0/imm32/no-inouts +27549 _Primitive-or-lit-with-reg/imm32/next +27550 _Primitive-or-lit-with-reg: # (payload primitive) +27551 0x11/imm32/alloc-id:fake:payload +27552 # var1/reg <- or lit => 81 1/subop/or var1/rm32 lit/imm32 +27553 0x11/imm32/alloc-id:fake +27554 _string-or/imm32/name +27555 0x11/imm32/alloc-id:fake +27556 Single-lit-var/imm32/inouts +27557 0x11/imm32/alloc-id:fake +27558 Single-int-var-in-some-register/imm32/outputs +27559 0x11/imm32/alloc-id:fake +27560 _string_81_subop_or/imm32/subx-name +27561 3/imm32/rm32-is-first-output +27562 0/imm32/no-r32 +27563 1/imm32/imm32-is-first-inout +27564 0/imm32/no-imm8 +27565 0/imm32/no-disp32 +27566 0/imm32/no-xm32 +27567 0/imm32/no-x32 +27568 0x11/imm32/alloc-id:fake +27569 _Primitive-or-lit-with-mem/imm32/next +27570 _Primitive-or-lit-with-mem: # (payload primitive) +27571 0x11/imm32/alloc-id:fake:payload +27572 # or-with var1, lit => 81 1/subop/or var1/rm32 lit/imm32 27573 0x11/imm32/alloc-id:fake -27574 Single-int-var-in-some-register/imm32/outputs +27574 _string-or-with/imm32/name 27575 0x11/imm32/alloc-id:fake -27576 _string_f7_subop_negate/imm32/subx-name -27577 3/imm32/rm32-is-first-output -27578 0/imm32/no-r32 -27579 0/imm32/no-imm32 -27580 0/imm32/no-imm8 -27581 0/imm32/no-disp32 -27582 0/imm32/no-xm32 -27583 0/imm32/no-x32 -27584 0x11/imm32/alloc-id:fake -27585 _Primitive-negate-mem/imm32/next -27586 _Primitive-negate-mem: # (payload primitive) -27587 0x11/imm32/alloc-id:fake:payload -27588 # negate var1 => f7 3/subop/negate var1/rm32 -27589 0x11/imm32/alloc-id:fake -27590 _string-negate/imm32/name -27591 0x11/imm32/alloc-id:fake -27592 Single-int-var-in-mem/imm32/inouts -27593 0/imm32/no-outputs -27594 0/imm32/no-outputs -27595 0x11/imm32/alloc-id:fake -27596 _string_f7_subop_negate/imm32/subx-name -27597 1/imm32/rm32-is-first-inout -27598 0/imm32/no-r32 -27599 0/imm32/no-imm32 -27600 0/imm32/no-imm8 -27601 0/imm32/no-disp32 -27602 0/imm32/no-xm32 -27603 0/imm32/no-x32 -27604 0x11/imm32/alloc-id:fake -27605 _Primitive-multiply-reg-by-reg/imm32/next -27606 # - multiply -27607 _Primitive-multiply-reg-by-reg: # (payload primitive) -27608 0x11/imm32/alloc-id:fake:payload -27609 # var1/reg <- multiply var2 => 0f af/multiply var2/rm32 var1/r32 -27610 0x11/imm32/alloc-id:fake -27611 _string-multiply/imm32/name -27612 0x11/imm32/alloc-id:fake -27613 Single-int-var-in-some-register/imm32/inouts +27576 Int-var-and-literal/imm32/inouts +27577 0/imm32/no-outputs +27578 0/imm32/no-outputs +27579 0x11/imm32/alloc-id:fake +27580 _string_81_subop_or/imm32/subx-name +27581 1/imm32/rm32-is-first-inout +27582 0/imm32/no-r32 +27583 2/imm32/imm32-is-second-inout +27584 0/imm32/no-imm8 +27585 0/imm32/no-disp32 +27586 0/imm32/no-xm32 +27587 0/imm32/no-x32 +27588 0x11/imm32/alloc-id:fake +27589 _Primitive-xor-with-eax/imm32/next +27590 # - xor +27591 _Primitive-xor-with-eax: # (payload primitive) +27592 0x11/imm32/alloc-id:fake:payload +27593 # var/eax <- xor lit => 35/xor-with-eax lit/imm32 +27594 0x11/imm32/alloc-id:fake +27595 _string-xor/imm32/name +27596 0x11/imm32/alloc-id:fake +27597 Single-lit-var/imm32/inouts +27598 0x11/imm32/alloc-id:fake +27599 Single-int-var-in-eax/imm32/outputs +27600 0x11/imm32/alloc-id:fake +27601 _string_35_xor_with_eax/imm32/subx-name +27602 0/imm32/no-rm32 +27603 0/imm32/no-r32 +27604 1/imm32/imm32-is-first-inout +27605 0/imm32/no-imm8 +27606 0/imm32/no-disp32 +27607 0/imm32/no-xm32 +27608 0/imm32/no-x32 +27609 0x11/imm32/alloc-id:fake +27610 _Primitive-xor-reg-with-reg/imm32/next +27611 _Primitive-xor-reg-with-reg: # (payload primitive) +27612 0x11/imm32/alloc-id:fake:payload +27613 # var1/reg <- xor var2/reg => 31/xor-with var1/rm32 var2/r32 27614 0x11/imm32/alloc-id:fake -27615 Single-int-var-in-some-register/imm32/outputs +27615 _string-xor/imm32/name 27616 0x11/imm32/alloc-id:fake -27617 _string_0f_af_multiply/imm32/subx-name -27618 1/imm32/rm32-is-first-inout -27619 3/imm32/r32-is-first-output -27620 0/imm32/no-imm32 -27621 0/imm32/no-imm8 -27622 0/imm32/no-disp32 -27623 0/imm32/no-xm32 -27624 0/imm32/no-x32 -27625 0x11/imm32/alloc-id:fake -27626 _Primitive-multiply-reg-by-mem/imm32/next -27627 _Primitive-multiply-reg-by-mem: # (payload primitive) -27628 0x11/imm32/alloc-id:fake:payload -27629 # var1/reg <- multiply var2 => 0f af/multiply var2/rm32 var1/r32 -27630 0x11/imm32/alloc-id:fake -27631 _string-multiply/imm32/name -27632 0x11/imm32/alloc-id:fake -27633 Single-int-var-in-mem/imm32/inouts +27617 Single-int-var-in-some-register/imm32/inouts +27618 0x11/imm32/alloc-id:fake +27619 Single-int-var-in-some-register/imm32/outputs +27620 0x11/imm32/alloc-id:fake +27621 _string_31_xor_with/imm32/subx-name +27622 3/imm32/rm32-is-first-output +27623 1/imm32/r32-is-first-inout +27624 0/imm32/no-imm32 +27625 0/imm32/no-imm8 +27626 0/imm32/no-disp32 +27627 0/imm32/no-xm32 +27628 0/imm32/no-x32 +27629 0x11/imm32/alloc-id:fake +27630 _Primitive-xor-reg-with-mem/imm32/next +27631 _Primitive-xor-reg-with-mem: # (payload primitive) +27632 0x11/imm32/alloc-id:fake:payload +27633 # xor-with var1 var2/reg => 31/xor-with var1 var2/r32 27634 0x11/imm32/alloc-id:fake -27635 Single-int-var-in-some-register/imm32/outputs +27635 _string-xor-with/imm32/name 27636 0x11/imm32/alloc-id:fake -27637 _string_0f_af_multiply/imm32/subx-name -27638 1/imm32/rm32-is-first-inout -27639 3/imm32/r32-is-first-output -27640 0/imm32/no-imm32 -27641 0/imm32/no-imm8 -27642 0/imm32/no-disp32 -27643 0/imm32/no-xm32 -27644 0/imm32/no-x32 -27645 0x11/imm32/alloc-id:fake -27646 _Primitive-convert-mem-to-xreg/imm32/next -27647 # - convert int to floating point -27648 _Primitive-convert-mem-to-xreg: # (payload primitive) -27649 0x11/imm32/alloc-id:fake:payload -27650 # var1/xreg <- convert var2 => f3 0f 2a/convert-to-float var2/rm32 var1/x32 -27651 0x11/imm32/alloc-id:fake -27652 _string-convert/imm32/name -27653 0x11/imm32/alloc-id:fake -27654 Single-int-var-in-mem/imm32/inouts -27655 0x11/imm32/alloc-id:fake -27656 Single-float-var-in-some-register/imm32/outputs -27657 0x11/imm32/alloc-id:fake -27658 _string_f3_0f_2a_convert_to_float/imm32/subx-name -27659 1/imm32/rm32-is-first-inout -27660 0/imm32/no-r32 -27661 0/imm32/no-imm32 -27662 0/imm32/no-imm8 -27663 0/imm32/no-disp32 -27664 0/imm32/no-xm32 -27665 3/imm32/x32-is-first-output -27666 0x11/imm32/alloc-id:fake -27667 _Primitive-convert-reg-to-xreg/imm32/next -27668 _Primitive-convert-reg-to-xreg: # (payload primitive) -27669 0x11/imm32/alloc-id:fake:payload -27670 # var1/xreg <- convert var2/reg => f3 0f 2a/convert-to-float var2/rm32 var1/x32 -27671 0x11/imm32/alloc-id:fake -27672 _string-convert/imm32/name -27673 0x11/imm32/alloc-id:fake -27674 Single-int-var-in-some-register/imm32/inouts -27675 0x11/imm32/alloc-id:fake -27676 Single-float-var-in-some-register/imm32/outputs -27677 0x11/imm32/alloc-id:fake -27678 _string_f3_0f_2a_convert_to_float/imm32/subx-name -27679 1/imm32/rm32-is-first-inout -27680 0/imm32/no-r32 -27681 0/imm32/no-imm32 -27682 0/imm32/no-imm8 -27683 0/imm32/no-disp32 -27684 0/imm32/no-xm32 -27685 3/imm32/x32-is-first-output -27686 0x11/imm32/alloc-id:fake -27687 _Primitive-convert-xmem-to-reg/imm32/next -27688 # - convert floating point to int -27689 _Primitive-convert-xmem-to-reg: # (payload primitive) -27690 0x11/imm32/alloc-id:fake:payload -27691 # var1/reg <- convert var2 => f3 0f 2d/convert-to-int var2/xm32 var1/r32 -27692 0x11/imm32/alloc-id:fake -27693 _string-convert/imm32/name +27637 Two-args-int-stack-int-reg/imm32/inouts +27638 0/imm32/no-outputs +27639 0/imm32/no-outputs +27640 0x11/imm32/alloc-id:fake +27641 _string_31_xor_with/imm32/subx-name +27642 1/imm32/rm32-is-first-inout +27643 2/imm32/r32-is-second-inout +27644 0/imm32/no-imm32 +27645 0/imm32/no-imm8 +27646 0/imm32/no-disp32 +27647 0/imm32/no-xm32 +27648 0/imm32/no-x32 +27649 0x11/imm32/alloc-id:fake +27650 _Primitive-xor-mem-with-reg/imm32/next +27651 _Primitive-xor-mem-with-reg: # (payload primitive) +27652 0x11/imm32/alloc-id:fake:payload +27653 # var1/reg <- xor var2 => 33/xor var2/rm32 var1/r32 +27654 0x11/imm32/alloc-id:fake +27655 _string-xor/imm32/name +27656 0x11/imm32/alloc-id:fake +27657 Single-int-var-in-mem/imm32/inouts +27658 0x11/imm32/alloc-id:fake +27659 Single-int-var-in-some-register/imm32/outputs +27660 0x11/imm32/alloc-id:fake +27661 _string_33_xor/imm32/subx-name +27662 1/imm32/rm32-is-first-inout +27663 3/imm32/r32-is-first-output +27664 0/imm32/no-imm32 +27665 0/imm32/no-imm8 +27666 0/imm32/no-disp32 +27667 0/imm32/no-xm32 +27668 0/imm32/no-x32 +27669 0x11/imm32/alloc-id:fake +27670 _Primitive-xor-lit-with-reg/imm32/next +27671 _Primitive-xor-lit-with-reg: # (payload primitive) +27672 0x11/imm32/alloc-id:fake:payload +27673 # var1/reg <- xor lit => 81 6/subop/xor var1/rm32 lit/imm32 +27674 0x11/imm32/alloc-id:fake +27675 _string-xor/imm32/name +27676 0x11/imm32/alloc-id:fake +27677 Single-lit-var/imm32/inouts +27678 0x11/imm32/alloc-id:fake +27679 Single-int-var-in-some-register/imm32/outputs +27680 0x11/imm32/alloc-id:fake +27681 _string_81_subop_xor/imm32/subx-name +27682 3/imm32/rm32-is-first-output +27683 0/imm32/no-r32 +27684 1/imm32/imm32-is-first-inout +27685 0/imm32/no-imm8 +27686 0/imm32/no-disp32 +27687 0/imm32/no-xm32 +27688 0/imm32/no-x32 +27689 0x11/imm32/alloc-id:fake +27690 _Primitive-xor-lit-with-mem/imm32/next +27691 _Primitive-xor-lit-with-mem: # (payload primitive) +27692 0x11/imm32/alloc-id:fake:payload +27693 # xor-with var1, lit => 81 6/subop/xor var1/rm32 lit/imm32 27694 0x11/imm32/alloc-id:fake -27695 Single-float-var-in-mem/imm32/inouts +27695 _string-xor-with/imm32/name 27696 0x11/imm32/alloc-id:fake -27697 Single-int-var-in-some-register/imm32/outputs -27698 0x11/imm32/alloc-id:fake -27699 _string_f3_0f_2d_convert_to_int/imm32/subx-name -27700 0/imm32/no-rm32 -27701 3/imm32/r32-is-first-output -27702 0/imm32/no-imm32 -27703 0/imm32/no-imm8 -27704 0/imm32/no-disp32 -27705 1/imm32/xm32-is-first-inout -27706 0/imm32/no-x32 -27707 0x11/imm32/alloc-id:fake -27708 _Primitive-convert-xreg-to-reg/imm32/next -27709 _Primitive-convert-xreg-to-reg: # (payload primitive) -27710 0x11/imm32/alloc-id:fake:payload -27711 # var1/reg <- convert var2/xreg => f3 0f 2d/convert-to-int var2/xm32 var1/r32 -27712 0x11/imm32/alloc-id:fake -27713 _string-convert/imm32/name +27697 Int-var-and-literal/imm32/inouts +27698 0/imm32/no-outputs +27699 0/imm32/no-outputs +27700 0x11/imm32/alloc-id:fake +27701 _string_81_subop_xor/imm32/subx-name +27702 1/imm32/rm32-is-first-inout +27703 0/imm32/no-r32 +27704 2/imm32/imm32-is-second-inout +27705 0/imm32/no-imm8 +27706 0/imm32/no-disp32 +27707 0/imm32/no-xm32 +27708 0/imm32/no-x32 +27709 0x11/imm32/alloc-id:fake +27710 _Primitive-shift-reg-left-by-lit/imm32/next +27711 _Primitive-shift-reg-left-by-lit: # (payload primitive) +27712 0x11/imm32/alloc-id:fake:payload +27713 # var1/reg <- shift-left lit => c1/shift 4/subop/left var1/rm32 lit/imm32 27714 0x11/imm32/alloc-id:fake -27715 Single-float-var-in-some-register/imm32/inouts +27715 _string-shift-left/imm32/name 27716 0x11/imm32/alloc-id:fake -27717 Single-int-var-in-some-register/imm32/outputs +27717 Single-lit-var/imm32/inouts 27718 0x11/imm32/alloc-id:fake -27719 _string_f3_0f_2d_convert_to_int/imm32/subx-name -27720 0/imm32/no-rm32 -27721 3/imm32/r32-is-first-output -27722 0/imm32/no-imm32 -27723 0/imm32/no-imm8 -27724 0/imm32/no-disp32 -27725 1/imm32/xm32-is-first-inout -27726 0/imm32/no-x32 -27727 0x11/imm32/alloc-id:fake -27728 _Primitive-truncate-xmem-to-reg/imm32/next -27729 _Primitive-truncate-xmem-to-reg: # (payload primitive) -27730 0x11/imm32/alloc-id:fake:payload -27731 # var1/reg <- truncate var2 => f3 0f 2c/truncate-to-int var2/xm32 var1/r32 -27732 0x11/imm32/alloc-id:fake -27733 _string-truncate/imm32/name +27719 Single-int-var-in-some-register/imm32/outputs +27720 0x11/imm32/alloc-id:fake +27721 _string_c1_subop_shift_left/imm32/subx-name +27722 3/imm32/rm32-is-first-output +27723 0/imm32/no-r32 +27724 0/imm32/no-imm32 +27725 1/imm32/imm8-is-first-inout +27726 0/imm32/no-disp32 +27727 0/imm32/no-xm32 +27728 0/imm32/no-x32 +27729 0x11/imm32/alloc-id:fake +27730 _Primitive-shift-reg-right-by-lit/imm32/next +27731 _Primitive-shift-reg-right-by-lit: # (payload primitive) +27732 0x11/imm32/alloc-id:fake:payload +27733 # var1/reg <- shift-right lit => c1/shift 5/subop/right var1/rm32 lit/imm32 27734 0x11/imm32/alloc-id:fake -27735 Single-float-var-in-mem/imm32/inouts +27735 _string-shift-right/imm32/name 27736 0x11/imm32/alloc-id:fake -27737 Single-int-var-in-some-register/imm32/outputs +27737 Single-lit-var/imm32/inouts 27738 0x11/imm32/alloc-id:fake -27739 _string_f3_0f_2c_truncate_to_int/imm32/subx-name -27740 0/imm32/no-rm32 -27741 3/imm32/r32-is-first-output -27742 0/imm32/no-imm32 -27743 0/imm32/no-imm8 -27744 0/imm32/no-disp32 -27745 1/imm32/xm32-is-first-inout -27746 0/imm32/no-x32 -27747 0x11/imm32/alloc-id:fake -27748 _Primitive-truncate-xreg-to-reg/imm32/next -27749 _Primitive-truncate-xreg-to-reg: # (payload primitive) -27750 0x11/imm32/alloc-id:fake:payload -27751 # var1/reg <- truncate var2/xreg => f3 0f 2c/truncate-to-int var2/xm32 var1/r32 -27752 0x11/imm32/alloc-id:fake -27753 _string-truncate/imm32/name +27739 Single-int-var-in-some-register/imm32/outputs +27740 0x11/imm32/alloc-id:fake +27741 _string_c1_subop_shift_right_padding_zeroes/imm32/subx-name +27742 3/imm32/rm32-is-first-output +27743 0/imm32/no-r32 +27744 0/imm32/no-imm32 +27745 1/imm32/imm8-is-first-inout +27746 0/imm32/no-disp32 +27747 0/imm32/no-xm32 +27748 0/imm32/no-x32 +27749 0x11/imm32/alloc-id:fake +27750 _Primitive-shift-reg-right-signed-by-lit/imm32/next +27751 _Primitive-shift-reg-right-signed-by-lit: # (payload primitive) +27752 0x11/imm32/alloc-id:fake:payload +27753 # var1/reg <- shift-right-signed lit => c1/shift 7/subop/right-preserving-sign var1/rm32 lit/imm32 27754 0x11/imm32/alloc-id:fake -27755 Single-float-var-in-some-register/imm32/inouts +27755 _string-shift-right-signed/imm32/name 27756 0x11/imm32/alloc-id:fake -27757 Single-int-var-in-some-register/imm32/outputs +27757 Single-lit-var/imm32/inouts 27758 0x11/imm32/alloc-id:fake -27759 _string_f3_0f_2c_truncate_to_int/imm32/subx-name -27760 0/imm32/no-rm32 -27761 3/imm32/r32-is-first-output -27762 0/imm32/no-imm32 -27763 0/imm32/no-imm8 -27764 0/imm32/no-disp32 -27765 1/imm32/xm32-is-first-inout -27766 0/imm32/no-x32 -27767 0x11/imm32/alloc-id:fake -27768 _Primitive-reinterpret-xmem-as-reg/imm32/next -27769 # - reinterpret bytes (just for debugging) -27770 _Primitive-reinterpret-xmem-as-reg: # (payload primitive) -27771 0x11/imm32/alloc-id:fake:payload -27772 # var1/reg <- reinterpret var2 => 8b/-> var2/xm32 var1/r32 -27773 0x11/imm32/alloc-id:fake -27774 _string-reinterpret/imm32/name -27775 0x11/imm32/alloc-id:fake -27776 Single-float-var-in-mem/imm32/inouts -27777 0x11/imm32/alloc-id:fake -27778 Single-int-var-in-some-register/imm32/outputs -27779 0x11/imm32/alloc-id:fake -27780 _string_8b_->/imm32/subx-name -27781 0/imm32/no-rm32 -27782 3/imm32/r32-is-first-output -27783 0/imm32/no-imm32 -27784 0/imm32/no-imm8 -27785 0/imm32/no-disp32 -27786 1/imm32/xm32-is-first-inout -27787 0/imm32/no-x32 -27788 0x11/imm32/alloc-id:fake -27789 _Primitive-reinterpret-mem-as-xreg/imm32/next -27790 _Primitive-reinterpret-mem-as-xreg: # (payload primitive) -27791 0x11/imm32/alloc-id:fake:payload -27792 # var1/xreg <- reinterpret var2 => f3 0f 10/-> var2/rm32 var1/x32 -27793 0x11/imm32/alloc-id:fake -27794 _string-reinterpret/imm32/name -27795 0x11/imm32/alloc-id:fake -27796 Single-int-var-in-mem/imm32/inouts -27797 0x11/imm32/alloc-id:fake -27798 Single-float-var-in-some-register/imm32/outputs -27799 0x11/imm32/alloc-id:fake -27800 _string_f3_0f_10_copy/imm32/subx-name -27801 1/imm32/rm32-is-first-inout -27802 0/imm32/no-r32 -27803 0/imm32/no-imm32 -27804 0/imm32/no-imm8 -27805 0/imm32/no-disp32 -27806 0/imm32/no-xm32 -27807 3/imm32/x32-is-first-output -27808 0x11/imm32/alloc-id:fake -27809 _Primitive-copy-xreg-to-xreg/imm32/next -27810 # - floating-point copy -27811 _Primitive-copy-xreg-to-xreg: # (payload primitive) +27759 Single-int-var-in-some-register/imm32/outputs +27760 0x11/imm32/alloc-id:fake +27761 _string_c1_subop_shift_right_preserving_sign/imm32/subx-name +27762 3/imm32/rm32-is-first-output +27763 0/imm32/no-r32 +27764 0/imm32/no-imm32 +27765 1/imm32/imm8-is-first-inout +27766 0/imm32/no-disp32 +27767 0/imm32/no-xm32 +27768 0/imm32/no-x32 +27769 0x11/imm32/alloc-id:fake +27770 _Primitive-shift-mem-left-by-lit/imm32/next +27771 _Primitive-shift-mem-left-by-lit: # (payload primitive) +27772 0x11/imm32/alloc-id:fake:payload +27773 # shift-left var1, lit => c1/shift 4/subop/left var1/rm32 lit/imm32 +27774 0x11/imm32/alloc-id:fake +27775 _string-shift-left/imm32/name +27776 0x11/imm32/alloc-id:fake +27777 Int-var-and-literal/imm32/inouts +27778 0/imm32/no-outputs +27779 0/imm32/no-outputs +27780 0x11/imm32/alloc-id:fake +27781 _string_c1_subop_shift_left/imm32/subx-name +27782 1/imm32/rm32-is-first-inout +27783 0/imm32/no-r32 +27784 0/imm32/no-imm32 +27785 2/imm32/imm8-is-second-inout +27786 0/imm32/no-disp32 +27787 0/imm32/no-xm32 +27788 0/imm32/no-x32 +27789 0x11/imm32/alloc-id:fake +27790 _Primitive-shift-mem-right-by-lit/imm32/next +27791 _Primitive-shift-mem-right-by-lit: # (payload primitive) +27792 0x11/imm32/alloc-id:fake:payload +27793 # shift-right var1, lit => c1/shift 5/subop/right var1/rm32 lit/imm32 +27794 0x11/imm32/alloc-id:fake +27795 _string-shift-right/imm32/name +27796 0x11/imm32/alloc-id:fake +27797 Int-var-and-literal/imm32/inouts +27798 0/imm32/no-outputs +27799 0/imm32/no-outputs +27800 0x11/imm32/alloc-id:fake +27801 _string_c1_subop_shift_right_padding_zeroes/imm32/subx-name +27802 1/imm32/rm32-is-first-inout +27803 0/imm32/no-r32 +27804 0/imm32/no-imm32 +27805 2/imm32/imm8-is-second-inout +27806 0/imm32/no-disp32 +27807 0/imm32/no-xm32 +27808 0/imm32/no-x32 +27809 0x11/imm32/alloc-id:fake +27810 _Primitive-shift-mem-right-signed-by-lit/imm32/next +27811 _Primitive-shift-mem-right-signed-by-lit: # (payload primitive) 27812 0x11/imm32/alloc-id:fake:payload -27813 # var1/xreg <- copy var2/xreg => f3 0f 11/<- var1/xm32 var2/x32 +27813 # shift-right-signed var1, lit => c1/shift 7/subop/right-preserving-sign var1/rm32 lit/imm32 27814 0x11/imm32/alloc-id:fake -27815 _string-copy/imm32/name +27815 _string-shift-right-signed/imm32/name 27816 0x11/imm32/alloc-id:fake -27817 Single-float-var-in-some-register/imm32/inouts -27818 0x11/imm32/alloc-id:fake -27819 Single-float-var-in-some-register/imm32/outputs +27817 Int-var-and-literal/imm32/inouts +27818 0/imm32/no-outputs +27819 0/imm32/no-outputs 27820 0x11/imm32/alloc-id:fake -27821 _string_f3_0f_11_copy/imm32/subx-name -27822 0/imm32/no-rm32 +27821 _string_c1_subop_shift_right_preserving_sign/imm32/subx-name +27822 1/imm32/rm32-is-first-inout 27823 0/imm32/no-r32 27824 0/imm32/no-imm32 -27825 0/imm32/no-imm8 +27825 2/imm32/imm8-is-second-inout 27826 0/imm32/no-disp32 -27827 3/imm32/xm32-is-first-output -27828 1/imm32/x32-is-first-inout +27827 0/imm32/no-xm32 +27828 0/imm32/no-x32 27829 0x11/imm32/alloc-id:fake -27830 _Primitive-copy-xreg-to-mem/imm32/next -27831 _Primitive-copy-xreg-to-mem: # (payload primitive) -27832 0x11/imm32/alloc-id:fake:payload -27833 # copy-to var1 var2/xreg => f3 0f 11/<- var1 var2/x32 -27834 0x11/imm32/alloc-id:fake -27835 _string-copy-to/imm32/name -27836 0x11/imm32/alloc-id:fake -27837 Two-args-float-stack-float-reg/imm32/inouts -27838 0/imm32/no-outputs -27839 0/imm32/no-outputs -27840 0x11/imm32/alloc-id:fake -27841 _string_f3_0f_11_copy/imm32/subx-name -27842 0/imm32/no-rm32 -27843 0/imm32/no-r32 -27844 0/imm32/no-imm32 -27845 0/imm32/no-imm8 -27846 0/imm32/no-disp32 -27847 1/imm32/xm32-is-first-inout -27848 2/imm32/x32-is-second-inout -27849 0x11/imm32/alloc-id:fake -27850 _Primitive-copy-mem-to-xreg/imm32/next -27851 _Primitive-copy-mem-to-xreg: # (payload primitive) -27852 0x11/imm32/alloc-id:fake:payload -27853 # var1/xreg <- copy var2 => f3 0f 10/-> var2/rm32 var1/x32 -27854 0x11/imm32/alloc-id:fake -27855 _string-copy/imm32/name -27856 0x11/imm32/alloc-id:fake -27857 Single-float-var-in-mem/imm32/inouts -27858 0x11/imm32/alloc-id:fake -27859 Single-float-var-in-some-register/imm32/outputs -27860 0x11/imm32/alloc-id:fake -27861 _string_f3_0f_10_copy/imm32/subx-name -27862 0/imm32/no-rm32 -27863 0/imm32/no-r32 -27864 0/imm32/no-imm32 -27865 0/imm32/no-imm8 -27866 0/imm32/no-disp32 -27867 1/imm32/xm32-is-first-inout -27868 3/imm32/x32-is-first-output -27869 0x11/imm32/alloc-id:fake -27870 _Primitive-address-of-xmem/imm32/next -27871 # - floating-point-address -27872 _Primitive-address-of-xmem: # (payload primitive) +27830 _Primitive-copy-to-eax/imm32/next +27831 # - copy +27832 _Primitive-copy-to-eax: # (payload primitive) +27833 0x11/imm32/alloc-id:fake:payload +27834 # var/eax <- copy lit => b8/copy-to-eax lit/imm32 +27835 0x11/imm32/alloc-id:fake +27836 _string-copy/imm32/name +27837 0x11/imm32/alloc-id:fake +27838 Single-lit-var/imm32/inouts +27839 0x11/imm32/alloc-id:fake +27840 Single-int-var-in-eax/imm32/outputs +27841 0x11/imm32/alloc-id:fake +27842 _string_b8_copy_to_eax/imm32/subx-name +27843 0/imm32/no-rm32 +27844 0/imm32/no-r32 +27845 1/imm32/imm32-is-first-inout +27846 0/imm32/no-imm8 +27847 0/imm32/no-disp32 +27848 0/imm32/no-xm32 +27849 0/imm32/no-x32 +27850 0x11/imm32/alloc-id:fake +27851 _Primitive-copy-to-ecx/imm32/next +27852 _Primitive-copy-to-ecx: # (payload primitive) +27853 0x11/imm32/alloc-id:fake:payload +27854 # var/ecx <- copy lit => b9/copy-to-ecx lit/imm32 +27855 0x11/imm32/alloc-id:fake +27856 _string-copy/imm32/name +27857 0x11/imm32/alloc-id:fake +27858 Single-lit-var/imm32/inouts +27859 0x11/imm32/alloc-id:fake +27860 Single-int-var-in-ecx/imm32/outputs +27861 0x11/imm32/alloc-id:fake +27862 _string_b9_copy_to_ecx/imm32/subx-name +27863 0/imm32/no-rm32 +27864 0/imm32/no-r32 +27865 1/imm32/imm32-is-first-inout +27866 0/imm32/no-imm8 +27867 0/imm32/no-disp32 +27868 0/imm32/no-xm32 +27869 0/imm32/no-x32 +27870 0x11/imm32/alloc-id:fake +27871 _Primitive-copy-to-edx/imm32/next +27872 _Primitive-copy-to-edx: # (payload primitive) 27873 0x11/imm32/alloc-id:fake:payload -27874 # var1/reg <- address var2 => 8d/copy-address var2/rm32 var1/r32 +27874 # var/edx <- copy lit => ba/copy-to-edx lit/imm32 27875 0x11/imm32/alloc-id:fake -27876 _string-address/imm32/name +27876 _string-copy/imm32/name 27877 0x11/imm32/alloc-id:fake -27878 Single-float-var-in-mem/imm32/inouts +27878 Single-lit-var/imm32/inouts 27879 0x11/imm32/alloc-id:fake -27880 Single-addr-var-in-some-register/imm32/outputs +27880 Single-int-var-in-edx/imm32/outputs 27881 0x11/imm32/alloc-id:fake -27882 _string_8d_copy_address/imm32/subx-name -27883 1/imm32/rm32-is-first-inout -27884 3/imm32/r32-is-first-output -27885 0/imm32/no-imm32 +27882 _string_ba_copy_to_edx/imm32/subx-name +27883 0/imm32/no-rm32 +27884 0/imm32/no-r32 +27885 1/imm32/imm32-is-first-inout 27886 0/imm32/no-imm8 27887 0/imm32/no-disp32 27888 0/imm32/no-xm32 27889 0/imm32/no-x32 27890 0x11/imm32/alloc-id:fake -27891 _Primitive-add-xreg-to-xreg/imm32/next -27892 # - floating-point add -27893 _Primitive-add-xreg-to-xreg: # (payload primitive) -27894 0x11/imm32/alloc-id:fake:payload -27895 # var1/xreg <- add var2/xreg => f3 0f 58/add var1/xm32 var2/x32 -27896 0x11/imm32/alloc-id:fake -27897 _string-add/imm32/name -27898 0x11/imm32/alloc-id:fake -27899 Single-float-var-in-some-register/imm32/inouts -27900 0x11/imm32/alloc-id:fake -27901 Single-float-var-in-some-register/imm32/outputs -27902 0x11/imm32/alloc-id:fake -27903 _string_f3_0f_58_add/imm32/subx-name -27904 0/imm32/no-rm32 -27905 0/imm32/no-r32 -27906 0/imm32/no-imm32 -27907 0/imm32/no-imm8 -27908 0/imm32/no-disp32 -27909 1/imm32/xm32-is-first-inout -27910 3/imm32/x32-is-first-output -27911 0x11/imm32/alloc-id:fake -27912 _Primitive-add-mem-to-xreg/imm32/next -27913 _Primitive-add-mem-to-xreg: # (payload primitive) -27914 0x11/imm32/alloc-id:fake:payload -27915 # var1/xreg <- add var2 => f3 0f 58/add var2/xm32 var1/x32 -27916 0x11/imm32/alloc-id:fake -27917 _string-add/imm32/name -27918 0x11/imm32/alloc-id:fake -27919 Single-float-var-in-mem/imm32/inouts -27920 0x11/imm32/alloc-id:fake -27921 Single-float-var-in-some-register/imm32/outputs -27922 0x11/imm32/alloc-id:fake -27923 _string_f3_0f_58_add/imm32/subx-name -27924 0/imm32/no-rm32 -27925 0/imm32/no-r32 -27926 0/imm32/no-imm32 -27927 0/imm32/no-imm8 -27928 0/imm32/no-disp32 -27929 1/imm32/xm32-is-first-inout -27930 3/imm32/x32-is-first-output -27931 0x11/imm32/alloc-id:fake -27932 _Primitive-subtract-xreg-from-xreg/imm32/next -27933 # - floating-point subtract -27934 _Primitive-subtract-xreg-from-xreg: # (payload primitive) -27935 0x11/imm32/alloc-id:fake:payload -27936 # var1/xreg <- subtract var2/xreg => f3 0f 5c/subtract var1/xm32 var2/x32 +27891 _Primitive-copy-to-ebx/imm32/next +27892 _Primitive-copy-to-ebx: # (payload primitive) +27893 0x11/imm32/alloc-id:fake:payload +27894 # var/ebx <- copy lit => bb/copy-to-ebx lit/imm32 +27895 0x11/imm32/alloc-id:fake +27896 _string-copy/imm32/name +27897 0x11/imm32/alloc-id:fake +27898 Single-lit-var/imm32/inouts +27899 0x11/imm32/alloc-id:fake +27900 Single-int-var-in-ebx/imm32/outputs +27901 0x11/imm32/alloc-id:fake +27902 _string_bb_copy_to_ebx/imm32/subx-name +27903 0/imm32/no-rm32 +27904 0/imm32/no-r32 +27905 1/imm32/imm32-is-first-inout +27906 0/imm32/no-imm8 +27907 0/imm32/no-disp32 +27908 0/imm32/no-xm32 +27909 0/imm32/no-x32 +27910 0x11/imm32/alloc-id:fake +27911 _Primitive-copy-to-esi/imm32/next +27912 _Primitive-copy-to-esi: # (payload primitive) +27913 0x11/imm32/alloc-id:fake:payload +27914 # var/esi <- copy lit => be/copy-to-esi lit/imm32 +27915 0x11/imm32/alloc-id:fake +27916 _string-copy/imm32/name +27917 0x11/imm32/alloc-id:fake +27918 Single-lit-var/imm32/inouts +27919 0x11/imm32/alloc-id:fake +27920 Single-int-var-in-esi/imm32/outputs +27921 0x11/imm32/alloc-id:fake +27922 _string_be_copy_to_esi/imm32/subx-name +27923 0/imm32/no-rm32 +27924 0/imm32/no-r32 +27925 1/imm32/imm32-is-first-inout +27926 0/imm32/no-imm8 +27927 0/imm32/no-disp32 +27928 0/imm32/no-xm32 +27929 0/imm32/no-x32 +27930 0x11/imm32/alloc-id:fake +27931 _Primitive-copy-to-edi/imm32/next +27932 _Primitive-copy-to-edi: # (payload primitive) +27933 0x11/imm32/alloc-id:fake:payload +27934 # var/edi <- copy lit => bf/copy-to-edi lit/imm32 +27935 0x11/imm32/alloc-id:fake +27936 _string-copy/imm32/name 27937 0x11/imm32/alloc-id:fake -27938 _string-subtract/imm32/name +27938 Single-lit-var/imm32/inouts 27939 0x11/imm32/alloc-id:fake -27940 Single-float-var-in-some-register/imm32/inouts +27940 Single-int-var-in-edi/imm32/outputs 27941 0x11/imm32/alloc-id:fake -27942 Single-float-var-in-some-register/imm32/outputs -27943 0x11/imm32/alloc-id:fake -27944 _string_f3_0f_5c_subtract/imm32/subx-name -27945 0/imm32/no-rm32 -27946 0/imm32/no-r32 -27947 0/imm32/no-imm32 -27948 0/imm32/no-imm8 -27949 0/imm32/no-disp32 -27950 1/imm32/xm32-is-first-inout -27951 3/imm32/x32-is-first-output -27952 0x11/imm32/alloc-id:fake -27953 _Primitive-subtract-mem-from-xreg/imm32/next -27954 _Primitive-subtract-mem-from-xreg: # (payload primitive) -27955 0x11/imm32/alloc-id:fake:payload -27956 # var1/xreg <- subtract var2 => f3 0f 5c/subtract var2/xm32 var1/x32 +27942 _string_bf_copy_to_edi/imm32/subx-name +27943 0/imm32/no-rm32 +27944 0/imm32/no-r32 +27945 1/imm32/imm32-is-first-inout +27946 0/imm32/no-imm8 +27947 0/imm32/no-disp32 +27948 0/imm32/no-xm32 +27949 0/imm32/no-x32 +27950 0x11/imm32/alloc-id:fake +27951 _Primitive-copy-reg-to-reg/imm32/next +27952 _Primitive-copy-reg-to-reg: # (payload primitive) +27953 0x11/imm32/alloc-id:fake:payload +27954 # var1/reg <- copy var2/reg => 89/<- var1/rm32 var2/r32 +27955 0x11/imm32/alloc-id:fake +27956 _string-copy/imm32/name 27957 0x11/imm32/alloc-id:fake -27958 _string-subtract/imm32/name +27958 Single-int-var-in-some-register/imm32/inouts 27959 0x11/imm32/alloc-id:fake -27960 Single-float-var-in-mem/imm32/inouts +27960 Single-int-var-in-some-register/imm32/outputs 27961 0x11/imm32/alloc-id:fake -27962 Single-float-var-in-some-register/imm32/outputs -27963 0x11/imm32/alloc-id:fake -27964 _string_f3_0f_5c_subtract/imm32/subx-name -27965 0/imm32/no-rm32 -27966 0/imm32/no-r32 -27967 0/imm32/no-imm32 -27968 0/imm32/no-imm8 -27969 0/imm32/no-disp32 -27970 1/imm32/xm32-is-first-inout -27971 3/imm32/x32-is-first-output -27972 0x11/imm32/alloc-id:fake -27973 _Primitive-multiply-xreg-by-xreg/imm32/next -27974 # - floating-point multiply -27975 _Primitive-multiply-xreg-by-xreg: # (payload primitive) -27976 0x11/imm32/alloc-id:fake:payload -27977 # var1/xreg <- multiply var2 => f3 0f 59/multiply var2/xm32 var1/x32 -27978 0x11/imm32/alloc-id:fake -27979 _string-multiply/imm32/name -27980 0x11/imm32/alloc-id:fake -27981 Single-float-var-in-some-register/imm32/inouts -27982 0x11/imm32/alloc-id:fake -27983 Single-float-var-in-some-register/imm32/outputs -27984 0x11/imm32/alloc-id:fake -27985 _string_f3_0f_59_multiply/imm32/subx-name -27986 0/imm32/no-rm32 -27987 0/imm32/no-r32 -27988 0/imm32/no-imm32 -27989 0/imm32/no-imm8 -27990 0/imm32/no-disp32 -27991 1/imm32/xm32-is-first-inout -27992 3/imm32/x32-is-first-output -27993 0x11/imm32/alloc-id:fake -27994 _Primitive-multiply-xreg-by-mem/imm32/next -27995 _Primitive-multiply-xreg-by-mem: # (payload primitive) -27996 0x11/imm32/alloc-id:fake:payload -27997 # var1/xreg <- multiply var2 => 53 0f 59/multiply var2/xm32 var1/x32 -27998 0x11/imm32/alloc-id:fake -27999 _string-multiply/imm32/name -28000 0x11/imm32/alloc-id:fake -28001 Single-float-var-in-mem/imm32/inouts -28002 0x11/imm32/alloc-id:fake -28003 Single-float-var-in-some-register/imm32/outputs -28004 0x11/imm32/alloc-id:fake -28005 _string_f3_0f_59_multiply/imm32/subx-name -28006 0/imm32/no-rm32 -28007 0/imm32/no-r32 -28008 0/imm32/no-imm32 -28009 0/imm32/no-imm8 -28010 0/imm32/no-disp32 -28011 1/imm32/xm32-is-first-inout -28012 3/imm32/x32-is-first-output -28013 0x11/imm32/alloc-id:fake -28014 _Primitive-divide-xreg-by-xreg/imm32/next -28015 # - floating-point divide -28016 _Primitive-divide-xreg-by-xreg: # (payload primitive) -28017 0x11/imm32/alloc-id:fake:payload -28018 # var1/xreg <- divide var2 => f3 0f 5e/divide var2/xm32 var1/x32 +27962 _string_89_<-/imm32/subx-name +27963 3/imm32/rm32-is-first-output +27964 1/imm32/r32-is-first-inout +27965 0/imm32/no-imm32 +27966 0/imm32/no-imm8 +27967 0/imm32/no-disp32 +27968 0/imm32/no-xm32 +27969 0/imm32/no-x32 +27970 0x11/imm32/alloc-id:fake +27971 _Primitive-copy-reg-to-mem/imm32/next +27972 _Primitive-copy-reg-to-mem: # (payload primitive) +27973 0x11/imm32/alloc-id:fake:payload +27974 # copy-to var1 var2/reg => 89/<- var1 var2/r32 +27975 0x11/imm32/alloc-id:fake +27976 _string-copy-to/imm32/name +27977 0x11/imm32/alloc-id:fake +27978 Two-args-int-stack-int-reg/imm32/inouts +27979 0/imm32/no-outputs +27980 0/imm32/no-outputs +27981 0x11/imm32/alloc-id:fake +27982 _string_89_<-/imm32/subx-name +27983 1/imm32/rm32-is-first-inout +27984 2/imm32/r32-is-second-inout +27985 0/imm32/no-imm32 +27986 0/imm32/no-imm8 +27987 0/imm32/no-disp32 +27988 0/imm32/no-xm32 +27989 0/imm32/no-x32 +27990 0x11/imm32/alloc-id:fake +27991 _Primitive-copy-mem-to-reg/imm32/next +27992 _Primitive-copy-mem-to-reg: # (payload primitive) +27993 0x11/imm32/alloc-id:fake:payload +27994 # var1/reg <- copy var2 => 8b/-> var2/rm32 var1/r32 +27995 0x11/imm32/alloc-id:fake +27996 _string-copy/imm32/name +27997 0x11/imm32/alloc-id:fake +27998 Single-int-var-in-mem/imm32/inouts +27999 0x11/imm32/alloc-id:fake +28000 Single-int-var-in-some-register/imm32/outputs +28001 0x11/imm32/alloc-id:fake +28002 _string_8b_->/imm32/subx-name +28003 1/imm32/rm32-is-first-inout +28004 3/imm32/r32-is-first-output +28005 0/imm32/no-imm32 +28006 0/imm32/no-imm8 +28007 0/imm32/no-disp32 +28008 0/imm32/no-xm32 +28009 0/imm32/no-x32 +28010 0x11/imm32/alloc-id:fake +28011 _Primitive-copy-lit-to-reg/imm32/next +28012 _Primitive-copy-lit-to-reg: # (payload primitive) +28013 0x11/imm32/alloc-id:fake:payload +28014 # var1/reg <- copy lit => c7 0/subop/copy var1/rm32 lit/imm32 +28015 0x11/imm32/alloc-id:fake +28016 _string-copy/imm32/name +28017 0x11/imm32/alloc-id:fake +28018 Single-lit-var/imm32/inouts 28019 0x11/imm32/alloc-id:fake -28020 _string-divide/imm32/name +28020 Single-int-var-in-some-register/imm32/outputs 28021 0x11/imm32/alloc-id:fake -28022 Single-float-var-in-some-register/imm32/inouts -28023 0x11/imm32/alloc-id:fake -28024 Single-float-var-in-some-register/imm32/outputs -28025 0x11/imm32/alloc-id:fake -28026 _string_f3_0f_5e_divide/imm32/subx-name -28027 0/imm32/no-rm32 -28028 0/imm32/no-r32 -28029 0/imm32/no-imm32 -28030 0/imm32/no-imm8 -28031 0/imm32/no-disp32 -28032 1/imm32/xm32-is-first-inout -28033 3/imm32/x32-is-first-output -28034 0x11/imm32/alloc-id:fake -28035 _Primitive-divide-xreg-by-mem/imm32/next -28036 _Primitive-divide-xreg-by-mem: # (payload primitive) -28037 0x11/imm32/alloc-id:fake:payload -28038 # var1/xreg <- divide var2 => f3 0f 5e/divide var2/xm32 var1/x32 -28039 0x11/imm32/alloc-id:fake -28040 _string-divide/imm32/name +28022 _string_c7_subop_copy/imm32/subx-name +28023 3/imm32/rm32-is-first-output +28024 0/imm32/no-r32 +28025 1/imm32/imm32-is-first-inout +28026 0/imm32/no-imm8 +28027 0/imm32/no-disp32 +28028 0/imm32/no-xm32 +28029 0/imm32/no-x32 +28030 0x11/imm32/alloc-id:fake +28031 _Primitive-copy-lit-to-mem/imm32/next +28032 _Primitive-copy-lit-to-mem: # (payload primitive) +28033 0x11/imm32/alloc-id:fake:payload +28034 # copy-to var1, lit => c7 0/subop/copy var1/rm32 lit/imm32 +28035 0x11/imm32/alloc-id:fake +28036 _string-copy-to/imm32/name +28037 0x11/imm32/alloc-id:fake +28038 Int-var-and-literal/imm32/inouts +28039 0/imm32/no-outputs +28040 0/imm32/no-outputs 28041 0x11/imm32/alloc-id:fake -28042 Single-float-var-in-mem/imm32/inouts -28043 0x11/imm32/alloc-id:fake -28044 Single-float-var-in-some-register/imm32/outputs -28045 0x11/imm32/alloc-id:fake -28046 _string_f3_0f_5e_divide/imm32/subx-name -28047 0/imm32/no-rm32 -28048 0/imm32/no-r32 -28049 0/imm32/no-imm32 -28050 0/imm32/no-imm8 -28051 0/imm32/no-disp32 -28052 1/imm32/xm32-is-first-inout -28053 3/imm32/x32-is-first-output -28054 0x11/imm32/alloc-id:fake -28055 _Primitive-max-xreg-with-xreg/imm32/next -28056 # - floating-point maximum -28057 _Primitive-max-xreg-with-xreg: # (payload primitive) -28058 0x11/imm32/alloc-id:fake:payload -28059 # var1/xreg <- max var2 => f3 0f 5f/max var2/xm32 var1/x32 +28042 _string_c7_subop_copy/imm32/subx-name +28043 1/imm32/rm32-is-first-inout +28044 0/imm32/no-r32 +28045 2/imm32/imm32-is-second-inout +28046 0/imm32/no-imm8 +28047 0/imm32/no-disp32 +28048 0/imm32/no-xm32 +28049 0/imm32/no-x32 +28050 0x11/imm32/alloc-id:fake +28051 _Primitive-copy-byte-from-reg/imm32/next +28052 # - copy byte +28053 _Primitive-copy-byte-from-reg: +28054 0x11/imm32/alloc-id:fake:payload +28055 # var/reg <- copy-byte var2/reg2 => 8a/byte-> %var2 var/r32 +28056 0x11/imm32/alloc-id:fake +28057 _string-copy-byte/imm32/name +28058 0x11/imm32/alloc-id:fake +28059 Single-byte-var-in-some-register/imm32/inouts 28060 0x11/imm32/alloc-id:fake -28061 _string-max/imm32/name +28061 Single-byte-var-in-some-register/imm32/outputs 28062 0x11/imm32/alloc-id:fake -28063 Single-float-var-in-some-register/imm32/inouts -28064 0x11/imm32/alloc-id:fake -28065 Single-float-var-in-some-register/imm32/outputs -28066 0x11/imm32/alloc-id:fake -28067 _string_f3_0f_5f_max/imm32/subx-name -28068 0/imm32/no-rm32 -28069 0/imm32/no-r32 -28070 0/imm32/no-imm32 -28071 0/imm32/no-imm8 -28072 0/imm32/no-disp32 -28073 1/imm32/xm32-is-first-inout -28074 3/imm32/x32-is-first-output -28075 0x11/imm32/alloc-id:fake -28076 _Primitive-max-xreg-with-mem/imm32/next -28077 _Primitive-max-xreg-with-mem: # (payload primitive) -28078 0x11/imm32/alloc-id:fake:payload -28079 # var1/xreg <- divide var2 => f3 0f 5f/max var2/xm32 var1/x32 +28063 _string_8a_copy_byte/imm32/subx-name +28064 1/imm32/rm32-is-first-inout +28065 3/imm32/r32-is-first-output +28066 0/imm32/no-imm32 +28067 0/imm32/no-imm8 +28068 0/imm32/no-disp32 +28069 0/imm32/no-xm32 +28070 0/imm32/no-x32 +28071 0x11/imm32/alloc-id:fake +28072 _Primitive-copy-byte-from-mem/imm32/next +28073 _Primitive-copy-byte-from-mem: +28074 0x11/imm32/alloc-id:fake:payload +28075 # var/reg <- copy-byte *var2/reg2 => 8a/byte-> *var2 var/r32 +28076 0x11/imm32/alloc-id:fake +28077 _string-copy-byte/imm32/name +28078 0x11/imm32/alloc-id:fake +28079 Single-byte-var-in-mem/imm32/inouts 28080 0x11/imm32/alloc-id:fake -28081 _string-max/imm32/name +28081 Single-byte-var-in-some-register/imm32/outputs 28082 0x11/imm32/alloc-id:fake -28083 Single-float-var-in-mem/imm32/inouts -28084 0x11/imm32/alloc-id:fake -28085 Single-float-var-in-some-register/imm32/outputs -28086 0x11/imm32/alloc-id:fake -28087 _string_f3_0f_5f_max/imm32/subx-name -28088 0/imm32/no-rm32 -28089 0/imm32/no-r32 -28090 0/imm32/no-imm32 -28091 0/imm32/no-imm8 -28092 0/imm32/no-disp32 -28093 1/imm32/xm32-is-first-inout -28094 3/imm32/x32-is-first-output -28095 0x11/imm32/alloc-id:fake -28096 _Primitive-min-xreg-with-xreg/imm32/next -28097 # - floating-point minimum -28098 _Primitive-min-xreg-with-xreg: # (payload primitive) -28099 0x11/imm32/alloc-id:fake:payload -28100 # var1/xreg <- divide var2 => f3 0f 5d/min var2/xm32 var1/x32 -28101 0x11/imm32/alloc-id:fake -28102 _string-min/imm32/name -28103 0x11/imm32/alloc-id:fake -28104 Single-float-var-in-some-register/imm32/inouts -28105 0x11/imm32/alloc-id:fake -28106 Single-float-var-in-some-register/imm32/outputs -28107 0x11/imm32/alloc-id:fake -28108 _string_f3_0f_5d_min/imm32/subx-name -28109 0/imm32/no-rm32 -28110 0/imm32/no-r32 -28111 0/imm32/no-imm32 -28112 0/imm32/no-imm8 -28113 0/imm32/no-disp32 -28114 1/imm32/xm32-is-first-inout -28115 3/imm32/x32-is-first-output -28116 0x11/imm32/alloc-id:fake -28117 _Primitive-min-xreg-with-mem/imm32/next -28118 _Primitive-min-xreg-with-mem: # (payload primitive) -28119 0x11/imm32/alloc-id:fake:payload -28120 # var1/xreg <- divide var2 => f3 0f 5d/min var2/xm32 var1/x32 +28083 _string_8a_copy_byte/imm32/subx-name +28084 1/imm32/rm32-is-first-inout +28085 3/imm32/r32-is-first-output +28086 0/imm32/no-imm32 +28087 0/imm32/no-imm8 +28088 0/imm32/no-disp32 +28089 0/imm32/no-xm32 +28090 0/imm32/no-x32 +28091 0x11/imm32/alloc-id:fake +28092 _Primitive-copy-byte-to-mem/imm32/next +28093 _Primitive-copy-byte-to-mem: +28094 0x11/imm32/alloc-id:fake:payload +28095 # copy-byte-to *var1/reg1, var2/reg2 => 88/byte<- *reg1 reg2/r32 +28096 0x11/imm32/alloc-id:fake +28097 _string-copy-byte-to/imm32/name +28098 0x11/imm32/alloc-id:fake +28099 Two-args-byte-stack-byte-reg/imm32/inouts +28100 0/imm32/no-outputs +28101 0/imm32/no-outputs +28102 0x11/imm32/alloc-id:fake +28103 _string_88_copy_byte/imm32/subx-name +28104 1/imm32/rm32-is-first-inout +28105 2/imm32/r32-is-second-inout +28106 0/imm32/no-imm32 +28107 0/imm32/no-imm8 +28108 0/imm32/no-disp32 +28109 0/imm32/no-xm32 +28110 0/imm32/no-x32 +28111 0x11/imm32/alloc-id:fake +28112 _Primitive-address/imm32/next +28113 # - address +28114 _Primitive-address: # (payload primitive) +28115 0x11/imm32/alloc-id:fake:payload +28116 # var1/reg <- address var2 => 8d/copy-address var2/rm32 var1/r32 +28117 0x11/imm32/alloc-id:fake +28118 _string-address/imm32/name +28119 0x11/imm32/alloc-id:fake +28120 Single-int-var-in-mem/imm32/inouts 28121 0x11/imm32/alloc-id:fake -28122 _string-min/imm32/name +28122 Single-addr-var-in-some-register/imm32/outputs 28123 0x11/imm32/alloc-id:fake -28124 Single-float-var-in-mem/imm32/inouts -28125 0x11/imm32/alloc-id:fake -28126 Single-float-var-in-some-register/imm32/outputs -28127 0x11/imm32/alloc-id:fake -28128 _string_f3_0f_5d_min/imm32/subx-name -28129 0/imm32/no-rm32 -28130 0/imm32/no-r32 -28131 0/imm32/no-imm32 -28132 0/imm32/no-imm8 -28133 0/imm32/no-disp32 -28134 1/imm32/xm32-is-first-inout -28135 3/imm32/x32-is-first-output -28136 0x11/imm32/alloc-id:fake -28137 _Primitive-reciprocal-xreg-to-xreg/imm32/next -28138 # - floating-point reciprocal -28139 _Primitive-reciprocal-xreg-to-xreg: # (payload primitive) -28140 0x11/imm32/alloc-id:fake:payload -28141 # var1/xreg <- reciprocal var2 => f3 0f 53/reciprocal var2/xm32 var1/x32 -28142 0x11/imm32/alloc-id:fake -28143 _string-reciprocal/imm32/name +28124 _string_8d_copy_address/imm32/subx-name +28125 1/imm32/rm32-is-first-inout +28126 3/imm32/r32-is-first-output +28127 0/imm32/no-imm32 +28128 0/imm32/no-imm8 +28129 0/imm32/no-disp32 +28130 0/imm32/no-xm32 +28131 0/imm32/no-x32 +28132 0x11/imm32/alloc-id:fake +28133 _Primitive-compare-reg-with-reg/imm32/next +28134 # - compare +28135 _Primitive-compare-reg-with-reg: # (payload primitive) +28136 0x11/imm32/alloc-id:fake:payload +28137 # compare var1/reg1 var2/reg2 => 39/compare var1/rm32 var2/r32 +28138 0x11/imm32/alloc-id:fake +28139 _string-compare/imm32/name +28140 0x11/imm32/alloc-id:fake +28141 Two-int-args-in-regs/imm32/inouts +28142 0/imm32/no-outputs +28143 0/imm32/no-outputs 28144 0x11/imm32/alloc-id:fake -28145 Single-float-var-in-some-register/imm32/inouts -28146 0x11/imm32/alloc-id:fake -28147 Single-float-var-in-some-register/imm32/outputs -28148 0x11/imm32/alloc-id:fake -28149 _string_f3_0f_53_reciprocal/imm32/subx-name -28150 0/imm32/no-rm32 -28151 0/imm32/no-r32 -28152 0/imm32/no-imm32 -28153 0/imm32/no-imm8 -28154 0/imm32/no-disp32 -28155 1/imm32/xm32-is-first-inout -28156 3/imm32/x32-is-first-output -28157 0x11/imm32/alloc-id:fake -28158 _Primitive-reciprocal-mem-to-xreg/imm32/next -28159 _Primitive-reciprocal-mem-to-xreg: # (payload primitive) -28160 0x11/imm32/alloc-id:fake:payload -28161 # var1/xreg <- divide var2 => f3 0f 53/reciprocal var2/xm32 var1/x32 -28162 0x11/imm32/alloc-id:fake -28163 _string-reciprocal/imm32/name +28145 _string_39_compare->/imm32/subx-name +28146 1/imm32/rm32-is-first-inout +28147 2/imm32/r32-is-second-inout +28148 0/imm32/no-imm32 +28149 0/imm32/no-imm8 +28150 0/imm32/no-disp32 +28151 0/imm32/no-xm32 +28152 0/imm32/no-x32 +28153 0x11/imm32/alloc-id:fake +28154 _Primitive-compare-mem-with-reg/imm32/next +28155 _Primitive-compare-mem-with-reg: # (payload primitive) +28156 0x11/imm32/alloc-id:fake:payload +28157 # compare var1 var2/reg => 39/compare var1/rm32 var2/r32 +28158 0x11/imm32/alloc-id:fake +28159 _string-compare/imm32/name +28160 0x11/imm32/alloc-id:fake +28161 Two-args-int-stack-int-reg/imm32/inouts +28162 0/imm32/no-outputs +28163 0/imm32/no-outputs 28164 0x11/imm32/alloc-id:fake -28165 Single-float-var-in-mem/imm32/inouts -28166 0x11/imm32/alloc-id:fake -28167 Single-float-var-in-some-register/imm32/outputs -28168 0x11/imm32/alloc-id:fake -28169 _string_f3_0f_53_reciprocal/imm32/subx-name -28170 0/imm32/no-rm32 -28171 0/imm32/no-r32 -28172 0/imm32/no-imm32 -28173 0/imm32/no-imm8 -28174 0/imm32/no-disp32 -28175 1/imm32/xm32-is-first-inout -28176 3/imm32/x32-is-first-output -28177 0x11/imm32/alloc-id:fake -28178 _Primitive-square-root-xreg-to-xreg/imm32/next -28179 # - floating-point square root -28180 _Primitive-square-root-xreg-to-xreg: # (payload primitive) -28181 0x11/imm32/alloc-id:fake:payload -28182 # var1/xreg <- square-root var2 => f3 0f 51/square-root var2/xm32 var1/x32 -28183 0x11/imm32/alloc-id:fake -28184 _string-square-root/imm32/name -28185 0x11/imm32/alloc-id:fake -28186 Single-float-var-in-some-register/imm32/inouts -28187 0x11/imm32/alloc-id:fake -28188 Single-float-var-in-some-register/imm32/outputs -28189 0x11/imm32/alloc-id:fake -28190 _string_f3_0f_51_square_root/imm32/subx-name -28191 0/imm32/no-rm32 -28192 0/imm32/no-r32 -28193 0/imm32/no-imm32 -28194 0/imm32/no-imm8 -28195 0/imm32/no-disp32 -28196 1/imm32/xm32-is-first-inout -28197 3/imm32/x32-is-first-output +28165 _string_39_compare->/imm32/subx-name +28166 1/imm32/rm32-is-first-inout +28167 2/imm32/r32-is-second-inout +28168 0/imm32/no-imm32 +28169 0/imm32/no-imm8 +28170 0/imm32/no-disp32 +28171 0/imm32/no-xm32 +28172 0/imm32/no-x32 +28173 0x11/imm32/alloc-id:fake +28174 _Primitive-compare-reg-with-mem/imm32/next +28175 _Primitive-compare-reg-with-mem: # (payload primitive) +28176 0x11/imm32/alloc-id:fake:payload +28177 # compare var1/reg var2 => 3b/compare<- var2/rm32 var1/r32 +28178 0x11/imm32/alloc-id:fake +28179 _string-compare/imm32/name +28180 0x11/imm32/alloc-id:fake +28181 Two-args-int-reg-int-stack/imm32/inouts +28182 0/imm32/no-outputs +28183 0/imm32/no-outputs +28184 0x11/imm32/alloc-id:fake +28185 _string_3b_compare<-/imm32/subx-name +28186 2/imm32/rm32-is-second-inout +28187 1/imm32/r32-is-first-inout +28188 0/imm32/no-imm32 +28189 0/imm32/no-imm8 +28190 0/imm32/no-disp32 +28191 0/imm32/no-xm32 +28192 0/imm32/no-x32 +28193 0x11/imm32/alloc-id:fake +28194 _Primitive-compare-eax-with-literal/imm32/next +28195 _Primitive-compare-eax-with-literal: # (payload primitive) +28196 0x11/imm32/alloc-id:fake:payload +28197 # compare var1/eax n => 3d/compare-eax-with n/imm32 28198 0x11/imm32/alloc-id:fake -28199 _Primitive-square-root-mem-to-xreg/imm32/next -28200 _Primitive-square-root-mem-to-xreg: # (payload primitive) -28201 0x11/imm32/alloc-id:fake:payload -28202 # var1/xreg <- divide var2 => f3 0f 51/square-root var2/xm32 var1/x32 -28203 0x11/imm32/alloc-id:fake -28204 _string-square-root/imm32/name -28205 0x11/imm32/alloc-id:fake -28206 Single-float-var-in-mem/imm32/inouts -28207 0x11/imm32/alloc-id:fake -28208 Single-float-var-in-some-register/imm32/outputs -28209 0x11/imm32/alloc-id:fake -28210 _string_f3_0f_51_square_root/imm32/subx-name -28211 0/imm32/no-rm32 -28212 0/imm32/no-r32 -28213 0/imm32/no-imm32 -28214 0/imm32/no-imm8 -28215 0/imm32/no-disp32 -28216 1/imm32/xm32-is-first-inout -28217 3/imm32/x32-is-first-output +28199 _string-compare/imm32/name +28200 0x11/imm32/alloc-id:fake +28201 Two-args-int-eax-int-literal/imm32/inouts +28202 0/imm32/no-outputs +28203 0/imm32/no-outputs +28204 0x11/imm32/alloc-id:fake +28205 _string_3d_compare_eax_with/imm32/subx-name +28206 0/imm32/no-rm32 +28207 0/imm32/no-r32 +28208 2/imm32/imm32-is-second-inout +28209 0/imm32/no-imm8 +28210 0/imm32/no-disp32 +28211 0/imm32/no-xm32 +28212 0/imm32/no-x32 +28213 0x11/imm32/alloc-id:fake +28214 _Primitive-compare-reg-with-literal/imm32/next +28215 _Primitive-compare-reg-with-literal: # (payload primitive) +28216 0x11/imm32/alloc-id:fake:payload +28217 # compare var1/reg n => 81 7/subop/compare %reg n/imm32 28218 0x11/imm32/alloc-id:fake -28219 _Primitive-inverse-square-root-xreg-to-xreg/imm32/next -28220 # - floating-point inverse square root 1/sqrt(x) -28221 _Primitive-inverse-square-root-xreg-to-xreg: # (payload primitive) -28222 0x11/imm32/alloc-id:fake:payload -28223 # var1/xreg <- reciprocal var2 => f3 0f 52/inverse-square-root var2/xm32 var1/x32 +28219 _string-compare/imm32/name +28220 0x11/imm32/alloc-id:fake +28221 Int-var-in-register-and-literal/imm32/inouts +28222 0/imm32/no-outputs +28223 0/imm32/no-outputs 28224 0x11/imm32/alloc-id:fake -28225 _string-inverse-square-root/imm32/name -28226 0x11/imm32/alloc-id:fake -28227 Single-float-var-in-some-register/imm32/inouts -28228 0x11/imm32/alloc-id:fake -28229 Single-float-var-in-some-register/imm32/outputs -28230 0x11/imm32/alloc-id:fake -28231 _string_f3_0f_52_inverse_square_root/imm32/subx-name -28232 0/imm32/no-rm32 -28233 0/imm32/no-r32 -28234 0/imm32/no-imm32 -28235 0/imm32/no-imm8 -28236 0/imm32/no-disp32 -28237 1/imm32/xm32-is-first-inout -28238 3/imm32/x32-is-first-output -28239 0x11/imm32/alloc-id:fake -28240 _Primitive-inverse-square-root-mem-to-xreg/imm32/next -28241 _Primitive-inverse-square-root-mem-to-xreg: # (payload primitive) -28242 0x11/imm32/alloc-id:fake:payload -28243 # var1/xreg <- divide var2 => f3 0f 52/inverse-square-root var2/xm32 var1/x32 +28225 _string_81_subop_compare/imm32/subx-name +28226 1/imm32/rm32-is-first-inout +28227 0/imm32/no-r32 +28228 2/imm32/imm32-is-second-inout +28229 0/imm32/no-imm8 +28230 0/imm32/no-disp32 +28231 0/imm32/no-xm32 +28232 0/imm32/no-x32 +28233 0x11/imm32/alloc-id:fake +28234 _Primitive-compare-mem-with-literal/imm32/next +28235 _Primitive-compare-mem-with-literal: # (payload primitive) +28236 0x11/imm32/alloc-id:fake:payload +28237 # compare var1 n => 81 7/subop/compare *(ebp+___) n/imm32 +28238 0x11/imm32/alloc-id:fake +28239 _string-compare/imm32/name +28240 0x11/imm32/alloc-id:fake +28241 Int-var-and-literal/imm32/inouts +28242 0/imm32/no-outputs +28243 0/imm32/no-outputs 28244 0x11/imm32/alloc-id:fake -28245 _string-inverse-square-root/imm32/name -28246 0x11/imm32/alloc-id:fake -28247 Single-float-var-in-mem/imm32/inouts -28248 0x11/imm32/alloc-id:fake -28249 Single-float-var-in-some-register/imm32/outputs -28250 0x11/imm32/alloc-id:fake -28251 _string_f3_0f_52_inverse_square_root/imm32/subx-name -28252 0/imm32/no-rm32 -28253 0/imm32/no-r32 -28254 0/imm32/no-imm32 -28255 0/imm32/no-imm8 -28256 0/imm32/no-disp32 -28257 1/imm32/xm32-is-first-inout -28258 3/imm32/x32-is-first-output +28245 _string_81_subop_compare/imm32/subx-name +28246 1/imm32/rm32-is-first-inout +28247 0/imm32/no-r32 +28248 2/imm32/imm32-is-second-inout +28249 0/imm32/no-imm8 +28250 0/imm32/no-disp32 +28251 0/imm32/no-xm32 +28252 0/imm32/no-x32 +28253 0x11/imm32/alloc-id:fake +28254 _Primitive-negate-reg/imm32/next +28255 # - negate +28256 _Primitive-negate-reg: # (payload primitive) +28257 0x11/imm32/alloc-id:fake:payload +28258 # var1/reg <- negate => f7 3/subop/negate var1/rm32 28259 0x11/imm32/alloc-id:fake -28260 _Primitive-compare-xreg-with-xreg/imm32/next -28261 # - floating-point compare -28262 _Primitive-compare-xreg-with-xreg: # (payload primitive) -28263 0x11/imm32/alloc-id:fake:payload -28264 # compare var1/reg1 var2/reg2 => 0f 2f/compare var2/x32 var1/xm32 +28260 _string-negate/imm32/name +28261 0/imm32/no-inouts +28262 0/imm32/no-inouts +28263 0x11/imm32/alloc-id:fake +28264 Single-int-var-in-some-register/imm32/outputs 28265 0x11/imm32/alloc-id:fake -28266 _string-compare/imm32/name -28267 0x11/imm32/alloc-id:fake -28268 Two-float-args-in-regs/imm32/inouts -28269 0/imm32/no-outputs -28270 0/imm32/no-outputs -28271 0x11/imm32/alloc-id:fake -28272 _string_0f_2f_compare/imm32/subx-name -28273 0/imm32/no-rm32 -28274 0/imm32/no-r32 -28275 0/imm32/no-imm32 -28276 0/imm32/no-imm8 -28277 0/imm32/no-disp32 -28278 1/imm32/xm32-is-first-inout -28279 2/imm32/x32-is-second-inout -28280 0x11/imm32/alloc-id:fake -28281 _Primitive-compare-xreg-with-mem/imm32/next -28282 _Primitive-compare-xreg-with-mem: # (payload primitive) -28283 0x11/imm32/alloc-id:fake:payload -28284 # compare var1/xreg var2 => 0f 2f/compare var1/x32 var2/xm32 +28266 _string_f7_subop_negate/imm32/subx-name +28267 3/imm32/rm32-is-first-output +28268 0/imm32/no-r32 +28269 0/imm32/no-imm32 +28270 0/imm32/no-imm8 +28271 0/imm32/no-disp32 +28272 0/imm32/no-xm32 +28273 0/imm32/no-x32 +28274 0x11/imm32/alloc-id:fake +28275 _Primitive-negate-mem/imm32/next +28276 _Primitive-negate-mem: # (payload primitive) +28277 0x11/imm32/alloc-id:fake:payload +28278 # negate var1 => f7 3/subop/negate var1/rm32 +28279 0x11/imm32/alloc-id:fake +28280 _string-negate/imm32/name +28281 0x11/imm32/alloc-id:fake +28282 Single-int-var-in-mem/imm32/inouts +28283 0/imm32/no-outputs +28284 0/imm32/no-outputs 28285 0x11/imm32/alloc-id:fake -28286 _string-compare/imm32/name -28287 0x11/imm32/alloc-id:fake -28288 Two-args-float-reg-float-stack/imm32/inouts -28289 0/imm32/no-outputs -28290 0/imm32/no-outputs -28291 0x11/imm32/alloc-id:fake -28292 _string_0f_2f_compare/imm32/subx-name -28293 0/imm32/no-rm32 -28294 0/imm32/no-r32 -28295 0/imm32/no-imm32 -28296 0/imm32/no-imm8 -28297 0/imm32/no-disp32 -28298 2/imm32/xm32-is-second-inout -28299 1/imm32/x32-is-first-inout +28286 _string_f7_subop_negate/imm32/subx-name +28287 1/imm32/rm32-is-first-inout +28288 0/imm32/no-r32 +28289 0/imm32/no-imm32 +28290 0/imm32/no-imm8 +28291 0/imm32/no-disp32 +28292 0/imm32/no-xm32 +28293 0/imm32/no-x32 +28294 0x11/imm32/alloc-id:fake +28295 _Primitive-multiply-reg-by-reg/imm32/next +28296 # - multiply +28297 _Primitive-multiply-reg-by-reg: # (payload primitive) +28298 0x11/imm32/alloc-id:fake:payload +28299 # var1/reg <- multiply var2 => 0f af/multiply var2/rm32 var1/r32 28300 0x11/imm32/alloc-id:fake -28301 _Primitive-break-if-addr</imm32/next -28302 # - branches -28303 _Primitive-break-if-addr<: # (payload primitive) -28304 0x11/imm32/alloc-id:fake:payload -28305 0x11/imm32/alloc-id:fake -28306 _string-break-if-addr</imm32/name -28307 0/imm32/no-inouts -28308 0/imm32/no-inouts -28309 0/imm32/no-outputs -28310 0/imm32/no-outputs -28311 0x11/imm32/alloc-id:fake -28312 _string_0f_82_jump_break/imm32/subx-name -28313 0/imm32/no-rm32 -28314 0/imm32/no-r32 -28315 0/imm32/no-imm32 -28316 0/imm32/no-imm8 -28317 0/imm32/no-disp32 -28318 0/imm32/no-xm32 -28319 0/imm32/no-x32 +28301 _string-multiply/imm32/name +28302 0x11/imm32/alloc-id:fake +28303 Single-int-var-in-some-register/imm32/inouts +28304 0x11/imm32/alloc-id:fake +28305 Single-int-var-in-some-register/imm32/outputs +28306 0x11/imm32/alloc-id:fake +28307 _string_0f_af_multiply/imm32/subx-name +28308 1/imm32/rm32-is-first-inout +28309 3/imm32/r32-is-first-output +28310 0/imm32/no-imm32 +28311 0/imm32/no-imm8 +28312 0/imm32/no-disp32 +28313 0/imm32/no-xm32 +28314 0/imm32/no-x32 +28315 0x11/imm32/alloc-id:fake +28316 _Primitive-multiply-reg-by-mem/imm32/next +28317 _Primitive-multiply-reg-by-mem: # (payload primitive) +28318 0x11/imm32/alloc-id:fake:payload +28319 # var1/reg <- multiply var2 => 0f af/multiply var2/rm32 var1/r32 28320 0x11/imm32/alloc-id:fake -28321 _Primitive-break-if-addr>=/imm32/next -28322 _Primitive-break-if-addr>=: # (payload primitive) -28323 0x11/imm32/alloc-id:fake:payload +28321 _string-multiply/imm32/name +28322 0x11/imm32/alloc-id:fake +28323 Single-int-var-in-mem/imm32/inouts 28324 0x11/imm32/alloc-id:fake -28325 _string-break-if-addr>=/imm32/name -28326 0/imm32/no-inouts -28327 0/imm32/no-inouts -28328 0/imm32/no-outputs -28329 0/imm32/no-outputs -28330 0x11/imm32/alloc-id:fake -28331 _string_0f_83_jump_break/imm32/subx-name -28332 0/imm32/no-rm32 -28333 0/imm32/no-r32 -28334 0/imm32/no-imm32 -28335 0/imm32/no-imm8 -28336 0/imm32/no-disp32 -28337 0/imm32/no-xm32 -28338 0/imm32/no-x32 -28339 0x11/imm32/alloc-id:fake -28340 _Primitive-break-if-=/imm32/next -28341 _Primitive-break-if-=: # (payload primitive) -28342 0x11/imm32/alloc-id:fake:payload +28325 Single-int-var-in-some-register/imm32/outputs +28326 0x11/imm32/alloc-id:fake +28327 _string_0f_af_multiply/imm32/subx-name +28328 1/imm32/rm32-is-first-inout +28329 3/imm32/r32-is-first-output +28330 0/imm32/no-imm32 +28331 0/imm32/no-imm8 +28332 0/imm32/no-disp32 +28333 0/imm32/no-xm32 +28334 0/imm32/no-x32 +28335 0x11/imm32/alloc-id:fake +28336 _Primitive-convert-mem-to-xreg/imm32/next +28337 # - convert int to floating point +28338 _Primitive-convert-mem-to-xreg: # (payload primitive) +28339 0x11/imm32/alloc-id:fake:payload +28340 # var1/xreg <- convert var2 => f3 0f 2a/convert-to-float var2/rm32 var1/x32 +28341 0x11/imm32/alloc-id:fake +28342 _string-convert/imm32/name 28343 0x11/imm32/alloc-id:fake -28344 _string-break-if-=/imm32/name -28345 0/imm32/no-inouts -28346 0/imm32/no-inouts -28347 0/imm32/no-outputs -28348 0/imm32/no-outputs -28349 0x11/imm32/alloc-id:fake -28350 _string_0f_84_jump_break/imm32/subx-name -28351 0/imm32/no-rm32 -28352 0/imm32/no-r32 -28353 0/imm32/no-imm32 -28354 0/imm32/no-imm8 -28355 0/imm32/no-disp32 -28356 0/imm32/no-xm32 -28357 0/imm32/no-x32 -28358 0x11/imm32/alloc-id:fake -28359 _Primitive-break-if-!=/imm32/next -28360 _Primitive-break-if-!=: # (payload primitive) -28361 0x11/imm32/alloc-id:fake:payload -28362 0x11/imm32/alloc-id:fake -28363 _string-break-if-!=/imm32/name -28364 0/imm32/no-inouts -28365 0/imm32/no-inouts -28366 0/imm32/no-outputs -28367 0/imm32/no-outputs -28368 0x11/imm32/alloc-id:fake -28369 _string_0f_85_jump_break/imm32/subx-name -28370 0/imm32/no-rm32 -28371 0/imm32/no-r32 -28372 0/imm32/no-imm32 -28373 0/imm32/no-imm8 -28374 0/imm32/no-disp32 -28375 0/imm32/no-xm32 -28376 0/imm32/no-x32 -28377 0x11/imm32/alloc-id:fake -28378 _Primitive-break-if-addr<=/imm32/next -28379 _Primitive-break-if-addr<=: # (payload primitive) +28344 Single-int-var-in-mem/imm32/inouts +28345 0x11/imm32/alloc-id:fake +28346 Single-float-var-in-some-register/imm32/outputs +28347 0x11/imm32/alloc-id:fake +28348 _string_f3_0f_2a_convert_to_float/imm32/subx-name +28349 1/imm32/rm32-is-first-inout +28350 0/imm32/no-r32 +28351 0/imm32/no-imm32 +28352 0/imm32/no-imm8 +28353 0/imm32/no-disp32 +28354 0/imm32/no-xm32 +28355 3/imm32/x32-is-first-output +28356 0x11/imm32/alloc-id:fake +28357 _Primitive-convert-reg-to-xreg/imm32/next +28358 _Primitive-convert-reg-to-xreg: # (payload primitive) +28359 0x11/imm32/alloc-id:fake:payload +28360 # var1/xreg <- convert var2/reg => f3 0f 2a/convert-to-float var2/rm32 var1/x32 +28361 0x11/imm32/alloc-id:fake +28362 _string-convert/imm32/name +28363 0x11/imm32/alloc-id:fake +28364 Single-int-var-in-some-register/imm32/inouts +28365 0x11/imm32/alloc-id:fake +28366 Single-float-var-in-some-register/imm32/outputs +28367 0x11/imm32/alloc-id:fake +28368 _string_f3_0f_2a_convert_to_float/imm32/subx-name +28369 1/imm32/rm32-is-first-inout +28370 0/imm32/no-r32 +28371 0/imm32/no-imm32 +28372 0/imm32/no-imm8 +28373 0/imm32/no-disp32 +28374 0/imm32/no-xm32 +28375 3/imm32/x32-is-first-output +28376 0x11/imm32/alloc-id:fake +28377 _Primitive-convert-xmem-to-reg/imm32/next +28378 # - convert floating point to int +28379 _Primitive-convert-xmem-to-reg: # (payload primitive) 28380 0x11/imm32/alloc-id:fake:payload -28381 0x11/imm32/alloc-id:fake -28382 _string-break-if-addr<=/imm32/name -28383 0/imm32/no-inouts -28384 0/imm32/no-inouts -28385 0/imm32/no-outputs -28386 0/imm32/no-outputs -28387 0x11/imm32/alloc-id:fake -28388 _string_0f_86_jump_break/imm32/subx-name -28389 0/imm32/no-rm32 -28390 0/imm32/no-r32 -28391 0/imm32/no-imm32 -28392 0/imm32/no-imm8 -28393 0/imm32/no-disp32 -28394 0/imm32/no-xm32 -28395 0/imm32/no-x32 -28396 0x11/imm32/alloc-id:fake -28397 _Primitive-break-if-addr>/imm32/next -28398 _Primitive-break-if-addr>: # (payload primitive) -28399 0x11/imm32/alloc-id:fake:payload -28400 0x11/imm32/alloc-id:fake -28401 _string-break-if-addr>/imm32/name -28402 0/imm32/no-inouts -28403 0/imm32/no-inouts -28404 0/imm32/no-outputs -28405 0/imm32/no-outputs +28381 # var1/reg <- convert var2 => f3 0f 2d/convert-to-int var2/xm32 var1/r32 +28382 0x11/imm32/alloc-id:fake +28383 _string-convert/imm32/name +28384 0x11/imm32/alloc-id:fake +28385 Single-float-var-in-mem/imm32/inouts +28386 0x11/imm32/alloc-id:fake +28387 Single-int-var-in-some-register/imm32/outputs +28388 0x11/imm32/alloc-id:fake +28389 _string_f3_0f_2d_convert_to_int/imm32/subx-name +28390 0/imm32/no-rm32 +28391 3/imm32/r32-is-first-output +28392 0/imm32/no-imm32 +28393 0/imm32/no-imm8 +28394 0/imm32/no-disp32 +28395 1/imm32/xm32-is-first-inout +28396 0/imm32/no-x32 +28397 0x11/imm32/alloc-id:fake +28398 _Primitive-convert-xreg-to-reg/imm32/next +28399 _Primitive-convert-xreg-to-reg: # (payload primitive) +28400 0x11/imm32/alloc-id:fake:payload +28401 # var1/reg <- convert var2/xreg => f3 0f 2d/convert-to-int var2/xm32 var1/r32 +28402 0x11/imm32/alloc-id:fake +28403 _string-convert/imm32/name +28404 0x11/imm32/alloc-id:fake +28405 Single-float-var-in-some-register/imm32/inouts 28406 0x11/imm32/alloc-id:fake -28407 _string_0f_87_jump_break/imm32/subx-name -28408 0/imm32/no-rm32 -28409 0/imm32/no-r32 -28410 0/imm32/no-imm32 -28411 0/imm32/no-imm8 -28412 0/imm32/no-disp32 -28413 0/imm32/no-xm32 -28414 0/imm32/no-x32 -28415 0x11/imm32/alloc-id:fake -28416 _Primitive-break-if-</imm32/next -28417 _Primitive-break-if-<: # (payload primitive) -28418 0x11/imm32/alloc-id:fake:payload -28419 0x11/imm32/alloc-id:fake -28420 _string-break-if-</imm32/name -28421 0/imm32/no-inouts -28422 0/imm32/no-inouts -28423 0/imm32/no-outputs -28424 0/imm32/no-outputs -28425 0x11/imm32/alloc-id:fake -28426 _string_0f_8c_jump_break/imm32/subx-name -28427 0/imm32/no-rm32 -28428 0/imm32/no-r32 -28429 0/imm32/no-imm32 -28430 0/imm32/no-imm8 -28431 0/imm32/no-disp32 -28432 0/imm32/no-xm32 -28433 0/imm32/no-x32 -28434 0x11/imm32/alloc-id:fake -28435 _Primitive-break-if->=/imm32/next -28436 _Primitive-break-if->=: # (payload primitive) -28437 0x11/imm32/alloc-id:fake:payload -28438 0x11/imm32/alloc-id:fake -28439 _string-break-if->=/imm32/name -28440 0/imm32/no-inouts -28441 0/imm32/no-inouts -28442 0/imm32/no-outputs -28443 0/imm32/no-outputs +28407 Single-int-var-in-some-register/imm32/outputs +28408 0x11/imm32/alloc-id:fake +28409 _string_f3_0f_2d_convert_to_int/imm32/subx-name +28410 0/imm32/no-rm32 +28411 3/imm32/r32-is-first-output +28412 0/imm32/no-imm32 +28413 0/imm32/no-imm8 +28414 0/imm32/no-disp32 +28415 1/imm32/xm32-is-first-inout +28416 0/imm32/no-x32 +28417 0x11/imm32/alloc-id:fake +28418 _Primitive-truncate-xmem-to-reg/imm32/next +28419 _Primitive-truncate-xmem-to-reg: # (payload primitive) +28420 0x11/imm32/alloc-id:fake:payload +28421 # var1/reg <- truncate var2 => f3 0f 2c/truncate-to-int var2/xm32 var1/r32 +28422 0x11/imm32/alloc-id:fake +28423 _string-truncate/imm32/name +28424 0x11/imm32/alloc-id:fake +28425 Single-float-var-in-mem/imm32/inouts +28426 0x11/imm32/alloc-id:fake +28427 Single-int-var-in-some-register/imm32/outputs +28428 0x11/imm32/alloc-id:fake +28429 _string_f3_0f_2c_truncate_to_int/imm32/subx-name +28430 0/imm32/no-rm32 +28431 3/imm32/r32-is-first-output +28432 0/imm32/no-imm32 +28433 0/imm32/no-imm8 +28434 0/imm32/no-disp32 +28435 1/imm32/xm32-is-first-inout +28436 0/imm32/no-x32 +28437 0x11/imm32/alloc-id:fake +28438 _Primitive-truncate-xreg-to-reg/imm32/next +28439 _Primitive-truncate-xreg-to-reg: # (payload primitive) +28440 0x11/imm32/alloc-id:fake:payload +28441 # var1/reg <- truncate var2/xreg => f3 0f 2c/truncate-to-int var2/xm32 var1/r32 +28442 0x11/imm32/alloc-id:fake +28443 _string-truncate/imm32/name 28444 0x11/imm32/alloc-id:fake -28445 _string_0f_8d_jump_break/imm32/subx-name -28446 0/imm32/no-rm32 -28447 0/imm32/no-r32 -28448 0/imm32/no-imm32 -28449 0/imm32/no-imm8 -28450 0/imm32/no-disp32 -28451 0/imm32/no-xm32 -28452 0/imm32/no-x32 -28453 0x11/imm32/alloc-id:fake -28454 _Primitive-break-if-<=/imm32/next -28455 _Primitive-break-if-<=: # (payload primitive) -28456 0x11/imm32/alloc-id:fake:payload +28445 Single-float-var-in-some-register/imm32/inouts +28446 0x11/imm32/alloc-id:fake +28447 Single-int-var-in-some-register/imm32/outputs +28448 0x11/imm32/alloc-id:fake +28449 _string_f3_0f_2c_truncate_to_int/imm32/subx-name +28450 0/imm32/no-rm32 +28451 3/imm32/r32-is-first-output +28452 0/imm32/no-imm32 +28453 0/imm32/no-imm8 +28454 0/imm32/no-disp32 +28455 1/imm32/xm32-is-first-inout +28456 0/imm32/no-x32 28457 0x11/imm32/alloc-id:fake -28458 _string-break-if-<=/imm32/name -28459 0/imm32/no-inouts -28460 0/imm32/no-inouts -28461 0/imm32/no-outputs -28462 0/imm32/no-outputs +28458 _Primitive-reinterpret-xmem-as-reg/imm32/next +28459 # - reinterpret bytes (just for debugging) +28460 _Primitive-reinterpret-xmem-as-reg: # (payload primitive) +28461 0x11/imm32/alloc-id:fake:payload +28462 # var1/reg <- reinterpret var2 => 8b/-> var2/xm32 var1/r32 28463 0x11/imm32/alloc-id:fake -28464 _string_0f_8e_jump_break/imm32/subx-name -28465 0/imm32/no-rm32 -28466 0/imm32/no-r32 -28467 0/imm32/no-imm32 -28468 0/imm32/no-imm8 -28469 0/imm32/no-disp32 -28470 0/imm32/no-xm32 -28471 0/imm32/no-x32 -28472 0x11/imm32/alloc-id:fake -28473 _Primitive-break-if->/imm32/next -28474 _Primitive-break-if->: # (payload primitive) -28475 0x11/imm32/alloc-id:fake:payload -28476 0x11/imm32/alloc-id:fake -28477 _string-break-if->/imm32/name -28478 0/imm32/no-inouts -28479 0/imm32/no-inouts -28480 0/imm32/no-outputs -28481 0/imm32/no-outputs -28482 0x11/imm32/alloc-id:fake -28483 _string_0f_8f_jump_break/imm32/subx-name -28484 0/imm32/no-rm32 -28485 0/imm32/no-r32 -28486 0/imm32/no-imm32 -28487 0/imm32/no-imm8 -28488 0/imm32/no-disp32 -28489 0/imm32/no-xm32 -28490 0/imm32/no-x32 -28491 0x11/imm32/alloc-id:fake -28492 _Primitive-break/imm32/next -28493 _Primitive-break: # (payload primitive) -28494 0x11/imm32/alloc-id:fake:payload -28495 0x11/imm32/alloc-id:fake -28496 _string-break/imm32/name -28497 0/imm32/no-inouts -28498 0/imm32/no-inouts -28499 0/imm32/no-outputs -28500 0/imm32/no-outputs -28501 0x11/imm32/alloc-id:fake -28502 _string_e9_jump_break/imm32/subx-name -28503 0/imm32/no-rm32 -28504 0/imm32/no-r32 -28505 0/imm32/no-imm32 -28506 0/imm32/no-imm8 -28507 0/imm32/no-disp32 -28508 0/imm32/no-xm32 -28509 0/imm32/no-x32 +28464 _string-reinterpret/imm32/name +28465 0x11/imm32/alloc-id:fake +28466 Single-float-var-in-mem/imm32/inouts +28467 0x11/imm32/alloc-id:fake +28468 Single-int-var-in-some-register/imm32/outputs +28469 0x11/imm32/alloc-id:fake +28470 _string_8b_->/imm32/subx-name +28471 0/imm32/no-rm32 +28472 3/imm32/r32-is-first-output +28473 0/imm32/no-imm32 +28474 0/imm32/no-imm8 +28475 0/imm32/no-disp32 +28476 1/imm32/xm32-is-first-inout +28477 0/imm32/no-x32 +28478 0x11/imm32/alloc-id:fake +28479 _Primitive-reinterpret-mem-as-xreg/imm32/next +28480 _Primitive-reinterpret-mem-as-xreg: # (payload primitive) +28481 0x11/imm32/alloc-id:fake:payload +28482 # var1/xreg <- reinterpret var2 => f3 0f 10/-> var2/rm32 var1/x32 +28483 0x11/imm32/alloc-id:fake +28484 _string-reinterpret/imm32/name +28485 0x11/imm32/alloc-id:fake +28486 Single-int-var-in-mem/imm32/inouts +28487 0x11/imm32/alloc-id:fake +28488 Single-float-var-in-some-register/imm32/outputs +28489 0x11/imm32/alloc-id:fake +28490 _string_f3_0f_10_copy/imm32/subx-name +28491 1/imm32/rm32-is-first-inout +28492 0/imm32/no-r32 +28493 0/imm32/no-imm32 +28494 0/imm32/no-imm8 +28495 0/imm32/no-disp32 +28496 0/imm32/no-xm32 +28497 3/imm32/x32-is-first-output +28498 0x11/imm32/alloc-id:fake +28499 _Primitive-copy-xreg-to-xreg/imm32/next +28500 # - floating-point copy +28501 _Primitive-copy-xreg-to-xreg: # (payload primitive) +28502 0x11/imm32/alloc-id:fake:payload +28503 # var1/xreg <- copy var2/xreg => f3 0f 11/<- var1/xm32 var2/x32 +28504 0x11/imm32/alloc-id:fake +28505 _string-copy/imm32/name +28506 0x11/imm32/alloc-id:fake +28507 Single-float-var-in-some-register/imm32/inouts +28508 0x11/imm32/alloc-id:fake +28509 Single-float-var-in-some-register/imm32/outputs 28510 0x11/imm32/alloc-id:fake -28511 _Primitive-loop-if-addr</imm32/next -28512 _Primitive-loop-if-addr<: # (payload primitive) -28513 0x11/imm32/alloc-id:fake:payload -28514 0x11/imm32/alloc-id:fake -28515 _string-loop-if-addr</imm32/name -28516 0/imm32/no-inouts -28517 0/imm32/no-inouts -28518 0/imm32/no-outputs -28519 0/imm32/no-outputs -28520 0x11/imm32/alloc-id:fake -28521 _string_0f_82_jump_loop/imm32/subx-name -28522 0/imm32/no-rm32 -28523 0/imm32/no-r32 -28524 0/imm32/no-imm32 -28525 0/imm32/no-imm8 -28526 0/imm32/no-disp32 -28527 0/imm32/no-xm32 -28528 0/imm32/no-x32 -28529 0x11/imm32/alloc-id:fake -28530 _Primitive-loop-if-addr>=/imm32/next -28531 _Primitive-loop-if-addr>=: # (payload primitive) -28532 0x11/imm32/alloc-id:fake:payload -28533 0x11/imm32/alloc-id:fake -28534 _string-loop-if-addr>=/imm32/name -28535 0/imm32/no-inouts -28536 0/imm32/no-inouts -28537 0/imm32/no-outputs -28538 0/imm32/no-outputs +28511 _string_f3_0f_11_copy/imm32/subx-name +28512 0/imm32/no-rm32 +28513 0/imm32/no-r32 +28514 0/imm32/no-imm32 +28515 0/imm32/no-imm8 +28516 0/imm32/no-disp32 +28517 3/imm32/xm32-is-first-output +28518 1/imm32/x32-is-first-inout +28519 0x11/imm32/alloc-id:fake +28520 _Primitive-copy-xreg-to-mem/imm32/next +28521 _Primitive-copy-xreg-to-mem: # (payload primitive) +28522 0x11/imm32/alloc-id:fake:payload +28523 # copy-to var1 var2/xreg => f3 0f 11/<- var1 var2/x32 +28524 0x11/imm32/alloc-id:fake +28525 _string-copy-to/imm32/name +28526 0x11/imm32/alloc-id:fake +28527 Two-args-float-stack-float-reg/imm32/inouts +28528 0/imm32/no-outputs +28529 0/imm32/no-outputs +28530 0x11/imm32/alloc-id:fake +28531 _string_f3_0f_11_copy/imm32/subx-name +28532 0/imm32/no-rm32 +28533 0/imm32/no-r32 +28534 0/imm32/no-imm32 +28535 0/imm32/no-imm8 +28536 0/imm32/no-disp32 +28537 1/imm32/xm32-is-first-inout +28538 2/imm32/x32-is-second-inout 28539 0x11/imm32/alloc-id:fake -28540 _string_0f_83_jump_loop/imm32/subx-name -28541 0/imm32/no-rm32 -28542 0/imm32/no-r32 -28543 0/imm32/no-imm32 -28544 0/imm32/no-imm8 -28545 0/imm32/no-disp32 -28546 0/imm32/no-xm32 -28547 0/imm32/no-x32 +28540 _Primitive-copy-mem-to-xreg/imm32/next +28541 _Primitive-copy-mem-to-xreg: # (payload primitive) +28542 0x11/imm32/alloc-id:fake:payload +28543 # var1/xreg <- copy var2 => f3 0f 10/-> var2/rm32 var1/x32 +28544 0x11/imm32/alloc-id:fake +28545 _string-copy/imm32/name +28546 0x11/imm32/alloc-id:fake +28547 Single-float-var-in-mem/imm32/inouts 28548 0x11/imm32/alloc-id:fake -28549 _Primitive-loop-if-=/imm32/next -28550 _Primitive-loop-if-=: # (payload primitive) -28551 0x11/imm32/alloc-id:fake:payload -28552 0x11/imm32/alloc-id:fake -28553 _string-loop-if-=/imm32/name -28554 0/imm32/no-inouts -28555 0/imm32/no-inouts -28556 0/imm32/no-outputs -28557 0/imm32/no-outputs -28558 0x11/imm32/alloc-id:fake -28559 _string_0f_84_jump_loop/imm32/subx-name -28560 0/imm32/no-rm32 -28561 0/imm32/no-r32 -28562 0/imm32/no-imm32 -28563 0/imm32/no-imm8 -28564 0/imm32/no-disp32 -28565 0/imm32/no-xm32 -28566 0/imm32/no-x32 +28549 Single-float-var-in-some-register/imm32/outputs +28550 0x11/imm32/alloc-id:fake +28551 _string_f3_0f_10_copy/imm32/subx-name +28552 0/imm32/no-rm32 +28553 0/imm32/no-r32 +28554 0/imm32/no-imm32 +28555 0/imm32/no-imm8 +28556 0/imm32/no-disp32 +28557 1/imm32/xm32-is-first-inout +28558 3/imm32/x32-is-first-output +28559 0x11/imm32/alloc-id:fake +28560 _Primitive-address-of-xmem/imm32/next +28561 # - floating-point-address +28562 _Primitive-address-of-xmem: # (payload primitive) +28563 0x11/imm32/alloc-id:fake:payload +28564 # var1/reg <- address var2 => 8d/copy-address var2/rm32 var1/r32 +28565 0x11/imm32/alloc-id:fake +28566 _string-address/imm32/name 28567 0x11/imm32/alloc-id:fake -28568 _Primitive-loop-if-!=/imm32/next -28569 _Primitive-loop-if-!=: # (payload primitive) -28570 0x11/imm32/alloc-id:fake:payload +28568 Single-float-var-in-mem/imm32/inouts +28569 0x11/imm32/alloc-id:fake +28570 Single-addr-var-in-some-register/imm32/outputs 28571 0x11/imm32/alloc-id:fake -28572 _string-loop-if-!=/imm32/name -28573 0/imm32/no-inouts -28574 0/imm32/no-inouts -28575 0/imm32/no-outputs -28576 0/imm32/no-outputs -28577 0x11/imm32/alloc-id:fake -28578 _string_0f_85_jump_loop/imm32/subx-name -28579 0/imm32/no-rm32 -28580 0/imm32/no-r32 -28581 0/imm32/no-imm32 -28582 0/imm32/no-imm8 -28583 0/imm32/no-disp32 -28584 0/imm32/no-xm32 -28585 0/imm32/no-x32 +28572 _string_8d_copy_address/imm32/subx-name +28573 1/imm32/rm32-is-first-inout +28574 3/imm32/r32-is-first-output +28575 0/imm32/no-imm32 +28576 0/imm32/no-imm8 +28577 0/imm32/no-disp32 +28578 0/imm32/no-xm32 +28579 0/imm32/no-x32 +28580 0x11/imm32/alloc-id:fake +28581 _Primitive-add-xreg-to-xreg/imm32/next +28582 # - floating-point add +28583 _Primitive-add-xreg-to-xreg: # (payload primitive) +28584 0x11/imm32/alloc-id:fake:payload +28585 # var1/xreg <- add var2/xreg => f3 0f 58/add var1/xm32 var2/x32 28586 0x11/imm32/alloc-id:fake -28587 _Primitive-loop-if-addr<=/imm32/next -28588 _Primitive-loop-if-addr<=: # (payload primitive) -28589 0x11/imm32/alloc-id:fake:payload +28587 _string-add/imm32/name +28588 0x11/imm32/alloc-id:fake +28589 Single-float-var-in-some-register/imm32/inouts 28590 0x11/imm32/alloc-id:fake -28591 _string-loop-if-addr<=/imm32/name -28592 0/imm32/no-inouts -28593 0/imm32/no-inouts -28594 0/imm32/no-outputs -28595 0/imm32/no-outputs -28596 0x11/imm32/alloc-id:fake -28597 _string_0f_86_jump_loop/imm32/subx-name -28598 0/imm32/no-rm32 -28599 0/imm32/no-r32 -28600 0/imm32/no-imm32 -28601 0/imm32/no-imm8 -28602 0/imm32/no-disp32 -28603 0/imm32/no-xm32 -28604 0/imm32/no-x32 -28605 0x11/imm32/alloc-id:fake -28606 _Primitive-loop-if-addr>/imm32/next -28607 _Primitive-loop-if-addr>: # (payload primitive) -28608 0x11/imm32/alloc-id:fake:payload -28609 0x11/imm32/alloc-id:fake -28610 _string-loop-if-addr>/imm32/name -28611 0/imm32/no-inouts -28612 0/imm32/no-inouts -28613 0/imm32/no-outputs -28614 0/imm32/no-outputs -28615 0x11/imm32/alloc-id:fake -28616 _string_0f_87_jump_loop/imm32/subx-name -28617 0/imm32/no-rm32 -28618 0/imm32/no-r32 -28619 0/imm32/no-imm32 -28620 0/imm32/no-imm8 -28621 0/imm32/no-disp32 -28622 0/imm32/no-xm32 -28623 0/imm32/no-x32 -28624 0x11/imm32/alloc-id:fake -28625 _Primitive-loop-if-</imm32/next -28626 _Primitive-loop-if-<: # (payload primitive) -28627 0x11/imm32/alloc-id:fake:payload -28628 0x11/imm32/alloc-id:fake -28629 _string-loop-if-</imm32/name -28630 0/imm32/no-inouts -28631 0/imm32/no-inouts -28632 0/imm32/no-outputs -28633 0/imm32/no-outputs -28634 0x11/imm32/alloc-id:fake -28635 _string_0f_8c_jump_loop/imm32/subx-name -28636 0/imm32/no-rm32 -28637 0/imm32/no-r32 -28638 0/imm32/no-imm32 -28639 0/imm32/no-imm8 -28640 0/imm32/no-disp32 -28641 0/imm32/no-xm32 -28642 0/imm32/no-x32 -28643 0x11/imm32/alloc-id:fake -28644 _Primitive-loop-if->=/imm32/next -28645 _Primitive-loop-if->=: # (payload primitive) -28646 0x11/imm32/alloc-id:fake:payload +28591 Single-float-var-in-some-register/imm32/outputs +28592 0x11/imm32/alloc-id:fake +28593 _string_f3_0f_58_add/imm32/subx-name +28594 0/imm32/no-rm32 +28595 0/imm32/no-r32 +28596 0/imm32/no-imm32 +28597 0/imm32/no-imm8 +28598 0/imm32/no-disp32 +28599 1/imm32/xm32-is-first-inout +28600 3/imm32/x32-is-first-output +28601 0x11/imm32/alloc-id:fake +28602 _Primitive-add-mem-to-xreg/imm32/next +28603 _Primitive-add-mem-to-xreg: # (payload primitive) +28604 0x11/imm32/alloc-id:fake:payload +28605 # var1/xreg <- add var2 => f3 0f 58/add var2/xm32 var1/x32 +28606 0x11/imm32/alloc-id:fake +28607 _string-add/imm32/name +28608 0x11/imm32/alloc-id:fake +28609 Single-float-var-in-mem/imm32/inouts +28610 0x11/imm32/alloc-id:fake +28611 Single-float-var-in-some-register/imm32/outputs +28612 0x11/imm32/alloc-id:fake +28613 _string_f3_0f_58_add/imm32/subx-name +28614 0/imm32/no-rm32 +28615 0/imm32/no-r32 +28616 0/imm32/no-imm32 +28617 0/imm32/no-imm8 +28618 0/imm32/no-disp32 +28619 1/imm32/xm32-is-first-inout +28620 3/imm32/x32-is-first-output +28621 0x11/imm32/alloc-id:fake +28622 _Primitive-subtract-xreg-from-xreg/imm32/next +28623 # - floating-point subtract +28624 _Primitive-subtract-xreg-from-xreg: # (payload primitive) +28625 0x11/imm32/alloc-id:fake:payload +28626 # var1/xreg <- subtract var2/xreg => f3 0f 5c/subtract var1/xm32 var2/x32 +28627 0x11/imm32/alloc-id:fake +28628 _string-subtract/imm32/name +28629 0x11/imm32/alloc-id:fake +28630 Single-float-var-in-some-register/imm32/inouts +28631 0x11/imm32/alloc-id:fake +28632 Single-float-var-in-some-register/imm32/outputs +28633 0x11/imm32/alloc-id:fake +28634 _string_f3_0f_5c_subtract/imm32/subx-name +28635 0/imm32/no-rm32 +28636 0/imm32/no-r32 +28637 0/imm32/no-imm32 +28638 0/imm32/no-imm8 +28639 0/imm32/no-disp32 +28640 1/imm32/xm32-is-first-inout +28641 3/imm32/x32-is-first-output +28642 0x11/imm32/alloc-id:fake +28643 _Primitive-subtract-mem-from-xreg/imm32/next +28644 _Primitive-subtract-mem-from-xreg: # (payload primitive) +28645 0x11/imm32/alloc-id:fake:payload +28646 # var1/xreg <- subtract var2 => f3 0f 5c/subtract var2/xm32 var1/x32 28647 0x11/imm32/alloc-id:fake -28648 _string-loop-if->=/imm32/name -28649 0/imm32/no-inouts -28650 0/imm32/no-inouts -28651 0/imm32/no-outputs -28652 0/imm32/no-outputs +28648 _string-subtract/imm32/name +28649 0x11/imm32/alloc-id:fake +28650 Single-float-var-in-mem/imm32/inouts +28651 0x11/imm32/alloc-id:fake +28652 Single-float-var-in-some-register/imm32/outputs 28653 0x11/imm32/alloc-id:fake -28654 _string_0f_8d_jump_loop/imm32/subx-name +28654 _string_f3_0f_5c_subtract/imm32/subx-name 28655 0/imm32/no-rm32 28656 0/imm32/no-r32 28657 0/imm32/no-imm32 28658 0/imm32/no-imm8 28659 0/imm32/no-disp32 -28660 0/imm32/no-xm32 -28661 0/imm32/no-x32 +28660 1/imm32/xm32-is-first-inout +28661 3/imm32/x32-is-first-output 28662 0x11/imm32/alloc-id:fake -28663 _Primitive-loop-if-<=/imm32/next -28664 _Primitive-loop-if-<=: # (payload primitive) -28665 0x11/imm32/alloc-id:fake:payload -28666 0x11/imm32/alloc-id:fake -28667 _string-loop-if-<=/imm32/name -28668 0/imm32/no-inouts -28669 0/imm32/no-inouts -28670 0/imm32/no-outputs -28671 0/imm32/no-outputs +28663 _Primitive-multiply-xreg-by-xreg/imm32/next +28664 # - floating-point multiply +28665 _Primitive-multiply-xreg-by-xreg: # (payload primitive) +28666 0x11/imm32/alloc-id:fake:payload +28667 # var1/xreg <- multiply var2 => f3 0f 59/multiply var2/xm32 var1/x32 +28668 0x11/imm32/alloc-id:fake +28669 _string-multiply/imm32/name +28670 0x11/imm32/alloc-id:fake +28671 Single-float-var-in-some-register/imm32/inouts 28672 0x11/imm32/alloc-id:fake -28673 _string_0f_8e_jump_loop/imm32/subx-name -28674 0/imm32/no-rm32 -28675 0/imm32/no-r32 -28676 0/imm32/no-imm32 -28677 0/imm32/no-imm8 -28678 0/imm32/no-disp32 -28679 0/imm32/no-xm32 -28680 0/imm32/no-x32 -28681 0x11/imm32/alloc-id:fake -28682 _Primitive-loop-if->/imm32/next -28683 _Primitive-loop-if->: # (payload primitive) -28684 0x11/imm32/alloc-id:fake:payload -28685 0x11/imm32/alloc-id:fake -28686 _string-loop-if->/imm32/name -28687 0/imm32/no-inouts -28688 0/imm32/no-inouts -28689 0/imm32/no-outputs -28690 0/imm32/no-outputs -28691 0x11/imm32/alloc-id:fake -28692 _string_0f_8f_jump_loop/imm32/subx-name -28693 0/imm32/no-rm32 -28694 0/imm32/no-r32 -28695 0/imm32/no-imm32 -28696 0/imm32/no-imm8 -28697 0/imm32/no-disp32 -28698 0/imm32/no-xm32 -28699 0/imm32/no-x32 -28700 0x11/imm32/alloc-id:fake -28701 _Primitive-loop/imm32/next # we probably don't need an unconditional break -28702 _Primitive-loop: # (payload primitive) -28703 0x11/imm32/alloc-id:fake:payload -28704 0x11/imm32/alloc-id:fake -28705 _string-loop/imm32/name -28706 0/imm32/no-inouts -28707 0/imm32/no-inouts -28708 0/imm32/no-outputs -28709 0/imm32/no-outputs -28710 0x11/imm32/alloc-id:fake -28711 _string_e9_jump_loop/imm32/subx-name -28712 0/imm32/no-rm32 -28713 0/imm32/no-r32 -28714 0/imm32/no-imm32 -28715 0/imm32/no-imm8 -28716 0/imm32/no-disp32 -28717 0/imm32/no-xm32 -28718 0/imm32/no-x32 -28719 0x11/imm32/alloc-id:fake -28720 _Primitive-break-if-addr<-named/imm32/next -28721 # - branches to named blocks -28722 _Primitive-break-if-addr<-named: # (payload primitive) -28723 0x11/imm32/alloc-id:fake:payload +28673 Single-float-var-in-some-register/imm32/outputs +28674 0x11/imm32/alloc-id:fake +28675 _string_f3_0f_59_multiply/imm32/subx-name +28676 0/imm32/no-rm32 +28677 0/imm32/no-r32 +28678 0/imm32/no-imm32 +28679 0/imm32/no-imm8 +28680 0/imm32/no-disp32 +28681 1/imm32/xm32-is-first-inout +28682 3/imm32/x32-is-first-output +28683 0x11/imm32/alloc-id:fake +28684 _Primitive-multiply-xreg-by-mem/imm32/next +28685 _Primitive-multiply-xreg-by-mem: # (payload primitive) +28686 0x11/imm32/alloc-id:fake:payload +28687 # var1/xreg <- multiply var2 => 53 0f 59/multiply var2/xm32 var1/x32 +28688 0x11/imm32/alloc-id:fake +28689 _string-multiply/imm32/name +28690 0x11/imm32/alloc-id:fake +28691 Single-float-var-in-mem/imm32/inouts +28692 0x11/imm32/alloc-id:fake +28693 Single-float-var-in-some-register/imm32/outputs +28694 0x11/imm32/alloc-id:fake +28695 _string_f3_0f_59_multiply/imm32/subx-name +28696 0/imm32/no-rm32 +28697 0/imm32/no-r32 +28698 0/imm32/no-imm32 +28699 0/imm32/no-imm8 +28700 0/imm32/no-disp32 +28701 1/imm32/xm32-is-first-inout +28702 3/imm32/x32-is-first-output +28703 0x11/imm32/alloc-id:fake +28704 _Primitive-divide-xreg-by-xreg/imm32/next +28705 # - floating-point divide +28706 _Primitive-divide-xreg-by-xreg: # (payload primitive) +28707 0x11/imm32/alloc-id:fake:payload +28708 # var1/xreg <- divide var2 => f3 0f 5e/divide var2/xm32 var1/x32 +28709 0x11/imm32/alloc-id:fake +28710 _string-divide/imm32/name +28711 0x11/imm32/alloc-id:fake +28712 Single-float-var-in-some-register/imm32/inouts +28713 0x11/imm32/alloc-id:fake +28714 Single-float-var-in-some-register/imm32/outputs +28715 0x11/imm32/alloc-id:fake +28716 _string_f3_0f_5e_divide/imm32/subx-name +28717 0/imm32/no-rm32 +28718 0/imm32/no-r32 +28719 0/imm32/no-imm32 +28720 0/imm32/no-imm8 +28721 0/imm32/no-disp32 +28722 1/imm32/xm32-is-first-inout +28723 3/imm32/x32-is-first-output 28724 0x11/imm32/alloc-id:fake -28725 _string-break-if-addr</imm32/name -28726 0x11/imm32/alloc-id:fake -28727 Single-lit-var/imm32/inouts -28728 0/imm32/no-outputs -28729 0/imm32/no-outputs -28730 0x11/imm32/alloc-id:fake -28731 _string_0f_82_jump_label/imm32/subx-name -28732 0/imm32/no-rm32 -28733 0/imm32/no-r32 -28734 0/imm32/no-imm32 -28735 0/imm32/no-imm8 -28736 1/imm32/disp32-is-first-inout -28737 0/imm32/no-xm32 -28738 0/imm32/no-x32 -28739 0x11/imm32/alloc-id:fake -28740 _Primitive-break-if-addr>=-named/imm32/next -28741 _Primitive-break-if-addr>=-named: # (payload primitive) -28742 0x11/imm32/alloc-id:fake:payload -28743 0x11/imm32/alloc-id:fake -28744 _string-break-if-addr>=/imm32/name -28745 0x11/imm32/alloc-id:fake -28746 Single-lit-var/imm32/inouts -28747 0/imm32/no-outputs -28748 0/imm32/no-outputs -28749 0x11/imm32/alloc-id:fake -28750 _string_0f_83_jump_label/imm32/subx-name -28751 0/imm32/no-rm32 -28752 0/imm32/no-r32 -28753 0/imm32/no-imm32 -28754 0/imm32/no-imm8 -28755 1/imm32/disp32-is-first-inout -28756 0/imm32/no-xm32 -28757 0/imm32/no-x32 -28758 0x11/imm32/alloc-id:fake -28759 _Primitive-break-if-=-named/imm32/next -28760 _Primitive-break-if-=-named: # (payload primitive) -28761 0x11/imm32/alloc-id:fake:payload -28762 0x11/imm32/alloc-id:fake -28763 _string-break-if-=/imm32/name -28764 0x11/imm32/alloc-id:fake -28765 Single-lit-var/imm32/inouts -28766 0/imm32/no-outputs -28767 0/imm32/no-outputs -28768 0x11/imm32/alloc-id:fake -28769 _string_0f_84_jump_label/imm32/subx-name -28770 0/imm32/no-rm32 -28771 0/imm32/no-r32 -28772 0/imm32/no-imm32 -28773 0/imm32/no-imm8 -28774 1/imm32/disp32-is-first-inout -28775 0/imm32/no-xm32 -28776 0/imm32/no-x32 -28777 0x11/imm32/alloc-id:fake -28778 _Primitive-break-if-!=-named/imm32/next -28779 _Primitive-break-if-!=-named: # (payload primitive) -28780 0x11/imm32/alloc-id:fake:payload -28781 0x11/imm32/alloc-id:fake -28782 _string-break-if-!=/imm32/name -28783 0x11/imm32/alloc-id:fake -28784 Single-lit-var/imm32/inouts -28785 0/imm32/no-outputs -28786 0/imm32/no-outputs -28787 0x11/imm32/alloc-id:fake -28788 _string_0f_85_jump_label/imm32/subx-name -28789 0/imm32/no-rm32 -28790 0/imm32/no-r32 -28791 0/imm32/no-imm32 -28792 0/imm32/no-imm8 -28793 1/imm32/disp32-is-first-inout -28794 0/imm32/no-xm32 -28795 0/imm32/no-x32 -28796 0x11/imm32/alloc-id:fake -28797 _Primitive-break-if-addr<=-named/imm32/next -28798 _Primitive-break-if-addr<=-named: # (payload primitive) -28799 0x11/imm32/alloc-id:fake:payload -28800 0x11/imm32/alloc-id:fake -28801 _string-break-if-addr<=/imm32/name -28802 0x11/imm32/alloc-id:fake -28803 Single-lit-var/imm32/inouts -28804 0/imm32/no-outputs -28805 0/imm32/no-outputs +28725 _Primitive-divide-xreg-by-mem/imm32/next +28726 _Primitive-divide-xreg-by-mem: # (payload primitive) +28727 0x11/imm32/alloc-id:fake:payload +28728 # var1/xreg <- divide var2 => f3 0f 5e/divide var2/xm32 var1/x32 +28729 0x11/imm32/alloc-id:fake +28730 _string-divide/imm32/name +28731 0x11/imm32/alloc-id:fake +28732 Single-float-var-in-mem/imm32/inouts +28733 0x11/imm32/alloc-id:fake +28734 Single-float-var-in-some-register/imm32/outputs +28735 0x11/imm32/alloc-id:fake +28736 _string_f3_0f_5e_divide/imm32/subx-name +28737 0/imm32/no-rm32 +28738 0/imm32/no-r32 +28739 0/imm32/no-imm32 +28740 0/imm32/no-imm8 +28741 0/imm32/no-disp32 +28742 1/imm32/xm32-is-first-inout +28743 3/imm32/x32-is-first-output +28744 0x11/imm32/alloc-id:fake +28745 _Primitive-max-xreg-with-xreg/imm32/next +28746 # - floating-point maximum +28747 _Primitive-max-xreg-with-xreg: # (payload primitive) +28748 0x11/imm32/alloc-id:fake:payload +28749 # var1/xreg <- max var2 => f3 0f 5f/max var2/xm32 var1/x32 +28750 0x11/imm32/alloc-id:fake +28751 _string-max/imm32/name +28752 0x11/imm32/alloc-id:fake +28753 Single-float-var-in-some-register/imm32/inouts +28754 0x11/imm32/alloc-id:fake +28755 Single-float-var-in-some-register/imm32/outputs +28756 0x11/imm32/alloc-id:fake +28757 _string_f3_0f_5f_max/imm32/subx-name +28758 0/imm32/no-rm32 +28759 0/imm32/no-r32 +28760 0/imm32/no-imm32 +28761 0/imm32/no-imm8 +28762 0/imm32/no-disp32 +28763 1/imm32/xm32-is-first-inout +28764 3/imm32/x32-is-first-output +28765 0x11/imm32/alloc-id:fake +28766 _Primitive-max-xreg-with-mem/imm32/next +28767 _Primitive-max-xreg-with-mem: # (payload primitive) +28768 0x11/imm32/alloc-id:fake:payload +28769 # var1/xreg <- divide var2 => f3 0f 5f/max var2/xm32 var1/x32 +28770 0x11/imm32/alloc-id:fake +28771 _string-max/imm32/name +28772 0x11/imm32/alloc-id:fake +28773 Single-float-var-in-mem/imm32/inouts +28774 0x11/imm32/alloc-id:fake +28775 Single-float-var-in-some-register/imm32/outputs +28776 0x11/imm32/alloc-id:fake +28777 _string_f3_0f_5f_max/imm32/subx-name +28778 0/imm32/no-rm32 +28779 0/imm32/no-r32 +28780 0/imm32/no-imm32 +28781 0/imm32/no-imm8 +28782 0/imm32/no-disp32 +28783 1/imm32/xm32-is-first-inout +28784 3/imm32/x32-is-first-output +28785 0x11/imm32/alloc-id:fake +28786 _Primitive-min-xreg-with-xreg/imm32/next +28787 # - floating-point minimum +28788 _Primitive-min-xreg-with-xreg: # (payload primitive) +28789 0x11/imm32/alloc-id:fake:payload +28790 # var1/xreg <- divide var2 => f3 0f 5d/min var2/xm32 var1/x32 +28791 0x11/imm32/alloc-id:fake +28792 _string-min/imm32/name +28793 0x11/imm32/alloc-id:fake +28794 Single-float-var-in-some-register/imm32/inouts +28795 0x11/imm32/alloc-id:fake +28796 Single-float-var-in-some-register/imm32/outputs +28797 0x11/imm32/alloc-id:fake +28798 _string_f3_0f_5d_min/imm32/subx-name +28799 0/imm32/no-rm32 +28800 0/imm32/no-r32 +28801 0/imm32/no-imm32 +28802 0/imm32/no-imm8 +28803 0/imm32/no-disp32 +28804 1/imm32/xm32-is-first-inout +28805 3/imm32/x32-is-first-output 28806 0x11/imm32/alloc-id:fake -28807 _string_0f_86_jump_label/imm32/subx-name -28808 0/imm32/no-rm32 -28809 0/imm32/no-r32 -28810 0/imm32/no-imm32 -28811 0/imm32/no-imm8 -28812 1/imm32/disp32-is-first-inout -28813 0/imm32/no-xm32 -28814 0/imm32/no-x32 +28807 _Primitive-min-xreg-with-mem/imm32/next +28808 _Primitive-min-xreg-with-mem: # (payload primitive) +28809 0x11/imm32/alloc-id:fake:payload +28810 # var1/xreg <- divide var2 => f3 0f 5d/min var2/xm32 var1/x32 +28811 0x11/imm32/alloc-id:fake +28812 _string-min/imm32/name +28813 0x11/imm32/alloc-id:fake +28814 Single-float-var-in-mem/imm32/inouts 28815 0x11/imm32/alloc-id:fake -28816 _Primitive-break-if-addr>-named/imm32/next -28817 _Primitive-break-if-addr>-named: # (payload primitive) -28818 0x11/imm32/alloc-id:fake:payload -28819 0x11/imm32/alloc-id:fake -28820 _string-break-if-addr>/imm32/name -28821 0x11/imm32/alloc-id:fake -28822 Single-lit-var/imm32/inouts -28823 0/imm32/no-outputs -28824 0/imm32/no-outputs -28825 0x11/imm32/alloc-id:fake -28826 _string_0f_87_jump_label/imm32/subx-name -28827 0/imm32/no-rm32 -28828 0/imm32/no-r32 -28829 0/imm32/no-imm32 -28830 0/imm32/no-imm8 -28831 1/imm32/disp32-is-first-inout -28832 0/imm32/no-xm32 -28833 0/imm32/no-x32 +28816 Single-float-var-in-some-register/imm32/outputs +28817 0x11/imm32/alloc-id:fake +28818 _string_f3_0f_5d_min/imm32/subx-name +28819 0/imm32/no-rm32 +28820 0/imm32/no-r32 +28821 0/imm32/no-imm32 +28822 0/imm32/no-imm8 +28823 0/imm32/no-disp32 +28824 1/imm32/xm32-is-first-inout +28825 3/imm32/x32-is-first-output +28826 0x11/imm32/alloc-id:fake +28827 _Primitive-reciprocal-xreg-to-xreg/imm32/next +28828 # - floating-point reciprocal +28829 _Primitive-reciprocal-xreg-to-xreg: # (payload primitive) +28830 0x11/imm32/alloc-id:fake:payload +28831 # var1/xreg <- reciprocal var2 => f3 0f 53/reciprocal var2/xm32 var1/x32 +28832 0x11/imm32/alloc-id:fake +28833 _string-reciprocal/imm32/name 28834 0x11/imm32/alloc-id:fake -28835 _Primitive-break-if-<-named/imm32/next -28836 _Primitive-break-if-<-named: # (payload primitive) -28837 0x11/imm32/alloc-id:fake:payload +28835 Single-float-var-in-some-register/imm32/inouts +28836 0x11/imm32/alloc-id:fake +28837 Single-float-var-in-some-register/imm32/outputs 28838 0x11/imm32/alloc-id:fake -28839 _string-break-if-</imm32/name -28840 0x11/imm32/alloc-id:fake -28841 Single-lit-var/imm32/inouts -28842 0/imm32/no-outputs -28843 0/imm32/no-outputs -28844 0x11/imm32/alloc-id:fake -28845 _string_0f_8c_jump_label/imm32/subx-name -28846 0/imm32/no-rm32 -28847 0/imm32/no-r32 -28848 0/imm32/no-imm32 -28849 0/imm32/no-imm8 -28850 1/imm32/disp32-is-first-inout -28851 0/imm32/no-xm32 -28852 0/imm32/no-x32 -28853 0x11/imm32/alloc-id:fake -28854 _Primitive-break-if->=-named/imm32/next -28855 _Primitive-break-if->=-named: # (payload primitive) -28856 0x11/imm32/alloc-id:fake:payload -28857 0x11/imm32/alloc-id:fake -28858 _string-break-if->=/imm32/name -28859 0x11/imm32/alloc-id:fake -28860 Single-lit-var/imm32/inouts -28861 0/imm32/no-outputs -28862 0/imm32/no-outputs -28863 0x11/imm32/alloc-id:fake -28864 _string_0f_8d_jump_label/imm32/subx-name -28865 0/imm32/no-rm32 -28866 0/imm32/no-r32 -28867 0/imm32/no-imm32 -28868 0/imm32/no-imm8 -28869 1/imm32/disp32-is-first-inout -28870 0/imm32/no-xm32 -28871 0/imm32/no-x32 -28872 0x11/imm32/alloc-id:fake -28873 _Primitive-break-if-<=-named/imm32/next -28874 _Primitive-break-if-<=-named: # (payload primitive) -28875 0x11/imm32/alloc-id:fake:payload -28876 0x11/imm32/alloc-id:fake -28877 _string-break-if-<=/imm32/name -28878 0x11/imm32/alloc-id:fake -28879 Single-lit-var/imm32/inouts -28880 0/imm32/no-outputs -28881 0/imm32/no-outputs -28882 0x11/imm32/alloc-id:fake -28883 _string_0f_8e_jump_label/imm32/subx-name -28884 0/imm32/no-rm32 -28885 0/imm32/no-r32 -28886 0/imm32/no-imm32 -28887 0/imm32/no-imm8 -28888 1/imm32/disp32-is-first-inout -28889 0/imm32/no-xm32 -28890 0/imm32/no-x32 -28891 0x11/imm32/alloc-id:fake -28892 _Primitive-break-if->-named/imm32/next -28893 _Primitive-break-if->-named: # (payload primitive) -28894 0x11/imm32/alloc-id:fake:payload +28839 _string_f3_0f_53_reciprocal/imm32/subx-name +28840 0/imm32/no-rm32 +28841 0/imm32/no-r32 +28842 0/imm32/no-imm32 +28843 0/imm32/no-imm8 +28844 0/imm32/no-disp32 +28845 1/imm32/xm32-is-first-inout +28846 3/imm32/x32-is-first-output +28847 0x11/imm32/alloc-id:fake +28848 _Primitive-reciprocal-mem-to-xreg/imm32/next +28849 _Primitive-reciprocal-mem-to-xreg: # (payload primitive) +28850 0x11/imm32/alloc-id:fake:payload +28851 # var1/xreg <- divide var2 => f3 0f 53/reciprocal var2/xm32 var1/x32 +28852 0x11/imm32/alloc-id:fake +28853 _string-reciprocal/imm32/name +28854 0x11/imm32/alloc-id:fake +28855 Single-float-var-in-mem/imm32/inouts +28856 0x11/imm32/alloc-id:fake +28857 Single-float-var-in-some-register/imm32/outputs +28858 0x11/imm32/alloc-id:fake +28859 _string_f3_0f_53_reciprocal/imm32/subx-name +28860 0/imm32/no-rm32 +28861 0/imm32/no-r32 +28862 0/imm32/no-imm32 +28863 0/imm32/no-imm8 +28864 0/imm32/no-disp32 +28865 1/imm32/xm32-is-first-inout +28866 3/imm32/x32-is-first-output +28867 0x11/imm32/alloc-id:fake +28868 _Primitive-square-root-xreg-to-xreg/imm32/next +28869 # - floating-point square root +28870 _Primitive-square-root-xreg-to-xreg: # (payload primitive) +28871 0x11/imm32/alloc-id:fake:payload +28872 # var1/xreg <- square-root var2 => f3 0f 51/square-root var2/xm32 var1/x32 +28873 0x11/imm32/alloc-id:fake +28874 _string-square-root/imm32/name +28875 0x11/imm32/alloc-id:fake +28876 Single-float-var-in-some-register/imm32/inouts +28877 0x11/imm32/alloc-id:fake +28878 Single-float-var-in-some-register/imm32/outputs +28879 0x11/imm32/alloc-id:fake +28880 _string_f3_0f_51_square_root/imm32/subx-name +28881 0/imm32/no-rm32 +28882 0/imm32/no-r32 +28883 0/imm32/no-imm32 +28884 0/imm32/no-imm8 +28885 0/imm32/no-disp32 +28886 1/imm32/xm32-is-first-inout +28887 3/imm32/x32-is-first-output +28888 0x11/imm32/alloc-id:fake +28889 _Primitive-square-root-mem-to-xreg/imm32/next +28890 _Primitive-square-root-mem-to-xreg: # (payload primitive) +28891 0x11/imm32/alloc-id:fake:payload +28892 # var1/xreg <- divide var2 => f3 0f 51/square-root var2/xm32 var1/x32 +28893 0x11/imm32/alloc-id:fake +28894 _string-square-root/imm32/name 28895 0x11/imm32/alloc-id:fake -28896 _string-break-if->/imm32/name +28896 Single-float-var-in-mem/imm32/inouts 28897 0x11/imm32/alloc-id:fake -28898 Single-lit-var/imm32/inouts -28899 0/imm32/no-outputs -28900 0/imm32/no-outputs -28901 0x11/imm32/alloc-id:fake -28902 _string_0f_8f_jump_label/imm32/subx-name -28903 0/imm32/no-rm32 -28904 0/imm32/no-r32 -28905 0/imm32/no-imm32 -28906 0/imm32/no-imm8 -28907 1/imm32/disp32-is-first-inout -28908 0/imm32/no-xm32 -28909 0/imm32/no-x32 -28910 0x11/imm32/alloc-id:fake -28911 _Primitive-break-named/imm32/next -28912 _Primitive-break-named: # (payload primitive) -28913 0x11/imm32/alloc-id:fake:payload +28898 Single-float-var-in-some-register/imm32/outputs +28899 0x11/imm32/alloc-id:fake +28900 _string_f3_0f_51_square_root/imm32/subx-name +28901 0/imm32/no-rm32 +28902 0/imm32/no-r32 +28903 0/imm32/no-imm32 +28904 0/imm32/no-imm8 +28905 0/imm32/no-disp32 +28906 1/imm32/xm32-is-first-inout +28907 3/imm32/x32-is-first-output +28908 0x11/imm32/alloc-id:fake +28909 _Primitive-inverse-square-root-xreg-to-xreg/imm32/next +28910 # - floating-point inverse square root 1/sqrt(x) +28911 _Primitive-inverse-square-root-xreg-to-xreg: # (payload primitive) +28912 0x11/imm32/alloc-id:fake:payload +28913 # var1/xreg <- reciprocal var2 => f3 0f 52/inverse-square-root var2/xm32 var1/x32 28914 0x11/imm32/alloc-id:fake -28915 _string-break/imm32/name +28915 _string-inverse-square-root/imm32/name 28916 0x11/imm32/alloc-id:fake -28917 Single-lit-var/imm32/inouts -28918 0/imm32/no-outputs -28919 0/imm32/no-outputs +28917 Single-float-var-in-some-register/imm32/inouts +28918 0x11/imm32/alloc-id:fake +28919 Single-float-var-in-some-register/imm32/outputs 28920 0x11/imm32/alloc-id:fake -28921 _string_e9_jump_label/imm32/subx-name +28921 _string_f3_0f_52_inverse_square_root/imm32/subx-name 28922 0/imm32/no-rm32 28923 0/imm32/no-r32 28924 0/imm32/no-imm32 28925 0/imm32/no-imm8 -28926 1/imm32/disp32-is-first-inout -28927 0/imm32/no-xm32 -28928 0/imm32/no-x32 +28926 0/imm32/no-disp32 +28927 1/imm32/xm32-is-first-inout +28928 3/imm32/x32-is-first-output 28929 0x11/imm32/alloc-id:fake -28930 _Primitive-loop-if-addr<-named/imm32/next -28931 _Primitive-loop-if-addr<-named: # (payload primitive) +28930 _Primitive-inverse-square-root-mem-to-xreg/imm32/next +28931 _Primitive-inverse-square-root-mem-to-xreg: # (payload primitive) 28932 0x11/imm32/alloc-id:fake:payload -28933 0x11/imm32/alloc-id:fake -28934 _string-loop-if-addr</imm32/name -28935 0x11/imm32/alloc-id:fake -28936 Single-lit-var/imm32/inouts -28937 0/imm32/no-outputs -28938 0/imm32/no-outputs -28939 0x11/imm32/alloc-id:fake -28940 _string_0f_82_jump_label/imm32/subx-name -28941 0/imm32/no-rm32 -28942 0/imm32/no-r32 -28943 0/imm32/no-imm32 -28944 0/imm32/no-imm8 -28945 1/imm32/disp32-is-first-inout -28946 0/imm32/no-xm32 -28947 0/imm32/no-x32 -28948 0x11/imm32/alloc-id:fake -28949 _Primitive-loop-if-addr>=-named/imm32/next -28950 _Primitive-loop-if-addr>=-named: # (payload primitive) -28951 0x11/imm32/alloc-id:fake:payload -28952 0x11/imm32/alloc-id:fake -28953 _string-loop-if-addr>=/imm32/name -28954 0x11/imm32/alloc-id:fake -28955 Single-lit-var/imm32/inouts -28956 0/imm32/no-outputs -28957 0/imm32/no-outputs -28958 0x11/imm32/alloc-id:fake -28959 _string_0f_83_jump_label/imm32/subx-name -28960 0/imm32/no-rm32 -28961 0/imm32/no-r32 -28962 0/imm32/no-imm32 -28963 0/imm32/no-imm8 -28964 1/imm32/disp32-is-first-inout -28965 0/imm32/no-xm32 -28966 0/imm32/no-x32 -28967 0x11/imm32/alloc-id:fake -28968 _Primitive-loop-if-=-named/imm32/next -28969 _Primitive-loop-if-=-named: # (payload primitive) -28970 0x11/imm32/alloc-id:fake:payload -28971 0x11/imm32/alloc-id:fake -28972 _string-loop-if-=/imm32/name -28973 0x11/imm32/alloc-id:fake -28974 Single-lit-var/imm32/inouts -28975 0/imm32/no-outputs -28976 0/imm32/no-outputs +28933 # var1/xreg <- divide var2 => f3 0f 52/inverse-square-root var2/xm32 var1/x32 +28934 0x11/imm32/alloc-id:fake +28935 _string-inverse-square-root/imm32/name +28936 0x11/imm32/alloc-id:fake +28937 Single-float-var-in-mem/imm32/inouts +28938 0x11/imm32/alloc-id:fake +28939 Single-float-var-in-some-register/imm32/outputs +28940 0x11/imm32/alloc-id:fake +28941 _string_f3_0f_52_inverse_square_root/imm32/subx-name +28942 0/imm32/no-rm32 +28943 0/imm32/no-r32 +28944 0/imm32/no-imm32 +28945 0/imm32/no-imm8 +28946 0/imm32/no-disp32 +28947 1/imm32/xm32-is-first-inout +28948 3/imm32/x32-is-first-output +28949 0x11/imm32/alloc-id:fake +28950 _Primitive-compare-xreg-with-xreg/imm32/next +28951 # - floating-point compare +28952 _Primitive-compare-xreg-with-xreg: # (payload primitive) +28953 0x11/imm32/alloc-id:fake:payload +28954 # compare var1/reg1 var2/reg2 => 0f 2f/compare var2/x32 var1/xm32 +28955 0x11/imm32/alloc-id:fake +28956 _string-compare/imm32/name +28957 0x11/imm32/alloc-id:fake +28958 Two-float-args-in-regs/imm32/inouts +28959 0/imm32/no-outputs +28960 0/imm32/no-outputs +28961 0x11/imm32/alloc-id:fake +28962 _string_0f_2f_compare/imm32/subx-name +28963 0/imm32/no-rm32 +28964 0/imm32/no-r32 +28965 0/imm32/no-imm32 +28966 0/imm32/no-imm8 +28967 0/imm32/no-disp32 +28968 1/imm32/xm32-is-first-inout +28969 2/imm32/x32-is-second-inout +28970 0x11/imm32/alloc-id:fake +28971 _Primitive-compare-xreg-with-mem/imm32/next +28972 _Primitive-compare-xreg-with-mem: # (payload primitive) +28973 0x11/imm32/alloc-id:fake:payload +28974 # compare var1/xreg var2 => 0f 2f/compare var1/x32 var2/xm32 +28975 0x11/imm32/alloc-id:fake +28976 _string-compare/imm32/name 28977 0x11/imm32/alloc-id:fake -28978 _string_0f_84_jump_label/imm32/subx-name -28979 0/imm32/no-rm32 -28980 0/imm32/no-r32 -28981 0/imm32/no-imm32 -28982 0/imm32/no-imm8 -28983 1/imm32/disp32-is-first-inout -28984 0/imm32/no-xm32 -28985 0/imm32/no-x32 -28986 0x11/imm32/alloc-id:fake -28987 _Primitive-loop-if-!=-named/imm32/next -28988 _Primitive-loop-if-!=-named: # (payload primitive) -28989 0x11/imm32/alloc-id:fake:payload +28978 Two-args-float-reg-float-stack/imm32/inouts +28979 0/imm32/no-outputs +28980 0/imm32/no-outputs +28981 0x11/imm32/alloc-id:fake +28982 _string_0f_2f_compare/imm32/subx-name +28983 0/imm32/no-rm32 +28984 0/imm32/no-r32 +28985 0/imm32/no-imm32 +28986 0/imm32/no-imm8 +28987 0/imm32/no-disp32 +28988 2/imm32/xm32-is-second-inout +28989 1/imm32/x32-is-first-inout 28990 0x11/imm32/alloc-id:fake -28991 _string-loop-if-!=/imm32/name -28992 0x11/imm32/alloc-id:fake -28993 Single-lit-var/imm32/inouts -28994 0/imm32/no-outputs -28995 0/imm32/no-outputs -28996 0x11/imm32/alloc-id:fake -28997 _string_0f_85_jump_label/imm32/subx-name -28998 0/imm32/no-rm32 -28999 0/imm32/no-r32 -29000 0/imm32/no-imm32 -29001 0/imm32/no-imm8 -29002 1/imm32/disp32-is-first-inout -29003 0/imm32/no-xm32 -29004 0/imm32/no-x32 -29005 0x11/imm32/alloc-id:fake -29006 _Primitive-loop-if-addr<=-named/imm32/next -29007 _Primitive-loop-if-addr<=-named: # (payload primitive) -29008 0x11/imm32/alloc-id:fake:payload -29009 0x11/imm32/alloc-id:fake -29010 _string-loop-if-addr<=/imm32/name -29011 0x11/imm32/alloc-id:fake -29012 Single-lit-var/imm32/inouts -29013 0/imm32/no-outputs -29014 0/imm32/no-outputs -29015 0x11/imm32/alloc-id:fake -29016 _string_0f_86_jump_label/imm32/subx-name -29017 0/imm32/no-rm32 -29018 0/imm32/no-r32 -29019 0/imm32/no-imm32 -29020 0/imm32/no-imm8 -29021 1/imm32/disp32-is-first-inout -29022 0/imm32/no-xm32 -29023 0/imm32/no-x32 -29024 0x11/imm32/alloc-id:fake -29025 _Primitive-loop-if-addr>-named/imm32/next -29026 _Primitive-loop-if-addr>-named: # (payload primitive) -29027 0x11/imm32/alloc-id:fake:payload -29028 0x11/imm32/alloc-id:fake -29029 _string-loop-if-addr>/imm32/name -29030 0x11/imm32/alloc-id:fake -29031 Single-lit-var/imm32/inouts -29032 0/imm32/no-outputs -29033 0/imm32/no-outputs -29034 0x11/imm32/alloc-id:fake -29035 _string_0f_87_jump_label/imm32/subx-name -29036 0/imm32/no-rm32 -29037 0/imm32/no-r32 -29038 0/imm32/no-imm32 -29039 0/imm32/no-imm8 -29040 1/imm32/disp32-is-first-inout -29041 0/imm32/no-xm32 -29042 0/imm32/no-x32 -29043 0x11/imm32/alloc-id:fake -29044 _Primitive-loop-if-<-named/imm32/next -29045 _Primitive-loop-if-<-named: # (payload primitive) -29046 0x11/imm32/alloc-id:fake:payload -29047 0x11/imm32/alloc-id:fake -29048 _string-loop-if-</imm32/name -29049 0x11/imm32/alloc-id:fake -29050 Single-lit-var/imm32/inouts -29051 0/imm32/no-outputs -29052 0/imm32/no-outputs -29053 0x11/imm32/alloc-id:fake -29054 _string_0f_8c_jump_label/imm32/subx-name -29055 0/imm32/no-rm32 -29056 0/imm32/no-r32 -29057 0/imm32/no-imm32 -29058 0/imm32/no-imm8 -29059 1/imm32/disp32-is-first-inout -29060 0/imm32/no-xm32 -29061 0/imm32/no-x32 -29062 0x11/imm32/alloc-id:fake -29063 _Primitive-loop-if->=-named/imm32/next -29064 _Primitive-loop-if->=-named: # (payload primitive) -29065 0x11/imm32/alloc-id:fake:payload -29066 0x11/imm32/alloc-id:fake -29067 _string-loop-if->=/imm32/name -29068 0x11/imm32/alloc-id:fake -29069 Single-lit-var/imm32/inouts -29070 0/imm32/no-outputs -29071 0/imm32/no-outputs -29072 0x11/imm32/alloc-id:fake -29073 _string_0f_8d_jump_label/imm32/subx-name -29074 0/imm32/no-rm32 -29075 0/imm32/no-r32 -29076 0/imm32/no-imm32 -29077 0/imm32/no-imm8 -29078 1/imm32/disp32-is-first-inout -29079 0/imm32/no-xm32 -29080 0/imm32/no-x32 -29081 0x11/imm32/alloc-id:fake -29082 _Primitive-loop-if-<=-named/imm32/next -29083 _Primitive-loop-if-<=-named: # (payload primitive) -29084 0x11/imm32/alloc-id:fake:payload -29085 0x11/imm32/alloc-id:fake -29086 _string-loop-if-<=/imm32/name -29087 0x11/imm32/alloc-id:fake -29088 Single-lit-var/imm32/inouts -29089 0/imm32/no-outputs -29090 0/imm32/no-outputs -29091 0x11/imm32/alloc-id:fake -29092 _string_0f_8e_jump_label/imm32/subx-name -29093 0/imm32/no-rm32 -29094 0/imm32/no-r32 -29095 0/imm32/no-imm32 -29096 0/imm32/no-imm8 -29097 1/imm32/disp32-is-first-inout -29098 0/imm32/no-xm32 -29099 0/imm32/no-x32 -29100 0x11/imm32/alloc-id:fake -29101 _Primitive-loop-if->-named/imm32/next -29102 _Primitive-loop-if->-named: # (payload primitive) -29103 0x11/imm32/alloc-id:fake:payload -29104 0x11/imm32/alloc-id:fake -29105 _string-loop-if->/imm32/name -29106 0x11/imm32/alloc-id:fake -29107 Single-lit-var/imm32/inouts -29108 0/imm32/no-outputs -29109 0/imm32/no-outputs -29110 0x11/imm32/alloc-id:fake -29111 _string_0f_8f_jump_label/imm32/subx-name -29112 0/imm32/no-rm32 -29113 0/imm32/no-r32 -29114 0/imm32/no-imm32 -29115 0/imm32/no-imm8 -29116 1/imm32/disp32-is-first-inout -29117 0/imm32/no-xm32 -29118 0/imm32/no-x32 -29119 0x11/imm32/alloc-id:fake -29120 _Primitive-loop-named/imm32/next # we probably don't need an unconditional break -29121 _Primitive-loop-named: # (payload primitive) -29122 0x11/imm32/alloc-id:fake:payload -29123 0x11/imm32/alloc-id:fake -29124 _string-loop/imm32/name -29125 0x11/imm32/alloc-id:fake -29126 Single-lit-var/imm32/inouts -29127 0/imm32/no-outputs -29128 0/imm32/no-outputs -29129 0x11/imm32/alloc-id:fake -29130 _string_e9_jump_label/imm32/subx-name -29131 0/imm32/no-rm32 -29132 0/imm32/no-r32 -29133 0/imm32/no-imm32 -29134 0/imm32/no-imm8 -29135 1/imm32/disp32-is-first-inout -29136 0/imm32/no-xm32 -29137 0/imm32/no-x32 -29138 0x11/imm32/alloc-id:fake -29139 _Primitive-break-if-float</imm32/next -29140 # - branches based on floating-point comparisons -29141 _Primitive-break-if-float<: # (payload primitive) -29142 0x11/imm32/alloc-id:fake:payload +28991 _Primitive-break-if-addr</imm32/next +28992 # - branches +28993 _Primitive-break-if-addr<: # (payload primitive) +28994 0x11/imm32/alloc-id:fake:payload +28995 0x11/imm32/alloc-id:fake +28996 _string-break-if-addr</imm32/name +28997 0/imm32/no-inouts +28998 0/imm32/no-inouts +28999 0/imm32/no-outputs +29000 0/imm32/no-outputs +29001 0x11/imm32/alloc-id:fake +29002 _string_0f_82_jump_break/imm32/subx-name +29003 0/imm32/no-rm32 +29004 0/imm32/no-r32 +29005 0/imm32/no-imm32 +29006 0/imm32/no-imm8 +29007 0/imm32/no-disp32 +29008 0/imm32/no-xm32 +29009 0/imm32/no-x32 +29010 0x11/imm32/alloc-id:fake +29011 _Primitive-break-if-addr>=/imm32/next +29012 _Primitive-break-if-addr>=: # (payload primitive) +29013 0x11/imm32/alloc-id:fake:payload +29014 0x11/imm32/alloc-id:fake +29015 _string-break-if-addr>=/imm32/name +29016 0/imm32/no-inouts +29017 0/imm32/no-inouts +29018 0/imm32/no-outputs +29019 0/imm32/no-outputs +29020 0x11/imm32/alloc-id:fake +29021 _string_0f_83_jump_break/imm32/subx-name +29022 0/imm32/no-rm32 +29023 0/imm32/no-r32 +29024 0/imm32/no-imm32 +29025 0/imm32/no-imm8 +29026 0/imm32/no-disp32 +29027 0/imm32/no-xm32 +29028 0/imm32/no-x32 +29029 0x11/imm32/alloc-id:fake +29030 _Primitive-break-if-=/imm32/next +29031 _Primitive-break-if-=: # (payload primitive) +29032 0x11/imm32/alloc-id:fake:payload +29033 0x11/imm32/alloc-id:fake +29034 _string-break-if-=/imm32/name +29035 0/imm32/no-inouts +29036 0/imm32/no-inouts +29037 0/imm32/no-outputs +29038 0/imm32/no-outputs +29039 0x11/imm32/alloc-id:fake +29040 _string_0f_84_jump_break/imm32/subx-name +29041 0/imm32/no-rm32 +29042 0/imm32/no-r32 +29043 0/imm32/no-imm32 +29044 0/imm32/no-imm8 +29045 0/imm32/no-disp32 +29046 0/imm32/no-xm32 +29047 0/imm32/no-x32 +29048 0x11/imm32/alloc-id:fake +29049 _Primitive-break-if-!=/imm32/next +29050 _Primitive-break-if-!=: # (payload primitive) +29051 0x11/imm32/alloc-id:fake:payload +29052 0x11/imm32/alloc-id:fake +29053 _string-break-if-!=/imm32/name +29054 0/imm32/no-inouts +29055 0/imm32/no-inouts +29056 0/imm32/no-outputs +29057 0/imm32/no-outputs +29058 0x11/imm32/alloc-id:fake +29059 _string_0f_85_jump_break/imm32/subx-name +29060 0/imm32/no-rm32 +29061 0/imm32/no-r32 +29062 0/imm32/no-imm32 +29063 0/imm32/no-imm8 +29064 0/imm32/no-disp32 +29065 0/imm32/no-xm32 +29066 0/imm32/no-x32 +29067 0x11/imm32/alloc-id:fake +29068 _Primitive-break-if-addr<=/imm32/next +29069 _Primitive-break-if-addr<=: # (payload primitive) +29070 0x11/imm32/alloc-id:fake:payload +29071 0x11/imm32/alloc-id:fake +29072 _string-break-if-addr<=/imm32/name +29073 0/imm32/no-inouts +29074 0/imm32/no-inouts +29075 0/imm32/no-outputs +29076 0/imm32/no-outputs +29077 0x11/imm32/alloc-id:fake +29078 _string_0f_86_jump_break/imm32/subx-name +29079 0/imm32/no-rm32 +29080 0/imm32/no-r32 +29081 0/imm32/no-imm32 +29082 0/imm32/no-imm8 +29083 0/imm32/no-disp32 +29084 0/imm32/no-xm32 +29085 0/imm32/no-x32 +29086 0x11/imm32/alloc-id:fake +29087 _Primitive-break-if-addr>/imm32/next +29088 _Primitive-break-if-addr>: # (payload primitive) +29089 0x11/imm32/alloc-id:fake:payload +29090 0x11/imm32/alloc-id:fake +29091 _string-break-if-addr>/imm32/name +29092 0/imm32/no-inouts +29093 0/imm32/no-inouts +29094 0/imm32/no-outputs +29095 0/imm32/no-outputs +29096 0x11/imm32/alloc-id:fake +29097 _string_0f_87_jump_break/imm32/subx-name +29098 0/imm32/no-rm32 +29099 0/imm32/no-r32 +29100 0/imm32/no-imm32 +29101 0/imm32/no-imm8 +29102 0/imm32/no-disp32 +29103 0/imm32/no-xm32 +29104 0/imm32/no-x32 +29105 0x11/imm32/alloc-id:fake +29106 _Primitive-break-if-</imm32/next +29107 _Primitive-break-if-<: # (payload primitive) +29108 0x11/imm32/alloc-id:fake:payload +29109 0x11/imm32/alloc-id:fake +29110 _string-break-if-</imm32/name +29111 0/imm32/no-inouts +29112 0/imm32/no-inouts +29113 0/imm32/no-outputs +29114 0/imm32/no-outputs +29115 0x11/imm32/alloc-id:fake +29116 _string_0f_8c_jump_break/imm32/subx-name +29117 0/imm32/no-rm32 +29118 0/imm32/no-r32 +29119 0/imm32/no-imm32 +29120 0/imm32/no-imm8 +29121 0/imm32/no-disp32 +29122 0/imm32/no-xm32 +29123 0/imm32/no-x32 +29124 0x11/imm32/alloc-id:fake +29125 _Primitive-break-if->=/imm32/next +29126 _Primitive-break-if->=: # (payload primitive) +29127 0x11/imm32/alloc-id:fake:payload +29128 0x11/imm32/alloc-id:fake +29129 _string-break-if->=/imm32/name +29130 0/imm32/no-inouts +29131 0/imm32/no-inouts +29132 0/imm32/no-outputs +29133 0/imm32/no-outputs +29134 0x11/imm32/alloc-id:fake +29135 _string_0f_8d_jump_break/imm32/subx-name +29136 0/imm32/no-rm32 +29137 0/imm32/no-r32 +29138 0/imm32/no-imm32 +29139 0/imm32/no-imm8 +29140 0/imm32/no-disp32 +29141 0/imm32/no-xm32 +29142 0/imm32/no-x32 29143 0x11/imm32/alloc-id:fake -29144 _string-break-if-float</imm32/name -29145 0/imm32/no-inouts -29146 0/imm32/no-inouts -29147 0/imm32/no-outputs -29148 0/imm32/no-outputs -29149 0x11/imm32/alloc-id:fake -29150 _string_0f_82_jump_break/imm32/subx-name -29151 0/imm32/no-rm32 -29152 0/imm32/no-r32 -29153 0/imm32/no-imm32 -29154 0/imm32/no-imm8 -29155 0/imm32/no-disp32 -29156 0/imm32/no-xm32 -29157 0/imm32/no-x32 -29158 0x11/imm32/alloc-id:fake -29159 _Primitive-break-if-float>=/imm32/next -29160 _Primitive-break-if-float>=: # (payload primitive) -29161 0x11/imm32/alloc-id:fake:payload +29144 _Primitive-break-if-<=/imm32/next +29145 _Primitive-break-if-<=: # (payload primitive) +29146 0x11/imm32/alloc-id:fake:payload +29147 0x11/imm32/alloc-id:fake +29148 _string-break-if-<=/imm32/name +29149 0/imm32/no-inouts +29150 0/imm32/no-inouts +29151 0/imm32/no-outputs +29152 0/imm32/no-outputs +29153 0x11/imm32/alloc-id:fake +29154 _string_0f_8e_jump_break/imm32/subx-name +29155 0/imm32/no-rm32 +29156 0/imm32/no-r32 +29157 0/imm32/no-imm32 +29158 0/imm32/no-imm8 +29159 0/imm32/no-disp32 +29160 0/imm32/no-xm32 +29161 0/imm32/no-x32 29162 0x11/imm32/alloc-id:fake -29163 _string-break-if-float>=/imm32/name -29164 0/imm32/no-inouts -29165 0/imm32/no-inouts -29166 0/imm32/no-outputs -29167 0/imm32/no-outputs -29168 0x11/imm32/alloc-id:fake -29169 _string_0f_83_jump_break/imm32/subx-name -29170 0/imm32/no-rm32 -29171 0/imm32/no-r32 -29172 0/imm32/no-imm32 -29173 0/imm32/no-imm8 -29174 0/imm32/no-disp32 -29175 0/imm32/no-xm32 -29176 0/imm32/no-x32 -29177 0x11/imm32/alloc-id:fake -29178 _Primitive-break-if-float<=/imm32/next -29179 _Primitive-break-if-float<=: # (payload primitive) -29180 0x11/imm32/alloc-id:fake:payload +29163 _Primitive-break-if->/imm32/next +29164 _Primitive-break-if->: # (payload primitive) +29165 0x11/imm32/alloc-id:fake:payload +29166 0x11/imm32/alloc-id:fake +29167 _string-break-if->/imm32/name +29168 0/imm32/no-inouts +29169 0/imm32/no-inouts +29170 0/imm32/no-outputs +29171 0/imm32/no-outputs +29172 0x11/imm32/alloc-id:fake +29173 _string_0f_8f_jump_break/imm32/subx-name +29174 0/imm32/no-rm32 +29175 0/imm32/no-r32 +29176 0/imm32/no-imm32 +29177 0/imm32/no-imm8 +29178 0/imm32/no-disp32 +29179 0/imm32/no-xm32 +29180 0/imm32/no-x32 29181 0x11/imm32/alloc-id:fake -29182 _string-break-if-float<=/imm32/name -29183 0/imm32/no-inouts -29184 0/imm32/no-inouts -29185 0/imm32/no-outputs -29186 0/imm32/no-outputs -29187 0x11/imm32/alloc-id:fake -29188 _string_0f_86_jump_break/imm32/subx-name -29189 0/imm32/no-rm32 -29190 0/imm32/no-r32 -29191 0/imm32/no-imm32 -29192 0/imm32/no-imm8 -29193 0/imm32/no-disp32 -29194 0/imm32/no-xm32 -29195 0/imm32/no-x32 -29196 0x11/imm32/alloc-id:fake -29197 _Primitive-break-if-float>/imm32/next -29198 _Primitive-break-if-float>: # (payload primitive) -29199 0x11/imm32/alloc-id:fake:payload +29182 _Primitive-break/imm32/next +29183 _Primitive-break: # (payload primitive) +29184 0x11/imm32/alloc-id:fake:payload +29185 0x11/imm32/alloc-id:fake +29186 _string-break/imm32/name +29187 0/imm32/no-inouts +29188 0/imm32/no-inouts +29189 0/imm32/no-outputs +29190 0/imm32/no-outputs +29191 0x11/imm32/alloc-id:fake +29192 _string_e9_jump_break/imm32/subx-name +29193 0/imm32/no-rm32 +29194 0/imm32/no-r32 +29195 0/imm32/no-imm32 +29196 0/imm32/no-imm8 +29197 0/imm32/no-disp32 +29198 0/imm32/no-xm32 +29199 0/imm32/no-x32 29200 0x11/imm32/alloc-id:fake -29201 _string-break-if-float>/imm32/name -29202 0/imm32/no-inouts -29203 0/imm32/no-inouts -29204 0/imm32/no-outputs -29205 0/imm32/no-outputs -29206 0x11/imm32/alloc-id:fake -29207 _string_0f_87_jump_break/imm32/subx-name -29208 0/imm32/no-rm32 -29209 0/imm32/no-r32 -29210 0/imm32/no-imm32 -29211 0/imm32/no-imm8 -29212 0/imm32/no-disp32 -29213 0/imm32/no-xm32 -29214 0/imm32/no-x32 -29215 0x11/imm32/alloc-id:fake -29216 _Primitive-loop-if-float</imm32/next -29217 _Primitive-loop-if-float<: # (payload primitive) -29218 0x11/imm32/alloc-id:fake:payload +29201 _Primitive-loop-if-addr</imm32/next +29202 _Primitive-loop-if-addr<: # (payload primitive) +29203 0x11/imm32/alloc-id:fake:payload +29204 0x11/imm32/alloc-id:fake +29205 _string-loop-if-addr</imm32/name +29206 0/imm32/no-inouts +29207 0/imm32/no-inouts +29208 0/imm32/no-outputs +29209 0/imm32/no-outputs +29210 0x11/imm32/alloc-id:fake +29211 _string_0f_82_jump_loop/imm32/subx-name +29212 0/imm32/no-rm32 +29213 0/imm32/no-r32 +29214 0/imm32/no-imm32 +29215 0/imm32/no-imm8 +29216 0/imm32/no-disp32 +29217 0/imm32/no-xm32 +29218 0/imm32/no-x32 29219 0x11/imm32/alloc-id:fake -29220 _string-loop-if-float</imm32/name -29221 0/imm32/no-inouts -29222 0/imm32/no-inouts -29223 0/imm32/no-outputs -29224 0/imm32/no-outputs -29225 0x11/imm32/alloc-id:fake -29226 _string_0f_82_jump_loop/imm32/subx-name -29227 0/imm32/no-rm32 -29228 0/imm32/no-r32 -29229 0/imm32/no-imm32 -29230 0/imm32/no-imm8 -29231 0/imm32/no-disp32 -29232 0/imm32/no-xm32 -29233 0/imm32/no-x32 -29234 0x11/imm32/alloc-id:fake -29235 _Primitive-loop-if-float>=/imm32/next -29236 _Primitive-loop-if-float>=: # (payload primitive) -29237 0x11/imm32/alloc-id:fake:payload +29220 _Primitive-loop-if-addr>=/imm32/next +29221 _Primitive-loop-if-addr>=: # (payload primitive) +29222 0x11/imm32/alloc-id:fake:payload +29223 0x11/imm32/alloc-id:fake +29224 _string-loop-if-addr>=/imm32/name +29225 0/imm32/no-inouts +29226 0/imm32/no-inouts +29227 0/imm32/no-outputs +29228 0/imm32/no-outputs +29229 0x11/imm32/alloc-id:fake +29230 _string_0f_83_jump_loop/imm32/subx-name +29231 0/imm32/no-rm32 +29232 0/imm32/no-r32 +29233 0/imm32/no-imm32 +29234 0/imm32/no-imm8 +29235 0/imm32/no-disp32 +29236 0/imm32/no-xm32 +29237 0/imm32/no-x32 29238 0x11/imm32/alloc-id:fake -29239 _string-loop-if-float>=/imm32/name -29240 0/imm32/no-inouts -29241 0/imm32/no-inouts -29242 0/imm32/no-outputs -29243 0/imm32/no-outputs -29244 0x11/imm32/alloc-id:fake -29245 _string_0f_83_jump_loop/imm32/subx-name -29246 0/imm32/no-rm32 -29247 0/imm32/no-r32 -29248 0/imm32/no-imm32 -29249 0/imm32/no-imm8 -29250 0/imm32/no-disp32 -29251 0/imm32/no-xm32 -29252 0/imm32/no-x32 -29253 0x11/imm32/alloc-id:fake -29254 _Primitive-loop-if-float<=/imm32/next -29255 _Primitive-loop-if-float<=: # (payload primitive) -29256 0x11/imm32/alloc-id:fake:payload +29239 _Primitive-loop-if-=/imm32/next +29240 _Primitive-loop-if-=: # (payload primitive) +29241 0x11/imm32/alloc-id:fake:payload +29242 0x11/imm32/alloc-id:fake +29243 _string-loop-if-=/imm32/name +29244 0/imm32/no-inouts +29245 0/imm32/no-inouts +29246 0/imm32/no-outputs +29247 0/imm32/no-outputs +29248 0x11/imm32/alloc-id:fake +29249 _string_0f_84_jump_loop/imm32/subx-name +29250 0/imm32/no-rm32 +29251 0/imm32/no-r32 +29252 0/imm32/no-imm32 +29253 0/imm32/no-imm8 +29254 0/imm32/no-disp32 +29255 0/imm32/no-xm32 +29256 0/imm32/no-x32 29257 0x11/imm32/alloc-id:fake -29258 _string-loop-if-float<=/imm32/name -29259 0/imm32/no-inouts -29260 0/imm32/no-inouts -29261 0/imm32/no-outputs -29262 0/imm32/no-outputs -29263 0x11/imm32/alloc-id:fake -29264 _string_0f_86_jump_loop/imm32/subx-name -29265 0/imm32/no-rm32 -29266 0/imm32/no-r32 -29267 0/imm32/no-imm32 -29268 0/imm32/no-imm8 -29269 0/imm32/no-disp32 -29270 0/imm32/no-xm32 -29271 0/imm32/no-x32 -29272 0x11/imm32/alloc-id:fake -29273 _Primitive-loop-if-float>/imm32/next -29274 _Primitive-loop-if-float>: # (payload primitive) -29275 0x11/imm32/alloc-id:fake:payload +29258 _Primitive-loop-if-!=/imm32/next +29259 _Primitive-loop-if-!=: # (payload primitive) +29260 0x11/imm32/alloc-id:fake:payload +29261 0x11/imm32/alloc-id:fake +29262 _string-loop-if-!=/imm32/name +29263 0/imm32/no-inouts +29264 0/imm32/no-inouts +29265 0/imm32/no-outputs +29266 0/imm32/no-outputs +29267 0x11/imm32/alloc-id:fake +29268 _string_0f_85_jump_loop/imm32/subx-name +29269 0/imm32/no-rm32 +29270 0/imm32/no-r32 +29271 0/imm32/no-imm32 +29272 0/imm32/no-imm8 +29273 0/imm32/no-disp32 +29274 0/imm32/no-xm32 +29275 0/imm32/no-x32 29276 0x11/imm32/alloc-id:fake -29277 _string-loop-if-float>/imm32/name -29278 0/imm32/no-inouts -29279 0/imm32/no-inouts -29280 0/imm32/no-outputs -29281 0/imm32/no-outputs -29282 0x11/imm32/alloc-id:fake -29283 _string_0f_87_jump_loop/imm32/subx-name -29284 0/imm32/no-rm32 -29285 0/imm32/no-r32 -29286 0/imm32/no-imm32 -29287 0/imm32/no-imm8 -29288 0/imm32/no-disp32 -29289 0/imm32/no-xm32 -29290 0/imm32/no-x32 -29291 0x11/imm32/alloc-id:fake -29292 _Primitive-break-if-float<-named/imm32/next -29293 _Primitive-break-if-float<-named: # (payload primitive) -29294 0x11/imm32/alloc-id:fake:payload +29277 _Primitive-loop-if-addr<=/imm32/next +29278 _Primitive-loop-if-addr<=: # (payload primitive) +29279 0x11/imm32/alloc-id:fake:payload +29280 0x11/imm32/alloc-id:fake +29281 _string-loop-if-addr<=/imm32/name +29282 0/imm32/no-inouts +29283 0/imm32/no-inouts +29284 0/imm32/no-outputs +29285 0/imm32/no-outputs +29286 0x11/imm32/alloc-id:fake +29287 _string_0f_86_jump_loop/imm32/subx-name +29288 0/imm32/no-rm32 +29289 0/imm32/no-r32 +29290 0/imm32/no-imm32 +29291 0/imm32/no-imm8 +29292 0/imm32/no-disp32 +29293 0/imm32/no-xm32 +29294 0/imm32/no-x32 29295 0x11/imm32/alloc-id:fake -29296 _string-break-if-float</imm32/name -29297 0x11/imm32/alloc-id:fake -29298 Single-lit-var/imm32/inouts -29299 0/imm32/no-outputs -29300 0/imm32/no-outputs -29301 0x11/imm32/alloc-id:fake -29302 _string_0f_82_jump_label/imm32/subx-name -29303 0/imm32/no-rm32 -29304 0/imm32/no-r32 -29305 0/imm32/no-imm32 -29306 0/imm32/no-imm8 -29307 1/imm32/disp32-is-first-inout -29308 0/imm32/no-xm32 -29309 0/imm32/no-x32 -29310 0x11/imm32/alloc-id:fake -29311 _Primitive-break-if-float>=-named/imm32/next -29312 _Primitive-break-if-float>=-named: # (payload primitive) -29313 0x11/imm32/alloc-id:fake:payload +29296 _Primitive-loop-if-addr>/imm32/next +29297 _Primitive-loop-if-addr>: # (payload primitive) +29298 0x11/imm32/alloc-id:fake:payload +29299 0x11/imm32/alloc-id:fake +29300 _string-loop-if-addr>/imm32/name +29301 0/imm32/no-inouts +29302 0/imm32/no-inouts +29303 0/imm32/no-outputs +29304 0/imm32/no-outputs +29305 0x11/imm32/alloc-id:fake +29306 _string_0f_87_jump_loop/imm32/subx-name +29307 0/imm32/no-rm32 +29308 0/imm32/no-r32 +29309 0/imm32/no-imm32 +29310 0/imm32/no-imm8 +29311 0/imm32/no-disp32 +29312 0/imm32/no-xm32 +29313 0/imm32/no-x32 29314 0x11/imm32/alloc-id:fake -29315 _string-break-if-float>=/imm32/name -29316 0x11/imm32/alloc-id:fake -29317 Single-lit-var/imm32/inouts -29318 0/imm32/no-outputs -29319 0/imm32/no-outputs -29320 0x11/imm32/alloc-id:fake -29321 _string_0f_83_jump_label/imm32/subx-name -29322 0/imm32/no-rm32 -29323 0/imm32/no-r32 -29324 0/imm32/no-imm32 -29325 0/imm32/no-imm8 -29326 1/imm32/disp32-is-first-inout -29327 0/imm32/no-xm32 -29328 0/imm32/no-x32 -29329 0x11/imm32/alloc-id:fake -29330 _Primitive-break-if-float<=-named/imm32/next -29331 _Primitive-break-if-float<=-named: # (payload primitive) -29332 0x11/imm32/alloc-id:fake:payload +29315 _Primitive-loop-if-</imm32/next +29316 _Primitive-loop-if-<: # (payload primitive) +29317 0x11/imm32/alloc-id:fake:payload +29318 0x11/imm32/alloc-id:fake +29319 _string-loop-if-</imm32/name +29320 0/imm32/no-inouts +29321 0/imm32/no-inouts +29322 0/imm32/no-outputs +29323 0/imm32/no-outputs +29324 0x11/imm32/alloc-id:fake +29325 _string_0f_8c_jump_loop/imm32/subx-name +29326 0/imm32/no-rm32 +29327 0/imm32/no-r32 +29328 0/imm32/no-imm32 +29329 0/imm32/no-imm8 +29330 0/imm32/no-disp32 +29331 0/imm32/no-xm32 +29332 0/imm32/no-x32 29333 0x11/imm32/alloc-id:fake -29334 _string-break-if-float<=/imm32/name -29335 0x11/imm32/alloc-id:fake -29336 Single-lit-var/imm32/inouts -29337 0/imm32/no-outputs -29338 0/imm32/no-outputs -29339 0x11/imm32/alloc-id:fake -29340 _string_0f_86_jump_label/imm32/subx-name -29341 0/imm32/no-rm32 -29342 0/imm32/no-r32 -29343 0/imm32/no-imm32 -29344 0/imm32/no-imm8 -29345 1/imm32/disp32-is-first-inout -29346 0/imm32/no-xm32 -29347 0/imm32/no-x32 -29348 0x11/imm32/alloc-id:fake -29349 _Primitive-break-if-float>-named/imm32/next -29350 _Primitive-break-if-float>-named: # (payload primitive) -29351 0x11/imm32/alloc-id:fake:payload +29334 _Primitive-loop-if->=/imm32/next +29335 _Primitive-loop-if->=: # (payload primitive) +29336 0x11/imm32/alloc-id:fake:payload +29337 0x11/imm32/alloc-id:fake +29338 _string-loop-if->=/imm32/name +29339 0/imm32/no-inouts +29340 0/imm32/no-inouts +29341 0/imm32/no-outputs +29342 0/imm32/no-outputs +29343 0x11/imm32/alloc-id:fake +29344 _string_0f_8d_jump_loop/imm32/subx-name +29345 0/imm32/no-rm32 +29346 0/imm32/no-r32 +29347 0/imm32/no-imm32 +29348 0/imm32/no-imm8 +29349 0/imm32/no-disp32 +29350 0/imm32/no-xm32 +29351 0/imm32/no-x32 29352 0x11/imm32/alloc-id:fake -29353 _string-break-if-float>/imm32/name -29354 0x11/imm32/alloc-id:fake -29355 Single-lit-var/imm32/inouts -29356 0/imm32/no-outputs -29357 0/imm32/no-outputs -29358 0x11/imm32/alloc-id:fake -29359 _string_0f_87_jump_label/imm32/subx-name -29360 0/imm32/no-rm32 -29361 0/imm32/no-r32 -29362 0/imm32/no-imm32 -29363 0/imm32/no-imm8 -29364 1/imm32/disp32-is-first-inout -29365 0/imm32/no-xm32 -29366 0/imm32/no-x32 -29367 0x11/imm32/alloc-id:fake -29368 _Primitive-loop-if-float<-named/imm32/next -29369 _Primitive-loop-if-float<-named: # (payload primitive) -29370 0x11/imm32/alloc-id:fake:payload +29353 _Primitive-loop-if-<=/imm32/next +29354 _Primitive-loop-if-<=: # (payload primitive) +29355 0x11/imm32/alloc-id:fake:payload +29356 0x11/imm32/alloc-id:fake +29357 _string-loop-if-<=/imm32/name +29358 0/imm32/no-inouts +29359 0/imm32/no-inouts +29360 0/imm32/no-outputs +29361 0/imm32/no-outputs +29362 0x11/imm32/alloc-id:fake +29363 _string_0f_8e_jump_loop/imm32/subx-name +29364 0/imm32/no-rm32 +29365 0/imm32/no-r32 +29366 0/imm32/no-imm32 +29367 0/imm32/no-imm8 +29368 0/imm32/no-disp32 +29369 0/imm32/no-xm32 +29370 0/imm32/no-x32 29371 0x11/imm32/alloc-id:fake -29372 _string-loop-if-float</imm32/name -29373 0x11/imm32/alloc-id:fake -29374 Single-lit-var/imm32/inouts -29375 0/imm32/no-outputs -29376 0/imm32/no-outputs -29377 0x11/imm32/alloc-id:fake -29378 _string_0f_82_jump_label/imm32/subx-name -29379 0/imm32/no-rm32 -29380 0/imm32/no-r32 -29381 0/imm32/no-imm32 -29382 0/imm32/no-imm8 -29383 1/imm32/disp32-is-first-inout -29384 0/imm32/no-xm32 -29385 0/imm32/no-x32 -29386 0x11/imm32/alloc-id:fake -29387 _Primitive-loop-if-float>=-named/imm32/next -29388 _Primitive-loop-if-float>=-named: # (payload primitive) -29389 0x11/imm32/alloc-id:fake:payload +29372 _Primitive-loop-if->/imm32/next +29373 _Primitive-loop-if->: # (payload primitive) +29374 0x11/imm32/alloc-id:fake:payload +29375 0x11/imm32/alloc-id:fake +29376 _string-loop-if->/imm32/name +29377 0/imm32/no-inouts +29378 0/imm32/no-inouts +29379 0/imm32/no-outputs +29380 0/imm32/no-outputs +29381 0x11/imm32/alloc-id:fake +29382 _string_0f_8f_jump_loop/imm32/subx-name +29383 0/imm32/no-rm32 +29384 0/imm32/no-r32 +29385 0/imm32/no-imm32 +29386 0/imm32/no-imm8 +29387 0/imm32/no-disp32 +29388 0/imm32/no-xm32 +29389 0/imm32/no-x32 29390 0x11/imm32/alloc-id:fake -29391 _string-loop-if-float>=/imm32/name -29392 0x11/imm32/alloc-id:fake -29393 Single-lit-var/imm32/inouts -29394 0/imm32/no-outputs -29395 0/imm32/no-outputs -29396 0x11/imm32/alloc-id:fake -29397 _string_0f_83_jump_label/imm32/subx-name -29398 0/imm32/no-rm32 -29399 0/imm32/no-r32 -29400 0/imm32/no-imm32 -29401 0/imm32/no-imm8 -29402 1/imm32/disp32-is-first-inout -29403 0/imm32/no-xm32 -29404 0/imm32/no-x32 -29405 0x11/imm32/alloc-id:fake -29406 _Primitive-loop-if-float<=-named/imm32/next -29407 _Primitive-loop-if-float<=-named: # (payload primitive) -29408 0x11/imm32/alloc-id:fake:payload +29391 _Primitive-loop/imm32/next # we probably don't need an unconditional break +29392 _Primitive-loop: # (payload primitive) +29393 0x11/imm32/alloc-id:fake:payload +29394 0x11/imm32/alloc-id:fake +29395 _string-loop/imm32/name +29396 0/imm32/no-inouts +29397 0/imm32/no-inouts +29398 0/imm32/no-outputs +29399 0/imm32/no-outputs +29400 0x11/imm32/alloc-id:fake +29401 _string_e9_jump_loop/imm32/subx-name +29402 0/imm32/no-rm32 +29403 0/imm32/no-r32 +29404 0/imm32/no-imm32 +29405 0/imm32/no-imm8 +29406 0/imm32/no-disp32 +29407 0/imm32/no-xm32 +29408 0/imm32/no-x32 29409 0x11/imm32/alloc-id:fake -29410 _string-loop-if-float<=/imm32/name -29411 0x11/imm32/alloc-id:fake -29412 Single-lit-var/imm32/inouts -29413 0/imm32/no-outputs -29414 0/imm32/no-outputs -29415 0x11/imm32/alloc-id:fake -29416 _string_0f_86_jump_label/imm32/subx-name -29417 0/imm32/no-rm32 -29418 0/imm32/no-r32 -29419 0/imm32/no-imm32 -29420 0/imm32/no-imm8 -29421 1/imm32/disp32-is-first-inout -29422 0/imm32/no-xm32 -29423 0/imm32/no-x32 -29424 0x11/imm32/alloc-id:fake -29425 _Primitive-loop-if-float>-named/imm32/next -29426 _Primitive-loop-if-float>-named: # (payload primitive) -29427 0x11/imm32/alloc-id:fake:payload -29428 0x11/imm32/alloc-id:fake -29429 _string-loop-if-float>/imm32/name -29430 0x11/imm32/alloc-id:fake -29431 Single-lit-var/imm32/inouts -29432 0/imm32/no-outputs -29433 0/imm32/no-outputs -29434 0x11/imm32/alloc-id:fake -29435 _string_0f_87_jump_label/imm32/subx-name -29436 0/imm32/no-rm32 -29437 0/imm32/no-r32 -29438 0/imm32/no-imm32 -29439 0/imm32/no-imm8 -29440 1/imm32/disp32-is-first-inout -29441 0/imm32/no-xm32 -29442 0/imm32/no-x32 -29443 0/imm32/next -29444 0/imm32/next -29445 -29446 # string literals for Mu instructions -29447 _string-add: # (payload array byte) -29448 0x11/imm32/alloc-id:fake:payload -29449 # "add" -29450 0x3/imm32/size -29451 0x61/a 0x64/d 0x64/d -29452 _string-address: # (payload array byte) -29453 0x11/imm32/alloc-id:fake:payload -29454 # "address" -29455 0x7/imm32/size -29456 0x61/a 0x64/d 0x64/d 0x72/r 0x65/e 0x73/s 0x73/s -29457 _string-add-to: # (payload array byte) -29458 0x11/imm32/alloc-id:fake:payload -29459 # "add-to" -29460 0x6/imm32/size -29461 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o -29462 _string-and: # (payload array byte) -29463 0x11/imm32/alloc-id:fake:payload -29464 # "and" -29465 0x3/imm32/size -29466 0x61/a 0x6e/n 0x64/d -29467 _string-and-with: # (payload array byte) -29468 0x11/imm32/alloc-id:fake:payload -29469 # "and-with" -29470 0x8/imm32/size -29471 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -29472 _string-break: # (payload array byte) -29473 0x11/imm32/alloc-id:fake:payload -29474 # "break" -29475 0x5/imm32/size -29476 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k -29477 _string-break-if-<: # (payload array byte) -29478 0x11/imm32/alloc-id:fake:payload -29479 # "break-if-<" -29480 0xa/imm32/size -29481 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< -29482 _string-break-if-<=: # (payload array byte) -29483 0x11/imm32/alloc-id:fake:payload -29484 # "break-if-<=" -29485 0xb/imm32/size -29486 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= -29487 _string-break-if-=: # (payload array byte) -29488 0x11/imm32/alloc-id:fake:payload -29489 # "break-if-=" -29490 0xa/imm32/size -29491 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= -29492 _string-break-if->: # (payload array byte) -29493 0x11/imm32/alloc-id:fake:payload -29494 # "break-if->" -29495 0xa/imm32/size -29496 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> -29497 _string-break-if->=: # (payload array byte) -29498 0x11/imm32/alloc-id:fake:payload -29499 # "break-if->=" -29500 0xb/imm32/size -29501 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= -29502 _string-break-if-!=: # (payload array byte) -29503 0x11/imm32/alloc-id:fake:payload -29504 # "break-if-!=" -29505 0xb/imm32/size -29506 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= -29507 _string-break-if-addr<: # (payload array byte) +29410 _Primitive-break-if-addr<-named/imm32/next +29411 # - branches to named blocks +29412 _Primitive-break-if-addr<-named: # (payload primitive) +29413 0x11/imm32/alloc-id:fake:payload +29414 0x11/imm32/alloc-id:fake +29415 _string-break-if-addr</imm32/name +29416 0x11/imm32/alloc-id:fake +29417 Single-lit-var/imm32/inouts +29418 0/imm32/no-outputs +29419 0/imm32/no-outputs +29420 0x11/imm32/alloc-id:fake +29421 _string_0f_82_jump_label/imm32/subx-name +29422 0/imm32/no-rm32 +29423 0/imm32/no-r32 +29424 0/imm32/no-imm32 +29425 0/imm32/no-imm8 +29426 1/imm32/disp32-is-first-inout +29427 0/imm32/no-xm32 +29428 0/imm32/no-x32 +29429 0x11/imm32/alloc-id:fake +29430 _Primitive-break-if-addr>=-named/imm32/next +29431 _Primitive-break-if-addr>=-named: # (payload primitive) +29432 0x11/imm32/alloc-id:fake:payload +29433 0x11/imm32/alloc-id:fake +29434 _string-break-if-addr>=/imm32/name +29435 0x11/imm32/alloc-id:fake +29436 Single-lit-var/imm32/inouts +29437 0/imm32/no-outputs +29438 0/imm32/no-outputs +29439 0x11/imm32/alloc-id:fake +29440 _string_0f_83_jump_label/imm32/subx-name +29441 0/imm32/no-rm32 +29442 0/imm32/no-r32 +29443 0/imm32/no-imm32 +29444 0/imm32/no-imm8 +29445 1/imm32/disp32-is-first-inout +29446 0/imm32/no-xm32 +29447 0/imm32/no-x32 +29448 0x11/imm32/alloc-id:fake +29449 _Primitive-break-if-=-named/imm32/next +29450 _Primitive-break-if-=-named: # (payload primitive) +29451 0x11/imm32/alloc-id:fake:payload +29452 0x11/imm32/alloc-id:fake +29453 _string-break-if-=/imm32/name +29454 0x11/imm32/alloc-id:fake +29455 Single-lit-var/imm32/inouts +29456 0/imm32/no-outputs +29457 0/imm32/no-outputs +29458 0x11/imm32/alloc-id:fake +29459 _string_0f_84_jump_label/imm32/subx-name +29460 0/imm32/no-rm32 +29461 0/imm32/no-r32 +29462 0/imm32/no-imm32 +29463 0/imm32/no-imm8 +29464 1/imm32/disp32-is-first-inout +29465 0/imm32/no-xm32 +29466 0/imm32/no-x32 +29467 0x11/imm32/alloc-id:fake +29468 _Primitive-break-if-!=-named/imm32/next +29469 _Primitive-break-if-!=-named: # (payload primitive) +29470 0x11/imm32/alloc-id:fake:payload +29471 0x11/imm32/alloc-id:fake +29472 _string-break-if-!=/imm32/name +29473 0x11/imm32/alloc-id:fake +29474 Single-lit-var/imm32/inouts +29475 0/imm32/no-outputs +29476 0/imm32/no-outputs +29477 0x11/imm32/alloc-id:fake +29478 _string_0f_85_jump_label/imm32/subx-name +29479 0/imm32/no-rm32 +29480 0/imm32/no-r32 +29481 0/imm32/no-imm32 +29482 0/imm32/no-imm8 +29483 1/imm32/disp32-is-first-inout +29484 0/imm32/no-xm32 +29485 0/imm32/no-x32 +29486 0x11/imm32/alloc-id:fake +29487 _Primitive-break-if-addr<=-named/imm32/next +29488 _Primitive-break-if-addr<=-named: # (payload primitive) +29489 0x11/imm32/alloc-id:fake:payload +29490 0x11/imm32/alloc-id:fake +29491 _string-break-if-addr<=/imm32/name +29492 0x11/imm32/alloc-id:fake +29493 Single-lit-var/imm32/inouts +29494 0/imm32/no-outputs +29495 0/imm32/no-outputs +29496 0x11/imm32/alloc-id:fake +29497 _string_0f_86_jump_label/imm32/subx-name +29498 0/imm32/no-rm32 +29499 0/imm32/no-r32 +29500 0/imm32/no-imm32 +29501 0/imm32/no-imm8 +29502 1/imm32/disp32-is-first-inout +29503 0/imm32/no-xm32 +29504 0/imm32/no-x32 +29505 0x11/imm32/alloc-id:fake +29506 _Primitive-break-if-addr>-named/imm32/next +29507 _Primitive-break-if-addr>-named: # (payload primitive) 29508 0x11/imm32/alloc-id:fake:payload -29509 # "break-if-addr<" -29510 0xe/imm32/size -29511 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< -29512 _string-break-if-addr<=: # (payload array byte) -29513 0x11/imm32/alloc-id:fake:payload -29514 # "break-if-addr<=" -29515 0xf/imm32/size -29516 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< 0x3d/= -29517 _string-break-if-addr>: # (payload array byte) -29518 0x11/imm32/alloc-id:fake:payload -29519 # "break-if-addr>" -29520 0xe/imm32/size -29521 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> -29522 _string-break-if-addr>=: # (payload array byte) -29523 0x11/imm32/alloc-id:fake:payload -29524 # "break-if-addr>=" -29525 0xf/imm32/size -29526 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> 0x3d/= -29527 _string-break-if-float<: # (payload array byte) -29528 0x11/imm32/alloc-id:fake:payload -29529 # "break-if-float<" -29530 0xf/imm32/size -29531 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3c/< -29532 _string-break-if-float<=: # (payload array byte) -29533 0x11/imm32/alloc-id:fake:payload -29534 # "break-if-float<=" -29535 0x10/imm32/size -29536 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3c/< 0x3d/= -29537 _string-break-if-float>: # (payload array byte) -29538 0x11/imm32/alloc-id:fake:payload -29539 # "break-if-float>" -29540 0xf/imm32/size -29541 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3e/> -29542 _string-break-if-float>=: # (payload array byte) -29543 0x11/imm32/alloc-id:fake:payload -29544 # "break-if-float>=" -29545 0x10/imm32/size -29546 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3e/> 0x3d/= -29547 _string-compare: # (payload array byte) -29548 0x11/imm32/alloc-id:fake:payload -29549 # "compare" -29550 0x7/imm32/size -29551 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e -29552 _string-copy: # (payload array byte) -29553 0x11/imm32/alloc-id:fake:payload -29554 # "copy" -29555 0x4/imm32/size -29556 0x63/c 0x6f/o 0x70/p 0x79/y -29557 _string-copy-to: # (payload array byte) -29558 0x11/imm32/alloc-id:fake:payload -29559 # "copy-to" -29560 0x7/imm32/size -29561 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o -29562 _string-copy-byte: -29563 0x11/imm32/alloc-id:fake:payload -29564 # "copy-byte" -29565 0x9/imm32/size -29566 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/- 0x62/b 0x79/y 0x74/t 0x65/e -29567 _string-copy-byte-to: -29568 0x11/imm32/alloc-id:fake:payload -29569 # "copy-byte-to" -29570 0xc/imm32/size -29571 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/- 0x62/b 0x79/y 0x74/t 0x65/e 0x2d/- 0x74/t 0x6f/o -29572 _string-decrement: # (payload array byte) -29573 0x11/imm32/alloc-id:fake:payload -29574 # "decrement" -29575 0x9/imm32/size -29576 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t -29577 _string-increment: # (payload array byte) -29578 0x11/imm32/alloc-id:fake:payload -29579 # "increment" -29580 0x9/imm32/size -29581 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t -29582 _string-loop: # (payload array byte) -29583 0x11/imm32/alloc-id:fake:payload -29584 # "loop" -29585 0x4/imm32/size -29586 0x6c/l 0x6f/o 0x6f/o 0x70/p -29587 _string-loop-if-<: # (payload array byte) -29588 0x11/imm32/alloc-id:fake:payload -29589 # "loop-if-<" -29590 0x9/imm32/size -29591 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< -29592 _string-loop-if-<=: # (payload array byte) -29593 0x11/imm32/alloc-id:fake:payload -29594 # "loop-if-<=" -29595 0xa/imm32/size -29596 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= -29597 _string-loop-if-=: # (payload array byte) -29598 0x11/imm32/alloc-id:fake:payload -29599 # "loop-if-=" -29600 0x9/imm32/size -29601 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= -29602 _string-loop-if->: # (payload array byte) +29509 0x11/imm32/alloc-id:fake +29510 _string-break-if-addr>/imm32/name +29511 0x11/imm32/alloc-id:fake +29512 Single-lit-var/imm32/inouts +29513 0/imm32/no-outputs +29514 0/imm32/no-outputs +29515 0x11/imm32/alloc-id:fake +29516 _string_0f_87_jump_label/imm32/subx-name +29517 0/imm32/no-rm32 +29518 0/imm32/no-r32 +29519 0/imm32/no-imm32 +29520 0/imm32/no-imm8 +29521 1/imm32/disp32-is-first-inout +29522 0/imm32/no-xm32 +29523 0/imm32/no-x32 +29524 0x11/imm32/alloc-id:fake +29525 _Primitive-break-if-<-named/imm32/next +29526 _Primitive-break-if-<-named: # (payload primitive) +29527 0x11/imm32/alloc-id:fake:payload +29528 0x11/imm32/alloc-id:fake +29529 _string-break-if-</imm32/name +29530 0x11/imm32/alloc-id:fake +29531 Single-lit-var/imm32/inouts +29532 0/imm32/no-outputs +29533 0/imm32/no-outputs +29534 0x11/imm32/alloc-id:fake +29535 _string_0f_8c_jump_label/imm32/subx-name +29536 0/imm32/no-rm32 +29537 0/imm32/no-r32 +29538 0/imm32/no-imm32 +29539 0/imm32/no-imm8 +29540 1/imm32/disp32-is-first-inout +29541 0/imm32/no-xm32 +29542 0/imm32/no-x32 +29543 0x11/imm32/alloc-id:fake +29544 _Primitive-break-if->=-named/imm32/next +29545 _Primitive-break-if->=-named: # (payload primitive) +29546 0x11/imm32/alloc-id:fake:payload +29547 0x11/imm32/alloc-id:fake +29548 _string-break-if->=/imm32/name +29549 0x11/imm32/alloc-id:fake +29550 Single-lit-var/imm32/inouts +29551 0/imm32/no-outputs +29552 0/imm32/no-outputs +29553 0x11/imm32/alloc-id:fake +29554 _string_0f_8d_jump_label/imm32/subx-name +29555 0/imm32/no-rm32 +29556 0/imm32/no-r32 +29557 0/imm32/no-imm32 +29558 0/imm32/no-imm8 +29559 1/imm32/disp32-is-first-inout +29560 0/imm32/no-xm32 +29561 0/imm32/no-x32 +29562 0x11/imm32/alloc-id:fake +29563 _Primitive-break-if-<=-named/imm32/next +29564 _Primitive-break-if-<=-named: # (payload primitive) +29565 0x11/imm32/alloc-id:fake:payload +29566 0x11/imm32/alloc-id:fake +29567 _string-break-if-<=/imm32/name +29568 0x11/imm32/alloc-id:fake +29569 Single-lit-var/imm32/inouts +29570 0/imm32/no-outputs +29571 0/imm32/no-outputs +29572 0x11/imm32/alloc-id:fake +29573 _string_0f_8e_jump_label/imm32/subx-name +29574 0/imm32/no-rm32 +29575 0/imm32/no-r32 +29576 0/imm32/no-imm32 +29577 0/imm32/no-imm8 +29578 1/imm32/disp32-is-first-inout +29579 0/imm32/no-xm32 +29580 0/imm32/no-x32 +29581 0x11/imm32/alloc-id:fake +29582 _Primitive-break-if->-named/imm32/next +29583 _Primitive-break-if->-named: # (payload primitive) +29584 0x11/imm32/alloc-id:fake:payload +29585 0x11/imm32/alloc-id:fake +29586 _string-break-if->/imm32/name +29587 0x11/imm32/alloc-id:fake +29588 Single-lit-var/imm32/inouts +29589 0/imm32/no-outputs +29590 0/imm32/no-outputs +29591 0x11/imm32/alloc-id:fake +29592 _string_0f_8f_jump_label/imm32/subx-name +29593 0/imm32/no-rm32 +29594 0/imm32/no-r32 +29595 0/imm32/no-imm32 +29596 0/imm32/no-imm8 +29597 1/imm32/disp32-is-first-inout +29598 0/imm32/no-xm32 +29599 0/imm32/no-x32 +29600 0x11/imm32/alloc-id:fake +29601 _Primitive-break-named/imm32/next +29602 _Primitive-break-named: # (payload primitive) 29603 0x11/imm32/alloc-id:fake:payload -29604 # "loop-if->" -29605 0x9/imm32/size -29606 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> -29607 _string-loop-if->=: # (payload array byte) -29608 0x11/imm32/alloc-id:fake:payload -29609 # "loop-if->=" -29610 0xa/imm32/size -29611 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= -29612 _string-loop-if-!=: # (payload array byte) -29613 0x11/imm32/alloc-id:fake:payload -29614 # "loop-if-!=" -29615 0xa/imm32/size -29616 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= -29617 _string-loop-if-addr<: # (payload array byte) -29618 0x11/imm32/alloc-id:fake:payload -29619 # "loop-if-addr<" -29620 0xd/imm32/size -29621 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< -29622 _string-loop-if-addr<=: # (payload array byte) -29623 0x11/imm32/alloc-id:fake:payload -29624 # "loop-if-addr<=" -29625 0xe/imm32/size -29626 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< 0x3d/= -29627 _string-loop-if-addr>: # (payload array byte) -29628 0x11/imm32/alloc-id:fake:payload -29629 # "loop-if-addr>" -29630 0xd/imm32/size -29631 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> -29632 _string-loop-if-addr>=: # (payload array byte) -29633 0x11/imm32/alloc-id:fake:payload -29634 # "loop-if-addr>=" -29635 0xe/imm32/size -29636 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> 0x3d/= -29637 _string-loop-if-float<: # (payload array byte) -29638 0x11/imm32/alloc-id:fake:payload -29639 # "loop-if-float<" -29640 0xe/imm32/size -29641 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3c/< -29642 _string-loop-if-float<=: # (payload array byte) -29643 0x11/imm32/alloc-id:fake:payload -29644 # "loop-if-float<=" -29645 0xf/imm32/size -29646 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3c/< 0x3d/= -29647 _string-loop-if-float>: # (payload array byte) -29648 0x11/imm32/alloc-id:fake:payload -29649 # "loop-if-float>" -29650 0xe/imm32/size -29651 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3e/> -29652 _string-loop-if-float>=: # (payload array byte) -29653 0x11/imm32/alloc-id:fake:payload -29654 # "loop-if-float>=" -29655 0xf/imm32/size -29656 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3e/> 0x3d/= -29657 _string-multiply: # (payload array byte) -29658 0x11/imm32/alloc-id:fake:payload -29659 # "multiply" -29660 0x8/imm32/size -29661 0x6d/m 0x75/u 0x6c/l 0x74/t 0x69/i 0x70/p 0x6c/l 0x79/y -29662 _string-convert: # (payload array byte) -29663 0x11/imm32/alloc-id:fake:payload -29664 # "convert" -29665 0x7/imm32/size -29666 0x63/c 0x6f/o 0x6e/n 0x76/v 0x65/e 0x72/r 0x74/t -29667 _string-truncate: # (payload array byte) -29668 0x11/imm32/alloc-id:fake:payload -29669 # "truncate" -29670 0x8/imm32/size -29671 0x74/t 0x72/r 0x75/u 0x6e/n 0x63/c 0x61/a 0x74/t 0x65/e -29672 _string-reinterpret: # (payload array byte) -29673 0x11/imm32/alloc-id:fake:payload -29674 # "reinterpret" -29675 0xb/imm32/size -29676 0x72/r 0x65/e 0x69/i 0x6e/n 0x74/t 0x65/e 0x72/r 0x70/p 0x72/r 0x65/e 0x74/t -29677 _string-divide: -29678 0x11/imm32/alloc-id:fake:payload -29679 # "divide" -29680 0x6/imm32/size -29681 0x64/d 0x69/i 0x76/v 0x69/i 0x64/d 0x65/e -29682 _string-max: -29683 0x11/imm32/alloc-id:fake:payload -29684 # "max" -29685 0x3/imm32/size -29686 0x6d/m 0x61/a 0x78/x -29687 _string-min: -29688 0x11/imm32/alloc-id:fake:payload -29689 # "min" -29690 0x3/imm32/size -29691 0x6d/m 0x69/i 0x6e/n -29692 _string-reciprocal: -29693 0x11/imm32/alloc-id:fake:payload -29694 # "reciprocal" -29695 0xa/imm32/size -29696 0x72/r 0x65/e 0x63/c 0x69/i 0x70/p 0x72/r 0x6f/o 0x63/c 0x61/a 0x6c/l -29697 _string-square-root: +29604 0x11/imm32/alloc-id:fake +29605 _string-break/imm32/name +29606 0x11/imm32/alloc-id:fake +29607 Single-lit-var/imm32/inouts +29608 0/imm32/no-outputs +29609 0/imm32/no-outputs +29610 0x11/imm32/alloc-id:fake +29611 _string_e9_jump_label/imm32/subx-name +29612 0/imm32/no-rm32 +29613 0/imm32/no-r32 +29614 0/imm32/no-imm32 +29615 0/imm32/no-imm8 +29616 1/imm32/disp32-is-first-inout +29617 0/imm32/no-xm32 +29618 0/imm32/no-x32 +29619 0x11/imm32/alloc-id:fake +29620 _Primitive-loop-if-addr<-named/imm32/next +29621 _Primitive-loop-if-addr<-named: # (payload primitive) +29622 0x11/imm32/alloc-id:fake:payload +29623 0x11/imm32/alloc-id:fake +29624 _string-loop-if-addr</imm32/name +29625 0x11/imm32/alloc-id:fake +29626 Single-lit-var/imm32/inouts +29627 0/imm32/no-outputs +29628 0/imm32/no-outputs +29629 0x11/imm32/alloc-id:fake +29630 _string_0f_82_jump_label/imm32/subx-name +29631 0/imm32/no-rm32 +29632 0/imm32/no-r32 +29633 0/imm32/no-imm32 +29634 0/imm32/no-imm8 +29635 1/imm32/disp32-is-first-inout +29636 0/imm32/no-xm32 +29637 0/imm32/no-x32 +29638 0x11/imm32/alloc-id:fake +29639 _Primitive-loop-if-addr>=-named/imm32/next +29640 _Primitive-loop-if-addr>=-named: # (payload primitive) +29641 0x11/imm32/alloc-id:fake:payload +29642 0x11/imm32/alloc-id:fake +29643 _string-loop-if-addr>=/imm32/name +29644 0x11/imm32/alloc-id:fake +29645 Single-lit-var/imm32/inouts +29646 0/imm32/no-outputs +29647 0/imm32/no-outputs +29648 0x11/imm32/alloc-id:fake +29649 _string_0f_83_jump_label/imm32/subx-name +29650 0/imm32/no-rm32 +29651 0/imm32/no-r32 +29652 0/imm32/no-imm32 +29653 0/imm32/no-imm8 +29654 1/imm32/disp32-is-first-inout +29655 0/imm32/no-xm32 +29656 0/imm32/no-x32 +29657 0x11/imm32/alloc-id:fake +29658 _Primitive-loop-if-=-named/imm32/next +29659 _Primitive-loop-if-=-named: # (payload primitive) +29660 0x11/imm32/alloc-id:fake:payload +29661 0x11/imm32/alloc-id:fake +29662 _string-loop-if-=/imm32/name +29663 0x11/imm32/alloc-id:fake +29664 Single-lit-var/imm32/inouts +29665 0/imm32/no-outputs +29666 0/imm32/no-outputs +29667 0x11/imm32/alloc-id:fake +29668 _string_0f_84_jump_label/imm32/subx-name +29669 0/imm32/no-rm32 +29670 0/imm32/no-r32 +29671 0/imm32/no-imm32 +29672 0/imm32/no-imm8 +29673 1/imm32/disp32-is-first-inout +29674 0/imm32/no-xm32 +29675 0/imm32/no-x32 +29676 0x11/imm32/alloc-id:fake +29677 _Primitive-loop-if-!=-named/imm32/next +29678 _Primitive-loop-if-!=-named: # (payload primitive) +29679 0x11/imm32/alloc-id:fake:payload +29680 0x11/imm32/alloc-id:fake +29681 _string-loop-if-!=/imm32/name +29682 0x11/imm32/alloc-id:fake +29683 Single-lit-var/imm32/inouts +29684 0/imm32/no-outputs +29685 0/imm32/no-outputs +29686 0x11/imm32/alloc-id:fake +29687 _string_0f_85_jump_label/imm32/subx-name +29688 0/imm32/no-rm32 +29689 0/imm32/no-r32 +29690 0/imm32/no-imm32 +29691 0/imm32/no-imm8 +29692 1/imm32/disp32-is-first-inout +29693 0/imm32/no-xm32 +29694 0/imm32/no-x32 +29695 0x11/imm32/alloc-id:fake +29696 _Primitive-loop-if-addr<=-named/imm32/next +29697 _Primitive-loop-if-addr<=-named: # (payload primitive) 29698 0x11/imm32/alloc-id:fake:payload -29699 # "square-root" -29700 0xb/imm32/size -29701 0x73/s 0x71/q 0x75/u 0x61/a 0x72/r 0x65/e 0x2d/- 0x72/r 0x6f/o 0x6f/o 0x74/t -29702 _string-inverse-square-root: -29703 0x11/imm32/alloc-id:fake:payload -29704 # "inverse-square-root" -29705 0x13/imm32/size -29706 0x69/i 0x6e/n 0x76/v 0x65/e 0x72/r 0x73/s 0x65/e 0x2d/- 0x73/s 0x71/q 0x75/u 0x61/a 0x72/r 0x65/e 0x2d/- 0x72/r 0x6f/o 0x6f/o 0x74/t -29707 _string-negate: # (payload array byte) -29708 0x11/imm32/alloc-id:fake:payload -29709 # "negate" -29710 0x6/imm32/size -29711 0x6e/n 0x65/e 0x67/g 0x61/a 0x74/t 0x65/e -29712 _string-or: # (payload array byte) -29713 0x11/imm32/alloc-id:fake:payload -29714 # "or" -29715 0x2/imm32/size -29716 0x6f/o 0x72/r -29717 _string-or-with: # (payload array byte) -29718 0x11/imm32/alloc-id:fake:payload -29719 # "or-with" -29720 0x7/imm32/size -29721 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -29722 _string-subtract: # (payload array byte) -29723 0x11/imm32/alloc-id:fake:payload -29724 # "subtract" -29725 0x8/imm32/size -29726 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t -29727 _string-subtract-from: # (payload array byte) -29728 0x11/imm32/alloc-id:fake:payload -29729 # "subtract-from" -29730 0xd/imm32/size -29731 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t 0x2d/dash 0x66/f 0x72/r 0x6f/o 0x6d/m -29732 _string-xor: # (payload array byte) -29733 0x11/imm32/alloc-id:fake:payload -29734 # "xor" -29735 0x3/imm32/size -29736 0x78/x 0x6f/o 0x72/r -29737 _string-xor-with: # (payload array byte) -29738 0x11/imm32/alloc-id:fake:payload -29739 # "xor-with" -29740 0x8/imm32/size -29741 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -29742 _string-shift-left: # (payload array byte) -29743 0x11/imm32/alloc-id:fake:payload -29744 # "shift-left" -29745 0xa/imm32/size -29746 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x2d/dash 0x6c/l 0x65/e 0x66/f 0x74/t -29747 _string-shift-right: # (payload array byte) -29748 0x11/imm32/alloc-id:fake:payload -29749 # "shift-right" -29750 0xb/imm32/size -29751 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x2d/dash 0x72/r 0x69/i 0x67/g 0x68/h 0x74/t -29752 _string-shift-right-signed: # (payload array byte) -29753 0x11/imm32/alloc-id:fake:payload -29754 # "shift-right-signed" -29755 0x12/imm32/size -29756 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x2d/dash 0x72/r 0x69/i 0x67/g 0x68/h 0x74/t 0x2d/dash 0x73/s 0x69/i 0x67/g 0x6e/n 0x65/e 0x64/d -29757 -29758 # string literals for SubX instructions -29759 _string_01_add_to: # (payload array byte) -29760 0x11/imm32/alloc-id:fake:payload -29761 # "01/add-to" -29762 0x9/imm32/size -29763 0x30/0 0x31/1 0x2f/slash 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o -29764 _string_03_add: # (payload array byte) -29765 0x11/imm32/alloc-id:fake:payload -29766 # "03/add" -29767 0x6/imm32/size -29768 0x30/0 0x33/3 0x2f/slash 0x61/a 0x64/d 0x64/d -29769 _string_05_add_to_eax: # (payload array byte) -29770 0x11/imm32/alloc-id:fake:payload -29771 # "05/add-to-eax" -29772 0xd/imm32/size -29773 0x30/0 0x35/5 0x2f/slash 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x65/e 0x61/a 0x78/x -29774 _string_09_or_with: # (payload array byte) -29775 0x11/imm32/alloc-id:fake:payload -29776 # "09/or-with" -29777 0xa/imm32/size -29778 0x30/0 0x39/9 0x2f/slash 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -29779 _string_0b_or: # (payload array byte) -29780 0x11/imm32/alloc-id:fake:payload -29781 # "0b/or" -29782 0x5/imm32/size -29783 0x30/0 0x62/b 0x2f/slash 0x6f/o 0x72/r -29784 _string_0d_or_with_eax: # (payload array byte) -29785 0x11/imm32/alloc-id:fake:payload -29786 # "0d/or-with-eax" -29787 0xe/imm32/size -29788 0x30/0 0x64/d 0x2f/slash 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h 0x2d/dash 0x65/e 0x61/a 0x78/x -29789 _string_0f_82_jump_label: # (payload array byte) -29790 0x11/imm32/alloc-id:fake:payload -29791 # "0f 82/jump-if-addr<" -29792 0x13/imm32/size -29793 0x30/0 0x66/f 0x20/space 0x38/8 0x32/2 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< -29794 _string_0f_82_jump_break: # (payload array byte) -29795 0x11/imm32/alloc-id:fake:payload -29796 # "0f 82/jump-if-addr< break/disp32" -29797 0x20/imm32/size -29798 0x30/0 0x66/f 0x20/space 0x38/8 0x32/2 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29799 _string_0f_82_jump_loop: # (payload array byte) -29800 0x11/imm32/alloc-id:fake:payload -29801 # "0f 82/jump-if-addr< loop/disp32" -29802 0x1f/imm32/size -29803 0x30/0 0x66/f 0x20/space 0x38/8 0x32/2 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29804 _string_0f_83_jump_label: # (payload array byte) -29805 0x11/imm32/alloc-id:fake:payload -29806 # "0f 83/jump-if-addr>=" -29807 0x14/imm32/size -29808 0x30/0 0x66/f 0x20/space 0x38/8 0x33/3 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> 0x3d/= -29809 _string_0f_83_jump_break: # (payload array byte) -29810 0x11/imm32/alloc-id:fake:payload -29811 # "0f 83/jump-if-addr>= break/disp32" -29812 0x21/imm32/size -29813 0x30/0 0x66/f 0x20/space 0x38/8 0x33/3 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> 0x3d/= 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29814 _string_0f_83_jump_loop: # (payload array byte) -29815 0x11/imm32/alloc-id:fake:payload -29816 # "0f 83/jump-if-addr>= loop/disp32" -29817 0x20/imm32/size -29818 0x30/0 0x66/f 0x20/space 0x38/8 0x33/3 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> 0x3d/= 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29819 _string_0f_84_jump_label: # (payload array byte) -29820 0x11/imm32/alloc-id:fake:payload -29821 # "0f 84/jump-if-=" -29822 0xf/imm32/size -29823 0x30/0 0x66/f 0x20/space 0x38/8 0x34/4 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= -29824 _string_0f_84_jump_break: # (payload array byte) -29825 0x11/imm32/alloc-id:fake:payload -29826 # "0f 84/jump-if-= break/disp32" -29827 0x1c/imm32/size -29828 0x30/0 0x66/f 0x20/space 0x38/8 0x34/4 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29829 _string_0f_84_jump_loop: # (payload array byte) -29830 0x11/imm32/alloc-id:fake:payload -29831 # "0f 84/jump-if-= loop/disp32" -29832 0x1b/imm32/size -29833 0x30/0 0x66/f 0x20/space 0x38/8 0x34/4 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29834 _string_0f_85_jump_label: # (payload array byte) -29835 0x11/imm32/alloc-id:fake:payload -29836 # "0f 85/jump-if-!=" -29837 0x10/imm32/size -29838 0x30/0 0x66/f 0x20/space 0x38/8 0x35/5 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= -29839 _string_0f_85_jump_break: # (payload array byte) -29840 0x11/imm32/alloc-id:fake:payload -29841 # "0f 85/jump-if-!= break/disp32" -29842 0x1d/imm32/size -29843 0x30/0 0x66/f 0x20/space 0x38/8 0x35/5 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29844 _string_0f_85_jump_loop: # (payload array byte) -29845 0x11/imm32/alloc-id:fake:payload -29846 # "0f 85/jump-if-!= loop/disp32" -29847 0x1c/imm32/size -29848 0x30/0 0x66/f 0x20/space 0x38/8 0x35/5 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29849 _string_0f_86_jump_label: # (payload array byte) -29850 0x11/imm32/alloc-id:fake:payload -29851 # "0f 86/jump-if-addr<=" -29852 0x14/imm32/size -29853 0x30/0 0x66/f 0x20/space 0x38/8 0x36/6 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< 0x3d/= -29854 _string_0f_86_jump_break: # (payload array byte) -29855 0x11/imm32/alloc-id:fake:payload -29856 # "0f 86/jump-if-addr<= break/disp32" -29857 0x21/imm32/size -29858 0x30/0 0x66/f 0x20/space 0x38/8 0x36/6 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< 0x3d/= 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29859 _string_0f_86_jump_loop: # (payload array byte) -29860 0x11/imm32/alloc-id:fake:payload -29861 # "0f 86/jump-if-addr<= loop/disp32" -29862 0x20/imm32/size -29863 0x30/0 0x66/f 0x20/space 0x38/8 0x36/6 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< 0x3d/= 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29864 _string_0f_87_jump_label: # (payload array byte) -29865 0x11/imm32/alloc-id:fake:payload -29866 # "0f 87/jump-if-addr>" -29867 0x13/imm32/size -29868 0x30/0 0x66/f 0x20/space 0x38/8 0x37/7 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> -29869 _string_0f_87_jump_break: # (payload array byte) +29699 0x11/imm32/alloc-id:fake +29700 _string-loop-if-addr<=/imm32/name +29701 0x11/imm32/alloc-id:fake +29702 Single-lit-var/imm32/inouts +29703 0/imm32/no-outputs +29704 0/imm32/no-outputs +29705 0x11/imm32/alloc-id:fake +29706 _string_0f_86_jump_label/imm32/subx-name +29707 0/imm32/no-rm32 +29708 0/imm32/no-r32 +29709 0/imm32/no-imm32 +29710 0/imm32/no-imm8 +29711 1/imm32/disp32-is-first-inout +29712 0/imm32/no-xm32 +29713 0/imm32/no-x32 +29714 0x11/imm32/alloc-id:fake +29715 _Primitive-loop-if-addr>-named/imm32/next +29716 _Primitive-loop-if-addr>-named: # (payload primitive) +29717 0x11/imm32/alloc-id:fake:payload +29718 0x11/imm32/alloc-id:fake +29719 _string-loop-if-addr>/imm32/name +29720 0x11/imm32/alloc-id:fake +29721 Single-lit-var/imm32/inouts +29722 0/imm32/no-outputs +29723 0/imm32/no-outputs +29724 0x11/imm32/alloc-id:fake +29725 _string_0f_87_jump_label/imm32/subx-name +29726 0/imm32/no-rm32 +29727 0/imm32/no-r32 +29728 0/imm32/no-imm32 +29729 0/imm32/no-imm8 +29730 1/imm32/disp32-is-first-inout +29731 0/imm32/no-xm32 +29732 0/imm32/no-x32 +29733 0x11/imm32/alloc-id:fake +29734 _Primitive-loop-if-<-named/imm32/next +29735 _Primitive-loop-if-<-named: # (payload primitive) +29736 0x11/imm32/alloc-id:fake:payload +29737 0x11/imm32/alloc-id:fake +29738 _string-loop-if-</imm32/name +29739 0x11/imm32/alloc-id:fake +29740 Single-lit-var/imm32/inouts +29741 0/imm32/no-outputs +29742 0/imm32/no-outputs +29743 0x11/imm32/alloc-id:fake +29744 _string_0f_8c_jump_label/imm32/subx-name +29745 0/imm32/no-rm32 +29746 0/imm32/no-r32 +29747 0/imm32/no-imm32 +29748 0/imm32/no-imm8 +29749 1/imm32/disp32-is-first-inout +29750 0/imm32/no-xm32 +29751 0/imm32/no-x32 +29752 0x11/imm32/alloc-id:fake +29753 _Primitive-loop-if->=-named/imm32/next +29754 _Primitive-loop-if->=-named: # (payload primitive) +29755 0x11/imm32/alloc-id:fake:payload +29756 0x11/imm32/alloc-id:fake +29757 _string-loop-if->=/imm32/name +29758 0x11/imm32/alloc-id:fake +29759 Single-lit-var/imm32/inouts +29760 0/imm32/no-outputs +29761 0/imm32/no-outputs +29762 0x11/imm32/alloc-id:fake +29763 _string_0f_8d_jump_label/imm32/subx-name +29764 0/imm32/no-rm32 +29765 0/imm32/no-r32 +29766 0/imm32/no-imm32 +29767 0/imm32/no-imm8 +29768 1/imm32/disp32-is-first-inout +29769 0/imm32/no-xm32 +29770 0/imm32/no-x32 +29771 0x11/imm32/alloc-id:fake +29772 _Primitive-loop-if-<=-named/imm32/next +29773 _Primitive-loop-if-<=-named: # (payload primitive) +29774 0x11/imm32/alloc-id:fake:payload +29775 0x11/imm32/alloc-id:fake +29776 _string-loop-if-<=/imm32/name +29777 0x11/imm32/alloc-id:fake +29778 Single-lit-var/imm32/inouts +29779 0/imm32/no-outputs +29780 0/imm32/no-outputs +29781 0x11/imm32/alloc-id:fake +29782 _string_0f_8e_jump_label/imm32/subx-name +29783 0/imm32/no-rm32 +29784 0/imm32/no-r32 +29785 0/imm32/no-imm32 +29786 0/imm32/no-imm8 +29787 1/imm32/disp32-is-first-inout +29788 0/imm32/no-xm32 +29789 0/imm32/no-x32 +29790 0x11/imm32/alloc-id:fake +29791 _Primitive-loop-if->-named/imm32/next +29792 _Primitive-loop-if->-named: # (payload primitive) +29793 0x11/imm32/alloc-id:fake:payload +29794 0x11/imm32/alloc-id:fake +29795 _string-loop-if->/imm32/name +29796 0x11/imm32/alloc-id:fake +29797 Single-lit-var/imm32/inouts +29798 0/imm32/no-outputs +29799 0/imm32/no-outputs +29800 0x11/imm32/alloc-id:fake +29801 _string_0f_8f_jump_label/imm32/subx-name +29802 0/imm32/no-rm32 +29803 0/imm32/no-r32 +29804 0/imm32/no-imm32 +29805 0/imm32/no-imm8 +29806 1/imm32/disp32-is-first-inout +29807 0/imm32/no-xm32 +29808 0/imm32/no-x32 +29809 0x11/imm32/alloc-id:fake +29810 _Primitive-loop-named/imm32/next # we probably don't need an unconditional break +29811 _Primitive-loop-named: # (payload primitive) +29812 0x11/imm32/alloc-id:fake:payload +29813 0x11/imm32/alloc-id:fake +29814 _string-loop/imm32/name +29815 0x11/imm32/alloc-id:fake +29816 Single-lit-var/imm32/inouts +29817 0/imm32/no-outputs +29818 0/imm32/no-outputs +29819 0x11/imm32/alloc-id:fake +29820 _string_e9_jump_label/imm32/subx-name +29821 0/imm32/no-rm32 +29822 0/imm32/no-r32 +29823 0/imm32/no-imm32 +29824 0/imm32/no-imm8 +29825 1/imm32/disp32-is-first-inout +29826 0/imm32/no-xm32 +29827 0/imm32/no-x32 +29828 0x11/imm32/alloc-id:fake +29829 _Primitive-break-if-float</imm32/next +29830 # - branches based on floating-point comparisons +29831 _Primitive-break-if-float<: # (payload primitive) +29832 0x11/imm32/alloc-id:fake:payload +29833 0x11/imm32/alloc-id:fake +29834 _string-break-if-float</imm32/name +29835 0/imm32/no-inouts +29836 0/imm32/no-inouts +29837 0/imm32/no-outputs +29838 0/imm32/no-outputs +29839 0x11/imm32/alloc-id:fake +29840 _string_0f_82_jump_break/imm32/subx-name +29841 0/imm32/no-rm32 +29842 0/imm32/no-r32 +29843 0/imm32/no-imm32 +29844 0/imm32/no-imm8 +29845 0/imm32/no-disp32 +29846 0/imm32/no-xm32 +29847 0/imm32/no-x32 +29848 0x11/imm32/alloc-id:fake +29849 _Primitive-break-if-float>=/imm32/next +29850 _Primitive-break-if-float>=: # (payload primitive) +29851 0x11/imm32/alloc-id:fake:payload +29852 0x11/imm32/alloc-id:fake +29853 _string-break-if-float>=/imm32/name +29854 0/imm32/no-inouts +29855 0/imm32/no-inouts +29856 0/imm32/no-outputs +29857 0/imm32/no-outputs +29858 0x11/imm32/alloc-id:fake +29859 _string_0f_83_jump_break/imm32/subx-name +29860 0/imm32/no-rm32 +29861 0/imm32/no-r32 +29862 0/imm32/no-imm32 +29863 0/imm32/no-imm8 +29864 0/imm32/no-disp32 +29865 0/imm32/no-xm32 +29866 0/imm32/no-x32 +29867 0x11/imm32/alloc-id:fake +29868 _Primitive-break-if-float<=/imm32/next +29869 _Primitive-break-if-float<=: # (payload primitive) 29870 0x11/imm32/alloc-id:fake:payload -29871 # "0f 87/jump-if-addr> break/disp32" -29872 0x20/imm32/size -29873 0x30/0 0x66/f 0x20/space 0x38/8 0x37/7 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29874 _string_0f_87_jump_loop: # (payload array byte) -29875 0x11/imm32/alloc-id:fake:payload -29876 # "0f 87/jump-if-addr> loop/disp32" -29877 0x1f/imm32/size -29878 0x30/0 0x66/f 0x20/space 0x38/8 0x37/7 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29879 _string_0f_8c_jump_label: # (payload array byte) -29880 0x11/imm32/alloc-id:fake:payload -29881 # "0f 8c/jump-if-<" -29882 0xf/imm32/size -29883 0x30/0 0x66/f 0x20/space 0x38/8 0x63/c 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< -29884 _string_0f_8c_jump_break: # (payload array byte) -29885 0x11/imm32/alloc-id:fake:payload -29886 # "0f 8c/jump-if-< break/disp32" -29887 0x1c/imm32/size -29888 0x30/0 0x66/f 0x20/space 0x38/8 0x63/c 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29889 _string_0f_8c_jump_loop: # (payload array byte) -29890 0x11/imm32/alloc-id:fake:payload -29891 # "0f 8c/jump-if-< loop/disp32" -29892 0x1b/imm32/size -29893 0x30/0 0x66/f 0x20/space 0x38/8 0x63/c 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29894 _string_0f_8d_jump_label: # (payload array byte) -29895 0x11/imm32/alloc-id:fake:payload -29896 # "0f 8d/jump-if->=" -29897 0x10/imm32/size -29898 0x30/0 0x66/f 0x20/space 0x38/8 0x64/d 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= -29899 _string_0f_8d_jump_break: # (payload array byte) -29900 0x11/imm32/alloc-id:fake:payload -29901 # "0f 8d/jump-if->= break/disp32" -29902 0x1d/imm32/size -29903 0x30/0 0x66/f 0x20/space 0x38/8 0x64/d 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29904 _string_0f_8d_jump_loop: # (payload array byte) -29905 0x11/imm32/alloc-id:fake:payload -29906 # "0f 8d/jump-if->= loop/disp32" -29907 0x1c/imm32/size -29908 0x30/0 0x66/f 0x20/space 0x38/8 0x64/d 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29909 _string_0f_8e_jump_label: # (payload array byte) -29910 0x11/imm32/alloc-id:fake:payload -29911 # "0f 8e/jump-if-<=" -29912 0x10/imm32/size -29913 0x30/0 0x66/f 0x20/space 0x38/8 0x65/e 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= -29914 _string_0f_8e_jump_break: # (payload array byte) -29915 0x11/imm32/alloc-id:fake:payload -29916 # "0f 8e/jump-if-<= break/disp32" -29917 0x1d/imm32/size -29918 0x30/0 0x66/f 0x20/space 0x38/8 0x65/e 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29919 _string_0f_8e_jump_loop: # (payload array byte) -29920 0x11/imm32/alloc-id:fake:payload -29921 # "0f 8e/jump-if-<= loop/disp32" -29922 0x1c/imm32/size -29923 0x30/0 0x66/f 0x20/space 0x38/8 0x65/e 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29924 _string_0f_8f_jump_label: # (payload array byte) -29925 0x11/imm32/alloc-id:fake:payload -29926 # "0f 8f/jump-if->" -29927 0xf/imm32/size -29928 0x30/0 0x66/f 0x20/space 0x38/8 0x66/f 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> -29929 _string_0f_8f_jump_break: # (payload array byte) -29930 0x11/imm32/alloc-id:fake:payload -29931 # "0f 8f/jump-if-> break/disp32" -29932 0x1c/imm32/size -29933 0x30/0 0x66/f 0x20/space 0x38/8 0x66/f 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29934 _string_0f_8f_jump_loop: # (payload array byte) -29935 0x11/imm32/alloc-id:fake:payload -29936 # "0f 8f/jump-if-> loop/disp32" -29937 0x1b/imm32/size -29938 0x30/0 0x66/f 0x20/space 0x38/8 0x66/f 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -29939 _string_0f_af_multiply: # (payload array byte) -29940 0x11/imm32/alloc-id:fake:payload -29941 # "0f af/multiply" -29942 0xe/imm32/size -29943 0x30/0 0x66/f 0x20/space 0x61/a 0x66/f 0x2f/slash 0x6d/m 0x75/u 0x6c/l 0x74/t 0x69/i 0x70/p 0x6c/l 0x79/y -29944 _string_f3_0f_2a_convert_to_float: -29945 0x11/imm32/alloc-id:fake:payload -29946 # "f3 0f 2a/convert-to-float" -29947 0x19/imm32/size -29948 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x32/2 0x61/a 0x2f/slash 0x63/c 0x6f/o 0x6e/n 0x76/v 0x65/e 0x72/r 0x74/t 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t -29949 _string_f3_0f_2d_convert_to_int: -29950 0x11/imm32/alloc-id:fake:payload -29951 # "f3 0f 2d/convert-to-int" -29952 0x17/imm32/size -29953 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x32/2 0x64/d 0x2f/slash 0x63/c 0x6f/o 0x6e/n 0x76/v 0x65/e 0x72/r 0x74/t 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x69/i 0x6e/n 0x74/t -29954 _string_f3_0f_2c_truncate_to_int: -29955 0x11/imm32/alloc-id:fake:payload -29956 # "f3 0f 2c/truncate-to-int" -29957 0x18/imm32/size -29958 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x32/2 0x63/c 0x2f/slash 0x74/t 0x72/r 0x75/u 0x6e/n 0x63/c 0x61/a 0x74/t 0x65/e 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x69/i 0x6e/n 0x74/t -29959 _string_f3_0f_58_add: -29960 0x11/imm32/alloc-id:fake:payload -29961 # "f3 0f 58/add" -29962 0xc/imm32/size -29963 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x38/8 0x2f/slash 0x61/a 0x64/d 0x64/d -29964 _string_f3_0f_5c_subtract: +29871 0x11/imm32/alloc-id:fake +29872 _string-break-if-float<=/imm32/name +29873 0/imm32/no-inouts +29874 0/imm32/no-inouts +29875 0/imm32/no-outputs +29876 0/imm32/no-outputs +29877 0x11/imm32/alloc-id:fake +29878 _string_0f_86_jump_break/imm32/subx-name +29879 0/imm32/no-rm32 +29880 0/imm32/no-r32 +29881 0/imm32/no-imm32 +29882 0/imm32/no-imm8 +29883 0/imm32/no-disp32 +29884 0/imm32/no-xm32 +29885 0/imm32/no-x32 +29886 0x11/imm32/alloc-id:fake +29887 _Primitive-break-if-float>/imm32/next +29888 _Primitive-break-if-float>: # (payload primitive) +29889 0x11/imm32/alloc-id:fake:payload +29890 0x11/imm32/alloc-id:fake +29891 _string-break-if-float>/imm32/name +29892 0/imm32/no-inouts +29893 0/imm32/no-inouts +29894 0/imm32/no-outputs +29895 0/imm32/no-outputs +29896 0x11/imm32/alloc-id:fake +29897 _string_0f_87_jump_break/imm32/subx-name +29898 0/imm32/no-rm32 +29899 0/imm32/no-r32 +29900 0/imm32/no-imm32 +29901 0/imm32/no-imm8 +29902 0/imm32/no-disp32 +29903 0/imm32/no-xm32 +29904 0/imm32/no-x32 +29905 0x11/imm32/alloc-id:fake +29906 _Primitive-loop-if-float</imm32/next +29907 _Primitive-loop-if-float<: # (payload primitive) +29908 0x11/imm32/alloc-id:fake:payload +29909 0x11/imm32/alloc-id:fake +29910 _string-loop-if-float</imm32/name +29911 0/imm32/no-inouts +29912 0/imm32/no-inouts +29913 0/imm32/no-outputs +29914 0/imm32/no-outputs +29915 0x11/imm32/alloc-id:fake +29916 _string_0f_82_jump_loop/imm32/subx-name +29917 0/imm32/no-rm32 +29918 0/imm32/no-r32 +29919 0/imm32/no-imm32 +29920 0/imm32/no-imm8 +29921 0/imm32/no-disp32 +29922 0/imm32/no-xm32 +29923 0/imm32/no-x32 +29924 0x11/imm32/alloc-id:fake +29925 _Primitive-loop-if-float>=/imm32/next +29926 _Primitive-loop-if-float>=: # (payload primitive) +29927 0x11/imm32/alloc-id:fake:payload +29928 0x11/imm32/alloc-id:fake +29929 _string-loop-if-float>=/imm32/name +29930 0/imm32/no-inouts +29931 0/imm32/no-inouts +29932 0/imm32/no-outputs +29933 0/imm32/no-outputs +29934 0x11/imm32/alloc-id:fake +29935 _string_0f_83_jump_loop/imm32/subx-name +29936 0/imm32/no-rm32 +29937 0/imm32/no-r32 +29938 0/imm32/no-imm32 +29939 0/imm32/no-imm8 +29940 0/imm32/no-disp32 +29941 0/imm32/no-xm32 +29942 0/imm32/no-x32 +29943 0x11/imm32/alloc-id:fake +29944 _Primitive-loop-if-float<=/imm32/next +29945 _Primitive-loop-if-float<=: # (payload primitive) +29946 0x11/imm32/alloc-id:fake:payload +29947 0x11/imm32/alloc-id:fake +29948 _string-loop-if-float<=/imm32/name +29949 0/imm32/no-inouts +29950 0/imm32/no-inouts +29951 0/imm32/no-outputs +29952 0/imm32/no-outputs +29953 0x11/imm32/alloc-id:fake +29954 _string_0f_86_jump_loop/imm32/subx-name +29955 0/imm32/no-rm32 +29956 0/imm32/no-r32 +29957 0/imm32/no-imm32 +29958 0/imm32/no-imm8 +29959 0/imm32/no-disp32 +29960 0/imm32/no-xm32 +29961 0/imm32/no-x32 +29962 0x11/imm32/alloc-id:fake +29963 _Primitive-loop-if-float>/imm32/next +29964 _Primitive-loop-if-float>: # (payload primitive) 29965 0x11/imm32/alloc-id:fake:payload -29966 # "f3 0f 5c/subtract" -29967 0x11/imm32/size -29968 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x63/c 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t -29969 _string_f3_0f_59_multiply: -29970 0x11/imm32/alloc-id:fake:payload -29971 # "f3 0f 59/multiply" -29972 0x11/imm32/size -29973 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x39/9 0x2f/slash 0x6d/m 0x75/u 0x6c/l 0x74/t 0x69/i 0x70/p 0x6c/l 0x79/y -29974 _string_f3_0f_5e_divide: -29975 0x11/imm32/alloc-id:fake:payload -29976 # "f3 0f 5e/divide" -29977 0xf/imm32/size -29978 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x65/e 0x2f/slash 0x64/d 0x69/i 0x76/v 0x69/i 0x64/d 0x65/e -29979 _string_f3_0f_53_reciprocal: -29980 0x11/imm32/alloc-id:fake:payload -29981 # "f3 0f 53/reciprocal" -29982 0x13/imm32/size -29983 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x33/3 0x2f/slash 0x72/r 0x65/e 0x63/c 0x69/i 0x70/p 0x72/r 0x6f/o 0x63/c 0x61/a 0x6c/l -29984 _string_f3_0f_51_square_root: -29985 0x11/imm32/alloc-id:fake:payload -29986 # "f3 0f 51/square-root" -29987 0x14/imm32/size -29988 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x31/1 0x2f/slash 0x73/s 0x71/q 0x75/u 0x61/a 0x72/r 0x65/e 0x2d/dash 0x72/r 0x6f/o 0x6f/o 0x74/t -29989 _string_f3_0f_52_inverse_square_root: -29990 0x11/imm32/alloc-id:fake:payload -29991 # "f3 0f 52/inverse-square-root" -29992 0x1c/imm32/size -29993 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x32/2 0x2f/slash 0x69/i 0x6e/n 0x76/v 0x65/e 0x72/r 0x73/s 0x65/e 0x2d/dash 0x73/s 0x71/q 0x75/u 0x61/a 0x72/r 0x65/e 0x2d/dash 0x72/r 0x6f/o 0x6f/o 0x74/t -29994 _string_f3_0f_5d_min: -29995 0x11/imm32/alloc-id:fake:payload -29996 # "f3 0f 5d/min" -29997 0xc/imm32/size -29998 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x64/d 0x2f/slash 0x6d/m 0x69/i 0x6e/n -29999 _string_f3_0f_5f_max: -30000 0x11/imm32/alloc-id:fake:payload -30001 # "f3 0f 5f/max" -30002 0xc/imm32/size -30003 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x66/f 0x2f/slash 0x6d/m 0x61/a 0x78/x -30004 _string_f3_0f_10_copy: -30005 0x11/imm32/alloc-id:fake:payload -30006 # "f3 0f 10/copy" -30007 0xd/imm32/size -30008 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x31/1 0x30/0 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y -30009 _string_f3_0f_11_copy: -30010 0x11/imm32/alloc-id:fake:payload -30011 # "f3 0f 11/copy" -30012 0xd/imm32/size -30013 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x31/1 0x31/1 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y -30014 _string_0f_2f_compare: -30015 0x11/imm32/alloc-id:fake:payload -30016 # "0f 2f/compare" -30017 0xd/imm32/size -30018 0x30/0 0x66/f 0x20/space 0x32/2 0x66/f 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e -30019 _string_21_and_with: # (payload array byte) -30020 0x11/imm32/alloc-id:fake:payload -30021 # "21/and-with" -30022 0xb/imm32/size -30023 0x32/2 0x31/1 0x2f/slash 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -30024 _string_23_and: # (payload array byte) -30025 0x11/imm32/alloc-id:fake:payload -30026 # "23/and" -30027 0x6/imm32/size -30028 0x32/2 0x33/3 0x2f/slash 0x61/a 0x6e/n 0x64/d -30029 _string_25_and_with_eax: # (payload array byte) -30030 0x11/imm32/alloc-id:fake:payload -30031 # "25/and-with-eax" -30032 0xf/imm32/size -30033 0x32/2 0x35/5 0x2f/slash 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h 0x2d/dash 0x65/e 0x61/a 0x78/x -30034 _string_29_subtract_from: # (payload array byte) -30035 0x11/imm32/alloc-id:fake:payload -30036 # "29/subtract-from" -30037 0x10/imm32/size -30038 0x32/2 0x39/9 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t 0x2d/dash 0x66/f 0x72/r 0x6f/o 0x6d/m -30039 _string_2b_subtract: # (payload array byte) -30040 0x11/imm32/alloc-id:fake:payload -30041 # "2b/subtract" -30042 0xb/imm32/size -30043 0x32/2 0x62/b 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t -30044 _string_2d_subtract_from_eax: # (payload array byte) -30045 0x11/imm32/alloc-id:fake:payload -30046 # "2d/subtract-from-eax" -30047 0x14/imm32/size -30048 0x32/2 0x64/d 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t 0x2d/dash 0x66/f 0x72/r 0x6f/o 0x6d/m 0x2d/dash 0x65/e 0x61/a 0x78/x -30049 _string_31_xor_with: # (payload array byte) -30050 0x11/imm32/alloc-id:fake:payload -30051 # "31/xor-with" -30052 0xb/imm32/size -30053 0x33/3 0x31/1 0x2f/slash 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -30054 _string_33_xor: # (payload array byte) -30055 0x11/imm32/alloc-id:fake:payload -30056 # "33/xor" -30057 0x6/imm32/size -30058 0x33/3 0x33/3 0x2f/slash 0x78/x 0x6f/o 0x72/r -30059 _string_35_xor_with_eax: # (payload array byte) +29966 0x11/imm32/alloc-id:fake +29967 _string-loop-if-float>/imm32/name +29968 0/imm32/no-inouts +29969 0/imm32/no-inouts +29970 0/imm32/no-outputs +29971 0/imm32/no-outputs +29972 0x11/imm32/alloc-id:fake +29973 _string_0f_87_jump_loop/imm32/subx-name +29974 0/imm32/no-rm32 +29975 0/imm32/no-r32 +29976 0/imm32/no-imm32 +29977 0/imm32/no-imm8 +29978 0/imm32/no-disp32 +29979 0/imm32/no-xm32 +29980 0/imm32/no-x32 +29981 0x11/imm32/alloc-id:fake +29982 _Primitive-break-if-float<-named/imm32/next +29983 _Primitive-break-if-float<-named: # (payload primitive) +29984 0x11/imm32/alloc-id:fake:payload +29985 0x11/imm32/alloc-id:fake +29986 _string-break-if-float</imm32/name +29987 0x11/imm32/alloc-id:fake +29988 Single-lit-var/imm32/inouts +29989 0/imm32/no-outputs +29990 0/imm32/no-outputs +29991 0x11/imm32/alloc-id:fake +29992 _string_0f_82_jump_label/imm32/subx-name +29993 0/imm32/no-rm32 +29994 0/imm32/no-r32 +29995 0/imm32/no-imm32 +29996 0/imm32/no-imm8 +29997 1/imm32/disp32-is-first-inout +29998 0/imm32/no-xm32 +29999 0/imm32/no-x32 +30000 0x11/imm32/alloc-id:fake +30001 _Primitive-break-if-float>=-named/imm32/next +30002 _Primitive-break-if-float>=-named: # (payload primitive) +30003 0x11/imm32/alloc-id:fake:payload +30004 0x11/imm32/alloc-id:fake +30005 _string-break-if-float>=/imm32/name +30006 0x11/imm32/alloc-id:fake +30007 Single-lit-var/imm32/inouts +30008 0/imm32/no-outputs +30009 0/imm32/no-outputs +30010 0x11/imm32/alloc-id:fake +30011 _string_0f_83_jump_label/imm32/subx-name +30012 0/imm32/no-rm32 +30013 0/imm32/no-r32 +30014 0/imm32/no-imm32 +30015 0/imm32/no-imm8 +30016 1/imm32/disp32-is-first-inout +30017 0/imm32/no-xm32 +30018 0/imm32/no-x32 +30019 0x11/imm32/alloc-id:fake +30020 _Primitive-break-if-float<=-named/imm32/next +30021 _Primitive-break-if-float<=-named: # (payload primitive) +30022 0x11/imm32/alloc-id:fake:payload +30023 0x11/imm32/alloc-id:fake +30024 _string-break-if-float<=/imm32/name +30025 0x11/imm32/alloc-id:fake +30026 Single-lit-var/imm32/inouts +30027 0/imm32/no-outputs +30028 0/imm32/no-outputs +30029 0x11/imm32/alloc-id:fake +30030 _string_0f_86_jump_label/imm32/subx-name +30031 0/imm32/no-rm32 +30032 0/imm32/no-r32 +30033 0/imm32/no-imm32 +30034 0/imm32/no-imm8 +30035 1/imm32/disp32-is-first-inout +30036 0/imm32/no-xm32 +30037 0/imm32/no-x32 +30038 0x11/imm32/alloc-id:fake +30039 _Primitive-break-if-float>-named/imm32/next +30040 _Primitive-break-if-float>-named: # (payload primitive) +30041 0x11/imm32/alloc-id:fake:payload +30042 0x11/imm32/alloc-id:fake +30043 _string-break-if-float>/imm32/name +30044 0x11/imm32/alloc-id:fake +30045 Single-lit-var/imm32/inouts +30046 0/imm32/no-outputs +30047 0/imm32/no-outputs +30048 0x11/imm32/alloc-id:fake +30049 _string_0f_87_jump_label/imm32/subx-name +30050 0/imm32/no-rm32 +30051 0/imm32/no-r32 +30052 0/imm32/no-imm32 +30053 0/imm32/no-imm8 +30054 1/imm32/disp32-is-first-inout +30055 0/imm32/no-xm32 +30056 0/imm32/no-x32 +30057 0x11/imm32/alloc-id:fake +30058 _Primitive-loop-if-float<-named/imm32/next +30059 _Primitive-loop-if-float<-named: # (payload primitive) 30060 0x11/imm32/alloc-id:fake:payload -30061 # "35/xor-with-eax" -30062 0xf/imm32/size -30063 0x33/3 0x35/5 0x2f/slash 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h 0x2d/dash 0x65/e 0x61/a 0x78/x -30064 _string_39_compare->: # (payload array byte) -30065 0x11/imm32/alloc-id:fake:payload -30066 # "39/compare->" -30067 0xc/imm32/size -30068 0x33/3 0x39/9 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x2d/dash 0x3e/> -30069 _string_3b_compare<-: # (payload array byte) -30070 0x11/imm32/alloc-id:fake:payload -30071 # "3b/compare<-" -30072 0xc/imm32/size -30073 0x33/3 0x62/b 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x3c/< 0x2d/dash -30074 _string_3d_compare_eax_with: # (payload array byte) -30075 0x11/imm32/alloc-id:fake:payload -30076 # "3d/compare-eax-with" -30077 0x13/imm32/size -30078 0x33/3 0x64/d 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x2d/dash 0x65/e 0x61/a 0x78/x 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h -30079 _string_40_increment_eax: # (payload array byte) -30080 0x11/imm32/alloc-id:fake:payload -30081 # "40/increment-eax" -30082 0x10/imm32/size -30083 0x34/4 0x30/0 0x2f/slash 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x61/a 0x78/x -30084 _string_41_increment_ecx: # (payload array byte) -30085 0x11/imm32/alloc-id:fake:payload -30086 # "41/increment-ecx" -30087 0x10/imm32/size -30088 0x34/4 0x31/1 0x2f/slash 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x63/c 0x78/x -30089 _string_42_increment_edx: # (payload array byte) -30090 0x11/imm32/alloc-id:fake:payload -30091 # "42/increment-edx" -30092 0x10/imm32/size -30093 0x34/4 0x32/2 0x2f/slash 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x64/d 0x78/x -30094 _string_43_increment_ebx: # (payload array byte) -30095 0x11/imm32/alloc-id:fake:payload -30096 # "43/increment-ebx" -30097 0x10/imm32/size -30098 0x34/4 0x33/3 0x2f/slash 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x62/b 0x78/x -30099 _string_46_increment_esi: # (payload array byte) -30100 0x11/imm32/alloc-id:fake:payload -30101 # "46/increment-esi" -30102 0x10/imm32/size -30103 0x34/4 0x36/6 0x2f/slash 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x73/s 0x69/i -30104 _string_47_increment_edi: # (payload array byte) -30105 0x11/imm32/alloc-id:fake:payload -30106 # "47/increment-edi" -30107 0x10/imm32/size -30108 0x34/4 0x37/7 0x2f/slash 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x64/d 0x69/i -30109 _string_48_decrement_eax: # (payload array byte) -30110 0x11/imm32/alloc-id:fake:payload -30111 # "48/decrement-eax" -30112 0x10/imm32/size -30113 0x34/4 0x38/8 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x61/a 0x78/x -30114 _string_49_decrement_ecx: # (payload array byte) -30115 0x11/imm32/alloc-id:fake:payload -30116 # "49/decrement-ecx" -30117 0x10/imm32/size -30118 0x34/4 0x39/9 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x63/c 0x78/x -30119 _string_4a_decrement_edx: # (payload array byte) -30120 0x11/imm32/alloc-id:fake:payload -30121 # "4a/decrement-edx" -30122 0x10/imm32/size -30123 0x34/4 0x61/a 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x64/d 0x78/x -30124 _string_4b_decrement_ebx: # (payload array byte) -30125 0x11/imm32/alloc-id:fake:payload -30126 # "4b/decrement-ebx" -30127 0x10/imm32/size -30128 0x34/4 0x62/b 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x62/b 0x78/x -30129 _string_4e_decrement_esi: # (payload array byte) -30130 0x11/imm32/alloc-id:fake:payload -30131 # "4e/decrement-esi" -30132 0x10/imm32/size -30133 0x34/4 0x65/e 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x73/s 0x69/i -30134 _string_4f_decrement_edi: # (payload array byte) -30135 0x11/imm32/alloc-id:fake:payload -30136 # "4f/decrement-edi" -30137 0x10/imm32/size -30138 0x34/4 0x66/f 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x64/d 0x69/i -30139 _string_81_subop_add: # (payload array byte) -30140 0x11/imm32/alloc-id:fake:payload -30141 # "81 0/subop/add" -30142 0xe/imm32/size -30143 0x38/8 0x31/1 0x20/space 0x30/0 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x61/a 0x64/d 0x64/d -30144 _string_81_subop_or: # (payload array byte) -30145 0x11/imm32/alloc-id:fake:payload -30146 # "81 1/subop/or" -30147 0xd/imm32/size -30148 0x38/8 0x31/1 0x20/space 0x31/1 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x6f/o 0x72/r -30149 _string_81_subop_and: # (payload array byte) -30150 0x11/imm32/alloc-id:fake:payload -30151 # "81 4/subop/and" -30152 0xe/imm32/size -30153 0x38/8 0x31/1 0x20/space 0x34/4 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x61/a 0x6e/n 0x64/d -30154 _string_81_subop_subtract: # (payload array byte) -30155 0x11/imm32/alloc-id:fake:payload -30156 # "81 5/subop/subtract" -30157 0x13/imm32/size -30158 0x38/8 0x31/1 0x20/space 0x35/5 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t -30159 _string_81_subop_xor: # (payload array byte) -30160 0x11/imm32/alloc-id:fake:payload -30161 # "81 6/subop/xor" -30162 0xe/imm32/size -30163 0x38/8 0x31/1 0x20/space 0x36/6 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x78/x 0x6f/o 0x72/r -30164 _string_81_subop_compare: # (payload array byte) -30165 0x11/imm32/alloc-id:fake:payload -30166 # "81 7/subop/compare" -30167 0x12/imm32/size -30168 0x38/8 0x31/1 0x20/space 0x37/7 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e -30169 _string_89_<-: # (payload array byte) -30170 0x11/imm32/alloc-id:fake:payload -30171 # "89/<-" -30172 0x5/imm32/size -30173 0x38/8 0x39/9 0x2f/slash 0x3c/< 0x2d/dash -30174 _string_8b_->: # (payload array byte) -30175 0x11/imm32/alloc-id:fake:payload -30176 # "8b/->" -30177 0x5/imm32/size -30178 0x38/8 0x62/b 0x2f/slash 0x2d/dash 0x3e/> -30179 _string_8a_copy_byte: -30180 0x11/imm32/alloc-id:fake:payload -30181 # "8a/byte->" -30182 0x9/imm32/size -30183 0x38/8 0x61/a 0x2f// 0x62/b 0x79/y 0x74/t 0x65/e 0x2d/- 0x3e/> -30184 _string_88_copy_byte: -30185 0x11/imm32/alloc-id:fake:payload -30186 # "88/byte<-" -30187 0x9/imm32/size -30188 0x38/8 0x38/8 0x2f// 0x62/b 0x79/y 0x74/t 0x65/e 0x3c/< 0x2d/- -30189 _string_8d_copy_address: # (payload array byte) -30190 0x11/imm32/alloc-id:fake:payload -30191 # "8d/copy-address" -30192 0xf/imm32/size -30193 0x38/8 0x64/d 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x65/e 0x73/s 0x73/s -30194 _string_b8_copy_to_eax: # (payload array byte) -30195 0x11/imm32/alloc-id:fake:payload -30196 # "b8/copy-to-eax" -30197 0xe/imm32/size -30198 0x62/b 0x38/8 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x65/e 0x61/a 0x78/x -30199 _string_b9_copy_to_ecx: # (payload array byte) -30200 0x11/imm32/alloc-id:fake:payload -30201 # "b9/copy-to-ecx" -30202 0xe/imm32/size -30203 0x62/b 0x39/9 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x65/e 0x63/c 0x78/x -30204 _string_ba_copy_to_edx: # (payload array byte) -30205 0x11/imm32/alloc-id:fake:payload -30206 # "ba/copy-to-edx" -30207 0xe/imm32/size -30208 0x62/b 0x61/a 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x65/e 0x64/d 0x78/x -30209 _string_bb_copy_to_ebx: # (payload array byte) -30210 0x11/imm32/alloc-id:fake:payload -30211 # "bb/copy-to-ebx" -30212 0xe/imm32/size -30213 0x62/b 0x62/b 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x65/e 0x62/b 0x78/x -30214 _string_be_copy_to_esi: # (payload array byte) -30215 0x11/imm32/alloc-id:fake:payload -30216 # "be/copy-to-esi" -30217 0xe/imm32/size -30218 0x62/b 0x65/e 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x65/e 0x73/s 0x69/i -30219 _string_bf_copy_to_edi: # (payload array byte) -30220 0x11/imm32/alloc-id:fake:payload -30221 # "bf/copy-to-edi" -30222 0xe/imm32/size -30223 0x62/b 0x66/f 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x65/e 0x64/d 0x69/i -30224 _string_c7_subop_copy: # (payload array byte) -30225 0x11/imm32/alloc-id:fake:payload -30226 # "c7 0/subop/copy" -30227 0xf/imm32/size -30228 0x63/c 0x37/7 0x20/space 0x30/0 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y -30229 _string_e9_jump_label: # (payload array byte) -30230 0x11/imm32/alloc-id:fake:payload -30231 # "e9/jump" -30232 0x7/imm32/size -30233 0x65/e 0x39/9 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p -30234 _string_e9_jump_break: # (payload array byte) -30235 0x11/imm32/alloc-id:fake:payload -30236 # "e9/jump break/disp32" -30237 0x14/imm32/size -30238 0x65/e 0x39/9 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -30239 _string_e9_jump_loop: # (payload array byte) -30240 0x11/imm32/alloc-id:fake:payload -30241 # "e9/jump loop/disp32" -30242 0x13/imm32/size -30243 0x65/e 0x39/9 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 -30244 _string_f7_subop_negate: -30245 0x11/imm32/alloc-id:fake:payload -30246 # "f7 3/subop/negate" -30247 0x11/imm32/size -30248 0x66/f 0x37/7 0x20/space 0x33/3 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x6e/n 0x65/e 0x67/g 0x61/a 0x74/t 0x65/e -30249 _string_ff_subop_increment: # (payload array byte) -30250 0x11/imm32/alloc-id:fake:payload -30251 # "ff 0/subop/increment" -30252 0x14/imm32/size -30253 0x66/f 0x66/f 0x20/space 0x30/0 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t -30254 _string_ff_subop_decrement: # (payload array byte) -30255 0x11/imm32/alloc-id:fake:payload -30256 # "ff 1/subop/decrement" -30257 0x14/imm32/size -30258 0x66/f 0x66/f 0x20/space 0x31/1 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t -30259 _string_c1_subop_shift_left: # (payload array byte) -30260 0x11/imm32/alloc-id:fake:payload -30261 # "c1/shift 4/subop/left" -30262 0x15/imm32/size -30263 0x63/c 0x31/1 0x2f/slash 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x20/space 0x34/4 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x6c/l 0x65/e 0x66/f 0x74/t -30264 _string_c1_subop_shift_right_padding_zeroes: # (payload array byte) -30265 0x11/imm32/alloc-id:fake:payload -30266 # "c1/shift 5/subop/right-padding-zeroes" -30267 0x25/imm32/size -30268 0x63/c 0x31/1 0x2f/slash 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x20/space 0x35/5 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x72/r 0x69/i 0x67/g 0x68/h 0x74/t 0x2d/dash 0x70/p 0x61/a 0x64/d 0x64/d 0x69/i 0x6e/n 0x67/g 0x2d/dash 0x7a/z 0x65/e 0x72/r 0x6f/o 0x65/e 0x73/s -30269 _string_c1_subop_shift_right_preserving_sign: # (payload array byte) -30270 0x11/imm32/alloc-id:fake:payload -30271 # "c1/shift 7/subop/right-preserving-sign" -30272 0x26/imm32/size -30273 0x63/c 0x31/1 0x2f/slash 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x20/space 0x37/7 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x72/r 0x69/i 0x67/g 0x68/h 0x74/t 0x2d/dash 0x70/p 0x72/r 0x65/e 0x73/s 0x65/e 0x72/r 0x76/v 0x69/i 0x6e/n 0x67/g 0x2d/dash 0x73/s 0x69/i 0x67/g 0x6e/n -30274 -30275 Single-int-var-in-mem: # (payload list var) -30276 0x11/imm32/alloc-id:fake:payload -30277 0x11/imm32/alloc-id:fake -30278 Int-var-in-mem/imm32 -30279 0/imm32/next -30280 0/imm32/next -30281 -30282 Int-var-in-mem: # (payload var) +30061 0x11/imm32/alloc-id:fake +30062 _string-loop-if-float</imm32/name +30063 0x11/imm32/alloc-id:fake +30064 Single-lit-var/imm32/inouts +30065 0/imm32/no-outputs +30066 0/imm32/no-outputs +30067 0x11/imm32/alloc-id:fake +30068 _string_0f_82_jump_label/imm32/subx-name +30069 0/imm32/no-rm32 +30070 0/imm32/no-r32 +30071 0/imm32/no-imm32 +30072 0/imm32/no-imm8 +30073 1/imm32/disp32-is-first-inout +30074 0/imm32/no-xm32 +30075 0/imm32/no-x32 +30076 0x11/imm32/alloc-id:fake +30077 _Primitive-loop-if-float>=-named/imm32/next +30078 _Primitive-loop-if-float>=-named: # (payload primitive) +30079 0x11/imm32/alloc-id:fake:payload +30080 0x11/imm32/alloc-id:fake +30081 _string-loop-if-float>=/imm32/name +30082 0x11/imm32/alloc-id:fake +30083 Single-lit-var/imm32/inouts +30084 0/imm32/no-outputs +30085 0/imm32/no-outputs +30086 0x11/imm32/alloc-id:fake +30087 _string_0f_83_jump_label/imm32/subx-name +30088 0/imm32/no-rm32 +30089 0/imm32/no-r32 +30090 0/imm32/no-imm32 +30091 0/imm32/no-imm8 +30092 1/imm32/disp32-is-first-inout +30093 0/imm32/no-xm32 +30094 0/imm32/no-x32 +30095 0x11/imm32/alloc-id:fake +30096 _Primitive-loop-if-float<=-named/imm32/next +30097 _Primitive-loop-if-float<=-named: # (payload primitive) +30098 0x11/imm32/alloc-id:fake:payload +30099 0x11/imm32/alloc-id:fake +30100 _string-loop-if-float<=/imm32/name +30101 0x11/imm32/alloc-id:fake +30102 Single-lit-var/imm32/inouts +30103 0/imm32/no-outputs +30104 0/imm32/no-outputs +30105 0x11/imm32/alloc-id:fake +30106 _string_0f_86_jump_label/imm32/subx-name +30107 0/imm32/no-rm32 +30108 0/imm32/no-r32 +30109 0/imm32/no-imm32 +30110 0/imm32/no-imm8 +30111 1/imm32/disp32-is-first-inout +30112 0/imm32/no-xm32 +30113 0/imm32/no-x32 +30114 0x11/imm32/alloc-id:fake +30115 _Primitive-loop-if-float>-named/imm32/next +30116 _Primitive-loop-if-float>-named: # (payload primitive) +30117 0x11/imm32/alloc-id:fake:payload +30118 0x11/imm32/alloc-id:fake +30119 _string-loop-if-float>/imm32/name +30120 0x11/imm32/alloc-id:fake +30121 Single-lit-var/imm32/inouts +30122 0/imm32/no-outputs +30123 0/imm32/no-outputs +30124 0x11/imm32/alloc-id:fake +30125 _string_0f_87_jump_label/imm32/subx-name +30126 0/imm32/no-rm32 +30127 0/imm32/no-r32 +30128 0/imm32/no-imm32 +30129 0/imm32/no-imm8 +30130 1/imm32/disp32-is-first-inout +30131 0/imm32/no-xm32 +30132 0/imm32/no-x32 +30133 0/imm32/next +30134 0/imm32/next +30135 +30136 # string literals for Mu instructions +30137 _string-add: # (payload array byte) +30138 0x11/imm32/alloc-id:fake:payload +30139 # "add" +30140 0x3/imm32/size +30141 0x61/a 0x64/d 0x64/d +30142 _string-address: # (payload array byte) +30143 0x11/imm32/alloc-id:fake:payload +30144 # "address" +30145 0x7/imm32/size +30146 0x61/a 0x64/d 0x64/d 0x72/r 0x65/e 0x73/s 0x73/s +30147 _string-add-to: # (payload array byte) +30148 0x11/imm32/alloc-id:fake:payload +30149 # "add-to" +30150 0x6/imm32/size +30151 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o +30152 _string-and: # (payload array byte) +30153 0x11/imm32/alloc-id:fake:payload +30154 # "and" +30155 0x3/imm32/size +30156 0x61/a 0x6e/n 0x64/d +30157 _string-and-with: # (payload array byte) +30158 0x11/imm32/alloc-id:fake:payload +30159 # "and-with" +30160 0x8/imm32/size +30161 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +30162 _string-break: # (payload array byte) +30163 0x11/imm32/alloc-id:fake:payload +30164 # "break" +30165 0x5/imm32/size +30166 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k +30167 _string-break-if-<: # (payload array byte) +30168 0x11/imm32/alloc-id:fake:payload +30169 # "break-if-<" +30170 0xa/imm32/size +30171 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< +30172 _string-break-if-<=: # (payload array byte) +30173 0x11/imm32/alloc-id:fake:payload +30174 # "break-if-<=" +30175 0xb/imm32/size +30176 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= +30177 _string-break-if-=: # (payload array byte) +30178 0x11/imm32/alloc-id:fake:payload +30179 # "break-if-=" +30180 0xa/imm32/size +30181 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= +30182 _string-break-if->: # (payload array byte) +30183 0x11/imm32/alloc-id:fake:payload +30184 # "break-if->" +30185 0xa/imm32/size +30186 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> +30187 _string-break-if->=: # (payload array byte) +30188 0x11/imm32/alloc-id:fake:payload +30189 # "break-if->=" +30190 0xb/imm32/size +30191 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= +30192 _string-break-if-!=: # (payload array byte) +30193 0x11/imm32/alloc-id:fake:payload +30194 # "break-if-!=" +30195 0xb/imm32/size +30196 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= +30197 _string-break-if-addr<: # (payload array byte) +30198 0x11/imm32/alloc-id:fake:payload +30199 # "break-if-addr<" +30200 0xe/imm32/size +30201 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< +30202 _string-break-if-addr<=: # (payload array byte) +30203 0x11/imm32/alloc-id:fake:payload +30204 # "break-if-addr<=" +30205 0xf/imm32/size +30206 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< 0x3d/= +30207 _string-break-if-addr>: # (payload array byte) +30208 0x11/imm32/alloc-id:fake:payload +30209 # "break-if-addr>" +30210 0xe/imm32/size +30211 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> +30212 _string-break-if-addr>=: # (payload array byte) +30213 0x11/imm32/alloc-id:fake:payload +30214 # "break-if-addr>=" +30215 0xf/imm32/size +30216 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> 0x3d/= +30217 _string-break-if-float<: # (payload array byte) +30218 0x11/imm32/alloc-id:fake:payload +30219 # "break-if-float<" +30220 0xf/imm32/size +30221 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3c/< +30222 _string-break-if-float<=: # (payload array byte) +30223 0x11/imm32/alloc-id:fake:payload +30224 # "break-if-float<=" +30225 0x10/imm32/size +30226 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3c/< 0x3d/= +30227 _string-break-if-float>: # (payload array byte) +30228 0x11/imm32/alloc-id:fake:payload +30229 # "break-if-float>" +30230 0xf/imm32/size +30231 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3e/> +30232 _string-break-if-float>=: # (payload array byte) +30233 0x11/imm32/alloc-id:fake:payload +30234 # "break-if-float>=" +30235 0x10/imm32/size +30236 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3e/> 0x3d/= +30237 _string-compare: # (payload array byte) +30238 0x11/imm32/alloc-id:fake:payload +30239 # "compare" +30240 0x7/imm32/size +30241 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e +30242 _string-copy: # (payload array byte) +30243 0x11/imm32/alloc-id:fake:payload +30244 # "copy" +30245 0x4/imm32/size +30246 0x63/c 0x6f/o 0x70/p 0x79/y +30247 _string-copy-to: # (payload array byte) +30248 0x11/imm32/alloc-id:fake:payload +30249 # "copy-to" +30250 0x7/imm32/size +30251 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o +30252 _string-copy-byte: +30253 0x11/imm32/alloc-id:fake:payload +30254 # "copy-byte" +30255 0x9/imm32/size +30256 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/- 0x62/b 0x79/y 0x74/t 0x65/e +30257 _string-copy-byte-to: +30258 0x11/imm32/alloc-id:fake:payload +30259 # "copy-byte-to" +30260 0xc/imm32/size +30261 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/- 0x62/b 0x79/y 0x74/t 0x65/e 0x2d/- 0x74/t 0x6f/o +30262 _string-decrement: # (payload array byte) +30263 0x11/imm32/alloc-id:fake:payload +30264 # "decrement" +30265 0x9/imm32/size +30266 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t +30267 _string-increment: # (payload array byte) +30268 0x11/imm32/alloc-id:fake:payload +30269 # "increment" +30270 0x9/imm32/size +30271 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t +30272 _string-loop: # (payload array byte) +30273 0x11/imm32/alloc-id:fake:payload +30274 # "loop" +30275 0x4/imm32/size +30276 0x6c/l 0x6f/o 0x6f/o 0x70/p +30277 _string-loop-if-<: # (payload array byte) +30278 0x11/imm32/alloc-id:fake:payload +30279 # "loop-if-<" +30280 0x9/imm32/size +30281 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< +30282 _string-loop-if-<=: # (payload array byte) 30283 0x11/imm32/alloc-id:fake:payload -30284 0/imm32/name -30285 0/imm32/name -30286 0x11/imm32/alloc-id:fake -30287 Type-int/imm32 -30288 1/imm32/some-block-depth -30289 1/imm32/some-stack-offset -30290 0/imm32/no-register -30291 0/imm32/no-register -30292 -30293 # Not really legal, but closest we can currently represent a dereference of an (addr byte) -30294 Single-byte-var-in-mem: # (payload list var) -30295 0x11/imm32/alloc-id:fake:payload -30296 0x11/imm32/alloc-id:fake -30297 Byte-var-in-mem/imm32 -30298 0/imm32/next -30299 0/imm32/next -30300 -30301 # Not really legal, but closest we can currently represent a dereference of an (addr byte) -30302 Byte-var-in-mem: # (payload var) +30284 # "loop-if-<=" +30285 0xa/imm32/size +30286 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= +30287 _string-loop-if-=: # (payload array byte) +30288 0x11/imm32/alloc-id:fake:payload +30289 # "loop-if-=" +30290 0x9/imm32/size +30291 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= +30292 _string-loop-if->: # (payload array byte) +30293 0x11/imm32/alloc-id:fake:payload +30294 # "loop-if->" +30295 0x9/imm32/size +30296 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> +30297 _string-loop-if->=: # (payload array byte) +30298 0x11/imm32/alloc-id:fake:payload +30299 # "loop-if->=" +30300 0xa/imm32/size +30301 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= +30302 _string-loop-if-!=: # (payload array byte) 30303 0x11/imm32/alloc-id:fake:payload -30304 0/imm32/name -30305 0/imm32/name -30306 0x11/imm32/alloc-id:fake -30307 Type-byte/imm32 -30308 1/imm32/some-block-depth -30309 1/imm32/some-stack-offset -30310 0/imm32/no-register -30311 0/imm32/no-register -30312 -30313 Two-args-int-stack-int-reg: # (payload list var) -30314 0x11/imm32/alloc-id:fake:payload -30315 0x11/imm32/alloc-id:fake -30316 Int-var-in-mem/imm32 -30317 0x11/imm32/alloc-id:fake -30318 Single-int-var-in-some-register/imm32/next -30319 -30320 Two-int-args-in-regs: # (payload list var) -30321 0x11/imm32/alloc-id:fake:payload -30322 0x11/imm32/alloc-id:fake -30323 Int-var-in-some-register/imm32 -30324 0x11/imm32/alloc-id:fake -30325 Single-int-var-in-some-register/imm32/next -30326 -30327 # Not really legal, but closest we can currently represent a dereference of an (addr byte) -30328 Two-args-byte-stack-byte-reg: # (payload list var) -30329 0x11/imm32/alloc-id:fake:payload -30330 0x11/imm32/alloc-id:fake -30331 Byte-var-in-mem/imm32 -30332 0x11/imm32/alloc-id:fake -30333 Single-byte-var-in-some-register/imm32/next -30334 -30335 Two-args-int-reg-int-stack: # (payload list var) -30336 0x11/imm32/alloc-id:fake:payload -30337 0x11/imm32/alloc-id:fake -30338 Int-var-in-some-register/imm32 -30339 0x11/imm32/alloc-id:fake -30340 Single-int-var-in-mem/imm32/next -30341 -30342 Two-args-int-eax-int-literal: # (payload list var) +30304 # "loop-if-!=" +30305 0xa/imm32/size +30306 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= +30307 _string-loop-if-addr<: # (payload array byte) +30308 0x11/imm32/alloc-id:fake:payload +30309 # "loop-if-addr<" +30310 0xd/imm32/size +30311 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< +30312 _string-loop-if-addr<=: # (payload array byte) +30313 0x11/imm32/alloc-id:fake:payload +30314 # "loop-if-addr<=" +30315 0xe/imm32/size +30316 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< 0x3d/= +30317 _string-loop-if-addr>: # (payload array byte) +30318 0x11/imm32/alloc-id:fake:payload +30319 # "loop-if-addr>" +30320 0xd/imm32/size +30321 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> +30322 _string-loop-if-addr>=: # (payload array byte) +30323 0x11/imm32/alloc-id:fake:payload +30324 # "loop-if-addr>=" +30325 0xe/imm32/size +30326 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> 0x3d/= +30327 _string-loop-if-float<: # (payload array byte) +30328 0x11/imm32/alloc-id:fake:payload +30329 # "loop-if-float<" +30330 0xe/imm32/size +30331 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3c/< +30332 _string-loop-if-float<=: # (payload array byte) +30333 0x11/imm32/alloc-id:fake:payload +30334 # "loop-if-float<=" +30335 0xf/imm32/size +30336 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3c/< 0x3d/= +30337 _string-loop-if-float>: # (payload array byte) +30338 0x11/imm32/alloc-id:fake:payload +30339 # "loop-if-float>" +30340 0xe/imm32/size +30341 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3e/> +30342 _string-loop-if-float>=: # (payload array byte) 30343 0x11/imm32/alloc-id:fake:payload -30344 0x11/imm32/alloc-id:fake -30345 Int-var-in-eax/imm32 -30346 0x11/imm32/alloc-id:fake -30347 Single-lit-var/imm32/next -30348 -30349 Int-var-and-literal: # (payload list var) -30350 0x11/imm32/alloc-id:fake:payload -30351 0x11/imm32/alloc-id:fake -30352 Int-var-in-mem/imm32 -30353 0x11/imm32/alloc-id:fake -30354 Single-lit-var/imm32/next -30355 -30356 Int-var-in-register-and-literal: # (payload list var) -30357 0x11/imm32/alloc-id:fake:payload -30358 0x11/imm32/alloc-id:fake -30359 Int-var-in-some-register/imm32 -30360 0x11/imm32/alloc-id:fake -30361 Single-lit-var/imm32/next -30362 -30363 Two-float-args-in-regs: # (payload list var) -30364 0x11/imm32/alloc-id:fake:payload -30365 0x11/imm32/alloc-id:fake -30366 Float-var-in-some-register/imm32 -30367 0x11/imm32/alloc-id:fake -30368 Single-float-var-in-some-register/imm32/next -30369 -30370 Two-args-float-reg-float-stack: # (payload list var) -30371 0x11/imm32/alloc-id:fake:payload -30372 0x11/imm32/alloc-id:fake -30373 Float-var-in-some-register/imm32 -30374 0x11/imm32/alloc-id:fake -30375 Single-float-var-in-mem/imm32/next -30376 -30377 Two-args-float-stack-float-reg: # (payload list var) +30344 # "loop-if-float>=" +30345 0xf/imm32/size +30346 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t 0x3e/> 0x3d/= +30347 _string-multiply: # (payload array byte) +30348 0x11/imm32/alloc-id:fake:payload +30349 # "multiply" +30350 0x8/imm32/size +30351 0x6d/m 0x75/u 0x6c/l 0x74/t 0x69/i 0x70/p 0x6c/l 0x79/y +30352 _string-convert: # (payload array byte) +30353 0x11/imm32/alloc-id:fake:payload +30354 # "convert" +30355 0x7/imm32/size +30356 0x63/c 0x6f/o 0x6e/n 0x76/v 0x65/e 0x72/r 0x74/t +30357 _string-truncate: # (payload array byte) +30358 0x11/imm32/alloc-id:fake:payload +30359 # "truncate" +30360 0x8/imm32/size +30361 0x74/t 0x72/r 0x75/u 0x6e/n 0x63/c 0x61/a 0x74/t 0x65/e +30362 _string-reinterpret: # (payload array byte) +30363 0x11/imm32/alloc-id:fake:payload +30364 # "reinterpret" +30365 0xb/imm32/size +30366 0x72/r 0x65/e 0x69/i 0x6e/n 0x74/t 0x65/e 0x72/r 0x70/p 0x72/r 0x65/e 0x74/t +30367 _string-divide: +30368 0x11/imm32/alloc-id:fake:payload +30369 # "divide" +30370 0x6/imm32/size +30371 0x64/d 0x69/i 0x76/v 0x69/i 0x64/d 0x65/e +30372 _string-max: +30373 0x11/imm32/alloc-id:fake:payload +30374 # "max" +30375 0x3/imm32/size +30376 0x6d/m 0x61/a 0x78/x +30377 _string-min: 30378 0x11/imm32/alloc-id:fake:payload -30379 0x11/imm32/alloc-id:fake -30380 Float-var-in-mem/imm32 -30381 0x11/imm32/alloc-id:fake -30382 Single-float-var-in-some-register/imm32/next -30383 -30384 Single-int-var-in-some-register: # (payload list var) -30385 0x11/imm32/alloc-id:fake:payload -30386 0x11/imm32/alloc-id:fake -30387 Int-var-in-some-register/imm32 -30388 0/imm32/next -30389 0/imm32/next -30390 -30391 Single-addr-var-in-some-register: # (payload list var) -30392 0x11/imm32/alloc-id:fake:payload -30393 0x11/imm32/alloc-id:fake -30394 Addr-var-in-some-register/imm32 -30395 0/imm32/next -30396 0/imm32/next -30397 -30398 Single-byte-var-in-some-register: # (payload list var) -30399 0x11/imm32/alloc-id:fake:payload -30400 0x11/imm32/alloc-id:fake -30401 Byte-var-in-some-register/imm32 -30402 0/imm32/next -30403 0/imm32/next -30404 -30405 Int-var-in-some-register: # (payload var) -30406 0x11/imm32/alloc-id:fake:payload -30407 0/imm32/name -30408 0/imm32/name -30409 0x11/imm32/alloc-id:fake -30410 Type-int/imm32 -30411 1/imm32/some-block-depth -30412 0/imm32/no-stack-offset -30413 0x11/imm32/alloc-id:fake -30414 Any-register/imm32 -30415 -30416 Any-register: # (payload array byte) -30417 0x11/imm32/alloc-id:fake:payload -30418 1/imm32/size -30419 # data -30420 2a/asterisk -30421 -30422 Addr-var-in-some-register: # (payload var) +30379 # "min" +30380 0x3/imm32/size +30381 0x6d/m 0x69/i 0x6e/n +30382 _string-reciprocal: +30383 0x11/imm32/alloc-id:fake:payload +30384 # "reciprocal" +30385 0xa/imm32/size +30386 0x72/r 0x65/e 0x63/c 0x69/i 0x70/p 0x72/r 0x6f/o 0x63/c 0x61/a 0x6c/l +30387 _string-square-root: +30388 0x11/imm32/alloc-id:fake:payload +30389 # "square-root" +30390 0xb/imm32/size +30391 0x73/s 0x71/q 0x75/u 0x61/a 0x72/r 0x65/e 0x2d/- 0x72/r 0x6f/o 0x6f/o 0x74/t +30392 _string-inverse-square-root: +30393 0x11/imm32/alloc-id:fake:payload +30394 # "inverse-square-root" +30395 0x13/imm32/size +30396 0x69/i 0x6e/n 0x76/v 0x65/e 0x72/r 0x73/s 0x65/e 0x2d/- 0x73/s 0x71/q 0x75/u 0x61/a 0x72/r 0x65/e 0x2d/- 0x72/r 0x6f/o 0x6f/o 0x74/t +30397 _string-negate: # (payload array byte) +30398 0x11/imm32/alloc-id:fake:payload +30399 # "negate" +30400 0x6/imm32/size +30401 0x6e/n 0x65/e 0x67/g 0x61/a 0x74/t 0x65/e +30402 _string-or: # (payload array byte) +30403 0x11/imm32/alloc-id:fake:payload +30404 # "or" +30405 0x2/imm32/size +30406 0x6f/o 0x72/r +30407 _string-or-with: # (payload array byte) +30408 0x11/imm32/alloc-id:fake:payload +30409 # "or-with" +30410 0x7/imm32/size +30411 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +30412 _string-subtract: # (payload array byte) +30413 0x11/imm32/alloc-id:fake:payload +30414 # "subtract" +30415 0x8/imm32/size +30416 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t +30417 _string-subtract-from: # (payload array byte) +30418 0x11/imm32/alloc-id:fake:payload +30419 # "subtract-from" +30420 0xd/imm32/size +30421 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t 0x2d/dash 0x66/f 0x72/r 0x6f/o 0x6d/m +30422 _string-xor: # (payload array byte) 30423 0x11/imm32/alloc-id:fake:payload -30424 0/imm32/name -30425 0/imm32/name -30426 0x11/imm32/alloc-id:fake -30427 Type-addr/imm32 -30428 1/imm32/some-block-depth -30429 0/imm32/no-stack-offset -30430 0x11/imm32/alloc-id:fake -30431 Any-register/imm32 -30432 -30433 Byte-var-in-some-register: # (payload var) -30434 0x11/imm32/alloc-id:fake:payload -30435 0/imm32/name -30436 0/imm32/name -30437 0x11/imm32/alloc-id:fake -30438 Type-byte/imm32 -30439 1/imm32/some-block-depth -30440 0/imm32/no-stack-offset -30441 0x11/imm32/alloc-id:fake -30442 Any-register/imm32 -30443 -30444 Single-int-var-in-eax: # (payload list var) -30445 0x11/imm32/alloc-id:fake:payload -30446 0x11/imm32/alloc-id:fake -30447 Int-var-in-eax/imm32 -30448 0/imm32/next -30449 0/imm32/next -30450 -30451 Int-var-in-eax: -30452 0x11/imm32/alloc-id:fake:payload -30453 0/imm32/name -30454 0/imm32/name -30455 0x11/imm32/alloc-id:fake -30456 Type-int/imm32 -30457 1/imm32/some-block-depth -30458 0/imm32/no-stack-offset -30459 0x11/imm32/alloc-id:fake -30460 $Mu-register-eax/imm32 # can't use Register-eax only to keep our buggy tools/treeshake.cc happy (TODO) -30461 -30462 Single-int-var-in-ecx: # (payload list var) -30463 0x11/imm32/alloc-id:fake:payload -30464 0x11/imm32/alloc-id:fake -30465 Int-var-in-ecx/imm32 -30466 0/imm32/next -30467 0/imm32/next -30468 -30469 Int-var-in-ecx: +30424 # "xor" +30425 0x3/imm32/size +30426 0x78/x 0x6f/o 0x72/r +30427 _string-xor-with: # (payload array byte) +30428 0x11/imm32/alloc-id:fake:payload +30429 # "xor-with" +30430 0x8/imm32/size +30431 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +30432 _string-shift-left: # (payload array byte) +30433 0x11/imm32/alloc-id:fake:payload +30434 # "shift-left" +30435 0xa/imm32/size +30436 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x2d/dash 0x6c/l 0x65/e 0x66/f 0x74/t +30437 _string-shift-right: # (payload array byte) +30438 0x11/imm32/alloc-id:fake:payload +30439 # "shift-right" +30440 0xb/imm32/size +30441 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x2d/dash 0x72/r 0x69/i 0x67/g 0x68/h 0x74/t +30442 _string-shift-right-signed: # (payload array byte) +30443 0x11/imm32/alloc-id:fake:payload +30444 # "shift-right-signed" +30445 0x12/imm32/size +30446 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x2d/dash 0x72/r 0x69/i 0x67/g 0x68/h 0x74/t 0x2d/dash 0x73/s 0x69/i 0x67/g 0x6e/n 0x65/e 0x64/d +30447 +30448 # string literals for SubX instructions +30449 _string_01_add_to: # (payload array byte) +30450 0x11/imm32/alloc-id:fake:payload +30451 # "01/add-to" +30452 0x9/imm32/size +30453 0x30/0 0x31/1 0x2f/slash 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o +30454 _string_03_add: # (payload array byte) +30455 0x11/imm32/alloc-id:fake:payload +30456 # "03/add" +30457 0x6/imm32/size +30458 0x30/0 0x33/3 0x2f/slash 0x61/a 0x64/d 0x64/d +30459 _string_05_add_to_eax: # (payload array byte) +30460 0x11/imm32/alloc-id:fake:payload +30461 # "05/add-to-eax" +30462 0xd/imm32/size +30463 0x30/0 0x35/5 0x2f/slash 0x61/a 0x64/d 0x64/d 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x65/e 0x61/a 0x78/x +30464 _string_09_or_with: # (payload array byte) +30465 0x11/imm32/alloc-id:fake:payload +30466 # "09/or-with" +30467 0xa/imm32/size +30468 0x30/0 0x39/9 0x2f/slash 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +30469 _string_0b_or: # (payload array byte) 30470 0x11/imm32/alloc-id:fake:payload -30471 0/imm32/name -30472 0/imm32/name -30473 0x11/imm32/alloc-id:fake -30474 Type-int/imm32 -30475 1/imm32/some-block-depth -30476 0/imm32/no-stack-offset -30477 0x11/imm32/alloc-id:fake -30478 $Register-ecx/imm32/register -30479 -30480 Single-int-var-in-edx: # (payload list var) -30481 0x11/imm32/alloc-id:fake:payload -30482 0x11/imm32/alloc-id:fake -30483 Int-var-in-edx/imm32 -30484 0/imm32/next -30485 0/imm32/next -30486 -30487 Int-var-in-edx: # (payload list var) -30488 0x11/imm32/alloc-id:fake:payload -30489 0/imm32/name -30490 0/imm32/name -30491 0x11/imm32/alloc-id:fake -30492 Type-int/imm32 -30493 1/imm32/some-block-depth -30494 0/imm32/no-stack-offset -30495 0x11/imm32/alloc-id:fake -30496 $Register-edx/imm32/register -30497 -30498 Single-int-var-in-ebx: # (payload list var) -30499 0x11/imm32/alloc-id:fake:payload -30500 0x11/imm32/alloc-id:fake -30501 Int-var-in-ebx/imm32 -30502 0/imm32/next -30503 0/imm32/next -30504 -30505 Int-var-in-ebx: # (payload list var) -30506 0x11/imm32/alloc-id:fake:payload -30507 0/imm32/name -30508 0/imm32/name -30509 0x11/imm32/alloc-id:fake -30510 Type-int/imm32 -30511 1/imm32/some-block-depth -30512 0/imm32/no-stack-offset -30513 0x11/imm32/alloc-id:fake -30514 $Register-ebx/imm32/register -30515 -30516 Single-int-var-in-esi: # (payload list var) -30517 0x11/imm32/alloc-id:fake:payload -30518 0x11/imm32/alloc-id:fake -30519 Int-var-in-esi/imm32 -30520 0/imm32/next -30521 0/imm32/next -30522 -30523 Int-var-in-esi: # (payload list var) -30524 0x11/imm32/alloc-id:fake:payload -30525 0/imm32/name -30526 0/imm32/name -30527 0x11/imm32/alloc-id:fake -30528 Type-int/imm32 -30529 1/imm32/some-block-depth -30530 0/imm32/no-stack-offset -30531 0x11/imm32/alloc-id:fake -30532 $Register-esi/imm32/register -30533 -30534 Single-int-var-in-edi: # (payload list var) +30471 # "0b/or" +30472 0x5/imm32/size +30473 0x30/0 0x62/b 0x2f/slash 0x6f/o 0x72/r +30474 _string_0d_or_with_eax: # (payload array byte) +30475 0x11/imm32/alloc-id:fake:payload +30476 # "0d/or-with-eax" +30477 0xe/imm32/size +30478 0x30/0 0x64/d 0x2f/slash 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h 0x2d/dash 0x65/e 0x61/a 0x78/x +30479 _string_0f_82_jump_label: # (payload array byte) +30480 0x11/imm32/alloc-id:fake:payload +30481 # "0f 82/jump-if-addr<" +30482 0x13/imm32/size +30483 0x30/0 0x66/f 0x20/space 0x38/8 0x32/2 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< +30484 _string_0f_82_jump_break: # (payload array byte) +30485 0x11/imm32/alloc-id:fake:payload +30486 # "0f 82/jump-if-addr< break/disp32" +30487 0x20/imm32/size +30488 0x30/0 0x66/f 0x20/space 0x38/8 0x32/2 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30489 _string_0f_82_jump_loop: # (payload array byte) +30490 0x11/imm32/alloc-id:fake:payload +30491 # "0f 82/jump-if-addr< loop/disp32" +30492 0x1f/imm32/size +30493 0x30/0 0x66/f 0x20/space 0x38/8 0x32/2 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30494 _string_0f_83_jump_label: # (payload array byte) +30495 0x11/imm32/alloc-id:fake:payload +30496 # "0f 83/jump-if-addr>=" +30497 0x14/imm32/size +30498 0x30/0 0x66/f 0x20/space 0x38/8 0x33/3 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> 0x3d/= +30499 _string_0f_83_jump_break: # (payload array byte) +30500 0x11/imm32/alloc-id:fake:payload +30501 # "0f 83/jump-if-addr>= break/disp32" +30502 0x21/imm32/size +30503 0x30/0 0x66/f 0x20/space 0x38/8 0x33/3 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> 0x3d/= 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30504 _string_0f_83_jump_loop: # (payload array byte) +30505 0x11/imm32/alloc-id:fake:payload +30506 # "0f 83/jump-if-addr>= loop/disp32" +30507 0x20/imm32/size +30508 0x30/0 0x66/f 0x20/space 0x38/8 0x33/3 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> 0x3d/= 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30509 _string_0f_84_jump_label: # (payload array byte) +30510 0x11/imm32/alloc-id:fake:payload +30511 # "0f 84/jump-if-=" +30512 0xf/imm32/size +30513 0x30/0 0x66/f 0x20/space 0x38/8 0x34/4 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= +30514 _string_0f_84_jump_break: # (payload array byte) +30515 0x11/imm32/alloc-id:fake:payload +30516 # "0f 84/jump-if-= break/disp32" +30517 0x1c/imm32/size +30518 0x30/0 0x66/f 0x20/space 0x38/8 0x34/4 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30519 _string_0f_84_jump_loop: # (payload array byte) +30520 0x11/imm32/alloc-id:fake:payload +30521 # "0f 84/jump-if-= loop/disp32" +30522 0x1b/imm32/size +30523 0x30/0 0x66/f 0x20/space 0x38/8 0x34/4 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3d/= 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30524 _string_0f_85_jump_label: # (payload array byte) +30525 0x11/imm32/alloc-id:fake:payload +30526 # "0f 85/jump-if-!=" +30527 0x10/imm32/size +30528 0x30/0 0x66/f 0x20/space 0x38/8 0x35/5 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= +30529 _string_0f_85_jump_break: # (payload array byte) +30530 0x11/imm32/alloc-id:fake:payload +30531 # "0f 85/jump-if-!= break/disp32" +30532 0x1d/imm32/size +30533 0x30/0 0x66/f 0x20/space 0x38/8 0x35/5 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30534 _string_0f_85_jump_loop: # (payload array byte) 30535 0x11/imm32/alloc-id:fake:payload -30536 0x11/imm32/alloc-id:fake -30537 Int-var-in-edi/imm32 -30538 0/imm32/next -30539 0/imm32/next -30540 -30541 Int-var-in-edi: # (payload list var) -30542 0x11/imm32/alloc-id:fake:payload -30543 0/imm32/name -30544 0/imm32/name -30545 0x11/imm32/alloc-id:fake -30546 Type-int/imm32 -30547 1/imm32/some-block-depth -30548 0/imm32/no-stack-offset -30549 0x11/imm32/alloc-id:fake -30550 $Register-edi/imm32/register -30551 -30552 Single-lit-var: # (payload list var) -30553 0x11/imm32/alloc-id:fake:payload -30554 0x11/imm32/alloc-id:fake -30555 Lit-var/imm32 -30556 0/imm32/next -30557 0/imm32/next -30558 -30559 Lit-var: # (payload var) +30536 # "0f 85/jump-if-!= loop/disp32" +30537 0x1c/imm32/size +30538 0x30/0 0x66/f 0x20/space 0x38/8 0x35/5 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x21/! 0x3d/= 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30539 _string_0f_86_jump_label: # (payload array byte) +30540 0x11/imm32/alloc-id:fake:payload +30541 # "0f 86/jump-if-addr<=" +30542 0x14/imm32/size +30543 0x30/0 0x66/f 0x20/space 0x38/8 0x36/6 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< 0x3d/= +30544 _string_0f_86_jump_break: # (payload array byte) +30545 0x11/imm32/alloc-id:fake:payload +30546 # "0f 86/jump-if-addr<= break/disp32" +30547 0x21/imm32/size +30548 0x30/0 0x66/f 0x20/space 0x38/8 0x36/6 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< 0x3d/= 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30549 _string_0f_86_jump_loop: # (payload array byte) +30550 0x11/imm32/alloc-id:fake:payload +30551 # "0f 86/jump-if-addr<= loop/disp32" +30552 0x20/imm32/size +30553 0x30/0 0x66/f 0x20/space 0x38/8 0x36/6 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3c/< 0x3d/= 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30554 _string_0f_87_jump_label: # (payload array byte) +30555 0x11/imm32/alloc-id:fake:payload +30556 # "0f 87/jump-if-addr>" +30557 0x13/imm32/size +30558 0x30/0 0x66/f 0x20/space 0x38/8 0x37/7 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> +30559 _string_0f_87_jump_break: # (payload array byte) 30560 0x11/imm32/alloc-id:fake:payload -30561 0/imm32/name -30562 0/imm32/name -30563 0x11/imm32/alloc-id:fake -30564 Type-literal/imm32 -30565 1/imm32/some-block-depth -30566 0/imm32/no-stack-offset -30567 0/imm32/no-register -30568 0/imm32/no-register -30569 -30570 Single-float-var-in-mem: # (payload list var) -30571 0x11/imm32/alloc-id:fake:payload -30572 0x11/imm32/alloc-id:fake -30573 Float-var-in-mem/imm32 -30574 0/imm32/next -30575 0/imm32/next -30576 -30577 Float-var-in-mem: # (payload var) -30578 0x11/imm32/alloc-id:fake:payload -30579 0/imm32/name -30580 0/imm32/name -30581 0x11/imm32/alloc-id:fake -30582 Type-float/imm32 -30583 1/imm32/some-block-depth -30584 1/imm32/some-stack-offset -30585 0/imm32/no-register -30586 0/imm32/no-register -30587 -30588 Single-float-var-in-some-register: # (payload list var) -30589 0x11/imm32/alloc-id:fake:payload -30590 0x11/imm32/alloc-id:fake -30591 Float-var-in-some-register/imm32 -30592 0/imm32/next -30593 0/imm32/next -30594 -30595 Float-var-in-some-register: # (payload var) -30596 0x11/imm32/alloc-id:fake:payload -30597 0/imm32/name -30598 0/imm32/name -30599 0x11/imm32/alloc-id:fake -30600 Type-float/imm32 -30601 1/imm32/some-block-depth -30602 0/imm32/no-stack-offset -30603 0x11/imm32/alloc-id:fake -30604 Any-register/imm32 -30605 -30606 Type-int: # (payload type-tree) -30607 0x11/imm32/alloc-id:fake:payload -30608 1/imm32/is-atom -30609 1/imm32/value:int -30610 0/imm32/left:unused -30611 0/imm32/right:null -30612 0/imm32/right:null -30613 -30614 Type-literal: # (payload type-tree) +30561 # "0f 87/jump-if-addr> break/disp32" +30562 0x20/imm32/size +30563 0x30/0 0x66/f 0x20/space 0x38/8 0x37/7 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30564 _string_0f_87_jump_loop: # (payload array byte) +30565 0x11/imm32/alloc-id:fake:payload +30566 # "0f 87/jump-if-addr> loop/disp32" +30567 0x1f/imm32/size +30568 0x30/0 0x66/f 0x20/space 0x38/8 0x37/7 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x3e/> 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30569 _string_0f_8c_jump_label: # (payload array byte) +30570 0x11/imm32/alloc-id:fake:payload +30571 # "0f 8c/jump-if-<" +30572 0xf/imm32/size +30573 0x30/0 0x66/f 0x20/space 0x38/8 0x63/c 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< +30574 _string_0f_8c_jump_break: # (payload array byte) +30575 0x11/imm32/alloc-id:fake:payload +30576 # "0f 8c/jump-if-< break/disp32" +30577 0x1c/imm32/size +30578 0x30/0 0x66/f 0x20/space 0x38/8 0x63/c 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30579 _string_0f_8c_jump_loop: # (payload array byte) +30580 0x11/imm32/alloc-id:fake:payload +30581 # "0f 8c/jump-if-< loop/disp32" +30582 0x1b/imm32/size +30583 0x30/0 0x66/f 0x20/space 0x38/8 0x63/c 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30584 _string_0f_8d_jump_label: # (payload array byte) +30585 0x11/imm32/alloc-id:fake:payload +30586 # "0f 8d/jump-if->=" +30587 0x10/imm32/size +30588 0x30/0 0x66/f 0x20/space 0x38/8 0x64/d 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= +30589 _string_0f_8d_jump_break: # (payload array byte) +30590 0x11/imm32/alloc-id:fake:payload +30591 # "0f 8d/jump-if->= break/disp32" +30592 0x1d/imm32/size +30593 0x30/0 0x66/f 0x20/space 0x38/8 0x64/d 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30594 _string_0f_8d_jump_loop: # (payload array byte) +30595 0x11/imm32/alloc-id:fake:payload +30596 # "0f 8d/jump-if->= loop/disp32" +30597 0x1c/imm32/size +30598 0x30/0 0x66/f 0x20/space 0x38/8 0x64/d 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x3d/= 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30599 _string_0f_8e_jump_label: # (payload array byte) +30600 0x11/imm32/alloc-id:fake:payload +30601 # "0f 8e/jump-if-<=" +30602 0x10/imm32/size +30603 0x30/0 0x66/f 0x20/space 0x38/8 0x65/e 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= +30604 _string_0f_8e_jump_break: # (payload array byte) +30605 0x11/imm32/alloc-id:fake:payload +30606 # "0f 8e/jump-if-<= break/disp32" +30607 0x1d/imm32/size +30608 0x30/0 0x66/f 0x20/space 0x38/8 0x65/e 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30609 _string_0f_8e_jump_loop: # (payload array byte) +30610 0x11/imm32/alloc-id:fake:payload +30611 # "0f 8e/jump-if-<= loop/disp32" +30612 0x1c/imm32/size +30613 0x30/0 0x66/f 0x20/space 0x38/8 0x65/e 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3c/< 0x3d/= 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30614 _string_0f_8f_jump_label: # (payload array byte) 30615 0x11/imm32/alloc-id:fake:payload -30616 1/imm32/is-atom -30617 0/imm32/value:literal -30618 0/imm32/left:unused -30619 0/imm32/right:null -30620 0/imm32/right:null -30621 -30622 Type-addr: # (payload type-tree) -30623 0x11/imm32/alloc-id:fake:payload -30624 1/imm32/is-atom -30625 2/imm32/value:addr -30626 0/imm32/left:unused -30627 0/imm32/right:null -30628 0/imm32/right:null -30629 -30630 Type-byte: # (payload type-tree) -30631 0x11/imm32/alloc-id:fake:payload -30632 1/imm32/is-atom -30633 8/imm32/value:byte -30634 0/imm32/left:unused -30635 0/imm32/right:null -30636 0/imm32/right:null -30637 -30638 Type-float: # (payload type-tree) -30639 0x11/imm32/alloc-id:fake:payload -30640 1/imm32/is-atom -30641 0xf/imm32/value:float -30642 0/imm32/left:unused -30643 0/imm32/right:null -30644 0/imm32/right:null -30645 -30646 == code -30647 emit-subx-primitive: # out: (addr buffered-file), stmt: (addr stmt), primitive: (addr primitive), err: (addr buffered-file), ed: (addr exit-descriptor) -30648 # . prologue -30649 55/push-ebp -30650 89/<- %ebp 4/r32/esp -30651 # . save registers -30652 50/push-eax -30653 51/push-ecx -30654 # ecx = primitive -30655 8b/-> *(ebp+0x10) 1/r32/ecx -30656 # emit primitive name -30657 (emit-indent *(ebp+8) *Curr-block-depth) -30658 (lookup *(ecx+0x18) *(ecx+0x1c)) # Primitive-subx-name Primitive-subx-name => eax -30659 (write-buffered *(ebp+8) %eax) -30660 # emit rm32 if necessary -30661 (emit-subx-rm32 *(ebp+8) *(ecx+0x20) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-rm32 -30662 # emit xm32 if necessary -30663 (emit-subx-rm32 *(ebp+8) *(ecx+0x34) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-xm32 -30664 # emit r32 if necessary -30665 (emit-subx-r32 *(ebp+8) *(ecx+0x24) *(ebp+0xc)) # Primitive-subx-r32 -30666 # emit x32 if necessary -30667 (emit-subx-x32 *(ebp+8) *(ecx+0x38) *(ebp+0xc)) # Primitive-subx-x32 -30668 # emit imm32 if necessary -30669 (emit-subx-imm32 *(ebp+8) *(ecx+0x28) *(ebp+0xc)) # Primitive-subx-imm32 -30670 # emit imm8 if necessary -30671 (emit-subx-imm8 *(ebp+8) *(ecx+0x2c) *(ebp+0xc)) # Primitive-subx-imm8 -30672 # emit disp32 if necessary -30673 (emit-subx-disp32 *(ebp+8) *(ecx+0x30) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-disp32 -30674 (write-buffered *(ebp+8) Newline) -30675 $emit-subx-primitive:end: -30676 # . restore registers -30677 59/pop-to-ecx -30678 58/pop-to-eax -30679 # . epilogue -30680 89/<- %esp 5/r32/ebp -30681 5d/pop-to-ebp -30682 c3/return -30683 -30684 emit-subx-rm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -30685 # . prologue -30686 55/push-ebp -30687 89/<- %ebp 4/r32/esp -30688 # . save registers -30689 50/push-eax -30690 # if (l == 0) return -30691 81 7/subop/compare *(ebp+0xc) 0/imm32 -30692 74/jump-if-= $emit-subx-rm32:end/disp8 -30693 # var v/eax: (addr stmt-var) -30694 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # => eax -30695 (emit-subx-var-as-rm32 *(ebp+8) %eax) -30696 $emit-subx-rm32:end: -30697 # . restore registers -30698 58/pop-to-eax -30699 # . epilogue -30700 89/<- %esp 5/r32/ebp -30701 5d/pop-to-ebp -30702 c3/return -30703 -30704 get-stmt-operand-from-arg-location: # stmt: (addr stmt), l: arg-location, err: (addr buffered-file), ed: (addr exit-descriptor) -> var/eax: (addr stmt-var) -30705 # . prologue -30706 55/push-ebp -30707 89/<- %ebp 4/r32/esp -30708 # . save registers -30709 51/push-ecx -30710 # eax = l -30711 8b/-> *(ebp+0xc) 0/r32/eax -30712 # ecx = stmt -30713 8b/-> *(ebp+8) 1/r32/ecx -30714 # if (l == 1) return stmt->inouts -30715 { -30716 3d/compare-eax-and 1/imm32 -30717 75/jump-if-!= break/disp8 -30718 $get-stmt-operand-from-arg-location:1: -30719 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -30720 eb/jump $get-stmt-operand-from-arg-location:end/disp8 -30721 } -30722 # if (l == 2) return stmt->inouts->next -30723 { -30724 3d/compare-eax-and 2/imm32 -30725 75/jump-if-!= break/disp8 -30726 $get-stmt-operand-from-arg-location:2: -30727 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -30728 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -30729 eb/jump $get-stmt-operand-from-arg-location:end/disp8 -30730 } -30731 # if (l == 3) return stmt->outputs -30732 { -30733 3d/compare-eax-and 3/imm32 -30734 75/jump-if-!= break/disp8 -30735 $get-stmt-operand-from-arg-location:3: -30736 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -30737 eb/jump $get-stmt-operand-from-arg-location:end/disp8 -30738 } -30739 # abort -30740 e9/jump $get-stmt-operand-from-arg-location:abort/disp32 -30741 $get-stmt-operand-from-arg-location:end: -30742 # . restore registers -30743 59/pop-to-ecx -30744 # . epilogue -30745 89/<- %esp 5/r32/ebp -30746 5d/pop-to-ebp -30747 c3/return -30748 -30749 $get-stmt-operand-from-arg-location:abort: -30750 # error("invalid arg-location " eax) -30751 (write-buffered *(ebp+0x10) "invalid arg-location ") -30752 (write-int32-hex-buffered *(ebp+0x10) %eax) -30753 (write-buffered *(ebp+0x10) Newline) -30754 (flush *(ebp+0x10)) -30755 (stop *(ebp+0x14) 1) -30756 # never gets here -30757 -30758 emit-subx-r32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) -30759 # . prologue -30760 55/push-ebp -30761 89/<- %ebp 4/r32/esp -30762 # . save registers -30763 50/push-eax -30764 51/push-ecx -30765 # if (l == 0) return -30766 81 7/subop/compare *(ebp+0xc) 0/imm32 -30767 0f 84/jump-if-= $emit-subx-r32:end/disp32 -30768 # var v/eax: (addr stmt-var) -30769 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax -30770 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -30771 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -30772 #? (write-buffered Stderr "looking up ") -30773 #? (write-buffered Stderr %eax) -30774 #? (write-buffered Stderr Newline) -30775 #? (flush Stderr) -30776 (maybe-get Mu-registers %eax 0xc) # => eax: (addr register-index) -30777 (write-buffered *(ebp+8) Space) -30778 (write-int32-hex-buffered *(ebp+8) *eax) -30779 (write-buffered *(ebp+8) "/r32") -30780 $emit-subx-r32:end: -30781 # . restore registers -30782 59/pop-to-ecx -30783 58/pop-to-eax -30784 # . epilogue -30785 89/<- %esp 5/r32/ebp -30786 5d/pop-to-ebp -30787 c3/return -30788 -30789 emit-subx-x32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) -30790 # . prologue -30791 55/push-ebp -30792 89/<- %ebp 4/r32/esp -30793 # . save registers -30794 50/push-eax -30795 51/push-ecx -30796 # if (l == 0) return -30797 81 7/subop/compare *(ebp+0xc) 0/imm32 -30798 0f 84/jump-if-= $emit-subx-x32:end/disp32 -30799 # var v/eax: (addr stmt-var) -30800 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax -30801 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -30802 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax -30803 #? (write-buffered Stderr "looking up ") -30804 #? (write-buffered Stderr %eax) -30805 #? (write-buffered Stderr Newline) -30806 #? (flush Stderr) -30807 (maybe-get Mu-registers %eax 0xc) # => eax: (addr register-index) -30808 (write-buffered *(ebp+8) Space) -30809 (write-int32-hex-buffered *(ebp+8) *eax) -30810 (write-buffered *(ebp+8) "/x32") -30811 $emit-subx-x32:end: -30812 # . restore registers -30813 59/pop-to-ecx -30814 58/pop-to-eax -30815 # . epilogue -30816 89/<- %esp 5/r32/ebp -30817 5d/pop-to-ebp -30818 c3/return -30819 -30820 emit-subx-imm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) -30821 # . prologue -30822 55/push-ebp -30823 89/<- %ebp 4/r32/esp -30824 # . save registers -30825 50/push-eax -30826 51/push-ecx -30827 # if (l == 0) return -30828 81 7/subop/compare *(ebp+0xc) 0/imm32 -30829 0f 84/jump-if-= $emit-subx-imm32:end/disp32 -30830 # var v/eax: (handle var) -30831 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax -30832 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -30833 (lookup *eax *(eax+4)) # Var-name Var-name => eax -30834 (write-buffered *(ebp+8) Space) -30835 (write-buffered *(ebp+8) %eax) -30836 (write-buffered *(ebp+8) "/imm32") -30837 $emit-subx-imm32:end: -30838 # . restore registers -30839 59/pop-to-ecx -30840 58/pop-to-eax -30841 # . epilogue -30842 89/<- %esp 5/r32/ebp -30843 5d/pop-to-ebp -30844 c3/return -30845 -30846 emit-subx-imm8: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) -30847 # . prologue -30848 55/push-ebp -30849 89/<- %ebp 4/r32/esp -30850 # . save registers -30851 50/push-eax -30852 51/push-ecx -30853 # if (l == 0) return -30854 81 7/subop/compare *(ebp+0xc) 0/imm32 -30855 0f 84/jump-if-= $emit-subx-imm32:end/disp32 -30856 # var v/eax: (handle var) -30857 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax -30858 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -30859 (lookup *eax *(eax+4)) # Var-name Var-name => eax -30860 (write-buffered *(ebp+8) Space) -30861 (write-buffered *(ebp+8) %eax) -30862 (write-buffered *(ebp+8) "/imm8") -30863 $emit-subx-imm8:end: -30864 # . restore registers -30865 59/pop-to-ecx -30866 58/pop-to-eax -30867 # . epilogue -30868 89/<- %esp 5/r32/ebp -30869 5d/pop-to-ebp -30870 c3/return -30871 -30872 emit-subx-disp32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) -30873 # . prologue -30874 55/push-ebp -30875 89/<- %ebp 4/r32/esp -30876 # . save registers -30877 50/push-eax -30878 51/push-ecx -30879 # if (location == 0) return -30880 81 7/subop/compare *(ebp+0xc) 0/imm32 -30881 0f 84/jump-if-= $emit-subx-disp32:end/disp32 -30882 # var v/eax: (addr stmt-var) -30883 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # => eax -30884 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax -30885 (lookup *eax *(eax+4)) # Var-name Var-name => eax -30886 (write-buffered *(ebp+8) Space) -30887 (write-buffered *(ebp+8) %eax) -30888 # hack: if instruction operation starts with "break", emit ":break" -30889 # var name/ecx: (addr array byte) = lookup(stmt->operation) -30890 8b/-> *(ebp+0x10) 0/r32/eax -30891 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -30892 89/<- %ecx 0/r32/eax -30893 { -30894 (string-starts-with? %ecx "break") # => eax -30895 3d/compare-eax-and 0/imm32/false -30896 74/jump-if-= break/disp8 -30897 (write-buffered *(ebp+8) ":break") -30898 } -30899 # hack: if instruction operation starts with "loop", emit ":loop" -30900 { -30901 (string-starts-with? %ecx "loop") # => eax -30902 3d/compare-eax-and 0/imm32/false -30903 74/jump-if-= break/disp8 -30904 (write-buffered *(ebp+8) ":loop") -30905 } -30906 (write-buffered *(ebp+8) "/disp32") -30907 $emit-subx-disp32:end: -30908 # . restore registers -30909 59/pop-to-ecx -30910 58/pop-to-eax -30911 # . epilogue -30912 89/<- %esp 5/r32/ebp -30913 5d/pop-to-ebp -30914 c3/return -30915 -30916 emit-call: # out: (addr buffered-file), stmt: (addr stmt) -30917 # . prologue -30918 55/push-ebp -30919 89/<- %ebp 4/r32/esp -30920 # . save registers -30921 50/push-eax -30922 51/push-ecx -30923 # -30924 (emit-indent *(ebp+8) *Curr-block-depth) -30925 (write-buffered *(ebp+8) "(") -30926 # ecx = stmt -30927 8b/-> *(ebp+0xc) 1/r32/ecx -30928 # - emit function name -30929 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax -30930 (write-buffered *(ebp+8) %eax) -30931 # - emit arguments -30932 # var curr/eax: (addr stmt-var) = lookup(stmt->inouts) -30933 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -30934 { -30935 # if (curr == null) break -30936 3d/compare-eax-and 0/imm32 -30937 74/jump-if-= break/disp8 -30938 # -30939 (emit-subx-call-operand *(ebp+8) %eax) -30940 # curr = lookup(curr->next) -30941 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax -30942 eb/jump loop/disp8 -30943 } -30944 # -30945 (write-buffered *(ebp+8) ")\n") -30946 $emit-call:end: -30947 # . restore registers -30948 59/pop-to-ecx -30949 58/pop-to-eax -30950 # . epilogue -30951 89/<- %esp 5/r32/ebp -30952 5d/pop-to-ebp -30953 c3/return -30954 -30955 emit-subx-call-operand: # out: (addr buffered-file), s: (addr stmt-var) -30956 # shares code with emit-subx-var-as-rm32 -30957 # . prologue -30958 55/push-ebp -30959 89/<- %ebp 4/r32/esp -30960 # . save registers -30961 50/push-eax -30962 51/push-ecx -30963 56/push-esi -30964 # ecx = s -30965 8b/-> *(ebp+0xc) 1/r32/ecx -30966 # var operand/esi: (addr var) = lookup(s->value) -30967 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -30968 89/<- %esi 0/r32/eax -30969 # if (operand->register && !s->is-deref?) emit "%__" -30970 { -30971 $emit-subx-call-operand:check-for-register-direct: -30972 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -30973 74/jump-if-= break/disp8 -30974 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -30975 75/jump-if-!= break/disp8 -30976 $emit-subx-call-operand:register-direct: -30977 (write-buffered *(ebp+8) " %") -30978 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -30979 (write-buffered *(ebp+8) %eax) -30980 e9/jump $emit-subx-call-operand:end/disp32 -30981 } -30982 # else if (operand->register && s->is-deref?) emit "*__" -30983 { -30984 $emit-subx-call-operand:check-for-register-indirect: -30985 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -30986 74/jump-if-= break/disp8 -30987 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -30988 74/jump-if-= break/disp8 -30989 $emit-subx-call-operand:register-indirect: -30990 (emit-subx-call-operand-register-indirect *(ebp+8) %esi) -30991 e9/jump $emit-subx-call-operand:end/disp32 -30992 } -30993 # else if (operand->stack-offset) emit "*(ebp+__)" -30994 { -30995 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset -30996 74/jump-if-= break/disp8 -30997 $emit-subx-call-operand:stack: -30998 (emit-subx-call-operand-stack *(ebp+8) %esi) -30999 e9/jump $emit-subx-call-operand:end/disp32 -31000 } -31001 # else if (operand->type == literal) emit "__" -31002 { -31003 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax -31004 81 7/subop/compare *(eax+4) 0/imm32 # Type-tree-left -31005 75/jump-if-!= break/disp8 -31006 $emit-subx-call-operand:literal: -31007 (write-buffered *(ebp+8) Space) -31008 (lookup *esi *(esi+4)) # Var-name Var-name => eax -31009 (write-buffered *(ebp+8) %eax) -31010 } -31011 $emit-subx-call-operand:end: -31012 # . restore registers -31013 5e/pop-to-esi -31014 59/pop-to-ecx -31015 58/pop-to-eax -31016 # . epilogue -31017 89/<- %esp 5/r32/ebp -31018 5d/pop-to-ebp -31019 c3/return -31020 -31021 emit-subx-call-operand-register-indirect: # out: (addr buffered-file), v: (addr var) -31022 # . prologue -31023 55/push-ebp -31024 89/<- %ebp 4/r32/esp -31025 # . save registers -31026 50/push-eax -31027 51/push-ecx -31028 56/push-esi -31029 # esi = v -31030 8b/-> *(ebp+0xc) 6/r32/esi -31031 # var size/ecx: int = size-of-deref(v) -31032 (size-of-deref %esi) # => eax -31033 89/<- %ecx 0/r32/eax -31034 # var reg-name/esi: (addr array byte) = lookup(v->register) -31035 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -31036 89/<- %esi 0/r32/eax -31037 # TODO: assert size is a multiple of 4 -31038 # var i/eax: int = 0 -31039 b8/copy-to-eax 0/imm32 -31040 { -31041 $emit-subx-call-operand-register-indirect:loop: -31042 # if (i >= size) break -31043 39/compare %eax 1/r32/ecx -31044 7d/jump-if->= break/disp8 -31045 # emit " *(" v->register "+" i ")" -31046 (write-buffered *(ebp+8) " *(") -31047 (write-buffered *(ebp+8) %esi) -31048 (write-buffered *(ebp+8) "+") -31049 (write-int32-hex-buffered *(ebp+8) %eax) -31050 (write-buffered *(ebp+8) ")") -31051 # i += 4 -31052 05/add-to-eax 4/imm32 -31053 # -31054 eb/jump loop/disp8 -31055 } -31056 $emit-subx-call-operand-register-indirect:end: -31057 # . restore registers -31058 5e/pop-to-esi -31059 59/pop-to-ecx -31060 58/pop-to-eax -31061 # . epilogue -31062 89/<- %esp 5/r32/ebp -31063 5d/pop-to-ebp -31064 c3/return -31065 -31066 emit-subx-call-operand-stack: # out: (addr buffered-file), v: (addr var) -31067 # . prologue -31068 55/push-ebp -31069 89/<- %ebp 4/r32/esp -31070 # . save registers -31071 50/push-eax -31072 51/push-ecx -31073 56/push-esi -31074 # esi = v -31075 8b/-> *(ebp+0xc) 6/r32/esi -31076 # var curr/ecx: int = v->offset -31077 8b/-> *(esi+0x14) 1/r32/ecx # Var-offset -31078 # var max/eax: int = v->offset + size-of(v) -31079 (size-of %esi) # => eax -31080 # TODO: assert size is a multiple of 4 -31081 01/add-to %eax 1/r32/ecx -31082 { -31083 $emit-subx-call-operand-stack:loop: -31084 # if (curr >= max) break -31085 39/compare %ecx 0/r32/eax -31086 7d/jump-if->= break/disp8 -31087 # emit " *(ebp+" curr ")" -31088 (write-buffered *(ebp+8) " *(ebp+") -31089 (write-int32-hex-buffered *(ebp+8) %ecx) -31090 (write-buffered *(ebp+8) ")") -31091 # i += 4 -31092 81 0/subop/add %ecx 4/imm32 -31093 # -31094 eb/jump loop/disp8 -31095 } -31096 $emit-subx-call-operand-stack:end: -31097 # . restore registers -31098 5e/pop-to-esi -31099 59/pop-to-ecx -31100 58/pop-to-eax -31101 # . epilogue -31102 89/<- %esp 5/r32/ebp -31103 5d/pop-to-ebp -31104 c3/return +30616 # "0f 8f/jump-if->" +30617 0xf/imm32/size +30618 0x30/0 0x66/f 0x20/space 0x38/8 0x66/f 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> +30619 _string_0f_8f_jump_break: # (payload array byte) +30620 0x11/imm32/alloc-id:fake:payload +30621 # "0f 8f/jump-if-> break/disp32" +30622 0x1c/imm32/size +30623 0x30/0 0x66/f 0x20/space 0x38/8 0x66/f 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30624 _string_0f_8f_jump_loop: # (payload array byte) +30625 0x11/imm32/alloc-id:fake:payload +30626 # "0f 8f/jump-if-> loop/disp32" +30627 0x1b/imm32/size +30628 0x30/0 0x66/f 0x20/space 0x38/8 0x66/f 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x2d/dash 0x69/i 0x66/f 0x2d/dash 0x3e/> 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30629 _string_0f_af_multiply: # (payload array byte) +30630 0x11/imm32/alloc-id:fake:payload +30631 # "0f af/multiply" +30632 0xe/imm32/size +30633 0x30/0 0x66/f 0x20/space 0x61/a 0x66/f 0x2f/slash 0x6d/m 0x75/u 0x6c/l 0x74/t 0x69/i 0x70/p 0x6c/l 0x79/y +30634 _string_f3_0f_2a_convert_to_float: +30635 0x11/imm32/alloc-id:fake:payload +30636 # "f3 0f 2a/convert-to-float" +30637 0x19/imm32/size +30638 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x32/2 0x61/a 0x2f/slash 0x63/c 0x6f/o 0x6e/n 0x76/v 0x65/e 0x72/r 0x74/t 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x66/f 0x6c/l 0x6f/o 0x61/a 0x74/t +30639 _string_f3_0f_2d_convert_to_int: +30640 0x11/imm32/alloc-id:fake:payload +30641 # "f3 0f 2d/convert-to-int" +30642 0x17/imm32/size +30643 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x32/2 0x64/d 0x2f/slash 0x63/c 0x6f/o 0x6e/n 0x76/v 0x65/e 0x72/r 0x74/t 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x69/i 0x6e/n 0x74/t +30644 _string_f3_0f_2c_truncate_to_int: +30645 0x11/imm32/alloc-id:fake:payload +30646 # "f3 0f 2c/truncate-to-int" +30647 0x18/imm32/size +30648 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x32/2 0x63/c 0x2f/slash 0x74/t 0x72/r 0x75/u 0x6e/n 0x63/c 0x61/a 0x74/t 0x65/e 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x69/i 0x6e/n 0x74/t +30649 _string_f3_0f_58_add: +30650 0x11/imm32/alloc-id:fake:payload +30651 # "f3 0f 58/add" +30652 0xc/imm32/size +30653 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x38/8 0x2f/slash 0x61/a 0x64/d 0x64/d +30654 _string_f3_0f_5c_subtract: +30655 0x11/imm32/alloc-id:fake:payload +30656 # "f3 0f 5c/subtract" +30657 0x11/imm32/size +30658 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x63/c 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t +30659 _string_f3_0f_59_multiply: +30660 0x11/imm32/alloc-id:fake:payload +30661 # "f3 0f 59/multiply" +30662 0x11/imm32/size +30663 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x39/9 0x2f/slash 0x6d/m 0x75/u 0x6c/l 0x74/t 0x69/i 0x70/p 0x6c/l 0x79/y +30664 _string_f3_0f_5e_divide: +30665 0x11/imm32/alloc-id:fake:payload +30666 # "f3 0f 5e/divide" +30667 0xf/imm32/size +30668 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x65/e 0x2f/slash 0x64/d 0x69/i 0x76/v 0x69/i 0x64/d 0x65/e +30669 _string_f3_0f_53_reciprocal: +30670 0x11/imm32/alloc-id:fake:payload +30671 # "f3 0f 53/reciprocal" +30672 0x13/imm32/size +30673 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x33/3 0x2f/slash 0x72/r 0x65/e 0x63/c 0x69/i 0x70/p 0x72/r 0x6f/o 0x63/c 0x61/a 0x6c/l +30674 _string_f3_0f_51_square_root: +30675 0x11/imm32/alloc-id:fake:payload +30676 # "f3 0f 51/square-root" +30677 0x14/imm32/size +30678 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x31/1 0x2f/slash 0x73/s 0x71/q 0x75/u 0x61/a 0x72/r 0x65/e 0x2d/dash 0x72/r 0x6f/o 0x6f/o 0x74/t +30679 _string_f3_0f_52_inverse_square_root: +30680 0x11/imm32/alloc-id:fake:payload +30681 # "f3 0f 52/inverse-square-root" +30682 0x1c/imm32/size +30683 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x32/2 0x2f/slash 0x69/i 0x6e/n 0x76/v 0x65/e 0x72/r 0x73/s 0x65/e 0x2d/dash 0x73/s 0x71/q 0x75/u 0x61/a 0x72/r 0x65/e 0x2d/dash 0x72/r 0x6f/o 0x6f/o 0x74/t +30684 _string_f3_0f_5d_min: +30685 0x11/imm32/alloc-id:fake:payload +30686 # "f3 0f 5d/min" +30687 0xc/imm32/size +30688 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x64/d 0x2f/slash 0x6d/m 0x69/i 0x6e/n +30689 _string_f3_0f_5f_max: +30690 0x11/imm32/alloc-id:fake:payload +30691 # "f3 0f 5f/max" +30692 0xc/imm32/size +30693 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x35/5 0x66/f 0x2f/slash 0x6d/m 0x61/a 0x78/x +30694 _string_f3_0f_10_copy: +30695 0x11/imm32/alloc-id:fake:payload +30696 # "f3 0f 10/copy" +30697 0xd/imm32/size +30698 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x31/1 0x30/0 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y +30699 _string_f3_0f_11_copy: +30700 0x11/imm32/alloc-id:fake:payload +30701 # "f3 0f 11/copy" +30702 0xd/imm32/size +30703 0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x31/1 0x31/1 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y +30704 _string_0f_2f_compare: +30705 0x11/imm32/alloc-id:fake:payload +30706 # "0f 2f/compare" +30707 0xd/imm32/size +30708 0x30/0 0x66/f 0x20/space 0x32/2 0x66/f 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e +30709 _string_21_and_with: # (payload array byte) +30710 0x11/imm32/alloc-id:fake:payload +30711 # "21/and-with" +30712 0xb/imm32/size +30713 0x32/2 0x31/1 0x2f/slash 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +30714 _string_23_and: # (payload array byte) +30715 0x11/imm32/alloc-id:fake:payload +30716 # "23/and" +30717 0x6/imm32/size +30718 0x32/2 0x33/3 0x2f/slash 0x61/a 0x6e/n 0x64/d +30719 _string_25_and_with_eax: # (payload array byte) +30720 0x11/imm32/alloc-id:fake:payload +30721 # "25/and-with-eax" +30722 0xf/imm32/size +30723 0x32/2 0x35/5 0x2f/slash 0x61/a 0x6e/n 0x64/d 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h 0x2d/dash 0x65/e 0x61/a 0x78/x +30724 _string_29_subtract_from: # (payload array byte) +30725 0x11/imm32/alloc-id:fake:payload +30726 # "29/subtract-from" +30727 0x10/imm32/size +30728 0x32/2 0x39/9 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t 0x2d/dash 0x66/f 0x72/r 0x6f/o 0x6d/m +30729 _string_2b_subtract: # (payload array byte) +30730 0x11/imm32/alloc-id:fake:payload +30731 # "2b/subtract" +30732 0xb/imm32/size +30733 0x32/2 0x62/b 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t +30734 _string_2d_subtract_from_eax: # (payload array byte) +30735 0x11/imm32/alloc-id:fake:payload +30736 # "2d/subtract-from-eax" +30737 0x14/imm32/size +30738 0x32/2 0x64/d 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t 0x2d/dash 0x66/f 0x72/r 0x6f/o 0x6d/m 0x2d/dash 0x65/e 0x61/a 0x78/x +30739 _string_31_xor_with: # (payload array byte) +30740 0x11/imm32/alloc-id:fake:payload +30741 # "31/xor-with" +30742 0xb/imm32/size +30743 0x33/3 0x31/1 0x2f/slash 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +30744 _string_33_xor: # (payload array byte) +30745 0x11/imm32/alloc-id:fake:payload +30746 # "33/xor" +30747 0x6/imm32/size +30748 0x33/3 0x33/3 0x2f/slash 0x78/x 0x6f/o 0x72/r +30749 _string_35_xor_with_eax: # (payload array byte) +30750 0x11/imm32/alloc-id:fake:payload +30751 # "35/xor-with-eax" +30752 0xf/imm32/size +30753 0x33/3 0x35/5 0x2f/slash 0x78/x 0x6f/o 0x72/r 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h 0x2d/dash 0x65/e 0x61/a 0x78/x +30754 _string_39_compare->: # (payload array byte) +30755 0x11/imm32/alloc-id:fake:payload +30756 # "39/compare->" +30757 0xc/imm32/size +30758 0x33/3 0x39/9 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x2d/dash 0x3e/> +30759 _string_3b_compare<-: # (payload array byte) +30760 0x11/imm32/alloc-id:fake:payload +30761 # "3b/compare<-" +30762 0xc/imm32/size +30763 0x33/3 0x62/b 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x3c/< 0x2d/dash +30764 _string_3d_compare_eax_with: # (payload array byte) +30765 0x11/imm32/alloc-id:fake:payload +30766 # "3d/compare-eax-with" +30767 0x13/imm32/size +30768 0x33/3 0x64/d 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e 0x2d/dash 0x65/e 0x61/a 0x78/x 0x2d/dash 0x77/w 0x69/i 0x74/t 0x68/h +30769 _string_40_increment_eax: # (payload array byte) +30770 0x11/imm32/alloc-id:fake:payload +30771 # "40/increment-eax" +30772 0x10/imm32/size +30773 0x34/4 0x30/0 0x2f/slash 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x61/a 0x78/x +30774 _string_41_increment_ecx: # (payload array byte) +30775 0x11/imm32/alloc-id:fake:payload +30776 # "41/increment-ecx" +30777 0x10/imm32/size +30778 0x34/4 0x31/1 0x2f/slash 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x63/c 0x78/x +30779 _string_42_increment_edx: # (payload array byte) +30780 0x11/imm32/alloc-id:fake:payload +30781 # "42/increment-edx" +30782 0x10/imm32/size +30783 0x34/4 0x32/2 0x2f/slash 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x64/d 0x78/x +30784 _string_43_increment_ebx: # (payload array byte) +30785 0x11/imm32/alloc-id:fake:payload +30786 # "43/increment-ebx" +30787 0x10/imm32/size +30788 0x34/4 0x33/3 0x2f/slash 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x62/b 0x78/x +30789 _string_46_increment_esi: # (payload array byte) +30790 0x11/imm32/alloc-id:fake:payload +30791 # "46/increment-esi" +30792 0x10/imm32/size +30793 0x34/4 0x36/6 0x2f/slash 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x73/s 0x69/i +30794 _string_47_increment_edi: # (payload array byte) +30795 0x11/imm32/alloc-id:fake:payload +30796 # "47/increment-edi" +30797 0x10/imm32/size +30798 0x34/4 0x37/7 0x2f/slash 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x64/d 0x69/i +30799 _string_48_decrement_eax: # (payload array byte) +30800 0x11/imm32/alloc-id:fake:payload +30801 # "48/decrement-eax" +30802 0x10/imm32/size +30803 0x34/4 0x38/8 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x61/a 0x78/x +30804 _string_49_decrement_ecx: # (payload array byte) +30805 0x11/imm32/alloc-id:fake:payload +30806 # "49/decrement-ecx" +30807 0x10/imm32/size +30808 0x34/4 0x39/9 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x63/c 0x78/x +30809 _string_4a_decrement_edx: # (payload array byte) +30810 0x11/imm32/alloc-id:fake:payload +30811 # "4a/decrement-edx" +30812 0x10/imm32/size +30813 0x34/4 0x61/a 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x64/d 0x78/x +30814 _string_4b_decrement_ebx: # (payload array byte) +30815 0x11/imm32/alloc-id:fake:payload +30816 # "4b/decrement-ebx" +30817 0x10/imm32/size +30818 0x34/4 0x62/b 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x62/b 0x78/x +30819 _string_4e_decrement_esi: # (payload array byte) +30820 0x11/imm32/alloc-id:fake:payload +30821 # "4e/decrement-esi" +30822 0x10/imm32/size +30823 0x34/4 0x65/e 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x73/s 0x69/i +30824 _string_4f_decrement_edi: # (payload array byte) +30825 0x11/imm32/alloc-id:fake:payload +30826 # "4f/decrement-edi" +30827 0x10/imm32/size +30828 0x34/4 0x66/f 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t 0x2d/dash 0x65/e 0x64/d 0x69/i +30829 _string_81_subop_add: # (payload array byte) +30830 0x11/imm32/alloc-id:fake:payload +30831 # "81 0/subop/add" +30832 0xe/imm32/size +30833 0x38/8 0x31/1 0x20/space 0x30/0 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x61/a 0x64/d 0x64/d +30834 _string_81_subop_or: # (payload array byte) +30835 0x11/imm32/alloc-id:fake:payload +30836 # "81 1/subop/or" +30837 0xd/imm32/size +30838 0x38/8 0x31/1 0x20/space 0x31/1 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x6f/o 0x72/r +30839 _string_81_subop_and: # (payload array byte) +30840 0x11/imm32/alloc-id:fake:payload +30841 # "81 4/subop/and" +30842 0xe/imm32/size +30843 0x38/8 0x31/1 0x20/space 0x34/4 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x61/a 0x6e/n 0x64/d +30844 _string_81_subop_subtract: # (payload array byte) +30845 0x11/imm32/alloc-id:fake:payload +30846 # "81 5/subop/subtract" +30847 0x13/imm32/size +30848 0x38/8 0x31/1 0x20/space 0x35/5 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x73/s 0x75/u 0x62/b 0x74/t 0x72/r 0x61/a 0x63/c 0x74/t +30849 _string_81_subop_xor: # (payload array byte) +30850 0x11/imm32/alloc-id:fake:payload +30851 # "81 6/subop/xor" +30852 0xe/imm32/size +30853 0x38/8 0x31/1 0x20/space 0x36/6 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x78/x 0x6f/o 0x72/r +30854 _string_81_subop_compare: # (payload array byte) +30855 0x11/imm32/alloc-id:fake:payload +30856 # "81 7/subop/compare" +30857 0x12/imm32/size +30858 0x38/8 0x31/1 0x20/space 0x37/7 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x63/c 0x6f/o 0x6d/m 0x70/p 0x61/a 0x72/r 0x65/e +30859 _string_89_<-: # (payload array byte) +30860 0x11/imm32/alloc-id:fake:payload +30861 # "89/<-" +30862 0x5/imm32/size +30863 0x38/8 0x39/9 0x2f/slash 0x3c/< 0x2d/dash +30864 _string_8b_->: # (payload array byte) +30865 0x11/imm32/alloc-id:fake:payload +30866 # "8b/->" +30867 0x5/imm32/size +30868 0x38/8 0x62/b 0x2f/slash 0x2d/dash 0x3e/> +30869 _string_8a_copy_byte: +30870 0x11/imm32/alloc-id:fake:payload +30871 # "8a/byte->" +30872 0x9/imm32/size +30873 0x38/8 0x61/a 0x2f// 0x62/b 0x79/y 0x74/t 0x65/e 0x2d/- 0x3e/> +30874 _string_88_copy_byte: +30875 0x11/imm32/alloc-id:fake:payload +30876 # "88/byte<-" +30877 0x9/imm32/size +30878 0x38/8 0x38/8 0x2f// 0x62/b 0x79/y 0x74/t 0x65/e 0x3c/< 0x2d/- +30879 _string_8d_copy_address: # (payload array byte) +30880 0x11/imm32/alloc-id:fake:payload +30881 # "8d/copy-address" +30882 0xf/imm32/size +30883 0x38/8 0x64/d 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x61/a 0x64/d 0x64/d 0x72/r 0x65/e 0x73/s 0x73/s +30884 _string_b8_copy_to_eax: # (payload array byte) +30885 0x11/imm32/alloc-id:fake:payload +30886 # "b8/copy-to-eax" +30887 0xe/imm32/size +30888 0x62/b 0x38/8 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x65/e 0x61/a 0x78/x +30889 _string_b9_copy_to_ecx: # (payload array byte) +30890 0x11/imm32/alloc-id:fake:payload +30891 # "b9/copy-to-ecx" +30892 0xe/imm32/size +30893 0x62/b 0x39/9 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x65/e 0x63/c 0x78/x +30894 _string_ba_copy_to_edx: # (payload array byte) +30895 0x11/imm32/alloc-id:fake:payload +30896 # "ba/copy-to-edx" +30897 0xe/imm32/size +30898 0x62/b 0x61/a 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x65/e 0x64/d 0x78/x +30899 _string_bb_copy_to_ebx: # (payload array byte) +30900 0x11/imm32/alloc-id:fake:payload +30901 # "bb/copy-to-ebx" +30902 0xe/imm32/size +30903 0x62/b 0x62/b 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x65/e 0x62/b 0x78/x +30904 _string_be_copy_to_esi: # (payload array byte) +30905 0x11/imm32/alloc-id:fake:payload +30906 # "be/copy-to-esi" +30907 0xe/imm32/size +30908 0x62/b 0x65/e 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x65/e 0x73/s 0x69/i +30909 _string_bf_copy_to_edi: # (payload array byte) +30910 0x11/imm32/alloc-id:fake:payload +30911 # "bf/copy-to-edi" +30912 0xe/imm32/size +30913 0x62/b 0x66/f 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x65/e 0x64/d 0x69/i +30914 _string_c7_subop_copy: # (payload array byte) +30915 0x11/imm32/alloc-id:fake:payload +30916 # "c7 0/subop/copy" +30917 0xf/imm32/size +30918 0x63/c 0x37/7 0x20/space 0x30/0 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x63/c 0x6f/o 0x70/p 0x79/y +30919 _string_e9_jump_label: # (payload array byte) +30920 0x11/imm32/alloc-id:fake:payload +30921 # "e9/jump" +30922 0x7/imm32/size +30923 0x65/e 0x39/9 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p +30924 _string_e9_jump_break: # (payload array byte) +30925 0x11/imm32/alloc-id:fake:payload +30926 # "e9/jump break/disp32" +30927 0x14/imm32/size +30928 0x65/e 0x39/9 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x20/space 0x62/b 0x72/r 0x65/e 0x61/a 0x6b/k 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30929 _string_e9_jump_loop: # (payload array byte) +30930 0x11/imm32/alloc-id:fake:payload +30931 # "e9/jump loop/disp32" +30932 0x13/imm32/size +30933 0x65/e 0x39/9 0x2f/slash 0x6a/j 0x75/u 0x6d/m 0x70/p 0x20/space 0x6c/l 0x6f/o 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x69/i 0x73/s 0x70/p 0x33/3 0x32/2 +30934 _string_f7_subop_negate: +30935 0x11/imm32/alloc-id:fake:payload +30936 # "f7 3/subop/negate" +30937 0x11/imm32/size +30938 0x66/f 0x37/7 0x20/space 0x33/3 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x6e/n 0x65/e 0x67/g 0x61/a 0x74/t 0x65/e +30939 _string_ff_subop_increment: # (payload array byte) +30940 0x11/imm32/alloc-id:fake:payload +30941 # "ff 0/subop/increment" +30942 0x14/imm32/size +30943 0x66/f 0x66/f 0x20/space 0x30/0 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x69/i 0x6e/n 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t +30944 _string_ff_subop_decrement: # (payload array byte) +30945 0x11/imm32/alloc-id:fake:payload +30946 # "ff 1/subop/decrement" +30947 0x14/imm32/size +30948 0x66/f 0x66/f 0x20/space 0x31/1 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t +30949 _string_c1_subop_shift_left: # (payload array byte) +30950 0x11/imm32/alloc-id:fake:payload +30951 # "c1/shift 4/subop/left" +30952 0x15/imm32/size +30953 0x63/c 0x31/1 0x2f/slash 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x20/space 0x34/4 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x6c/l 0x65/e 0x66/f 0x74/t +30954 _string_c1_subop_shift_right_padding_zeroes: # (payload array byte) +30955 0x11/imm32/alloc-id:fake:payload +30956 # "c1/shift 5/subop/right-padding-zeroes" +30957 0x25/imm32/size +30958 0x63/c 0x31/1 0x2f/slash 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x20/space 0x35/5 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x72/r 0x69/i 0x67/g 0x68/h 0x74/t 0x2d/dash 0x70/p 0x61/a 0x64/d 0x64/d 0x69/i 0x6e/n 0x67/g 0x2d/dash 0x7a/z 0x65/e 0x72/r 0x6f/o 0x65/e 0x73/s +30959 _string_c1_subop_shift_right_preserving_sign: # (payload array byte) +30960 0x11/imm32/alloc-id:fake:payload +30961 # "c1/shift 7/subop/right-preserving-sign" +30962 0x26/imm32/size +30963 0x63/c 0x31/1 0x2f/slash 0x73/s 0x68/h 0x69/i 0x66/f 0x74/t 0x20/space 0x37/7 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x72/r 0x69/i 0x67/g 0x68/h 0x74/t 0x2d/dash 0x70/p 0x72/r 0x65/e 0x73/s 0x65/e 0x72/r 0x76/v 0x69/i 0x6e/n 0x67/g 0x2d/dash 0x73/s 0x69/i 0x67/g 0x6e/n +30964 +30965 Single-int-var-in-mem: # (payload list var) +30966 0x11/imm32/alloc-id:fake:payload +30967 0x11/imm32/alloc-id:fake +30968 Int-var-in-mem/imm32 +30969 0/imm32/next +30970 0/imm32/next +30971 +30972 Int-var-in-mem: # (payload var) +30973 0x11/imm32/alloc-id:fake:payload +30974 0/imm32/name +30975 0/imm32/name +30976 0x11/imm32/alloc-id:fake +30977 Type-int/imm32 +30978 1/imm32/some-block-depth +30979 1/imm32/some-stack-offset +30980 0/imm32/no-register +30981 0/imm32/no-register +30982 +30983 # Not really legal, but closest we can currently represent a dereference of an (addr byte) +30984 Single-byte-var-in-mem: # (payload list var) +30985 0x11/imm32/alloc-id:fake:payload +30986 0x11/imm32/alloc-id:fake +30987 Byte-var-in-mem/imm32 +30988 0/imm32/next +30989 0/imm32/next +30990 +30991 # Not really legal, but closest we can currently represent a dereference of an (addr byte) +30992 Byte-var-in-mem: # (payload var) +30993 0x11/imm32/alloc-id:fake:payload +30994 0/imm32/name +30995 0/imm32/name +30996 0x11/imm32/alloc-id:fake +30997 Type-byte/imm32 +30998 1/imm32/some-block-depth +30999 1/imm32/some-stack-offset +31000 0/imm32/no-register +31001 0/imm32/no-register +31002 +31003 Two-args-int-stack-int-reg: # (payload list var) +31004 0x11/imm32/alloc-id:fake:payload +31005 0x11/imm32/alloc-id:fake +31006 Int-var-in-mem/imm32 +31007 0x11/imm32/alloc-id:fake +31008 Single-int-var-in-some-register/imm32/next +31009 +31010 Two-int-args-in-regs: # (payload list var) +31011 0x11/imm32/alloc-id:fake:payload +31012 0x11/imm32/alloc-id:fake +31013 Int-var-in-some-register/imm32 +31014 0x11/imm32/alloc-id:fake +31015 Single-int-var-in-some-register/imm32/next +31016 +31017 # Not really legal, but closest we can currently represent a dereference of an (addr byte) +31018 Two-args-byte-stack-byte-reg: # (payload list var) +31019 0x11/imm32/alloc-id:fake:payload +31020 0x11/imm32/alloc-id:fake +31021 Byte-var-in-mem/imm32 +31022 0x11/imm32/alloc-id:fake +31023 Single-byte-var-in-some-register/imm32/next +31024 +31025 Two-args-int-reg-int-stack: # (payload list var) +31026 0x11/imm32/alloc-id:fake:payload +31027 0x11/imm32/alloc-id:fake +31028 Int-var-in-some-register/imm32 +31029 0x11/imm32/alloc-id:fake +31030 Single-int-var-in-mem/imm32/next +31031 +31032 Two-args-int-eax-int-literal: # (payload list var) +31033 0x11/imm32/alloc-id:fake:payload +31034 0x11/imm32/alloc-id:fake +31035 Int-var-in-eax/imm32 +31036 0x11/imm32/alloc-id:fake +31037 Single-lit-var/imm32/next +31038 +31039 Int-var-and-literal: # (payload list var) +31040 0x11/imm32/alloc-id:fake:payload +31041 0x11/imm32/alloc-id:fake +31042 Int-var-in-mem/imm32 +31043 0x11/imm32/alloc-id:fake +31044 Single-lit-var/imm32/next +31045 +31046 Int-var-in-register-and-literal: # (payload list var) +31047 0x11/imm32/alloc-id:fake:payload +31048 0x11/imm32/alloc-id:fake +31049 Int-var-in-some-register/imm32 +31050 0x11/imm32/alloc-id:fake +31051 Single-lit-var/imm32/next +31052 +31053 Two-float-args-in-regs: # (payload list var) +31054 0x11/imm32/alloc-id:fake:payload +31055 0x11/imm32/alloc-id:fake +31056 Float-var-in-some-register/imm32 +31057 0x11/imm32/alloc-id:fake +31058 Single-float-var-in-some-register/imm32/next +31059 +31060 Two-args-float-reg-float-stack: # (payload list var) +31061 0x11/imm32/alloc-id:fake:payload +31062 0x11/imm32/alloc-id:fake +31063 Float-var-in-some-register/imm32 +31064 0x11/imm32/alloc-id:fake +31065 Single-float-var-in-mem/imm32/next +31066 +31067 Two-args-float-stack-float-reg: # (payload list var) +31068 0x11/imm32/alloc-id:fake:payload +31069 0x11/imm32/alloc-id:fake +31070 Float-var-in-mem/imm32 +31071 0x11/imm32/alloc-id:fake +31072 Single-float-var-in-some-register/imm32/next +31073 +31074 Single-int-var-in-some-register: # (payload list var) +31075 0x11/imm32/alloc-id:fake:payload +31076 0x11/imm32/alloc-id:fake +31077 Int-var-in-some-register/imm32 +31078 0/imm32/next +31079 0/imm32/next +31080 +31081 Single-addr-var-in-some-register: # (payload list var) +31082 0x11/imm32/alloc-id:fake:payload +31083 0x11/imm32/alloc-id:fake +31084 Addr-var-in-some-register/imm32 +31085 0/imm32/next +31086 0/imm32/next +31087 +31088 Single-byte-var-in-some-register: # (payload list var) +31089 0x11/imm32/alloc-id:fake:payload +31090 0x11/imm32/alloc-id:fake +31091 Byte-var-in-some-register/imm32 +31092 0/imm32/next +31093 0/imm32/next +31094 +31095 Int-var-in-some-register: # (payload var) +31096 0x11/imm32/alloc-id:fake:payload +31097 0/imm32/name +31098 0/imm32/name +31099 0x11/imm32/alloc-id:fake +31100 Type-int/imm32 +31101 1/imm32/some-block-depth +31102 0/imm32/no-stack-offset +31103 0x11/imm32/alloc-id:fake +31104 Any-register/imm32 31105 -31106 emit-subx-var-as-rm32: # out: (addr buffered-file), s: (addr stmt-var) -31107 # . prologue -31108 55/push-ebp -31109 89/<- %ebp 4/r32/esp -31110 # . save registers -31111 50/push-eax -31112 51/push-ecx -31113 56/push-esi -31114 # ecx = s -31115 8b/-> *(ebp+0xc) 1/r32/ecx -31116 # var operand/esi: (addr var) = lookup(s->value) -31117 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -31118 89/<- %esi 0/r32/eax -31119 # if (operand->register && s->is-deref?) emit "*__" -31120 { -31121 $emit-subx-var-as-rm32:check-for-register-indirect: -31122 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -31123 74/jump-if-= break/disp8 -31124 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -31125 74/jump-if-= break/disp8 -31126 $emit-subx-var-as-rm32:register-indirect: -31127 (write-buffered *(ebp+8) " *") -31128 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -31129 (write-buffered *(ebp+8) %eax) -31130 e9/jump $emit-subx-var-as-rm32:end/disp32 -31131 } -31132 # if (operand->register && !s->is-deref?) emit "%__" -31133 { -31134 $emit-subx-var-as-rm32:check-for-register-direct: -31135 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -31136 74/jump-if-= break/disp8 -31137 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -31138 75/jump-if-!= break/disp8 -31139 $emit-subx-var-as-rm32:register-direct: -31140 (write-buffered *(ebp+8) " %") -31141 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -31142 (write-buffered *(ebp+8) %eax) -31143 e9/jump $emit-subx-var-as-rm32:end/disp32 -31144 } -31145 # else if (operand->stack-offset) emit "*(ebp+__)" -31146 { -31147 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset -31148 74/jump-if-= break/disp8 -31149 $emit-subx-var-as-rm32:stack: -31150 (write-buffered *(ebp+8) Space) -31151 (write-buffered *(ebp+8) "*(ebp+") -31152 (write-int32-hex-buffered *(ebp+8) *(esi+0x14)) # Var-offset -31153 (write-buffered *(ebp+8) ")") -31154 } -31155 $emit-subx-var-as-rm32:end: -31156 # . restore registers -31157 5e/pop-to-esi -31158 59/pop-to-ecx -31159 58/pop-to-eax -31160 # . epilogue -31161 89/<- %esp 5/r32/ebp -31162 5d/pop-to-ebp -31163 c3/return -31164 -31165 find-matching-primitive: # primitives: (addr primitive), stmt: (addr stmt) -> result/eax: (addr primitive) -31166 # . prologue -31167 55/push-ebp -31168 89/<- %ebp 4/r32/esp -31169 # . save registers -31170 51/push-ecx -31171 # var curr/ecx: (addr primitive) = primitives -31172 8b/-> *(ebp+8) 1/r32/ecx -31173 { -31174 $find-matching-primitive:loop: -31175 # if (curr == null) break -31176 81 7/subop/compare %ecx 0/imm32 -31177 74/jump-if-= break/disp8 -31178 # if match(curr, stmt) return curr -31179 { -31180 (mu-stmt-matches-primitive? *(ebp+0xc) %ecx) # => eax -31181 3d/compare-eax-and 0/imm32/false -31182 74/jump-if-= break/disp8 -31183 89/<- %eax 1/r32/ecx -31184 eb/jump $find-matching-primitive:end/disp8 -31185 } -31186 $find-matching-primitive:next-primitive: -31187 # curr = curr->next -31188 (lookup *(ecx+0x3c) *(ecx+0x40)) # Primitive-next Primitive-next => eax -31189 89/<- %ecx 0/r32/eax -31190 # -31191 e9/jump loop/disp32 -31192 } -31193 # return null -31194 b8/copy-to-eax 0/imm32 -31195 $find-matching-primitive:end: -31196 # . restore registers -31197 59/pop-to-ecx -31198 # . epilogue -31199 89/<- %esp 5/r32/ebp -31200 5d/pop-to-ebp -31201 c3/return -31202 -31203 mu-stmt-matches-primitive?: # stmt: (addr stmt), primitive: (addr primitive) -> result/eax: boolean -31204 # A mu stmt matches a primitive if the name matches, all the inout vars -31205 # match, and all the output vars match. -31206 # Vars match if types match and registers match. -31207 # In addition, a stmt output matches a primitive's output if types match -31208 # and the primitive has a wildcard register. -31209 # . prologue -31210 55/push-ebp -31211 89/<- %ebp 4/r32/esp -31212 # . save registers -31213 51/push-ecx -31214 52/push-edx -31215 53/push-ebx -31216 56/push-esi -31217 57/push-edi -31218 # ecx = stmt -31219 8b/-> *(ebp+8) 1/r32/ecx -31220 # edx = primitive -31221 8b/-> *(ebp+0xc) 2/r32/edx -31222 { -31223 $mu-stmt-matches-primitive?:check-name: -31224 # if (primitive->name != stmt->operation) return false -31225 # . var esi: (addr array byte) = lookup(stmt->operation) -31226 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax -31227 89/<- %esi 0/r32/eax -31228 # . var edi: (addr array byte) = lookup(primitive->name) -31229 (lookup *edx *(edx+4)) # Primitive-name Primitive-name => eax -31230 #? (write-buffered Stderr %eax) -31231 #? (write-buffered Stderr Newline) -31232 #? (flush Stderr) -31233 89/<- %edi 0/r32/eax -31234 (string-equal? %esi %edi) # => eax -31235 3d/compare-eax-and 0/imm32/false -31236 75/jump-if-!= break/disp8 -31237 b8/copy-to-eax 0/imm32 -31238 e9/jump $mu-stmt-matches-primitive?:end/disp32 -31239 } -31240 # var curr/esi: (addr stmt-var) = lookup(stmt->inouts) -31241 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax -31242 89/<- %esi 0/r32/eax -31243 # var curr2/edi: (addr list var) = lookup(primitive->inouts) -31244 (lookup *(edx+8) *(edx+0xc)) # Primitive-inouts Primitive-inouts => eax -31245 89/<- %edi 0/r32/eax -31246 { -31247 $mu-stmt-matches-primitive?:inouts-loop: -31248 # if (curr == 0 && curr2 == 0) move on to check outputs -31249 { -31250 $mu-stmt-matches-primitive?:check-both-inouts-null: -31251 81 7/subop/compare %esi 0/imm32 -31252 75/jump-if-!= break/disp8 -31253 $mu-stmt-matches-primitive?:stmt-inout-null: -31254 81 7/subop/compare %edi 0/imm32 -31255 0f 84/jump-if-= $mu-stmt-matches-primitive?:check-outputs/disp32 -31256 $mu-stmt-matches-primitive?:stmt-inout-null-and-prim-inout-not-null: -31257 # return false -31258 b8/copy-to-eax 0/imm32/false -31259 e9/jump $mu-stmt-matches-primitive?:end/disp32 -31260 } -31261 # if (curr2 == 0) return false -31262 { -31263 $mu-stmt-matches-primitive?:check-prim-inout-null: -31264 81 7/subop/compare %edi 0/imm32 -31265 75/jump-if-!= break/disp8 -31266 $mu-stmt-matches-primitive?:prim-inout-null: -31267 b8/copy-to-eax 0/imm32/false -31268 e9/jump $mu-stmt-matches-primitive?:end/disp32 -31269 } -31270 # if (curr != curr2) return false -31271 { -31272 $mu-stmt-matches-primitive?:check-inouts-match: -31273 (lookup *edi *(edi+4)) # List-value List-value => eax -31274 (operand-matches-primitive? %esi %eax) # => eax -31275 3d/compare-eax-and 0/imm32/false -31276 75/jump-if-!= break/disp8 -31277 $mu-stmt-matches-primitive?:inouts-match: -31278 b8/copy-to-eax 0/imm32/false -31279 e9/jump $mu-stmt-matches-primitive?:end/disp32 -31280 } -31281 $mu-stmt-matches-primitive?:next-inout: -31282 # curr = lookup(curr->next) -31283 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -31284 89/<- %esi 0/r32/eax -31285 # curr2 = lookup(curr2->next) -31286 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax -31287 89/<- %edi 0/r32/eax -31288 # -31289 e9/jump loop/disp32 -31290 } -31291 $mu-stmt-matches-primitive?:check-outputs: -31292 # var curr/esi: (addr stmt-var) = lookup(stmt->outputs) -31293 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax -31294 89/<- %esi 0/r32/eax -31295 # var curr2/edi: (addr list var) = lookup(primitive->outputs) -31296 (lookup *(edx+0x10) *(edx+0x14)) # Primitive-outputs Primitive-outputs => eax -31297 89/<- %edi 0/r32/eax -31298 { -31299 $mu-stmt-matches-primitive?:outputs-loop: -31300 # if (curr == 0) return (curr2 == 0) -31301 { -31302 $mu-stmt-matches-primitive?:check-both-outputs-null: -31303 81 7/subop/compare %esi 0/imm32 -31304 75/jump-if-!= break/disp8 -31305 { -31306 $mu-stmt-matches-primitive?:stmt-output-null: -31307 81 7/subop/compare %edi 0/imm32 -31308 75/jump-if-!= break/disp8 -31309 $mu-stmt-matches-primitive?:both-outputs-null: -31310 # return true -31311 b8/copy-to-eax 1/imm32 -31312 e9/jump $mu-stmt-matches-primitive?:end/disp32 -31313 } -31314 $mu-stmt-matches-primitive?:stmt-output-null-and-prim-output-not-null: -31315 # return false -31316 b8/copy-to-eax 0/imm32 -31317 e9/jump $mu-stmt-matches-primitive?:end/disp32 -31318 } -31319 # if (curr2 == 0) return false -31320 { -31321 $mu-stmt-matches-primitive?:check-prim-output-null: -31322 81 7/subop/compare %edi 0/imm32 -31323 75/jump-if-!= break/disp8 -31324 $mu-stmt-matches-primitive?:prim-output-is-null: -31325 b8/copy-to-eax 0/imm32 -31326 e9/jump $mu-stmt-matches-primitive?:end/disp32 -31327 } -31328 # if (curr != curr2) return false -31329 { -31330 $mu-stmt-matches-primitive?:check-outputs-match: -31331 (lookup *edi *(edi+4)) # List-value List-value => eax -31332 (operand-matches-primitive? %esi %eax) # => eax -31333 3d/compare-eax-and 0/imm32/false -31334 75/jump-if-!= break/disp8 -31335 $mu-stmt-matches-primitive?:outputs-match: -31336 b8/copy-to-eax 0/imm32 -31337 e9/jump $mu-stmt-matches-primitive?:end/disp32 -31338 } -31339 $mu-stmt-matches-primitive?:next-output: -31340 # curr = lookup(curr->next) -31341 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax -31342 89/<- %esi 0/r32/eax -31343 # curr2 = lookup(curr2->next) -31344 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax -31345 89/<- %edi 0/r32/eax -31346 # -31347 e9/jump loop/disp32 -31348 } -31349 $mu-stmt-matches-primitive?:return-true: -31350 b8/copy-to-eax 1/imm32 -31351 $mu-stmt-matches-primitive?:end: -31352 # . restore registers -31353 5f/pop-to-edi -31354 5e/pop-to-esi -31355 5b/pop-to-ebx -31356 5a/pop-to-edx -31357 59/pop-to-ecx -31358 # . epilogue -31359 89/<- %esp 5/r32/ebp -31360 5d/pop-to-ebp -31361 c3/return -31362 -31363 operand-matches-primitive?: # s: (addr stmt-var), prim-var: (addr var) -> result/eax: boolean -31364 # . prologue -31365 55/push-ebp -31366 89/<- %ebp 4/r32/esp -31367 # . save registers -31368 51/push-ecx -31369 52/push-edx -31370 53/push-ebx -31371 56/push-esi -31372 57/push-edi -31373 # ecx = s -31374 8b/-> *(ebp+8) 1/r32/ecx -31375 # var var/esi: (addr var) = lookup(s->value) -31376 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax -31377 89/<- %esi 0/r32/eax -31378 # edi = prim-var -31379 8b/-> *(ebp+0xc) 7/r32/edi -31380 $operand-matches-primitive?:check-type: -31381 # if !category-match?(var->type, prim-var->type) return false -31382 # . var vtype/ebx: (addr type-tree) = lookup(var->type) -31383 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax -31384 89/<- %ebx 0/r32/eax -31385 # . if s is deref, vtype = vtype->right -31386 { -31387 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -31388 74/jump-if-= break/disp8 -31389 $operand-matches-primitive?:is-deref: -31390 # . var t/eax: (addr type) -31391 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax -31392 # . if !t->is-atom? t = t->left -31393 81 7/subop/compare *eax 0/imm32/false -31394 { -31395 75/jump-if-!= break/disp8 -31396 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -31397 } -31398 # . -31399 89/<- %ebx 0/r32/eax -31400 } -31401 # . var ptype/eax: (addr type-tree) = lookup(prim-var->type) -31402 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax -31403 (subx-type-category-match? %ebx %eax) # => eax -31404 3d/compare-eax-and 0/imm32/false -31405 0f 84/jump-if-= $operand-matches-primitive?:return-false/disp32 -31406 { -31407 $operand-matches-primitive?:check-register: -31408 # if prim-var is in memory and var is in register but dereference, match -31409 { -31410 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register -31411 0f 85/jump-if-!= break/disp32 -31412 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -31413 74/jump-if-= break/disp8 -31414 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -31415 74/jump-if-= break/disp8 -31416 $operand-matches-primitive?:var-deref-match: -31417 e9/jump $operand-matches-primitive?:return-true/disp32 -31418 } -31419 # if prim-var is in register and var is in register but dereference, no match -31420 { -31421 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register -31422 0f 84/jump-if-= break/disp32 -31423 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register -31424 0f 84/jump-if-= break/disp32 -31425 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref -31426 74/jump-if-= break/disp8 -31427 $operand-matches-primitive?:var-deref-no-match: -31428 e9/jump $operand-matches-primitive?:return-false/disp32 -31429 } -31430 # return false if var->register doesn't match prim-var->register -31431 { -31432 # if register addresses are equal, it's a match -31433 # var vreg/ebx: (addr array byte) = lookup(var->register) -31434 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax -31435 89/<- %ebx 0/r32/eax -31436 # var preg/ecx: (addr array byte) = lookup(prim-var->register) -31437 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax -31438 89/<- %ecx 0/r32/eax -31439 # if (vreg == preg) break -31440 39/compare %ecx 3/r32/ebx -31441 74/jump-if-= break/disp8 -31442 $operand-matches-primitive?:var-register-no-match: -31443 # if either address is 0, return false -31444 81 7/subop/compare %ebx 0/imm32 -31445 74/jump-if-= $operand-matches-primitive?:return-false/disp8 -31446 81 7/subop/compare %ecx 0/imm32 -31447 74/jump-if-= $operand-matches-primitive?:return-false/disp8 -31448 # if prim-var->register is wildcard, it's a match -31449 (string-equal? %ecx "*") # Any-register => eax -31450 3d/compare-eax-and 0/imm32/false -31451 75/jump-if-!= break/disp8 -31452 $operand-matches-primitive?:wildcard-no-match: -31453 # if string contents aren't equal, return false -31454 (string-equal? %ecx %ebx) # => eax -31455 3d/compare-eax-and 0/imm32/false -31456 74/jump-if-= $operand-matches-primitive?:return-false/disp8 -31457 } -31458 } -31459 $operand-matches-primitive?:return-true: -31460 b8/copy-to-eax 1/imm32/true -31461 eb/jump $operand-matches-primitive?:end/disp8 -31462 $operand-matches-primitive?:return-false: -31463 b8/copy-to-eax 0/imm32/false -31464 $operand-matches-primitive?:end: -31465 # . restore registers -31466 5f/pop-to-edi -31467 5e/pop-to-esi -31468 5b/pop-to-ebx -31469 5a/pop-to-edx -31470 59/pop-to-ecx -31471 # . epilogue -31472 89/<- %esp 5/r32/ebp -31473 5d/pop-to-ebp -31474 c3/return -31475 -31476 find-matching-function: # functions: (addr function), stmt: (addr stmt) -> result/eax: (addr function) -31477 # . prologue -31478 55/push-ebp -31479 89/<- %ebp 4/r32/esp -31480 # . save registers -31481 51/push-ecx -31482 # var curr/ecx: (handle function) = functions -31483 8b/-> *(ebp+8) 1/r32/ecx -31484 { -31485 # if (curr == null) break -31486 81 7/subop/compare %ecx 0/imm32 -31487 74/jump-if-= break/disp8 -31488 #? (write-buffered Stderr "iter\n") -31489 #? (flush Stderr) -31490 # if match(stmt, curr) return curr -31491 { -31492 (mu-stmt-matches-function? *(ebp+0xc) %ecx) # => eax -31493 3d/compare-eax-and 0/imm32/false -31494 74/jump-if-= break/disp8 -31495 89/<- %eax 1/r32/ecx -31496 eb/jump $find-matching-function:end/disp8 -31497 } -31498 # curr = curr->next -31499 (lookup *(ecx+0x20) *(ecx+0x24)) # Function-next Function-next => eax -31500 89/<- %ecx 0/r32/eax -31501 # -31502 eb/jump loop/disp8 -31503 } -31504 # return null -31505 b8/copy-to-eax 0/imm32 -31506 $find-matching-function:end: -31507 # . restore registers -31508 59/pop-to-ecx -31509 # . epilogue -31510 89/<- %esp 5/r32/ebp -31511 5d/pop-to-ebp -31512 c3/return -31513 -31514 # Just compare names; user-defined functions don't support overloading yet. -31515 mu-stmt-matches-function?: # stmt: (addr stmt1), function: (addr function) -> result/eax: boolean -31516 # . prologue -31517 55/push-ebp -31518 89/<- %ebp 4/r32/esp -31519 # . save registers -31520 51/push-ecx -31521 # return function->name == stmt->operation -31522 # ecx = lookup(stmt->operation) -31523 8b/-> *(ebp+8) 0/r32/eax -31524 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax -31525 89/<- %ecx 0/r32/eax -31526 # eax = lookup(function->name) -31527 8b/-> *(ebp+0xc) 0/r32/eax -31528 (lookup *eax *(eax+4)) # Function-name Function-name => eax -31529 (string-equal? %eax %ecx) # => eax -31530 $mu-stmt-matches-function?:end: -31531 # . restore registers -31532 59/pop-to-ecx -31533 # . epilogue -31534 89/<- %esp 5/r32/ebp -31535 5d/pop-to-ebp -31536 c3/return -31537 -31538 # Type-checking happens elsewhere. This method is for selecting between -31539 # primitives. -31540 subx-type-category-match?: # a: (addr type-tree), b: (addr type-tree) -> result/eax: boolean -31541 # . prologue -31542 55/push-ebp -31543 89/<- %ebp 4/r32/esp -31544 # . save registers -31545 51/push-ecx -31546 # var cata/ecx: int = type-category(a) -31547 (type-category *(ebp+8)) # => eax -31548 89/<- %ecx 0/r32/eax -31549 # var catb/eax: int = type-category(b) -31550 (type-category *(ebp+0xc)) # => eax -31551 # return cata == catb -31552 39/compare %eax 1/r32/ecx -31553 0f 94/set-byte-if-= %al -31554 81 4/subop/and %eax 0xff/imm32 -31555 $subx-type-category-match?:end: -31556 # . restore registers -31557 59/pop-to-ecx -31558 # . epilogue -31559 89/<- %esp 5/r32/ebp -31560 5d/pop-to-ebp -31561 c3/return -31562 -31563 type-category: # a: (addr type-tree) -> result/eax: int -31564 # . prologue -31565 55/push-ebp -31566 89/<- %ebp 4/r32/esp -31567 # . save registers +31106 Any-register: # (payload array byte) +31107 0x11/imm32/alloc-id:fake:payload +31108 1/imm32/size +31109 # data +31110 2a/asterisk +31111 +31112 Addr-var-in-some-register: # (payload var) +31113 0x11/imm32/alloc-id:fake:payload +31114 0/imm32/name +31115 0/imm32/name +31116 0x11/imm32/alloc-id:fake +31117 Type-addr/imm32 +31118 1/imm32/some-block-depth +31119 0/imm32/no-stack-offset +31120 0x11/imm32/alloc-id:fake +31121 Any-register/imm32 +31122 +31123 Byte-var-in-some-register: # (payload var) +31124 0x11/imm32/alloc-id:fake:payload +31125 0/imm32/name +31126 0/imm32/name +31127 0x11/imm32/alloc-id:fake +31128 Type-byte/imm32 +31129 1/imm32/some-block-depth +31130 0/imm32/no-stack-offset +31131 0x11/imm32/alloc-id:fake +31132 Any-register/imm32 +31133 +31134 Single-int-var-in-eax: # (payload list var) +31135 0x11/imm32/alloc-id:fake:payload +31136 0x11/imm32/alloc-id:fake +31137 Int-var-in-eax/imm32 +31138 0/imm32/next +31139 0/imm32/next +31140 +31141 Int-var-in-eax: +31142 0x11/imm32/alloc-id:fake:payload +31143 0/imm32/name +31144 0/imm32/name +31145 0x11/imm32/alloc-id:fake +31146 Type-int/imm32 +31147 1/imm32/some-block-depth +31148 0/imm32/no-stack-offset +31149 0x11/imm32/alloc-id:fake +31150 $Mu-register-eax/imm32 # can't use Register-eax only to keep our buggy tools/treeshake.cc happy (TODO) +31151 +31152 Single-int-var-in-ecx: # (payload list var) +31153 0x11/imm32/alloc-id:fake:payload +31154 0x11/imm32/alloc-id:fake +31155 Int-var-in-ecx/imm32 +31156 0/imm32/next +31157 0/imm32/next +31158 +31159 Int-var-in-ecx: +31160 0x11/imm32/alloc-id:fake:payload +31161 0/imm32/name +31162 0/imm32/name +31163 0x11/imm32/alloc-id:fake +31164 Type-int/imm32 +31165 1/imm32/some-block-depth +31166 0/imm32/no-stack-offset +31167 0x11/imm32/alloc-id:fake +31168 $Register-ecx/imm32/register +31169 +31170 Single-int-var-in-edx: # (payload list var) +31171 0x11/imm32/alloc-id:fake:payload +31172 0x11/imm32/alloc-id:fake +31173 Int-var-in-edx/imm32 +31174 0/imm32/next +31175 0/imm32/next +31176 +31177 Int-var-in-edx: # (payload list var) +31178 0x11/imm32/alloc-id:fake:payload +31179 0/imm32/name +31180 0/imm32/name +31181 0x11/imm32/alloc-id:fake +31182 Type-int/imm32 +31183 1/imm32/some-block-depth +31184 0/imm32/no-stack-offset +31185 0x11/imm32/alloc-id:fake +31186 $Register-edx/imm32/register +31187 +31188 Single-int-var-in-ebx: # (payload list var) +31189 0x11/imm32/alloc-id:fake:payload +31190 0x11/imm32/alloc-id:fake +31191 Int-var-in-ebx/imm32 +31192 0/imm32/next +31193 0/imm32/next +31194 +31195 Int-var-in-ebx: # (payload list var) +31196 0x11/imm32/alloc-id:fake:payload +31197 0/imm32/name +31198 0/imm32/name +31199 0x11/imm32/alloc-id:fake +31200 Type-int/imm32 +31201 1/imm32/some-block-depth +31202 0/imm32/no-stack-offset +31203 0x11/imm32/alloc-id:fake +31204 $Register-ebx/imm32/register +31205 +31206 Single-int-var-in-esi: # (payload list var) +31207 0x11/imm32/alloc-id:fake:payload +31208 0x11/imm32/alloc-id:fake +31209 Int-var-in-esi/imm32 +31210 0/imm32/next +31211 0/imm32/next +31212 +31213 Int-var-in-esi: # (payload list var) +31214 0x11/imm32/alloc-id:fake:payload +31215 0/imm32/name +31216 0/imm32/name +31217 0x11/imm32/alloc-id:fake +31218 Type-int/imm32 +31219 1/imm32/some-block-depth +31220 0/imm32/no-stack-offset +31221 0x11/imm32/alloc-id:fake +31222 $Register-esi/imm32/register +31223 +31224 Single-int-var-in-edi: # (payload list var) +31225 0x11/imm32/alloc-id:fake:payload +31226 0x11/imm32/alloc-id:fake +31227 Int-var-in-edi/imm32 +31228 0/imm32/next +31229 0/imm32/next +31230 +31231 Int-var-in-edi: # (payload list var) +31232 0x11/imm32/alloc-id:fake:payload +31233 0/imm32/name +31234 0/imm32/name +31235 0x11/imm32/alloc-id:fake +31236 Type-int/imm32 +31237 1/imm32/some-block-depth +31238 0/imm32/no-stack-offset +31239 0x11/imm32/alloc-id:fake +31240 $Register-edi/imm32/register +31241 +31242 Single-lit-var: # (payload list var) +31243 0x11/imm32/alloc-id:fake:payload +31244 0x11/imm32/alloc-id:fake +31245 Lit-var/imm32 +31246 0/imm32/next +31247 0/imm32/next +31248 +31249 Lit-var: # (payload var) +31250 0x11/imm32/alloc-id:fake:payload +31251 0/imm32/name +31252 0/imm32/name +31253 0x11/imm32/alloc-id:fake +31254 Type-literal/imm32 +31255 1/imm32/some-block-depth +31256 0/imm32/no-stack-offset +31257 0/imm32/no-register +31258 0/imm32/no-register +31259 +31260 Single-float-var-in-mem: # (payload list var) +31261 0x11/imm32/alloc-id:fake:payload +31262 0x11/imm32/alloc-id:fake +31263 Float-var-in-mem/imm32 +31264 0/imm32/next +31265 0/imm32/next +31266 +31267 Float-var-in-mem: # (payload var) +31268 0x11/imm32/alloc-id:fake:payload +31269 0/imm32/name +31270 0/imm32/name +31271 0x11/imm32/alloc-id:fake +31272 Type-float/imm32 +31273 1/imm32/some-block-depth +31274 1/imm32/some-stack-offset +31275 0/imm32/no-register +31276 0/imm32/no-register +31277 +31278 Single-float-var-in-some-register: # (payload list var) +31279 0x11/imm32/alloc-id:fake:payload +31280 0x11/imm32/alloc-id:fake +31281 Float-var-in-some-register/imm32 +31282 0/imm32/next +31283 0/imm32/next +31284 +31285 Float-var-in-some-register: # (payload var) +31286 0x11/imm32/alloc-id:fake:payload +31287 0/imm32/name +31288 0/imm32/name +31289 0x11/imm32/alloc-id:fake +31290 Type-float/imm32 +31291 1/imm32/some-block-depth +31292 0/imm32/no-stack-offset +31293 0x11/imm32/alloc-id:fake +31294 Any-register/imm32 +31295 +31296 Type-int: # (payload type-tree) +31297 0x11/imm32/alloc-id:fake:payload +31298 1/imm32/is-atom +31299 1/imm32/value:int +31300 0/imm32/left:unused +31301 0/imm32/right:null +31302 0/imm32/right:null +31303 +31304 Type-literal: # (payload type-tree) +31305 0x11/imm32/alloc-id:fake:payload +31306 1/imm32/is-atom +31307 0/imm32/value:literal +31308 0/imm32/left:unused +31309 0/imm32/right:null +31310 0/imm32/right:null +31311 +31312 Type-addr: # (payload type-tree) +31313 0x11/imm32/alloc-id:fake:payload +31314 1/imm32/is-atom +31315 2/imm32/value:addr +31316 0/imm32/left:unused +31317 0/imm32/right:null +31318 0/imm32/right:null +31319 +31320 Type-byte: # (payload type-tree) +31321 0x11/imm32/alloc-id:fake:payload +31322 1/imm32/is-atom +31323 8/imm32/value:byte +31324 0/imm32/left:unused +31325 0/imm32/right:null +31326 0/imm32/right:null +31327 +31328 Type-float: # (payload type-tree) +31329 0x11/imm32/alloc-id:fake:payload +31330 1/imm32/is-atom +31331 0xf/imm32/value:float +31332 0/imm32/left:unused +31333 0/imm32/right:null +31334 0/imm32/right:null +31335 +31336 == code +31337 emit-subx-primitive: # out: (addr buffered-file), stmt: (addr stmt), primitive: (addr primitive), err: (addr buffered-file), ed: (addr exit-descriptor) +31338 # . prologue +31339 55/push-ebp +31340 89/<- %ebp 4/r32/esp +31341 # . save registers +31342 50/push-eax +31343 51/push-ecx +31344 # ecx = primitive +31345 8b/-> *(ebp+0x10) 1/r32/ecx +31346 # emit primitive name +31347 (emit-indent *(ebp+8) *Curr-block-depth) +31348 (lookup *(ecx+0x18) *(ecx+0x1c)) # Primitive-subx-name Primitive-subx-name => eax +31349 (write-buffered *(ebp+8) %eax) +31350 # emit rm32 if necessary +31351 (emit-subx-rm32 *(ebp+8) *(ecx+0x20) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-rm32 +31352 # emit xm32 if necessary +31353 (emit-subx-rm32 *(ebp+8) *(ecx+0x34) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-xm32 +31354 # emit r32 if necessary +31355 (emit-subx-r32 *(ebp+8) *(ecx+0x24) *(ebp+0xc)) # Primitive-subx-r32 +31356 # emit x32 if necessary +31357 (emit-subx-x32 *(ebp+8) *(ecx+0x38) *(ebp+0xc)) # Primitive-subx-x32 +31358 # emit imm32 if necessary +31359 (emit-subx-imm32 *(ebp+8) *(ecx+0x28) *(ebp+0xc)) # Primitive-subx-imm32 +31360 # emit imm8 if necessary +31361 (emit-subx-imm8 *(ebp+8) *(ecx+0x2c) *(ebp+0xc)) # Primitive-subx-imm8 +31362 # emit disp32 if necessary +31363 (emit-subx-disp32 *(ebp+8) *(ecx+0x30) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # Primitive-subx-disp32 +31364 (write-buffered *(ebp+8) Newline) +31365 $emit-subx-primitive:end: +31366 # . restore registers +31367 59/pop-to-ecx +31368 58/pop-to-eax +31369 # . epilogue +31370 89/<- %esp 5/r32/ebp +31371 5d/pop-to-ebp +31372 c3/return +31373 +31374 emit-subx-rm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +31375 # . prologue +31376 55/push-ebp +31377 89/<- %ebp 4/r32/esp +31378 # . save registers +31379 50/push-eax +31380 # if (l == 0) return +31381 81 7/subop/compare *(ebp+0xc) 0/imm32 +31382 74/jump-if-= $emit-subx-rm32:end/disp8 +31383 # var v/eax: (addr stmt-var) +31384 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # => eax +31385 (emit-subx-var-as-rm32 *(ebp+8) %eax) +31386 $emit-subx-rm32:end: +31387 # . restore registers +31388 58/pop-to-eax +31389 # . epilogue +31390 89/<- %esp 5/r32/ebp +31391 5d/pop-to-ebp +31392 c3/return +31393 +31394 get-stmt-operand-from-arg-location: # stmt: (addr stmt), l: arg-location, err: (addr buffered-file), ed: (addr exit-descriptor) -> var/eax: (addr stmt-var) +31395 # . prologue +31396 55/push-ebp +31397 89/<- %ebp 4/r32/esp +31398 # . save registers +31399 51/push-ecx +31400 # eax = l +31401 8b/-> *(ebp+0xc) 0/r32/eax +31402 # ecx = stmt +31403 8b/-> *(ebp+8) 1/r32/ecx +31404 # if (l == 1) return stmt->inouts +31405 { +31406 3d/compare-eax-and 1/imm32 +31407 75/jump-if-!= break/disp8 +31408 $get-stmt-operand-from-arg-location:1: +31409 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +31410 eb/jump $get-stmt-operand-from-arg-location:end/disp8 +31411 } +31412 # if (l == 2) return stmt->inouts->next +31413 { +31414 3d/compare-eax-and 2/imm32 +31415 75/jump-if-!= break/disp8 +31416 $get-stmt-operand-from-arg-location:2: +31417 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +31418 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +31419 eb/jump $get-stmt-operand-from-arg-location:end/disp8 +31420 } +31421 # if (l == 3) return stmt->outputs +31422 { +31423 3d/compare-eax-and 3/imm32 +31424 75/jump-if-!= break/disp8 +31425 $get-stmt-operand-from-arg-location:3: +31426 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +31427 eb/jump $get-stmt-operand-from-arg-location:end/disp8 +31428 } +31429 # abort +31430 e9/jump $get-stmt-operand-from-arg-location:abort/disp32 +31431 $get-stmt-operand-from-arg-location:end: +31432 # . restore registers +31433 59/pop-to-ecx +31434 # . epilogue +31435 89/<- %esp 5/r32/ebp +31436 5d/pop-to-ebp +31437 c3/return +31438 +31439 $get-stmt-operand-from-arg-location:abort: +31440 # error("invalid arg-location " eax) +31441 (write-buffered *(ebp+0x10) "invalid arg-location ") +31442 (write-int32-hex-buffered *(ebp+0x10) %eax) +31443 (write-buffered *(ebp+0x10) Newline) +31444 (flush *(ebp+0x10)) +31445 (stop *(ebp+0x14) 1) +31446 # never gets here +31447 +31448 emit-subx-r32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) +31449 # . prologue +31450 55/push-ebp +31451 89/<- %ebp 4/r32/esp +31452 # . save registers +31453 50/push-eax +31454 51/push-ecx +31455 # if (l == 0) return +31456 81 7/subop/compare *(ebp+0xc) 0/imm32 +31457 0f 84/jump-if-= $emit-subx-r32:end/disp32 +31458 # var v/eax: (addr stmt-var) +31459 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax +31460 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +31461 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +31462 #? (write-buffered Stderr "looking up ") +31463 #? (write-buffered Stderr %eax) +31464 #? (write-buffered Stderr Newline) +31465 #? (flush Stderr) +31466 (maybe-get Mu-registers %eax 0xc) # => eax: (addr register-index) +31467 (write-buffered *(ebp+8) Space) +31468 (write-int32-hex-buffered *(ebp+8) *eax) +31469 (write-buffered *(ebp+8) "/r32") +31470 $emit-subx-r32:end: +31471 # . restore registers +31472 59/pop-to-ecx +31473 58/pop-to-eax +31474 # . epilogue +31475 89/<- %esp 5/r32/ebp +31476 5d/pop-to-ebp +31477 c3/return +31478 +31479 emit-subx-x32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) +31480 # . prologue +31481 55/push-ebp +31482 89/<- %ebp 4/r32/esp +31483 # . save registers +31484 50/push-eax +31485 51/push-ecx +31486 # if (l == 0) return +31487 81 7/subop/compare *(ebp+0xc) 0/imm32 +31488 0f 84/jump-if-= $emit-subx-x32:end/disp32 +31489 # var v/eax: (addr stmt-var) +31490 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax +31491 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +31492 (lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax +31493 #? (write-buffered Stderr "looking up ") +31494 #? (write-buffered Stderr %eax) +31495 #? (write-buffered Stderr Newline) +31496 #? (flush Stderr) +31497 (maybe-get Mu-registers %eax 0xc) # => eax: (addr register-index) +31498 (write-buffered *(ebp+8) Space) +31499 (write-int32-hex-buffered *(ebp+8) *eax) +31500 (write-buffered *(ebp+8) "/x32") +31501 $emit-subx-x32:end: +31502 # . restore registers +31503 59/pop-to-ecx +31504 58/pop-to-eax +31505 # . epilogue +31506 89/<- %esp 5/r32/ebp +31507 5d/pop-to-ebp +31508 c3/return +31509 +31510 emit-subx-imm32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) +31511 # . prologue +31512 55/push-ebp +31513 89/<- %ebp 4/r32/esp +31514 # . save registers +31515 50/push-eax +31516 51/push-ecx +31517 # if (l == 0) return +31518 81 7/subop/compare *(ebp+0xc) 0/imm32 +31519 0f 84/jump-if-= $emit-subx-imm32:end/disp32 +31520 # var v/eax: (handle var) +31521 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax +31522 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +31523 (lookup *eax *(eax+4)) # Var-name Var-name => eax +31524 (write-buffered *(ebp+8) Space) +31525 (write-buffered *(ebp+8) %eax) +31526 (write-buffered *(ebp+8) "/imm32") +31527 $emit-subx-imm32:end: +31528 # . restore registers +31529 59/pop-to-ecx +31530 58/pop-to-eax +31531 # . epilogue +31532 89/<- %esp 5/r32/ebp +31533 5d/pop-to-ebp +31534 c3/return +31535 +31536 emit-subx-imm8: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt) +31537 # . prologue +31538 55/push-ebp +31539 89/<- %ebp 4/r32/esp +31540 # . save registers +31541 50/push-eax +31542 51/push-ecx +31543 # if (l == 0) return +31544 81 7/subop/compare *(ebp+0xc) 0/imm32 +31545 0f 84/jump-if-= $emit-subx-imm32:end/disp32 +31546 # var v/eax: (handle var) +31547 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # => eax +31548 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +31549 (lookup *eax *(eax+4)) # Var-name Var-name => eax +31550 (write-buffered *(ebp+8) Space) +31551 (write-buffered *(ebp+8) %eax) +31552 (write-buffered *(ebp+8) "/imm8") +31553 $emit-subx-imm8:end: +31554 # . restore registers +31555 59/pop-to-ecx +31556 58/pop-to-eax +31557 # . epilogue +31558 89/<- %esp 5/r32/ebp +31559 5d/pop-to-ebp +31560 c3/return +31561 +31562 emit-subx-disp32: # out: (addr buffered-file), l: arg-location, stmt: (addr stmt), err: (addr buffered-file), ed: (addr exit-descriptor) +31563 # . prologue +31564 55/push-ebp +31565 89/<- %ebp 4/r32/esp +31566 # . save registers +31567 50/push-eax 31568 51/push-ecx -31569 # var lit?/ecx: boolean = is-literal-type?(a) -31570 (is-simple-mu-type? *(ebp+8) 0) # => eax -31571 89/<- %ecx 0/r32/eax -31572 # var float?/eax: int = is-float?(a) -31573 (is-simple-mu-type? *(ebp+8) 0xf) # => eax -31574 # set bits for lit? and float? -31575 c1/shift 4/subop/left %ecx 1/imm8 -31576 09/or %eax 1/r32/ecx -31577 $type-category:end: -31578 # . restore registers -31579 59/pop-to-ecx -31580 # . epilogue -31581 89/<- %esp 5/r32/ebp -31582 5d/pop-to-ebp -31583 c3/return -31584 -31585 is-simple-mu-type?: # a: (addr type-tree), n: type-id -> result/eax: boolean -31586 # . prologue -31587 55/push-ebp -31588 89/<- %ebp 4/r32/esp -31589 # . save registers -31590 51/push-ecx -31591 # ecx = n -31592 8b/-> *(ebp+0xc) 1/r32/ecx -31593 # return (a->value == n) -31594 8b/-> *(ebp+8) 0/r32/eax -31595 39/compare *(eax+4) 1/r32/ecx # Type-tree-value -31596 0f 94/set-byte-if-= %al -31597 81 4/subop/and %eax 0xff/imm32 -31598 $is-simple-mu-type?:end: -31599 # . restore registers -31600 59/pop-to-ecx +31569 # if (location == 0) return +31570 81 7/subop/compare *(ebp+0xc) 0/imm32 +31571 0f 84/jump-if-= $emit-subx-disp32:end/disp32 +31572 # var v/eax: (addr stmt-var) +31573 (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc) *(ebp+0x14) *(ebp+0x18)) # => eax +31574 (lookup *eax *(eax+4)) # Stmt-var-value Stmt-var-value => eax +31575 (lookup *eax *(eax+4)) # Var-name Var-name => eax +31576 (write-buffered *(ebp+8) Space) +31577 (write-buffered *(ebp+8) %eax) +31578 # hack: if instruction operation starts with "break", emit ":break" +31579 # var name/ecx: (addr array byte) = lookup(stmt->operation) +31580 8b/-> *(ebp+0x10) 0/r32/eax +31581 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +31582 89/<- %ecx 0/r32/eax +31583 { +31584 (string-starts-with? %ecx "break") # => eax +31585 3d/compare-eax-and 0/imm32/false +31586 74/jump-if-= break/disp8 +31587 (write-buffered *(ebp+8) ":break") +31588 } +31589 # hack: if instruction operation starts with "loop", emit ":loop" +31590 { +31591 (string-starts-with? %ecx "loop") # => eax +31592 3d/compare-eax-and 0/imm32/false +31593 74/jump-if-= break/disp8 +31594 (write-buffered *(ebp+8) ":loop") +31595 } +31596 (write-buffered *(ebp+8) "/disp32") +31597 $emit-subx-disp32:end: +31598 # . restore registers +31599 59/pop-to-ecx +31600 58/pop-to-eax 31601 # . epilogue 31602 89/<- %esp 5/r32/ebp 31603 5d/pop-to-ebp 31604 c3/return 31605 -31606 is-mu-addr-type?: # a: (addr type-tree) -> result/eax: boolean +31606 emit-call: # out: (addr buffered-file), stmt: (addr stmt) 31607 # . prologue 31608 55/push-ebp 31609 89/<- %ebp 4/r32/esp -31610 # eax = a -31611 8b/-> *(ebp+8) 0/r32/eax -31612 # if (!a->is-atom?) a = a->left -31613 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -31614 { -31615 75/jump-if-!= break/disp8 -31616 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -31617 } -31618 # return (a->value == addr) -31619 81 7/subop/compare *(eax+4) 2/imm32/addr # Type-tree-value -31620 0f 94/set-byte-if-= %al -31621 81 4/subop/and %eax 0xff/imm32 -31622 $is-mu-addr-type?:end: -31623 # . epilogue -31624 89/<- %esp 5/r32/ebp -31625 5d/pop-to-ebp -31626 c3/return -31627 -31628 is-mu-array-type?: # a: (addr type-tree) -> result/eax: boolean -31629 # . prologue -31630 55/push-ebp -31631 89/<- %ebp 4/r32/esp -31632 # eax = a -31633 8b/-> *(ebp+8) 0/r32/eax -31634 # if (!a->is-atom?) a = a->left -31635 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -31636 { -31637 75/jump-if-!= break/disp8 -31638 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -31639 } -31640 # return (a->value == array) -31641 81 7/subop/compare *(eax+4) 3/imm32/array # Type-tree-value -31642 0f 94/set-byte-if-= %al -31643 81 4/subop/and %eax 0xff/imm32 -31644 $is-mu-array-type?:end: -31645 # . epilogue -31646 89/<- %esp 5/r32/ebp -31647 5d/pop-to-ebp -31648 c3/return -31649 -31650 is-mu-stream-type?: # a: (addr type-tree) -> result/eax: boolean -31651 # . prologue -31652 55/push-ebp -31653 89/<- %ebp 4/r32/esp -31654 # eax = a -31655 8b/-> *(ebp+8) 0/r32/eax -31656 # if (!a->is-atom?) a = a->left -31657 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom -31658 { -31659 75/jump-if-!= break/disp8 -31660 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax -31661 } -31662 # return (a->value == stream) -31663 81 7/subop/compare *(eax+4) 0xb/imm32/stream # Type-tree-value -31664 0f 94/set-byte-if-= %al -31665 81 4/subop/and %eax 0xff/imm32 -31666 $is-mu-stream-type?:end: -31667 # . epilogue -31668 89/<- %esp 5/r32/ebp -31669 5d/pop-to-ebp -31670 c3/return -31671 -31672 test-emit-subx-stmt-primitive: -31673 # Primitive operation on a variable on the stack. -31674 # increment foo -31675 # => -31676 # ff 0/subop/increment *(ebp-8) -31677 # -31678 # There's a variable on the var stack as follows: -31679 # name: 'foo' -31680 # type: int -31681 # stack-offset: -8 -31682 # -31683 # There's a primitive with this info: -31684 # name: 'increment' -31685 # inouts: int/mem -31686 # value: 'ff 0/subop/increment' -31687 # -31688 # . prologue -31689 55/push-ebp -31690 89/<- %ebp 4/r32/esp -31691 # setup -31692 (clear-stream _test-output-stream) -31693 (clear-stream $_test-output-buffered-file->buffer) -31694 # simulate allocated payloads starting with an initial fake alloc-id (0x11) -31695 $test-emit-subx-stmt-primitive:initialize-type: -31696 # var type/ecx: (payload type-tree) = int -31697 68/push 0/imm32/right:null -31698 68/push 0/imm32/right:null -31699 68/push 0/imm32/left:unused -31700 68/push 1/imm32/value:int -31701 68/push 1/imm32/is-atom?:true -31702 68/push 0x11/imm32/alloc-id:fake:payload -31703 89/<- %ecx 4/r32/esp -31704 $test-emit-subx-stmt-primitive:initialize-var: -31705 # var var-foo/ecx: (payload var) = var(type) -31706 68/push 0/imm32/no-register -31707 68/push 0/imm32/no-register -31708 68/push -8/imm32/stack-offset -31709 68/push 1/imm32/block-depth -31710 51/push-ecx/type -31711 68/push 0x11/imm32/alloc-id:fake -31712 68/push 0/imm32/name -31713 68/push 0/imm32/name -31714 68/push 0x11/imm32/alloc-id:fake:payload -31715 89/<- %ecx 4/r32/esp -31716 $test-emit-subx-stmt-primitive:initialize-var-name: -31717 # var-foo->name = "foo" -31718 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -31719 (copy-array Heap "foo" %eax) -31720 $test-emit-subx-stmt-primitive:initialize-stmt-var: -31721 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) -31722 68/push 0/imm32/is-deref:false -31723 68/push 0/imm32/next -31724 68/push 0/imm32/next -31725 51/push-ecx/var-foo -31726 68/push 0x11/imm32/alloc-id:fake -31727 68/push 0x11/imm32/alloc-id:fake:payload -31728 89/<- %ebx 4/r32/esp -31729 $test-emit-subx-stmt-primitive:initialize-stmt: -31730 # var stmt/esi: (addr statement) -31731 68/push 0/imm32/no-outputs -31732 68/push 0/imm32/no-outputs -31733 53/push-ebx/inouts -31734 68/push 0x11/imm32/alloc-id:fake -31735 68/push 0/imm32/operation -31736 68/push 0/imm32/operation -31737 68/push 1/imm32/tag -31738 89/<- %esi 4/r32/esp -31739 $test-emit-subx-stmt-primitive:initialize-stmt-operation: -31740 # stmt->operation = "increment" -31741 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -31742 (copy-array Heap "increment" %eax) -31743 $test-emit-subx-stmt-primitive:initialize-primitive: -31744 # var primitives/ebx: (addr primitive) -31745 68/push 0/imm32/next -31746 68/push 0/imm32/next -31747 68/push 0/imm32/no-x32 -31748 68/push 0/imm32/no-xm32 -31749 68/push 0/imm32/no-disp32 -31750 68/push 0/imm32/no-imm8 -31751 68/push 0/imm32/no-imm32 -31752 68/push 0/imm32/no-r32 -31753 68/push 1/imm32/rm32-is-first-inout -31754 68/push 0/imm32/subx-name -31755 68/push 0/imm32/subx-name -31756 68/push 0/imm32/no-outputs -31757 68/push 0/imm32/no-outputs -31758 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration -31759 68/push 0x11/imm32/alloc-id:fake -31760 68/push 0/imm32/name -31761 68/push 0/imm32/name -31762 89/<- %ebx 4/r32/esp -31763 $test-emit-subx-stmt-primitive:initialize-primitive-name: -31764 # primitives->name = "increment" -31765 (copy-array Heap "increment" %ebx) # Primitive-name -31766 $test-emit-subx-stmt-primitive:initialize-primitive-subx-name: -31767 # primitives->subx-name = "ff 0/subop/increment" -31768 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -31769 (copy-array Heap "ff 0/subop/increment" %eax) -31770 # convert -31771 c7 0/subop/copy *Curr-block-depth 0/imm32 -31772 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) -31773 (flush _test-output-buffered-file) -31774 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -31780 # check output -31781 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffff8)" "F - test-emit-subx-stmt-primitive") -31782 # . epilogue -31783 89/<- %esp 5/r32/ebp -31784 5d/pop-to-ebp -31785 c3/return -31786 -31787 test-emit-subx-stmt-primitive-register: -31788 # Primitive operation on a variable in a register. -31789 # foo <- increment -31790 # => -31791 # ff 0/subop/increment %eax # sub-optimal, but should suffice -31792 # -31793 # There's a variable on the var stack as follows: -31794 # name: 'foo' -31795 # type: int -31796 # register: 'eax' -31797 # -31798 # There's a primitive with this info: -31799 # name: 'increment' -31800 # out: int/reg -31801 # value: 'ff 0/subop/increment' -31802 # -31803 # . prologue -31804 55/push-ebp -31805 89/<- %ebp 4/r32/esp -31806 # setup -31807 (clear-stream _test-output-stream) -31808 (clear-stream $_test-output-buffered-file->buffer) -31809 $test-emit-subx-stmt-primitive-register:initialize-type: -31810 # var type/ecx: (payload type-tree) = int -31811 68/push 0/imm32/right:null -31812 68/push 0/imm32/right:null -31813 68/push 0/imm32/left:unused -31814 68/push 1/imm32/value:int -31815 68/push 1/imm32/is-atom?:true -31816 68/push 0x11/imm32/alloc-id:fake:payload -31817 89/<- %ecx 4/r32/esp -31818 $test-emit-subx-stmt-primitive-register:initialize-var: -31819 # var var-foo/ecx: (payload var) -31820 68/push 0/imm32/register -31821 68/push 0/imm32/register -31822 68/push 0/imm32/no-stack-offset -31823 68/push 1/imm32/block-depth -31824 51/push-ecx -31825 68/push 0x11/imm32/alloc-id:fake -31826 68/push 0/imm32/name -31827 68/push 0/imm32/name -31828 68/push 0x11/imm32/alloc-id:fake:payload -31829 89/<- %ecx 4/r32/esp -31830 $test-emit-subx-stmt-primitive-register:initialize-var-name: -31831 # var-foo->name = "foo" -31832 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -31833 (copy-array Heap "foo" %eax) -31834 $test-emit-subx-stmt-primitive-register:initialize-var-register: -31835 # var-foo->register = "eax" -31836 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -31837 (copy-array Heap "eax" %eax) -31838 $test-emit-subx-stmt-primitive-register:initialize-stmt-var: -31839 # var operand/ebx: (payload stmt-var) -31840 68/push 0/imm32/is-deref:false -31841 68/push 0/imm32/next -31842 68/push 0/imm32/next -31843 51/push-ecx/var-foo -31844 68/push 0x11/imm32/alloc-id:fake -31845 68/push 0x11/imm32/alloc-id:fake:payload -31846 89/<- %ebx 4/r32/esp -31847 $test-emit-subx-stmt-primitive-register:initialize-stmt: -31848 # var stmt/esi: (addr statement) -31849 53/push-ebx/outputs -31850 68/push 0x11/imm32/alloc-id:fake -31851 68/push 0/imm32/no-inouts -31852 68/push 0/imm32/no-inouts -31853 68/push 0/imm32/operation -31854 68/push 0/imm32/operation -31855 68/push 1/imm32 -31856 89/<- %esi 4/r32/esp -31857 $test-emit-subx-stmt-primitive-register:initialize-stmt-operation: -31858 # stmt->operation = "increment" -31859 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -31860 (copy-array Heap "increment" %eax) -31861 $test-emit-subx-stmt-primitive-register:initialize-formal-var: -31862 # var formal-var/ebx: (payload var) -31863 68/push 0/imm32/register -31864 68/push 0/imm32/register -31865 68/push 0/imm32/no-stack-offset -31866 68/push 1/imm32/block-depth -31867 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id -31868 68/push 0x11/imm32/alloc-id:fake -31869 68/push 0/imm32/name -31870 68/push 0/imm32/name -31871 68/push 0x11/imm32/alloc-id:fake:payload -31872 89/<- %ebx 4/r32/esp -31873 $test-emit-subx-stmt-primitive-register:initialize-formal-var-name: -31874 # formal-var->name = "dummy" -31875 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 -31876 (copy-array Heap "dummy" %eax) -31877 $test-emit-subx-stmt-primitive-register:initialize-formal-register: -31878 # formal-var->register = "*" -31879 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 -31880 (copy-array Heap "*" %eax) # Any-register -31881 $test-emit-subx-stmt-primitive-register:initialize-var-list: -31882 # var formal-outputs/ebx: (payload list var) -31883 68/push 0/imm32/next -31884 68/push 0/imm32/next -31885 53/push-ebx/formal-var -31886 68/push 0x11/imm32/alloc-id:fake -31887 68/push 0x11/imm32/alloc-id:fake:payload -31888 89/<- %ebx 4/r32/esp -31889 $test-emit-subx-stmt-primitive-register:initialize-primitive: -31890 # var primitives/ebx: (addr primitive) -31891 68/push 0/imm32/next -31892 68/push 0/imm32/next -31893 68/push 0/imm32/no-x32 -31894 68/push 0/imm32/no-xm32 -31895 68/push 0/imm32/no-disp32 -31896 68/push 0/imm32/no-imm8 -31897 68/push 0/imm32/no-imm32 -31898 68/push 0/imm32/no-r32 -31899 68/push 3/imm32/rm32-is-first-output -31900 68/push 0/imm32/subx-name -31901 68/push 0/imm32/subx-name -31902 53/push-ebx/outputs -31903 68/push 0x11/imm32/alloc-id:fake -31904 68/push 0/imm32/no-inouts -31905 68/push 0/imm32/no-inouts -31906 68/push 0/imm32/name -31907 68/push 0/imm32/name -31908 89/<- %ebx 4/r32/esp -31909 $test-emit-subx-stmt-primitive-register:initialize-primitive-name: -31910 # primitives->name = "increment" -31911 (copy-array Heap "increment" %ebx) # Primitive-name -31912 $test-emit-subx-stmt-primitive-register:initialize-primitive-subx-name: -31913 # primitives->subx-name = "ff 0/subop/increment" -31914 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -31915 (copy-array Heap "ff 0/subop/increment" %eax) -31916 # convert -31917 c7 0/subop/copy *Curr-block-depth 0/imm32 -31918 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) -31919 (flush _test-output-buffered-file) -31920 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -31926 # check output -31927 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-primitive-register") -31928 # . epilogue -31929 89/<- %esp 5/r32/ebp -31930 5d/pop-to-ebp -31931 c3/return -31932 -31933 test-emit-subx-stmt-select-primitive: -31934 # Select the right primitive between overloads. -31935 # foo <- increment -31936 # => -31937 # ff 0/subop/increment %eax # sub-optimal, but should suffice -31938 # -31939 # There's a variable on the var stack as follows: -31940 # name: 'foo' -31941 # type: int -31942 # register: 'eax' -31943 # -31944 # There's two primitives, as follows: -31945 # - name: 'increment' -31946 # out: int/reg -31947 # value: 'ff 0/subop/increment' -31948 # - name: 'increment' -31949 # inout: int/mem -31950 # value: 'ff 0/subop/increment' -31951 # -31952 # . prologue -31953 55/push-ebp -31954 89/<- %ebp 4/r32/esp -31955 # setup -31956 (clear-stream _test-output-stream) -31957 (clear-stream $_test-output-buffered-file->buffer) -31958 $test-emit-subx-stmt-select-primitive:initialize-type: -31959 # var type/ecx: (payload type-tree) = int -31960 68/push 0/imm32/right:null -31961 68/push 0/imm32/right:null -31962 68/push 0/imm32/left:unused -31963 68/push 1/imm32/value:int -31964 68/push 1/imm32/is-atom?:true -31965 68/push 0x11/imm32/alloc-id:fake:payload -31966 89/<- %ecx 4/r32/esp -31967 $test-emit-subx-stmt-select-primitive:initialize-var: -31968 # var var-foo/ecx: (payload var) -31969 68/push 0/imm32/register -31970 68/push 0/imm32/register -31971 68/push 0/imm32/no-stack-offset -31972 68/push 1/imm32/block-depth -31973 51/push-ecx -31974 68/push 0x11/imm32/alloc-id:fake -31975 68/push 0/imm32/name -31976 68/push 0/imm32/name -31977 68/push 0x11/imm32/alloc-id:fake:payload -31978 89/<- %ecx 4/r32/esp -31979 $test-emit-subx-stmt-select-primitive:initialize-var-name: -31980 # var-foo->name = "foo" -31981 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -31982 (copy-array Heap "foo" %eax) -31983 $test-emit-subx-stmt-select-primitive:initialize-var-register: -31984 # var-foo->register = "eax" -31985 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -31986 (copy-array Heap "eax" %eax) -31987 $test-emit-subx-stmt-select-primitive:initialize-stmt-var: -31988 # var operand/ebx: (payload stmt-var) -31989 68/push 0/imm32/is-deref:false -31990 68/push 0/imm32/next -31991 68/push 0/imm32/next -31992 51/push-ecx/var-foo -31993 68/push 0x11/imm32/alloc-id:fake -31994 68/push 0x11/imm32/alloc-id:fake:payload -31995 89/<- %ebx 4/r32/esp -31996 $test-emit-subx-stmt-select-primitive:initialize-stmt: -31997 # var stmt/esi: (addr statement) -31998 53/push-ebx/outputs -31999 68/push 0x11/imm32/alloc-id:fake -32000 68/push 0/imm32/no-inouts -32001 68/push 0/imm32/no-inouts -32002 68/push 0/imm32/operation -32003 68/push 0/imm32/operation -32004 68/push 1/imm32 -32005 89/<- %esi 4/r32/esp -32006 $test-emit-subx-stmt-select-primitive:initialize-stmt-operation: -32007 # stmt->operation = "increment" -32008 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -32009 (copy-array Heap "increment" %eax) -32010 $test-emit-subx-stmt-select-primitive:initialize-formal-var: -32011 # var formal-var/ebx: (payload var) -32012 68/push 0/imm32/register -32013 68/push 0/imm32/register -32014 68/push 0/imm32/no-stack-offset -32015 68/push 1/imm32/block-depth -32016 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id -32017 68/push 0x11/imm32/alloc-id:fake -32018 68/push 0/imm32/name -32019 68/push 0/imm32/name -32020 68/push 0x11/imm32/alloc-id:fake:payload -32021 89/<- %ebx 4/r32/esp -32022 $test-emit-subx-stmt-select-primitive:initialize-formal-var-name: -32023 # formal-var->name = "dummy" -32024 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 -32025 (copy-array Heap "dummy" %eax) -32026 $test-emit-subx-stmt-select-primitive:initialize-formal-register: -32027 # formal-var->register = "*" -32028 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 -32029 (copy-array Heap "*" %eax) # Any-register -32030 $test-emit-subx-stmt-select-primitive:initialize-var-list: -32031 # var formal-outputs/ebx: (payload list var) -32032 68/push 0/imm32/next -32033 68/push 0/imm32/next -32034 53/push-ebx/formal-var -32035 68/push 0x11/imm32/alloc-id:fake -32036 68/push 0x11/imm32/alloc-id:fake:payload -32037 89/<- %ebx 4/r32/esp -32038 $test-emit-subx-stmt-select-primitive:initialize-primitive2: -32039 # var primitive2/edi: (payload primitive) -32040 68/push 0/imm32/next -32041 68/push 0/imm32/next -32042 68/push 0/imm32/no-x32 -32043 68/push 0/imm32/no-xm32 -32044 68/push 0/imm32/no-disp32 -32045 68/push 0/imm32/no-imm8 -32046 68/push 0/imm32/no-imm32 -32047 68/push 0/imm32/no-r32 -32048 68/push 3/imm32/rm32-is-first-output -32049 68/push 0/imm32/subx-name -32050 68/push 0/imm32/subx-name -32051 53/push-ebx/outputs -32052 68/push 0x11/imm32/alloc-id:fake -32053 68/push 0/imm32/no-inouts -32054 68/push 0/imm32/no-inouts -32055 68/push 0/imm32/name -32056 68/push 0/imm32/name -32057 68/push 0x11/imm32/alloc-id:fake:payload -32058 89/<- %edi 4/r32/esp -32059 $test-emit-subx-stmt-select-primitive:initialize-primitive2-name: -32060 # primitives->name = "increment" -32061 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 -32062 (copy-array Heap "increment" %eax) -32063 $test-emit-subx-stmt-select-primitive:initialize-primitive2-subx-name: -32064 # primitives->subx-name = "ff 0/subop/increment" -32065 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 -32066 (copy-array Heap "ff 0/subop/increment" %eax) -32067 $test-emit-subx-stmt-select-primitive:initialize-primitive: -32068 # var primitives/ebx: (addr primitive) -32069 57/push-edi -32070 68/push 0x11/imm32/alloc-id:fake -32071 68/push 0/imm32/no-x32 -32072 68/push 0/imm32/no-xm32 -32073 68/push 0/imm32/no-disp32 -32074 68/push 0/imm32/no-imm8 -32075 68/push 0/imm32/no-imm32 -32076 68/push 0/imm32/no-r32 -32077 68/push 1/imm32/rm32-is-first-inout -32078 68/push 0/imm32/subx-name -32079 68/push 0/imm32/subx-name -32080 68/push 0/imm32/no-outputs -32081 68/push 0/imm32/no-outputs -32082 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration -32083 68/push 0x11/imm32/alloc-id:fake -32084 68/push 0/imm32/name -32085 68/push 0/imm32/name -32086 89/<- %ebx 4/r32/esp -32087 $test-emit-subx-stmt-select-primitive:initialize-primitive-name: -32088 # primitives->name = "increment" -32089 (copy-array Heap "increment" %ebx) # Primitive-name -32090 $test-emit-subx-stmt-select-primitive:initialize-primitive-subx-name: -32091 # primitives->subx-name = "ff 0/subop/increment" -32092 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -32093 (copy-array Heap "ff 0/subop/increment" %eax) -32094 # convert -32095 c7 0/subop/copy *Curr-block-depth 0/imm32 -32096 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) -32097 (flush _test-output-buffered-file) -32098 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -32104 # check output -32105 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive") -32106 # . epilogue -32107 89/<- %esp 5/r32/ebp -32108 5d/pop-to-ebp -32109 c3/return -32110 -32111 test-emit-subx-stmt-select-primitive-2: -32112 # Select the right primitive between overloads. -32113 # increment foo -32114 # => -32115 # ff 0/subop/increment %eax # sub-optimal, but should suffice -32116 # -32117 # There's a variable on the var stack as follows: -32118 # name: 'foo' -32119 # type: int -32120 # register: 'eax' -32121 # -32122 # There's two primitives, as follows: -32123 # - name: 'increment' -32124 # out: int/reg -32125 # value: 'ff 0/subop/increment' -32126 # - name: 'increment' -32127 # inout: int/mem -32128 # value: 'ff 0/subop/increment' -32129 # -32130 # . prologue -32131 55/push-ebp -32132 89/<- %ebp 4/r32/esp -32133 # setup -32134 (clear-stream _test-output-stream) -32135 (clear-stream $_test-output-buffered-file->buffer) -32136 $test-emit-subx-stmt-select-primitive-2:initialize-type: -32137 # var type/ecx: (payload type-tree) = int -32138 68/push 0/imm32/right:null -32139 68/push 0/imm32/right:null -32140 68/push 0/imm32/left:unused -32141 68/push 1/imm32/value:int -32142 68/push 1/imm32/is-atom?:true -32143 68/push 0x11/imm32/alloc-id:fake:payload -32144 89/<- %ecx 4/r32/esp -32145 $test-emit-subx-stmt-select-primitive-2:initialize-var: -32146 # var var-foo/ecx: (payload var) -32147 68/push 0/imm32/register -32148 68/push 0/imm32/register -32149 68/push 0/imm32/no-stack-offset -32150 68/push 1/imm32/block-depth -32151 51/push-ecx -32152 68/push 0x11/imm32/alloc-id:fake -32153 68/push 0/imm32/name -32154 68/push 0/imm32/name -32155 68/push 0x11/imm32/alloc-id:fake:payload -32156 89/<- %ecx 4/r32/esp -32157 $test-emit-subx-stmt-select-primitive-2:initialize-var-name: -32158 # var-foo->name = "foo" -32159 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -32160 (copy-array Heap "foo" %eax) -32161 $test-emit-subx-stmt-select-primitive-2:initialize-var-register: -32162 # var-foo->register = "eax" -32163 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -32164 (copy-array Heap "eax" %eax) -32165 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-var: -32166 # var operand/ebx: (payload stmt-var) -32167 68/push 0/imm32/is-deref:false -32168 68/push 0/imm32/next -32169 68/push 0/imm32/next -32170 51/push-ecx/var-foo -32171 68/push 0x11/imm32/alloc-id:fake -32172 68/push 0x11/imm32/alloc-id:fake:payload -32173 89/<- %ebx 4/r32/esp -32174 $test-emit-subx-stmt-select-primitive-2:initialize-stmt: -32175 # var stmt/esi: (addr statement) -32176 68/push 0/imm32/no-outputs -32177 68/push 0/imm32/no-outputs -32178 53/push-ebx/inouts -32179 68/push 0x11/imm32/alloc-id:fake -32180 68/push 0/imm32/operation -32181 68/push 0/imm32/operation -32182 68/push 1/imm32 -32183 89/<- %esi 4/r32/esp -32184 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-operation: -32185 # stmt->operation = "increment" -32186 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -32187 (copy-array Heap "increment" %eax) -32188 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var: -32189 # var formal-var/ebx: (payload var) -32190 68/push 0/imm32/register -32191 68/push 0/imm32/register -32192 68/push 0/imm32/no-stack-offset -32193 68/push 1/imm32/block-depth -32194 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id -32195 68/push 0x11/imm32/alloc-id:fake -32196 68/push 0/imm32/name -32197 68/push 0/imm32/name -32198 68/push 0x11/imm32/alloc-id:fake:payload -32199 89/<- %ebx 4/r32/esp -32200 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var-name: -32201 # formal-var->name = "dummy" -32202 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 -32203 (copy-array Heap "dummy" %eax) -32204 $test-emit-subx-stmt-select-primitive-2:initialize-formal-register: -32205 # formal-var->register = "*" -32206 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 -32207 (copy-array Heap "*" %eax) # Any-register -32208 $test-emit-subx-stmt-select-primitive-2:initialize-var-list: -32209 # var formal-outputs/ebx: (payload list stmt-var) -32210 68/push 0/imm32/next -32211 68/push 0/imm32/next -32212 53/push-ebx/formal-var -32213 68/push 0x11/imm32/alloc-id:fake -32214 68/push 0x11/imm32/alloc-id:fake:payload -32215 89/<- %ebx 4/r32/esp -32216 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2: -32217 # var primitive2/edi: (payload primitive) -32218 68/push 0/imm32/next -32219 68/push 0/imm32/next -32220 68/push 0/imm32/no-x32 -32221 68/push 0/imm32/no-xm32 -32222 68/push 0/imm32/no-disp32 -32223 68/push 0/imm32/no-imm8 -32224 68/push 0/imm32/no-imm32 -32225 68/push 0/imm32/no-r32 -32226 68/push 3/imm32/rm32-is-first-output -32227 68/push 0/imm32/subx-name -32228 68/push 0/imm32/subx-name -32229 53/push-ebx/outputs -32230 68/push 0x11/imm32/alloc-id:fake -32231 68/push 0/imm32/no-inouts -32232 68/push 0/imm32/no-inouts -32233 68/push 0/imm32/name -32234 68/push 0/imm32/name -32235 68/push 0x11/imm32/alloc-id:fake:payload -32236 89/<- %edi 4/r32/esp -32237 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-name: -32238 # primitives->name = "increment" -32239 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 -32240 (copy-array Heap "increment" %eax) -32241 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-subx-name: -32242 # primitives->subx-name = "ff 0/subop/increment" -32243 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 -32244 (copy-array Heap "ff 0/subop/increment" %eax) -32245 $test-emit-subx-stmt-select-primitive-2:initialize-primitive: -32246 # var primitives/ebx: (addr primitive) -32247 57/push-edi -32248 68/push 0x11/imm32/alloc-id:fake -32249 68/push 0/imm32/no-x32 -32250 68/push 0/imm32/no-xm32 -32251 68/push 0/imm32/no-disp32 -32252 68/push 0/imm32/no-imm8 -32253 68/push 0/imm32/no-imm32 -32254 68/push 0/imm32/no-r32 -32255 68/push 1/imm32/rm32-is-first-inout -32256 68/push 0/imm32/subx-name -32257 68/push 0/imm32/subx-name -32258 68/push 0/imm32/no-outputs -32259 68/push 0/imm32/no-outputs -32260 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration -32261 68/push 0x11/imm32/alloc-id:fake -32262 68/push 0/imm32/name -32263 68/push 0/imm32/name -32264 89/<- %ebx 4/r32/esp -32265 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-name: -32266 # primitives->name = "increment" -32267 (copy-array Heap "increment" %ebx) # Primitive-name -32268 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-subx-name: -32269 # primitives->subx-name = "ff 0/subop/increment" -32270 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name -32271 (copy-array Heap "ff 0/subop/increment" %eax) -32272 # convert -32273 c7 0/subop/copy *Curr-block-depth 0/imm32 -32274 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) -32275 (flush _test-output-buffered-file) -32276 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -32282 # check output -32283 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive-2") -32284 # . epilogue -32285 89/<- %esp 5/r32/ebp -32286 5d/pop-to-ebp -32287 c3/return -32288 -32289 test-increment-register: -32290 # Select the right register between overloads. -32291 # foo <- increment -32292 # => -32293 # 50/increment-eax -32294 # -32295 # There's a variable on the var stack as follows: -32296 # name: 'foo' -32297 # type: int -32298 # register: 'eax' -32299 # -32300 # Primitives are the global definitions. -32301 # -32302 # . prologue -32303 55/push-ebp -32304 89/<- %ebp 4/r32/esp -32305 # setup -32306 (clear-stream _test-output-stream) -32307 (clear-stream $_test-output-buffered-file->buffer) -32308 $test-increment-register:initialize-type: -32309 # var type/ecx: (payload type-tree) = int -32310 68/push 0/imm32/right:null -32311 68/push 0/imm32/right:null -32312 68/push 0/imm32/left:unused -32313 68/push 1/imm32/value:int -32314 68/push 1/imm32/is-atom?:true -32315 68/push 0x11/imm32/alloc-id:fake:payload -32316 89/<- %ecx 4/r32/esp -32317 $test-increment-register:initialize-var: -32318 # var var-foo/ecx: (payload var) -32319 68/push 0/imm32/register -32320 68/push 0/imm32/register -32321 68/push 0/imm32/no-stack-offset -32322 68/push 1/imm32/block-depth -32323 51/push-ecx -32324 68/push 0x11/imm32/alloc-id:fake -32325 68/push 0/imm32/name -32326 68/push 0/imm32/name -32327 68/push 0x11/imm32/alloc-id:fake:payload -32328 89/<- %ecx 4/r32/esp -32329 $test-increment-register:initialize-var-name: -32330 # var-foo->name = "foo" -32331 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -32332 (copy-array Heap "foo" %eax) -32333 $test-increment-register:initialize-var-register: -32334 # var-foo->register = "eax" -32335 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -32336 (copy-array Heap "eax" %eax) -32337 $test-increment-register:initialize-stmt-var: -32338 # var operand/ebx: (payload stmt-var) -32339 68/push 0/imm32/is-deref:false -32340 68/push 0/imm32/next -32341 68/push 0/imm32/next -32342 51/push-ecx/var-foo -32343 68/push 0x11/imm32/alloc-id:fake -32344 68/push 0x11/imm32/alloc-id:fake:payload -32345 89/<- %ebx 4/r32/esp -32346 $test-increment-register:initialize-stmt: -32347 # var stmt/esi: (addr statement) -32348 53/push-ebx/outputs -32349 68/push 0x11/imm32/alloc-id:fake -32350 68/push 0/imm32/no-inouts -32351 68/push 0/imm32/no-inouts -32352 68/push 0/imm32/operation -32353 68/push 0/imm32/operation -32354 68/push 1/imm32 -32355 89/<- %esi 4/r32/esp -32356 $test-increment-register:initialize-stmt-operation: -32357 # stmt->operation = "increment" -32358 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -32359 (copy-array Heap "increment" %eax) -32360 # convert -32361 c7 0/subop/copy *Curr-block-depth 0/imm32 -32362 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -32363 (flush _test-output-buffered-file) -32364 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -32370 # check output -32371 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-register") -32372 # . epilogue -32373 89/<- %esp 5/r32/ebp -32374 5d/pop-to-ebp -32375 c3/return -32376 -32377 test-add-reg-to-reg: -32378 # var1/reg <- add var2/reg -32379 # => -32380 # 01/add-to %var1 var2 -32381 # -32382 # . prologue -32383 55/push-ebp -32384 89/<- %ebp 4/r32/esp -32385 # setup -32386 (clear-stream _test-output-stream) -32387 (clear-stream $_test-output-buffered-file->buffer) -32388 $test-add-reg-to-reg:initialize-type: -32389 # var type/ecx: (payload type-tree) = int -32390 68/push 0/imm32/right:null -32391 68/push 0/imm32/right:null -32392 68/push 0/imm32/left:unused -32393 68/push 1/imm32/value:int -32394 68/push 1/imm32/is-atom?:true -32395 68/push 0x11/imm32/alloc-id:fake:payload -32396 89/<- %ecx 4/r32/esp -32397 $test-add-reg-to-reg:initialize-var1: -32398 # var var1/ecx: (payload var) -32399 68/push 0/imm32/register -32400 68/push 0/imm32/register -32401 68/push 0/imm32/no-stack-offset -32402 68/push 1/imm32/block-depth -32403 51/push-ecx -32404 68/push 0x11/imm32/alloc-id:fake -32405 68/push 0/imm32/name -32406 68/push 0/imm32/name -32407 68/push 0x11/imm32/alloc-id:fake:payload -32408 89/<- %ecx 4/r32/esp -32409 $test-add-reg-to-reg:initialize-var1-name: -32410 # var1->name = "var1" -32411 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -32412 (copy-array Heap "var1" %eax) -32413 $test-add-reg-to-reg:initialize-var1-register: -32414 # var1->register = "eax" -32415 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -32416 (copy-array Heap "eax" %eax) -32417 $test-add-reg-to-reg:initialize-var2: -32418 # var var2/edx: (payload var) -32419 68/push 0/imm32/register -32420 68/push 0/imm32/register -32421 68/push 0/imm32/no-stack-offset -32422 68/push 1/imm32/block-depth -32423 ff 6/subop/push *(ecx+0x10) -32424 68/push 0x11/imm32/alloc-id:fake -32425 68/push 0/imm32/name -32426 68/push 0/imm32/name -32427 68/push 0x11/imm32/alloc-id:fake:payload -32428 89/<- %edx 4/r32/esp -32429 $test-add-reg-to-reg:initialize-var2-name: -32430 # var2->name = "var2" -32431 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -32432 (copy-array Heap "var2" %eax) -32433 $test-add-reg-to-reg:initialize-var2-register: -32434 # var2->register = "ecx" -32435 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 -32436 (copy-array Heap "ecx" %eax) -32437 $test-add-reg-to-reg:initialize-inouts: -32438 # var inouts/esi: (payload stmt-var) = [var2] -32439 68/push 0/imm32/is-deref:false -32440 68/push 0/imm32/next -32441 68/push 0/imm32/next -32442 52/push-edx/var2 -32443 68/push 0x11/imm32/alloc-id:fake -32444 68/push 0x11/imm32/alloc-id:fake:payload -32445 89/<- %esi 4/r32/esp -32446 $test-add-reg-to-reg:initialize-outputs: -32447 # var outputs/edi: (payload stmt-var) = [var1] -32448 68/push 0/imm32/is-deref:false -32449 68/push 0/imm32/next -32450 68/push 0/imm32/next -32451 51/push-ecx/var1 +31610 # . save registers +31611 50/push-eax +31612 51/push-ecx +31613 # +31614 (emit-indent *(ebp+8) *Curr-block-depth) +31615 (write-buffered *(ebp+8) "(") +31616 # ecx = stmt +31617 8b/-> *(ebp+0xc) 1/r32/ecx +31618 # - emit function name +31619 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +31620 (write-buffered *(ebp+8) %eax) +31621 # - emit arguments +31622 # var curr/eax: (addr stmt-var) = lookup(stmt->inouts) +31623 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +31624 { +31625 # if (curr == null) break +31626 3d/compare-eax-and 0/imm32 +31627 74/jump-if-= break/disp8 +31628 # +31629 (emit-subx-call-operand *(ebp+8) %eax) +31630 # curr = lookup(curr->next) +31631 (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax +31632 eb/jump loop/disp8 +31633 } +31634 # +31635 (write-buffered *(ebp+8) ")\n") +31636 $emit-call:end: +31637 # . restore registers +31638 59/pop-to-ecx +31639 58/pop-to-eax +31640 # . epilogue +31641 89/<- %esp 5/r32/ebp +31642 5d/pop-to-ebp +31643 c3/return +31644 +31645 emit-subx-call-operand: # out: (addr buffered-file), s: (addr stmt-var) +31646 # shares code with emit-subx-var-as-rm32 +31647 # . prologue +31648 55/push-ebp +31649 89/<- %ebp 4/r32/esp +31650 # . save registers +31651 50/push-eax +31652 51/push-ecx +31653 56/push-esi +31654 # ecx = s +31655 8b/-> *(ebp+0xc) 1/r32/ecx +31656 # var operand/esi: (addr var) = lookup(s->value) +31657 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +31658 89/<- %esi 0/r32/eax +31659 # if (operand->register && !s->is-deref?) emit "%__" +31660 { +31661 $emit-subx-call-operand:check-for-register-direct: +31662 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +31663 74/jump-if-= break/disp8 +31664 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +31665 75/jump-if-!= break/disp8 +31666 $emit-subx-call-operand:register-direct: +31667 (write-buffered *(ebp+8) " %") +31668 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +31669 (write-buffered *(ebp+8) %eax) +31670 e9/jump $emit-subx-call-operand:end/disp32 +31671 } +31672 # else if (operand->register && s->is-deref?) emit "*__" +31673 { +31674 $emit-subx-call-operand:check-for-register-indirect: +31675 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +31676 74/jump-if-= break/disp8 +31677 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +31678 74/jump-if-= break/disp8 +31679 $emit-subx-call-operand:register-indirect: +31680 (emit-subx-call-operand-register-indirect *(ebp+8) %esi) +31681 e9/jump $emit-subx-call-operand:end/disp32 +31682 } +31683 # else if (operand->stack-offset) emit "*(ebp+__)" +31684 { +31685 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset +31686 74/jump-if-= break/disp8 +31687 $emit-subx-call-operand:stack: +31688 (emit-subx-call-operand-stack *(ebp+8) %esi) +31689 e9/jump $emit-subx-call-operand:end/disp32 +31690 } +31691 # else if (operand->type == literal) emit "__" +31692 { +31693 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax +31694 81 7/subop/compare *(eax+4) 0/imm32 # Type-tree-value +31695 75/jump-if-!= break/disp8 +31696 $emit-subx-call-operand:literal: +31697 (write-buffered *(ebp+8) Space) +31698 (lookup *esi *(esi+4)) # Var-name Var-name => eax +31699 (write-buffered *(ebp+8) %eax) +31700 e9/jump $emit-subx-call-operand:end/disp32 +31701 } +31702 # else if (operand->type == literal-string) emit "__" +31703 { +31704 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax +31705 81 7/subop/compare *(eax+4) 0x10/imm32 # Type-tree-value +31706 75/jump-if-!= break/disp8 +31707 $emit-subx-call-operand:literal-string: +31708 (write-buffered *(ebp+8) Space) +31709 (lookup *esi *(esi+4)) # Var-name Var-name => eax +31710 (write-buffered *(ebp+8) %eax) +31711 } +31712 $emit-subx-call-operand:end: +31713 # . restore registers +31714 5e/pop-to-esi +31715 59/pop-to-ecx +31716 58/pop-to-eax +31717 # . epilogue +31718 89/<- %esp 5/r32/ebp +31719 5d/pop-to-ebp +31720 c3/return +31721 +31722 emit-subx-call-operand-register-indirect: # out: (addr buffered-file), v: (addr var) +31723 # . prologue +31724 55/push-ebp +31725 89/<- %ebp 4/r32/esp +31726 # . save registers +31727 50/push-eax +31728 51/push-ecx +31729 56/push-esi +31730 # esi = v +31731 8b/-> *(ebp+0xc) 6/r32/esi +31732 # var size/ecx: int = size-of-deref(v) +31733 (size-of-deref %esi) # => eax +31734 89/<- %ecx 0/r32/eax +31735 # var reg-name/esi: (addr array byte) = lookup(v->register) +31736 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +31737 89/<- %esi 0/r32/eax +31738 # TODO: assert size is a multiple of 4 +31739 # var i/eax: int = 0 +31740 b8/copy-to-eax 0/imm32 +31741 { +31742 $emit-subx-call-operand-register-indirect:loop: +31743 # if (i >= size) break +31744 39/compare %eax 1/r32/ecx +31745 7d/jump-if->= break/disp8 +31746 # emit " *(" v->register "+" i ")" +31747 (write-buffered *(ebp+8) " *(") +31748 (write-buffered *(ebp+8) %esi) +31749 (write-buffered *(ebp+8) "+") +31750 (write-int32-hex-buffered *(ebp+8) %eax) +31751 (write-buffered *(ebp+8) ")") +31752 # i += 4 +31753 05/add-to-eax 4/imm32 +31754 # +31755 eb/jump loop/disp8 +31756 } +31757 $emit-subx-call-operand-register-indirect:end: +31758 # . restore registers +31759 5e/pop-to-esi +31760 59/pop-to-ecx +31761 58/pop-to-eax +31762 # . epilogue +31763 89/<- %esp 5/r32/ebp +31764 5d/pop-to-ebp +31765 c3/return +31766 +31767 emit-subx-call-operand-stack: # out: (addr buffered-file), v: (addr var) +31768 # . prologue +31769 55/push-ebp +31770 89/<- %ebp 4/r32/esp +31771 # . save registers +31772 50/push-eax +31773 51/push-ecx +31774 56/push-esi +31775 # esi = v +31776 8b/-> *(ebp+0xc) 6/r32/esi +31777 # var curr/ecx: int = v->offset +31778 8b/-> *(esi+0x14) 1/r32/ecx # Var-offset +31779 # var max/eax: int = v->offset + size-of(v) +31780 (size-of %esi) # => eax +31781 # TODO: assert size is a multiple of 4 +31782 01/add-to %eax 1/r32/ecx +31783 { +31784 $emit-subx-call-operand-stack:loop: +31785 # if (curr >= max) break +31786 39/compare %ecx 0/r32/eax +31787 7d/jump-if->= break/disp8 +31788 # emit " *(ebp+" curr ")" +31789 (write-buffered *(ebp+8) " *(ebp+") +31790 (write-int32-hex-buffered *(ebp+8) %ecx) +31791 (write-buffered *(ebp+8) ")") +31792 # i += 4 +31793 81 0/subop/add %ecx 4/imm32 +31794 # +31795 eb/jump loop/disp8 +31796 } +31797 $emit-subx-call-operand-stack:end: +31798 # . restore registers +31799 5e/pop-to-esi +31800 59/pop-to-ecx +31801 58/pop-to-eax +31802 # . epilogue +31803 89/<- %esp 5/r32/ebp +31804 5d/pop-to-ebp +31805 c3/return +31806 +31807 emit-subx-var-as-rm32: # out: (addr buffered-file), s: (addr stmt-var) +31808 # . prologue +31809 55/push-ebp +31810 89/<- %ebp 4/r32/esp +31811 # . save registers +31812 50/push-eax +31813 51/push-ecx +31814 56/push-esi +31815 # ecx = s +31816 8b/-> *(ebp+0xc) 1/r32/ecx +31817 # var operand/esi: (addr var) = lookup(s->value) +31818 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +31819 89/<- %esi 0/r32/eax +31820 # if (operand->register && s->is-deref?) emit "*__" +31821 { +31822 $emit-subx-var-as-rm32:check-for-register-indirect: +31823 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +31824 74/jump-if-= break/disp8 +31825 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +31826 74/jump-if-= break/disp8 +31827 $emit-subx-var-as-rm32:register-indirect: +31828 (write-buffered *(ebp+8) " *") +31829 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +31830 (write-buffered *(ebp+8) %eax) +31831 e9/jump $emit-subx-var-as-rm32:end/disp32 +31832 } +31833 # if (operand->register && !s->is-deref?) emit "%__" +31834 { +31835 $emit-subx-var-as-rm32:check-for-register-direct: +31836 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +31837 74/jump-if-= break/disp8 +31838 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +31839 75/jump-if-!= break/disp8 +31840 $emit-subx-var-as-rm32:register-direct: +31841 (write-buffered *(ebp+8) " %") +31842 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +31843 (write-buffered *(ebp+8) %eax) +31844 e9/jump $emit-subx-var-as-rm32:end/disp32 +31845 } +31846 # else if (operand->stack-offset) emit "*(ebp+__)" +31847 { +31848 81 7/subop/compare *(esi+0x14) 0/imm32 # Var-offset +31849 74/jump-if-= break/disp8 +31850 $emit-subx-var-as-rm32:stack: +31851 (write-buffered *(ebp+8) Space) +31852 (write-buffered *(ebp+8) "*(ebp+") +31853 (write-int32-hex-buffered *(ebp+8) *(esi+0x14)) # Var-offset +31854 (write-buffered *(ebp+8) ")") +31855 } +31856 $emit-subx-var-as-rm32:end: +31857 # . restore registers +31858 5e/pop-to-esi +31859 59/pop-to-ecx +31860 58/pop-to-eax +31861 # . epilogue +31862 89/<- %esp 5/r32/ebp +31863 5d/pop-to-ebp +31864 c3/return +31865 +31866 find-matching-primitive: # primitives: (addr primitive), stmt: (addr stmt) -> result/eax: (addr primitive) +31867 # . prologue +31868 55/push-ebp +31869 89/<- %ebp 4/r32/esp +31870 # . save registers +31871 51/push-ecx +31872 # var curr/ecx: (addr primitive) = primitives +31873 8b/-> *(ebp+8) 1/r32/ecx +31874 { +31875 $find-matching-primitive:loop: +31876 # if (curr == null) break +31877 81 7/subop/compare %ecx 0/imm32 +31878 74/jump-if-= break/disp8 +31879 # if match(curr, stmt) return curr +31880 { +31881 (mu-stmt-matches-primitive? *(ebp+0xc) %ecx) # => eax +31882 3d/compare-eax-and 0/imm32/false +31883 74/jump-if-= break/disp8 +31884 89/<- %eax 1/r32/ecx +31885 eb/jump $find-matching-primitive:end/disp8 +31886 } +31887 $find-matching-primitive:next-primitive: +31888 # curr = curr->next +31889 (lookup *(ecx+0x3c) *(ecx+0x40)) # Primitive-next Primitive-next => eax +31890 89/<- %ecx 0/r32/eax +31891 # +31892 e9/jump loop/disp32 +31893 } +31894 # return null +31895 b8/copy-to-eax 0/imm32 +31896 $find-matching-primitive:end: +31897 # . restore registers +31898 59/pop-to-ecx +31899 # . epilogue +31900 89/<- %esp 5/r32/ebp +31901 5d/pop-to-ebp +31902 c3/return +31903 +31904 mu-stmt-matches-primitive?: # stmt: (addr stmt), primitive: (addr primitive) -> result/eax: boolean +31905 # A mu stmt matches a primitive if the name matches, all the inout vars +31906 # match, and all the output vars match. +31907 # Vars match if types match and registers match. +31908 # In addition, a stmt output matches a primitive's output if types match +31909 # and the primitive has a wildcard register. +31910 # . prologue +31911 55/push-ebp +31912 89/<- %ebp 4/r32/esp +31913 # . save registers +31914 51/push-ecx +31915 52/push-edx +31916 53/push-ebx +31917 56/push-esi +31918 57/push-edi +31919 # ecx = stmt +31920 8b/-> *(ebp+8) 1/r32/ecx +31921 # edx = primitive +31922 8b/-> *(ebp+0xc) 2/r32/edx +31923 { +31924 $mu-stmt-matches-primitive?:check-name: +31925 # if (primitive->name != stmt->operation) return false +31926 # . var esi: (addr array byte) = lookup(stmt->operation) +31927 (lookup *(ecx+4) *(ecx+8)) # Stmt1-operation Stmt1-operation => eax +31928 89/<- %esi 0/r32/eax +31929 # . var edi: (addr array byte) = lookup(primitive->name) +31930 (lookup *edx *(edx+4)) # Primitive-name Primitive-name => eax +31931 #? (write-buffered Stderr %eax) +31932 #? (write-buffered Stderr Newline) +31933 #? (flush Stderr) +31934 89/<- %edi 0/r32/eax +31935 (string-equal? %esi %edi) # => eax +31936 3d/compare-eax-and 0/imm32/false +31937 75/jump-if-!= break/disp8 +31938 b8/copy-to-eax 0/imm32 +31939 e9/jump $mu-stmt-matches-primitive?:end/disp32 +31940 } +31941 # var curr/esi: (addr stmt-var) = lookup(stmt->inouts) +31942 (lookup *(ecx+0xc) *(ecx+0x10)) # Stmt1-inouts Stmt1-inouts => eax +31943 89/<- %esi 0/r32/eax +31944 # var curr2/edi: (addr list var) = lookup(primitive->inouts) +31945 (lookup *(edx+8) *(edx+0xc)) # Primitive-inouts Primitive-inouts => eax +31946 89/<- %edi 0/r32/eax +31947 { +31948 $mu-stmt-matches-primitive?:inouts-loop: +31949 # if (curr == 0 && curr2 == 0) move on to check outputs +31950 { +31951 $mu-stmt-matches-primitive?:check-both-inouts-null: +31952 81 7/subop/compare %esi 0/imm32 +31953 75/jump-if-!= break/disp8 +31954 $mu-stmt-matches-primitive?:stmt-inout-null: +31955 81 7/subop/compare %edi 0/imm32 +31956 0f 84/jump-if-= $mu-stmt-matches-primitive?:check-outputs/disp32 +31957 $mu-stmt-matches-primitive?:stmt-inout-null-and-prim-inout-not-null: +31958 # return false +31959 b8/copy-to-eax 0/imm32/false +31960 e9/jump $mu-stmt-matches-primitive?:end/disp32 +31961 } +31962 # if (curr2 == 0) return false +31963 { +31964 $mu-stmt-matches-primitive?:check-prim-inout-null: +31965 81 7/subop/compare %edi 0/imm32 +31966 75/jump-if-!= break/disp8 +31967 $mu-stmt-matches-primitive?:prim-inout-null: +31968 b8/copy-to-eax 0/imm32/false +31969 e9/jump $mu-stmt-matches-primitive?:end/disp32 +31970 } +31971 # if (curr != curr2) return false +31972 { +31973 $mu-stmt-matches-primitive?:check-inouts-match: +31974 (lookup *edi *(edi+4)) # List-value List-value => eax +31975 (operand-matches-primitive? %esi %eax) # => eax +31976 3d/compare-eax-and 0/imm32/false +31977 75/jump-if-!= break/disp8 +31978 $mu-stmt-matches-primitive?:inouts-match: +31979 b8/copy-to-eax 0/imm32/false +31980 e9/jump $mu-stmt-matches-primitive?:end/disp32 +31981 } +31982 $mu-stmt-matches-primitive?:next-inout: +31983 # curr = lookup(curr->next) +31984 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +31985 89/<- %esi 0/r32/eax +31986 # curr2 = lookup(curr2->next) +31987 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax +31988 89/<- %edi 0/r32/eax +31989 # +31990 e9/jump loop/disp32 +31991 } +31992 $mu-stmt-matches-primitive?:check-outputs: +31993 # var curr/esi: (addr stmt-var) = lookup(stmt->outputs) +31994 (lookup *(ecx+0x14) *(ecx+0x18)) # Stmt1-outputs Stmt1-outputs => eax +31995 89/<- %esi 0/r32/eax +31996 # var curr2/edi: (addr list var) = lookup(primitive->outputs) +31997 (lookup *(edx+0x10) *(edx+0x14)) # Primitive-outputs Primitive-outputs => eax +31998 89/<- %edi 0/r32/eax +31999 { +32000 $mu-stmt-matches-primitive?:outputs-loop: +32001 # if (curr == 0) return (curr2 == 0) +32002 { +32003 $mu-stmt-matches-primitive?:check-both-outputs-null: +32004 81 7/subop/compare %esi 0/imm32 +32005 75/jump-if-!= break/disp8 +32006 { +32007 $mu-stmt-matches-primitive?:stmt-output-null: +32008 81 7/subop/compare %edi 0/imm32 +32009 75/jump-if-!= break/disp8 +32010 $mu-stmt-matches-primitive?:both-outputs-null: +32011 # return true +32012 b8/copy-to-eax 1/imm32 +32013 e9/jump $mu-stmt-matches-primitive?:end/disp32 +32014 } +32015 $mu-stmt-matches-primitive?:stmt-output-null-and-prim-output-not-null: +32016 # return false +32017 b8/copy-to-eax 0/imm32 +32018 e9/jump $mu-stmt-matches-primitive?:end/disp32 +32019 } +32020 # if (curr2 == 0) return false +32021 { +32022 $mu-stmt-matches-primitive?:check-prim-output-null: +32023 81 7/subop/compare %edi 0/imm32 +32024 75/jump-if-!= break/disp8 +32025 $mu-stmt-matches-primitive?:prim-output-is-null: +32026 b8/copy-to-eax 0/imm32 +32027 e9/jump $mu-stmt-matches-primitive?:end/disp32 +32028 } +32029 # if (curr != curr2) return false +32030 { +32031 $mu-stmt-matches-primitive?:check-outputs-match: +32032 (lookup *edi *(edi+4)) # List-value List-value => eax +32033 (operand-matches-primitive? %esi %eax) # => eax +32034 3d/compare-eax-and 0/imm32/false +32035 75/jump-if-!= break/disp8 +32036 $mu-stmt-matches-primitive?:outputs-match: +32037 b8/copy-to-eax 0/imm32 +32038 e9/jump $mu-stmt-matches-primitive?:end/disp32 +32039 } +32040 $mu-stmt-matches-primitive?:next-output: +32041 # curr = lookup(curr->next) +32042 (lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax +32043 89/<- %esi 0/r32/eax +32044 # curr2 = lookup(curr2->next) +32045 (lookup *(edi+8) *(edi+0xc)) # List-next List-next => eax +32046 89/<- %edi 0/r32/eax +32047 # +32048 e9/jump loop/disp32 +32049 } +32050 $mu-stmt-matches-primitive?:return-true: +32051 b8/copy-to-eax 1/imm32 +32052 $mu-stmt-matches-primitive?:end: +32053 # . restore registers +32054 5f/pop-to-edi +32055 5e/pop-to-esi +32056 5b/pop-to-ebx +32057 5a/pop-to-edx +32058 59/pop-to-ecx +32059 # . epilogue +32060 89/<- %esp 5/r32/ebp +32061 5d/pop-to-ebp +32062 c3/return +32063 +32064 operand-matches-primitive?: # s: (addr stmt-var), prim-var: (addr var) -> result/eax: boolean +32065 # . prologue +32066 55/push-ebp +32067 89/<- %ebp 4/r32/esp +32068 # . save registers +32069 51/push-ecx +32070 52/push-edx +32071 53/push-ebx +32072 56/push-esi +32073 57/push-edi +32074 # ecx = s +32075 8b/-> *(ebp+8) 1/r32/ecx +32076 # var var/esi: (addr var) = lookup(s->value) +32077 (lookup *ecx *(ecx+4)) # Stmt-var-value Stmt-var-value => eax +32078 89/<- %esi 0/r32/eax +32079 # edi = prim-var +32080 8b/-> *(ebp+0xc) 7/r32/edi +32081 $operand-matches-primitive?:check-type: +32082 # if !category-match?(var->type, prim-var->type) return false +32083 # . var vtype/ebx: (addr type-tree) = lookup(var->type) +32084 (lookup *(esi+8) *(esi+0xc)) # Var-type Var-type => eax +32085 89/<- %ebx 0/r32/eax +32086 # . if s is deref, vtype = vtype->right +32087 { +32088 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +32089 74/jump-if-= break/disp8 +32090 $operand-matches-primitive?:is-deref: +32091 # . var t/eax: (addr type) +32092 (lookup *(ebx+0xc) *(ebx+0x10)) # Type-tree-right Type-tree-right => eax +32093 # . if !t->is-atom? t = t->left +32094 81 7/subop/compare *eax 0/imm32/false +32095 { +32096 75/jump-if-!= break/disp8 +32097 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +32098 } +32099 # . +32100 89/<- %ebx 0/r32/eax +32101 } +32102 # . var ptype/eax: (addr type-tree) = lookup(prim-var->type) +32103 (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax +32104 (subx-type-category-match? %ebx %eax) # => eax +32105 3d/compare-eax-and 0/imm32/false +32106 0f 84/jump-if-= $operand-matches-primitive?:return-false/disp32 +32107 { +32108 $operand-matches-primitive?:check-register: +32109 # if prim-var is in memory and var is in register but dereference, match +32110 { +32111 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register +32112 0f 85/jump-if-!= break/disp32 +32113 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +32114 74/jump-if-= break/disp8 +32115 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +32116 74/jump-if-= break/disp8 +32117 $operand-matches-primitive?:var-deref-match: +32118 e9/jump $operand-matches-primitive?:return-true/disp32 +32119 } +32120 # if prim-var is in register and var is in register but dereference, no match +32121 { +32122 81 7/subop/compare *(edi+0x18) 0/imm32 # Var-register +32123 0f 84/jump-if-= break/disp32 +32124 81 7/subop/compare *(esi+0x18) 0/imm32 # Var-register +32125 0f 84/jump-if-= break/disp32 +32126 81 7/subop/compare *(ecx+0x10) 0/imm32/false # Stmt-var-is-deref +32127 74/jump-if-= break/disp8 +32128 $operand-matches-primitive?:var-deref-no-match: +32129 e9/jump $operand-matches-primitive?:return-false/disp32 +32130 } +32131 # return false if var->register doesn't match prim-var->register +32132 { +32133 # if register addresses are equal, it's a match +32134 # var vreg/ebx: (addr array byte) = lookup(var->register) +32135 (lookup *(esi+0x18) *(esi+0x1c)) # Var-register Var-register => eax +32136 89/<- %ebx 0/r32/eax +32137 # var preg/ecx: (addr array byte) = lookup(prim-var->register) +32138 (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax +32139 89/<- %ecx 0/r32/eax +32140 # if (vreg == preg) break +32141 39/compare %ecx 3/r32/ebx +32142 74/jump-if-= break/disp8 +32143 $operand-matches-primitive?:var-register-no-match: +32144 # if either address is 0, return false +32145 81 7/subop/compare %ebx 0/imm32 +32146 74/jump-if-= $operand-matches-primitive?:return-false/disp8 +32147 81 7/subop/compare %ecx 0/imm32 +32148 74/jump-if-= $operand-matches-primitive?:return-false/disp8 +32149 # if prim-var->register is wildcard, it's a match +32150 (string-equal? %ecx "*") # Any-register => eax +32151 3d/compare-eax-and 0/imm32/false +32152 75/jump-if-!= break/disp8 +32153 $operand-matches-primitive?:wildcard-no-match: +32154 # if string contents aren't equal, return false +32155 (string-equal? %ecx %ebx) # => eax +32156 3d/compare-eax-and 0/imm32/false +32157 74/jump-if-= $operand-matches-primitive?:return-false/disp8 +32158 } +32159 } +32160 $operand-matches-primitive?:return-true: +32161 b8/copy-to-eax 1/imm32/true +32162 eb/jump $operand-matches-primitive?:end/disp8 +32163 $operand-matches-primitive?:return-false: +32164 b8/copy-to-eax 0/imm32/false +32165 $operand-matches-primitive?:end: +32166 # . restore registers +32167 5f/pop-to-edi +32168 5e/pop-to-esi +32169 5b/pop-to-ebx +32170 5a/pop-to-edx +32171 59/pop-to-ecx +32172 # . epilogue +32173 89/<- %esp 5/r32/ebp +32174 5d/pop-to-ebp +32175 c3/return +32176 +32177 find-matching-function: # functions: (addr function), stmt: (addr stmt) -> result/eax: (addr function) +32178 # . prologue +32179 55/push-ebp +32180 89/<- %ebp 4/r32/esp +32181 # . save registers +32182 51/push-ecx +32183 # var curr/ecx: (handle function) = functions +32184 8b/-> *(ebp+8) 1/r32/ecx +32185 { +32186 # if (curr == null) break +32187 81 7/subop/compare %ecx 0/imm32 +32188 74/jump-if-= break/disp8 +32189 #? (write-buffered Stderr "iter\n") +32190 #? (flush Stderr) +32191 # if match(stmt, curr) return curr +32192 { +32193 (mu-stmt-matches-function? *(ebp+0xc) %ecx) # => eax +32194 3d/compare-eax-and 0/imm32/false +32195 74/jump-if-= break/disp8 +32196 89/<- %eax 1/r32/ecx +32197 eb/jump $find-matching-function:end/disp8 +32198 } +32199 # curr = curr->next +32200 (lookup *(ecx+0x20) *(ecx+0x24)) # Function-next Function-next => eax +32201 89/<- %ecx 0/r32/eax +32202 # +32203 eb/jump loop/disp8 +32204 } +32205 # return null +32206 b8/copy-to-eax 0/imm32 +32207 $find-matching-function:end: +32208 # . restore registers +32209 59/pop-to-ecx +32210 # . epilogue +32211 89/<- %esp 5/r32/ebp +32212 5d/pop-to-ebp +32213 c3/return +32214 +32215 # Just compare names; user-defined functions don't support overloading yet. +32216 mu-stmt-matches-function?: # stmt: (addr stmt1), function: (addr function) -> result/eax: boolean +32217 # . prologue +32218 55/push-ebp +32219 89/<- %ebp 4/r32/esp +32220 # . save registers +32221 51/push-ecx +32222 # return function->name == stmt->operation +32223 # ecx = lookup(stmt->operation) +32224 8b/-> *(ebp+8) 0/r32/eax +32225 (lookup *(eax+4) *(eax+8)) # Stmt1-operation Stmt1-operation => eax +32226 89/<- %ecx 0/r32/eax +32227 # eax = lookup(function->name) +32228 8b/-> *(ebp+0xc) 0/r32/eax +32229 (lookup *eax *(eax+4)) # Function-name Function-name => eax +32230 (string-equal? %eax %ecx) # => eax +32231 $mu-stmt-matches-function?:end: +32232 # . restore registers +32233 59/pop-to-ecx +32234 # . epilogue +32235 89/<- %esp 5/r32/ebp +32236 5d/pop-to-ebp +32237 c3/return +32238 +32239 # Type-checking happens elsewhere. This method is for selecting between +32240 # primitives. +32241 subx-type-category-match?: # a: (addr type-tree), b: (addr type-tree) -> result/eax: boolean +32242 # . prologue +32243 55/push-ebp +32244 89/<- %ebp 4/r32/esp +32245 # . save registers +32246 51/push-ecx +32247 # var cata/ecx: int = type-category(a) +32248 (type-category *(ebp+8)) # => eax +32249 89/<- %ecx 0/r32/eax +32250 # var catb/eax: int = type-category(b) +32251 (type-category *(ebp+0xc)) # => eax +32252 # return cata == catb +32253 39/compare %eax 1/r32/ecx +32254 0f 94/set-byte-if-= %al +32255 81 4/subop/and %eax 0xff/imm32 +32256 $subx-type-category-match?:end: +32257 # . restore registers +32258 59/pop-to-ecx +32259 # . epilogue +32260 89/<- %esp 5/r32/ebp +32261 5d/pop-to-ebp +32262 c3/return +32263 +32264 type-category: # a: (addr type-tree) -> result/eax: int +32265 # . prologue +32266 55/push-ebp +32267 89/<- %ebp 4/r32/esp +32268 # . save registers +32269 51/push-ecx +32270 # var lit?/ecx: boolean = is-literal-type?(a) +32271 (is-simple-mu-type? *(ebp+8) 0) # literal => eax +32272 89/<- %ecx 0/r32/eax +32273 # var float?/eax: int = is-float?(a) +32274 (is-simple-mu-type? *(ebp+8) 0xf) # => eax +32275 # set bits for lit? and float? +32276 c1/shift 4/subop/left %ecx 1/imm8 +32277 09/or %eax 1/r32/ecx +32278 $type-category:end: +32279 # . restore registers +32280 59/pop-to-ecx +32281 # . epilogue +32282 89/<- %esp 5/r32/ebp +32283 5d/pop-to-ebp +32284 c3/return +32285 +32286 is-simple-mu-type?: # a: (addr type-tree), n: type-id -> result/eax: boolean +32287 # . prologue +32288 55/push-ebp +32289 89/<- %ebp 4/r32/esp +32290 # . save registers +32291 51/push-ecx +32292 # ecx = n +32293 8b/-> *(ebp+0xc) 1/r32/ecx +32294 # return (a->value == n) +32295 8b/-> *(ebp+8) 0/r32/eax +32296 39/compare *(eax+4) 1/r32/ecx # Type-tree-value +32297 0f 94/set-byte-if-= %al +32298 81 4/subop/and %eax 0xff/imm32 +32299 $is-simple-mu-type?:end: +32300 # . restore registers +32301 59/pop-to-ecx +32302 # . epilogue +32303 89/<- %esp 5/r32/ebp +32304 5d/pop-to-ebp +32305 c3/return +32306 +32307 is-mu-addr-type?: # a: (addr type-tree) -> result/eax: boolean +32308 # . prologue +32309 55/push-ebp +32310 89/<- %ebp 4/r32/esp +32311 # eax = a +32312 8b/-> *(ebp+8) 0/r32/eax +32313 # if (!a->is-atom?) a = a->left +32314 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +32315 { +32316 75/jump-if-!= break/disp8 +32317 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +32318 } +32319 # return (a->value == addr) +32320 81 7/subop/compare *(eax+4) 2/imm32/addr # Type-tree-value +32321 0f 94/set-byte-if-= %al +32322 81 4/subop/and %eax 0xff/imm32 +32323 $is-mu-addr-type?:end: +32324 # . epilogue +32325 89/<- %esp 5/r32/ebp +32326 5d/pop-to-ebp +32327 c3/return +32328 +32329 is-mu-array-type?: # a: (addr type-tree) -> result/eax: boolean +32330 # . prologue +32331 55/push-ebp +32332 89/<- %ebp 4/r32/esp +32333 # eax = a +32334 8b/-> *(ebp+8) 0/r32/eax +32335 # if (!a->is-atom?) a = a->left +32336 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +32337 { +32338 75/jump-if-!= break/disp8 +32339 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +32340 } +32341 # return (a->value == array) +32342 81 7/subop/compare *(eax+4) 3/imm32/array # Type-tree-value +32343 0f 94/set-byte-if-= %al +32344 81 4/subop/and %eax 0xff/imm32 +32345 $is-mu-array-type?:end: +32346 # . epilogue +32347 89/<- %esp 5/r32/ebp +32348 5d/pop-to-ebp +32349 c3/return +32350 +32351 is-mu-string-type?: # a: (addr type-tree) -> result/eax: boolean +32352 # . prologue +32353 55/push-ebp +32354 89/<- %ebp 4/r32/esp +32355 # . save registers +32356 56/push-esi +32357 # esi = a +32358 8b/-> *(ebp+8) 6/r32/esi +32359 # if (a->is-atom?) return false +32360 81 7/subop/compare *esi 0/imm32/false # Type-tree-is-atom +32361 0f 85/jump-if-!= $is-mu-string-type?:return-false/disp32 +32362 # if a is not an addr, return false +32363 (is-mu-addr-type? %esi) # => eax +32364 3d/compare-eax-with 0/imm32/false +32365 0f 84/jump-if-= $is-mu-string-type?:end/disp32 # eax changes var +32366 # if a is not an array, return false +32367 (lookup *(esi+0xc) *(esi+0x10)) # Type-tree-right Type-tree-right => eax +32368 (is-mu-array-type? %eax) # => eax +32369 3d/compare-eax-with 0/imm32/false +32370 74/jump-if-= $is-mu-string-type?:end/disp8 # eax changes var +32371 # var p/eax: (addr type-tree) = payload of a +32372 (lookup *(esi+0xc) *(esi+0x10)) # Type-tree-right Type-tree-right => eax +32373 (lookup *(eax+0xc) *(eax+0x10)) # Type-tree-right Type-tree-right => eax +32374 # if p is an atom, return false +32375 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +32376 75/jump-if-!= $is-mu-string-type?:return-false/disp8 +32377 # return (p == byte) +32378 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +32379 (is-simple-mu-type? %eax 8) # byte => eax +32380 eb/jump $is-mu-string-type?:end/disp8 +32381 $is-mu-string-type?:return-false: +32382 b8/copy-to-eax 0/imm32/false +32383 $is-mu-string-type?:end: +32384 # . restore registers +32385 5e/pop-to-esi +32386 # . epilogue +32387 89/<- %esp 5/r32/ebp +32388 5d/pop-to-ebp +32389 c3/return +32390 +32391 is-mu-stream-type?: # a: (addr type-tree) -> result/eax: boolean +32392 # . prologue +32393 55/push-ebp +32394 89/<- %ebp 4/r32/esp +32395 # eax = a +32396 8b/-> *(ebp+8) 0/r32/eax +32397 # if (!a->is-atom?) a = a->left +32398 81 7/subop/compare *eax 0/imm32/false # Type-tree-is-atom +32399 { +32400 75/jump-if-!= break/disp8 +32401 (lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax +32402 } +32403 # return (a->value == stream) +32404 81 7/subop/compare *(eax+4) 0xb/imm32/stream # Type-tree-value +32405 0f 94/set-byte-if-= %al +32406 81 4/subop/and %eax 0xff/imm32 +32407 $is-mu-stream-type?:end: +32408 # . epilogue +32409 89/<- %esp 5/r32/ebp +32410 5d/pop-to-ebp +32411 c3/return +32412 +32413 test-emit-subx-stmt-primitive: +32414 # Primitive operation on a variable on the stack. +32415 # increment foo +32416 # => +32417 # ff 0/subop/increment *(ebp-8) +32418 # +32419 # There's a variable on the var stack as follows: +32420 # name: 'foo' +32421 # type: int +32422 # stack-offset: -8 +32423 # +32424 # There's a primitive with this info: +32425 # name: 'increment' +32426 # inouts: int/mem +32427 # value: 'ff 0/subop/increment' +32428 # +32429 # . prologue +32430 55/push-ebp +32431 89/<- %ebp 4/r32/esp +32432 # setup +32433 (clear-stream _test-output-stream) +32434 (clear-stream $_test-output-buffered-file->buffer) +32435 # simulate allocated payloads starting with an initial fake alloc-id (0x11) +32436 $test-emit-subx-stmt-primitive:initialize-type: +32437 # var type/ecx: (payload type-tree) = int +32438 68/push 0/imm32/right:null +32439 68/push 0/imm32/right:null +32440 68/push 0/imm32/left:unused +32441 68/push 1/imm32/value:int +32442 68/push 1/imm32/is-atom?:true +32443 68/push 0x11/imm32/alloc-id:fake:payload +32444 89/<- %ecx 4/r32/esp +32445 $test-emit-subx-stmt-primitive:initialize-var: +32446 # var var-foo/ecx: (payload var) = var(type) +32447 68/push 0/imm32/no-register +32448 68/push 0/imm32/no-register +32449 68/push -8/imm32/stack-offset +32450 68/push 1/imm32/block-depth +32451 51/push-ecx/type 32452 68/push 0x11/imm32/alloc-id:fake -32453 68/push 0x11/imm32/alloc-id:fake:payload -32454 89/<- %edi 4/r32/esp -32455 $test-add-reg-to-reg:initialize-stmt: -32456 # var stmt/esi: (addr statement) -32457 68/push 0/imm32/next -32458 68/push 0/imm32/next -32459 57/push-edi/outputs -32460 68/push 0x11/imm32/alloc-id:fake -32461 56/push-esi/inouts -32462 68/push 0x11/imm32/alloc-id:fake -32463 68/push 0/imm32/operation -32464 68/push 0/imm32/operation -32465 68/push 1/imm32/tag:stmt1 -32466 89/<- %esi 4/r32/esp -32467 $test-add-reg-to-reg:initialize-stmt-operation: -32468 # stmt->operation = "add" -32469 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -32470 (copy-array Heap "add" %eax) -32471 # convert -32472 c7 0/subop/copy *Curr-block-depth 0/imm32 -32473 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -32474 (flush _test-output-buffered-file) -32475 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -32481 # check output -32482 (check-next-stream-line-equal _test-output-stream "01/add-to %eax 0x00000001/r32" "F - test-add-reg-to-reg") -32483 # . epilogue -32484 89/<- %esp 5/r32/ebp -32485 5d/pop-to-ebp -32486 c3/return -32487 -32488 test-add-reg-to-mem: -32489 # add-to var1 var2/reg -32490 # => -32491 # 01/add-to *(ebp+__) var2 -32492 # -32493 # . prologue -32494 55/push-ebp -32495 89/<- %ebp 4/r32/esp -32496 # setup -32497 (clear-stream _test-output-stream) -32498 (clear-stream $_test-output-buffered-file->buffer) -32499 $test-add-reg-to-mem:initialize-type: -32500 # var type/ecx: (payload type-tree) = int -32501 68/push 0/imm32/right:null -32502 68/push 0/imm32/right:null -32503 68/push 0/imm32/left:unused -32504 68/push 1/imm32/value:int -32505 68/push 1/imm32/is-atom?:true -32506 68/push 0x11/imm32/alloc-id:fake:payload -32507 89/<- %ecx 4/r32/esp -32508 $test-add-reg-to-mem:initialize-var1: -32509 # var var1/ecx: (payload var) -32510 68/push 0/imm32/register -32511 68/push 0/imm32/register -32512 68/push 8/imm32/stack-offset -32513 68/push 1/imm32/block-depth -32514 51/push-ecx -32515 68/push 0x11/imm32/alloc-id:fake -32516 68/push 0/imm32/name -32517 68/push 0/imm32/name -32518 68/push 0x11/imm32/alloc-id:fake:payload -32519 89/<- %ecx 4/r32/esp -32520 $test-add-reg-to-mem:initialize-var1-name: -32521 # var1->name = "var1" -32522 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -32523 (copy-array Heap "var1" %eax) -32524 $test-add-reg-to-mem:initialize-var2: -32525 # var var2/edx: (payload var) -32526 68/push 0/imm32/register -32527 68/push 0/imm32/register -32528 68/push 0/imm32/no-stack-offset -32529 68/push 1/imm32/block-depth -32530 ff 6/subop/push *(ecx+0x10) -32531 68/push 0x11/imm32/alloc-id:fake -32532 68/push 0/imm32/name -32533 68/push 0/imm32/name -32534 68/push 0x11/imm32/alloc-id:fake:payload -32535 89/<- %edx 4/r32/esp -32536 $test-add-reg-to-mem:initialize-var2-name: -32537 # var2->name = "var2" -32538 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -32539 (copy-array Heap "var2" %eax) -32540 $test-add-reg-to-mem:initialize-var2-register: -32541 # var2->register = "ecx" -32542 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 -32543 (copy-array Heap "ecx" %eax) -32544 $test-add-reg-to-mem:initialize-inouts: -32545 # var inouts/esi: (payload stmt-var) = [var2] -32546 68/push 0/imm32/is-deref:false -32547 68/push 0/imm32/next -32548 68/push 0/imm32/next -32549 52/push-edx/var2 -32550 68/push 0x11/imm32/alloc-id:fake -32551 68/push 0x11/imm32/alloc-id:fake:payload -32552 89/<- %esi 4/r32/esp -32553 # inouts = [var1, var2] -32554 68/push 0/imm32/is-deref:false -32555 56/push-esi/next -32556 68/push 0x11/imm32/alloc-id:fake -32557 51/push-ecx/var1 -32558 68/push 0x11/imm32/alloc-id:fake -32559 68/push 0x11/imm32/alloc-id:fake:payload -32560 89/<- %esi 4/r32/esp -32561 $test-add-reg-to-mem:initialize-stmt: -32562 # var stmt/esi: (addr statement) -32563 68/push 0/imm32/next -32564 68/push 0/imm32/next -32565 68/push 0/imm32/outputs -32566 68/push 0/imm32/outputs -32567 56/push-esi/inouts -32568 68/push 0x11/imm32/alloc-id:fake -32569 68/push 0/imm32/operation -32570 68/push 0/imm32/operation -32571 68/push 1/imm32/tag:stmt1 -32572 89/<- %esi 4/r32/esp -32573 $test-add-reg-to-mem:initialize-stmt-operation: -32574 # stmt->operation = "add-to" -32575 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -32576 (copy-array Heap "add-to" %eax) -32577 # convert -32578 c7 0/subop/copy *Curr-block-depth 0/imm32 -32579 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -32580 (flush _test-output-buffered-file) -32581 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -32587 # check output -32588 (check-next-stream-line-equal _test-output-stream "01/add-to *(ebp+0x00000008) 0x00000001/r32" "F - test-add-reg-to-mem") -32589 # . epilogue -32590 89/<- %esp 5/r32/ebp -32591 5d/pop-to-ebp -32592 c3/return -32593 -32594 test-add-mem-to-reg: -32595 # var1/reg <- add var2 -32596 # => -32597 # 03/add *(ebp+__) var1 -32598 # -32599 # . prologue -32600 55/push-ebp -32601 89/<- %ebp 4/r32/esp -32602 # setup -32603 (clear-stream _test-output-stream) -32604 (clear-stream $_test-output-buffered-file->buffer) -32605 $test-add-mem-to-reg:initialize-type: -32606 # var type/ecx: (payload type-tree) = int -32607 68/push 0/imm32/right:null -32608 68/push 0/imm32/right:null -32609 68/push 0/imm32/left:unused -32610 68/push 1/imm32/value:int -32611 68/push 1/imm32/is-atom?:true +32453 68/push 0/imm32/name +32454 68/push 0/imm32/name +32455 68/push 0x11/imm32/alloc-id:fake:payload +32456 89/<- %ecx 4/r32/esp +32457 $test-emit-subx-stmt-primitive:initialize-var-name: +32458 # var-foo->name = "foo" +32459 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +32460 (copy-array Heap "foo" %eax) +32461 $test-emit-subx-stmt-primitive:initialize-stmt-var: +32462 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) +32463 68/push 0/imm32/is-deref:false +32464 68/push 0/imm32/next +32465 68/push 0/imm32/next +32466 51/push-ecx/var-foo +32467 68/push 0x11/imm32/alloc-id:fake +32468 68/push 0x11/imm32/alloc-id:fake:payload +32469 89/<- %ebx 4/r32/esp +32470 $test-emit-subx-stmt-primitive:initialize-stmt: +32471 # var stmt/esi: (addr statement) +32472 68/push 0/imm32/no-outputs +32473 68/push 0/imm32/no-outputs +32474 53/push-ebx/inouts +32475 68/push 0x11/imm32/alloc-id:fake +32476 68/push 0/imm32/operation +32477 68/push 0/imm32/operation +32478 68/push 1/imm32/tag +32479 89/<- %esi 4/r32/esp +32480 $test-emit-subx-stmt-primitive:initialize-stmt-operation: +32481 # stmt->operation = "increment" +32482 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +32483 (copy-array Heap "increment" %eax) +32484 $test-emit-subx-stmt-primitive:initialize-primitive: +32485 # var primitives/ebx: (addr primitive) +32486 68/push 0/imm32/next +32487 68/push 0/imm32/next +32488 68/push 0/imm32/no-x32 +32489 68/push 0/imm32/no-xm32 +32490 68/push 0/imm32/no-disp32 +32491 68/push 0/imm32/no-imm8 +32492 68/push 0/imm32/no-imm32 +32493 68/push 0/imm32/no-r32 +32494 68/push 1/imm32/rm32-is-first-inout +32495 68/push 0/imm32/subx-name +32496 68/push 0/imm32/subx-name +32497 68/push 0/imm32/no-outputs +32498 68/push 0/imm32/no-outputs +32499 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration +32500 68/push 0x11/imm32/alloc-id:fake +32501 68/push 0/imm32/name +32502 68/push 0/imm32/name +32503 89/<- %ebx 4/r32/esp +32504 $test-emit-subx-stmt-primitive:initialize-primitive-name: +32505 # primitives->name = "increment" +32506 (copy-array Heap "increment" %ebx) # Primitive-name +32507 $test-emit-subx-stmt-primitive:initialize-primitive-subx-name: +32508 # primitives->subx-name = "ff 0/subop/increment" +32509 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +32510 (copy-array Heap "ff 0/subop/increment" %eax) +32511 # convert +32512 c7 0/subop/copy *Curr-block-depth 0/imm32 +32513 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) +32514 (flush _test-output-buffered-file) +32515 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +32521 # check output +32522 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment *(ebp+0xfffffff8)" "F - test-emit-subx-stmt-primitive") +32523 # . epilogue +32524 89/<- %esp 5/r32/ebp +32525 5d/pop-to-ebp +32526 c3/return +32527 +32528 test-emit-subx-stmt-primitive-register: +32529 # Primitive operation on a variable in a register. +32530 # foo <- increment +32531 # => +32532 # ff 0/subop/increment %eax # sub-optimal, but should suffice +32533 # +32534 # There's a variable on the var stack as follows: +32535 # name: 'foo' +32536 # type: int +32537 # register: 'eax' +32538 # +32539 # There's a primitive with this info: +32540 # name: 'increment' +32541 # out: int/reg +32542 # value: 'ff 0/subop/increment' +32543 # +32544 # . prologue +32545 55/push-ebp +32546 89/<- %ebp 4/r32/esp +32547 # setup +32548 (clear-stream _test-output-stream) +32549 (clear-stream $_test-output-buffered-file->buffer) +32550 $test-emit-subx-stmt-primitive-register:initialize-type: +32551 # var type/ecx: (payload type-tree) = int +32552 68/push 0/imm32/right:null +32553 68/push 0/imm32/right:null +32554 68/push 0/imm32/left:unused +32555 68/push 1/imm32/value:int +32556 68/push 1/imm32/is-atom?:true +32557 68/push 0x11/imm32/alloc-id:fake:payload +32558 89/<- %ecx 4/r32/esp +32559 $test-emit-subx-stmt-primitive-register:initialize-var: +32560 # var var-foo/ecx: (payload var) +32561 68/push 0/imm32/register +32562 68/push 0/imm32/register +32563 68/push 0/imm32/no-stack-offset +32564 68/push 1/imm32/block-depth +32565 51/push-ecx +32566 68/push 0x11/imm32/alloc-id:fake +32567 68/push 0/imm32/name +32568 68/push 0/imm32/name +32569 68/push 0x11/imm32/alloc-id:fake:payload +32570 89/<- %ecx 4/r32/esp +32571 $test-emit-subx-stmt-primitive-register:initialize-var-name: +32572 # var-foo->name = "foo" +32573 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +32574 (copy-array Heap "foo" %eax) +32575 $test-emit-subx-stmt-primitive-register:initialize-var-register: +32576 # var-foo->register = "eax" +32577 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +32578 (copy-array Heap "eax" %eax) +32579 $test-emit-subx-stmt-primitive-register:initialize-stmt-var: +32580 # var operand/ebx: (payload stmt-var) +32581 68/push 0/imm32/is-deref:false +32582 68/push 0/imm32/next +32583 68/push 0/imm32/next +32584 51/push-ecx/var-foo +32585 68/push 0x11/imm32/alloc-id:fake +32586 68/push 0x11/imm32/alloc-id:fake:payload +32587 89/<- %ebx 4/r32/esp +32588 $test-emit-subx-stmt-primitive-register:initialize-stmt: +32589 # var stmt/esi: (addr statement) +32590 53/push-ebx/outputs +32591 68/push 0x11/imm32/alloc-id:fake +32592 68/push 0/imm32/no-inouts +32593 68/push 0/imm32/no-inouts +32594 68/push 0/imm32/operation +32595 68/push 0/imm32/operation +32596 68/push 1/imm32 +32597 89/<- %esi 4/r32/esp +32598 $test-emit-subx-stmt-primitive-register:initialize-stmt-operation: +32599 # stmt->operation = "increment" +32600 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +32601 (copy-array Heap "increment" %eax) +32602 $test-emit-subx-stmt-primitive-register:initialize-formal-var: +32603 # var formal-var/ebx: (payload var) +32604 68/push 0/imm32/register +32605 68/push 0/imm32/register +32606 68/push 0/imm32/no-stack-offset +32607 68/push 1/imm32/block-depth +32608 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id +32609 68/push 0x11/imm32/alloc-id:fake +32610 68/push 0/imm32/name +32611 68/push 0/imm32/name 32612 68/push 0x11/imm32/alloc-id:fake:payload -32613 89/<- %ecx 4/r32/esp -32614 $test-add-mem-to-reg:initialize-var: -32615 # var var1/ecx: (payload var) -32616 68/push 0/imm32/register -32617 68/push 0/imm32/register -32618 68/push 0/imm32/no-stack-offset -32619 68/push 1/imm32/block-depth -32620 51/push-ecx -32621 68/push 0x11/imm32/alloc-id:fake -32622 68/push 0/imm32/name -32623 68/push 0/imm32/name -32624 68/push 0x11/imm32/alloc-id:fake:payload -32625 89/<- %ecx 4/r32/esp -32626 $test-add-mem-to-reg:initialize-var-name: -32627 # var1->name = "foo" -32628 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -32629 (copy-array Heap "var1" %eax) -32630 $test-add-mem-to-reg:initialize-var-register: -32631 # var1->register = "eax" -32632 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -32633 (copy-array Heap "eax" %eax) -32634 $test-add-mem-to-reg:initialize-var2: -32635 # var var2/edx: (payload var) -32636 68/push 0/imm32/register -32637 68/push 0/imm32/register -32638 68/push 8/imm32/stack-offset -32639 68/push 1/imm32/block-depth -32640 ff 6/subop/push *(ecx+0x10) -32641 68/push 0x11/imm32/alloc-id:fake -32642 68/push 0/imm32/name -32643 68/push 0/imm32/name -32644 68/push 0x11/imm32/alloc-id:fake:payload -32645 89/<- %edx 4/r32/esp -32646 $test-add-mem-to-reg:initialize-var2-name: -32647 # var2->name = "var2" -32648 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -32649 (copy-array Heap "var2" %eax) -32650 $test-add-mem-to-reg:initialize-inouts: -32651 # var inouts/esi: (payload stmt-var) = [var2] -32652 68/push 0/imm32/is-deref:false -32653 68/push 0/imm32/next -32654 68/push 0/imm32/next -32655 52/push-edx/var2 -32656 68/push 0x11/imm32/alloc-id:fake -32657 68/push 0x11/imm32/alloc-id:fake:payload -32658 89/<- %esi 4/r32/esp -32659 $test-add-mem-to-reg:initialize-outputs: -32660 # var outputs/edi: (payload stmt-var) = [var1] -32661 68/push 0/imm32/is-deref:false -32662 68/push 0/imm32/next -32663 68/push 0/imm32/next -32664 51/push-ecx/var1 -32665 68/push 0x11/imm32/alloc-id:fake -32666 68/push 0x11/imm32/alloc-id:fake:payload -32667 89/<- %edi 4/r32/esp -32668 $test-add-mem-to-reg:initialize-stmt: -32669 # var stmt/esi: (addr statement) -32670 68/push 0/imm32/next -32671 68/push 0/imm32/next -32672 57/push-edi/outputs -32673 68/push 0x11/imm32/alloc-id:fake -32674 56/push-esi/inouts -32675 68/push 0x11/imm32/alloc-id:fake -32676 68/push 0/imm32/operation -32677 68/push 0/imm32/operation -32678 68/push 1/imm32/tag:stmt1 -32679 89/<- %esi 4/r32/esp -32680 $test-add-mem-to-reg:initialize-stmt-operation: -32681 # stmt->operation = "add" -32682 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -32683 (copy-array Heap "add" %eax) -32684 # convert -32685 c7 0/subop/copy *Curr-block-depth 0/imm32 -32686 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -32687 (flush _test-output-buffered-file) -32688 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -32694 # check output -32695 (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x00000008) 0x00000000/r32" "F - test-add-mem-to-reg") -32696 # . epilogue -32697 89/<- %esp 5/r32/ebp -32698 5d/pop-to-ebp -32699 c3/return -32700 -32701 test-add-literal-to-eax: -32702 # var1/eax <- add 0x34 -32703 # => -32704 # 05/add-to-eax 0x34/imm32 -32705 # -32706 # . prologue -32707 55/push-ebp -32708 89/<- %ebp 4/r32/esp -32709 # setup -32710 (clear-stream _test-output-stream) -32711 (clear-stream $_test-output-buffered-file->buffer) -32712 $test-add-literal-to-eax:initialize-var-type: -32713 # var type/ecx: (payload type-tree) = int -32714 68/push 0/imm32/right:null -32715 68/push 0/imm32/right:null -32716 68/push 0/imm32/left:unused -32717 68/push 1/imm32/value:int -32718 68/push 1/imm32/is-atom?:true -32719 68/push 0x11/imm32/alloc-id:fake:payload -32720 89/<- %ecx 4/r32/esp -32721 $test-add-literal-to-eax:initialize-var: -32722 # var v/ecx: (payload var) -32723 68/push 0/imm32/register -32724 68/push 0/imm32/register -32725 68/push 0/imm32/no-stack-offset -32726 68/push 1/imm32/block-depth -32727 51/push-ecx -32728 68/push 0x11/imm32/alloc-id:fake -32729 68/push 0/imm32/name -32730 68/push 0/imm32/name -32731 68/push 0x11/imm32/alloc-id:fake:payload -32732 89/<- %ecx 4/r32/esp -32733 $test-add-literal-to-eax:initialize-var-name: -32734 # v->name = "v" -32735 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -32736 (copy-array Heap "v" %eax) -32737 $test-add-literal-to-eax:initialize-var-register: -32738 # v->register = "eax" -32739 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -32740 (copy-array Heap "eax" %eax) -32741 $test-add-literal-to-eax:initialize-literal-type: -32742 # var type/edx: (payload type-tree) = literal -32743 68/push 0/imm32/right:null -32744 68/push 0/imm32/right:null -32745 68/push 0/imm32/left:unused -32746 68/push 0/imm32/value:literal -32747 68/push 1/imm32/is-atom?:true -32748 68/push 0x11/imm32/alloc-id:fake:payload -32749 89/<- %edx 4/r32/esp -32750 $test-add-literal-to-eax:initialize-literal: -32751 # var l/edx: (payload var) -32752 68/push 0/imm32/register +32613 89/<- %ebx 4/r32/esp +32614 $test-emit-subx-stmt-primitive-register:initialize-formal-var-name: +32615 # formal-var->name = "dummy" +32616 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 +32617 (copy-array Heap "dummy" %eax) +32618 $test-emit-subx-stmt-primitive-register:initialize-formal-register: +32619 # formal-var->register = "*" +32620 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 +32621 (copy-array Heap "*" %eax) # Any-register +32622 $test-emit-subx-stmt-primitive-register:initialize-var-list: +32623 # var formal-outputs/ebx: (payload list var) +32624 68/push 0/imm32/next +32625 68/push 0/imm32/next +32626 53/push-ebx/formal-var +32627 68/push 0x11/imm32/alloc-id:fake +32628 68/push 0x11/imm32/alloc-id:fake:payload +32629 89/<- %ebx 4/r32/esp +32630 $test-emit-subx-stmt-primitive-register:initialize-primitive: +32631 # var primitives/ebx: (addr primitive) +32632 68/push 0/imm32/next +32633 68/push 0/imm32/next +32634 68/push 0/imm32/no-x32 +32635 68/push 0/imm32/no-xm32 +32636 68/push 0/imm32/no-disp32 +32637 68/push 0/imm32/no-imm8 +32638 68/push 0/imm32/no-imm32 +32639 68/push 0/imm32/no-r32 +32640 68/push 3/imm32/rm32-is-first-output +32641 68/push 0/imm32/subx-name +32642 68/push 0/imm32/subx-name +32643 53/push-ebx/outputs +32644 68/push 0x11/imm32/alloc-id:fake +32645 68/push 0/imm32/no-inouts +32646 68/push 0/imm32/no-inouts +32647 68/push 0/imm32/name +32648 68/push 0/imm32/name +32649 89/<- %ebx 4/r32/esp +32650 $test-emit-subx-stmt-primitive-register:initialize-primitive-name: +32651 # primitives->name = "increment" +32652 (copy-array Heap "increment" %ebx) # Primitive-name +32653 $test-emit-subx-stmt-primitive-register:initialize-primitive-subx-name: +32654 # primitives->subx-name = "ff 0/subop/increment" +32655 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +32656 (copy-array Heap "ff 0/subop/increment" %eax) +32657 # convert +32658 c7 0/subop/copy *Curr-block-depth 0/imm32 +32659 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) +32660 (flush _test-output-buffered-file) +32661 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +32667 # check output +32668 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-primitive-register") +32669 # . epilogue +32670 89/<- %esp 5/r32/ebp +32671 5d/pop-to-ebp +32672 c3/return +32673 +32674 test-emit-subx-stmt-select-primitive: +32675 # Select the right primitive between overloads. +32676 # foo <- increment +32677 # => +32678 # ff 0/subop/increment %eax # sub-optimal, but should suffice +32679 # +32680 # There's a variable on the var stack as follows: +32681 # name: 'foo' +32682 # type: int +32683 # register: 'eax' +32684 # +32685 # There's two primitives, as follows: +32686 # - name: 'increment' +32687 # out: int/reg +32688 # value: 'ff 0/subop/increment' +32689 # - name: 'increment' +32690 # inout: int/mem +32691 # value: 'ff 0/subop/increment' +32692 # +32693 # . prologue +32694 55/push-ebp +32695 89/<- %ebp 4/r32/esp +32696 # setup +32697 (clear-stream _test-output-stream) +32698 (clear-stream $_test-output-buffered-file->buffer) +32699 $test-emit-subx-stmt-select-primitive:initialize-type: +32700 # var type/ecx: (payload type-tree) = int +32701 68/push 0/imm32/right:null +32702 68/push 0/imm32/right:null +32703 68/push 0/imm32/left:unused +32704 68/push 1/imm32/value:int +32705 68/push 1/imm32/is-atom?:true +32706 68/push 0x11/imm32/alloc-id:fake:payload +32707 89/<- %ecx 4/r32/esp +32708 $test-emit-subx-stmt-select-primitive:initialize-var: +32709 # var var-foo/ecx: (payload var) +32710 68/push 0/imm32/register +32711 68/push 0/imm32/register +32712 68/push 0/imm32/no-stack-offset +32713 68/push 1/imm32/block-depth +32714 51/push-ecx +32715 68/push 0x11/imm32/alloc-id:fake +32716 68/push 0/imm32/name +32717 68/push 0/imm32/name +32718 68/push 0x11/imm32/alloc-id:fake:payload +32719 89/<- %ecx 4/r32/esp +32720 $test-emit-subx-stmt-select-primitive:initialize-var-name: +32721 # var-foo->name = "foo" +32722 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +32723 (copy-array Heap "foo" %eax) +32724 $test-emit-subx-stmt-select-primitive:initialize-var-register: +32725 # var-foo->register = "eax" +32726 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +32727 (copy-array Heap "eax" %eax) +32728 $test-emit-subx-stmt-select-primitive:initialize-stmt-var: +32729 # var operand/ebx: (payload stmt-var) +32730 68/push 0/imm32/is-deref:false +32731 68/push 0/imm32/next +32732 68/push 0/imm32/next +32733 51/push-ecx/var-foo +32734 68/push 0x11/imm32/alloc-id:fake +32735 68/push 0x11/imm32/alloc-id:fake:payload +32736 89/<- %ebx 4/r32/esp +32737 $test-emit-subx-stmt-select-primitive:initialize-stmt: +32738 # var stmt/esi: (addr statement) +32739 53/push-ebx/outputs +32740 68/push 0x11/imm32/alloc-id:fake +32741 68/push 0/imm32/no-inouts +32742 68/push 0/imm32/no-inouts +32743 68/push 0/imm32/operation +32744 68/push 0/imm32/operation +32745 68/push 1/imm32 +32746 89/<- %esi 4/r32/esp +32747 $test-emit-subx-stmt-select-primitive:initialize-stmt-operation: +32748 # stmt->operation = "increment" +32749 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +32750 (copy-array Heap "increment" %eax) +32751 $test-emit-subx-stmt-select-primitive:initialize-formal-var: +32752 # var formal-var/ebx: (payload var) 32753 68/push 0/imm32/register -32754 68/push 0/imm32/no-stack-offset -32755 68/push 1/imm32/block-depth -32756 52/push-edx -32757 68/push 0x11/imm32/alloc-id:fake -32758 68/push 0/imm32/name +32754 68/push 0/imm32/register +32755 68/push 0/imm32/no-stack-offset +32756 68/push 1/imm32/block-depth +32757 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id +32758 68/push 0x11/imm32/alloc-id:fake 32759 68/push 0/imm32/name -32760 68/push 0x11/imm32/alloc-id:fake:payload -32761 89/<- %edx 4/r32/esp -32762 $test-add-literal-to-eax:initialize-literal-value: -32763 # l->name = "0x34" -32764 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -32765 (copy-array Heap "0x34" %eax) -32766 $test-add-literal-to-eax:initialize-inouts: -32767 # var inouts/esi: (payload stmt-var) = [l] -32768 68/push 0/imm32/is-deref:false -32769 68/push 0/imm32/next -32770 68/push 0/imm32/next -32771 52/push-edx/l -32772 68/push 0x11/imm32/alloc-id:fake -32773 68/push 0x11/imm32/alloc-id:fake:payload -32774 89/<- %esi 4/r32/esp -32775 $test-add-literal-to-eax:initialize-outputs: -32776 # var outputs/edi: (payload stmt-var) = [v] -32777 68/push 0/imm32/is-deref:false -32778 68/push 0/imm32/next -32779 68/push 0/imm32/next -32780 51/push-ecx/v -32781 68/push 0x11/imm32/alloc-id:fake -32782 68/push 0x11/imm32/alloc-id:fake:payload -32783 89/<- %edi 4/r32/esp -32784 $test-add-literal-to-eax:initialize-stmt: -32785 # var stmt/esi: (addr statement) -32786 68/push 0/imm32/next -32787 68/push 0/imm32/next -32788 57/push-edi/outputs -32789 68/push 0x11/imm32/alloc-id:fake -32790 56/push-esi/inouts -32791 68/push 0x11/imm32/alloc-id:fake -32792 68/push 0/imm32/operation -32793 68/push 0/imm32/operation -32794 68/push 1/imm32/tag:stmt1 -32795 89/<- %esi 4/r32/esp -32796 $test-add-literal-to-eax:initialize-stmt-operation: -32797 # stmt->operation = "add" -32798 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -32799 (copy-array Heap "add" %eax) -32800 # convert -32801 c7 0/subop/copy *Curr-block-depth 0/imm32 -32802 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -32803 (flush _test-output-buffered-file) -32804 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -32810 # check output -32811 (check-next-stream-line-equal _test-output-stream "05/add-to-eax 0x34/imm32" "F - test-add-literal-to-eax") -32812 # . epilogue -32813 89/<- %esp 5/r32/ebp -32814 5d/pop-to-ebp -32815 c3/return -32816 -32817 test-add-literal-to-reg: -32818 # var1/ecx <- add 0x34 -32819 # => -32820 # 81 0/subop/add %ecx 0x34/imm32 -32821 # -32822 # . prologue -32823 55/push-ebp -32824 89/<- %ebp 4/r32/esp -32825 # setup -32826 (clear-stream _test-output-stream) -32827 (clear-stream $_test-output-buffered-file->buffer) -32828 $test-add-literal-to-reg:initialize-var-type: -32829 # var type/ecx: (payload type-tree) = int -32830 68/push 0/imm32/right:null -32831 68/push 0/imm32/right:null -32832 68/push 0/imm32/left:unused -32833 68/push 1/imm32/value:int -32834 68/push 1/imm32/is-atom?:true -32835 68/push 0x11/imm32/alloc-id:fake:payload -32836 89/<- %ecx 4/r32/esp -32837 $test-add-literal-to-reg:initialize-var: -32838 # var v/ecx: (payload var) -32839 68/push 0/imm32/register -32840 68/push 0/imm32/register -32841 68/push 0/imm32/no-stack-offset -32842 68/push 1/imm32/block-depth -32843 51/push-ecx -32844 68/push 0x11/imm32/alloc-id:fake -32845 68/push 0/imm32/name -32846 68/push 0/imm32/name -32847 68/push 0x11/imm32/alloc-id:fake:payload -32848 89/<- %ecx 4/r32/esp -32849 $test-add-literal-to-reg:initialize-var-name: -32850 # v->name = "v" -32851 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -32852 (copy-array Heap "v" %eax) -32853 $test-add-literal-to-reg:initialize-var-register: -32854 # v->register = "ecx" -32855 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -32856 (copy-array Heap "ecx" %eax) -32857 $test-add-literal-to-reg:initialize-literal-type: -32858 # var type/edx: (payload type-tree) = literal -32859 68/push 0/imm32/right:null -32860 68/push 0/imm32/right:null -32861 68/push 0/imm32/left:unused -32862 68/push 0/imm32/value:literal -32863 68/push 1/imm32/is-atom?:true -32864 68/push 0x11/imm32/alloc-id:fake:payload -32865 89/<- %edx 4/r32/esp -32866 $test-add-literal-to-reg:initialize-literal: -32867 # var l/edx: (payload var) -32868 68/push 0/imm32/register -32869 68/push 0/imm32/register -32870 68/push 0/imm32/no-stack-offset -32871 68/push 1/imm32/block-depth -32872 52/push-edx -32873 68/push 0x11/imm32/alloc-id:fake -32874 68/push 0/imm32/name -32875 68/push 0/imm32/name -32876 68/push 0x11/imm32/alloc-id:fake:payload -32877 89/<- %edx 4/r32/esp -32878 $test-add-literal-to-reg:initialize-literal-value: -32879 # l->name = "0x34" -32880 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -32881 (copy-array Heap "0x34" %eax) -32882 $test-add-literal-to-reg:initialize-inouts: -32883 # var inouts/esi: (payload stmt-var) = [l] -32884 68/push 0/imm32/is-deref:false -32885 68/push 0/imm32/next -32886 68/push 0/imm32/next -32887 52/push-edx/l -32888 68/push 0x11/imm32/alloc-id:fake -32889 68/push 0x11/imm32/alloc-id:fake:payload -32890 89/<- %esi 4/r32/esp -32891 $test-add-literal-to-reg:initialize-outputs: -32892 # var outputs/edi: (payload stmt-var) = [v] -32893 68/push 0/imm32/is-deref:false -32894 68/push 0/imm32/next -32895 68/push 0/imm32/next -32896 51/push-ecx/v -32897 68/push 0x11/imm32/alloc-id:fake -32898 68/push 0x11/imm32/alloc-id:fake:payload -32899 89/<- %edi 4/r32/esp -32900 $test-add-literal-to-reg:initialize-stmt: -32901 # var stmt/esi: (addr statement) -32902 68/push 0/imm32/next -32903 68/push 0/imm32/next -32904 57/push-edi/outputs -32905 68/push 0x11/imm32/alloc-id:fake -32906 56/push-esi/inouts -32907 68/push 0x11/imm32/alloc-id:fake -32908 68/push 0/imm32/operation -32909 68/push 0/imm32/operation -32910 68/push 1/imm32/tag:stmt1 -32911 89/<- %esi 4/r32/esp -32912 $test-add-literal-to-reg:initialize-stmt-operation: -32913 # stmt->operation = "add" -32914 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -32915 (copy-array Heap "add" %eax) -32916 # convert -32917 c7 0/subop/copy *Curr-block-depth 0/imm32 -32918 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -32919 (flush _test-output-buffered-file) -32920 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -32926 # check output -32927 (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ecx 0x34/imm32" "F - test-add-literal-to-reg") -32928 # . epilogue -32929 89/<- %esp 5/r32/ebp -32930 5d/pop-to-ebp -32931 c3/return -32932 -32933 test-add-literal-to-mem: -32934 # add-to var1, 0x34 -32935 # => -32936 # 81 0/subop/add %eax 0x34/imm32 -32937 # -32938 # . prologue -32939 55/push-ebp -32940 89/<- %ebp 4/r32/esp -32941 # setup -32942 (clear-stream _test-output-stream) -32943 (clear-stream $_test-output-buffered-file->buffer) -32944 $test-add-literal-to-mem:initialize-type: -32945 # var type/ecx: (payload type-tree) = int -32946 68/push 0/imm32/right:null -32947 68/push 0/imm32/right:null -32948 68/push 0/imm32/left:unused -32949 68/push 1/imm32/value:int -32950 68/push 1/imm32/is-atom?:true -32951 68/push 0x11/imm32/alloc-id:fake:payload -32952 89/<- %ecx 4/r32/esp -32953 $test-add-literal-to-mem:initialize-var1: -32954 # var var1/ecx: (payload var) -32955 68/push 0/imm32/register -32956 68/push 0/imm32/register -32957 68/push 8/imm32/stack-offset -32958 68/push 1/imm32/block-depth -32959 51/push-ecx -32960 68/push 0x11/imm32/alloc-id:fake -32961 68/push 0/imm32/name -32962 68/push 0/imm32/name -32963 68/push 0x11/imm32/alloc-id:fake:payload -32964 89/<- %ecx 4/r32/esp -32965 $test-add-literal-to-mem:initialize-var1-name: -32966 # var1->name = "var1" -32967 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -32968 (copy-array Heap "var1" %eax) -32969 $test-add-literal-to-mem:initialize-literal-type: -32970 # var type/edx: (payload type-tree) = literal -32971 68/push 0/imm32/right:null -32972 68/push 0/imm32/right:null -32973 68/push 0/imm32/left:unused -32974 68/push 0/imm32/value:literal -32975 68/push 1/imm32/is-atom?:true +32760 68/push 0/imm32/name +32761 68/push 0x11/imm32/alloc-id:fake:payload +32762 89/<- %ebx 4/r32/esp +32763 $test-emit-subx-stmt-select-primitive:initialize-formal-var-name: +32764 # formal-var->name = "dummy" +32765 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 +32766 (copy-array Heap "dummy" %eax) +32767 $test-emit-subx-stmt-select-primitive:initialize-formal-register: +32768 # formal-var->register = "*" +32769 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 +32770 (copy-array Heap "*" %eax) # Any-register +32771 $test-emit-subx-stmt-select-primitive:initialize-var-list: +32772 # var formal-outputs/ebx: (payload list var) +32773 68/push 0/imm32/next +32774 68/push 0/imm32/next +32775 53/push-ebx/formal-var +32776 68/push 0x11/imm32/alloc-id:fake +32777 68/push 0x11/imm32/alloc-id:fake:payload +32778 89/<- %ebx 4/r32/esp +32779 $test-emit-subx-stmt-select-primitive:initialize-primitive2: +32780 # var primitive2/edi: (payload primitive) +32781 68/push 0/imm32/next +32782 68/push 0/imm32/next +32783 68/push 0/imm32/no-x32 +32784 68/push 0/imm32/no-xm32 +32785 68/push 0/imm32/no-disp32 +32786 68/push 0/imm32/no-imm8 +32787 68/push 0/imm32/no-imm32 +32788 68/push 0/imm32/no-r32 +32789 68/push 3/imm32/rm32-is-first-output +32790 68/push 0/imm32/subx-name +32791 68/push 0/imm32/subx-name +32792 53/push-ebx/outputs +32793 68/push 0x11/imm32/alloc-id:fake +32794 68/push 0/imm32/no-inouts +32795 68/push 0/imm32/no-inouts +32796 68/push 0/imm32/name +32797 68/push 0/imm32/name +32798 68/push 0x11/imm32/alloc-id:fake:payload +32799 89/<- %edi 4/r32/esp +32800 $test-emit-subx-stmt-select-primitive:initialize-primitive2-name: +32801 # primitives->name = "increment" +32802 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 +32803 (copy-array Heap "increment" %eax) +32804 $test-emit-subx-stmt-select-primitive:initialize-primitive2-subx-name: +32805 # primitives->subx-name = "ff 0/subop/increment" +32806 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 +32807 (copy-array Heap "ff 0/subop/increment" %eax) +32808 $test-emit-subx-stmt-select-primitive:initialize-primitive: +32809 # var primitives/ebx: (addr primitive) +32810 57/push-edi +32811 68/push 0x11/imm32/alloc-id:fake +32812 68/push 0/imm32/no-x32 +32813 68/push 0/imm32/no-xm32 +32814 68/push 0/imm32/no-disp32 +32815 68/push 0/imm32/no-imm8 +32816 68/push 0/imm32/no-imm32 +32817 68/push 0/imm32/no-r32 +32818 68/push 1/imm32/rm32-is-first-inout +32819 68/push 0/imm32/subx-name +32820 68/push 0/imm32/subx-name +32821 68/push 0/imm32/no-outputs +32822 68/push 0/imm32/no-outputs +32823 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration +32824 68/push 0x11/imm32/alloc-id:fake +32825 68/push 0/imm32/name +32826 68/push 0/imm32/name +32827 89/<- %ebx 4/r32/esp +32828 $test-emit-subx-stmt-select-primitive:initialize-primitive-name: +32829 # primitives->name = "increment" +32830 (copy-array Heap "increment" %ebx) # Primitive-name +32831 $test-emit-subx-stmt-select-primitive:initialize-primitive-subx-name: +32832 # primitives->subx-name = "ff 0/subop/increment" +32833 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +32834 (copy-array Heap "ff 0/subop/increment" %eax) +32835 # convert +32836 c7 0/subop/copy *Curr-block-depth 0/imm32 +32837 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) +32838 (flush _test-output-buffered-file) +32839 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +32845 # check output +32846 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive") +32847 # . epilogue +32848 89/<- %esp 5/r32/ebp +32849 5d/pop-to-ebp +32850 c3/return +32851 +32852 test-emit-subx-stmt-select-primitive-2: +32853 # Select the right primitive between overloads. +32854 # increment foo +32855 # => +32856 # ff 0/subop/increment %eax # sub-optimal, but should suffice +32857 # +32858 # There's a variable on the var stack as follows: +32859 # name: 'foo' +32860 # type: int +32861 # register: 'eax' +32862 # +32863 # There's two primitives, as follows: +32864 # - name: 'increment' +32865 # out: int/reg +32866 # value: 'ff 0/subop/increment' +32867 # - name: 'increment' +32868 # inout: int/mem +32869 # value: 'ff 0/subop/increment' +32870 # +32871 # . prologue +32872 55/push-ebp +32873 89/<- %ebp 4/r32/esp +32874 # setup +32875 (clear-stream _test-output-stream) +32876 (clear-stream $_test-output-buffered-file->buffer) +32877 $test-emit-subx-stmt-select-primitive-2:initialize-type: +32878 # var type/ecx: (payload type-tree) = int +32879 68/push 0/imm32/right:null +32880 68/push 0/imm32/right:null +32881 68/push 0/imm32/left:unused +32882 68/push 1/imm32/value:int +32883 68/push 1/imm32/is-atom?:true +32884 68/push 0x11/imm32/alloc-id:fake:payload +32885 89/<- %ecx 4/r32/esp +32886 $test-emit-subx-stmt-select-primitive-2:initialize-var: +32887 # var var-foo/ecx: (payload var) +32888 68/push 0/imm32/register +32889 68/push 0/imm32/register +32890 68/push 0/imm32/no-stack-offset +32891 68/push 1/imm32/block-depth +32892 51/push-ecx +32893 68/push 0x11/imm32/alloc-id:fake +32894 68/push 0/imm32/name +32895 68/push 0/imm32/name +32896 68/push 0x11/imm32/alloc-id:fake:payload +32897 89/<- %ecx 4/r32/esp +32898 $test-emit-subx-stmt-select-primitive-2:initialize-var-name: +32899 # var-foo->name = "foo" +32900 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +32901 (copy-array Heap "foo" %eax) +32902 $test-emit-subx-stmt-select-primitive-2:initialize-var-register: +32903 # var-foo->register = "eax" +32904 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +32905 (copy-array Heap "eax" %eax) +32906 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-var: +32907 # var operand/ebx: (payload stmt-var) +32908 68/push 0/imm32/is-deref:false +32909 68/push 0/imm32/next +32910 68/push 0/imm32/next +32911 51/push-ecx/var-foo +32912 68/push 0x11/imm32/alloc-id:fake +32913 68/push 0x11/imm32/alloc-id:fake:payload +32914 89/<- %ebx 4/r32/esp +32915 $test-emit-subx-stmt-select-primitive-2:initialize-stmt: +32916 # var stmt/esi: (addr statement) +32917 68/push 0/imm32/no-outputs +32918 68/push 0/imm32/no-outputs +32919 53/push-ebx/inouts +32920 68/push 0x11/imm32/alloc-id:fake +32921 68/push 0/imm32/operation +32922 68/push 0/imm32/operation +32923 68/push 1/imm32 +32924 89/<- %esi 4/r32/esp +32925 $test-emit-subx-stmt-select-primitive-2:initialize-stmt-operation: +32926 # stmt->operation = "increment" +32927 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +32928 (copy-array Heap "increment" %eax) +32929 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var: +32930 # var formal-var/ebx: (payload var) +32931 68/push 0/imm32/register +32932 68/push 0/imm32/register +32933 68/push 0/imm32/no-stack-offset +32934 68/push 1/imm32/block-depth +32935 ff 6/subop/push *(ecx+0x10) # Var-type + payload alloc id + handle alloc id +32936 68/push 0x11/imm32/alloc-id:fake +32937 68/push 0/imm32/name +32938 68/push 0/imm32/name +32939 68/push 0x11/imm32/alloc-id:fake:payload +32940 89/<- %ebx 4/r32/esp +32941 $test-emit-subx-stmt-select-primitive-2:initialize-formal-var-name: +32942 # formal-var->name = "dummy" +32943 8d/copy-address *(ebx+4) 0/r32/eax # Var-name + 4 +32944 (copy-array Heap "dummy" %eax) +32945 $test-emit-subx-stmt-select-primitive-2:initialize-formal-register: +32946 # formal-var->register = "*" +32947 8d/copy-address *(ebx+0x1c) 0/r32/eax # Var-register + 4 +32948 (copy-array Heap "*" %eax) # Any-register +32949 $test-emit-subx-stmt-select-primitive-2:initialize-var-list: +32950 # var formal-outputs/ebx: (payload list stmt-var) +32951 68/push 0/imm32/next +32952 68/push 0/imm32/next +32953 53/push-ebx/formal-var +32954 68/push 0x11/imm32/alloc-id:fake +32955 68/push 0x11/imm32/alloc-id:fake:payload +32956 89/<- %ebx 4/r32/esp +32957 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2: +32958 # var primitive2/edi: (payload primitive) +32959 68/push 0/imm32/next +32960 68/push 0/imm32/next +32961 68/push 0/imm32/no-x32 +32962 68/push 0/imm32/no-xm32 +32963 68/push 0/imm32/no-disp32 +32964 68/push 0/imm32/no-imm8 +32965 68/push 0/imm32/no-imm32 +32966 68/push 0/imm32/no-r32 +32967 68/push 3/imm32/rm32-is-first-output +32968 68/push 0/imm32/subx-name +32969 68/push 0/imm32/subx-name +32970 53/push-ebx/outputs +32971 68/push 0x11/imm32/alloc-id:fake +32972 68/push 0/imm32/no-inouts +32973 68/push 0/imm32/no-inouts +32974 68/push 0/imm32/name +32975 68/push 0/imm32/name 32976 68/push 0x11/imm32/alloc-id:fake:payload -32977 89/<- %edx 4/r32/esp -32978 $test-add-literal-to-mem:initialize-literal: -32979 # var l/edx: (payload var) -32980 68/push 0/imm32/register -32981 68/push 0/imm32/register -32982 68/push 0/imm32/no-stack-offset -32983 68/push 1/imm32/block-depth -32984 52/push-edx -32985 68/push 0x11/imm32/alloc-id:fake -32986 68/push 0/imm32/name -32987 68/push 0/imm32/name -32988 68/push 0x11/imm32/alloc-id:fake:payload -32989 89/<- %edx 4/r32/esp -32990 $test-add-literal-to-mem:initialize-literal-value: -32991 # l->name = "0x34" -32992 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -32993 (copy-array Heap "0x34" %eax) -32994 $test-add-literal-to-mem:initialize-inouts: -32995 # var inouts/esi: (payload stmt-var) = [l] -32996 68/push 0/imm32/is-deref:false -32997 68/push 0/imm32/next -32998 68/push 0/imm32/next -32999 52/push-edx/l -33000 68/push 0x11/imm32/alloc-id:fake -33001 68/push 0x11/imm32/alloc-id:fake:payload -33002 89/<- %esi 4/r32/esp -33003 # var inouts = (handle stmt-var) = [var1, var2] -33004 68/push 0/imm32/is-deref:false -33005 56/push-esi/next -33006 68/push 0x11/imm32/alloc-id:fake -33007 51/push-ecx/var1 -33008 68/push 0x11/imm32/alloc-id:fake -33009 68/push 0x11/imm32/alloc-id:fake:payload -33010 89/<- %esi 4/r32/esp -33011 $test-add-literal-to-mem:initialize-stmt: -33012 # var stmt/esi: (addr statement) -33013 68/push 0/imm32/next -33014 68/push 0/imm32/next -33015 68/push 0/imm32/outputs -33016 68/push 0/imm32/outputs -33017 56/push-esi/inouts -33018 68/push 0x11/imm32/alloc-id:fake -33019 68/push 0/imm32/operation -33020 68/push 0/imm32/operation -33021 68/push 1/imm32/tag:stmt1 -33022 89/<- %esi 4/r32/esp -33023 $test-add-literal-to-mem:initialize-stmt-operation: -33024 # stmt->operation = "add-to" -33025 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -33026 (copy-array Heap "add-to" %eax) -33027 # convert -33028 c7 0/subop/copy *Curr-block-depth 0/imm32 -33029 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -33030 (flush _test-output-buffered-file) -33031 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -33037 # check output -33038 (check-next-stream-line-equal _test-output-stream "81 0/subop/add *(ebp+0x00000008) 0x34/imm32" "F - test-add-literal-to-mem") -33039 # . epilogue -33040 89/<- %esp 5/r32/ebp -33041 5d/pop-to-ebp -33042 c3/return -33043 -33044 test-shift-reg-by-literal: -33045 # var1/ecx <- shift-left 2 -33046 # => -33047 # c1/shift 4/subop/left %ecx 2/imm8 -33048 # -33049 # . prologue -33050 55/push-ebp -33051 89/<- %ebp 4/r32/esp -33052 # setup -33053 (clear-stream _test-output-stream) -33054 (clear-stream $_test-output-buffered-file->buffer) -33055 $test-shift-reg-by-literal:initialize-var-type: -33056 # var type/ecx: (payload type-tree) = int -33057 68/push 0/imm32/right:null -33058 68/push 0/imm32/right:null -33059 68/push 0/imm32/left:unused -33060 68/push 1/imm32/value:int -33061 68/push 1/imm32/is-atom?:true -33062 68/push 0x11/imm32/alloc-id:fake:payload -33063 89/<- %ecx 4/r32/esp -33064 $test-shift-reg-by-literal:initialize-var: -33065 # var v/ecx: (payload var) -33066 68/push 0/imm32/register -33067 68/push 0/imm32/register -33068 68/push 0/imm32/no-stack-offset -33069 68/push 1/imm32/block-depth -33070 51/push-ecx -33071 68/push 0x11/imm32/alloc-id:fake -33072 68/push 0/imm32/name -33073 68/push 0/imm32/name -33074 68/push 0x11/imm32/alloc-id:fake:payload -33075 89/<- %ecx 4/r32/esp -33076 $test-shift-reg-by-literal:initialize-var-name: -33077 # v->name = "v" -33078 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -33079 (copy-array Heap "v" %eax) -33080 $test-shift-reg-by-literal:initialize-var-register: -33081 # v->register = "ecx" -33082 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -33083 (copy-array Heap "ecx" %eax) -33084 $test-shift-reg-by-literal:initialize-literal-type: -33085 # var type/edx: (payload type-tree) = literal -33086 68/push 0/imm32/right:null -33087 68/push 0/imm32/right:null -33088 68/push 0/imm32/left:unused -33089 68/push 0/imm32/value:literal -33090 68/push 1/imm32/is-atom?:true -33091 68/push 0x11/imm32/alloc-id:fake:payload -33092 89/<- %edx 4/r32/esp -33093 $test-shift-reg-by-literal:initialize-literal: -33094 # var l/edx: (payload var) -33095 68/push 0/imm32/register -33096 68/push 0/imm32/register -33097 68/push 0/imm32/no-stack-offset -33098 68/push 1/imm32/block-depth -33099 52/push-edx -33100 68/push 0x11/imm32/alloc-id:fake -33101 68/push 0/imm32/name -33102 68/push 0/imm32/name -33103 68/push 0x11/imm32/alloc-id:fake:payload -33104 89/<- %edx 4/r32/esp -33105 $test-shift-reg-by-literal:initialize-literal-value: -33106 # l->name = "2" -33107 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -33108 (copy-array Heap "2" %eax) -33109 $test-shift-reg-by-literal:initialize-inouts: -33110 # var inouts/esi: (payload stmt-var) = [l] -33111 68/push 0/imm32/is-deref:false -33112 68/push 0/imm32/next -33113 68/push 0/imm32/next -33114 52/push-edx/l -33115 68/push 0x11/imm32/alloc-id:fake -33116 68/push 0x11/imm32/alloc-id:fake:payload -33117 89/<- %esi 4/r32/esp -33118 $test-shift-reg-by-literal:initialize-outputs: -33119 # var outputs/edi: (payload stmt-var) = [v] -33120 68/push 0/imm32/is-deref:false -33121 68/push 0/imm32/next -33122 68/push 0/imm32/next -33123 51/push-ecx/v -33124 68/push 0x11/imm32/alloc-id:fake -33125 68/push 0x11/imm32/alloc-id:fake:payload -33126 89/<- %edi 4/r32/esp -33127 $test-shift-reg-by-literal:initialize-stmt: -33128 # var stmt/esi: (addr statement) -33129 68/push 0/imm32/next -33130 68/push 0/imm32/next -33131 57/push-edi/outputs -33132 68/push 0x11/imm32/alloc-id:fake -33133 56/push-esi/inouts -33134 68/push 0x11/imm32/alloc-id:fake -33135 68/push 0/imm32/operation -33136 68/push 0/imm32/operation -33137 68/push 1/imm32/tag:stmt1 -33138 89/<- %esi 4/r32/esp -33139 $test-shift-reg-by-literal:initialize-stmt-operation: -33140 # stmt->operation = "shift-left" -33141 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -33142 (copy-array Heap "shift-left" %eax) -33143 # convert -33144 c7 0/subop/copy *Curr-block-depth 0/imm32 -33145 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -33146 (flush _test-output-buffered-file) -33147 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -33153 # check output -33154 (check-next-stream-line-equal _test-output-stream "c1/shift 4/subop/left %ecx 2/imm8" "F - test-shift-reg-by-literal") -33155 # . epilogue -33156 89/<- %esp 5/r32/ebp -33157 5d/pop-to-ebp -33158 c3/return -33159 -33160 test-shift-mem-by-literal: -33161 # shift-left var 3 -33162 # => -33163 # c1/shift 4/subop/left *(ebp+8) 3/imm8 -33164 # -33165 # . prologue -33166 55/push-ebp -33167 89/<- %ebp 4/r32/esp -33168 # setup -33169 (clear-stream _test-output-stream) -33170 (clear-stream $_test-output-buffered-file->buffer) -33171 $test-shift-mem-by-literal:initialize-type: -33172 # var type/ecx: (payload type-tree) = int -33173 68/push 0/imm32/right:null -33174 68/push 0/imm32/right:null -33175 68/push 0/imm32/left:unused -33176 68/push 1/imm32/value:int -33177 68/push 1/imm32/is-atom?:true -33178 68/push 0x11/imm32/alloc-id:fake:payload -33179 89/<- %ecx 4/r32/esp -33180 $test-shift-mem-by-literal:initialize-var1: -33181 # var var1/ecx: (payload var) -33182 68/push 0/imm32/register -33183 68/push 0/imm32/register -33184 68/push 8/imm32/stack-offset -33185 68/push 1/imm32/block-depth -33186 51/push-ecx -33187 68/push 0x11/imm32/alloc-id:fake -33188 68/push 0/imm32/name -33189 68/push 0/imm32/name -33190 68/push 0x11/imm32/alloc-id:fake:payload -33191 89/<- %ecx 4/r32/esp -33192 $test-shift-mem-by-literal:initialize-var1-name: -33193 # var1->name = "var1" -33194 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -33195 (copy-array Heap "var1" %eax) -33196 $test-shift-mem-by-literal:initialize-literal-type: -33197 # var type/edx: (payload type-tree) = literal -33198 68/push 0/imm32/right:null -33199 68/push 0/imm32/right:null -33200 68/push 0/imm32/left:unused -33201 68/push 0/imm32/value:literal -33202 68/push 1/imm32/is-atom?:true -33203 68/push 0x11/imm32/alloc-id:fake:payload -33204 89/<- %edx 4/r32/esp -33205 $test-shift-mem-by-literal:initialize-literal: -33206 # var l/edx: (payload var) -33207 68/push 0/imm32/register -33208 68/push 0/imm32/register -33209 68/push 0/imm32/no-stack-offset -33210 68/push 1/imm32/block-depth -33211 52/push-edx -33212 68/push 0x11/imm32/alloc-id:fake -33213 68/push 0/imm32/name -33214 68/push 0/imm32/name -33215 68/push 0x11/imm32/alloc-id:fake:payload -33216 89/<- %edx 4/r32/esp -33217 $test-shift-mem-by-literal:initialize-literal-value: -33218 # l->name = "3" -33219 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -33220 (copy-array Heap "3" %eax) -33221 $test-shift-mem-by-literal:initialize-inouts: -33222 # var inouts/esi: (payload stmt-var) = [l] -33223 68/push 0/imm32/is-deref:false -33224 68/push 0/imm32/next -33225 68/push 0/imm32/next -33226 52/push-edx/l -33227 68/push 0x11/imm32/alloc-id:fake -33228 68/push 0x11/imm32/alloc-id:fake:payload -33229 89/<- %esi 4/r32/esp -33230 # var inouts = (handle stmt-var) = [var1, var2] -33231 68/push 0/imm32/is-deref:false -33232 56/push-esi/next -33233 68/push 0x11/imm32/alloc-id:fake -33234 51/push-ecx/var1 -33235 68/push 0x11/imm32/alloc-id:fake -33236 68/push 0x11/imm32/alloc-id:fake:payload -33237 89/<- %esi 4/r32/esp -33238 $test-shift-mem-by-literal:initialize-stmt: -33239 # var stmt/esi: (addr statement) -33240 68/push 0/imm32/next -33241 68/push 0/imm32/next -33242 68/push 0/imm32/outputs -33243 68/push 0/imm32/outputs -33244 56/push-esi/inouts -33245 68/push 0x11/imm32/alloc-id:fake -33246 68/push 0/imm32/operation -33247 68/push 0/imm32/operation -33248 68/push 1/imm32/tag:stmt1 -33249 89/<- %esi 4/r32/esp -33250 $test-shift-mem-by-literal:initialize-stmt-operation: -33251 # stmt->operation = "shift-left" -33252 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -33253 (copy-array Heap "shift-left" %eax) -33254 # convert -33255 c7 0/subop/copy *Curr-block-depth 0/imm32 -33256 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -33257 (flush _test-output-buffered-file) -33258 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -33264 # check output -33265 (check-next-stream-line-equal _test-output-stream "c1/shift 4/subop/left *(ebp+0x00000008) 3/imm8" "F - test-shift-mem-by-literal") -33266 # . epilogue -33267 89/<- %esp 5/r32/ebp -33268 5d/pop-to-ebp -33269 c3/return -33270 -33271 test-compare-reg-with-reg: -33272 # compare var1/ecx, var2/eax -33273 # => -33274 # 39/compare %ecx 0/r32/eax -33275 # -33276 # . prologue -33277 55/push-ebp -33278 89/<- %ebp 4/r32/esp -33279 # setup -33280 (clear-stream _test-output-stream) -33281 (clear-stream $_test-output-buffered-file->buffer) -33282 $test-compare-reg-with-reg:initialize-type: -33283 # var type/ecx: (payload type-tree) = int -33284 68/push 0/imm32/right:null -33285 68/push 0/imm32/right:null -33286 68/push 0/imm32/left:unused -33287 68/push 1/imm32/value:int -33288 68/push 1/imm32/is-atom?:true -33289 68/push 0x11/imm32/alloc-id:fake:payload -33290 89/<- %ecx 4/r32/esp -33291 $test-compare-reg-with-reg:initialize-var1: -33292 # var var1/ecx: (payload var) -33293 68/push 0/imm32/register -33294 68/push 0/imm32/register -33295 68/push 0/imm32/no-stack-offset -33296 68/push 1/imm32/block-depth -33297 51/push-ecx -33298 68/push 0x11/imm32/alloc-id:fake -33299 68/push 0/imm32/name -33300 68/push 0/imm32/name -33301 68/push 0x11/imm32/alloc-id:fake:payload -33302 89/<- %ecx 4/r32/esp -33303 $test-compare-reg-with-reg:initialize-var1-name: -33304 # var1->name = "var1" -33305 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -33306 (copy-array Heap "var1" %eax) -33307 $test-compare-reg-with-reg:initialize-var1-register: -33308 # var1->register = "ecx" -33309 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -33310 (copy-array Heap "ecx" %eax) -33311 $test-compare-reg-with-reg:initialize-var2: -33312 # var var2/edx: (payload var) -33313 68/push 0/imm32/register -33314 68/push 0/imm32/register -33315 68/push 0/imm32/no-stack-offset -33316 68/push 1/imm32/block-depth -33317 ff 6/subop/push *(ecx+0x10) -33318 68/push 0x11/imm32/alloc-id:fake -33319 68/push 0/imm32/name -33320 68/push 0/imm32/name -33321 68/push 0x11/imm32/alloc-id:fake:payload -33322 89/<- %edx 4/r32/esp -33323 $test-compare-reg-with-reg:initialize-var2-name: -33324 # var2->name = "var2" -33325 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -33326 (copy-array Heap "var2" %eax) -33327 $test-compare-reg-with-reg:initialize-var2-register: -33328 # var2->register = "eax" -33329 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 -33330 (copy-array Heap "eax" %eax) -33331 $test-compare-reg-with-reg:initialize-inouts: -33332 # var inouts/esi: (payload stmt-var) = [var2] -33333 68/push 0/imm32/is-deref:false -33334 68/push 0/imm32/next -33335 68/push 0/imm32/next -33336 52/push-edx/var2 -33337 68/push 0x11/imm32/alloc-id:fake -33338 68/push 0x11/imm32/alloc-id:fake:payload -33339 89/<- %esi 4/r32/esp -33340 # inouts = [var1, var2] -33341 68/push 0/imm32/is-deref:false -33342 56/push-esi/next -33343 68/push 0x11/imm32/alloc-id:fake -33344 51/push-ecx/var1 -33345 68/push 0x11/imm32/alloc-id:fake -33346 68/push 0x11/imm32/alloc-id:fake:payload -33347 89/<- %esi 4/r32/esp -33348 $test-compare-reg-with-reg:initialize-stmt: -33349 # var stmt/esi: (addr statement) -33350 68/push 0/imm32/next -33351 68/push 0/imm32/next -33352 68/push 0/imm32/outputs -33353 68/push 0/imm32/outputs -33354 56/push-esi/inouts -33355 68/push 0x11/imm32/alloc-id:fake -33356 68/push 0/imm32/operation -33357 68/push 0/imm32/operation -33358 68/push 1/imm32/tag:stmt1 -33359 89/<- %esi 4/r32/esp -33360 $test-compare-reg-with-reg:initialize-stmt-operation: -33361 # stmt->operation = "compare" -33362 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -33363 (copy-array Heap "compare" %eax) -33364 # convert -33365 c7 0/subop/copy *Curr-block-depth 0/imm32 -33366 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -33367 (flush _test-output-buffered-file) -33368 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -33374 # check output -33375 (check-next-stream-line-equal _test-output-stream "39/compare-> %ecx 0x00000000/r32" "F - test-compare-reg-with-reg") -33376 # . epilogue -33377 89/<- %esp 5/r32/ebp -33378 5d/pop-to-ebp -33379 c3/return -33380 -33381 test-compare-mem-with-reg: -33382 # compare var1, var2/eax -33383 # => -33384 # 39/compare *(ebp+___) 0/r32/eax -33385 # -33386 # . prologue -33387 55/push-ebp -33388 89/<- %ebp 4/r32/esp -33389 # setup -33390 (clear-stream _test-output-stream) -33391 (clear-stream $_test-output-buffered-file->buffer) -33392 $test-compare-mem-with-reg:initialize-type: -33393 # var type/ecx: (payload type-tree) = int -33394 68/push 0/imm32/right:null -33395 68/push 0/imm32/right:null -33396 68/push 0/imm32/left:unused -33397 68/push 1/imm32/value:int -33398 68/push 1/imm32/is-atom?:true -33399 68/push 0x11/imm32/alloc-id:fake:payload -33400 89/<- %ecx 4/r32/esp -33401 $test-compare-mem-with-reg:initialize-var1: -33402 # var var1/ecx: (payload var) -33403 68/push 0/imm32/register -33404 68/push 0/imm32/register -33405 68/push 8/imm32/stack-offset -33406 68/push 1/imm32/block-depth -33407 51/push-ecx -33408 68/push 0x11/imm32/alloc-id:fake -33409 68/push 0/imm32/name -33410 68/push 0/imm32/name -33411 68/push 0x11/imm32/alloc-id:fake:payload -33412 89/<- %ecx 4/r32/esp -33413 $test-compare-mem-with-reg:initialize-var1-name: -33414 # var1->name = "var1" -33415 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -33416 (copy-array Heap "var1" %eax) -33417 $test-compare-mem-with-reg:initialize-var2: -33418 # var var2/edx: (payload var) -33419 68/push 0/imm32/register -33420 68/push 0/imm32/register -33421 68/push 0/imm32/no-stack-offset -33422 68/push 1/imm32/block-depth -33423 ff 6/subop/push *(ecx+0x10) -33424 68/push 0x11/imm32/alloc-id:fake -33425 68/push 0/imm32/name -33426 68/push 0/imm32/name -33427 68/push 0x11/imm32/alloc-id:fake:payload -33428 89/<- %edx 4/r32/esp -33429 $test-compare-mem-with-reg:initialize-var2-name: -33430 # var2->name = "var2" -33431 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -33432 (copy-array Heap "var2" %eax) -33433 $test-compare-mem-with-reg:initialize-var2-register: -33434 # var2->register = "eax" -33435 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 -33436 (copy-array Heap "eax" %eax) -33437 $test-compare-mem-with-reg:initialize-inouts: -33438 # var inouts/esi: (payload stmt-var) = [var2] -33439 68/push 0/imm32/is-deref:false -33440 68/push 0/imm32/next -33441 68/push 0/imm32/next -33442 52/push-edx/var2 -33443 68/push 0x11/imm32/alloc-id:fake -33444 68/push 0x11/imm32/alloc-id:fake:payload -33445 89/<- %esi 4/r32/esp -33446 # inouts = [var1, var2] -33447 68/push 0/imm32/is-deref:false -33448 56/push-esi/next -33449 68/push 0x11/imm32/alloc-id:fake -33450 51/push-ecx/var1 -33451 68/push 0x11/imm32/alloc-id:fake -33452 68/push 0x11/imm32/alloc-id:fake:payload -33453 89/<- %esi 4/r32/esp -33454 $test-compare-mem-with-reg:initialize-stmt: -33455 # var stmt/esi: (addr statement) -33456 68/push 0/imm32/next -33457 68/push 0/imm32/next -33458 68/push 0/imm32/outputs -33459 68/push 0/imm32/outputs -33460 56/push-esi/inouts -33461 68/push 0x11/imm32/alloc-id:fake -33462 68/push 0/imm32/operation -33463 68/push 0/imm32/operation -33464 68/push 1/imm32/tag:stmt1 -33465 89/<- %esi 4/r32/esp -33466 $test-compare-mem-with-reg:initialize-stmt-operation: -33467 # stmt->operation = "compare" -33468 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -33469 (copy-array Heap "compare" %eax) -33470 # convert -33471 c7 0/subop/copy *Curr-block-depth 0/imm32 -33472 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -33473 (flush _test-output-buffered-file) -33474 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -33480 # check output -33481 (check-next-stream-line-equal _test-output-stream "39/compare-> *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-mem-with-reg") -33482 # . epilogue -33483 89/<- %esp 5/r32/ebp -33484 5d/pop-to-ebp -33485 c3/return -33486 -33487 test-compare-reg-with-mem: -33488 # compare var1/eax, var2 -33489 # => -33490 # 3b/compare<- *(ebp+___) 0/r32/eax -33491 # -33492 # . prologue -33493 55/push-ebp -33494 89/<- %ebp 4/r32/esp -33495 # setup -33496 (clear-stream _test-output-stream) -33497 (clear-stream $_test-output-buffered-file->buffer) -33498 $test-compare-reg-with-mem:initialize-type: -33499 # var type/ecx: (payload type-tree) = int -33500 68/push 0/imm32/right:null -33501 68/push 0/imm32/right:null -33502 68/push 0/imm32/left:unused -33503 68/push 1/imm32/value:int -33504 68/push 1/imm32/is-atom?:true -33505 68/push 0x11/imm32/alloc-id:fake:payload -33506 89/<- %ecx 4/r32/esp -33507 $test-compare-reg-with-mem:initialize-var1: -33508 # var var1/ecx: (payload var) -33509 68/push 0/imm32/register -33510 68/push 0/imm32/register -33511 68/push 0/imm32/no-stack-offset -33512 68/push 1/imm32/block-depth -33513 51/push-ecx -33514 68/push 0x11/imm32/alloc-id:fake -33515 68/push 0/imm32/name -33516 68/push 0/imm32/name -33517 68/push 0x11/imm32/alloc-id:fake:payload -33518 89/<- %ecx 4/r32/esp -33519 $test-compare-reg-with-mem:initialize-var1-name: -33520 # var1->name = "var1" -33521 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -33522 (copy-array Heap "var1" %eax) -33523 $test-compare-reg-with-mem:initialize-var1-register: -33524 # var1->register = "eax" -33525 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -33526 (copy-array Heap "eax" %eax) -33527 $test-compare-reg-with-mem:initialize-var2: -33528 # var var2/edx: (payload var) -33529 68/push 0/imm32/register -33530 68/push 0/imm32/register -33531 68/push 8/imm32/stack-offset -33532 68/push 1/imm32/block-depth -33533 ff 6/subop/push *(ecx+0x10) -33534 68/push 0x11/imm32/alloc-id:fake -33535 68/push 0/imm32/name -33536 68/push 0/imm32/name -33537 68/push 0x11/imm32/alloc-id:fake:payload -33538 89/<- %edx 4/r32/esp -33539 $test-compare-reg-with-mem:initialize-var2-name: -33540 # var2->name = "var2" -33541 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -33542 (copy-array Heap "var2" %eax) -33543 $test-compare-reg-with-mem:initialize-inouts: -33544 # var inouts/esi: (payload stmt-var) = [var2] -33545 68/push 0/imm32/is-deref:false -33546 68/push 0/imm32/next -33547 68/push 0/imm32/next -33548 52/push-edx/var2 -33549 68/push 0x11/imm32/alloc-id:fake -33550 68/push 0x11/imm32/alloc-id:fake:payload -33551 89/<- %esi 4/r32/esp -33552 # inouts = [var1, var2] -33553 68/push 0/imm32/is-deref:false -33554 56/push-esi/next -33555 68/push 0x11/imm32/alloc-id:fake -33556 51/push-ecx/var1 -33557 68/push 0x11/imm32/alloc-id:fake -33558 68/push 0x11/imm32/alloc-id:fake:payload -33559 89/<- %esi 4/r32/esp -33560 $test-compare-reg-with-mem:initialize-stmt: -33561 # var stmt/esi: (addr statement) -33562 68/push 0/imm32/next -33563 68/push 0/imm32/next -33564 68/push 0/imm32/outputs -33565 68/push 0/imm32/outputs -33566 56/push-esi/inouts -33567 68/push 0x11/imm32/alloc-id:fake -33568 68/push 0/imm32/operation -33569 68/push 0/imm32/operation -33570 68/push 1/imm32/tag:stmt1 -33571 89/<- %esi 4/r32/esp -33572 $test-compare-reg-with-mem:initialize-stmt-operation: -33573 # stmt->operation = "compare" -33574 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -33575 (copy-array Heap "compare" %eax) -33576 # convert -33577 c7 0/subop/copy *Curr-block-depth 0/imm32 -33578 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -33579 (flush _test-output-buffered-file) -33580 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -33586 # check output -33587 (check-next-stream-line-equal _test-output-stream "3b/compare<- *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-reg-with-mem") -33588 # . epilogue -33589 89/<- %esp 5/r32/ebp -33590 5d/pop-to-ebp -33591 c3/return -33592 -33593 test-compare-mem-with-literal: -33594 # compare var1, 0x34 -33595 # => -33596 # 81 7/subop/compare *(ebp+___) 0x34/imm32 -33597 # -33598 # . prologue -33599 55/push-ebp -33600 89/<- %ebp 4/r32/esp -33601 # setup -33602 (clear-stream _test-output-stream) -33603 (clear-stream $_test-output-buffered-file->buffer) -33604 $test-compare-mem-with-literal:initialize-type: -33605 # var type/ecx: (payload type-tree) = int -33606 68/push 0/imm32/right:null -33607 68/push 0/imm32/right:null -33608 68/push 0/imm32/left:unused -33609 68/push 1/imm32/value:int -33610 68/push 1/imm32/is-atom?:true -33611 68/push 0x11/imm32/alloc-id:fake:payload -33612 89/<- %ecx 4/r32/esp -33613 $test-compare-mem-with-literal:initialize-var1: -33614 # var var1/ecx: (payload var) -33615 68/push 0/imm32/register -33616 68/push 0/imm32/register -33617 68/push 8/imm32/stack-offset -33618 68/push 1/imm32/block-depth -33619 51/push-ecx -33620 68/push 0x11/imm32/alloc-id:fake -33621 68/push 0/imm32/name -33622 68/push 0/imm32/name -33623 68/push 0x11/imm32/alloc-id:fake:payload -33624 89/<- %ecx 4/r32/esp -33625 $test-compare-mem-with-literal:initialize-var1-name: -33626 # var1->name = "var1" -33627 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -33628 (copy-array Heap "var1" %eax) -33629 $test-compare-mem-with-literal:initialize-literal-type: -33630 # var type/edx: (payload type-tree) = literal -33631 68/push 0/imm32/right:null -33632 68/push 0/imm32/right:null -33633 68/push 0/imm32/left:unused -33634 68/push 0/imm32/value:literal -33635 68/push 1/imm32/is-atom?:true -33636 68/push 0x11/imm32/alloc-id:fake:payload -33637 89/<- %edx 4/r32/esp -33638 $test-compare-mem-with-literal:initialize-literal: -33639 # var l/edx: (payload var) -33640 68/push 0/imm32/register -33641 68/push 0/imm32/register -33642 68/push 0/imm32/no-stack-offset -33643 68/push 1/imm32/block-depth -33644 52/push-edx -33645 68/push 0x11/imm32/alloc-id:fake -33646 68/push 0/imm32/name -33647 68/push 0/imm32/name -33648 68/push 0x11/imm32/alloc-id:fake:payload -33649 89/<- %edx 4/r32/esp -33650 $test-compare-mem-with-literal:initialize-literal-value: -33651 # l->name = "0x34" -33652 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -33653 (copy-array Heap "0x34" %eax) -33654 $test-compare-mem-with-literal:initialize-inouts: -33655 # var inouts/esi: (payload stmt-var) = [l] -33656 68/push 0/imm32/is-deref:false -33657 68/push 0/imm32/next -33658 68/push 0/imm32/next -33659 52/push-edx/l -33660 68/push 0x11/imm32/alloc-id:fake -33661 68/push 0x11/imm32/alloc-id:fake:payload -33662 89/<- %esi 4/r32/esp -33663 # var inouts = (handle stmt-var) = [var1, var2] -33664 68/push 0/imm32/is-deref:false -33665 56/push-esi/next -33666 68/push 0x11/imm32/alloc-id:fake -33667 51/push-ecx/var1 -33668 68/push 0x11/imm32/alloc-id:fake -33669 68/push 0x11/imm32/alloc-id:fake:payload -33670 89/<- %esi 4/r32/esp -33671 $test-compare-mem-with-literal:initialize-stmt: -33672 # var stmt/esi: (addr statement) -33673 68/push 0/imm32/next -33674 68/push 0/imm32/next -33675 68/push 0/imm32/outputs -33676 68/push 0/imm32/outputs -33677 56/push-esi/inouts -33678 68/push 0x11/imm32/alloc-id:fake -33679 68/push 0/imm32/operation -33680 68/push 0/imm32/operation -33681 68/push 1/imm32/tag:stmt1 -33682 89/<- %esi 4/r32/esp -33683 $test-compare-mem-with-literal:initialize-stmt-operation: -33684 # stmt->operation = "compare" -33685 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -33686 (copy-array Heap "compare" %eax) -33687 # convert -33688 c7 0/subop/copy *Curr-block-depth 0/imm32 -33689 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -33690 (flush _test-output-buffered-file) -33691 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -33697 # check output -33698 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare *(ebp+0x00000008) 0x34/imm32" "F - test-compare-mem-with-literal") -33699 # . epilogue -33700 89/<- %esp 5/r32/ebp -33701 5d/pop-to-ebp -33702 c3/return -33703 -33704 test-compare-eax-with-literal: -33705 # compare var1/eax 0x34 -33706 # => -33707 # 3d/compare-eax-with 0x34/imm32 -33708 # -33709 # . prologue -33710 55/push-ebp -33711 89/<- %ebp 4/r32/esp -33712 # setup -33713 (clear-stream _test-output-stream) -33714 (clear-stream $_test-output-buffered-file->buffer) -33715 $test-compare-eax-with-literal:initialize-type: -33716 # var type/ecx: (payload type-tree) = int -33717 68/push 0/imm32/right:null -33718 68/push 0/imm32/right:null -33719 68/push 0/imm32/left:unused -33720 68/push 1/imm32/value:int -33721 68/push 1/imm32/is-atom?:true -33722 68/push 0x11/imm32/alloc-id:fake:payload -33723 89/<- %ecx 4/r32/esp -33724 $test-compare-eax-with-literal:initialize-var1: -33725 # var var1/ecx: (payload var) -33726 68/push 0/imm32/register -33727 68/push 0/imm32/register -33728 68/push 0/imm32/no-stack-offset -33729 68/push 1/imm32/block-depth -33730 51/push-ecx -33731 68/push 0x11/imm32/alloc-id:fake -33732 68/push 0/imm32/name -33733 68/push 0/imm32/name -33734 68/push 0x11/imm32/alloc-id:fake:payload -33735 89/<- %ecx 4/r32/esp -33736 $test-compare-eax-with-literal:initialize-var1-name: -33737 # var1->name = "var1" -33738 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -33739 (copy-array Heap "var1" %eax) -33740 $test-compare-eax-with-literal:initialize-var1-register: -33741 # v->register = "eax" -33742 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -33743 (copy-array Heap "eax" %eax) -33744 $test-compare-eax-with-literal:initialize-literal-type: -33745 # var type/edx: (payload type-tree) = literal -33746 68/push 0/imm32/right:null -33747 68/push 0/imm32/right:null -33748 68/push 0/imm32/left:unused -33749 68/push 0/imm32/value:literal -33750 68/push 1/imm32/is-atom?:true -33751 68/push 0x11/imm32/alloc-id:fake:payload -33752 89/<- %edx 4/r32/esp -33753 $test-compare-eax-with-literal:initialize-literal: -33754 # var l/edx: (payload var) -33755 68/push 0/imm32/register -33756 68/push 0/imm32/register -33757 68/push 0/imm32/no-stack-offset -33758 68/push 1/imm32/block-depth -33759 52/push-edx -33760 68/push 0x11/imm32/alloc-id:fake -33761 68/push 0/imm32/name -33762 68/push 0/imm32/name -33763 68/push 0x11/imm32/alloc-id:fake:payload -33764 89/<- %edx 4/r32/esp -33765 $test-compare-eax-with-literal:initialize-literal-value: -33766 # l->name = "0x34" -33767 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -33768 (copy-array Heap "0x34" %eax) -33769 $test-compare-eax-with-literal:initialize-inouts: -33770 # var inouts/esi: (payload stmt-var) = [l] -33771 68/push 0/imm32/is-deref:false -33772 68/push 0/imm32/next -33773 68/push 0/imm32/next -33774 52/push-edx/l -33775 68/push 0x11/imm32/alloc-id:fake -33776 68/push 0x11/imm32/alloc-id:fake:payload -33777 89/<- %esi 4/r32/esp -33778 # var inouts = (handle stmt-var) = [var1, var2] -33779 68/push 0/imm32/is-deref:false -33780 56/push-esi/next -33781 68/push 0x11/imm32/alloc-id:fake -33782 51/push-ecx/var1 -33783 68/push 0x11/imm32/alloc-id:fake -33784 68/push 0x11/imm32/alloc-id:fake:payload -33785 89/<- %esi 4/r32/esp -33786 $test-compare-eax-with-literal:initialize-stmt: -33787 # var stmt/esi: (addr statement) -33788 68/push 0/imm32/next -33789 68/push 0/imm32/next -33790 68/push 0/imm32/outputs -33791 68/push 0/imm32/outputs -33792 56/push-esi/inouts -33793 68/push 0x11/imm32/alloc-id:fake -33794 68/push 0/imm32/operation -33795 68/push 0/imm32/operation -33796 68/push 1/imm32/tag:stmt1 -33797 89/<- %esi 4/r32/esp -33798 $test-compare-eax-with-literal:initialize-stmt-operation: -33799 # stmt->operation = "compare" -33800 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -33801 (copy-array Heap "compare" %eax) -33802 # convert -33803 c7 0/subop/copy *Curr-block-depth 0/imm32 -33804 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -33805 (flush _test-output-buffered-file) -33806 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -33812 # check output -33813 (check-next-stream-line-equal _test-output-stream "3d/compare-eax-with 0x34/imm32" "F - test-compare-eax-with-literal") -33814 # . epilogue -33815 89/<- %esp 5/r32/ebp -33816 5d/pop-to-ebp -33817 c3/return -33818 -33819 test-compare-reg-with-literal: -33820 # compare var1/ecx 0x34 -33821 # => -33822 # 81 7/subop/compare %ecx 0x34/imm32 -33823 # -33824 # . prologue -33825 55/push-ebp -33826 89/<- %ebp 4/r32/esp -33827 # setup -33828 (clear-stream _test-output-stream) -33829 (clear-stream $_test-output-buffered-file->buffer) -33830 $test-compare-reg-with-literal:initialize-type: -33831 # var type/ecx: (payload type-tree) = int -33832 68/push 0/imm32/right:null -33833 68/push 0/imm32/right:null -33834 68/push 0/imm32/left:unused -33835 68/push 1/imm32/value:int -33836 68/push 1/imm32/is-atom?:true -33837 68/push 0x11/imm32/alloc-id:fake:payload -33838 89/<- %ecx 4/r32/esp -33839 $test-compare-reg-with-literal:initialize-var1: -33840 # var var1/ecx: (payload var) -33841 68/push 0/imm32/register -33842 68/push 0/imm32/register -33843 68/push 0/imm32/no-stack-offset -33844 68/push 1/imm32/block-depth -33845 51/push-ecx -33846 68/push 0x11/imm32/alloc-id:fake -33847 68/push 0/imm32/name -33848 68/push 0/imm32/name -33849 68/push 0x11/imm32/alloc-id:fake:payload -33850 89/<- %ecx 4/r32/esp -33851 $test-compare-reg-with-literal:initialize-var1-name: -33852 # var1->name = "var1" -33853 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -33854 (copy-array Heap "var1" %eax) -33855 $test-compare-reg-with-literal:initialize-var1-register: -33856 # v->register = "ecx" -33857 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 -33858 (copy-array Heap "ecx" %eax) -33859 $test-compare-reg-with-literal:initialize-literal-type: -33860 # var type/edx: (payload type-tree) = literal -33861 68/push 0/imm32/right:null -33862 68/push 0/imm32/right:null -33863 68/push 0/imm32/left:unused -33864 68/push 0/imm32/value:literal -33865 68/push 1/imm32/is-atom?:true +32977 89/<- %edi 4/r32/esp +32978 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-name: +32979 # primitives->name = "increment" +32980 8d/copy-address *(edi+4) 0/r32/eax # Primitive-name + 4 +32981 (copy-array Heap "increment" %eax) +32982 $test-emit-subx-stmt-select-primitive-2:initialize-primitive2-subx-name: +32983 # primitives->subx-name = "ff 0/subop/increment" +32984 8d/copy-address *(edi+0x1c) 0/r32/eax # Primitive-subx-name + 4 +32985 (copy-array Heap "ff 0/subop/increment" %eax) +32986 $test-emit-subx-stmt-select-primitive-2:initialize-primitive: +32987 # var primitives/ebx: (addr primitive) +32988 57/push-edi +32989 68/push 0x11/imm32/alloc-id:fake +32990 68/push 0/imm32/no-x32 +32991 68/push 0/imm32/no-xm32 +32992 68/push 0/imm32/no-disp32 +32993 68/push 0/imm32/no-imm8 +32994 68/push 0/imm32/no-imm32 +32995 68/push 0/imm32/no-r32 +32996 68/push 1/imm32/rm32-is-first-inout +32997 68/push 0/imm32/subx-name +32998 68/push 0/imm32/subx-name +32999 68/push 0/imm32/no-outputs +33000 68/push 0/imm32/no-outputs +33001 53/push-ebx/inouts # hack: reuse stmt-var from call stmt as (list var) in function declaration +33002 68/push 0x11/imm32/alloc-id:fake +33003 68/push 0/imm32/name +33004 68/push 0/imm32/name +33005 89/<- %ebx 4/r32/esp +33006 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-name: +33007 # primitives->name = "increment" +33008 (copy-array Heap "increment" %ebx) # Primitive-name +33009 $test-emit-subx-stmt-select-primitive-2:initialize-primitive-subx-name: +33010 # primitives->subx-name = "ff 0/subop/increment" +33011 8d/copy-address *(ebx+0x18) 0/r32/eax # Primitive-subx-name +33012 (copy-array Heap "ff 0/subop/increment" %eax) +33013 # convert +33014 c7 0/subop/copy *Curr-block-depth 0/imm32 +33015 (emit-subx-stmt _test-output-buffered-file %esi %ebx Stderr 0) +33016 (flush _test-output-buffered-file) +33017 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +33023 # check output +33024 (check-next-stream-line-equal _test-output-stream "ff 0/subop/increment %eax" "F - test-emit-subx-stmt-select-primitive-2") +33025 # . epilogue +33026 89/<- %esp 5/r32/ebp +33027 5d/pop-to-ebp +33028 c3/return +33029 +33030 test-increment-register: +33031 # Select the right register between overloads. +33032 # foo <- increment +33033 # => +33034 # 50/increment-eax +33035 # +33036 # There's a variable on the var stack as follows: +33037 # name: 'foo' +33038 # type: int +33039 # register: 'eax' +33040 # +33041 # Primitives are the global definitions. +33042 # +33043 # . prologue +33044 55/push-ebp +33045 89/<- %ebp 4/r32/esp +33046 # setup +33047 (clear-stream _test-output-stream) +33048 (clear-stream $_test-output-buffered-file->buffer) +33049 $test-increment-register:initialize-type: +33050 # var type/ecx: (payload type-tree) = int +33051 68/push 0/imm32/right:null +33052 68/push 0/imm32/right:null +33053 68/push 0/imm32/left:unused +33054 68/push 1/imm32/value:int +33055 68/push 1/imm32/is-atom?:true +33056 68/push 0x11/imm32/alloc-id:fake:payload +33057 89/<- %ecx 4/r32/esp +33058 $test-increment-register:initialize-var: +33059 # var var-foo/ecx: (payload var) +33060 68/push 0/imm32/register +33061 68/push 0/imm32/register +33062 68/push 0/imm32/no-stack-offset +33063 68/push 1/imm32/block-depth +33064 51/push-ecx +33065 68/push 0x11/imm32/alloc-id:fake +33066 68/push 0/imm32/name +33067 68/push 0/imm32/name +33068 68/push 0x11/imm32/alloc-id:fake:payload +33069 89/<- %ecx 4/r32/esp +33070 $test-increment-register:initialize-var-name: +33071 # var-foo->name = "foo" +33072 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +33073 (copy-array Heap "foo" %eax) +33074 $test-increment-register:initialize-var-register: +33075 # var-foo->register = "eax" +33076 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +33077 (copy-array Heap "eax" %eax) +33078 $test-increment-register:initialize-stmt-var: +33079 # var operand/ebx: (payload stmt-var) +33080 68/push 0/imm32/is-deref:false +33081 68/push 0/imm32/next +33082 68/push 0/imm32/next +33083 51/push-ecx/var-foo +33084 68/push 0x11/imm32/alloc-id:fake +33085 68/push 0x11/imm32/alloc-id:fake:payload +33086 89/<- %ebx 4/r32/esp +33087 $test-increment-register:initialize-stmt: +33088 # var stmt/esi: (addr statement) +33089 53/push-ebx/outputs +33090 68/push 0x11/imm32/alloc-id:fake +33091 68/push 0/imm32/no-inouts +33092 68/push 0/imm32/no-inouts +33093 68/push 0/imm32/operation +33094 68/push 0/imm32/operation +33095 68/push 1/imm32 +33096 89/<- %esi 4/r32/esp +33097 $test-increment-register:initialize-stmt-operation: +33098 # stmt->operation = "increment" +33099 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +33100 (copy-array Heap "increment" %eax) +33101 # convert +33102 c7 0/subop/copy *Curr-block-depth 0/imm32 +33103 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +33104 (flush _test-output-buffered-file) +33105 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +33111 # check output +33112 (check-next-stream-line-equal _test-output-stream "40/increment-eax" "F - test-increment-register") +33113 # . epilogue +33114 89/<- %esp 5/r32/ebp +33115 5d/pop-to-ebp +33116 c3/return +33117 +33118 test-add-reg-to-reg: +33119 # var1/reg <- add var2/reg +33120 # => +33121 # 01/add-to %var1 var2 +33122 # +33123 # . prologue +33124 55/push-ebp +33125 89/<- %ebp 4/r32/esp +33126 # setup +33127 (clear-stream _test-output-stream) +33128 (clear-stream $_test-output-buffered-file->buffer) +33129 $test-add-reg-to-reg:initialize-type: +33130 # var type/ecx: (payload type-tree) = int +33131 68/push 0/imm32/right:null +33132 68/push 0/imm32/right:null +33133 68/push 0/imm32/left:unused +33134 68/push 1/imm32/value:int +33135 68/push 1/imm32/is-atom?:true +33136 68/push 0x11/imm32/alloc-id:fake:payload +33137 89/<- %ecx 4/r32/esp +33138 $test-add-reg-to-reg:initialize-var1: +33139 # var var1/ecx: (payload var) +33140 68/push 0/imm32/register +33141 68/push 0/imm32/register +33142 68/push 0/imm32/no-stack-offset +33143 68/push 1/imm32/block-depth +33144 51/push-ecx +33145 68/push 0x11/imm32/alloc-id:fake +33146 68/push 0/imm32/name +33147 68/push 0/imm32/name +33148 68/push 0x11/imm32/alloc-id:fake:payload +33149 89/<- %ecx 4/r32/esp +33150 $test-add-reg-to-reg:initialize-var1-name: +33151 # var1->name = "var1" +33152 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +33153 (copy-array Heap "var1" %eax) +33154 $test-add-reg-to-reg:initialize-var1-register: +33155 # var1->register = "eax" +33156 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +33157 (copy-array Heap "eax" %eax) +33158 $test-add-reg-to-reg:initialize-var2: +33159 # var var2/edx: (payload var) +33160 68/push 0/imm32/register +33161 68/push 0/imm32/register +33162 68/push 0/imm32/no-stack-offset +33163 68/push 1/imm32/block-depth +33164 ff 6/subop/push *(ecx+0x10) +33165 68/push 0x11/imm32/alloc-id:fake +33166 68/push 0/imm32/name +33167 68/push 0/imm32/name +33168 68/push 0x11/imm32/alloc-id:fake:payload +33169 89/<- %edx 4/r32/esp +33170 $test-add-reg-to-reg:initialize-var2-name: +33171 # var2->name = "var2" +33172 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +33173 (copy-array Heap "var2" %eax) +33174 $test-add-reg-to-reg:initialize-var2-register: +33175 # var2->register = "ecx" +33176 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 +33177 (copy-array Heap "ecx" %eax) +33178 $test-add-reg-to-reg:initialize-inouts: +33179 # var inouts/esi: (payload stmt-var) = [var2] +33180 68/push 0/imm32/is-deref:false +33181 68/push 0/imm32/next +33182 68/push 0/imm32/next +33183 52/push-edx/var2 +33184 68/push 0x11/imm32/alloc-id:fake +33185 68/push 0x11/imm32/alloc-id:fake:payload +33186 89/<- %esi 4/r32/esp +33187 $test-add-reg-to-reg:initialize-outputs: +33188 # var outputs/edi: (payload stmt-var) = [var1] +33189 68/push 0/imm32/is-deref:false +33190 68/push 0/imm32/next +33191 68/push 0/imm32/next +33192 51/push-ecx/var1 +33193 68/push 0x11/imm32/alloc-id:fake +33194 68/push 0x11/imm32/alloc-id:fake:payload +33195 89/<- %edi 4/r32/esp +33196 $test-add-reg-to-reg:initialize-stmt: +33197 # var stmt/esi: (addr statement) +33198 68/push 0/imm32/next +33199 68/push 0/imm32/next +33200 57/push-edi/outputs +33201 68/push 0x11/imm32/alloc-id:fake +33202 56/push-esi/inouts +33203 68/push 0x11/imm32/alloc-id:fake +33204 68/push 0/imm32/operation +33205 68/push 0/imm32/operation +33206 68/push 1/imm32/tag:stmt1 +33207 89/<- %esi 4/r32/esp +33208 $test-add-reg-to-reg:initialize-stmt-operation: +33209 # stmt->operation = "add" +33210 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +33211 (copy-array Heap "add" %eax) +33212 # convert +33213 c7 0/subop/copy *Curr-block-depth 0/imm32 +33214 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +33215 (flush _test-output-buffered-file) +33216 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +33222 # check output +33223 (check-next-stream-line-equal _test-output-stream "01/add-to %eax 0x00000001/r32" "F - test-add-reg-to-reg") +33224 # . epilogue +33225 89/<- %esp 5/r32/ebp +33226 5d/pop-to-ebp +33227 c3/return +33228 +33229 test-add-reg-to-mem: +33230 # add-to var1 var2/reg +33231 # => +33232 # 01/add-to *(ebp+__) var2 +33233 # +33234 # . prologue +33235 55/push-ebp +33236 89/<- %ebp 4/r32/esp +33237 # setup +33238 (clear-stream _test-output-stream) +33239 (clear-stream $_test-output-buffered-file->buffer) +33240 $test-add-reg-to-mem:initialize-type: +33241 # var type/ecx: (payload type-tree) = int +33242 68/push 0/imm32/right:null +33243 68/push 0/imm32/right:null +33244 68/push 0/imm32/left:unused +33245 68/push 1/imm32/value:int +33246 68/push 1/imm32/is-atom?:true +33247 68/push 0x11/imm32/alloc-id:fake:payload +33248 89/<- %ecx 4/r32/esp +33249 $test-add-reg-to-mem:initialize-var1: +33250 # var var1/ecx: (payload var) +33251 68/push 0/imm32/register +33252 68/push 0/imm32/register +33253 68/push 8/imm32/stack-offset +33254 68/push 1/imm32/block-depth +33255 51/push-ecx +33256 68/push 0x11/imm32/alloc-id:fake +33257 68/push 0/imm32/name +33258 68/push 0/imm32/name +33259 68/push 0x11/imm32/alloc-id:fake:payload +33260 89/<- %ecx 4/r32/esp +33261 $test-add-reg-to-mem:initialize-var1-name: +33262 # var1->name = "var1" +33263 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +33264 (copy-array Heap "var1" %eax) +33265 $test-add-reg-to-mem:initialize-var2: +33266 # var var2/edx: (payload var) +33267 68/push 0/imm32/register +33268 68/push 0/imm32/register +33269 68/push 0/imm32/no-stack-offset +33270 68/push 1/imm32/block-depth +33271 ff 6/subop/push *(ecx+0x10) +33272 68/push 0x11/imm32/alloc-id:fake +33273 68/push 0/imm32/name +33274 68/push 0/imm32/name +33275 68/push 0x11/imm32/alloc-id:fake:payload +33276 89/<- %edx 4/r32/esp +33277 $test-add-reg-to-mem:initialize-var2-name: +33278 # var2->name = "var2" +33279 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +33280 (copy-array Heap "var2" %eax) +33281 $test-add-reg-to-mem:initialize-var2-register: +33282 # var2->register = "ecx" +33283 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 +33284 (copy-array Heap "ecx" %eax) +33285 $test-add-reg-to-mem:initialize-inouts: +33286 # var inouts/esi: (payload stmt-var) = [var2] +33287 68/push 0/imm32/is-deref:false +33288 68/push 0/imm32/next +33289 68/push 0/imm32/next +33290 52/push-edx/var2 +33291 68/push 0x11/imm32/alloc-id:fake +33292 68/push 0x11/imm32/alloc-id:fake:payload +33293 89/<- %esi 4/r32/esp +33294 # inouts = [var1, var2] +33295 68/push 0/imm32/is-deref:false +33296 56/push-esi/next +33297 68/push 0x11/imm32/alloc-id:fake +33298 51/push-ecx/var1 +33299 68/push 0x11/imm32/alloc-id:fake +33300 68/push 0x11/imm32/alloc-id:fake:payload +33301 89/<- %esi 4/r32/esp +33302 $test-add-reg-to-mem:initialize-stmt: +33303 # var stmt/esi: (addr statement) +33304 68/push 0/imm32/next +33305 68/push 0/imm32/next +33306 68/push 0/imm32/outputs +33307 68/push 0/imm32/outputs +33308 56/push-esi/inouts +33309 68/push 0x11/imm32/alloc-id:fake +33310 68/push 0/imm32/operation +33311 68/push 0/imm32/operation +33312 68/push 1/imm32/tag:stmt1 +33313 89/<- %esi 4/r32/esp +33314 $test-add-reg-to-mem:initialize-stmt-operation: +33315 # stmt->operation = "add-to" +33316 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +33317 (copy-array Heap "add-to" %eax) +33318 # convert +33319 c7 0/subop/copy *Curr-block-depth 0/imm32 +33320 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +33321 (flush _test-output-buffered-file) +33322 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +33328 # check output +33329 (check-next-stream-line-equal _test-output-stream "01/add-to *(ebp+0x00000008) 0x00000001/r32" "F - test-add-reg-to-mem") +33330 # . epilogue +33331 89/<- %esp 5/r32/ebp +33332 5d/pop-to-ebp +33333 c3/return +33334 +33335 test-add-mem-to-reg: +33336 # var1/reg <- add var2 +33337 # => +33338 # 03/add *(ebp+__) var1 +33339 # +33340 # . prologue +33341 55/push-ebp +33342 89/<- %ebp 4/r32/esp +33343 # setup +33344 (clear-stream _test-output-stream) +33345 (clear-stream $_test-output-buffered-file->buffer) +33346 $test-add-mem-to-reg:initialize-type: +33347 # var type/ecx: (payload type-tree) = int +33348 68/push 0/imm32/right:null +33349 68/push 0/imm32/right:null +33350 68/push 0/imm32/left:unused +33351 68/push 1/imm32/value:int +33352 68/push 1/imm32/is-atom?:true +33353 68/push 0x11/imm32/alloc-id:fake:payload +33354 89/<- %ecx 4/r32/esp +33355 $test-add-mem-to-reg:initialize-var: +33356 # var var1/ecx: (payload var) +33357 68/push 0/imm32/register +33358 68/push 0/imm32/register +33359 68/push 0/imm32/no-stack-offset +33360 68/push 1/imm32/block-depth +33361 51/push-ecx +33362 68/push 0x11/imm32/alloc-id:fake +33363 68/push 0/imm32/name +33364 68/push 0/imm32/name +33365 68/push 0x11/imm32/alloc-id:fake:payload +33366 89/<- %ecx 4/r32/esp +33367 $test-add-mem-to-reg:initialize-var-name: +33368 # var1->name = "foo" +33369 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +33370 (copy-array Heap "var1" %eax) +33371 $test-add-mem-to-reg:initialize-var-register: +33372 # var1->register = "eax" +33373 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +33374 (copy-array Heap "eax" %eax) +33375 $test-add-mem-to-reg:initialize-var2: +33376 # var var2/edx: (payload var) +33377 68/push 0/imm32/register +33378 68/push 0/imm32/register +33379 68/push 8/imm32/stack-offset +33380 68/push 1/imm32/block-depth +33381 ff 6/subop/push *(ecx+0x10) +33382 68/push 0x11/imm32/alloc-id:fake +33383 68/push 0/imm32/name +33384 68/push 0/imm32/name +33385 68/push 0x11/imm32/alloc-id:fake:payload +33386 89/<- %edx 4/r32/esp +33387 $test-add-mem-to-reg:initialize-var2-name: +33388 # var2->name = "var2" +33389 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +33390 (copy-array Heap "var2" %eax) +33391 $test-add-mem-to-reg:initialize-inouts: +33392 # var inouts/esi: (payload stmt-var) = [var2] +33393 68/push 0/imm32/is-deref:false +33394 68/push 0/imm32/next +33395 68/push 0/imm32/next +33396 52/push-edx/var2 +33397 68/push 0x11/imm32/alloc-id:fake +33398 68/push 0x11/imm32/alloc-id:fake:payload +33399 89/<- %esi 4/r32/esp +33400 $test-add-mem-to-reg:initialize-outputs: +33401 # var outputs/edi: (payload stmt-var) = [var1] +33402 68/push 0/imm32/is-deref:false +33403 68/push 0/imm32/next +33404 68/push 0/imm32/next +33405 51/push-ecx/var1 +33406 68/push 0x11/imm32/alloc-id:fake +33407 68/push 0x11/imm32/alloc-id:fake:payload +33408 89/<- %edi 4/r32/esp +33409 $test-add-mem-to-reg:initialize-stmt: +33410 # var stmt/esi: (addr statement) +33411 68/push 0/imm32/next +33412 68/push 0/imm32/next +33413 57/push-edi/outputs +33414 68/push 0x11/imm32/alloc-id:fake +33415 56/push-esi/inouts +33416 68/push 0x11/imm32/alloc-id:fake +33417 68/push 0/imm32/operation +33418 68/push 0/imm32/operation +33419 68/push 1/imm32/tag:stmt1 +33420 89/<- %esi 4/r32/esp +33421 $test-add-mem-to-reg:initialize-stmt-operation: +33422 # stmt->operation = "add" +33423 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +33424 (copy-array Heap "add" %eax) +33425 # convert +33426 c7 0/subop/copy *Curr-block-depth 0/imm32 +33427 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +33428 (flush _test-output-buffered-file) +33429 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +33435 # check output +33436 (check-next-stream-line-equal _test-output-stream "03/add *(ebp+0x00000008) 0x00000000/r32" "F - test-add-mem-to-reg") +33437 # . epilogue +33438 89/<- %esp 5/r32/ebp +33439 5d/pop-to-ebp +33440 c3/return +33441 +33442 test-add-literal-to-eax: +33443 # var1/eax <- add 0x34 +33444 # => +33445 # 05/add-to-eax 0x34/imm32 +33446 # +33447 # . prologue +33448 55/push-ebp +33449 89/<- %ebp 4/r32/esp +33450 # setup +33451 (clear-stream _test-output-stream) +33452 (clear-stream $_test-output-buffered-file->buffer) +33453 $test-add-literal-to-eax:initialize-var-type: +33454 # var type/ecx: (payload type-tree) = int +33455 68/push 0/imm32/right:null +33456 68/push 0/imm32/right:null +33457 68/push 0/imm32/left:unused +33458 68/push 1/imm32/value:int +33459 68/push 1/imm32/is-atom?:true +33460 68/push 0x11/imm32/alloc-id:fake:payload +33461 89/<- %ecx 4/r32/esp +33462 $test-add-literal-to-eax:initialize-var: +33463 # var v/ecx: (payload var) +33464 68/push 0/imm32/register +33465 68/push 0/imm32/register +33466 68/push 0/imm32/no-stack-offset +33467 68/push 1/imm32/block-depth +33468 51/push-ecx +33469 68/push 0x11/imm32/alloc-id:fake +33470 68/push 0/imm32/name +33471 68/push 0/imm32/name +33472 68/push 0x11/imm32/alloc-id:fake:payload +33473 89/<- %ecx 4/r32/esp +33474 $test-add-literal-to-eax:initialize-var-name: +33475 # v->name = "v" +33476 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +33477 (copy-array Heap "v" %eax) +33478 $test-add-literal-to-eax:initialize-var-register: +33479 # v->register = "eax" +33480 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +33481 (copy-array Heap "eax" %eax) +33482 $test-add-literal-to-eax:initialize-literal-type: +33483 # var type/edx: (payload type-tree) = literal +33484 68/push 0/imm32/right:null +33485 68/push 0/imm32/right:null +33486 68/push 0/imm32/left:unused +33487 68/push 0/imm32/value:literal +33488 68/push 1/imm32/is-atom?:true +33489 68/push 0x11/imm32/alloc-id:fake:payload +33490 89/<- %edx 4/r32/esp +33491 $test-add-literal-to-eax:initialize-literal: +33492 # var l/edx: (payload var) +33493 68/push 0/imm32/register +33494 68/push 0/imm32/register +33495 68/push 0/imm32/no-stack-offset +33496 68/push 1/imm32/block-depth +33497 52/push-edx +33498 68/push 0x11/imm32/alloc-id:fake +33499 68/push 0/imm32/name +33500 68/push 0/imm32/name +33501 68/push 0x11/imm32/alloc-id:fake:payload +33502 89/<- %edx 4/r32/esp +33503 $test-add-literal-to-eax:initialize-literal-value: +33504 # l->name = "0x34" +33505 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +33506 (copy-array Heap "0x34" %eax) +33507 $test-add-literal-to-eax:initialize-inouts: +33508 # var inouts/esi: (payload stmt-var) = [l] +33509 68/push 0/imm32/is-deref:false +33510 68/push 0/imm32/next +33511 68/push 0/imm32/next +33512 52/push-edx/l +33513 68/push 0x11/imm32/alloc-id:fake +33514 68/push 0x11/imm32/alloc-id:fake:payload +33515 89/<- %esi 4/r32/esp +33516 $test-add-literal-to-eax:initialize-outputs: +33517 # var outputs/edi: (payload stmt-var) = [v] +33518 68/push 0/imm32/is-deref:false +33519 68/push 0/imm32/next +33520 68/push 0/imm32/next +33521 51/push-ecx/v +33522 68/push 0x11/imm32/alloc-id:fake +33523 68/push 0x11/imm32/alloc-id:fake:payload +33524 89/<- %edi 4/r32/esp +33525 $test-add-literal-to-eax:initialize-stmt: +33526 # var stmt/esi: (addr statement) +33527 68/push 0/imm32/next +33528 68/push 0/imm32/next +33529 57/push-edi/outputs +33530 68/push 0x11/imm32/alloc-id:fake +33531 56/push-esi/inouts +33532 68/push 0x11/imm32/alloc-id:fake +33533 68/push 0/imm32/operation +33534 68/push 0/imm32/operation +33535 68/push 1/imm32/tag:stmt1 +33536 89/<- %esi 4/r32/esp +33537 $test-add-literal-to-eax:initialize-stmt-operation: +33538 # stmt->operation = "add" +33539 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +33540 (copy-array Heap "add" %eax) +33541 # convert +33542 c7 0/subop/copy *Curr-block-depth 0/imm32 +33543 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +33544 (flush _test-output-buffered-file) +33545 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +33551 # check output +33552 (check-next-stream-line-equal _test-output-stream "05/add-to-eax 0x34/imm32" "F - test-add-literal-to-eax") +33553 # . epilogue +33554 89/<- %esp 5/r32/ebp +33555 5d/pop-to-ebp +33556 c3/return +33557 +33558 test-add-literal-to-reg: +33559 # var1/ecx <- add 0x34 +33560 # => +33561 # 81 0/subop/add %ecx 0x34/imm32 +33562 # +33563 # . prologue +33564 55/push-ebp +33565 89/<- %ebp 4/r32/esp +33566 # setup +33567 (clear-stream _test-output-stream) +33568 (clear-stream $_test-output-buffered-file->buffer) +33569 $test-add-literal-to-reg:initialize-var-type: +33570 # var type/ecx: (payload type-tree) = int +33571 68/push 0/imm32/right:null +33572 68/push 0/imm32/right:null +33573 68/push 0/imm32/left:unused +33574 68/push 1/imm32/value:int +33575 68/push 1/imm32/is-atom?:true +33576 68/push 0x11/imm32/alloc-id:fake:payload +33577 89/<- %ecx 4/r32/esp +33578 $test-add-literal-to-reg:initialize-var: +33579 # var v/ecx: (payload var) +33580 68/push 0/imm32/register +33581 68/push 0/imm32/register +33582 68/push 0/imm32/no-stack-offset +33583 68/push 1/imm32/block-depth +33584 51/push-ecx +33585 68/push 0x11/imm32/alloc-id:fake +33586 68/push 0/imm32/name +33587 68/push 0/imm32/name +33588 68/push 0x11/imm32/alloc-id:fake:payload +33589 89/<- %ecx 4/r32/esp +33590 $test-add-literal-to-reg:initialize-var-name: +33591 # v->name = "v" +33592 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +33593 (copy-array Heap "v" %eax) +33594 $test-add-literal-to-reg:initialize-var-register: +33595 # v->register = "ecx" +33596 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +33597 (copy-array Heap "ecx" %eax) +33598 $test-add-literal-to-reg:initialize-literal-type: +33599 # var type/edx: (payload type-tree) = literal +33600 68/push 0/imm32/right:null +33601 68/push 0/imm32/right:null +33602 68/push 0/imm32/left:unused +33603 68/push 0/imm32/value:literal +33604 68/push 1/imm32/is-atom?:true +33605 68/push 0x11/imm32/alloc-id:fake:payload +33606 89/<- %edx 4/r32/esp +33607 $test-add-literal-to-reg:initialize-literal: +33608 # var l/edx: (payload var) +33609 68/push 0/imm32/register +33610 68/push 0/imm32/register +33611 68/push 0/imm32/no-stack-offset +33612 68/push 1/imm32/block-depth +33613 52/push-edx +33614 68/push 0x11/imm32/alloc-id:fake +33615 68/push 0/imm32/name +33616 68/push 0/imm32/name +33617 68/push 0x11/imm32/alloc-id:fake:payload +33618 89/<- %edx 4/r32/esp +33619 $test-add-literal-to-reg:initialize-literal-value: +33620 # l->name = "0x34" +33621 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +33622 (copy-array Heap "0x34" %eax) +33623 $test-add-literal-to-reg:initialize-inouts: +33624 # var inouts/esi: (payload stmt-var) = [l] +33625 68/push 0/imm32/is-deref:false +33626 68/push 0/imm32/next +33627 68/push 0/imm32/next +33628 52/push-edx/l +33629 68/push 0x11/imm32/alloc-id:fake +33630 68/push 0x11/imm32/alloc-id:fake:payload +33631 89/<- %esi 4/r32/esp +33632 $test-add-literal-to-reg:initialize-outputs: +33633 # var outputs/edi: (payload stmt-var) = [v] +33634 68/push 0/imm32/is-deref:false +33635 68/push 0/imm32/next +33636 68/push 0/imm32/next +33637 51/push-ecx/v +33638 68/push 0x11/imm32/alloc-id:fake +33639 68/push 0x11/imm32/alloc-id:fake:payload +33640 89/<- %edi 4/r32/esp +33641 $test-add-literal-to-reg:initialize-stmt: +33642 # var stmt/esi: (addr statement) +33643 68/push 0/imm32/next +33644 68/push 0/imm32/next +33645 57/push-edi/outputs +33646 68/push 0x11/imm32/alloc-id:fake +33647 56/push-esi/inouts +33648 68/push 0x11/imm32/alloc-id:fake +33649 68/push 0/imm32/operation +33650 68/push 0/imm32/operation +33651 68/push 1/imm32/tag:stmt1 +33652 89/<- %esi 4/r32/esp +33653 $test-add-literal-to-reg:initialize-stmt-operation: +33654 # stmt->operation = "add" +33655 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +33656 (copy-array Heap "add" %eax) +33657 # convert +33658 c7 0/subop/copy *Curr-block-depth 0/imm32 +33659 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +33660 (flush _test-output-buffered-file) +33661 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +33667 # check output +33668 (check-next-stream-line-equal _test-output-stream "81 0/subop/add %ecx 0x34/imm32" "F - test-add-literal-to-reg") +33669 # . epilogue +33670 89/<- %esp 5/r32/ebp +33671 5d/pop-to-ebp +33672 c3/return +33673 +33674 test-add-literal-to-mem: +33675 # add-to var1, 0x34 +33676 # => +33677 # 81 0/subop/add %eax 0x34/imm32 +33678 # +33679 # . prologue +33680 55/push-ebp +33681 89/<- %ebp 4/r32/esp +33682 # setup +33683 (clear-stream _test-output-stream) +33684 (clear-stream $_test-output-buffered-file->buffer) +33685 $test-add-literal-to-mem:initialize-type: +33686 # var type/ecx: (payload type-tree) = int +33687 68/push 0/imm32/right:null +33688 68/push 0/imm32/right:null +33689 68/push 0/imm32/left:unused +33690 68/push 1/imm32/value:int +33691 68/push 1/imm32/is-atom?:true +33692 68/push 0x11/imm32/alloc-id:fake:payload +33693 89/<- %ecx 4/r32/esp +33694 $test-add-literal-to-mem:initialize-var1: +33695 # var var1/ecx: (payload var) +33696 68/push 0/imm32/register +33697 68/push 0/imm32/register +33698 68/push 8/imm32/stack-offset +33699 68/push 1/imm32/block-depth +33700 51/push-ecx +33701 68/push 0x11/imm32/alloc-id:fake +33702 68/push 0/imm32/name +33703 68/push 0/imm32/name +33704 68/push 0x11/imm32/alloc-id:fake:payload +33705 89/<- %ecx 4/r32/esp +33706 $test-add-literal-to-mem:initialize-var1-name: +33707 # var1->name = "var1" +33708 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +33709 (copy-array Heap "var1" %eax) +33710 $test-add-literal-to-mem:initialize-literal-type: +33711 # var type/edx: (payload type-tree) = literal +33712 68/push 0/imm32/right:null +33713 68/push 0/imm32/right:null +33714 68/push 0/imm32/left:unused +33715 68/push 0/imm32/value:literal +33716 68/push 1/imm32/is-atom?:true +33717 68/push 0x11/imm32/alloc-id:fake:payload +33718 89/<- %edx 4/r32/esp +33719 $test-add-literal-to-mem:initialize-literal: +33720 # var l/edx: (payload var) +33721 68/push 0/imm32/register +33722 68/push 0/imm32/register +33723 68/push 0/imm32/no-stack-offset +33724 68/push 1/imm32/block-depth +33725 52/push-edx +33726 68/push 0x11/imm32/alloc-id:fake +33727 68/push 0/imm32/name +33728 68/push 0/imm32/name +33729 68/push 0x11/imm32/alloc-id:fake:payload +33730 89/<- %edx 4/r32/esp +33731 $test-add-literal-to-mem:initialize-literal-value: +33732 # l->name = "0x34" +33733 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +33734 (copy-array Heap "0x34" %eax) +33735 $test-add-literal-to-mem:initialize-inouts: +33736 # var inouts/esi: (payload stmt-var) = [l] +33737 68/push 0/imm32/is-deref:false +33738 68/push 0/imm32/next +33739 68/push 0/imm32/next +33740 52/push-edx/l +33741 68/push 0x11/imm32/alloc-id:fake +33742 68/push 0x11/imm32/alloc-id:fake:payload +33743 89/<- %esi 4/r32/esp +33744 # var inouts = (handle stmt-var) = [var1, var2] +33745 68/push 0/imm32/is-deref:false +33746 56/push-esi/next +33747 68/push 0x11/imm32/alloc-id:fake +33748 51/push-ecx/var1 +33749 68/push 0x11/imm32/alloc-id:fake +33750 68/push 0x11/imm32/alloc-id:fake:payload +33751 89/<- %esi 4/r32/esp +33752 $test-add-literal-to-mem:initialize-stmt: +33753 # var stmt/esi: (addr statement) +33754 68/push 0/imm32/next +33755 68/push 0/imm32/next +33756 68/push 0/imm32/outputs +33757 68/push 0/imm32/outputs +33758 56/push-esi/inouts +33759 68/push 0x11/imm32/alloc-id:fake +33760 68/push 0/imm32/operation +33761 68/push 0/imm32/operation +33762 68/push 1/imm32/tag:stmt1 +33763 89/<- %esi 4/r32/esp +33764 $test-add-literal-to-mem:initialize-stmt-operation: +33765 # stmt->operation = "add-to" +33766 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +33767 (copy-array Heap "add-to" %eax) +33768 # convert +33769 c7 0/subop/copy *Curr-block-depth 0/imm32 +33770 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +33771 (flush _test-output-buffered-file) +33772 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +33778 # check output +33779 (check-next-stream-line-equal _test-output-stream "81 0/subop/add *(ebp+0x00000008) 0x34/imm32" "F - test-add-literal-to-mem") +33780 # . epilogue +33781 89/<- %esp 5/r32/ebp +33782 5d/pop-to-ebp +33783 c3/return +33784 +33785 test-shift-reg-by-literal: +33786 # var1/ecx <- shift-left 2 +33787 # => +33788 # c1/shift 4/subop/left %ecx 2/imm8 +33789 # +33790 # . prologue +33791 55/push-ebp +33792 89/<- %ebp 4/r32/esp +33793 # setup +33794 (clear-stream _test-output-stream) +33795 (clear-stream $_test-output-buffered-file->buffer) +33796 $test-shift-reg-by-literal:initialize-var-type: +33797 # var type/ecx: (payload type-tree) = int +33798 68/push 0/imm32/right:null +33799 68/push 0/imm32/right:null +33800 68/push 0/imm32/left:unused +33801 68/push 1/imm32/value:int +33802 68/push 1/imm32/is-atom?:true +33803 68/push 0x11/imm32/alloc-id:fake:payload +33804 89/<- %ecx 4/r32/esp +33805 $test-shift-reg-by-literal:initialize-var: +33806 # var v/ecx: (payload var) +33807 68/push 0/imm32/register +33808 68/push 0/imm32/register +33809 68/push 0/imm32/no-stack-offset +33810 68/push 1/imm32/block-depth +33811 51/push-ecx +33812 68/push 0x11/imm32/alloc-id:fake +33813 68/push 0/imm32/name +33814 68/push 0/imm32/name +33815 68/push 0x11/imm32/alloc-id:fake:payload +33816 89/<- %ecx 4/r32/esp +33817 $test-shift-reg-by-literal:initialize-var-name: +33818 # v->name = "v" +33819 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +33820 (copy-array Heap "v" %eax) +33821 $test-shift-reg-by-literal:initialize-var-register: +33822 # v->register = "ecx" +33823 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +33824 (copy-array Heap "ecx" %eax) +33825 $test-shift-reg-by-literal:initialize-literal-type: +33826 # var type/edx: (payload type-tree) = literal +33827 68/push 0/imm32/right:null +33828 68/push 0/imm32/right:null +33829 68/push 0/imm32/left:unused +33830 68/push 0/imm32/value:literal +33831 68/push 1/imm32/is-atom?:true +33832 68/push 0x11/imm32/alloc-id:fake:payload +33833 89/<- %edx 4/r32/esp +33834 $test-shift-reg-by-literal:initialize-literal: +33835 # var l/edx: (payload var) +33836 68/push 0/imm32/register +33837 68/push 0/imm32/register +33838 68/push 0/imm32/no-stack-offset +33839 68/push 1/imm32/block-depth +33840 52/push-edx +33841 68/push 0x11/imm32/alloc-id:fake +33842 68/push 0/imm32/name +33843 68/push 0/imm32/name +33844 68/push 0x11/imm32/alloc-id:fake:payload +33845 89/<- %edx 4/r32/esp +33846 $test-shift-reg-by-literal:initialize-literal-value: +33847 # l->name = "2" +33848 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +33849 (copy-array Heap "2" %eax) +33850 $test-shift-reg-by-literal:initialize-inouts: +33851 # var inouts/esi: (payload stmt-var) = [l] +33852 68/push 0/imm32/is-deref:false +33853 68/push 0/imm32/next +33854 68/push 0/imm32/next +33855 52/push-edx/l +33856 68/push 0x11/imm32/alloc-id:fake +33857 68/push 0x11/imm32/alloc-id:fake:payload +33858 89/<- %esi 4/r32/esp +33859 $test-shift-reg-by-literal:initialize-outputs: +33860 # var outputs/edi: (payload stmt-var) = [v] +33861 68/push 0/imm32/is-deref:false +33862 68/push 0/imm32/next +33863 68/push 0/imm32/next +33864 51/push-ecx/v +33865 68/push 0x11/imm32/alloc-id:fake 33866 68/push 0x11/imm32/alloc-id:fake:payload -33867 89/<- %edx 4/r32/esp -33868 $test-compare-reg-with-literal:initialize-literal: -33869 # var l/edx: (payload var) -33870 68/push 0/imm32/register -33871 68/push 0/imm32/register -33872 68/push 0/imm32/no-stack-offset -33873 68/push 1/imm32/block-depth -33874 52/push-edx +33867 89/<- %edi 4/r32/esp +33868 $test-shift-reg-by-literal:initialize-stmt: +33869 # var stmt/esi: (addr statement) +33870 68/push 0/imm32/next +33871 68/push 0/imm32/next +33872 57/push-edi/outputs +33873 68/push 0x11/imm32/alloc-id:fake +33874 56/push-esi/inouts 33875 68/push 0x11/imm32/alloc-id:fake -33876 68/push 0/imm32/name -33877 68/push 0/imm32/name -33878 68/push 0x11/imm32/alloc-id:fake:payload -33879 89/<- %edx 4/r32/esp -33880 $test-compare-reg-with-literal:initialize-literal-value: -33881 # l->name = "0x34" -33882 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 -33883 (copy-array Heap "0x34" %eax) -33884 $test-compare-reg-with-literal:initialize-inouts: -33885 # var inouts/esi: (payload stmt-var) = [l] -33886 68/push 0/imm32/is-deref:false -33887 68/push 0/imm32/next -33888 68/push 0/imm32/next -33889 52/push-edx/l -33890 68/push 0x11/imm32/alloc-id:fake -33891 68/push 0x11/imm32/alloc-id:fake:payload -33892 89/<- %esi 4/r32/esp -33893 # var inouts = (handle stmt-var) = [var1, var2] -33894 68/push 0/imm32/is-deref:false -33895 56/push-esi/next -33896 68/push 0x11/imm32/alloc-id:fake -33897 51/push-ecx/var1 -33898 68/push 0x11/imm32/alloc-id:fake -33899 68/push 0x11/imm32/alloc-id:fake:payload -33900 89/<- %esi 4/r32/esp -33901 $test-compare-reg-with-literal:initialize-stmt: -33902 # var stmt/esi: (addr statement) -33903 68/push 0/imm32/next -33904 68/push 0/imm32/next -33905 68/push 0/imm32/outputs -33906 68/push 0/imm32/outputs -33907 56/push-esi/inouts -33908 68/push 0x11/imm32/alloc-id:fake -33909 68/push 0/imm32/operation -33910 68/push 0/imm32/operation -33911 68/push 1/imm32/tag:stmt1 -33912 89/<- %esi 4/r32/esp -33913 $test-compare-reg-with-literal:initialize-stmt-operation: -33914 # stmt->operation = "compare" -33915 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -33916 (copy-array Heap "compare" %eax) -33917 # convert -33918 c7 0/subop/copy *Curr-block-depth 0/imm32 -33919 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) -33920 (flush _test-output-buffered-file) -33921 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -33927 # check output -33928 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare %ecx 0x34/imm32" "F - test-compare-reg-with-literal") -33929 # . epilogue -33930 89/<- %esp 5/r32/ebp -33931 5d/pop-to-ebp -33932 c3/return -33933 -33934 test-emit-subx-stmt-function-call: -33935 # Call a function on a variable on the stack. -33936 # f foo -33937 # => -33938 # (f *(ebp-8)) -33939 # (Changing the function name supports overloading in general, but here it -33940 # just serves to help disambiguate things.) -33941 # -33942 # There's a variable on the var stack as follows: -33943 # name: 'foo' -33944 # type: int -33945 # stack-offset: -8 -33946 # -33947 # There's nothing in primitives. -33948 # -33949 # We don't perform any checking here on the type of 'f'. -33950 # -33951 # . prologue -33952 55/push-ebp -33953 89/<- %ebp 4/r32/esp -33954 # setup -33955 (clear-stream _test-output-stream) -33956 (clear-stream $_test-output-buffered-file->buffer) -33957 $test-emit-subx-function-call:initialize-type: -33958 # var type/ecx: (payload type-tree) = int -33959 68/push 0/imm32/right:null -33960 68/push 0/imm32/right:null -33961 68/push 0/imm32/left:unused -33962 68/push 1/imm32/value:int -33963 68/push 1/imm32/is-atom?:true -33964 68/push 0x11/imm32/alloc-id:fake:payload -33965 89/<- %ecx 4/r32/esp -33966 $test-emit-subx-function-call:initialize-var: -33967 # var var-foo/ecx: (payload var) = var(type) -33968 68/push 0/imm32/no-register -33969 68/push 0/imm32/no-register -33970 68/push -8/imm32/stack-offset -33971 68/push 1/imm32/block-depth -33972 51/push-ecx/type -33973 68/push 0x11/imm32/alloc-id:fake -33974 68/push 0/imm32/name -33975 68/push 0/imm32/name -33976 68/push 0x11/imm32/alloc-id:fake:payload -33977 89/<- %ecx 4/r32/esp -33978 $test-emit-subx-function-call:initialize-var-name: -33979 # var-foo->name = "foo" -33980 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -33981 (copy-array Heap "foo" %eax) -33982 $test-emit-subx-function-call:initialize-stmt-var: -33983 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) -33984 68/push 0/imm32/is-deref:false -33985 68/push 0/imm32/next -33986 68/push 0/imm32/next -33987 51/push-ecx/var-foo -33988 68/push 0x11/imm32/alloc-id:fake -33989 68/push 0x11/imm32/alloc-id:fake:payload -33990 89/<- %ebx 4/r32/esp -33991 $test-emit-subx-function-call:initialize-stmt: -33992 # var stmt/esi: (addr statement) -33993 68/push 0/imm32/no-outputs -33994 68/push 0/imm32/no-outputs -33995 53/push-ebx/inouts -33996 68/push 0x11/imm32/alloc-id:fake -33997 68/push 0/imm32/operation -33998 68/push 0/imm32/operation -33999 68/push 1/imm32/tag -34000 89/<- %esi 4/r32/esp -34001 $test-emit-subx-function-call:initialize-stmt-operation: -34002 # stmt->operation = "f" -34003 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -34004 (copy-array Heap "f" %eax) -34005 # convert -34006 c7 0/subop/copy *Curr-block-depth 0/imm32 -34007 (emit-subx-stmt _test-output-buffered-file %esi 0 Stderr 0) -34008 (flush _test-output-buffered-file) -34009 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -34015 # check output -34016 (check-next-stream-line-equal _test-output-stream "(f *(ebp+0xfffffff8))" "F - test-emit-subx-stmt-function-call") -34017 # . epilogue -34018 89/<- %esp 5/r32/ebp -34019 5d/pop-to-ebp -34020 c3/return -34021 -34022 test-emit-subx-stmt-function-call-with-literal-arg: -34023 # Call a function on a literal. -34024 # f 0x34 -34025 # => -34026 # (f2 0x34) -34027 # -34028 # . prologue -34029 55/push-ebp -34030 89/<- %ebp 4/r32/esp -34031 # setup -34032 (clear-stream _test-output-stream) -34033 (clear-stream $_test-output-buffered-file->buffer) -34034 $test-emit-subx-function-call-with-literal-arg:initialize-type: -34035 # var type/ecx: (payload type-tree) = int -34036 68/push 0/imm32/right:null -34037 68/push 0/imm32/right:null -34038 68/push 0/imm32/left:unused -34039 68/push 0/imm32/value:literal -34040 68/push 1/imm32/is-atom?:true -34041 68/push 0x11/imm32/alloc-id:fake:payload -34042 89/<- %ecx 4/r32/esp -34043 $test-emit-subx-function-call-with-literal-arg:initialize-var: -34044 # var var-foo/ecx: (payload var) = var(lit) -34045 68/push 0/imm32/no-register -34046 68/push 0/imm32/no-register -34047 68/push 0/imm32/no-stack-offset -34048 68/push 1/imm32/block-depth -34049 51/push-ecx/type -34050 68/push 0x11/imm32/alloc-id:fake -34051 68/push 0/imm32/name -34052 68/push 0/imm32/name -34053 68/push 0x11/imm32/alloc-id:fake:payload -34054 89/<- %ecx 4/r32/esp -34055 $test-emit-subx-function-call-with-literal-arg:initialize-var-name: -34056 # var-foo->name = "0x34" -34057 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 -34058 (copy-array Heap "0x34" %eax) -34059 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-var: -34060 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) -34061 68/push 0/imm32/is-deref:false -34062 68/push 0/imm32/next -34063 68/push 0/imm32/next -34064 51/push-ecx/var-foo -34065 68/push 0x11/imm32/alloc-id:fake -34066 68/push 0x11/imm32/alloc-id:fake:payload -34067 89/<- %ebx 4/r32/esp -34068 $test-emit-subx-function-call-with-literal-arg:initialize-stmt: -34069 # var stmt/esi: (addr statement) -34070 68/push 0/imm32/no-outputs -34071 68/push 0/imm32/no-outputs -34072 53/push-ebx/inouts -34073 68/push 0x11/imm32/alloc-id:fake -34074 68/push 0/imm32/operation -34075 68/push 0/imm32/operation -34076 68/push 1/imm32/tag -34077 89/<- %esi 4/r32/esp -34078 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-operation: -34079 # stmt->operation = "f" -34080 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation -34081 (copy-array Heap "f" %eax) -34082 # convert -34083 c7 0/subop/copy *Curr-block-depth 0/imm32 -34084 (emit-subx-stmt _test-output-buffered-file %esi 0 %ebx Stderr 0) -34085 (flush _test-output-buffered-file) -34086 +-- 6 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -34092 # check output -34093 (check-next-stream-line-equal _test-output-stream "(f 0x34)" "F - test-emit-subx-stmt-function-call-with-literal-arg") -34094 # . epilogue -34095 89/<- %esp 5/r32/ebp -34096 5d/pop-to-ebp -34097 c3/return -34098 -34099 emit-indent: # out: (addr buffered-file), n: int -34100 # . prologue -34101 55/push-ebp -34102 89/<- %ebp 4/r32/esp -34103 # . save registers -34104 50/push-eax -34105 # var i/eax: int = n -34106 8b/-> *(ebp+0xc) 0/r32/eax -34107 { -34108 # if (i <= 0) break -34109 3d/compare-eax-with 0/imm32 -34110 7e/jump-if-<= break/disp8 -34111 (write-buffered *(ebp+8) " ") -34112 48/decrement-eax -34113 eb/jump loop/disp8 -34114 } -34115 $emit-indent:end: -34116 # . restore registers -34117 58/pop-to-eax -34118 # . epilogue -34119 89/<- %esp 5/r32/ebp -34120 5d/pop-to-ebp -34121 c3/return -34122 -34123 emit-subx-prologue: # out: (addr buffered-file) -34124 # . prologue -34125 55/push-ebp -34126 89/<- %ebp 4/r32/esp -34127 # -34128 (write-buffered *(ebp+8) " # . prologue\n") -34129 (write-buffered *(ebp+8) " 55/push-ebp\n") -34130 (write-buffered *(ebp+8) " 89/<- %ebp 4/r32/esp\n") -34131 $emit-subx-prologue:end: -34132 # . epilogue -34133 89/<- %esp 5/r32/ebp -34134 5d/pop-to-ebp -34135 c3/return -34136 -34137 emit-subx-epilogue: # out: (addr buffered-file) -34138 # . prologue -34139 55/push-ebp -34140 89/<- %ebp 4/r32/esp -34141 # -34142 (write-buffered *(ebp+8) " # . epilogue\n") -34143 (write-buffered *(ebp+8) " 89/<- %esp 5/r32/ebp\n") -34144 (write-buffered *(ebp+8) " 5d/pop-to-ebp\n") -34145 (write-buffered *(ebp+8) " c3/return\n") -34146 $emit-subx-epilogue:end: -34147 # . epilogue -34148 89/<- %esp 5/r32/ebp -34149 5d/pop-to-ebp -34150 c3/return +33876 68/push 0/imm32/operation +33877 68/push 0/imm32/operation +33878 68/push 1/imm32/tag:stmt1 +33879 89/<- %esi 4/r32/esp +33880 $test-shift-reg-by-literal:initialize-stmt-operation: +33881 # stmt->operation = "shift-left" +33882 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +33883 (copy-array Heap "shift-left" %eax) +33884 # convert +33885 c7 0/subop/copy *Curr-block-depth 0/imm32 +33886 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +33887 (flush _test-output-buffered-file) +33888 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +33894 # check output +33895 (check-next-stream-line-equal _test-output-stream "c1/shift 4/subop/left %ecx 2/imm8" "F - test-shift-reg-by-literal") +33896 # . epilogue +33897 89/<- %esp 5/r32/ebp +33898 5d/pop-to-ebp +33899 c3/return +33900 +33901 test-shift-mem-by-literal: +33902 # shift-left var 3 +33903 # => +33904 # c1/shift 4/subop/left *(ebp+8) 3/imm8 +33905 # +33906 # . prologue +33907 55/push-ebp +33908 89/<- %ebp 4/r32/esp +33909 # setup +33910 (clear-stream _test-output-stream) +33911 (clear-stream $_test-output-buffered-file->buffer) +33912 $test-shift-mem-by-literal:initialize-type: +33913 # var type/ecx: (payload type-tree) = int +33914 68/push 0/imm32/right:null +33915 68/push 0/imm32/right:null +33916 68/push 0/imm32/left:unused +33917 68/push 1/imm32/value:int +33918 68/push 1/imm32/is-atom?:true +33919 68/push 0x11/imm32/alloc-id:fake:payload +33920 89/<- %ecx 4/r32/esp +33921 $test-shift-mem-by-literal:initialize-var1: +33922 # var var1/ecx: (payload var) +33923 68/push 0/imm32/register +33924 68/push 0/imm32/register +33925 68/push 8/imm32/stack-offset +33926 68/push 1/imm32/block-depth +33927 51/push-ecx +33928 68/push 0x11/imm32/alloc-id:fake +33929 68/push 0/imm32/name +33930 68/push 0/imm32/name +33931 68/push 0x11/imm32/alloc-id:fake:payload +33932 89/<- %ecx 4/r32/esp +33933 $test-shift-mem-by-literal:initialize-var1-name: +33934 # var1->name = "var1" +33935 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +33936 (copy-array Heap "var1" %eax) +33937 $test-shift-mem-by-literal:initialize-literal-type: +33938 # var type/edx: (payload type-tree) = literal +33939 68/push 0/imm32/right:null +33940 68/push 0/imm32/right:null +33941 68/push 0/imm32/left:unused +33942 68/push 0/imm32/value:literal +33943 68/push 1/imm32/is-atom?:true +33944 68/push 0x11/imm32/alloc-id:fake:payload +33945 89/<- %edx 4/r32/esp +33946 $test-shift-mem-by-literal:initialize-literal: +33947 # var l/edx: (payload var) +33948 68/push 0/imm32/register +33949 68/push 0/imm32/register +33950 68/push 0/imm32/no-stack-offset +33951 68/push 1/imm32/block-depth +33952 52/push-edx +33953 68/push 0x11/imm32/alloc-id:fake +33954 68/push 0/imm32/name +33955 68/push 0/imm32/name +33956 68/push 0x11/imm32/alloc-id:fake:payload +33957 89/<- %edx 4/r32/esp +33958 $test-shift-mem-by-literal:initialize-literal-value: +33959 # l->name = "3" +33960 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +33961 (copy-array Heap "3" %eax) +33962 $test-shift-mem-by-literal:initialize-inouts: +33963 # var inouts/esi: (payload stmt-var) = [l] +33964 68/push 0/imm32/is-deref:false +33965 68/push 0/imm32/next +33966 68/push 0/imm32/next +33967 52/push-edx/l +33968 68/push 0x11/imm32/alloc-id:fake +33969 68/push 0x11/imm32/alloc-id:fake:payload +33970 89/<- %esi 4/r32/esp +33971 # var inouts = (handle stmt-var) = [var1, var2] +33972 68/push 0/imm32/is-deref:false +33973 56/push-esi/next +33974 68/push 0x11/imm32/alloc-id:fake +33975 51/push-ecx/var1 +33976 68/push 0x11/imm32/alloc-id:fake +33977 68/push 0x11/imm32/alloc-id:fake:payload +33978 89/<- %esi 4/r32/esp +33979 $test-shift-mem-by-literal:initialize-stmt: +33980 # var stmt/esi: (addr statement) +33981 68/push 0/imm32/next +33982 68/push 0/imm32/next +33983 68/push 0/imm32/outputs +33984 68/push 0/imm32/outputs +33985 56/push-esi/inouts +33986 68/push 0x11/imm32/alloc-id:fake +33987 68/push 0/imm32/operation +33988 68/push 0/imm32/operation +33989 68/push 1/imm32/tag:stmt1 +33990 89/<- %esi 4/r32/esp +33991 $test-shift-mem-by-literal:initialize-stmt-operation: +33992 # stmt->operation = "shift-left" +33993 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +33994 (copy-array Heap "shift-left" %eax) +33995 # convert +33996 c7 0/subop/copy *Curr-block-depth 0/imm32 +33997 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +33998 (flush _test-output-buffered-file) +33999 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +34005 # check output +34006 (check-next-stream-line-equal _test-output-stream "c1/shift 4/subop/left *(ebp+0x00000008) 3/imm8" "F - test-shift-mem-by-literal") +34007 # . epilogue +34008 89/<- %esp 5/r32/ebp +34009 5d/pop-to-ebp +34010 c3/return +34011 +34012 test-compare-reg-with-reg: +34013 # compare var1/ecx, var2/eax +34014 # => +34015 # 39/compare %ecx 0/r32/eax +34016 # +34017 # . prologue +34018 55/push-ebp +34019 89/<- %ebp 4/r32/esp +34020 # setup +34021 (clear-stream _test-output-stream) +34022 (clear-stream $_test-output-buffered-file->buffer) +34023 $test-compare-reg-with-reg:initialize-type: +34024 # var type/ecx: (payload type-tree) = int +34025 68/push 0/imm32/right:null +34026 68/push 0/imm32/right:null +34027 68/push 0/imm32/left:unused +34028 68/push 1/imm32/value:int +34029 68/push 1/imm32/is-atom?:true +34030 68/push 0x11/imm32/alloc-id:fake:payload +34031 89/<- %ecx 4/r32/esp +34032 $test-compare-reg-with-reg:initialize-var1: +34033 # var var1/ecx: (payload var) +34034 68/push 0/imm32/register +34035 68/push 0/imm32/register +34036 68/push 0/imm32/no-stack-offset +34037 68/push 1/imm32/block-depth +34038 51/push-ecx +34039 68/push 0x11/imm32/alloc-id:fake +34040 68/push 0/imm32/name +34041 68/push 0/imm32/name +34042 68/push 0x11/imm32/alloc-id:fake:payload +34043 89/<- %ecx 4/r32/esp +34044 $test-compare-reg-with-reg:initialize-var1-name: +34045 # var1->name = "var1" +34046 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +34047 (copy-array Heap "var1" %eax) +34048 $test-compare-reg-with-reg:initialize-var1-register: +34049 # var1->register = "ecx" +34050 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +34051 (copy-array Heap "ecx" %eax) +34052 $test-compare-reg-with-reg:initialize-var2: +34053 # var var2/edx: (payload var) +34054 68/push 0/imm32/register +34055 68/push 0/imm32/register +34056 68/push 0/imm32/no-stack-offset +34057 68/push 1/imm32/block-depth +34058 ff 6/subop/push *(ecx+0x10) +34059 68/push 0x11/imm32/alloc-id:fake +34060 68/push 0/imm32/name +34061 68/push 0/imm32/name +34062 68/push 0x11/imm32/alloc-id:fake:payload +34063 89/<- %edx 4/r32/esp +34064 $test-compare-reg-with-reg:initialize-var2-name: +34065 # var2->name = "var2" +34066 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +34067 (copy-array Heap "var2" %eax) +34068 $test-compare-reg-with-reg:initialize-var2-register: +34069 # var2->register = "eax" +34070 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 +34071 (copy-array Heap "eax" %eax) +34072 $test-compare-reg-with-reg:initialize-inouts: +34073 # var inouts/esi: (payload stmt-var) = [var2] +34074 68/push 0/imm32/is-deref:false +34075 68/push 0/imm32/next +34076 68/push 0/imm32/next +34077 52/push-edx/var2 +34078 68/push 0x11/imm32/alloc-id:fake +34079 68/push 0x11/imm32/alloc-id:fake:payload +34080 89/<- %esi 4/r32/esp +34081 # inouts = [var1, var2] +34082 68/push 0/imm32/is-deref:false +34083 56/push-esi/next +34084 68/push 0x11/imm32/alloc-id:fake +34085 51/push-ecx/var1 +34086 68/push 0x11/imm32/alloc-id:fake +34087 68/push 0x11/imm32/alloc-id:fake:payload +34088 89/<- %esi 4/r32/esp +34089 $test-compare-reg-with-reg:initialize-stmt: +34090 # var stmt/esi: (addr statement) +34091 68/push 0/imm32/next +34092 68/push 0/imm32/next +34093 68/push 0/imm32/outputs +34094 68/push 0/imm32/outputs +34095 56/push-esi/inouts +34096 68/push 0x11/imm32/alloc-id:fake +34097 68/push 0/imm32/operation +34098 68/push 0/imm32/operation +34099 68/push 1/imm32/tag:stmt1 +34100 89/<- %esi 4/r32/esp +34101 $test-compare-reg-with-reg:initialize-stmt-operation: +34102 # stmt->operation = "compare" +34103 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +34104 (copy-array Heap "compare" %eax) +34105 # convert +34106 c7 0/subop/copy *Curr-block-depth 0/imm32 +34107 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +34108 (flush _test-output-buffered-file) +34109 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +34115 # check output +34116 (check-next-stream-line-equal _test-output-stream "39/compare-> %ecx 0x00000000/r32" "F - test-compare-reg-with-reg") +34117 # . epilogue +34118 89/<- %esp 5/r32/ebp +34119 5d/pop-to-ebp +34120 c3/return +34121 +34122 test-compare-mem-with-reg: +34123 # compare var1, var2/eax +34124 # => +34125 # 39/compare *(ebp+___) 0/r32/eax +34126 # +34127 # . prologue +34128 55/push-ebp +34129 89/<- %ebp 4/r32/esp +34130 # setup +34131 (clear-stream _test-output-stream) +34132 (clear-stream $_test-output-buffered-file->buffer) +34133 $test-compare-mem-with-reg:initialize-type: +34134 # var type/ecx: (payload type-tree) = int +34135 68/push 0/imm32/right:null +34136 68/push 0/imm32/right:null +34137 68/push 0/imm32/left:unused +34138 68/push 1/imm32/value:int +34139 68/push 1/imm32/is-atom?:true +34140 68/push 0x11/imm32/alloc-id:fake:payload +34141 89/<- %ecx 4/r32/esp +34142 $test-compare-mem-with-reg:initialize-var1: +34143 # var var1/ecx: (payload var) +34144 68/push 0/imm32/register +34145 68/push 0/imm32/register +34146 68/push 8/imm32/stack-offset +34147 68/push 1/imm32/block-depth +34148 51/push-ecx +34149 68/push 0x11/imm32/alloc-id:fake +34150 68/push 0/imm32/name +34151 68/push 0/imm32/name +34152 68/push 0x11/imm32/alloc-id:fake:payload +34153 89/<- %ecx 4/r32/esp +34154 $test-compare-mem-with-reg:initialize-var1-name: +34155 # var1->name = "var1" +34156 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +34157 (copy-array Heap "var1" %eax) +34158 $test-compare-mem-with-reg:initialize-var2: +34159 # var var2/edx: (payload var) +34160 68/push 0/imm32/register +34161 68/push 0/imm32/register +34162 68/push 0/imm32/no-stack-offset +34163 68/push 1/imm32/block-depth +34164 ff 6/subop/push *(ecx+0x10) +34165 68/push 0x11/imm32/alloc-id:fake +34166 68/push 0/imm32/name +34167 68/push 0/imm32/name +34168 68/push 0x11/imm32/alloc-id:fake:payload +34169 89/<- %edx 4/r32/esp +34170 $test-compare-mem-with-reg:initialize-var2-name: +34171 # var2->name = "var2" +34172 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +34173 (copy-array Heap "var2" %eax) +34174 $test-compare-mem-with-reg:initialize-var2-register: +34175 # var2->register = "eax" +34176 8d/copy-address *(edx+0x1c) 0/r32/eax # Var-register + 4 +34177 (copy-array Heap "eax" %eax) +34178 $test-compare-mem-with-reg:initialize-inouts: +34179 # var inouts/esi: (payload stmt-var) = [var2] +34180 68/push 0/imm32/is-deref:false +34181 68/push 0/imm32/next +34182 68/push 0/imm32/next +34183 52/push-edx/var2 +34184 68/push 0x11/imm32/alloc-id:fake +34185 68/push 0x11/imm32/alloc-id:fake:payload +34186 89/<- %esi 4/r32/esp +34187 # inouts = [var1, var2] +34188 68/push 0/imm32/is-deref:false +34189 56/push-esi/next +34190 68/push 0x11/imm32/alloc-id:fake +34191 51/push-ecx/var1 +34192 68/push 0x11/imm32/alloc-id:fake +34193 68/push 0x11/imm32/alloc-id:fake:payload +34194 89/<- %esi 4/r32/esp +34195 $test-compare-mem-with-reg:initialize-stmt: +34196 # var stmt/esi: (addr statement) +34197 68/push 0/imm32/next +34198 68/push 0/imm32/next +34199 68/push 0/imm32/outputs +34200 68/push 0/imm32/outputs +34201 56/push-esi/inouts +34202 68/push 0x11/imm32/alloc-id:fake +34203 68/push 0/imm32/operation +34204 68/push 0/imm32/operation +34205 68/push 1/imm32/tag:stmt1 +34206 89/<- %esi 4/r32/esp +34207 $test-compare-mem-with-reg:initialize-stmt-operation: +34208 # stmt->operation = "compare" +34209 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +34210 (copy-array Heap "compare" %eax) +34211 # convert +34212 c7 0/subop/copy *Curr-block-depth 0/imm32 +34213 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +34214 (flush _test-output-buffered-file) +34215 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +34221 # check output +34222 (check-next-stream-line-equal _test-output-stream "39/compare-> *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-mem-with-reg") +34223 # . epilogue +34224 89/<- %esp 5/r32/ebp +34225 5d/pop-to-ebp +34226 c3/return +34227 +34228 test-compare-reg-with-mem: +34229 # compare var1/eax, var2 +34230 # => +34231 # 3b/compare<- *(ebp+___) 0/r32/eax +34232 # +34233 # . prologue +34234 55/push-ebp +34235 89/<- %ebp 4/r32/esp +34236 # setup +34237 (clear-stream _test-output-stream) +34238 (clear-stream $_test-output-buffered-file->buffer) +34239 $test-compare-reg-with-mem:initialize-type: +34240 # var type/ecx: (payload type-tree) = int +34241 68/push 0/imm32/right:null +34242 68/push 0/imm32/right:null +34243 68/push 0/imm32/left:unused +34244 68/push 1/imm32/value:int +34245 68/push 1/imm32/is-atom?:true +34246 68/push 0x11/imm32/alloc-id:fake:payload +34247 89/<- %ecx 4/r32/esp +34248 $test-compare-reg-with-mem:initialize-var1: +34249 # var var1/ecx: (payload var) +34250 68/push 0/imm32/register +34251 68/push 0/imm32/register +34252 68/push 0/imm32/no-stack-offset +34253 68/push 1/imm32/block-depth +34254 51/push-ecx +34255 68/push 0x11/imm32/alloc-id:fake +34256 68/push 0/imm32/name +34257 68/push 0/imm32/name +34258 68/push 0x11/imm32/alloc-id:fake:payload +34259 89/<- %ecx 4/r32/esp +34260 $test-compare-reg-with-mem:initialize-var1-name: +34261 # var1->name = "var1" +34262 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +34263 (copy-array Heap "var1" %eax) +34264 $test-compare-reg-with-mem:initialize-var1-register: +34265 # var1->register = "eax" +34266 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +34267 (copy-array Heap "eax" %eax) +34268 $test-compare-reg-with-mem:initialize-var2: +34269 # var var2/edx: (payload var) +34270 68/push 0/imm32/register +34271 68/push 0/imm32/register +34272 68/push 8/imm32/stack-offset +34273 68/push 1/imm32/block-depth +34274 ff 6/subop/push *(ecx+0x10) +34275 68/push 0x11/imm32/alloc-id:fake +34276 68/push 0/imm32/name +34277 68/push 0/imm32/name +34278 68/push 0x11/imm32/alloc-id:fake:payload +34279 89/<- %edx 4/r32/esp +34280 $test-compare-reg-with-mem:initialize-var2-name: +34281 # var2->name = "var2" +34282 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +34283 (copy-array Heap "var2" %eax) +34284 $test-compare-reg-with-mem:initialize-inouts: +34285 # var inouts/esi: (payload stmt-var) = [var2] +34286 68/push 0/imm32/is-deref:false +34287 68/push 0/imm32/next +34288 68/push 0/imm32/next +34289 52/push-edx/var2 +34290 68/push 0x11/imm32/alloc-id:fake +34291 68/push 0x11/imm32/alloc-id:fake:payload +34292 89/<- %esi 4/r32/esp +34293 # inouts = [var1, var2] +34294 68/push 0/imm32/is-deref:false +34295 56/push-esi/next +34296 68/push 0x11/imm32/alloc-id:fake +34297 51/push-ecx/var1 +34298 68/push 0x11/imm32/alloc-id:fake +34299 68/push 0x11/imm32/alloc-id:fake:payload +34300 89/<- %esi 4/r32/esp +34301 $test-compare-reg-with-mem:initialize-stmt: +34302 # var stmt/esi: (addr statement) +34303 68/push 0/imm32/next +34304 68/push 0/imm32/next +34305 68/push 0/imm32/outputs +34306 68/push 0/imm32/outputs +34307 56/push-esi/inouts +34308 68/push 0x11/imm32/alloc-id:fake +34309 68/push 0/imm32/operation +34310 68/push 0/imm32/operation +34311 68/push 1/imm32/tag:stmt1 +34312 89/<- %esi 4/r32/esp +34313 $test-compare-reg-with-mem:initialize-stmt-operation: +34314 # stmt->operation = "compare" +34315 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +34316 (copy-array Heap "compare" %eax) +34317 # convert +34318 c7 0/subop/copy *Curr-block-depth 0/imm32 +34319 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +34320 (flush _test-output-buffered-file) +34321 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +34327 # check output +34328 (check-next-stream-line-equal _test-output-stream "3b/compare<- *(ebp+0x00000008) 0x00000000/r32" "F - test-compare-reg-with-mem") +34329 # . epilogue +34330 89/<- %esp 5/r32/ebp +34331 5d/pop-to-ebp +34332 c3/return +34333 +34334 test-compare-mem-with-literal: +34335 # compare var1, 0x34 +34336 # => +34337 # 81 7/subop/compare *(ebp+___) 0x34/imm32 +34338 # +34339 # . prologue +34340 55/push-ebp +34341 89/<- %ebp 4/r32/esp +34342 # setup +34343 (clear-stream _test-output-stream) +34344 (clear-stream $_test-output-buffered-file->buffer) +34345 $test-compare-mem-with-literal:initialize-type: +34346 # var type/ecx: (payload type-tree) = int +34347 68/push 0/imm32/right:null +34348 68/push 0/imm32/right:null +34349 68/push 0/imm32/left:unused +34350 68/push 1/imm32/value:int +34351 68/push 1/imm32/is-atom?:true +34352 68/push 0x11/imm32/alloc-id:fake:payload +34353 89/<- %ecx 4/r32/esp +34354 $test-compare-mem-with-literal:initialize-var1: +34355 # var var1/ecx: (payload var) +34356 68/push 0/imm32/register +34357 68/push 0/imm32/register +34358 68/push 8/imm32/stack-offset +34359 68/push 1/imm32/block-depth +34360 51/push-ecx +34361 68/push 0x11/imm32/alloc-id:fake +34362 68/push 0/imm32/name +34363 68/push 0/imm32/name +34364 68/push 0x11/imm32/alloc-id:fake:payload +34365 89/<- %ecx 4/r32/esp +34366 $test-compare-mem-with-literal:initialize-var1-name: +34367 # var1->name = "var1" +34368 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +34369 (copy-array Heap "var1" %eax) +34370 $test-compare-mem-with-literal:initialize-literal-type: +34371 # var type/edx: (payload type-tree) = literal +34372 68/push 0/imm32/right:null +34373 68/push 0/imm32/right:null +34374 68/push 0/imm32/left:unused +34375 68/push 0/imm32/value:literal +34376 68/push 1/imm32/is-atom?:true +34377 68/push 0x11/imm32/alloc-id:fake:payload +34378 89/<- %edx 4/r32/esp +34379 $test-compare-mem-with-literal:initialize-literal: +34380 # var l/edx: (payload var) +34381 68/push 0/imm32/register +34382 68/push 0/imm32/register +34383 68/push 0/imm32/no-stack-offset +34384 68/push 1/imm32/block-depth +34385 52/push-edx +34386 68/push 0x11/imm32/alloc-id:fake +34387 68/push 0/imm32/name +34388 68/push 0/imm32/name +34389 68/push 0x11/imm32/alloc-id:fake:payload +34390 89/<- %edx 4/r32/esp +34391 $test-compare-mem-with-literal:initialize-literal-value: +34392 # l->name = "0x34" +34393 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +34394 (copy-array Heap "0x34" %eax) +34395 $test-compare-mem-with-literal:initialize-inouts: +34396 # var inouts/esi: (payload stmt-var) = [l] +34397 68/push 0/imm32/is-deref:false +34398 68/push 0/imm32/next +34399 68/push 0/imm32/next +34400 52/push-edx/l +34401 68/push 0x11/imm32/alloc-id:fake +34402 68/push 0x11/imm32/alloc-id:fake:payload +34403 89/<- %esi 4/r32/esp +34404 # var inouts = (handle stmt-var) = [var1, var2] +34405 68/push 0/imm32/is-deref:false +34406 56/push-esi/next +34407 68/push 0x11/imm32/alloc-id:fake +34408 51/push-ecx/var1 +34409 68/push 0x11/imm32/alloc-id:fake +34410 68/push 0x11/imm32/alloc-id:fake:payload +34411 89/<- %esi 4/r32/esp +34412 $test-compare-mem-with-literal:initialize-stmt: +34413 # var stmt/esi: (addr statement) +34414 68/push 0/imm32/next +34415 68/push 0/imm32/next +34416 68/push 0/imm32/outputs +34417 68/push 0/imm32/outputs +34418 56/push-esi/inouts +34419 68/push 0x11/imm32/alloc-id:fake +34420 68/push 0/imm32/operation +34421 68/push 0/imm32/operation +34422 68/push 1/imm32/tag:stmt1 +34423 89/<- %esi 4/r32/esp +34424 $test-compare-mem-with-literal:initialize-stmt-operation: +34425 # stmt->operation = "compare" +34426 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +34427 (copy-array Heap "compare" %eax) +34428 # convert +34429 c7 0/subop/copy *Curr-block-depth 0/imm32 +34430 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +34431 (flush _test-output-buffered-file) +34432 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +34438 # check output +34439 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare *(ebp+0x00000008) 0x34/imm32" "F - test-compare-mem-with-literal") +34440 # . epilogue +34441 89/<- %esp 5/r32/ebp +34442 5d/pop-to-ebp +34443 c3/return +34444 +34445 test-compare-eax-with-literal: +34446 # compare var1/eax 0x34 +34447 # => +34448 # 3d/compare-eax-with 0x34/imm32 +34449 # +34450 # . prologue +34451 55/push-ebp +34452 89/<- %ebp 4/r32/esp +34453 # setup +34454 (clear-stream _test-output-stream) +34455 (clear-stream $_test-output-buffered-file->buffer) +34456 $test-compare-eax-with-literal:initialize-type: +34457 # var type/ecx: (payload type-tree) = int +34458 68/push 0/imm32/right:null +34459 68/push 0/imm32/right:null +34460 68/push 0/imm32/left:unused +34461 68/push 1/imm32/value:int +34462 68/push 1/imm32/is-atom?:true +34463 68/push 0x11/imm32/alloc-id:fake:payload +34464 89/<- %ecx 4/r32/esp +34465 $test-compare-eax-with-literal:initialize-var1: +34466 # var var1/ecx: (payload var) +34467 68/push 0/imm32/register +34468 68/push 0/imm32/register +34469 68/push 0/imm32/no-stack-offset +34470 68/push 1/imm32/block-depth +34471 51/push-ecx +34472 68/push 0x11/imm32/alloc-id:fake +34473 68/push 0/imm32/name +34474 68/push 0/imm32/name +34475 68/push 0x11/imm32/alloc-id:fake:payload +34476 89/<- %ecx 4/r32/esp +34477 $test-compare-eax-with-literal:initialize-var1-name: +34478 # var1->name = "var1" +34479 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +34480 (copy-array Heap "var1" %eax) +34481 $test-compare-eax-with-literal:initialize-var1-register: +34482 # v->register = "eax" +34483 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +34484 (copy-array Heap "eax" %eax) +34485 $test-compare-eax-with-literal:initialize-literal-type: +34486 # var type/edx: (payload type-tree) = literal +34487 68/push 0/imm32/right:null +34488 68/push 0/imm32/right:null +34489 68/push 0/imm32/left:unused +34490 68/push 0/imm32/value:literal +34491 68/push 1/imm32/is-atom?:true +34492 68/push 0x11/imm32/alloc-id:fake:payload +34493 89/<- %edx 4/r32/esp +34494 $test-compare-eax-with-literal:initialize-literal: +34495 # var l/edx: (payload var) +34496 68/push 0/imm32/register +34497 68/push 0/imm32/register +34498 68/push 0/imm32/no-stack-offset +34499 68/push 1/imm32/block-depth +34500 52/push-edx +34501 68/push 0x11/imm32/alloc-id:fake +34502 68/push 0/imm32/name +34503 68/push 0/imm32/name +34504 68/push 0x11/imm32/alloc-id:fake:payload +34505 89/<- %edx 4/r32/esp +34506 $test-compare-eax-with-literal:initialize-literal-value: +34507 # l->name = "0x34" +34508 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +34509 (copy-array Heap "0x34" %eax) +34510 $test-compare-eax-with-literal:initialize-inouts: +34511 # var inouts/esi: (payload stmt-var) = [l] +34512 68/push 0/imm32/is-deref:false +34513 68/push 0/imm32/next +34514 68/push 0/imm32/next +34515 52/push-edx/l +34516 68/push 0x11/imm32/alloc-id:fake +34517 68/push 0x11/imm32/alloc-id:fake:payload +34518 89/<- %esi 4/r32/esp +34519 # var inouts = (handle stmt-var) = [var1, var2] +34520 68/push 0/imm32/is-deref:false +34521 56/push-esi/next +34522 68/push 0x11/imm32/alloc-id:fake +34523 51/push-ecx/var1 +34524 68/push 0x11/imm32/alloc-id:fake +34525 68/push 0x11/imm32/alloc-id:fake:payload +34526 89/<- %esi 4/r32/esp +34527 $test-compare-eax-with-literal:initialize-stmt: +34528 # var stmt/esi: (addr statement) +34529 68/push 0/imm32/next +34530 68/push 0/imm32/next +34531 68/push 0/imm32/outputs +34532 68/push 0/imm32/outputs +34533 56/push-esi/inouts +34534 68/push 0x11/imm32/alloc-id:fake +34535 68/push 0/imm32/operation +34536 68/push 0/imm32/operation +34537 68/push 1/imm32/tag:stmt1 +34538 89/<- %esi 4/r32/esp +34539 $test-compare-eax-with-literal:initialize-stmt-operation: +34540 # stmt->operation = "compare" +34541 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +34542 (copy-array Heap "compare" %eax) +34543 # convert +34544 c7 0/subop/copy *Curr-block-depth 0/imm32 +34545 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +34546 (flush _test-output-buffered-file) +34547 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +34553 # check output +34554 (check-next-stream-line-equal _test-output-stream "3d/compare-eax-with 0x34/imm32" "F - test-compare-eax-with-literal") +34555 # . epilogue +34556 89/<- %esp 5/r32/ebp +34557 5d/pop-to-ebp +34558 c3/return +34559 +34560 test-compare-reg-with-literal: +34561 # compare var1/ecx 0x34 +34562 # => +34563 # 81 7/subop/compare %ecx 0x34/imm32 +34564 # +34565 # . prologue +34566 55/push-ebp +34567 89/<- %ebp 4/r32/esp +34568 # setup +34569 (clear-stream _test-output-stream) +34570 (clear-stream $_test-output-buffered-file->buffer) +34571 $test-compare-reg-with-literal:initialize-type: +34572 # var type/ecx: (payload type-tree) = int +34573 68/push 0/imm32/right:null +34574 68/push 0/imm32/right:null +34575 68/push 0/imm32/left:unused +34576 68/push 1/imm32/value:int +34577 68/push 1/imm32/is-atom?:true +34578 68/push 0x11/imm32/alloc-id:fake:payload +34579 89/<- %ecx 4/r32/esp +34580 $test-compare-reg-with-literal:initialize-var1: +34581 # var var1/ecx: (payload var) +34582 68/push 0/imm32/register +34583 68/push 0/imm32/register +34584 68/push 0/imm32/no-stack-offset +34585 68/push 1/imm32/block-depth +34586 51/push-ecx +34587 68/push 0x11/imm32/alloc-id:fake +34588 68/push 0/imm32/name +34589 68/push 0/imm32/name +34590 68/push 0x11/imm32/alloc-id:fake:payload +34591 89/<- %ecx 4/r32/esp +34592 $test-compare-reg-with-literal:initialize-var1-name: +34593 # var1->name = "var1" +34594 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +34595 (copy-array Heap "var1" %eax) +34596 $test-compare-reg-with-literal:initialize-var1-register: +34597 # v->register = "ecx" +34598 8d/copy-address *(ecx+0x1c) 0/r32/eax # Var-register + 4 +34599 (copy-array Heap "ecx" %eax) +34600 $test-compare-reg-with-literal:initialize-literal-type: +34601 # var type/edx: (payload type-tree) = literal +34602 68/push 0/imm32/right:null +34603 68/push 0/imm32/right:null +34604 68/push 0/imm32/left:unused +34605 68/push 0/imm32/value:literal +34606 68/push 1/imm32/is-atom?:true +34607 68/push 0x11/imm32/alloc-id:fake:payload +34608 89/<- %edx 4/r32/esp +34609 $test-compare-reg-with-literal:initialize-literal: +34610 # var l/edx: (payload var) +34611 68/push 0/imm32/register +34612 68/push 0/imm32/register +34613 68/push 0/imm32/no-stack-offset +34614 68/push 1/imm32/block-depth +34615 52/push-edx +34616 68/push 0x11/imm32/alloc-id:fake +34617 68/push 0/imm32/name +34618 68/push 0/imm32/name +34619 68/push 0x11/imm32/alloc-id:fake:payload +34620 89/<- %edx 4/r32/esp +34621 $test-compare-reg-with-literal:initialize-literal-value: +34622 # l->name = "0x34" +34623 8d/copy-address *(edx+4) 0/r32/eax # Var-name + 4 +34624 (copy-array Heap "0x34" %eax) +34625 $test-compare-reg-with-literal:initialize-inouts: +34626 # var inouts/esi: (payload stmt-var) = [l] +34627 68/push 0/imm32/is-deref:false +34628 68/push 0/imm32/next +34629 68/push 0/imm32/next +34630 52/push-edx/l +34631 68/push 0x11/imm32/alloc-id:fake +34632 68/push 0x11/imm32/alloc-id:fake:payload +34633 89/<- %esi 4/r32/esp +34634 # var inouts = (handle stmt-var) = [var1, var2] +34635 68/push 0/imm32/is-deref:false +34636 56/push-esi/next +34637 68/push 0x11/imm32/alloc-id:fake +34638 51/push-ecx/var1 +34639 68/push 0x11/imm32/alloc-id:fake +34640 68/push 0x11/imm32/alloc-id:fake:payload +34641 89/<- %esi 4/r32/esp +34642 $test-compare-reg-with-literal:initialize-stmt: +34643 # var stmt/esi: (addr statement) +34644 68/push 0/imm32/next +34645 68/push 0/imm32/next +34646 68/push 0/imm32/outputs +34647 68/push 0/imm32/outputs +34648 56/push-esi/inouts +34649 68/push 0x11/imm32/alloc-id:fake +34650 68/push 0/imm32/operation +34651 68/push 0/imm32/operation +34652 68/push 1/imm32/tag:stmt1 +34653 89/<- %esi 4/r32/esp +34654 $test-compare-reg-with-literal:initialize-stmt-operation: +34655 # stmt->operation = "compare" +34656 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +34657 (copy-array Heap "compare" %eax) +34658 # convert +34659 c7 0/subop/copy *Curr-block-depth 0/imm32 +34660 (emit-subx-stmt _test-output-buffered-file %esi Primitives Stderr 0) +34661 (flush _test-output-buffered-file) +34662 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +34668 # check output +34669 (check-next-stream-line-equal _test-output-stream "81 7/subop/compare %ecx 0x34/imm32" "F - test-compare-reg-with-literal") +34670 # . epilogue +34671 89/<- %esp 5/r32/ebp +34672 5d/pop-to-ebp +34673 c3/return +34674 +34675 test-emit-subx-stmt-function-call: +34676 # Call a function on a variable on the stack. +34677 # f foo +34678 # => +34679 # (f *(ebp-8)) +34680 # (Changing the function name supports overloading in general, but here it +34681 # just serves to help disambiguate things.) +34682 # +34683 # There's a variable on the var stack as follows: +34684 # name: 'foo' +34685 # type: int +34686 # stack-offset: -8 +34687 # +34688 # There's nothing in primitives. +34689 # +34690 # We don't perform any checking here on the type of 'f'. +34691 # +34692 # . prologue +34693 55/push-ebp +34694 89/<- %ebp 4/r32/esp +34695 # setup +34696 (clear-stream _test-output-stream) +34697 (clear-stream $_test-output-buffered-file->buffer) +34698 $test-emit-subx-function-call:initialize-type: +34699 # var type/ecx: (payload type-tree) = int +34700 68/push 0/imm32/right:null +34701 68/push 0/imm32/right:null +34702 68/push 0/imm32/left:unused +34703 68/push 1/imm32/value:int +34704 68/push 1/imm32/is-atom?:true +34705 68/push 0x11/imm32/alloc-id:fake:payload +34706 89/<- %ecx 4/r32/esp +34707 $test-emit-subx-function-call:initialize-var: +34708 # var var-foo/ecx: (payload var) = var(type) +34709 68/push 0/imm32/no-register +34710 68/push 0/imm32/no-register +34711 68/push -8/imm32/stack-offset +34712 68/push 1/imm32/block-depth +34713 51/push-ecx/type +34714 68/push 0x11/imm32/alloc-id:fake +34715 68/push 0/imm32/name +34716 68/push 0/imm32/name +34717 68/push 0x11/imm32/alloc-id:fake:payload +34718 89/<- %ecx 4/r32/esp +34719 $test-emit-subx-function-call:initialize-var-name: +34720 # var-foo->name = "foo" +34721 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +34722 (copy-array Heap "foo" %eax) +34723 $test-emit-subx-function-call:initialize-stmt-var: +34724 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) +34725 68/push 0/imm32/is-deref:false +34726 68/push 0/imm32/next +34727 68/push 0/imm32/next +34728 51/push-ecx/var-foo +34729 68/push 0x11/imm32/alloc-id:fake +34730 68/push 0x11/imm32/alloc-id:fake:payload +34731 89/<- %ebx 4/r32/esp +34732 $test-emit-subx-function-call:initialize-stmt: +34733 # var stmt/esi: (addr statement) +34734 68/push 0/imm32/no-outputs +34735 68/push 0/imm32/no-outputs +34736 53/push-ebx/inouts +34737 68/push 0x11/imm32/alloc-id:fake +34738 68/push 0/imm32/operation +34739 68/push 0/imm32/operation +34740 68/push 1/imm32/tag +34741 89/<- %esi 4/r32/esp +34742 $test-emit-subx-function-call:initialize-stmt-operation: +34743 # stmt->operation = "f" +34744 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +34745 (copy-array Heap "f" %eax) +34746 # convert +34747 c7 0/subop/copy *Curr-block-depth 0/imm32 +34748 (emit-subx-stmt _test-output-buffered-file %esi 0 Stderr 0) +34749 (flush _test-output-buffered-file) +34750 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +34756 # check output +34757 (check-next-stream-line-equal _test-output-stream "(f *(ebp+0xfffffff8))" "F - test-emit-subx-stmt-function-call") +34758 # . epilogue +34759 89/<- %esp 5/r32/ebp +34760 5d/pop-to-ebp +34761 c3/return +34762 +34763 test-emit-subx-stmt-function-call-with-literal-arg: +34764 # Call a function on a literal. +34765 # f 0x34 +34766 # => +34767 # (f2 0x34) +34768 # +34769 # . prologue +34770 55/push-ebp +34771 89/<- %ebp 4/r32/esp +34772 # setup +34773 (clear-stream _test-output-stream) +34774 (clear-stream $_test-output-buffered-file->buffer) +34775 $test-emit-subx-function-call-with-literal-arg:initialize-type: +34776 # var type/ecx: (payload type-tree) = int +34777 68/push 0/imm32/right:null +34778 68/push 0/imm32/right:null +34779 68/push 0/imm32/left:unused +34780 68/push 0/imm32/value:literal +34781 68/push 1/imm32/is-atom?:true +34782 68/push 0x11/imm32/alloc-id:fake:payload +34783 89/<- %ecx 4/r32/esp +34784 $test-emit-subx-function-call-with-literal-arg:initialize-var: +34785 # var var-foo/ecx: (payload var) = var(lit) +34786 68/push 0/imm32/no-register +34787 68/push 0/imm32/no-register +34788 68/push 0/imm32/no-stack-offset +34789 68/push 1/imm32/block-depth +34790 51/push-ecx/type +34791 68/push 0x11/imm32/alloc-id:fake +34792 68/push 0/imm32/name +34793 68/push 0/imm32/name +34794 68/push 0x11/imm32/alloc-id:fake:payload +34795 89/<- %ecx 4/r32/esp +34796 $test-emit-subx-function-call-with-literal-arg:initialize-var-name: +34797 # var-foo->name = "0x34" +34798 8d/copy-address *(ecx+4) 0/r32/eax # Var-name + 4 +34799 (copy-array Heap "0x34" %eax) +34800 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-var: +34801 # var operand/ebx: (payload stmt-var) = stmt-var(var-foo) +34802 68/push 0/imm32/is-deref:false +34803 68/push 0/imm32/next +34804 68/push 0/imm32/next +34805 51/push-ecx/var-foo +34806 68/push 0x11/imm32/alloc-id:fake +34807 68/push 0x11/imm32/alloc-id:fake:payload +34808 89/<- %ebx 4/r32/esp +34809 $test-emit-subx-function-call-with-literal-arg:initialize-stmt: +34810 # var stmt/esi: (addr statement) +34811 68/push 0/imm32/no-outputs +34812 68/push 0/imm32/no-outputs +34813 53/push-ebx/inouts +34814 68/push 0x11/imm32/alloc-id:fake +34815 68/push 0/imm32/operation +34816 68/push 0/imm32/operation +34817 68/push 1/imm32/tag +34818 89/<- %esi 4/r32/esp +34819 $test-emit-subx-function-call-with-literal-arg:initialize-stmt-operation: +34820 # stmt->operation = "f" +34821 8d/copy-address *(esi+4) 0/r32/eax # Stmt1-operation +34822 (copy-array Heap "f" %eax) +34823 # convert +34824 c7 0/subop/copy *Curr-block-depth 0/imm32 +34825 (emit-subx-stmt _test-output-buffered-file %esi 0 %ebx Stderr 0) +34826 (flush _test-output-buffered-file) +34827 +-- 6 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- +34833 # check output +34834 (check-next-stream-line-equal _test-output-stream "(f 0x34)" "F - test-emit-subx-stmt-function-call-with-literal-arg") +34835 # . epilogue +34836 89/<- %esp 5/r32/ebp +34837 5d/pop-to-ebp +34838 c3/return +34839 +34840 emit-indent: # out: (addr buffered-file), n: int +34841 # . prologue +34842 55/push-ebp +34843 89/<- %ebp 4/r32/esp +34844 # . save registers +34845 50/push-eax +34846 # var i/eax: int = n +34847 8b/-> *(ebp+0xc) 0/r32/eax +34848 { +34849 # if (i <= 0) break +34850 3d/compare-eax-with 0/imm32 +34851 7e/jump-if-<= break/disp8 +34852 (write-buffered *(ebp+8) " ") +34853 48/decrement-eax +34854 eb/jump loop/disp8 +34855 } +34856 $emit-indent:end: +34857 # . restore registers +34858 58/pop-to-eax +34859 # . epilogue +34860 89/<- %esp 5/r32/ebp +34861 5d/pop-to-ebp +34862 c3/return +34863 +34864 emit-subx-prologue: # out: (addr buffered-file) +34865 # . prologue +34866 55/push-ebp +34867 89/<- %ebp 4/r32/esp +34868 # +34869 (write-buffered *(ebp+8) " # . prologue\n") +34870 (write-buffered *(ebp+8) " 55/push-ebp\n") +34871 (write-buffered *(ebp+8) " 89/<- %ebp 4/r32/esp\n") +34872 $emit-subx-prologue:end: +34873 # . epilogue +34874 89/<- %esp 5/r32/ebp +34875 5d/pop-to-ebp +34876 c3/return +34877 +34878 emit-subx-epilogue: # out: (addr buffered-file) +34879 # . prologue +34880 55/push-ebp +34881 89/<- %ebp 4/r32/esp +34882 # +34883 (write-buffered *(ebp+8) " # . epilogue\n") +34884 (write-buffered *(ebp+8) " 89/<- %esp 5/r32/ebp\n") +34885 (write-buffered *(ebp+8) " 5d/pop-to-ebp\n") +34886 (write-buffered *(ebp+8) " c3/return\n") +34887 $emit-subx-epilogue:end: +34888 # . epilogue +34889 89/<- %esp 5/r32/ebp +34890 5d/pop-to-ebp +34891 c3/return diff --git a/html/apps/pack.subx.html b/html/apps/pack.subx.html index 91036e8a..98acccfe 100644 --- a/html/apps/pack.subx.html +++ b/html/apps/pack.subx.html @@ -213,7 +213,7 @@ if ('onhashchange' in window) { 151 # if (line->write == 0) break 152 81 7/subop/compare 0/mod/indirect 1/rm32/ecx . . . . . 0/imm32 # compare *ecx 153 0f 84/jump-if-= $subx-pack:break/disp32 - 154 +-- 26 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 154 +-- 26 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 180 # next-word(line, word-slice) 181 # . . push args 182 52/push-edx @@ -235,7 +235,7 @@ if ('onhashchange' in window) { 198 3d/compare-eax-and 0/imm32/false 199 0f 85/jump-if-!= $subx-pack:pass-through/disp32 200 $subx-pack:check2: - 201 +-- 40 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 201 +-- 40 lines: #? # dump word-slice ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 241 # if (!slice-equal?(word-slice, "==")) goto next check 242 # . eax = slice-equal?(word-slice, "==") 243 # . . push args @@ -256,7 +256,7 @@ if ('onhashchange' in window) { 258 e8/call next-word/disp32 259 # . . discard args 260 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - 261 +-- 40 lines: #? # dump segment name ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 261 +-- 40 lines: #? # dump segment name --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 301 # in-code? = slice-equal?(word-slice, "code") 302 # . . push args 303 68/push "code"/imm32 @@ -617,7 +617,7 @@ if ('onhashchange' in window) { 658 # . . discard args 659 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp 660 # check output - 661 +-- 26 lines: #? # debug print ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 661 +-- 26 lines: #? # debug print --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 687 # . flush(_test-output-buffered-file) 688 # . . push args 689 68/push _test-output-buffered-file/imm32 @@ -751,7 +751,7 @@ if ('onhashchange' in window) { 817 # 68 20 # 68/push 0x20/imm8 818 # == data 0x2 819 # 03 04 00 00 00 - 820 +-- 26 lines: #? # debug print ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 820 +-- 26 lines: #? # debug print --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 846 # . flush(_test-output-buffered-file) 847 # . . push args 848 68/push _test-output-buffered-file/imm32 @@ -840,7 +840,7 @@ if ('onhashchange' in window) { 931 68/push 0/imm32/end 932 68/push 0/imm32/start 933 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - 934 +-- 26 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 934 +-- 26 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 960 $convert-data:loop: 961 # next-word(line, word-slice) 962 # . . push args @@ -850,7 +850,7 @@ if ('onhashchange' in window) { 966 e8/call next-word/disp32 967 # . . discard args 968 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - 969 +-- 40 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 969 +-- 40 lines: #? # dump word-slice ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1009 $convert-data:check0: 1010 # if (slice-empty?(word-slice)) break 1011 # . eax = slice-empty?(word-slice) @@ -1013,7 +1013,7 @@ if ('onhashchange' in window) { 1168 e8/call flush/disp32 1169 # . . discard args 1170 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -1171 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1171 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1197 # . check-stream-equal(_test-output-stream, "# abcd", msg) 1198 # . . push args 1199 68/push "F - test-convert-data-passes-comments-through"/imm32 @@ -1478,7 +1478,7 @@ if ('onhashchange' in window) { 1658 e8/call flush/disp32 1659 # . . discard args 1660 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -1661 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1661 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1687 # . check-stream-equal(_test-output-stream, "30 abcd/o 42 e1 00 00 \n", msg) 1688 # . . push args 1689 68/push "F - test-convert-data-multiple-words"/imm32 @@ -1545,7 +1545,7 @@ if ('onhashchange' in window) { 1750 e8/call flush/disp32 1751 # . . discard args 1752 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -1753 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1753 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1779 # . check-stream-equal(_test-output-stream, "30 00 00 00 # comment", msg) 1780 # . . push args 1781 68/push "F - test-convert-data-trailing-comment"/imm32 @@ -2065,7 +2065,7 @@ if ('onhashchange' in window) { 2295 e8/call rewind-stream/disp32 2296 # . . discard args 2297 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -2298 +-- 33 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +2298 +-- 33 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2331 $emit-modrm:loop: 2332 # next-word(line, word-slice) 2333 # . . push args @@ -2075,7 +2075,7 @@ if ('onhashchange' in window) { 2337 e8/call next-word/disp32 2338 # . . discard args 2339 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -2340 +-- 40 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +2340 +-- 40 lines: #? # dump word-slice ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2380 $emit-modrm:check0: 2381 # if (slice-empty?(word-slice)) break 2382 # . eax = slice-empty?(word-slice) @@ -2367,7 +2367,7 @@ if ('onhashchange' in window) { 2668 # . . discard args 2669 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp 2670 $emit-sib:loop: -2671 +-- 26 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +2671 +-- 26 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2697 # next-word(line, word-slice) 2698 # . . push args 2699 51/push-ecx @@ -2376,7 +2376,7 @@ if ('onhashchange' in window) { 2702 e8/call next-word/disp32 2703 # . . discard args 2704 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -2705 +-- 40 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +2705 +-- 40 lines: #? # dump word-slice ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2745 $emit-sib:check0: 2746 # if (slice-empty?(word-slice)) break 2747 # . eax = slice-empty?(word-slice) @@ -2565,7 +2565,7 @@ if ('onhashchange' in window) { 2930 e8/call rewind-stream/disp32 2931 # . . discard args 2932 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -2933 +-- 26 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +2933 +-- 26 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2959 $emit-disp:loop: 2960 # next-word(line, word-slice) 2961 # . . push args @@ -2575,7 +2575,7 @@ if ('onhashchange' in window) { 2965 e8/call next-word/disp32 2966 # . . discard args 2967 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -2968 +-- 40 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +2968 +-- 40 lines: #? # dump word-slice ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3008 $emit-disp:check0: 3009 # if (slice-empty?(word-slice)) break 3010 # . eax = slice-empty?(word-slice) @@ -2720,7 +2720,7 @@ if ('onhashchange' in window) { 3149 e8/call rewind-stream/disp32 3150 # . . discard args 3151 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -3152 +-- 26 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +3152 +-- 26 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3178 $emit-imm:loop: 3179 # next-word(line, word-slice) 3180 # . . push args @@ -2730,7 +2730,7 @@ if ('onhashchange' in window) { 3184 e8/call next-word/disp32 3185 # . . discard args 3186 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -3187 +-- 40 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +3187 +-- 40 lines: #? # dump word-slice ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3227 $emit-imm:check0: 3228 # if (slice-empty?(word-slice)) break 3229 # . eax = slice-empty?(word-slice) @@ -3049,7 +3049,7 @@ if ('onhashchange' in window) { 3542 e8/call flush/disp32 3543 # . . discard args 3544 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -3545 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +3545 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3571 # . check-stream-equal(_test-output-stream, "ab # ab/cd # comment", msg) 3572 # . . push args 3573 68/push "F - test-convert-instruction-handles-single-opcode"/imm32 @@ -3116,7 +3116,7 @@ if ('onhashchange' in window) { 3634 e8/call flush/disp32 3635 # . . discard args 3636 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -3637 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +3637 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3663 # . check-stream-equal(_test-output-stream, "0f ab # 0f/m1 ab/m2 # comment", msg) 3664 # . . push args 3665 68/push "F - test-convert-instruction-handles-0f-opcode"/imm32 @@ -3183,7 +3183,7 @@ if ('onhashchange' in window) { 3726 e8/call flush/disp32 3727 # . . discard args 3728 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -3729 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +3729 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3755 # . check-stream-equal(_test-output-stream, "f2 ab # f2/m1 ab/m2 # comment", msg) 3756 # . . push args 3757 68/push "F - test-convert-instruction-handles-f2-opcode"/imm32 @@ -3250,7 +3250,7 @@ if ('onhashchange' in window) { 3818 e8/call flush/disp32 3819 # . . discard args 3820 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -3821 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +3821 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3847 # . check-stream-equal(_test-output-stream, "f3 ab # f3/m1 ab/m2 # comment", msg) 3848 # . . push args 3849 68/push "F - test-convert-instruction-handles-f3-opcode"/imm32 @@ -3317,7 +3317,7 @@ if ('onhashchange' in window) { 3910 e8/call flush/disp32 3911 # . . discard args 3912 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -3913 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +3913 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3939 # . check-stream-equal(_test-output-stream, "f2 0f ab # f2/m1 0f/m2 ab/m3 # comment", msg) 3940 # . . push args 3941 68/push "F - test-convert-instruction-handles-f2-0f-opcode"/imm32 @@ -3384,7 +3384,7 @@ if ('onhashchange' in window) { 4002 e8/call flush/disp32 4003 # . . discard args 4004 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -4005 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +4005 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4031 # . check-stream-equal(_test-output-stream, "f3 0f ab # f3/m1 0f/m2 ab/m3 # comment", msg) 4032 # . . push args 4033 68/push "F - test-convert-instruction-handles-f3-0f-opcode"/imm32 @@ -3451,7 +3451,7 @@ if ('onhashchange' in window) { 4094 e8/call flush/disp32 4095 # . . discard args 4096 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -4097 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +4097 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4123 # . check-stream-equal(_test-output-stream, "ab # f3/m1 0f/m2 ab/m3 # comment", msg) 4124 # . . push args 4125 68/push "F - test-convert-instruction-handles-unused-opcodes"/imm32 @@ -3518,7 +3518,7 @@ if ('onhashchange' in window) { 4186 e8/call flush/disp32 4187 # . . discard args 4188 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -4189 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +4189 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4215 # . check-stream-equal(_test-output-stream, "f2 ab # f2/m1 ab/m2 cd/m3 # comment", msg) 4216 # . . push args 4217 68/push "F - test-convert-instruction-handles-unused-second-opcodes"/imm32 @@ -3585,7 +3585,7 @@ if ('onhashchange' in window) { 4278 e8/call flush/disp32 4279 # . . discard args 4280 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -4281 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +4281 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4307 # . check-stream-equal(_test-output-stream, "f3 ab # f3/m1 ab/m2 cd/m3 # comment", msg) 4308 # . . push args 4309 68/push "F - test-convert-instruction-handles-unused-second-opcodes"/imm32 @@ -3652,7 +3652,7 @@ if ('onhashchange' in window) { 4370 e8/call flush/disp32 4371 # . . discard args 4372 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -4373 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +4373 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4399 # . check-stream-equal(_test-output-stream, "8b 08 # 8b/copy 0/mod 0/rm32 1/r32", msg) 4400 # . . push args 4401 68/push "F - test-convert-instruction-emits-modrm-byte"/imm32 @@ -3717,7 +3717,7 @@ if ('onhashchange' in window) { 4460 e8/call flush/disp32 4461 # . . discard args 4462 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -4463 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +4463 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4489 # check output 4490 # . check-stream-equal(_test-output-stream, "# abcd", msg) 4491 # . . push args @@ -3785,7 +3785,7 @@ if ('onhashchange' in window) { 4553 e8/call flush/disp32 4554 # . . discard args 4555 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -4556 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +4556 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4582 # . check-stream-equal(_test-output-stream, "ff 30 # ff 6/subop/push 0/mod 0/rm32", msg) 4583 # . . push args 4584 68/push "F - test-convert-instruction-emits-modrm-byte-from-subop"/imm32 @@ -3852,7 +3852,7 @@ if ('onhashchange' in window) { 4645 e8/call flush/disp32 4646 # . . discard args 4647 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -4648 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +4648 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4674 # . check-stream-equal(_test-output-stream, "8b 08 # 8b/copy 0/rm32 1/r32", msg) 4675 # . . push args 4676 68/push "F - test-convert-instruction-emits-modrm-byte-with-missing-mod"/imm32 @@ -3919,7 +3919,7 @@ if ('onhashchange' in window) { 4737 e8/call flush/disp32 4738 # . . discard args 4739 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -4740 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +4740 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4766 # . check-stream-equal(_test-output-stream, "8b 08 # 8b/copy 0/mod 1/r32", msg) 4767 # . . push args 4768 68/push "F - test-convert-instruction-emits-modrm-byte-with-missing-rm32"/imm32 @@ -3986,7 +3986,7 @@ if ('onhashchange' in window) { 4829 e8/call flush/disp32 4830 # . . discard args 4831 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -4832 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +4832 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4858 # . check-stream-equal(_test-output-stream, "8b 00 # 8b/copy 0/mod 0/rm32", msg) 4859 # . . push args 4860 68/push "F - test-convert-instruction-emits-modrm-byte-with-missing-r32"/imm32 @@ -4053,7 +4053,7 @@ if ('onhashchange' in window) { 4921 e8/call flush/disp32 4922 # . . discard args 4923 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -4924 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +4924 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4950 # . check-stream-equal(_test-output-stream, "8b 08 # 8b/copy 0/mod 4/rm32 1/r32 0/base 1/index 0/scale", msg) 4951 # . . push args 4952 68/push "F - test-convert-instruction-emits-sib-byte"/imm32 @@ -4120,7 +4120,7 @@ if ('onhashchange' in window) { 5013 e8/call flush/disp32 5014 # . . discard args 5015 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -5016 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +5016 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5042 # . check-stream-equal(_test-output-stream, "8b 04 40 # 8b/copy 0/mod 4/rm32 1/scale", msg) 5043 # . . push args 5044 68/push "F - test-convert-instruction-emits-scale"/imm32 @@ -4187,7 +4187,7 @@ if ('onhashchange' in window) { 5105 e8/call flush/disp32 5106 # . . discard args 5107 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -5108 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +5108 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5134 # . check-stream-equal(_test-output-stream, "8b 0c 08 # 8b/copy 0/mod 4/rm32 1/r32 1/index 0/scale", msg) 5135 # . . push args 5136 68/push "F - test-convert-instruction-emits-sib-byte-with-missing-base"/imm32 @@ -4254,7 +4254,7 @@ if ('onhashchange' in window) { 5197 e8/call flush/disp32 5198 # . . discard args 5199 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -5200 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +5200 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5226 # . check-stream-equal(_test-output-stream, "8b 0c 08 # 8b/copy 0/mod 4/rm32 1/r32 0/base 0/scale", msg) 5227 # . . push args 5228 68/push "F - test-convert-instruction-emits-sib-byte-with-missing-index"/imm32 @@ -4321,7 +4321,7 @@ if ('onhashchange' in window) { 5289 e8/call flush/disp32 5290 # . . discard args 5291 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -5292 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +5292 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5318 # . check-stream-equal(_test-output-stream, "8b 0c 08 # 8b/copy 0/mod 4/rm32 1/r32 0/base 1/index", msg) 5319 # . . push args 5320 68/push "F - test-convert-instruction-emits-sib-byte-with-missing-scale"/imm32 @@ -4388,7 +4388,7 @@ if ('onhashchange' in window) { 5381 e8/call flush/disp32 5382 # . . discard args 5383 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -5384 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +5384 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5410 # . check-stream-equal(_test-output-stream, "e8 20 00 00 00 # e8/call 20/disp32", msg) 5411 # . . push args 5412 68/push "F - test-convert-instruction-handles-disp32-operand"/imm32 @@ -4455,7 +4455,7 @@ if ('onhashchange' in window) { 5473 e8/call flush/disp32 5474 # . . discard args 5475 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -5476 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +5476 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5502 # . check-stream-equal(_test-output-stream, "e8 20 00 # e8/call 20/disp16", msg) 5503 # . . push args 5504 68/push "F - test-convert-instruction-handles-disp16-operand"/imm32 @@ -4522,7 +4522,7 @@ if ('onhashchange' in window) { 5565 e8/call flush/disp32 5566 # . . discard args 5567 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -5568 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +5568 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5594 # . check-stream-equal(_test-output-stream, "eb 20 # eb/jump 20/disp8", msg) 5595 # . . push args 5596 68/push "F - test-convert-instruction-handles-disp8-operand"/imm32 @@ -4589,7 +4589,7 @@ if ('onhashchange' in window) { 5657 e8/call flush/disp32 5658 # . . discard args 5659 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -5660 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +5660 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5686 # . check-stream-equal(_test-output-stream, "eb xyz/disp8 # eb/jump xyz/disp8", msg) 5687 # . . push args 5688 68/push "F - test-convert-instruction-handles-disp8-name"/imm32 @@ -4656,7 +4656,7 @@ if ('onhashchange' in window) { 5749 e8/call flush/disp32 5750 # . . discard args 5751 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -5752 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +5752 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5778 # . check-stream-equal(_test-output-stream, "68 20 00 00 00 # 68/push 0x20/imm32", msg) 5779 # . . push args 5780 68/push "F - test-convert-instruction-handles-imm32-operand"/imm32 @@ -4724,7 +4724,7 @@ if ('onhashchange' in window) { 5842 e8/call flush/disp32 5843 # . . discard args 5844 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -5845 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +5845 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5871 # . check-stream-equal(_test-output-stream, "68 20 00 # 68/push 0x20/imm16", msg) 5872 # . . push args 5873 68/push "F - test-convert-instruction-handles-imm16-operand"/imm32 @@ -4792,7 +4792,7 @@ if ('onhashchange' in window) { 5935 e8/call flush/disp32 5936 # . . discard args 5937 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -5938 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +5938 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5964 # . check-stream-equal(_test-output-stream, "68 20 # 68/push 0x20/imm8", msg) 5965 # . . push args 5966 68/push "F - test-convert-instruction-handles-imm8-operand"/imm32 diff --git a/html/apps/raytracing/1.mu.html b/html/apps/raytracing/1.mu.html index de84e398..bc5ab657 100644 --- a/html/apps/raytracing/1.mu.html +++ b/html/apps/raytracing/1.mu.html @@ -75,9 +75,9 @@ if ('onhashchange' in window) { 17 { 18 compare i, 0xff 19 break-if-> -20 print-int32-decimal 0, i +20 print-int32-decimal 0, i 21 print-string 0, " " -22 print-int32-decimal 0, j +22 print-int32-decimal 0, j 23 print-string 0, " 64\n" 24 i <- increment 25 loop diff --git a/html/apps/raytracing/2.mu.html b/html/apps/raytracing/2.mu.html index 5bc16803..8e068b01 100644 --- a/html/apps/raytracing/2.mu.html +++ b/html/apps/raytracing/2.mu.html @@ -126,21 +126,21 @@ if ('onhashchange' in window) { 67 var src-addr/eax: (addr float) <- get c, r 68 result <- multiply *src-addr 69 var result-int/edx: int <- convert result -70 print-int32-decimal screen, result-int +70 print-int32-decimal screen, result-int 71 print-string screen, " " 72 # print 255 * c->g 73 src-addr <- get c, g 74 result <- copy xn 75 result <- multiply *src-addr 76 result-int <- convert result -77 print-int32-decimal screen, result-int +77 print-int32-decimal screen, result-int 78 print-string screen, " " 79 # print 255 * c->b 80 src-addr <- get c, b 81 result <- copy xn 82 result <- multiply *src-addr 83 result-int <- convert result -84 print-int32-decimal screen, result-int +84 print-int32-decimal screen, result-int 85 print-string screen, "\n" 86 } diff --git a/html/apps/raytracing/3.mu.html b/html/apps/raytracing/3.mu.html index f090649a..9819e2ba 100644 --- a/html/apps/raytracing/3.mu.html +++ b/html/apps/raytracing/3.mu.html @@ -328,21 +328,21 @@ if ('onhashchange' in window) { 267 var src-addr/eax: (addr float) <- get c, r 268 result <- multiply *src-addr 269 var result-int/edx: int <- truncate result -270 print-int32-decimal screen, result-int +270 print-int32-decimal screen, result-int 271 print-string screen, " " 272 # print 255.999 * c->g 273 src-addr <- get c, g 274 result <- copy xn 275 result <- multiply *src-addr 276 result-int <- truncate result -277 print-int32-decimal screen, result-int +277 print-int32-decimal screen, result-int 278 print-string screen, " " 279 # print 255.999 * c->b 280 src-addr <- get c, b 281 result <- copy xn 282 result <- multiply *src-addr 283 result-int <- truncate result -284 print-int32-decimal screen, result-int +284 print-int32-decimal screen, result-int 285 print-string screen, "\n" 286 } 287 diff --git a/html/apps/raytracing/color.mu.html b/html/apps/raytracing/color.mu.html index b1d90af3..8313b7ec 100644 --- a/html/apps/raytracing/color.mu.html +++ b/html/apps/raytracing/color.mu.html @@ -74,21 +74,21 @@ if ('onhashchange' in window) { 16 var src-addr/eax: (addr float) <- get c, r 17 result <- multiply *src-addr 18 var result-int/edx: int <- truncate result -19 print-int32-decimal screen, result-int +19 print-int32-decimal screen, result-int 20 print-string screen, " " 21 # print 255.999 * c->g 22 src-addr <- get c, g 23 result <- copy xn 24 result <- multiply *src-addr 25 result-int <- truncate result -26 print-int32-decimal screen, result-int +26 print-int32-decimal screen, result-int 27 print-string screen, " " 28 # print 255.999 * c->b 29 src-addr <- get c, b 30 result <- copy xn 31 result <- multiply *src-addr 32 result-int <- truncate result -33 print-int32-decimal screen, result-int +33 print-int32-decimal screen, result-int 34 print-string screen, "\n" 35 } diff --git a/html/apps/rpn.mu.html b/html/apps/rpn.mu.html index 43ec8995..d1894cf0 100644 --- a/html/apps/rpn.mu.html +++ b/html/apps/rpn.mu.html @@ -101,7 +101,7 @@ if ('onhashchange' in window) { 43 # parse and eval 44 var out/eax: int <- simplify in 45 # print - 46 print-int32-decimal 0, out + 46 print-int32-decimal 0, out 47 print-string 0, "\n" 48 # 49 loop diff --git a/html/apps/sigils.subx.html b/html/apps/sigils.subx.html index b51642b9..fc4ec0a8 100644 --- a/html/apps/sigils.subx.html +++ b/html/apps/sigils.subx.html @@ -270,7 +270,7 @@ if ('onhashchange' in window) { 208 3d/compare-eax-and 0x25/imm32/percent 209 75/jump-if-!= $subx-sigils:check-for-indirect-mode/disp8 210 $subx-sigils:direct-mode: - 211 +-- 40 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 211 +-- 40 lines: #? # dump word-slice ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 251 # emit-direct-mode(out, word-slice) 252 # . . push args 253 52/push-edx @@ -511,7 +511,7 @@ if ('onhashchange' in window) { 488 e8/call flush/disp32 489 # . . discard args 490 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - 491 +-- 26 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 491 +-- 26 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 517 # . check-stream-equal(_test-output-stream, "== abcd 0x1 \n", msg) 518 # . . push args 519 68/push "F - test-subx-sigils-passes-most-words-through"/imm32 @@ -584,7 +584,7 @@ if ('onhashchange' in window) { 586 e8/call flush/disp32 587 # . . discard args 588 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - 589 +-- 26 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 589 +-- 26 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 615 # . check-stream-equal(_test-output-stream, "ab 3/mod/direct 0x00000001/rm32 \n", msg) 616 # . . push args 617 68/push "F - test-subx-sigils-direct-mode"/imm32 @@ -729,7 +729,7 @@ if ('onhashchange' in window) { 756 e8/call flush/disp32 757 # . . discard args 758 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - 759 +-- 26 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 759 +-- 26 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 785 # . check-stream-equal(_test-output-stream, "ab 0/mod/indirect 0x00000001/rm32 \n", msg) 786 # . . push args 787 68/push "F - test-subx-sigils-register-indirect-mode"/imm32 @@ -874,7 +874,7 @@ if ('onhashchange' in window) { 926 e8/call flush/disp32 927 # . . discard args 928 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - 929 +-- 26 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 929 +-- 26 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 955 # . check-stream-equal(_test-output-stream, "ab 0/mod/indirect 1/rm32 \n", msg) 956 # . . push args 957 68/push "F - test-subx-sigils-register-indirect-mode-without-displacement"/imm32 @@ -947,7 +947,7 @@ if ('onhashchange' in window) { 1024 e8/call flush/disp32 1025 # . . discard args 1026 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -1027 +-- 26 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ +1027 +-- 26 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1053 # . check-stream-equal(_test-output-stream, "ab 2/mod/*+disp32 1/rm32 4/disp32 \n", msg) 1054 # . . push args 1055 68/push "F - test-subx-sigils-register-indirect-mode-with-displacement"/imm32 @@ -1021,7 +1021,7 @@ if ('onhashchange' in window) { 1123 e8/call flush/disp32 1124 # . . discard args 1125 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -1126 +-- 26 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ +1126 +-- 26 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1152 # . check-stream-equal(_test-output-stream, "ab 2/mod/*+disp32 4/rm32/sib 1/base 2/index 3/scale 4/disp32 \n", msg) 1153 # . . push args 1154 68/push "F - test-subx-sigils-register-indirect-mode-with-sib-byte"/imm32 @@ -1094,7 +1094,7 @@ if ('onhashchange' in window) { 1221 e8/call flush/disp32 1222 # . . discard args 1223 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -1224 +-- 26 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ +1224 +-- 26 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1250 # . check-stream-equal(_test-output-stream, "ab 2/mod/*+disp32 4/rm32/sib 1/base 2/index 3/scale -4/disp32 \n", msg) 1251 # . . push args 1252 68/push "F - test-subx-sigils-register-indirect-mode-with-sib-byte-negative-displacement"/imm32 @@ -1167,7 +1167,7 @@ if ('onhashchange' in window) { 1319 e8/call flush/disp32 1320 # . . discard args 1321 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -1322 +-- 26 lines: #? # dump _test-output-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------ +1322 +-- 26 lines: #? # dump _test-output-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1348 # . check-stream-equal(_test-output-stream, "ab 0/mod/indirect 5/rm32/.disp32 Foo/disp32 \n", msg) 1349 # . . push args 1350 68/push "F - test-subx-sigils-indirect-mode-without-register"/imm32 @@ -1196,7 +1196,7 @@ if ('onhashchange' in window) { 1373 # ++local-slice->start to skip '%' 1374 # . ++(*eax) 1375 ff 0/subop/increment 0/mod/indirect 0/rm32/eax . . . . . . # increment *eax -1376 +-- 24 lines: #? # write-slice-buffered(Stderr, word-slice) -------------------------------------------------------------------------------------------------------------------------------------------------- +1376 +-- 24 lines: #? # write-slice-buffered(Stderr, word-slice) ---------------------------------------------------------------------------------------------------------------------------------------------------- 1400 # local-slice = next-token-from-slice(local-slice->start, local-slice->end, "/") 1401 # . . push args 1402 50/push-eax @@ -1294,7 +1294,7 @@ if ('onhashchange' in window) { 1494 e8/call flush/disp32 1495 # . . discard args 1496 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -1497 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1497 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1523 # check-stream-equal(_test-output-stream, "3/mod/direct 0/rm32", msg) 1524 # . . push args 1525 68/push "F - test-emit-direct-mode/0"/imm32 @@ -1352,7 +1352,7 @@ if ('onhashchange' in window) { 1577 e8/call flush/disp32 1578 # . . discard args 1579 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -1580 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1580 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1606 # check-stream-equal(_test-output-stream, "3/mod/direct 7/rm32", msg) 1607 # . . push args 1608 68/push "F - test-emit-direct-mode/1"/imm32 @@ -3124,7 +3124,7 @@ if ('onhashchange' in window) { 3374 e8/call flush/disp32 3375 # . . discard args 3376 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -3377 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +3377 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3403 # check-stream-equal(_test-output-stream, "0/mod/indirect 0/rm32", msg) 3404 # . . push args 3405 68/push "F - test-emit-indirect-mode"/imm32 @@ -3176,7 +3176,7 @@ if ('onhashchange' in window) { 3451 e8/call flush/disp32 3452 # . . discard args 3453 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -3454 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +3454 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3480 # check-stream-equal(_test-output-stream, "0/mod/indirect 7/rm32", msg) 3481 # . . push args 3482 68/push "F - test-emit-indirect-mode-2"/imm32 @@ -3228,7 +3228,7 @@ if ('onhashchange' in window) { 3528 e8/call flush/disp32 3529 # . . discard args 3530 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -3531 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +3531 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3557 # check-stream-equal(_test-output-stream, "2/mod/*+disp32 6/rm32 4/disp32", msg) 3558 # . . push args 3559 68/push "F - test-emit-indirect-mode-with-disp"/imm32 @@ -3280,7 +3280,7 @@ if ('onhashchange' in window) { 3605 e8/call flush/disp32 3606 # . . discard args 3607 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -3608 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +3608 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3634 # check-stream-equal(_test-output-stream, "2/mod/*+disp32 6/rm32 -4/disp32", msg) 3635 # . . push args 3636 68/push "F - test-emit-indirect-mode-with-disp"/imm32 @@ -3332,7 +3332,7 @@ if ('onhashchange' in window) { 3682 e8/call flush/disp32 3683 # . . discard args 3684 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -3685 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +3685 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3711 # check-stream-equal(_test-output-stream, "2/mod/indirect 4/rm32/sib 6/base 1/index 2/scale 4/disp", msg) 3712 # . . push args 3713 68/push "F - test-emit-indirect-mode-with-sib"/imm32 @@ -3384,7 +3384,7 @@ if ('onhashchange' in window) { 3759 e8/call flush/disp32 3760 # . . discard args 3761 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -3762 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +3762 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3788 # check-stream-equal(_test-output-stream, "2/mod/*+disp32 4/rm32/sib 5/base/ebp 0/index 0/scale 0/disp32", msg) 3789 # . . push args 3790 68/push "F - test-emit-indirect-mode-ebp"/imm32 @@ -3436,7 +3436,7 @@ if ('onhashchange' in window) { 3836 e8/call flush/disp32 3837 # . . discard args 3838 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -3839 +-- 26 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +3839 +-- 26 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3865 # check-stream-equal(_test-output-stream, "2/mod/*+disp32 4/rm32/sib 4/base/ebp 0/index 0/scale 0/disp32", msg) 3866 # . . push args 3867 68/push "F - test-emit-indirect-mode-esp"/imm32 diff --git a/html/apps/survey.subx.html b/html/apps/survey.subx.html index 92b9407a..6dbd7ad5 100644 --- a/html/apps/survey.subx.html +++ b/html/apps/survey.subx.html @@ -387,7 +387,7 @@ if ('onhashchange' in window) { 324 # . . discard args 325 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp 326 # check trace - 327 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 327 +-- 26 lines: #? # dump *Trace-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 353 # . check-trace-contains("label 'x' is at address 0x00001079.", msg) 354 # . . push args 355 68/push "F - test-subx-survey-computes-addresses/0"/imm32 @@ -546,7 +546,7 @@ if ('onhashchange' in window) { 508 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . . # copy *ecx to eax 509 3d/compare-eax-and 0/imm32 510 0f 84/jump-if-= $compute-offsets:break-line-loop/disp32 - 511 +-- 33 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 511 +-- 33 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 544 $compute-offsets:word-loop: 545 # next-word(line, word-slice) 546 52/push-edx @@ -812,7 +812,7 @@ if ('onhashchange' in window) { 806 01/add 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax compute-offsets:segment-offset/disp32 # add eax to *segment-offset 807 # file-offset += width 808 01/add 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax compute-offsets:file-offset/disp32 # add eax to *file-offset - 809 +-- 41 lines: #? # dump segment-offset ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 809 +-- 41 lines: #? # dump segment-offset ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 850 e9/jump $compute-offsets:word-loop/disp32 851 $compute-offsets:break-line-loop: 852 # sinfo/edi = get-or-insert-handle(segments, curr-segment-name, row-size=16) @@ -988,7 +988,7 @@ if ('onhashchange' in window) { 1022 e8/call compute-offsets/disp32 1023 # . . discard args 1024 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp -1025 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +1025 +-- 26 lines: #? # dump *Trace-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1051 # check trace 1052 # . check-trace-contains("segment 'code' is at file offset 0x00000000.", msg) 1053 # . . push args @@ -1152,7 +1152,7 @@ if ('onhashchange' in window) { 1211 81 0/subop/add 3/mod/direct 6/rm32/esi . . . . . 0x14/imm32 # add to esi 1212 eb/jump $compute-addresses:segment-loop/disp8 1213 $compute-addresses:segment-break: -1214 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +1214 +-- 26 lines: #? # dump *Trace-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1240 # esi = labels 1241 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi 1242 # var max/ecx: (addr byte) = &labels->data[labels->write] @@ -1164,7 +1164,7 @@ if ('onhashchange' in window) { 1248 # if (lrow >= max) break 1249 39/compare 3/mod/direct 6/rm32/esi . . . 1/r32/ecx . . # compare esi with ecx 1250 0f 83/jump-if-addr>= $compute-addresses:end/disp32 -1251 +-- 26 lines: #? # dump lrow->key ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1251 +-- 26 lines: #? # dump lrow->key ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 1277 # var seg-name/edx: (addr array byte) = lookup(lrow->segment-name) 1278 # . eax = lookup(lrow->segment-name) 1279 # . . push args @@ -1176,7 +1176,7 @@ if ('onhashchange' in window) { 1285 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp 1286 # . edx = eax 1287 89/copy 3/mod/direct 2/rm32/edx . . . 0/r32/eax . . # copy eax to edx -1288 +-- 26 lines: #? # dump seg-name ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1288 +-- 26 lines: #? # dump seg-name ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1314 # var label-seg/edx: (addr segment-info) = get(segments, seg-name, row-size=20, "segment table") 1315 # . eax = get(segments, seg-name, row-size=20) 1316 # . . push args @@ -1393,7 +1393,7 @@ if ('onhashchange' in window) { 1527 # . . discard args 1528 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp 1529 # checks -1530 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +1530 +-- 26 lines: #? # dump *Trace-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1556 # . check-trace-contains("segment 'a' starts at address 0x00001094.", msg) 1557 # . . push args 1558 68/push "F - test-compute-addresses/0"/imm32 @@ -1556,7 +1556,7 @@ if ('onhashchange' in window) { 1715 # . . discard args 1716 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp 1717 # checks -1718 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +1718 +-- 26 lines: #? # dump *Trace-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1744 # . check-trace-contains("segment 'a' starts at address 0x00001074.", msg) 1745 # . . push args 1746 68/push "F - test-compute-addresses-large-segments/0"/imm32 @@ -1594,7 +1594,7 @@ if ('onhashchange' in window) { 1778 # . prologue 1779 55/push-ebp 1780 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp -1781 +-- 9 lines: #? # write(2/stderr, "emit-headers\n") --------------------------------------------------------------------------------------------------------------------------------------------------------- +1781 +-- 9 lines: #? # write(2/stderr, "emit-headers\n") ----------------------------------------------------------------------------------------------------------------------------------------------------------- 1790 # emit-headers(out, segments, labels) 1791 # . . push args 1792 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 . # push *(ebp+20) @@ -1604,7 +1604,7 @@ if ('onhashchange' in window) { 1796 e8/call emit-headers/disp32 1797 # . . discard args 1798 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp -1799 +-- 9 lines: #? # write(2/stderr, "emit-segments\n") -------------------------------------------------------------------------------------------------------------------------------------------------------- +1799 +-- 9 lines: #? # write(2/stderr, "emit-segments\n") ---------------------------------------------------------------------------------------------------------------------------------------------------------- 1808 # emit-segments(in, out, labels) 1809 # . . push args 1810 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 . # push *(ebp+20) @@ -1718,7 +1718,7 @@ if ('onhashchange' in window) { 1918 e8/call read-line/disp32 1919 # . . discard args 1920 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -1921 +-- 33 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1921 +-- 33 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1954 $emit-segments:check-for-end-of-input: 1955 # if (line->write == 0) break 1956 81 7/subop/compare 0/mod/indirect 1/rm32/ecx . . . . . 0/imm32 # compare *ecx @@ -1742,7 +1742,7 @@ if ('onhashchange' in window) { 1974 e8/call next-word/disp32 1975 # . . discard args 1976 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -1977 +-- 33 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +1977 +-- 33 lines: #? # dump word-slice ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2010 $emit-segments:check-for-end-of-line: 2011 # if (slice-empty?(word-slice)) break 2012 # . eax = slice-empty?(word-slice) @@ -1828,7 +1828,7 @@ if ('onhashchange' in window) { 2092 e8/call next-token-from-slice/disp32 2093 # . . discard args 2094 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32 # add to esp -2095 +-- 33 lines: #? # dump datum -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +2095 +-- 33 lines: #? # dump datum ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2128 # info/esi = get-slice(labels, datum, row-size=24, "label table") 2129 # . eax = get-slice(labels, datum, row-size=24, "label table") 2130 # . . push args @@ -1927,7 +1927,7 @@ if ('onhashchange' in window) { 2223 # . if (eax == false) goto next check 2224 3d/compare-eax-and 0/imm32/false 2225 74/jump-if-= $emit-segments:check-code-label-for-disp8/disp8 -2226 +-- 33 lines: #? # dump info->address ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +2226 +-- 33 lines: #? # dump info->address -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2259 $emit-segments:emit-code-label-imm32: 2260 # emit-hex(out, info->address, 4) 2261 # . . push args @@ -2234,7 +2234,7 @@ if ('onhashchange' in window) { 2562 e8/call flush/disp32 2563 # . . discard args 2564 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -2565 +-- 33 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +2565 +-- 33 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2598 # . check-next-stream-line-equal(_test-output-stream, "ab cd ef gh ", msg) 2599 # . . push args 2600 68/push "F - test-emit-segments-global-variable/0"/imm32 @@ -2413,7 +2413,7 @@ if ('onhashchange' in window) { 2773 e8/call flush/disp32 2774 # . . discard args 2775 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -2776 +-- 33 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +2776 +-- 33 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2809 # . check-next-stream-line-equal(_test-output-stream, "ab cd ", msg) 2810 # . . push args 2811 68/push "F - test-emit-segments-code-label/0"/imm32 @@ -2583,7 +2583,7 @@ if ('onhashchange' in window) { 2975 e8/call flush/disp32 2976 # . . discard args 2977 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp -2978 +-- 33 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +2978 +-- 33 lines: #? # dump output --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3011 # . check-next-stream-line-equal(_test-output-stream, "ab cd ", msg) 3012 # . . push args 3013 68/push "F - test-emit-segments-code-label-absolute/0"/imm32 @@ -2653,8 +2653,8 @@ if ('onhashchange' in window) { 3077 # if (curr-segment >= max) break 3078 39/compare 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . . # compare eax with ecx 3079 0f 83/jump-if-addr>= $emit-headers:end/disp32 -3080 +-- 63 lines: #? # dump curr-segment->name ------------------------------------------------------------------------------------------------------------------------------------------------------------------- -3143 +-- 9 lines: #? # write(2/stderr, "emit-segment-header\n") -------------------------------------------------------------------------------------------------------------------------------------------------- +3080 +-- 63 lines: #? # dump curr-segment->name --------------------------------------------------------------------------------------------------------------------------------------------------------------------- +3143 +-- 9 lines: #? # write(2/stderr, "emit-segment-header\n") ---------------------------------------------------------------------------------------------------------------------------------------------------- 3152 # emit-elf-program-header-entry(out, curr-segment) 3153 # . . push args 3154 50/push-eax @@ -3174,7 +3174,7 @@ if ('onhashchange' in window) { 3668 e8/call trace-sssns/disp32 3669 # . . discard args 3670 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32 # add to esp -3671 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +3671 +-- 26 lines: #? # dump *Trace-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3697 # check-trace-contains("Abc 0x00000003 e") 3698 # . . push args 3699 68/push "F - test-trace-sssns"/imm32 @@ -3256,7 +3256,7 @@ if ('onhashchange' in window) { 3775 e8/call trace-snsns/disp32 3776 # . . discard args 3777 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32 # add to esp -3778 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +3778 +-- 26 lines: #? # dump *Trace-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3804 # check-trace-contains("Abc 0x00000003 e") 3805 # . . push args 3806 68/push "F - test-trace-snsns"/imm32 @@ -3356,7 +3356,7 @@ if ('onhashchange' in window) { 3900 e8/call trace-slsls/disp32 3901 # . . discard args 3902 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32 # add to esp -3903 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +3903 +-- 26 lines: #? # dump *Trace-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3929 # check-trace-contains("Abcde") 3930 # . . push args 3931 68/push "F - test-trace-slsls"/imm32 @@ -3447,7 +3447,7 @@ if ('onhashchange' in window) { 4016 e8/call trace-slsns/disp32 4017 # . . discard args 4018 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32 # add to esp -4019 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +4019 +-- 26 lines: #? # dump *Trace-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4045 # check-trace-contains("Abc 0x00000003 e") 4046 # . . push args 4047 68/push "F - test-trace-slsls"/imm32 @@ -3538,7 +3538,7 @@ if ('onhashchange' in window) { 4132 e8/call trace-slsss/disp32 4133 # . . discard args 4134 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32 # add to esp -4135 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +4135 +-- 26 lines: #? # dump *Trace-stream -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4161 # check-trace-contains("Abcde") 4162 # . . push args 4163 68/push "F - test-trace-slsss"/imm32 @@ -3581,7 +3581,7 @@ if ('onhashchange' in window) { 4200 68/push 0/imm32/end 4201 68/push 0/imm32/start 4202 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx -4203 +-- 26 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +4203 +-- 26 lines: #? # dump line ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4229 # . rewind-stream(line) 4230 # . . push args 4231 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 . # push *(ebp+8) @@ -3598,7 +3598,7 @@ if ('onhashchange' in window) { 4242 e8/call next-word/disp32 4243 # . . discard args 4244 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp -4245 +-- 40 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +4245 +-- 40 lines: #? # dump word-slice ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4285 $num-bytes:check0: 4286 # if (slice-empty?(word-slice)) break 4287 # . save result diff --git a/html/apps/texture.mu.html b/html/apps/texture.mu.html index bb3cf7b5..72f99d3b 100644 --- a/html/apps/texture.mu.html +++ b/html/apps/texture.mu.html @@ -71,9 +71,9 @@ if ('onhashchange' in window) { 12 var width/esi: int <- copy 0xff 13 var height/edi: int <- copy 0xff 14 print-string 0, "P3\n" -15 print-int32-decimal 0, width +15 print-int32-decimal 0, width 16 print-string 0, " " -17 print-int32-decimal 0, height +17 print-int32-decimal 0, height 18 print-string 0, "\n" 19 print-string 0, "255\n" # color depth 20 var row/ecx: int <- copy 0 @@ -90,7 +90,7 @@ if ('onhashchange' in window) { 31 tmp <- and 0x7f 32 tmp <- add 0x80 33 tmp <- copy 0xff -34 print-int32-decimal 0, tmp +34 print-int32-decimal 0, tmp 35 print-string 0, " " 36 # g 37 tmp <- copy row @@ -98,14 +98,14 @@ if ('onhashchange' in window) { 39 tmp <- and 0x7f 40 tmp <- add 0x80 41 #? tmp <- copy 0xcf -42 print-int32-decimal 0, tmp +42 print-int32-decimal 0, tmp 43 print-string 0, " " 44 # b 45 tmp <- copy row 46 tmp <- multiply col 47 tmp <- and 0x7f 48 tmp <- add 0x80 -49 print-int32-decimal 0, tmp +49 print-int32-decimal 0, tmp 50 print-string 0, "\n" 51 col <- increment 52 loop diff --git a/html/apps/tile/box.mu.html b/html/apps/tile/box.mu.html index cfb3da04..88d29001 100644 --- a/html/apps/tile/box.mu.html +++ b/html/apps/tile/box.mu.html @@ -87,7 +87,7 @@ if ('onhashchange' in window) { 29 { 30 compare col, col2 31 break-if->= - 32 print-code-point screen, 0x2500 + 32 print-code-point screen, 0x2500 33 col <- increment 34 loop 35 } @@ -99,7 +99,7 @@ if ('onhashchange' in window) { 41 compare row, row2 42 break-if->= 43 move-cursor screen, row, col - 44 print-code-point screen, 0x2502 + 44 print-code-point screen, 0x2502 45 row <- increment 46 loop 47 } @@ -107,22 +107,22 @@ if ('onhashchange' in window) { 49 50 fn draw-top-left-corner screen: (addr screen), row: int, col: int { 51 move-cursor screen, row, col - 52 print-code-point screen, 0x250c + 52 print-code-point screen, 0x250c 53 } 54 55 fn draw-top-right-corner screen: (addr screen), row: int, col: int { 56 move-cursor screen, row, col - 57 print-code-point screen, 0x2510 + 57 print-code-point screen, 0x2510 58 } 59 60 fn draw-bottom-left-corner screen: (addr screen), row: int, col: int { 61 move-cursor screen, row, col - 62 print-code-point screen, 0x2514 + 62 print-code-point screen, 0x2514 63 } 64 65 fn draw-bottom-right-corner screen: (addr screen), row: int, col: int { 66 move-cursor screen, row, col - 67 print-code-point screen, 0x2518 + 67 print-code-point screen, 0x2518 68 } 69 70 # erase parts of screen the slow way diff --git a/html/apps/tile/data.mu.html b/html/apps/tile/data.mu.html index 5d932cb3..3e3eacd4 100644 --- a/html/apps/tile/data.mu.html +++ b/html/apps/tile/data.mu.html @@ -61,8 +61,8 @@ if ('onhashchange' in window) { 2 setup: (handle line) 3 data: (handle line) 4 # display data - 5 cursor-call-path: (handle call-path-element) - 6 expanded-words: (handle call-path) + 5 cursor-call-path: (handle call-path-element) + 6 expanded-words: (handle call-path) 7 partial-name-for-cursor-word: (handle word) # only when renaming word 8 partial-name-for-function: (handle word) # only when defining function 9 # @@ -81,7 +81,7 @@ if ('onhashchange' in window) { 22 type line { 23 name: (handle array byte) 24 data: (handle word) - 25 result: (handle result) # might be cached + 25 result: (handle result) # might be cached 26 next: (handle line) 27 prev: (handle line) 28 } @@ -92,656 +92,659 @@ if ('onhashchange' in window) { 33 prev: (handle word) 34 } 35 - 36 type value { - 37 type: int - 38 int-data: int # if type = 0 - 39 text-data: (handle array byte) # if type = 1 - 40 array-data: (handle array value) # if type = 2 - 41 file-data: (handle buffered-file) # if type = 3 - 42 } - 43 - 44 type table { - 45 data: (handle array bind) - 46 next: (handle table) - 47 } - 48 - 49 type bind { - 50 key: (handle array byte) - 51 value: (handle value) # I'd inline this but we sometimes want to return a specific value from a table - 52 } - 53 - 54 # A call-path is a data structure that can unambiguously refer to any specific - 55 # call arbitrarily deep inside the call hierarchy of a program. - 56 type call-path { - 57 data: (handle call-path-element) - 58 next: (handle call-path) - 59 } - 60 - 61 # A call-path element is a list of elements, each of which corresponds to some call. - 62 type call-path-element { - 63 word: (handle word) - 64 next: (handle call-path-element) - 65 } - 66 - 67 type result { - 68 data: value-stack - 69 error: (handle array byte) # single error message for now - 70 } - 71 - 72 fn initialize-sandbox _sandbox: (addr sandbox) { - 73 var sandbox/esi: (addr sandbox) <- copy _sandbox - 74 var line-ah/eax: (addr handle line) <- get sandbox, data - 75 allocate line-ah - 76 var line/eax: (addr line) <- lookup *line-ah - 77 initialize-line line - 78 var word-ah/ecx: (addr handle word) <- get line, data - 79 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 80 allocate cursor-call-path-ah - 81 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 82 var dest/eax: (addr handle word) <- get cursor-call-path, word - 83 copy-object word-ah, dest - 84 } - 85 - 86 # initialize line with a single empty word - 87 fn initialize-line _line: (addr line) { - 88 var line/esi: (addr line) <- copy _line - 89 var word-ah/eax: (addr handle word) <- get line, data - 90 allocate word-ah - 91 var word/eax: (addr word) <- lookup *word-ah - 92 initialize-word word - 93 } - 94 - 95 fn create-primitive-functions _self: (addr handle function) { - 96 # x 2* = x 2 * - 97 var self/esi: (addr handle function) <- copy _self - 98 allocate self - 99 var _f/eax: (addr function) <- lookup *self -100 var f/esi: (addr function) <- copy _f -101 var name-ah/eax: (addr handle array byte) <- get f, name -102 populate-text-with name-ah, "2*" -103 var args-ah/eax: (addr handle word) <- get f, args -104 allocate args-ah -105 var args/eax: (addr word) <- lookup *args-ah -106 initialize-word-with args, "x" -107 var body-ah/eax: (addr handle line) <- get f, body -108 allocate body-ah -109 var body/eax: (addr line) <- lookup *body-ah -110 initialize-line body -111 var curr-word-ah/ecx: (addr handle word) <- get body, data -112 # *curr-word = "x" -113 allocate curr-word-ah -114 var tmp/eax: (addr word) <- lookup *curr-word-ah -115 var curr-word/edx: (addr word) <- copy tmp -116 initialize-word-with curr-word, "x" -117 # *curr-word->next = "2" -118 var next-word-ah/ebx: (addr handle word) <- get curr-word, next -119 allocate next-word-ah -120 tmp <- lookup *next-word-ah -121 initialize-word-with tmp, "2" -122 # *curr-word->next->prev = curr-word -123 var prev-word-ah/edi: (addr handle word) <- get tmp, prev -124 copy-object curr-word-ah, prev-word-ah -125 # curr-word = curr-word->next -126 curr-word-ah <- copy next-word-ah -127 curr-word <- copy tmp -128 # *curr-word->next = "*" -129 next-word-ah <- get curr-word, next -130 allocate next-word-ah -131 tmp <- lookup *next-word-ah -132 initialize-word-with tmp, "*" -133 # *curr-word->next->prev = curr-word -134 prev-word-ah <- get tmp, prev -135 copy-object curr-word-ah, prev-word-ah -136 tmp <- lookup *prev-word-ah -137 # x 1+ = x 1 + -138 var next/esi: (addr handle function) <- get f, next -139 allocate next -140 var _f/eax: (addr function) <- lookup *next -141 var f/esi: (addr function) <- copy _f -142 var name-ah/eax: (addr handle array byte) <- get f, name -143 populate-text-with name-ah, "1+" -144 var args-ah/eax: (addr handle word) <- get f, args -145 allocate args-ah -146 var args/eax: (addr word) <- lookup *args-ah -147 initialize-word-with args, "x" -148 var body-ah/eax: (addr handle line) <- get f, body -149 allocate body-ah -150 var body/eax: (addr line) <- lookup *body-ah -151 initialize-line body -152 var curr-word-ah/ecx: (addr handle word) <- get body, data -153 # *curr-word = "x" -154 allocate curr-word-ah -155 var tmp/eax: (addr word) <- lookup *curr-word-ah -156 curr-word <- copy tmp -157 initialize-word-with curr-word, "x" -158 # *curr-word->next = "1" -159 next-word-ah <- get curr-word, next -160 allocate next-word-ah -161 tmp <- lookup *next-word-ah -162 initialize-word-with tmp, "1" -163 # *curr-word->next->prev = curr-word -164 prev-word-ah <- get tmp, prev -165 copy-object curr-word-ah, prev-word-ah -166 # curr-word = curr-word->next -167 curr-word-ah <- copy next-word-ah -168 curr-word <- copy tmp -169 # *curr-word->next = "+" -170 next-word-ah <- get curr-word, next -171 allocate next-word-ah -172 tmp <- lookup *next-word-ah -173 initialize-word-with tmp, "+" -174 # *curr-word->next->prev = curr-word -175 prev-word-ah <- get tmp, prev -176 copy-object curr-word-ah, prev-word-ah -177 tmp <- lookup *prev-word-ah -178 # x 2+ = x 1+ 1+ -179 var next/esi: (addr handle function) <- get f, next -180 allocate next -181 var _f/eax: (addr function) <- lookup *next -182 var f/esi: (addr function) <- copy _f -183 var name-ah/eax: (addr handle array byte) <- get f, name -184 populate-text-with name-ah, "2+" -185 var args-ah/eax: (addr handle word) <- get f, args -186 allocate args-ah -187 var args/eax: (addr word) <- lookup *args-ah -188 initialize-word-with args, "x" -189 var body-ah/eax: (addr handle line) <- get f, body -190 allocate body-ah -191 var body/eax: (addr line) <- lookup *body-ah -192 initialize-line body -193 var curr-word-ah/ecx: (addr handle word) <- get body, data -194 # *curr-word = "x" -195 allocate curr-word-ah -196 var tmp/eax: (addr word) <- lookup *curr-word-ah -197 curr-word <- copy tmp -198 initialize-word-with curr-word, "x" -199 # *curr-word->next = "1+" -200 next-word-ah <- get curr-word, next -201 allocate next-word-ah -202 tmp <- lookup *next-word-ah -203 initialize-word-with tmp, "1+" -204 # *curr-word->next->prev = curr-word -205 prev-word-ah <- get tmp, prev -206 copy-object curr-word-ah, prev-word-ah -207 # curr-word = curr-word->next -208 curr-word-ah <- copy next-word-ah -209 curr-word <- copy tmp -210 # *curr-word->next = "1+" -211 next-word-ah <- get curr-word, next -212 allocate next-word-ah -213 tmp <- lookup *next-word-ah -214 initialize-word-with tmp, "1+" -215 # *curr-word->next->prev = curr-word -216 prev-word-ah <- get tmp, prev -217 copy-object curr-word-ah, prev-word-ah -218 tmp <- lookup *prev-word-ah -219 # x square = x x * -220 var next/esi: (addr handle function) <- get f, next -221 allocate next -222 var _f/eax: (addr function) <- lookup *next -223 var f/esi: (addr function) <- copy _f -224 var name-ah/eax: (addr handle array byte) <- get f, name -225 populate-text-with name-ah, "square" -226 var args-ah/eax: (addr handle word) <- get f, args -227 allocate args-ah -228 var args/eax: (addr word) <- lookup *args-ah -229 initialize-word-with args, "x" -230 var body-ah/eax: (addr handle line) <- get f, body -231 allocate body-ah -232 var body/eax: (addr line) <- lookup *body-ah -233 initialize-line body -234 var curr-word-ah/ecx: (addr handle word) <- get body, data -235 # *curr-word = "x" -236 allocate curr-word-ah -237 var tmp/eax: (addr word) <- lookup *curr-word-ah -238 var curr-word/edx: (addr word) <- copy tmp -239 initialize-word-with curr-word, "x" -240 # *curr-word->next = "x" -241 var next-word-ah/ebx: (addr handle word) <- get curr-word, next -242 allocate next-word-ah -243 tmp <- lookup *next-word-ah -244 initialize-word-with tmp, "x" -245 # *curr-word->next->prev = curr-word -246 var prev-word-ah/edi: (addr handle word) <- get tmp, prev -247 copy-object curr-word-ah, prev-word-ah -248 # curr-word = curr-word->next -249 curr-word-ah <- copy next-word-ah -250 curr-word <- copy tmp -251 # *curr-word->next = "*" -252 next-word-ah <- get curr-word, next -253 allocate next-word-ah -254 tmp <- lookup *next-word-ah -255 initialize-word-with tmp, "*" -256 # *curr-word->next->prev = curr-word -257 prev-word-ah <- get tmp, prev -258 copy-object curr-word-ah, prev-word-ah -259 tmp <- lookup *prev-word-ah -260 # x 1- = x 1 - -261 var next/esi: (addr handle function) <- get f, next -262 allocate next -263 var _f/eax: (addr function) <- lookup *next -264 var f/esi: (addr function) <- copy _f -265 var name-ah/eax: (addr handle array byte) <- get f, name -266 populate-text-with name-ah, "1-" -267 var args-ah/eax: (addr handle word) <- get f, args -268 allocate args-ah -269 var args/eax: (addr word) <- lookup *args-ah -270 initialize-word-with args, "x" -271 var body-ah/eax: (addr handle line) <- get f, body -272 allocate body-ah -273 var body/eax: (addr line) <- lookup *body-ah -274 initialize-line body -275 var curr-word-ah/ecx: (addr handle word) <- get body, data -276 # *curr-word = "x" -277 allocate curr-word-ah -278 var tmp/eax: (addr word) <- lookup *curr-word-ah -279 curr-word <- copy tmp -280 initialize-word-with curr-word, "x" -281 # *curr-word->next = "1" -282 next-word-ah <- get curr-word, next -283 allocate next-word-ah -284 tmp <- lookup *next-word-ah -285 initialize-word-with tmp, "1" -286 # *curr-word->next->prev = curr-word -287 prev-word-ah <- get tmp, prev -288 copy-object curr-word-ah, prev-word-ah -289 # curr-word = curr-word->next -290 curr-word-ah <- copy next-word-ah -291 curr-word <- copy tmp -292 # *curr-word->next = "-" -293 next-word-ah <- get curr-word, next -294 allocate next-word-ah -295 tmp <- lookup *next-word-ah -296 initialize-word-with tmp, "-" -297 # *curr-word->next->prev = curr-word -298 prev-word-ah <- get tmp, prev -299 copy-object curr-word-ah, prev-word-ah -300 tmp <- lookup *prev-word-ah -301 # x y sub = x y - -302 var next/esi: (addr handle function) <- get f, next -303 allocate next -304 var _f/eax: (addr function) <- lookup *next -305 var f/esi: (addr function) <- copy _f -306 var name-ah/eax: (addr handle array byte) <- get f, name -307 populate-text-with name-ah, "sub" -308 # critical lesson: args are stored in reverse order -309 var args-ah/eax: (addr handle word) <- get f, args -310 allocate args-ah -311 var args/eax: (addr word) <- lookup *args-ah -312 initialize-word-with args, "y" -313 var next-arg-ah/eax: (addr handle word) <- get args, next -314 allocate next-arg-ah -315 var next-arg/eax: (addr word) <- lookup *next-arg-ah -316 initialize-word-with next-arg, "x" -317 var body-ah/eax: (addr handle line) <- get f, body -318 allocate body-ah -319 var body/eax: (addr line) <- lookup *body-ah -320 initialize-line body -321 var curr-word-ah/ecx: (addr handle word) <- get body, data -322 # *curr-word = "x" -323 allocate curr-word-ah -324 var tmp/eax: (addr word) <- lookup *curr-word-ah -325 curr-word <- copy tmp -326 initialize-word-with curr-word, "x" -327 # *curr-word->next = "y" -328 next-word-ah <- get curr-word, next -329 allocate next-word-ah -330 tmp <- lookup *next-word-ah -331 initialize-word-with tmp, "y" -332 # *curr-word->next->prev = curr-word -333 prev-word-ah <- get tmp, prev -334 copy-object curr-word-ah, prev-word-ah -335 # curr-word = curr-word->next -336 curr-word-ah <- copy next-word-ah -337 curr-word <- copy tmp -338 # *curr-word->next = "-" -339 next-word-ah <- get curr-word, next -340 allocate next-word-ah -341 tmp <- lookup *next-word-ah -342 initialize-word-with tmp, "-" -343 # *curr-word->next->prev = curr-word -344 prev-word-ah <- get tmp, prev -345 copy-object curr-word-ah, prev-word-ah -346 tmp <- lookup *prev-word-ah -347 } -348 -349 fn function-body functions: (addr handle function), _word: (addr handle word), out: (addr handle line) { -350 var function-name-storage: (handle array byte) -351 var function-name-ah/ecx: (addr handle array byte) <- address function-name-storage -352 var word-ah/esi: (addr handle word) <- copy _word -353 var word/eax: (addr word) <- lookup *word-ah -354 var gap-ah/eax: (addr handle gap-buffer) <- get word, scalar-data -355 var gap/eax: (addr gap-buffer) <- lookup *gap-ah -356 gap-buffer-to-string gap, function-name-ah -357 var _function-name/eax: (addr array byte) <- lookup *function-name-ah -358 var function-name/esi: (addr array byte) <- copy _function-name -359 var curr-ah/ecx: (addr handle function) <- copy functions -360 $function-body:loop: { -361 var _curr/eax: (addr function) <- lookup *curr-ah -362 var curr/edx: (addr function) <- copy _curr -363 compare curr, 0 -364 break-if-= -365 var curr-name-ah/eax: (addr handle array byte) <- get curr, name -366 var curr-name/eax: (addr array byte) <- lookup *curr-name-ah -367 var found?/eax: boolean <- string-equal? curr-name, function-name -368 compare found?, 0 # false -369 { -370 break-if-= -371 var src/eax: (addr handle line) <- get curr, body -372 copy-object src, out -373 break $function-body:loop -374 } -375 curr-ah <- get curr, next -376 loop -377 } -378 } -379 -380 fn body-length functions: (addr handle function), function-name: (addr handle word) -> _/eax: int { -381 var body-storage: (handle line) -382 var body-ah/edi: (addr handle line) <- address body-storage -383 function-body functions, function-name, body-ah -384 var body/eax: (addr line) <- lookup *body-ah -385 var result/eax: int <- line-length body -386 return result -387 } -388 -389 fn line-length _in: (addr line) -> _/eax: int { -390 var in/esi: (addr line) <- copy _in -391 var curr-ah/ecx: (addr handle word) <- get in, data -392 var result/edi: int <- copy 0 -393 { -394 var curr/eax: (addr word) <- lookup *curr-ah -395 compare curr, 0 -396 break-if-= -397 curr-ah <- get curr, next -398 result <- increment -399 loop -400 } -401 return result -402 } -403 -404 fn populate-text-with _out: (addr handle array byte), _in: (addr array byte) { -405 var in/esi: (addr array byte) <- copy _in -406 var n/ecx: int <- length in -407 var out/edx: (addr handle array byte) <- copy _out -408 populate out, n -409 var _out-addr/eax: (addr array byte) <- lookup *out -410 var out-addr/edx: (addr array byte) <- copy _out-addr -411 var i/eax: int <- copy 0 -412 { -413 compare i, n -414 break-if->= -415 var src/esi: (addr byte) <- index in, i -416 var val/ecx: byte <- copy-byte *src -417 var dest/edi: (addr byte) <- index out-addr, i -418 copy-byte-to *dest, val -419 i <- increment -420 loop -421 } -422 } -423 -424 fn initialize-path-from-sandbox _in: (addr sandbox), _out: (addr handle call-path-element) { -425 var sandbox/esi: (addr sandbox) <- copy _in -426 var line-ah/eax: (addr handle line) <- get sandbox, data -427 var line/eax: (addr line) <- lookup *line-ah -428 var src/esi: (addr handle word) <- get line, data -429 var out-ah/edi: (addr handle call-path-element) <- copy _out -430 var out/eax: (addr call-path-element) <- lookup *out-ah -431 var dest/edi: (addr handle word) <- get out, word -432 copy-object src, dest -433 } -434 -435 fn initialize-path-from-line _line: (addr line), _out: (addr handle call-path-element) { -436 var line/eax: (addr line) <- copy _line -437 var src/esi: (addr handle word) <- get line, data -438 var out-ah/edi: (addr handle call-path-element) <- copy _out -439 var out/eax: (addr call-path-element) <- lookup *out-ah -440 var dest/edi: (addr handle word) <- get out, word -441 copy-object src, dest -442 } -443 -444 fn find-in-call-paths call-paths: (addr handle call-path), needle: (addr handle call-path-element) -> _/eax: boolean { -445 var curr-ah/esi: (addr handle call-path) <- copy call-paths -446 $find-in-call-path:loop: { -447 var curr/eax: (addr call-path) <- lookup *curr-ah -448 compare curr, 0 -449 break-if-= -450 { -451 var curr-data/eax: (addr handle call-path-element) <- get curr, data -452 var match?/eax: boolean <- call-path-element-match? curr-data, needle -453 compare match?, 0 # false -454 { -455 break-if-= -456 return 1 # true -457 } -458 } -459 curr-ah <- get curr, next -460 loop -461 } -462 return 0 # false -463 } -464 -465 fn call-path-element-match? _x: (addr handle call-path-element), _y: (addr handle call-path-element) -> _/eax: boolean { -466 var x-ah/eax: (addr handle call-path-element) <- copy _x -467 var x-a/eax: (addr call-path-element) <- lookup *x-ah -468 var x/esi: (addr call-path-element) <- copy x-a -469 var y-ah/eax: (addr handle call-path-element) <- copy _y -470 var y-a/eax: (addr call-path-element) <- lookup *y-ah -471 var y/edi: (addr call-path-element) <- copy y-a -472 compare x, y -473 { -474 break-if-!= -475 return 1 # true -476 } -477 compare x, 0 -478 { -479 break-if-!= -480 return 0 # false -481 } -482 compare y, 0 -483 { -484 break-if-!= -485 return 0 # false -486 } -487 # compare word addresses, not contents -488 var x-data-ah/ecx: (addr handle word) <- get x, word -489 var x-data-a/eax: (addr word) <- lookup *x-data-ah -490 var x-data/ecx: int <- copy x-data-a -491 var y-data-ah/eax: (addr handle word) <- get y, word -492 var y-data-a/eax: (addr word) <- lookup *y-data-ah -493 var y-data/eax: int <- copy y-data-a -494 #? print-string 0, "match? " -495 #? print-int32-hex 0, x-data -496 #? print-string 0, " vs " -497 #? print-int32-hex 0, y-data -498 #? print-string 0, "\n" -499 compare x-data, y-data -500 { -501 break-if-= -502 return 0 # false -503 } -504 var x-next/ecx: (addr handle call-path-element) <- get x, next -505 var y-next/eax: (addr handle call-path-element) <- get y, next -506 var result/eax: boolean <- call-path-element-match? x-next, y-next -507 return result -508 } -509 -510 # order is irrelevant -511 fn insert-in-call-path list: (addr handle call-path), new: (addr handle call-path-element) { -512 var new-path-storage: (handle call-path) -513 var new-path-ah/edi: (addr handle call-path) <- address new-path-storage -514 allocate new-path-ah -515 var new-path/eax: (addr call-path) <- lookup *new-path-ah -516 var next/ecx: (addr handle call-path) <- get new-path, next -517 copy-object list, next -518 var dest/ecx: (addr handle call-path-element) <- get new-path, data -519 deep-copy-call-path-element new, dest -520 copy-object new-path-ah, list -521 } -522 -523 # assumes dest is initially clear -524 fn deep-copy-call-path-element _src: (addr handle call-path-element), _dest: (addr handle call-path-element) { -525 var src/esi: (addr handle call-path-element) <- copy _src -526 # if src is null, return -527 var _src-addr/eax: (addr call-path-element) <- lookup *src -528 compare _src-addr, 0 -529 break-if-= -530 # allocate -531 var src-addr/esi: (addr call-path-element) <- copy _src-addr -532 var dest/eax: (addr handle call-path-element) <- copy _dest -533 allocate dest -534 # copy data -535 var dest-addr/eax: (addr call-path-element) <- lookup *dest -536 { -537 var dest-data-addr/ecx: (addr handle word) <- get dest-addr, word -538 var src-data-addr/eax: (addr handle word) <- get src-addr, word -539 copy-object src-data-addr, dest-data-addr -540 } -541 # recurse -542 var src-next/esi: (addr handle call-path-element) <- get src-addr, next -543 var dest-next/eax: (addr handle call-path-element) <- get dest-addr, next -544 deep-copy-call-path-element src-next, dest-next -545 } -546 -547 fn delete-in-call-path list: (addr handle call-path), needle: (addr handle call-path-element) { -548 var curr-ah/esi: (addr handle call-path) <- copy list -549 $delete-in-call-path:loop: { -550 var _curr/eax: (addr call-path) <- lookup *curr-ah -551 var curr/ecx: (addr call-path) <- copy _curr -552 compare curr, 0 -553 break-if-= -554 { -555 var curr-data/eax: (addr handle call-path-element) <- get curr, data -556 var match?/eax: boolean <- call-path-element-match? curr-data, needle -557 compare match?, 0 # false -558 { -559 break-if-= -560 var next-ah/ecx: (addr handle call-path) <- get curr, next -561 copy-object next-ah, curr-ah -562 loop $delete-in-call-path:loop -563 } -564 } -565 curr-ah <- get curr, next -566 loop -567 } -568 } -569 -570 fn increment-final-element list: (addr handle call-path-element) { -571 var final-ah/eax: (addr handle call-path-element) <- copy list -572 var final/eax: (addr call-path-element) <- lookup *final-ah -573 var val-ah/ecx: (addr handle word) <- get final, word -574 var val/eax: (addr word) <- lookup *val-ah -575 var new-ah/edx: (addr handle word) <- get val, next -576 var target/eax: (addr word) <- lookup *new-ah -577 compare target, 0 -578 break-if-= -579 copy-object new-ah, val-ah -580 } -581 -582 fn decrement-final-element list: (addr handle call-path-element) { -583 var final-ah/eax: (addr handle call-path-element) <- copy list -584 var final/eax: (addr call-path-element) <- lookup *final-ah -585 var val-ah/ecx: (addr handle word) <- get final, word -586 var val/eax: (addr word) <- lookup *val-ah -587 #? print-string 0, "replacing " -588 #? { -589 #? var foo/eax: int <- copy val -590 #? print-int32-hex 0, foo -591 #? } -592 var new-ah/edx: (addr handle word) <- get val, prev -593 var target/eax: (addr word) <- lookup *new-ah -594 compare target, 0 -595 break-if-= -596 # val = val->prev -597 #? print-string 0, " with " -598 #? { -599 #? var foo/eax: int <- copy target -600 #? print-int32-hex 0, foo -601 #? } -602 #? print-string 0, "\n" -603 copy-object new-ah, val-ah -604 } -605 -606 fn move-final-element-to-start-of-line list: (addr handle call-path-element) { -607 var final-ah/eax: (addr handle call-path-element) <- copy list -608 var final/eax: (addr call-path-element) <- lookup *final-ah -609 var val-ah/ecx: (addr handle word) <- get final, word -610 var val/eax: (addr word) <- lookup *val-ah -611 var new-ah/edx: (addr handle word) <- get val, prev -612 var target/eax: (addr word) <- lookup *new-ah -613 compare target, 0 -614 break-if-= -615 copy-object new-ah, val-ah -616 move-final-element-to-start-of-line list -617 } -618 -619 fn push-to-call-path-element list: (addr handle call-path-element), new: (addr handle word) { -620 var new-element-storage: (handle call-path-element) -621 var new-element-ah/edi: (addr handle call-path-element) <- address new-element-storage -622 allocate new-element-ah -623 var new-element/eax: (addr call-path-element) <- lookup *new-element-ah -624 # save word -625 var dest/ecx: (addr handle word) <- get new-element, word -626 copy-object new, dest -627 # save next -628 var dest2/ecx: (addr handle call-path-element) <- get new-element, next -629 copy-object list, dest2 -630 # return -631 copy-object new-element-ah, list -632 } -633 -634 fn drop-from-call-path-element _list: (addr handle call-path-element) { -635 var list-ah/esi: (addr handle call-path-element) <- copy _list -636 var list/eax: (addr call-path-element) <- lookup *list-ah -637 var next/eax: (addr handle call-path-element) <- get list, next -638 copy-object next, _list -639 } -640 -641 fn drop-nested-calls _list: (addr handle call-path-element) { -642 var list-ah/esi: (addr handle call-path-element) <- copy _list -643 var list/eax: (addr call-path-element) <- lookup *list-ah -644 var next-ah/edi: (addr handle call-path-element) <- get list, next -645 var next/eax: (addr call-path-element) <- lookup *next-ah -646 compare next, 0 -647 break-if-= -648 copy-object next-ah, _list -649 drop-nested-calls _list -650 } -651 -652 fn dump-call-path-element screen: (addr screen), _x-ah: (addr handle call-path-element) { -653 var x-ah/ecx: (addr handle call-path-element) <- copy _x-ah -654 var _x/eax: (addr call-path-element) <- lookup *x-ah -655 var x/esi: (addr call-path-element) <- copy _x -656 var word-ah/eax: (addr handle word) <- get x, word -657 var word/eax: (addr word) <- lookup *word-ah -658 print-word screen, word -659 var next-ah/ecx: (addr handle call-path-element) <- get x, next -660 var next/eax: (addr call-path-element) <- lookup *next-ah -661 compare next, 0 -662 { -663 break-if-= -664 print-string screen, " " -665 dump-call-path-element screen, next-ah -666 return -667 } -668 print-string screen, "\n" -669 } -670 -671 fn dump-call-paths screen: (addr screen), _x-ah: (addr handle call-path) { -672 var x-ah/ecx: (addr handle call-path) <- copy _x-ah -673 var x/eax: (addr call-path) <- lookup *x-ah -674 compare x, 0 -675 break-if-= -676 var src/ecx: (addr handle call-path-element) <- get x, data -677 dump-call-path-element screen, src -678 var next-ah/ecx: (addr handle call-path) <- get x, next -679 var next/eax: (addr call-path) <- lookup *next-ah -680 compare next, 0 -681 { -682 break-if-= -683 dump-call-paths screen, next-ah -684 } -685 } + 36 # todo: turn this into a sum type + 37 type value { + 38 type: int + 39 int-data: int # if type = 0 + 40 text-data: (handle array byte) # if type = 1 + 41 array-data: (handle array value) # if type = 2 + 42 file-data: (handle buffered-file) # if type = 3 + 43 filename: (handle array byte) # if type = 3 + 44 screen-data: (handle screen) # if type = 4 + 45 } + 46 + 47 type table { + 48 data: (handle array bind) + 49 next: (handle table) + 50 } + 51 + 52 type bind { + 53 key: (handle array byte) + 54 value: (handle value) # I'd inline this but we sometimes want to return a specific value from a table + 55 } + 56 + 57 # A call-path is a data structure that can unambiguously refer to any specific + 58 # call arbitrarily deep inside the call hierarchy of a program. + 59 type call-path { + 60 data: (handle call-path-element) + 61 next: (handle call-path) + 62 } + 63 + 64 # A call-path element is a list of elements, each of which corresponds to some call. + 65 type call-path-element { + 66 word: (handle word) + 67 next: (handle call-path-element) + 68 } + 69 + 70 type result { + 71 data: value-stack + 72 error: (handle array byte) # single error message for now + 73 } + 74 + 75 fn initialize-sandbox _sandbox: (addr sandbox) { + 76 var sandbox/esi: (addr sandbox) <- copy _sandbox + 77 var line-ah/eax: (addr handle line) <- get sandbox, data + 78 allocate line-ah + 79 var line/eax: (addr line) <- lookup *line-ah + 80 initialize-line line + 81 var word-ah/ecx: (addr handle word) <- get line, data + 82 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 83 allocate cursor-call-path-ah + 84 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 85 var dest/eax: (addr handle word) <- get cursor-call-path, word + 86 copy-object word-ah, dest + 87 } + 88 + 89 # initialize line with a single empty word + 90 fn initialize-line _line: (addr line) { + 91 var line/esi: (addr line) <- copy _line + 92 var word-ah/eax: (addr handle word) <- get line, data + 93 allocate word-ah + 94 var word/eax: (addr word) <- lookup *word-ah + 95 initialize-word word + 96 } + 97 + 98 fn create-primitive-functions _self: (addr handle function) { + 99 # x 2* = x 2 * +100 var self/esi: (addr handle function) <- copy _self +101 allocate self +102 var _f/eax: (addr function) <- lookup *self +103 var f/esi: (addr function) <- copy _f +104 var name-ah/eax: (addr handle array byte) <- get f, name +105 populate-text-with name-ah, "2*" +106 var args-ah/eax: (addr handle word) <- get f, args +107 allocate args-ah +108 var args/eax: (addr word) <- lookup *args-ah +109 initialize-word-with args, "x" +110 var body-ah/eax: (addr handle line) <- get f, body +111 allocate body-ah +112 var body/eax: (addr line) <- lookup *body-ah +113 initialize-line body +114 var curr-word-ah/ecx: (addr handle word) <- get body, data +115 # *curr-word = "x" +116 allocate curr-word-ah +117 var tmp/eax: (addr word) <- lookup *curr-word-ah +118 var curr-word/edx: (addr word) <- copy tmp +119 initialize-word-with curr-word, "x" +120 # *curr-word->next = "2" +121 var next-word-ah/ebx: (addr handle word) <- get curr-word, next +122 allocate next-word-ah +123 tmp <- lookup *next-word-ah +124 initialize-word-with tmp, "2" +125 # *curr-word->next->prev = curr-word +126 var prev-word-ah/edi: (addr handle word) <- get tmp, prev +127 copy-object curr-word-ah, prev-word-ah +128 # curr-word = curr-word->next +129 curr-word-ah <- copy next-word-ah +130 curr-word <- copy tmp +131 # *curr-word->next = "*" +132 next-word-ah <- get curr-word, next +133 allocate next-word-ah +134 tmp <- lookup *next-word-ah +135 initialize-word-with tmp, "*" +136 # *curr-word->next->prev = curr-word +137 prev-word-ah <- get tmp, prev +138 copy-object curr-word-ah, prev-word-ah +139 tmp <- lookup *prev-word-ah +140 # x 1+ = x 1 + +141 var next/esi: (addr handle function) <- get f, next +142 allocate next +143 var _f/eax: (addr function) <- lookup *next +144 var f/esi: (addr function) <- copy _f +145 var name-ah/eax: (addr handle array byte) <- get f, name +146 populate-text-with name-ah, "1+" +147 var args-ah/eax: (addr handle word) <- get f, args +148 allocate args-ah +149 var args/eax: (addr word) <- lookup *args-ah +150 initialize-word-with args, "x" +151 var body-ah/eax: (addr handle line) <- get f, body +152 allocate body-ah +153 var body/eax: (addr line) <- lookup *body-ah +154 initialize-line body +155 var curr-word-ah/ecx: (addr handle word) <- get body, data +156 # *curr-word = "x" +157 allocate curr-word-ah +158 var tmp/eax: (addr word) <- lookup *curr-word-ah +159 curr-word <- copy tmp +160 initialize-word-with curr-word, "x" +161 # *curr-word->next = "1" +162 next-word-ah <- get curr-word, next +163 allocate next-word-ah +164 tmp <- lookup *next-word-ah +165 initialize-word-with tmp, "1" +166 # *curr-word->next->prev = curr-word +167 prev-word-ah <- get tmp, prev +168 copy-object curr-word-ah, prev-word-ah +169 # curr-word = curr-word->next +170 curr-word-ah <- copy next-word-ah +171 curr-word <- copy tmp +172 # *curr-word->next = "+" +173 next-word-ah <- get curr-word, next +174 allocate next-word-ah +175 tmp <- lookup *next-word-ah +176 initialize-word-with tmp, "+" +177 # *curr-word->next->prev = curr-word +178 prev-word-ah <- get tmp, prev +179 copy-object curr-word-ah, prev-word-ah +180 tmp <- lookup *prev-word-ah +181 # x 2+ = x 1+ 1+ +182 var next/esi: (addr handle function) <- get f, next +183 allocate next +184 var _f/eax: (addr function) <- lookup *next +185 var f/esi: (addr function) <- copy _f +186 var name-ah/eax: (addr handle array byte) <- get f, name +187 populate-text-with name-ah, "2+" +188 var args-ah/eax: (addr handle word) <- get f, args +189 allocate args-ah +190 var args/eax: (addr word) <- lookup *args-ah +191 initialize-word-with args, "x" +192 var body-ah/eax: (addr handle line) <- get f, body +193 allocate body-ah +194 var body/eax: (addr line) <- lookup *body-ah +195 initialize-line body +196 var curr-word-ah/ecx: (addr handle word) <- get body, data +197 # *curr-word = "x" +198 allocate curr-word-ah +199 var tmp/eax: (addr word) <- lookup *curr-word-ah +200 curr-word <- copy tmp +201 initialize-word-with curr-word, "x" +202 # *curr-word->next = "1+" +203 next-word-ah <- get curr-word, next +204 allocate next-word-ah +205 tmp <- lookup *next-word-ah +206 initialize-word-with tmp, "1+" +207 # *curr-word->next->prev = curr-word +208 prev-word-ah <- get tmp, prev +209 copy-object curr-word-ah, prev-word-ah +210 # curr-word = curr-word->next +211 curr-word-ah <- copy next-word-ah +212 curr-word <- copy tmp +213 # *curr-word->next = "1+" +214 next-word-ah <- get curr-word, next +215 allocate next-word-ah +216 tmp <- lookup *next-word-ah +217 initialize-word-with tmp, "1+" +218 # *curr-word->next->prev = curr-word +219 prev-word-ah <- get tmp, prev +220 copy-object curr-word-ah, prev-word-ah +221 tmp <- lookup *prev-word-ah +222 # x square = x x * +223 var next/esi: (addr handle function) <- get f, next +224 allocate next +225 var _f/eax: (addr function) <- lookup *next +226 var f/esi: (addr function) <- copy _f +227 var name-ah/eax: (addr handle array byte) <- get f, name +228 populate-text-with name-ah, "square" +229 var args-ah/eax: (addr handle word) <- get f, args +230 allocate args-ah +231 var args/eax: (addr word) <- lookup *args-ah +232 initialize-word-with args, "x" +233 var body-ah/eax: (addr handle line) <- get f, body +234 allocate body-ah +235 var body/eax: (addr line) <- lookup *body-ah +236 initialize-line body +237 var curr-word-ah/ecx: (addr handle word) <- get body, data +238 # *curr-word = "x" +239 allocate curr-word-ah +240 var tmp/eax: (addr word) <- lookup *curr-word-ah +241 var curr-word/edx: (addr word) <- copy tmp +242 initialize-word-with curr-word, "x" +243 # *curr-word->next = "x" +244 var next-word-ah/ebx: (addr handle word) <- get curr-word, next +245 allocate next-word-ah +246 tmp <- lookup *next-word-ah +247 initialize-word-with tmp, "x" +248 # *curr-word->next->prev = curr-word +249 var prev-word-ah/edi: (addr handle word) <- get tmp, prev +250 copy-object curr-word-ah, prev-word-ah +251 # curr-word = curr-word->next +252 curr-word-ah <- copy next-word-ah +253 curr-word <- copy tmp +254 # *curr-word->next = "*" +255 next-word-ah <- get curr-word, next +256 allocate next-word-ah +257 tmp <- lookup *next-word-ah +258 initialize-word-with tmp, "*" +259 # *curr-word->next->prev = curr-word +260 prev-word-ah <- get tmp, prev +261 copy-object curr-word-ah, prev-word-ah +262 tmp <- lookup *prev-word-ah +263 # x 1- = x 1 - +264 var next/esi: (addr handle function) <- get f, next +265 allocate next +266 var _f/eax: (addr function) <- lookup *next +267 var f/esi: (addr function) <- copy _f +268 var name-ah/eax: (addr handle array byte) <- get f, name +269 populate-text-with name-ah, "1-" +270 var args-ah/eax: (addr handle word) <- get f, args +271 allocate args-ah +272 var args/eax: (addr word) <- lookup *args-ah +273 initialize-word-with args, "x" +274 var body-ah/eax: (addr handle line) <- get f, body +275 allocate body-ah +276 var body/eax: (addr line) <- lookup *body-ah +277 initialize-line body +278 var curr-word-ah/ecx: (addr handle word) <- get body, data +279 # *curr-word = "x" +280 allocate curr-word-ah +281 var tmp/eax: (addr word) <- lookup *curr-word-ah +282 curr-word <- copy tmp +283 initialize-word-with curr-word, "x" +284 # *curr-word->next = "1" +285 next-word-ah <- get curr-word, next +286 allocate next-word-ah +287 tmp <- lookup *next-word-ah +288 initialize-word-with tmp, "1" +289 # *curr-word->next->prev = curr-word +290 prev-word-ah <- get tmp, prev +291 copy-object curr-word-ah, prev-word-ah +292 # curr-word = curr-word->next +293 curr-word-ah <- copy next-word-ah +294 curr-word <- copy tmp +295 # *curr-word->next = "-" +296 next-word-ah <- get curr-word, next +297 allocate next-word-ah +298 tmp <- lookup *next-word-ah +299 initialize-word-with tmp, "-" +300 # *curr-word->next->prev = curr-word +301 prev-word-ah <- get tmp, prev +302 copy-object curr-word-ah, prev-word-ah +303 tmp <- lookup *prev-word-ah +304 # x y sub = x y - +305 var next/esi: (addr handle function) <- get f, next +306 allocate next +307 var _f/eax: (addr function) <- lookup *next +308 var f/esi: (addr function) <- copy _f +309 var name-ah/eax: (addr handle array byte) <- get f, name +310 populate-text-with name-ah, "sub" +311 # critical lesson: args are stored in reverse order +312 var args-ah/eax: (addr handle word) <- get f, args +313 allocate args-ah +314 var args/eax: (addr word) <- lookup *args-ah +315 initialize-word-with args, "y" +316 var next-arg-ah/eax: (addr handle word) <- get args, next +317 allocate next-arg-ah +318 var next-arg/eax: (addr word) <- lookup *next-arg-ah +319 initialize-word-with next-arg, "x" +320 var body-ah/eax: (addr handle line) <- get f, body +321 allocate body-ah +322 var body/eax: (addr line) <- lookup *body-ah +323 initialize-line body +324 var curr-word-ah/ecx: (addr handle word) <- get body, data +325 # *curr-word = "x" +326 allocate curr-word-ah +327 var tmp/eax: (addr word) <- lookup *curr-word-ah +328 curr-word <- copy tmp +329 initialize-word-with curr-word, "x" +330 # *curr-word->next = "y" +331 next-word-ah <- get curr-word, next +332 allocate next-word-ah +333 tmp <- lookup *next-word-ah +334 initialize-word-with tmp, "y" +335 # *curr-word->next->prev = curr-word +336 prev-word-ah <- get tmp, prev +337 copy-object curr-word-ah, prev-word-ah +338 # curr-word = curr-word->next +339 curr-word-ah <- copy next-word-ah +340 curr-word <- copy tmp +341 # *curr-word->next = "-" +342 next-word-ah <- get curr-word, next +343 allocate next-word-ah +344 tmp <- lookup *next-word-ah +345 initialize-word-with tmp, "-" +346 # *curr-word->next->prev = curr-word +347 prev-word-ah <- get tmp, prev +348 copy-object curr-word-ah, prev-word-ah +349 tmp <- lookup *prev-word-ah +350 } +351 +352 fn function-body functions: (addr handle function), _word: (addr handle word), out: (addr handle line) { +353 var function-name-storage: (handle array byte) +354 var function-name-ah/ecx: (addr handle array byte) <- address function-name-storage +355 var word-ah/esi: (addr handle word) <- copy _word +356 var word/eax: (addr word) <- lookup *word-ah +357 var gap-ah/eax: (addr handle gap-buffer) <- get word, scalar-data +358 var gap/eax: (addr gap-buffer) <- lookup *gap-ah +359 gap-buffer-to-string gap, function-name-ah +360 var _function-name/eax: (addr array byte) <- lookup *function-name-ah +361 var function-name/esi: (addr array byte) <- copy _function-name +362 var curr-ah/ecx: (addr handle function) <- copy functions +363 $function-body:loop: { +364 var _curr/eax: (addr function) <- lookup *curr-ah +365 var curr/edx: (addr function) <- copy _curr +366 compare curr, 0 +367 break-if-= +368 var curr-name-ah/eax: (addr handle array byte) <- get curr, name +369 var curr-name/eax: (addr array byte) <- lookup *curr-name-ah +370 var found?/eax: boolean <- string-equal? curr-name, function-name +371 compare found?, 0 # false +372 { +373 break-if-= +374 var src/eax: (addr handle line) <- get curr, body +375 copy-object src, out +376 break $function-body:loop +377 } +378 curr-ah <- get curr, next +379 loop +380 } +381 } +382 +383 fn body-length functions: (addr handle function), function-name: (addr handle word) -> _/eax: int { +384 var body-storage: (handle line) +385 var body-ah/edi: (addr handle line) <- address body-storage +386 function-body functions, function-name, body-ah +387 var body/eax: (addr line) <- lookup *body-ah +388 var result/eax: int <- line-length body +389 return result +390 } +391 +392 fn line-length _in: (addr line) -> _/eax: int { +393 var in/esi: (addr line) <- copy _in +394 var curr-ah/ecx: (addr handle word) <- get in, data +395 var result/edi: int <- copy 0 +396 { +397 var curr/eax: (addr word) <- lookup *curr-ah +398 compare curr, 0 +399 break-if-= +400 curr-ah <- get curr, next +401 result <- increment +402 loop +403 } +404 return result +405 } +406 +407 fn populate-text-with _out: (addr handle array byte), _in: (addr array byte) { +408 var in/esi: (addr array byte) <- copy _in +409 var n/ecx: int <- length in +410 var out/edx: (addr handle array byte) <- copy _out +411 populate out, n +412 var _out-addr/eax: (addr array byte) <- lookup *out +413 var out-addr/edx: (addr array byte) <- copy _out-addr +414 var i/eax: int <- copy 0 +415 { +416 compare i, n +417 break-if->= +418 var src/esi: (addr byte) <- index in, i +419 var val/ecx: byte <- copy-byte *src +420 var dest/edi: (addr byte) <- index out-addr, i +421 copy-byte-to *dest, val +422 i <- increment +423 loop +424 } +425 } +426 +427 fn initialize-path-from-sandbox _in: (addr sandbox), _out: (addr handle call-path-element) { +428 var sandbox/esi: (addr sandbox) <- copy _in +429 var line-ah/eax: (addr handle line) <- get sandbox, data +430 var line/eax: (addr line) <- lookup *line-ah +431 var src/esi: (addr handle word) <- get line, data +432 var out-ah/edi: (addr handle call-path-element) <- copy _out +433 var out/eax: (addr call-path-element) <- lookup *out-ah +434 var dest/edi: (addr handle word) <- get out, word +435 copy-object src, dest +436 } +437 +438 fn initialize-path-from-line _line: (addr line), _out: (addr handle call-path-element) { +439 var line/eax: (addr line) <- copy _line +440 var src/esi: (addr handle word) <- get line, data +441 var out-ah/edi: (addr handle call-path-element) <- copy _out +442 var out/eax: (addr call-path-element) <- lookup *out-ah +443 var dest/edi: (addr handle word) <- get out, word +444 copy-object src, dest +445 } +446 +447 fn find-in-call-paths call-paths: (addr handle call-path), needle: (addr handle call-path-element) -> _/eax: boolean { +448 var curr-ah/esi: (addr handle call-path) <- copy call-paths +449 $find-in-call-path:loop: { +450 var curr/eax: (addr call-path) <- lookup *curr-ah +451 compare curr, 0 +452 break-if-= +453 { +454 var curr-data/eax: (addr handle call-path-element) <- get curr, data +455 var match?/eax: boolean <- call-path-element-match? curr-data, needle +456 compare match?, 0 # false +457 { +458 break-if-= +459 return 1 # true +460 } +461 } +462 curr-ah <- get curr, next +463 loop +464 } +465 return 0 # false +466 } +467 +468 fn call-path-element-match? _x: (addr handle call-path-element), _y: (addr handle call-path-element) -> _/eax: boolean { +469 var x-ah/eax: (addr handle call-path-element) <- copy _x +470 var x-a/eax: (addr call-path-element) <- lookup *x-ah +471 var x/esi: (addr call-path-element) <- copy x-a +472 var y-ah/eax: (addr handle call-path-element) <- copy _y +473 var y-a/eax: (addr call-path-element) <- lookup *y-ah +474 var y/edi: (addr call-path-element) <- copy y-a +475 compare x, y +476 { +477 break-if-!= +478 return 1 # true +479 } +480 compare x, 0 +481 { +482 break-if-!= +483 return 0 # false +484 } +485 compare y, 0 +486 { +487 break-if-!= +488 return 0 # false +489 } +490 # compare word addresses, not contents +491 var x-data-ah/ecx: (addr handle word) <- get x, word +492 var x-data-a/eax: (addr word) <- lookup *x-data-ah +493 var x-data/ecx: int <- copy x-data-a +494 var y-data-ah/eax: (addr handle word) <- get y, word +495 var y-data-a/eax: (addr word) <- lookup *y-data-ah +496 var y-data/eax: int <- copy y-data-a +497 #? print-string 0, "match? " +498 #? print-int32-hex 0, x-data +499 #? print-string 0, " vs " +500 #? print-int32-hex 0, y-data +501 #? print-string 0, "\n" +502 compare x-data, y-data +503 { +504 break-if-= +505 return 0 # false +506 } +507 var x-next/ecx: (addr handle call-path-element) <- get x, next +508 var y-next/eax: (addr handle call-path-element) <- get y, next +509 var result/eax: boolean <- call-path-element-match? x-next, y-next +510 return result +511 } +512 +513 # order is irrelevant +514 fn insert-in-call-path list: (addr handle call-path), new: (addr handle call-path-element) { +515 var new-path-storage: (handle call-path) +516 var new-path-ah/edi: (addr handle call-path) <- address new-path-storage +517 allocate new-path-ah +518 var new-path/eax: (addr call-path) <- lookup *new-path-ah +519 var next/ecx: (addr handle call-path) <- get new-path, next +520 copy-object list, next +521 var dest/ecx: (addr handle call-path-element) <- get new-path, data +522 deep-copy-call-path-element new, dest +523 copy-object new-path-ah, list +524 } +525 +526 # assumes dest is initially clear +527 fn deep-copy-call-path-element _src: (addr handle call-path-element), _dest: (addr handle call-path-element) { +528 var src/esi: (addr handle call-path-element) <- copy _src +529 # if src is null, return +530 var _src-addr/eax: (addr call-path-element) <- lookup *src +531 compare _src-addr, 0 +532 break-if-= +533 # allocate +534 var src-addr/esi: (addr call-path-element) <- copy _src-addr +535 var dest/eax: (addr handle call-path-element) <- copy _dest +536 allocate dest +537 # copy data +538 var dest-addr/eax: (addr call-path-element) <- lookup *dest +539 { +540 var dest-data-addr/ecx: (addr handle word) <- get dest-addr, word +541 var src-data-addr/eax: (addr handle word) <- get src-addr, word +542 copy-object src-data-addr, dest-data-addr +543 } +544 # recurse +545 var src-next/esi: (addr handle call-path-element) <- get src-addr, next +546 var dest-next/eax: (addr handle call-path-element) <- get dest-addr, next +547 deep-copy-call-path-element src-next, dest-next +548 } +549 +550 fn delete-in-call-path list: (addr handle call-path), needle: (addr handle call-path-element) { +551 var curr-ah/esi: (addr handle call-path) <- copy list +552 $delete-in-call-path:loop: { +553 var _curr/eax: (addr call-path) <- lookup *curr-ah +554 var curr/ecx: (addr call-path) <- copy _curr +555 compare curr, 0 +556 break-if-= +557 { +558 var curr-data/eax: (addr handle call-path-element) <- get curr, data +559 var match?/eax: boolean <- call-path-element-match? curr-data, needle +560 compare match?, 0 # false +561 { +562 break-if-= +563 var next-ah/ecx: (addr handle call-path) <- get curr, next +564 copy-object next-ah, curr-ah +565 loop $delete-in-call-path:loop +566 } +567 } +568 curr-ah <- get curr, next +569 loop +570 } +571 } +572 +573 fn increment-final-element list: (addr handle call-path-element) { +574 var final-ah/eax: (addr handle call-path-element) <- copy list +575 var final/eax: (addr call-path-element) <- lookup *final-ah +576 var val-ah/ecx: (addr handle word) <- get final, word +577 var val/eax: (addr word) <- lookup *val-ah +578 var new-ah/edx: (addr handle word) <- get val, next +579 var target/eax: (addr word) <- lookup *new-ah +580 compare target, 0 +581 break-if-= +582 copy-object new-ah, val-ah +583 } +584 +585 fn decrement-final-element list: (addr handle call-path-element) { +586 var final-ah/eax: (addr handle call-path-element) <- copy list +587 var final/eax: (addr call-path-element) <- lookup *final-ah +588 var val-ah/ecx: (addr handle word) <- get final, word +589 var val/eax: (addr word) <- lookup *val-ah +590 #? print-string 0, "replacing " +591 #? { +592 #? var foo/eax: int <- copy val +593 #? print-int32-hex 0, foo +594 #? } +595 var new-ah/edx: (addr handle word) <- get val, prev +596 var target/eax: (addr word) <- lookup *new-ah +597 compare target, 0 +598 break-if-= +599 # val = val->prev +600 #? print-string 0, " with " +601 #? { +602 #? var foo/eax: int <- copy target +603 #? print-int32-hex 0, foo +604 #? } +605 #? print-string 0, "\n" +606 copy-object new-ah, val-ah +607 } +608 +609 fn move-final-element-to-start-of-line list: (addr handle call-path-element) { +610 var final-ah/eax: (addr handle call-path-element) <- copy list +611 var final/eax: (addr call-path-element) <- lookup *final-ah +612 var val-ah/ecx: (addr handle word) <- get final, word +613 var val/eax: (addr word) <- lookup *val-ah +614 var new-ah/edx: (addr handle word) <- get val, prev +615 var target/eax: (addr word) <- lookup *new-ah +616 compare target, 0 +617 break-if-= +618 copy-object new-ah, val-ah +619 move-final-element-to-start-of-line list +620 } +621 +622 fn push-to-call-path-element list: (addr handle call-path-element), new: (addr handle word) { +623 var new-element-storage: (handle call-path-element) +624 var new-element-ah/edi: (addr handle call-path-element) <- address new-element-storage +625 allocate new-element-ah +626 var new-element/eax: (addr call-path-element) <- lookup *new-element-ah +627 # save word +628 var dest/ecx: (addr handle word) <- get new-element, word +629 copy-object new, dest +630 # save next +631 var dest2/ecx: (addr handle call-path-element) <- get new-element, next +632 copy-object list, dest2 +633 # return +634 copy-object new-element-ah, list +635 } +636 +637 fn drop-from-call-path-element _list: (addr handle call-path-element) { +638 var list-ah/esi: (addr handle call-path-element) <- copy _list +639 var list/eax: (addr call-path-element) <- lookup *list-ah +640 var next/eax: (addr handle call-path-element) <- get list, next +641 copy-object next, _list +642 } +643 +644 fn drop-nested-calls _list: (addr handle call-path-element) { +645 var list-ah/esi: (addr handle call-path-element) <- copy _list +646 var list/eax: (addr call-path-element) <- lookup *list-ah +647 var next-ah/edi: (addr handle call-path-element) <- get list, next +648 var next/eax: (addr call-path-element) <- lookup *next-ah +649 compare next, 0 +650 break-if-= +651 copy-object next-ah, _list +652 drop-nested-calls _list +653 } +654 +655 fn dump-call-path-element screen: (addr screen), _x-ah: (addr handle call-path-element) { +656 var x-ah/ecx: (addr handle call-path-element) <- copy _x-ah +657 var _x/eax: (addr call-path-element) <- lookup *x-ah +658 var x/esi: (addr call-path-element) <- copy _x +659 var word-ah/eax: (addr handle word) <- get x, word +660 var word/eax: (addr word) <- lookup *word-ah +661 print-word screen, word +662 var next-ah/ecx: (addr handle call-path-element) <- get x, next +663 var next/eax: (addr call-path-element) <- lookup *next-ah +664 compare next, 0 +665 { +666 break-if-= +667 print-string screen, " " +668 dump-call-path-element screen, next-ah +669 return +670 } +671 print-string screen, "\n" +672 } +673 +674 fn dump-call-paths screen: (addr screen), _x-ah: (addr handle call-path) { +675 var x-ah/ecx: (addr handle call-path) <- copy _x-ah +676 var x/eax: (addr call-path) <- lookup *x-ah +677 compare x, 0 +678 break-if-= +679 var src/ecx: (addr handle call-path-element) <- get x, data +680 dump-call-path-element screen, src +681 var next-ah/ecx: (addr handle call-path) <- get x, next +682 var next/eax: (addr call-path) <- lookup *next-ah +683 compare next, 0 +684 { +685 break-if-= +686 dump-call-paths screen, next-ah +687 } +688 } diff --git a/html/apps/tile/environment.mu.html b/html/apps/tile/environment.mu.html index e11ef11a..a2080d59 100644 --- a/html/apps/tile/environment.mu.html +++ b/html/apps/tile/environment.mu.html @@ -101,7 +101,7 @@ if ('onhashchange' in window) { 41 var screen/edi: (addr screen) <- copy _screen 42 var dest/edx: (addr int) <- get env, code-separator-col 43 var tmp/eax: int <- copy *dest - 44 clear-canvas env + 44 clear-canvas env 45 tmp <- add 2 # repl-margin-left 46 move-cursor screen, 3, tmp # input-row 47 } @@ -131,7 +131,7 @@ if ('onhashchange' in window) { 71 { 72 break-if-= 73 #? print-string 0, "processing sandbox rename\n" - 74 process-sandbox-rename sandbox, key + 74 process-sandbox-rename sandbox, key 75 break $process:body 76 } 77 var define-function-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-function @@ -141,7 +141,7 @@ if ('onhashchange' in window) { 81 break-if-= 82 #? print-string 0, "processing function definition\n" 83 var functions/ecx: (addr handle function) <- get self, functions - 84 process-sandbox-define sandbox, functions, key + 84 process-sandbox-define sandbox, functions, key 85 break $process:body 86 } 87 #? print-string 0, "processing sandbox\n" @@ -307,9 +307,9 @@ if ('onhashchange' in window) { 247 var callee-h: (handle function) 248 var callee-ah/edx: (addr handle function) <- address callee-h 249 var functions/ebx: (addr handle function) <- get self, functions - 250 callee functions, next-word, callee-ah - 251 var callee/eax: (addr function) <- lookup *callee-ah - 252 var callee-body-ah/eax: (addr handle line) <- get callee, body + 250 callee functions, next-word, callee-ah + 251 var callee/eax: (addr function) <- lookup *callee-ah + 252 var callee-body-ah/eax: (addr handle line) <- get callee, body 253 var callee-body/eax: (addr line) <- lookup *callee-body-ah 254 var callee-body-first-word/edx: (addr handle word) <- get callee-body, data 255 push-to-call-path-element cursor-call-path, callee-body-first-word @@ -329,1404 +329,1338 @@ if ('onhashchange' in window) { 269 { 270 break-if-!= 271 # toggle display of subsidiary stack - 272 toggle-cursor-word sandbox + 272 toggle-cursor-word sandbox 273 break $process-sandbox:body 274 } - 275 # word-based motions - 276 compare key, 2 # ctrl-b - 277 $process-sandbox:prev-word: { - 278 break-if-!= - 279 # jump to previous word at same level - 280 var prev-word-ah/edx: (addr handle word) <- get cursor-word, prev - 281 var prev-word/eax: (addr word) <- lookup *prev-word-ah - 282 { - 283 compare prev-word, 0 - 284 break-if-= - 285 cursor-to-end prev-word - 286 var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 287 decrement-final-element cursor-call-path - 288 break $process-sandbox:body - 289 } - 290 # if previous word doesn't exist, try to bump up one level - 291 { - 292 var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path - 293 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 294 var caller-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next - 295 var caller-cursor-element/eax: (addr call-path-element) <- lookup *caller-cursor-element-ah - 296 compare caller-cursor-element, 0 - 297 break-if-= - 298 # check if previous word exists in caller - 299 var caller-word-ah/eax: (addr handle word) <- get caller-cursor-element, word - 300 var caller-word/eax: (addr word) <- lookup *caller-word-ah - 301 var word-before-caller-ah/eax: (addr handle word) <- get caller-word, prev - 302 var word-before-caller/eax: (addr word) <- lookup *word-before-caller-ah - 303 compare word-before-caller, 0 + 275 compare key, 0xc # ctrl-l + 276 $process-sandbox:new-line: { + 277 break-if-!= + 278 # new line in sandbox + 279 append-line sandbox + 280 break $process-sandbox:body + 281 } + 282 # word-based motions + 283 compare key, 2 # ctrl-b + 284 $process-sandbox:prev-word: { + 285 break-if-!= + 286 # jump to previous word at same level + 287 var prev-word-ah/edx: (addr handle word) <- get cursor-word, prev + 288 var prev-word/eax: (addr word) <- lookup *prev-word-ah + 289 { + 290 compare prev-word, 0 + 291 break-if-= + 292 cursor-to-end prev-word + 293 var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 294 decrement-final-element cursor-call-path + 295 break $process-sandbox:body + 296 } + 297 # if previous word doesn't exist, try to bump up one level + 298 { + 299 var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + 300 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 301 var caller-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next + 302 var caller-cursor-element/eax: (addr call-path-element) <- lookup *caller-cursor-element-ah + 303 compare caller-cursor-element, 0 304 break-if-= - 305 # if so jump to it - 306 drop-from-call-path-element cursor-call-path-ah - 307 decrement-final-element cursor-call-path-ah - 308 break $process-sandbox:body - 309 } - 310 } - 311 compare key, 6 # ctrl-f - 312 $process-sandbox:next-word: { - 313 break-if-!= - 314 #? print-string 0, "AA\n" - 315 # jump to previous word at same level - 316 var next-word-ah/edx: (addr handle word) <- get cursor-word, next - 317 var next-word/eax: (addr word) <- lookup *next-word-ah - 318 { - 319 compare next-word, 0 - 320 break-if-= - 321 #? print-string 0, "BB\n" - 322 cursor-to-end next-word - 323 var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 324 increment-final-element cursor-call-path - 325 break $process-sandbox:body - 326 } - 327 # if next word doesn't exist, try to bump up one level - 328 #? print-string 0, "CC\n" - 329 var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path - 330 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 331 var caller-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next - 332 var caller-cursor-element/eax: (addr call-path-element) <- lookup *caller-cursor-element-ah - 333 compare caller-cursor-element, 0 - 334 break-if-= - 335 #? print-string 0, "DD\n" - 336 copy-object caller-cursor-element-ah, cursor-call-path-ah - 337 break $process-sandbox:body - 338 } - 339 # line-based motions - 340 compare key, 1 # ctrl-a - 341 $process-sandbox:start-of-line: { - 342 break-if-!= - 343 # move cursor up past all calls and to start of line - 344 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 345 drop-nested-calls cursor-call-path-ah - 346 move-final-element-to-start-of-line cursor-call-path-ah - 347 # move cursor to start of initial word - 348 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 349 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word - 350 var cursor-word/eax: (addr word) <- lookup *cursor-word-ah - 351 cursor-to-start cursor-word - 352 # this works as long as the first word isn't expanded - 353 # but we don't expect to see zero-arg functions first-up - 354 break $process-sandbox:body - 355 } - 356 compare key, 5 # ctrl-e - 357 $process-sandbox:end-of-line: { - 358 break-if-!= - 359 # move cursor to final word of sandbox - 360 var cursor-call-path-ah/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path - 361 initialize-path-from-sandbox sandbox, cursor-call-path-ah - 362 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 363 var dest/eax: (addr handle word) <- get cursor-call-path, word - 364 final-word dest, dest - 365 # move cursor to end of final word - 366 var cursor-word/eax: (addr word) <- lookup *cursor-word-ah - 367 cursor-to-end cursor-word - 368 # this works because expanded words lie to the right of their bodies - 369 # so the final word is always guaranteed to be at the top-level - 370 break $process-sandbox:body - 371 } - 372 compare key, 0x15 # ctrl-u - 373 $process-sandbox:clear-line: { - 374 break-if-!= - 375 # clear line in sandbox - 376 initialize-sandbox sandbox + 305 # check if previous word exists in caller + 306 var caller-word-ah/eax: (addr handle word) <- get caller-cursor-element, word + 307 var caller-word/eax: (addr word) <- lookup *caller-word-ah + 308 var word-before-caller-ah/eax: (addr handle word) <- get caller-word, prev + 309 var word-before-caller/eax: (addr word) <- lookup *word-before-caller-ah + 310 compare word-before-caller, 0 + 311 break-if-= + 312 # if so jump to it + 313 drop-from-call-path-element cursor-call-path-ah + 314 decrement-final-element cursor-call-path-ah + 315 break $process-sandbox:body + 316 } + 317 } + 318 compare key, 6 # ctrl-f + 319 $process-sandbox:next-word: { + 320 break-if-!= + 321 #? print-string 0, "AA\n" + 322 # jump to previous word at same level + 323 var next-word-ah/edx: (addr handle word) <- get cursor-word, next + 324 var next-word/eax: (addr word) <- lookup *next-word-ah + 325 { + 326 compare next-word, 0 + 327 break-if-= + 328 #? print-string 0, "BB\n" + 329 cursor-to-end next-word + 330 var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 331 increment-final-element cursor-call-path + 332 break $process-sandbox:body + 333 } + 334 # if next word doesn't exist, try to bump up one level + 335 #? print-string 0, "CC\n" + 336 var cursor-call-path-ah/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + 337 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 338 var caller-cursor-element-ah/ecx: (addr handle call-path-element) <- get cursor-call-path, next + 339 var caller-cursor-element/eax: (addr call-path-element) <- lookup *caller-cursor-element-ah + 340 compare caller-cursor-element, 0 + 341 break-if-= + 342 #? print-string 0, "DD\n" + 343 copy-object caller-cursor-element-ah, cursor-call-path-ah + 344 break $process-sandbox:body + 345 } + 346 # line-based motions + 347 compare key, 1 # ctrl-a + 348 $process-sandbox:start-of-line: { + 349 break-if-!= + 350 # move cursor up past all calls and to start of line + 351 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 352 drop-nested-calls cursor-call-path-ah + 353 move-final-element-to-start-of-line cursor-call-path-ah + 354 # move cursor to start of initial word + 355 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 356 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word + 357 var cursor-word/eax: (addr word) <- lookup *cursor-word-ah + 358 cursor-to-start cursor-word + 359 # this works as long as the first word isn't expanded + 360 # but we don't expect to see zero-arg functions first-up + 361 break $process-sandbox:body + 362 } + 363 compare key, 5 # ctrl-e + 364 $process-sandbox:end-of-line: { + 365 break-if-!= + 366 # move cursor to final word of sandbox + 367 var cursor-call-path-ah/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path + 368 initialize-path-from-sandbox sandbox, cursor-call-path-ah + 369 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 370 var dest/eax: (addr handle word) <- get cursor-call-path, word + 371 final-word dest, dest + 372 # move cursor to end of final word + 373 var cursor-word/eax: (addr word) <- lookup *cursor-word-ah + 374 cursor-to-end cursor-word + 375 # this works because expanded words lie to the right of their bodies + 376 # so the final word is always guaranteed to be at the top-level 377 break $process-sandbox:body 378 } - 379 # if cursor is within a call, disable editing hotkeys below - 380 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 381 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 382 var next-cursor-element-ah/eax: (addr handle call-path-element) <- get cursor-call-path, next - 383 var next-cursor-element/eax: (addr call-path-element) <- lookup *next-cursor-element-ah - 384 compare next-cursor-element, 0 - 385 break-if-!= $process-sandbox:body - 386 # - remaining keys only work at the top row outside any function calls - 387 compare key, 0x7f # del (backspace on Macs) - 388 $process-sandbox:backspace: { - 389 break-if-!= - 390 # if not at start of some word, delete grapheme before cursor within current word - 391 var at-start?/eax: boolean <- cursor-at-start? cursor-word - 392 compare at-start?, 0 # false - 393 { - 394 break-if-!= - 395 delete-before-cursor cursor-word - 396 break $process-sandbox:body - 397 } - 398 # otherwise delete current word and move to end of prev word - 399 var prev-word-ah/eax: (addr handle word) <- get cursor-word, prev - 400 var prev-word/eax: (addr word) <- lookup *prev-word-ah - 401 { - 402 compare prev-word, 0 - 403 break-if-= - 404 cursor-to-end prev-word - 405 delete-next prev-word - 406 var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 407 decrement-final-element cursor-call-path - 408 } - 409 break $process-sandbox:body - 410 } - 411 compare key, 0x20 # space - 412 $process-sandbox:space: { - 413 break-if-!= - 414 #? print-string 0, "space\n" - 415 # if cursor is at start of word, insert word before - 416 { - 417 var at-start?/eax: boolean <- cursor-at-start? cursor-word - 418 compare at-start?, 0 # false - 419 break-if-= - 420 var prev-word-ah/eax: (addr handle word) <- get cursor-word, prev - 421 append-word prev-word-ah - 422 var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 423 decrement-final-element cursor-call-path - 424 break $process-sandbox:body - 425 } - 426 # if start of word is quote and grapheme before cursor is not, just insert it as usual - 427 # TODO: support string escaping - 428 { - 429 var first-grapheme/eax: grapheme <- first-grapheme cursor-word - 430 compare first-grapheme, 0x22 # double quote - 431 break-if-!= - 432 var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word - 433 compare final-grapheme, 0x22 # double quote - 434 break-if-= - 435 break $process-sandbox:space - 436 } - 437 # if start of word is '[' and grapheme before cursor is not ']', just insert it as usual - 438 # TODO: support nested arrays - 439 { - 440 var first-grapheme/eax: grapheme <- first-grapheme cursor-word - 441 compare first-grapheme, 0x5b # '[' - 442 break-if-!= - 443 var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word - 444 compare final-grapheme, 0x5d # ']' - 445 break-if-= - 446 break $process-sandbox:space - 447 } - 448 # otherwise insert word after and move cursor to it for the next key - 449 # (but we'll continue to track the current cursor-word for the rest of this function) - 450 append-word cursor-word-ah - 451 var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 452 increment-final-element cursor-call-path - 453 # if cursor is at end of word, that's all - 454 var at-end?/eax: boolean <- cursor-at-end? cursor-word - 455 compare at-end?, 0 # false - 456 break-if-!= $process-sandbox:body - 457 # otherwise we're in the middle of a word - 458 # move everything after cursor to the (just created) next word - 459 var next-word-ah/eax: (addr handle word) <- get cursor-word, next - 460 var _next-word/eax: (addr word) <- lookup *next-word-ah - 461 var next-word/ebx: (addr word) <- copy _next-word - 462 { - 463 var at-end?/eax: boolean <- cursor-at-end? cursor-word - 464 compare at-end?, 0 # false - 465 break-if-!= - 466 var g/eax: grapheme <- pop-after-cursor cursor-word - 467 add-grapheme-to-word next-word, g - 468 loop - 469 } - 470 cursor-to-start next-word - 471 break $process-sandbox:body - 472 } - 473 compare key, 0xe # ctrl-n - 474 $process:rename-word: { - 475 break-if-!= - 476 # TODO: ensure current word is not a function - 477 # rename word at cursor - 478 var new-name-ah/eax: (addr handle word) <- get sandbox, partial-name-for-cursor-word - 479 allocate new-name-ah - 480 var new-name/eax: (addr word) <- lookup *new-name-ah - 481 initialize-word new-name - 482 break $process-sandbox:body - 483 } - 484 compare key, 4 # ctrl-d - 485 $process:define-function: { - 486 break-if-!= - 487 # define function out of line at cursor - 488 var new-name-ah/eax: (addr handle word) <- get sandbox, partial-name-for-function - 489 allocate new-name-ah - 490 var new-name/eax: (addr word) <- lookup *new-name-ah - 491 initialize-word new-name - 492 break $process-sandbox:body - 493 } - 494 # otherwise insert key within current word - 495 var g/edx: grapheme <- copy key - 496 var print?/eax: boolean <- real-grapheme? key - 497 $process-sandbox:real-grapheme: { - 498 compare print?, 0 # false - 499 break-if-= - 500 add-grapheme-to-word cursor-word, g - 501 break $process-sandbox:body - 502 } - 503 # silently ignore other hotkeys - 504 } - 505 } - 506 - 507 # collect new name in partial-name-for-cursor-word, and then rename the word - 508 # at cursor to it - 509 # Precondition: cursor-call-path is a singleton (not within a call) - 510 fn process-sandbox-rename _sandbox: (addr sandbox), key: grapheme { - 511 $process-sandbox-rename:body: { - 512 var sandbox/esi: (addr sandbox) <- copy _sandbox - 513 var new-name-ah/edi: (addr handle word) <- get sandbox, partial-name-for-cursor-word - 514 # if 'esc' pressed, cancel rename - 515 compare key, 0x1b # esc - 516 $process-sandbox-rename:cancel: { - 517 break-if-!= - 518 var empty: (handle word) - 519 copy-handle empty, new-name-ah - 520 break $process-sandbox-rename:body - 521 } - 522 # if 'enter' pressed, perform rename - 523 compare key, 0xa # enter - 524 $process-sandbox-rename:commit: { - 525 break-if-!= - 526 #? print-string 0, "rename\n" - 527 # new line - 528 var new-line-h: (handle line) - 529 var new-line-ah/eax: (addr handle line) <- address new-line-h - 530 allocate new-line-ah - 531 var new-line/eax: (addr line) <- lookup *new-line-ah - 532 initialize-line new-line - 533 var new-line-word-ah/ecx: (addr handle word) <- get new-line, data - 534 { - 535 # move word at cursor to new line - 536 var cursor-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 537 var cursor/eax: (addr call-path-element) <- lookup *cursor-ah - 538 var word-at-cursor-ah/eax: (addr handle word) <- get cursor, word - 539 #? print-string 0, "cursor before at word " - 540 #? { - 541 #? var cursor-word/eax: (addr word) <- lookup *word-at-cursor-ah - 542 #? print-word 0, cursor-word - 543 #? print-string 0, "\n" - 544 #? } - 545 move-word-contents word-at-cursor-ah, new-line-word-ah - 546 # copy name to word at cursor - 547 copy-word-contents-before-cursor new-name-ah, word-at-cursor-ah - 548 #? print-string 0, "cursor after at word " - 549 #? { - 550 #? var cursor-word/eax: (addr word) <- lookup *word-at-cursor-ah - 551 #? print-word 0, cursor-word - 552 #? print-string 0, "\n" - 553 #? var foo/eax: int <- copy cursor-word - 554 #? print-int32-hex 0, foo - 555 #? print-string 0, "\n" - 556 #? } - 557 #? print-string 0, "new name word " - 558 #? { - 559 #? var new-name/eax: (addr word) <- lookup *new-name-ah - 560 #? print-word 0, new-name - 561 #? print-string 0, "\n" - 562 #? var foo/eax: int <- copy new-name - 563 #? print-int32-hex 0, foo - 564 #? print-string 0, "\n" - 565 #? } - 566 } - 567 # prepend '=' to name - 568 { - 569 var new-name/eax: (addr word) <- lookup *new-name-ah - 570 cursor-to-start new-name - 571 add-grapheme-to-word new-name, 0x3d # '=' - 572 } - 573 # append name to new line - 574 chain-words new-line-word-ah, new-name-ah - 575 # new-line->next = sandbox->data - 576 var new-line-next/ecx: (addr handle line) <- get new-line, next - 577 var sandbox-slot/edx: (addr handle line) <- get sandbox, data - 578 copy-object sandbox-slot, new-line-next - 579 # sandbox->data = new-line - 580 copy-handle new-line-h, sandbox-slot - 581 # clear partial-name-for-cursor-word - 582 var empty: (handle word) - 583 copy-handle empty, new-name-ah - 584 #? # XXX - 585 #? var cursor-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 586 #? var cursor/eax: (addr call-path-element) <- lookup *cursor-ah - 587 #? var word-at-cursor-ah/eax: (addr handle word) <- get cursor, word - 588 #? print-string 0, "cursor after rename: " - 589 #? { - 590 #? var cursor-word/eax: (addr word) <- lookup *word-at-cursor-ah - 591 #? print-word 0, cursor-word - 592 #? print-string 0, " -- " - 593 #? var foo/eax: int <- copy cursor-word - 594 #? print-int32-hex 0, foo - 595 #? print-string 0, "\n" - 596 #? } - 597 break $process-sandbox-rename:body - 598 } - 599 # - 600 compare key, 0x7f # del (backspace on Macs) - 601 $process-sandbox-rename:backspace: { - 602 break-if-!= - 603 # if not at start, delete grapheme before cursor - 604 var new-name/eax: (addr word) <- lookup *new-name-ah - 605 var at-start?/eax: boolean <- cursor-at-start? new-name - 606 compare at-start?, 0 # false - 607 { - 608 break-if-!= - 609 var new-name/eax: (addr word) <- lookup *new-name-ah - 610 delete-before-cursor new-name - 611 } - 612 break $process-sandbox-rename:body - 613 } - 614 # otherwise insert key within current word - 615 var print?/eax: boolean <- real-grapheme? key - 616 $process-sandbox-rename:real-grapheme: { - 617 compare print?, 0 # false - 618 break-if-= - 619 var new-name/eax: (addr word) <- lookup *new-name-ah - 620 add-grapheme-to-word new-name, key - 621 break $process-sandbox-rename:body - 622 } - 623 # silently ignore other hotkeys - 624 } - 625 } - 626 - 627 # collect new name in partial-name-for-function, and then define the last line - 628 # of the sandbox to be a new function with that name. Replace the last line - 629 # with a call to the appropriate function. - 630 # Precondition: cursor-call-path is a singleton (not within a call) - 631 fn process-sandbox-define _sandbox: (addr sandbox), functions: (addr handle function), key: grapheme { - 632 $process-sandbox-define:body: { - 633 var sandbox/esi: (addr sandbox) <- copy _sandbox - 634 var new-name-ah/edi: (addr handle word) <- get sandbox, partial-name-for-function - 635 # if 'esc' pressed, cancel define - 636 compare key, 0x1b # esc - 637 $process-sandbox-define:cancel: { - 638 break-if-!= - 639 var empty: (handle word) - 640 copy-handle empty, new-name-ah - 641 break $process-sandbox-define:body - 642 } - 643 # if 'enter' pressed, perform define - 644 compare key, 0xa # enter - 645 $process-sandbox-define:commit: { - 646 break-if-!= - 647 #? print-string 0, "define\n" - 648 # create new function - 649 var new-function: (handle function) - 650 var new-function-ah/ecx: (addr handle function) <- address new-function - 651 allocate new-function-ah - 652 var _new-function/eax: (addr function) <- lookup *new-function-ah - 653 var new-function/ebx: (addr function) <- copy _new-function - 654 var dest/edx: (addr handle function) <- get new-function, next - 655 copy-object functions, dest - 656 copy-object new-function-ah, functions - 657 # set function name to new-name - 658 var new-name/eax: (addr word) <- lookup *new-name-ah - 659 var dest/edx: (addr handle array byte) <- get new-function, name - 660 word-to-string new-name, dest - 661 # move final line to body - 662 var body-ah/eax: (addr handle line) <- get new-function, body - 663 allocate body-ah - 664 var body/eax: (addr line) <- lookup *body-ah - 665 var body-contents/ecx: (addr handle word) <- get body, data - 666 var final-line-storage: (handle line) - 667 var final-line-ah/eax: (addr handle line) <- address final-line-storage - 668 final-line sandbox, final-line-ah - 669 var final-line/eax: (addr line) <- lookup *final-line-ah - 670 var final-line-contents/eax: (addr handle word) <- get final-line, data - 671 copy-object final-line-contents, body-contents - 672 # - 673 copy-unbound-words-to-args functions - 674 # - 675 var empty-word: (handle word) - 676 copy-handle empty-word, final-line-contents - 677 construct-call functions, final-line-contents - 678 # clear partial-name-for-function - 679 var empty-word: (handle word) - 680 copy-handle empty-word, new-name-ah - 681 # update cursor - 682 var final-line/eax: (addr line) <- lookup final-line-storage - 683 var cursor-call-path-ah/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path - 684 allocate cursor-call-path-ah # leak - 685 initialize-path-from-line final-line, cursor-call-path-ah - 686 break $process-sandbox-define:body - 687 } - 688 # - 689 compare key, 0x7f # del (backspace on Macs) - 690 $process-sandbox-define:backspace: { - 691 break-if-!= - 692 # if not at start, delete grapheme before cursor - 693 var new-name/eax: (addr word) <- lookup *new-name-ah - 694 var at-start?/eax: boolean <- cursor-at-start? new-name - 695 compare at-start?, 0 # false - 696 { - 697 break-if-!= - 698 var new-name/eax: (addr word) <- lookup *new-name-ah - 699 delete-before-cursor new-name - 700 } - 701 break $process-sandbox-define:body - 702 } - 703 # otherwise insert key within current word - 704 var print?/eax: boolean <- real-grapheme? key - 705 $process-sandbox-define:real-grapheme: { - 706 compare print?, 0 # false - 707 break-if-= - 708 var new-name/eax: (addr word) <- lookup *new-name-ah - 709 add-grapheme-to-word new-name, key - 710 break $process-sandbox-define:body - 711 } - 712 # silently ignore other hotkeys - 713 } - 714 } - 715 - 716 # extract from the body of the first function in 'functions' all words that - 717 # aren't defined in the rest of 'functions'. Prepend them in reverse order. - 718 # Assumes function body is a single line for now. - 719 fn copy-unbound-words-to-args _functions: (addr handle function) { - 720 # target - 721 var target-ah/eax: (addr handle function) <- copy _functions - 722 var _target/eax: (addr function) <- lookup *target-ah - 723 var target/esi: (addr function) <- copy _target - 724 var dest-ah/edi: (addr handle word) <- get target, args - 725 # next - 726 var functions-ah/edx: (addr handle function) <- get target, next - 727 # src - 728 var line-ah/eax: (addr handle line) <- get target, body - 729 var line/eax: (addr line) <- lookup *line-ah - 730 var curr-ah/eax: (addr handle word) <- get line, data - 731 var curr/eax: (addr word) <- lookup *curr-ah - 732 { - 733 compare curr, 0 - 734 break-if-= - 735 $copy-unbound-words-to-args:loop-iter: { - 736 # is it a number? - 737 { - 738 var is-int?/eax: boolean <- word-is-decimal-integer? curr - 739 compare is-int?, 0 # false - 740 break-if-!= $copy-unbound-words-to-args:loop-iter - 741 } - 742 # is it a pre-existing function? - 743 var bound?/ebx: boolean <- bound-function? curr, functions-ah - 744 compare bound?, 0 # false - 745 break-if-!= - 746 # is it already bound as an arg? - 747 var dup?/ebx: boolean <- arg-exists? _functions, curr # _functions = target-ah - 748 compare dup?, 0 # false - 749 break-if-!= $copy-unbound-words-to-args:loop-iter - 750 # push copy of curr before dest-ah - 751 var rest-h: (handle word) - 752 var rest-ah/ecx: (addr handle word) <- address rest-h - 753 copy-object dest-ah, rest-ah - 754 copy-word curr, dest-ah - 755 chain-words dest-ah, rest-ah - 756 } - 757 var next-ah/ecx: (addr handle word) <- get curr, next - 758 curr <- lookup *next-ah - 759 loop - 760 } - 761 } - 762 - 763 fn bound-function? w: (addr word), functions-ah: (addr handle function) -> _/ebx: boolean { - 764 var result/ebx: boolean <- copy 1 # true - 765 { - 766 # if w == "+" return true - 767 var subresult/eax: boolean <- word-equal? w, "+" - 768 compare subresult, 0 # false - 769 break-if-!= - 770 # if w == "-" return true - 771 subresult <- word-equal? w, "-" - 772 compare subresult, 0 # false - 773 break-if-!= - 774 # if w == "*" return true - 775 subresult <- word-equal? w, "*" + 379 compare key, 0x15 # ctrl-u + 380 $process-sandbox:clear-line: { + 381 break-if-!= + 382 # clear line in sandbox + 383 initialize-sandbox sandbox + 384 break $process-sandbox:body + 385 } + 386 # if cursor is within a call, disable editing hotkeys below + 387 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 388 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 389 var next-cursor-element-ah/eax: (addr handle call-path-element) <- get cursor-call-path, next + 390 var next-cursor-element/eax: (addr call-path-element) <- lookup *next-cursor-element-ah + 391 compare next-cursor-element, 0 + 392 break-if-!= $process-sandbox:body + 393 # - remaining keys only work at the top row outside any function calls + 394 compare key, 0x7f # del (backspace on Macs) + 395 $process-sandbox:backspace: { + 396 break-if-!= + 397 # if not at start of some word, delete grapheme before cursor within current word + 398 var at-start?/eax: boolean <- cursor-at-start? cursor-word + 399 compare at-start?, 0 # false + 400 { + 401 break-if-!= + 402 delete-before-cursor cursor-word + 403 break $process-sandbox:body + 404 } + 405 # otherwise delete current word and move to end of prev word + 406 var prev-word-ah/eax: (addr handle word) <- get cursor-word, prev + 407 var prev-word/eax: (addr word) <- lookup *prev-word-ah + 408 { + 409 compare prev-word, 0 + 410 break-if-= + 411 cursor-to-end prev-word + 412 delete-next prev-word + 413 var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 414 decrement-final-element cursor-call-path + 415 } + 416 break $process-sandbox:body + 417 } + 418 compare key, 0x20 # space + 419 $process-sandbox:space: { + 420 break-if-!= + 421 #? print-string 0, "space\n" + 422 # if cursor is at start of word, insert word before + 423 { + 424 var at-start?/eax: boolean <- cursor-at-start? cursor-word + 425 compare at-start?, 0 # false + 426 break-if-= + 427 var prev-word-ah/eax: (addr handle word) <- get cursor-word, prev + 428 append-word prev-word-ah + 429 var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 430 decrement-final-element cursor-call-path + 431 break $process-sandbox:body + 432 } + 433 # if start of word is quote and grapheme before cursor is not, just insert it as usual + 434 # TODO: support string escaping + 435 { + 436 var first-grapheme/eax: grapheme <- first-grapheme cursor-word + 437 compare first-grapheme, 0x22 # double quote + 438 break-if-!= + 439 var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word + 440 compare final-grapheme, 0x22 # double quote + 441 break-if-= + 442 break $process-sandbox:space + 443 } + 444 # if start of word is '[' and grapheme before cursor is not ']', just insert it as usual + 445 # TODO: support nested arrays + 446 { + 447 var first-grapheme/eax: grapheme <- first-grapheme cursor-word + 448 compare first-grapheme, 0x5b # '[' + 449 break-if-!= + 450 var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word + 451 compare final-grapheme, 0x5d # ']' + 452 break-if-= + 453 break $process-sandbox:space + 454 } + 455 # otherwise insert word after and move cursor to it for the next key + 456 # (but we'll continue to track the current cursor-word for the rest of this function) + 457 append-word cursor-word-ah + 458 var cursor-call-path/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 459 increment-final-element cursor-call-path + 460 # if cursor is at end of word, that's all + 461 var at-end?/eax: boolean <- cursor-at-end? cursor-word + 462 compare at-end?, 0 # false + 463 break-if-!= $process-sandbox:body + 464 # otherwise we're in the middle of a word + 465 # move everything after cursor to the (just created) next word + 466 var next-word-ah/eax: (addr handle word) <- get cursor-word, next + 467 var _next-word/eax: (addr word) <- lookup *next-word-ah + 468 var next-word/ebx: (addr word) <- copy _next-word + 469 { + 470 var at-end?/eax: boolean <- cursor-at-end? cursor-word + 471 compare at-end?, 0 # false + 472 break-if-!= + 473 var g/eax: grapheme <- pop-after-cursor cursor-word + 474 add-grapheme-to-word next-word, g + 475 loop + 476 } + 477 cursor-to-start next-word + 478 break $process-sandbox:body + 479 } + 480 compare key, 0xe # ctrl-n + 481 $process:rename-word: { + 482 break-if-!= + 483 # TODO: ensure current word is not a function + 484 # rename word at cursor + 485 var new-name-ah/eax: (addr handle word) <- get sandbox, partial-name-for-cursor-word + 486 allocate new-name-ah + 487 var new-name/eax: (addr word) <- lookup *new-name-ah + 488 initialize-word new-name + 489 break $process-sandbox:body + 490 } + 491 compare key, 4 # ctrl-d + 492 $process:define-function: { + 493 break-if-!= + 494 # define function out of line at cursor + 495 var new-name-ah/eax: (addr handle word) <- get sandbox, partial-name-for-function + 496 allocate new-name-ah + 497 var new-name/eax: (addr word) <- lookup *new-name-ah + 498 initialize-word new-name + 499 break $process-sandbox:body + 500 } + 501 # otherwise insert key within current word + 502 var g/edx: grapheme <- copy key + 503 var print?/eax: boolean <- real-grapheme? key + 504 $process-sandbox:real-grapheme: { + 505 compare print?, 0 # false + 506 break-if-= + 507 add-grapheme-to-word cursor-word, g + 508 break $process-sandbox:body + 509 } + 510 # silently ignore other hotkeys + 511 } + 512 } + 513 + 514 # collect new name in partial-name-for-cursor-word, and then rename the word + 515 # at cursor to it + 516 # Precondition: cursor-call-path is a singleton (not within a call) + 517 fn process-sandbox-rename _sandbox: (addr sandbox), key: grapheme { + 518 $process-sandbox-rename:body: { + 519 var sandbox/esi: (addr sandbox) <- copy _sandbox + 520 var new-name-ah/edi: (addr handle word) <- get sandbox, partial-name-for-cursor-word + 521 # if 'esc' pressed, cancel rename + 522 compare key, 0x1b # esc + 523 $process-sandbox-rename:cancel: { + 524 break-if-!= + 525 var empty: (handle word) + 526 copy-handle empty, new-name-ah + 527 break $process-sandbox-rename:body + 528 } + 529 # if 'enter' pressed, perform rename + 530 compare key, 0xa # enter + 531 $process-sandbox-rename:commit: { + 532 break-if-!= + 533 #? print-string 0, "rename\n" + 534 # new line + 535 var new-line-h: (handle line) + 536 var new-line-ah/eax: (addr handle line) <- address new-line-h + 537 allocate new-line-ah + 538 var new-line/eax: (addr line) <- lookup *new-line-ah + 539 initialize-line new-line + 540 var new-line-word-ah/ecx: (addr handle word) <- get new-line, data + 541 { + 542 # move word at cursor to new line + 543 var cursor-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 544 var cursor/eax: (addr call-path-element) <- lookup *cursor-ah + 545 var word-at-cursor-ah/eax: (addr handle word) <- get cursor, word + 546 #? print-string 0, "cursor before at word " + 547 #? { + 548 #? var cursor-word/eax: (addr word) <- lookup *word-at-cursor-ah + 549 #? print-word 0, cursor-word + 550 #? print-string 0, "\n" + 551 #? } + 552 move-word-contents word-at-cursor-ah, new-line-word-ah + 553 # copy name to word at cursor + 554 copy-word-contents-before-cursor new-name-ah, word-at-cursor-ah + 555 #? print-string 0, "cursor after at word " + 556 #? { + 557 #? var cursor-word/eax: (addr word) <- lookup *word-at-cursor-ah + 558 #? print-word 0, cursor-word + 559 #? print-string 0, "\n" + 560 #? var foo/eax: int <- copy cursor-word + 561 #? print-int32-hex 0, foo + 562 #? print-string 0, "\n" + 563 #? } + 564 #? print-string 0, "new name word " + 565 #? { + 566 #? var new-name/eax: (addr word) <- lookup *new-name-ah + 567 #? print-word 0, new-name + 568 #? print-string 0, "\n" + 569 #? var foo/eax: int <- copy new-name + 570 #? print-int32-hex 0, foo + 571 #? print-string 0, "\n" + 572 #? } + 573 } + 574 # prepend '=' to name + 575 { + 576 var new-name/eax: (addr word) <- lookup *new-name-ah + 577 cursor-to-start new-name + 578 add-grapheme-to-word new-name, 0x3d # '=' + 579 } + 580 # append name to new line + 581 chain-words new-line-word-ah, new-name-ah + 582 # new-line->next = sandbox->data + 583 var new-line-next/ecx: (addr handle line) <- get new-line, next + 584 var sandbox-slot/edx: (addr handle line) <- get sandbox, data + 585 copy-object sandbox-slot, new-line-next + 586 # sandbox->data = new-line + 587 copy-handle new-line-h, sandbox-slot + 588 # clear partial-name-for-cursor-word + 589 var empty: (handle word) + 590 copy-handle empty, new-name-ah + 591 #? # XXX + 592 #? var cursor-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 593 #? var cursor/eax: (addr call-path-element) <- lookup *cursor-ah + 594 #? var word-at-cursor-ah/eax: (addr handle word) <- get cursor, word + 595 #? print-string 0, "cursor after rename: " + 596 #? { + 597 #? var cursor-word/eax: (addr word) <- lookup *word-at-cursor-ah + 598 #? print-word 0, cursor-word + 599 #? print-string 0, " -- " + 600 #? var foo/eax: int <- copy cursor-word + 601 #? print-int32-hex 0, foo + 602 #? print-string 0, "\n" + 603 #? } + 604 break $process-sandbox-rename:body + 605 } + 606 # + 607 compare key, 0x7f # del (backspace on Macs) + 608 $process-sandbox-rename:backspace: { + 609 break-if-!= + 610 # if not at start, delete grapheme before cursor + 611 var new-name/eax: (addr word) <- lookup *new-name-ah + 612 var at-start?/eax: boolean <- cursor-at-start? new-name + 613 compare at-start?, 0 # false + 614 { + 615 break-if-!= + 616 var new-name/eax: (addr word) <- lookup *new-name-ah + 617 delete-before-cursor new-name + 618 } + 619 break $process-sandbox-rename:body + 620 } + 621 # otherwise insert key within current word + 622 var print?/eax: boolean <- real-grapheme? key + 623 $process-sandbox-rename:real-grapheme: { + 624 compare print?, 0 # false + 625 break-if-= + 626 var new-name/eax: (addr word) <- lookup *new-name-ah + 627 add-grapheme-to-word new-name, key + 628 break $process-sandbox-rename:body + 629 } + 630 # silently ignore other hotkeys + 631 } + 632 } + 633 + 634 # collect new name in partial-name-for-function, and then define the last line + 635 # of the sandbox to be a new function with that name. Replace the last line + 636 # with a call to the appropriate function. + 637 # Precondition: cursor-call-path is a singleton (not within a call) + 638 fn process-sandbox-define _sandbox: (addr sandbox), functions: (addr handle function), key: grapheme { + 639 $process-sandbox-define:body: { + 640 var sandbox/esi: (addr sandbox) <- copy _sandbox + 641 var new-name-ah/edi: (addr handle word) <- get sandbox, partial-name-for-function + 642 # if 'esc' pressed, cancel define + 643 compare key, 0x1b # esc + 644 $process-sandbox-define:cancel: { + 645 break-if-!= + 646 var empty: (handle word) + 647 copy-handle empty, new-name-ah + 648 break $process-sandbox-define:body + 649 } + 650 # if 'enter' pressed, perform define + 651 compare key, 0xa # enter + 652 $process-sandbox-define:commit: { + 653 break-if-!= + 654 #? print-string 0, "define\n" + 655 # create new function + 656 var new-function: (handle function) + 657 var new-function-ah/ecx: (addr handle function) <- address new-function + 658 allocate new-function-ah + 659 var _new-function/eax: (addr function) <- lookup *new-function-ah + 660 var new-function/ebx: (addr function) <- copy _new-function + 661 var dest/edx: (addr handle function) <- get new-function, next + 662 copy-object functions, dest + 663 copy-object new-function-ah, functions + 664 # set function name to new-name + 665 var new-name/eax: (addr word) <- lookup *new-name-ah + 666 var dest/edx: (addr handle array byte) <- get new-function, name + 667 word-to-string new-name, dest + 668 # move final line to body + 669 var body-ah/eax: (addr handle line) <- get new-function, body + 670 allocate body-ah + 671 var body/eax: (addr line) <- lookup *body-ah + 672 var body-contents/ecx: (addr handle word) <- get body, data + 673 var final-line-storage: (handle line) + 674 var final-line-ah/eax: (addr handle line) <- address final-line-storage + 675 final-line sandbox, final-line-ah + 676 var final-line/eax: (addr line) <- lookup *final-line-ah + 677 var final-line-contents/eax: (addr handle word) <- get final-line, data + 678 copy-object final-line-contents, body-contents + 679 # + 680 copy-unbound-words-to-args functions + 681 # + 682 var empty-word: (handle word) + 683 copy-handle empty-word, final-line-contents + 684 construct-call functions, final-line-contents + 685 # clear partial-name-for-function + 686 var empty-word: (handle word) + 687 copy-handle empty-word, new-name-ah + 688 # update cursor + 689 var final-line/eax: (addr line) <- lookup final-line-storage + 690 var cursor-call-path-ah/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path + 691 allocate cursor-call-path-ah # leak + 692 initialize-path-from-line final-line, cursor-call-path-ah + 693 break $process-sandbox-define:body + 694 } + 695 # + 696 compare key, 0x7f # del (backspace on Macs) + 697 $process-sandbox-define:backspace: { + 698 break-if-!= + 699 # if not at start, delete grapheme before cursor + 700 var new-name/eax: (addr word) <- lookup *new-name-ah + 701 var at-start?/eax: boolean <- cursor-at-start? new-name + 702 compare at-start?, 0 # false + 703 { + 704 break-if-!= + 705 var new-name/eax: (addr word) <- lookup *new-name-ah + 706 delete-before-cursor new-name + 707 } + 708 break $process-sandbox-define:body + 709 } + 710 # otherwise insert key within current word + 711 var print?/eax: boolean <- real-grapheme? key + 712 $process-sandbox-define:real-grapheme: { + 713 compare print?, 0 # false + 714 break-if-= + 715 var new-name/eax: (addr word) <- lookup *new-name-ah + 716 add-grapheme-to-word new-name, key + 717 break $process-sandbox-define:body + 718 } + 719 # silently ignore other hotkeys + 720 } + 721 } + 722 + 723 # extract from the body of the first function in 'functions' all words that + 724 # aren't defined in the rest of 'functions'. Prepend them in reverse order. + 725 # Assumes function body is a single line for now. + 726 fn copy-unbound-words-to-args _functions: (addr handle function) { + 727 # target + 728 var target-ah/eax: (addr handle function) <- copy _functions + 729 var _target/eax: (addr function) <- lookup *target-ah + 730 var target/esi: (addr function) <- copy _target + 731 var dest-ah/edi: (addr handle word) <- get target, args + 732 # next + 733 var functions-ah/edx: (addr handle function) <- get target, next + 734 # src + 735 var line-ah/eax: (addr handle line) <- get target, body + 736 var line/eax: (addr line) <- lookup *line-ah + 737 var curr-ah/eax: (addr handle word) <- get line, data + 738 var curr/eax: (addr word) <- lookup *curr-ah + 739 { + 740 compare curr, 0 + 741 break-if-= + 742 $copy-unbound-words-to-args:loop-iter: { + 743 # is it a number? + 744 { + 745 var is-int?/eax: boolean <- word-is-decimal-integer? curr + 746 compare is-int?, 0 # false + 747 break-if-!= $copy-unbound-words-to-args:loop-iter + 748 } + 749 # is it a pre-existing function? + 750 var bound?/ebx: boolean <- bound-function? curr, functions-ah + 751 compare bound?, 0 # false + 752 break-if-!= + 753 # is it already bound as an arg? + 754 var dup?/ebx: boolean <- arg-exists? _functions, curr # _functions = target-ah + 755 compare dup?, 0 # false + 756 break-if-!= $copy-unbound-words-to-args:loop-iter + 757 # push copy of curr before dest-ah + 758 var rest-h: (handle word) + 759 var rest-ah/ecx: (addr handle word) <- address rest-h + 760 copy-object dest-ah, rest-ah + 761 copy-word curr, dest-ah + 762 chain-words dest-ah, rest-ah + 763 } + 764 var next-ah/ecx: (addr handle word) <- get curr, next + 765 curr <- lookup *next-ah + 766 loop + 767 } + 768 } + 769 + 770 fn bound-function? w: (addr word), functions-ah: (addr handle function) -> _/ebx: boolean { + 771 var result/ebx: boolean <- copy 1 # true + 772 { + 773 ## numbers + 774 # if w == "+" return true + 775 var subresult/eax: boolean <- word-equal? w, "+" 776 compare subresult, 0 # false 777 break-if-!= - 778 # if w == "len" return true - 779 subresult <- word-equal? w, "len" + 778 # if w == "-" return true + 779 subresult <- word-equal? w, "-" 780 compare subresult, 0 # false 781 break-if-!= - 782 # if w == "open" return true - 783 subresult <- word-equal? w, "open" + 782 # if w == "*" return true + 783 subresult <- word-equal? w, "*" 784 compare subresult, 0 # false 785 break-if-!= - 786 # if w == "read" return true - 787 subresult <- word-equal? w, "read" - 788 compare subresult, 0 # false - 789 break-if-!= - 790 # if w == "slurp" return true - 791 subresult <- word-equal? w, "slurp" - 792 compare subresult, 0 # false - 793 break-if-!= - 794 # if w == "lines" return true - 795 subresult <- word-equal? w, "lines" - 796 compare subresult, 0 # false - 797 break-if-!= - 798 # if w == "dup" return true - 799 subresult <- word-equal? w, "dup" - 800 compare subresult, 0 # false - 801 break-if-!= - 802 # if w == "swap" return true - 803 subresult <- word-equal? w, "swap" - 804 compare subresult, 0 # false - 805 break-if-!= - 806 # return w in functions - 807 var out-h: (handle function) - 808 var out/eax: (addr handle function) <- address out-h - 809 callee functions-ah, w, out - 810 var found?/eax: (addr function) <- lookup *out - 811 result <- copy found? - 812 } - 813 return result - 814 } - 815 - 816 fn arg-exists? _f-ah: (addr handle function), arg: (addr word) -> _/ebx: boolean { - 817 var f-ah/eax: (addr handle function) <- copy _f-ah - 818 var f/eax: (addr function) <- lookup *f-ah - 819 var args-ah/eax: (addr handle word) <- get f, args - 820 var result/ebx: boolean <- word-exists? args-ah, arg - 821 return result - 822 } - 823 - 824 # construct a call to `f` with copies of exactly its args - 825 fn construct-call _f-ah: (addr handle function), _dest-ah: (addr handle word) { - 826 var f-ah/eax: (addr handle function) <- copy _f-ah - 827 var _f/eax: (addr function) <- lookup *f-ah - 828 var f/esi: (addr function) <- copy _f - 829 # append args in reverse - 830 var args-ah/eax: (addr handle word) <- get f, args - 831 var dest-ah/edi: (addr handle word) <- copy _dest-ah - 832 copy-words-in-reverse args-ah, dest-ah - 833 # append name - 834 var name-ah/eax: (addr handle array byte) <- get f, name - 835 var name/eax: (addr array byte) <- lookup *name-ah - 836 append-word-at-end-with dest-ah, name - 837 } - 838 - 839 fn word-index _words: (addr handle word), _n: int, out: (addr handle word) { - 840 $word-index:body: { - 841 var n/ecx: int <- copy _n - 842 { - 843 compare n, 0 - 844 break-if-!= - 845 copy-object _words, out - 846 break $word-index:body - 847 } - 848 var words-ah/eax: (addr handle word) <- copy _words - 849 var words/eax: (addr word) <- lookup *words-ah - 850 var next/eax: (addr handle word) <- get words, next - 851 n <- decrement - 852 word-index next, n, out - 853 } + 786 ## strings/arrays + 787 # if w == "len" return true + 788 subresult <- word-equal? w, "len" + 789 compare subresult, 0 # false + 790 break-if-!= + 791 ## files + 792 # if w == "open" return true + 793 subresult <- word-equal? w, "open" + 794 compare subresult, 0 # false + 795 break-if-!= + 796 # if w == "read" return true + 797 subresult <- word-equal? w, "read" + 798 compare subresult, 0 # false + 799 break-if-!= + 800 # if w == "slurp" return true + 801 subresult <- word-equal? w, "slurp" + 802 compare subresult, 0 # false + 803 break-if-!= + 804 # if w == "lines" return true + 805 subresult <- word-equal? w, "lines" + 806 compare subresult, 0 # false + 807 break-if-!= + 808 ## screens + 809 # if w == "fake-screen" return true + 810 subresult <- word-equal? w, "fake-screen" + 811 compare subresult, 0 # false + 812 break-if-!= + 813 # if w == "print" return true + 814 subresult <- word-equal? w, "print" + 815 compare subresult, 0 # false + 816 break-if-!= + 817 # if w == "move" return true + 818 subresult <- word-equal? w, "move" + 819 compare subresult, 0 # false + 820 break-if-!= + 821 # if w == "up" return true + 822 subresult <- word-equal? w, "up" + 823 compare subresult, 0 # false + 824 break-if-!= + 825 # if w == "down" return true + 826 subresult <- word-equal? w, "down" + 827 compare subresult, 0 # false + 828 break-if-!= + 829 # if w == "left" return true + 830 subresult <- word-equal? w, "left" + 831 compare subresult, 0 # false + 832 break-if-!= + 833 # if w == "right" return true + 834 subresult <- word-equal? w, "right" + 835 compare subresult, 0 # false + 836 break-if-!= + 837 ## hacks + 838 # if w == "dup" return true + 839 subresult <- word-equal? w, "dup" + 840 compare subresult, 0 # false + 841 break-if-!= + 842 # if w == "swap" return true + 843 subresult <- word-equal? w, "swap" + 844 compare subresult, 0 # false + 845 break-if-!= + 846 # return w in functions + 847 var out-h: (handle function) + 848 var out/eax: (addr handle function) <- address out-h + 849 callee functions-ah, w, out + 850 var found?/eax: (addr function) <- lookup *out + 851 result <- copy found? + 852 } + 853 return result 854 } 855 - 856 fn toggle-cursor-word _sandbox: (addr sandbox) { - 857 $toggle-cursor-word:body: { - 858 var sandbox/esi: (addr sandbox) <- copy _sandbox - 859 var expanded-words/edi: (addr handle call-path) <- get sandbox, expanded-words - 860 var cursor-call-path/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path - 861 #? print-string 0, "cursor call path: " - 862 #? dump-call-path-element 0, cursor-call-path - 863 #? print-string 0, "expanded words:\n" - 864 #? dump-call-paths 0, expanded-words - 865 var already-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path - 866 compare already-expanded?, 0 # false - 867 { - 868 break-if-!= - 869 #? print-string 0, "expand\n" - 870 # if not already-expanded, insert - 871 insert-in-call-path expanded-words cursor-call-path - 872 #? print-string 0, "expanded words now:\n" - 873 #? dump-call-paths 0, expanded-words - 874 break $toggle-cursor-word:body - 875 } - 876 { - 877 break-if-= - 878 # otherwise delete - 879 delete-in-call-path expanded-words cursor-call-path - 880 } - 881 } - 882 } - 883 - 884 ############# - 885 # Visualize - 886 ############# - 887 - 888 fn evaluate-environment _env: (addr environment), stack: (addr value-stack) { - 889 var env/esi: (addr environment) <- copy _env - 890 # functions - 891 var functions/edx: (addr handle function) <- get env, functions - 892 # line - 893 var sandbox-ah/esi: (addr handle sandbox) <- get env, sandboxes - 894 var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah - 895 var line-ah/eax: (addr handle line) <- get sandbox, data - 896 var _line/eax: (addr line) <- lookup *line-ah - 897 var line/esi: (addr line) <- copy _line - 898 evaluate functions, 0, line, 0, stack - 899 } - 900 - 901 fn render _env: (addr environment) { - 902 #? print-string 0, "==\n" - 903 var env/esi: (addr environment) <- copy _env - 904 clear-canvas env - 905 # screen - 906 var screen-ah/eax: (addr handle screen) <- get env, screen - 907 var _screen/eax: (addr screen) <- lookup *screen-ah - 908 var screen/edi: (addr screen) <- copy _screen - 909 # repl-col - 910 var _repl-col/eax: (addr int) <- get env, code-separator-col - 911 var repl-col/ecx: int <- copy *_repl-col - 912 repl-col <- add 2 # repl-margin-left - 913 # functions - 914 var functions/edx: (addr handle function) <- get env, functions - 915 # sandbox - 916 var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes - 917 var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah - 918 #? { - 919 #? var line-ah/eax: (addr handle line) <- get sandbox, data - 920 #? var line/eax: (addr line) <- lookup *line-ah - 921 #? var first-word-ah/eax: (addr handle word) <- get line, data - 922 #? var curr-word/eax: (addr word) <- lookup *first-word-ah - 923 #? print-word 0, curr-word - 924 #? print-string 0, "\n" - 925 #? } - 926 # bindings - 927 var bindings-storage: table - 928 var bindings/ebx: (addr table) <- address bindings-storage - 929 initialize-table bindings, 0x10 - 930 render-sandbox screen, functions, bindings, sandbox, 3, repl-col - 931 } - 932 - 933 fn render-sandbox screen: (addr screen), functions: (addr handle function), bindings: (addr table), _sandbox: (addr sandbox), top-row: int, left-col: int { - 934 var sandbox/esi: (addr sandbox) <- copy _sandbox - 935 # line - 936 var curr-line-ah/eax: (addr handle line) <- get sandbox, data - 937 var _curr-line/eax: (addr line) <- lookup *curr-line-ah - 938 var curr-line/ecx: (addr line) <- copy _curr-line - 939 # - 940 var curr-row/edx: int <- copy top-row - 941 # cursor row, col - 942 var cursor-row: int - 943 var cursor-row-addr: (addr int) - 944 var tmp/eax: (addr int) <- address cursor-row - 945 copy-to cursor-row-addr, tmp - 946 var cursor-col: int - 947 var cursor-col-addr: (addr int) - 948 tmp <- address cursor-col - 949 copy-to cursor-col-addr, tmp - 950 # render all but final line without stack - 951 #? print-string 0, "render all but final line\n" - 952 { - 953 var next-line-ah/eax: (addr handle line) <- get curr-line, next - 954 var next-line/eax: (addr line) <- lookup *next-line-ah - 955 compare next-line, 0 - 956 break-if-= - 957 { - 958 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 959 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 960 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word - 961 var cursor-word/eax: (addr word) <- lookup *cursor-word-ah - 962 #? print-string 0, "cursor 2: " - 963 #? { - 964 #? print-word 0, cursor-word - 965 #? print-string 0, " -- " - 966 #? var foo/eax: int <- copy cursor-word - 967 #? print-int32-hex 0, foo - 968 #? print-string 0, "\n" - 969 #? } - 970 # it's enough to pass in the first word of the path, because if the path isn't a singleton the word is guaranteed to be unique - 971 render-line-without-stack screen, curr-line, curr-row, left-col, cursor-word, cursor-row-addr, cursor-col-addr - 972 } - 973 curr-line <- copy next-line - 974 curr-row <- add 2 - 975 loop - 976 } - 977 # - 978 #? print-string 0, "render final line\n" - 979 render-final-line-with-stack screen, functions, bindings, sandbox, curr-row, left-col, cursor-row-addr, cursor-col-addr - 980 # at most one of the following dialogs will be rendered - 981 render-rename-dialog screen, sandbox, cursor-row, cursor-col - 982 render-define-dialog screen, sandbox, cursor-row, cursor-col - 983 move-cursor screen, cursor-row, cursor-col - 984 } - 985 - 986 fn render-final-line-with-stack screen: (addr screen), functions: (addr handle function), bindings: (addr table), _sandbox: (addr sandbox), top-row: int, left-col: int, cursor-row-addr: (addr int), cursor-col-addr: (addr int) { - 987 var sandbox/esi: (addr sandbox) <- copy _sandbox - 988 # expanded-words - 989 var expanded-words/edi: (addr handle call-path) <- get sandbox, expanded-words - 990 # cursor-word - 991 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path - 992 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah - 993 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word - 994 var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah - 995 var cursor-word/ebx: (addr word) <- copy _cursor-word - 996 #? print-string 0, "word at cursor: " - 997 #? print-word 0, cursor-word - 998 #? print-string 0, "\n" - 999 # cursor-call-path -1000 var cursor-call-path: (addr handle call-path-element) -1001 { -1002 var src/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path -1003 copy-to cursor-call-path, src -1004 } -1005 # first line -1006 var first-line-ah/eax: (addr handle line) <- get sandbox, data -1007 var _first-line/eax: (addr line) <- lookup *first-line-ah -1008 var first-line/edx: (addr line) <- copy _first-line -1009 # final line -1010 var final-line-storage: (handle line) -1011 var final-line-ah/eax: (addr handle line) <- address final-line-storage -1012 final-line sandbox, final-line-ah -1013 var final-line/eax: (addr line) <- lookup *final-line-ah -1014 # curr-path -1015 var curr-path-storage: (handle call-path-element) -1016 var curr-path/ecx: (addr handle call-path-element) <- address curr-path-storage -1017 allocate curr-path # leak -1018 initialize-path-from-line final-line, curr-path -1019 # -1020 var dummy/ecx: int <- render-line screen, functions, bindings, first-line, final-line, expanded-words, top-row, left-col, curr-path, cursor-word, cursor-call-path, cursor-row-addr, cursor-col-addr -1021 } -1022 -1023 fn final-line _sandbox: (addr sandbox), out: (addr handle line) { -1024 var sandbox/esi: (addr sandbox) <- copy _sandbox -1025 var curr-line-ah/ecx: (addr handle line) <- get sandbox, data -1026 { -1027 var curr-line/eax: (addr line) <- lookup *curr-line-ah -1028 var next-line-ah/edx: (addr handle line) <- get curr-line, next -1029 var next-line/eax: (addr line) <- lookup *next-line-ah -1030 compare next-line, 0 -1031 break-if-= -1032 curr-line-ah <- copy next-line-ah -1033 loop -1034 } -1035 copy-object curr-line-ah, out -1036 } -1037 -1038 fn render-rename-dialog screen: (addr screen), _sandbox: (addr sandbox), cursor-row: int, cursor-col: int { -1039 var sandbox/edi: (addr sandbox) <- copy _sandbox -1040 var rename-word-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-cursor-word -1041 var rename-word-mode?/eax: (addr word) <- lookup *rename-word-mode-ah? -1042 compare rename-word-mode?, 0 -1043 break-if-= -1044 # clear a space for the dialog -1045 var top-row/eax: int <- copy cursor-row -1046 top-row <- subtract 3 -1047 var bottom-row/ecx: int <- copy cursor-row -1048 bottom-row <- add 3 -1049 var left-col/edx: int <- copy cursor-col -1050 left-col <- subtract 0x10 -1051 var right-col/ebx: int <- copy cursor-col -1052 right-col <- add 0x10 -1053 clear-rect screen, top-row, left-col, bottom-row, right-col -1054 draw-box screen, top-row, left-col, bottom-row, right-col -1055 # render a little menu for the dialog -1056 var menu-row/ecx: int <- copy bottom-row -1057 menu-row <- decrement -1058 var menu-col/edx: int <- copy left-col -1059 menu-col <- add 2 -1060 move-cursor screen, menu-row, menu-col -1061 start-reverse-video screen -1062 print-string screen, " esc " -1063 reset-formatting screen -1064 print-string screen, " cancel " -1065 start-reverse-video screen -1066 print-string screen, " enter " -1067 reset-formatting screen -1068 print-string screen, " rename " -1069 # draw the word, positioned appropriately around the cursor -1070 var start-col/ecx: int <- copy cursor-col -1071 var word-ah?/edx: (addr handle word) <- get sandbox, partial-name-for-cursor-word -1072 var word/eax: (addr word) <- lookup *word-ah? -1073 var cursor-index/eax: int <- cursor-index word -1074 start-col <- subtract cursor-index -1075 move-cursor screen, cursor-row, start-col -1076 var word/eax: (addr word) <- lookup *word-ah? -1077 print-word screen, word -1078 } -1079 -1080 fn render-define-dialog screen: (addr screen), _sandbox: (addr sandbox), cursor-row: int, cursor-col: int { -1081 var sandbox/edi: (addr sandbox) <- copy _sandbox -1082 var define-function-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-function -1083 var define-function-mode?/eax: (addr word) <- lookup *define-function-mode-ah? -1084 compare define-function-mode?, 0 -1085 break-if-= -1086 # clear a space for the dialog -1087 var top-row/eax: int <- copy cursor-row -1088 top-row <- subtract 3 -1089 var bottom-row/ecx: int <- copy cursor-row -1090 bottom-row <- add 3 -1091 var left-col/edx: int <- copy cursor-col -1092 left-col <- subtract 0x10 -1093 var right-col/ebx: int <- copy cursor-col -1094 right-col <- add 0x10 -1095 clear-rect screen, top-row, left-col, bottom-row, right-col -1096 draw-box screen, top-row, left-col, bottom-row, right-col -1097 # render a little menu for the dialog -1098 var menu-row/ecx: int <- copy bottom-row -1099 menu-row <- decrement -1100 var menu-col/edx: int <- copy left-col -1101 menu-col <- add 2 -1102 move-cursor screen, menu-row, menu-col -1103 start-reverse-video screen -1104 print-string screen, " esc " -1105 reset-formatting screen -1106 print-string screen, " cancel " -1107 start-reverse-video screen -1108 print-string screen, " enter " -1109 reset-formatting screen -1110 print-string screen, " define " -1111 # draw the word, positioned appropriately around the cursor -1112 var start-col/ecx: int <- copy cursor-col -1113 var word-ah?/edx: (addr handle word) <- get sandbox, partial-name-for-function -1114 var word/eax: (addr word) <- lookup *word-ah? -1115 var cursor-index/eax: int <- cursor-index word -1116 start-col <- subtract cursor-index -1117 move-cursor screen, cursor-row, start-col -1118 var word/eax: (addr word) <- lookup *word-ah? -1119 print-word screen, word -1120 } -1121 -1122 # Render just the words in 'line'. -1123 fn render-line-without-stack screen: (addr screen), _line: (addr line), curr-row: int, left-col: int, cursor-word: (addr word), cursor-row-addr: (addr int), cursor-col-addr: (addr int) { -1124 # curr-word -1125 var line/eax: (addr line) <- copy _line -1126 var first-word-ah/eax: (addr handle word) <- get line, data -1127 var _curr-word/eax: (addr word) <- lookup *first-word-ah -1128 var curr-word/esi: (addr word) <- copy _curr-word -1129 # -1130 # loop-carried dependency -1131 var curr-col/ecx: int <- copy left-col -1132 # -1133 { -1134 compare curr-word, 0 -1135 break-if-= -1136 #? print-string 0, "-- word in penultimate lines: " -1137 #? { -1138 #? var foo/eax: int <- copy curr-word -1139 #? print-int32-hex 0, foo -1140 #? } -1141 #? print-string 0, "\n" -1142 var old-col/edx: int <- copy curr-col -1143 reset-formatting screen -1144 move-cursor screen, curr-row, curr-col -1145 print-word screen, curr-word -1146 { -1147 var max-width/eax: int <- word-length curr-word -1148 curr-col <- add max-width -1149 curr-col <- add 1 # margin-right -1150 } -1151 # cache cursor column if necessary -1152 { -1153 compare curr-word, cursor-word -1154 break-if-!= -1155 #? print-string 0, "Cursor at " -1156 #? print-int32-decimal 0, curr-row -1157 #? print-string 0, ", " -1158 #? print-int32-decimal 0, old-col -1159 #? print-string 0, "\n" -1160 #? print-string 0, "contents: " -1161 #? print-word 0, cursor-word -1162 #? print-string 0, "\n" -1163 #? { -1164 #? var foo/eax: int <- copy cursor-word -1165 #? print-int32-hex 0, foo -1166 #? print-string 0, "\n" -1167 #? } -1168 var dest/ecx: (addr int) <- copy cursor-row-addr -1169 var src/eax: int <- copy curr-row -1170 copy-to *dest, src -1171 dest <- copy cursor-col-addr -1172 copy-to *dest, old-col -1173 var cursor-index-in-word/eax: int <- cursor-index curr-word -1174 add-to *dest, cursor-index-in-word -1175 } -1176 # loop update -1177 var next-word-ah/edx: (addr handle word) <- get curr-word, next -1178 var _curr-word/eax: (addr word) <- lookup *next-word-ah -1179 curr-word <- copy _curr-word -1180 loop -1181 } -1182 } -1183 -1184 fn call-depth-at-cursor _sandbox: (addr sandbox) -> _/eax: int { -1185 var sandbox/esi: (addr sandbox) <- copy _sandbox -1186 var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path -1187 var result/eax: int <- call-path-element-length cursor-call-path -1188 result <- add 2 # input-row - 1 -1189 return result -1190 } -1191 -1192 fn call-path-element-length _x: (addr handle call-path-element) -> _/eax: int { -1193 var curr-ah/ecx: (addr handle call-path-element) <- copy _x -1194 var result/edi: int <- copy 0 -1195 { -1196 var curr/eax: (addr call-path-element) <- lookup *curr-ah -1197 compare curr, 0 -1198 break-if-= -1199 curr-ah <- get curr, next -1200 result <- increment -1201 loop -1202 } -1203 return result -1204 } -1205 -1206 # Render the line of words in line, along with the state of the stack under each word. -1207 # Also render any expanded function calls using recursive calls. -1208 # -1209 # Along the way, compute the column the cursor should be positioned at (cursor-col-addr). -1210 fn render-line screen: (addr screen), functions: (addr handle function), bindings: (addr table), first-line: (addr line), _line: (addr line), expanded-words: (addr handle call-path), top-row: int, left-col: int, curr-path: (addr handle call-path-element), cursor-word: (addr word), cursor-call-path: (addr handle call-path-element), cursor-row-addr: (addr int), cursor-col-addr: (addr int) -> _/ecx: int { -1211 #? print-string 0, "--\n" -1212 # curr-word -1213 var line/esi: (addr line) <- copy _line -1214 var first-word-ah/eax: (addr handle word) <- get line, data -1215 var curr-word/eax: (addr word) <- lookup *first-word-ah -1216 var debug-row: int -1217 copy-to debug-row, 0x20 -1218 # -1219 # loop-carried dependency -1220 var curr-col/ecx: int <- copy left-col -1221 # -1222 { -1223 compare curr-word, 0 -1224 break-if-= -1225 #? print-string 0, "-- word in final line: " -1226 #? { -1227 #? var foo/eax: int <- copy curr-word -1228 #? print-int32-hex 0, foo -1229 #? } -1230 #? print-string 0, "\n" -1231 # if necessary, first render columns for subsidiary stack -1232 $render-line:subsidiary: { -1233 { -1234 #? print-string 0, "check sub\n" -1235 var display-subsidiary-stack?/eax: boolean <- find-in-call-paths expanded-words, curr-path -1236 compare display-subsidiary-stack?, 0 # false -1237 break-if-= $render-line:subsidiary -1238 } -1239 #? print-string 0, "render subsidiary stack\n" -1240 # does function exist? -1241 var callee/edi: (addr function) <- copy 0 -1242 { -1243 var callee-h: (handle function) -1244 var callee-ah/ecx: (addr handle function) <- address callee-h -1245 callee functions, curr-word, callee-ah -1246 var _callee/eax: (addr function) <- lookup *callee-ah -1247 callee <- copy _callee -1248 compare callee, 0 -1249 break-if-= $render-line:subsidiary -1250 } -1251 move-cursor screen, top-row, curr-col -1252 start-color screen, 8, 7 -1253 print-word screen, curr-word -1254 { -1255 var word-len/eax: int <- word-length curr-word -1256 curr-col <- add word-len -1257 curr-col <- add 2 -1258 increment top-row -1259 } -1260 # obtain stack at call site -1261 var stack-storage: value-stack -1262 var stack/edx: (addr value-stack) <- address stack-storage -1263 initialize-value-stack stack, 0x10 -1264 { -1265 var prev-word-ah/eax: (addr handle word) <- get curr-word, prev -1266 var prev-word/eax: (addr word) <- lookup *prev-word-ah -1267 compare prev-word, 0 -1268 break-if-= -1269 evaluate functions, bindings, line, prev-word, stack -1270 } -1271 # construct new bindings -1272 var callee-bindings-storage: table -1273 var callee-bindings/esi: (addr table) <- address callee-bindings-storage -1274 initialize-table callee-bindings, 0x10 -1275 bind-args callee, stack, callee-bindings -1276 # obtain body -1277 var callee-body-ah/eax: (addr handle line) <- get callee, body -1278 var callee-body/eax: (addr line) <- lookup *callee-body-ah -1279 var callee-body-first-word/edx: (addr handle word) <- get callee-body, data -1280 # - render subsidiary stack -1281 push-to-call-path-element curr-path, callee-body-first-word # leak -1282 curr-col <- render-line screen, functions, callee-bindings, callee-body, callee-body, expanded-words, top-row, curr-col, curr-path, cursor-word, cursor-call-path, cursor-row-addr, cursor-col-addr -1283 drop-from-call-path-element curr-path -1284 # -1285 move-cursor screen, top-row, curr-col -1286 print-code-point screen, 0x21d7 # ⇗ -1287 # -1288 curr-col <- add 2 -1289 decrement top-row -1290 } -1291 # render main column -1292 var old-col/edx: int <- copy curr-col -1293 #? move-cursor 0, debug-row, 1 -1294 #? increment debug-row -1295 #? print-string 0, "rendering column from " -1296 #? print-int32-decimal 0, curr-col -1297 #? print-string 0, "\n" -1298 curr-col <- render-column screen, functions, bindings, first-line, line, curr-word, top-row, curr-col -1299 # cache cursor column if necessary -1300 $render-line:cache-cursor-column: { -1301 #? print-string 0, "cache cursor? " -1302 #? { -1303 #? var foo/eax: int <- copy curr-word -1304 #? print-int32-hex 0, foo -1305 #? } -1306 #? print-string 0, "\n" -1307 { -1308 var found?/eax: boolean <- call-path-element-match? curr-path, cursor-call-path -1309 compare found?, 0 # false -1310 break-if-= $render-line:cache-cursor-column -1311 } -1312 #? print-string 0, "cursor at " -1313 #? print-int32-decimal 0, top-row -1314 #? print-string 0, ", " -1315 #? print-int32-decimal 0, old-col -1316 #? print-string 0, "\n" -1317 var dest/edi: (addr int) <- copy cursor-row-addr -1318 { -1319 var src/eax: int <- copy top-row -1320 copy-to *dest, src -1321 } -1322 dest <- copy cursor-col-addr -1323 copy-to *dest, old-col -1324 var cursor-index-in-word/eax: int <- cursor-index curr-word -1325 add-to *dest, cursor-index-in-word -1326 } -1327 # loop update -1328 #? print-string 0, "next word\n" -1329 var next-word-ah/edx: (addr handle word) <- get curr-word, next -1330 curr-word <- lookup *next-word-ah -1331 #? { -1332 #? var foo/eax: int <- copy curr-word -1333 #? print-int32-hex 0, foo -1334 #? print-string 0, "\n" -1335 #? } -1336 increment-final-element curr-path -1337 loop -1338 } -1339 return curr-col -1340 } -1341 -1342 fn callee functions: (addr handle function), word: (addr word), out: (addr handle function) { -1343 var stream-storage: (stream byte 0x10) -1344 var stream/esi: (addr stream byte) <- address stream-storage -1345 emit-word word, stream -1346 find-function functions, stream, out -1347 } -1348 -1349 # Render: -1350 # - starting at top-row, left-col: final-word -1351 # - starting somewhere below at left-col: the stack result from interpreting first-world to final-word (inclusive) -1352 # -1353 # Return the farthest column written. -1354 fn render-column screen: (addr screen), functions: (addr handle function), bindings: (addr table), first-line: (addr line), line: (addr line), final-word: (addr word), top-row: int, left-col: int -> _/ecx: int { -1355 #? print-string 0, "render-column\n" -1356 var max-width/esi: int <- copy 0 -1357 { -1358 # indent stack -1359 var indented-col/ebx: int <- copy left-col -1360 indented-col <- add 1 # margin-right -1361 # compute stack -1362 var stack: value-stack -1363 var stack-addr/edi: (addr value-stack) <- address stack -1364 initialize-value-stack stack-addr, 0x10 # max-words -1365 evaluate functions, bindings, first-line, final-word, stack-addr -1366 # render stack -1367 var curr-row/edx: int <- copy top-row -1368 curr-row <- add 2 # stack-margin-top -1369 var _max-width/eax: int <- value-stack-max-width stack-addr -1370 max-width <- copy _max-width -1371 { -1372 var top-addr/ecx: (addr int) <- get stack-addr, top -1373 compare *top-addr, 0 -1374 break-if-<= -1375 decrement *top-addr -1376 move-cursor screen, curr-row, indented-col -1377 { -1378 var data-ah/eax: (addr handle array value) <- get stack-addr, data -1379 var data/eax: (addr array value) <- lookup *data-ah -1380 var top/edx: int <- copy *top-addr -1381 var dest-offset/edx: (offset value) <- compute-offset data, top -1382 var val/eax: (addr value) <- index data, dest-offset -1383 render-value screen, val, max-width -1384 } -1385 curr-row <- increment -1386 loop -1387 } -1388 } -1389 -1390 max-width <- add 2 # spaces on either side of items on the stack -1391 -1392 # render word, initialize result -1393 reset-formatting screen -1394 move-cursor screen, top-row, left-col -1395 print-word screen, final-word -1396 { -1397 var size/eax: int <- word-length final-word -1398 compare size, max-width -1399 break-if-<= -1400 max-width <- copy size -1401 } -1402 -1403 # post-process right-col -1404 var right-col/ecx: int <- copy left-col -1405 right-col <- add max-width -1406 right-col <- add 1 # margin-right -1407 #? print-int32-decimal 0, left-col -1408 #? print-string 0, " => " -1409 #? print-int32-decimal 0, right-col -1410 #? print-string 0, "\n" -1411 return right-col -1412 } -1413 -1414 fn render-value screen: (addr screen), _val: (addr value), max-width: int { -1415 $render-value:body: { -1416 var val/esi: (addr value) <- copy _val -1417 var val-type/ecx: (addr int) <- get val, type -1418 # per-type rendering logic goes here -1419 compare *val-type, 1 # string -1420 { -1421 break-if-!= -1422 var val-ah/eax: (addr handle array byte) <- get val, text-data -1423 var val-string/eax: (addr array byte) <- lookup *val-ah -1424 compare val-string, 0 -1425 break-if-= -1426 var orig-len/ecx: int <- length val-string -1427 var truncated: (handle array byte) -1428 var truncated-ah/esi: (addr handle array byte) <- address truncated -1429 substring val-string, 0, 0xc, truncated-ah -1430 var truncated-string/eax: (addr array byte) <- lookup *truncated-ah -1431 #? { -1432 #? var foo/eax: int <- copy truncated-string -1433 #? print-int32-hex 0, foo -1434 #? print-string 0, "\n" -1435 #? } -1436 var len/edx: int <- length truncated-string -1437 start-color screen, 0xf2, 7 -1438 print-code-point screen, 0x275d # open-quote -1439 print-string screen, truncated-string -1440 compare len, orig-len -1441 { -1442 break-if-= -1443 print-code-point screen, 0x2026 # ellipses -1444 } -1445 print-code-point screen, 0x275e # close-quote -1446 reset-formatting screen -1447 break $render-value:body -1448 } -1449 compare *val-type, 2 # array -1450 { -1451 break-if-!= -1452 var val-ah/eax: (addr handle array value) <- get val, array-data -1453 var val-array/eax: (addr array value) <- lookup *val-ah -1454 render-array screen, val-array -1455 break $render-value:body -1456 } -1457 compare *val-type, 3 # file -1458 { -1459 break-if-!= -1460 var val-ah/eax: (addr handle buffered-file) <- get val, file-data -1461 var val-file/eax: (addr buffered-file) <- lookup *val-ah -1462 start-color screen, 0, 7 -1463 # TODO -1464 print-string screen, " FILE " -1465 break $render-value:body -1466 } -1467 # render ints by default for now -1468 var val-int/eax: (addr int) <- get val, int-data -1469 render-integer screen, *val-int, max-width -1470 } -1471 } -1472 -1473 # synaesthesia -1474 fn render-integer screen: (addr screen), val: int, max-width: int { -1475 $render-integer:body: { -1476 # if max-width is 0, we're inside an array. No coloring. -1477 compare max-width, 0 -1478 { -1479 break-if-!= -1480 print-int32-decimal screen, val -1481 break $render-integer:body -1482 } -1483 var bg/eax: int <- hash-color val -1484 var fg/ecx: int <- copy 7 -1485 { -1486 compare bg, 2 -1487 break-if-!= -1488 fg <- copy 0 -1489 } -1490 { -1491 compare bg, 3 -1492 break-if-!= -1493 fg <- copy 0 -1494 } -1495 { -1496 compare bg, 6 -1497 break-if-!= -1498 fg <- copy 0 -1499 } -1500 start-color screen, fg, bg -1501 print-grapheme screen, 0x20 # space -1502 print-int32-decimal-right-justified screen, val, max-width -1503 print-grapheme screen, 0x20 # space -1504 } -1505 } -1506 -1507 fn render-array screen: (addr screen), _a: (addr array value) { -1508 start-color screen, 0xf2, 7 -1509 # don't surround in spaces -1510 print-grapheme screen, 0x5b # '[' -1511 var a/esi: (addr array value) <- copy _a -1512 var max/ecx: int <- length a -1513 var i/eax: int <- copy 0 -1514 { -1515 compare i, max -1516 break-if->= -1517 { -1518 compare i, 0 -1519 break-if-= -1520 print-string screen, " " -1521 } -1522 var off/ecx: (offset value) <- compute-offset a, i -1523 var x/ecx: (addr value) <- index a, off -1524 render-value screen, x, 0 -1525 i <- increment -1526 loop -1527 } -1528 print-grapheme screen, 0x5d # ']' -1529 } -1530 -1531 fn hash-color val: int -> _/eax: int { -1532 var result/eax: int <- try-modulo val, 7 # assumes that 7 is always the background color -1533 return result -1534 } -1535 -1536 fn clear-canvas _env: (addr environment) { -1537 var env/esi: (addr environment) <- copy _env -1538 var screen-ah/edi: (addr handle screen) <- get env, screen -1539 var _screen/eax: (addr screen) <- lookup *screen-ah -1540 var screen/edi: (addr screen) <- copy _screen -1541 clear-screen screen -1542 var nrows/eax: (addr int) <- get env, nrows -1543 var _repl-col/ecx: (addr int) <- get env, code-separator-col -1544 var repl-col/ecx: int <- copy *_repl-col -1545 draw-vertical-line screen, 1, *nrows, repl-col -1546 # wordstar-style cheatsheet of shortcuts -1547 move-cursor screen, *nrows, 0 -1548 start-reverse-video screen -1549 print-string screen, " ctrl-q " -1550 reset-formatting screen -1551 print-string screen, " quit " -1552 var menu-start/ebx: int <- copy repl-col -1553 menu-start <- subtract 0x40 # 64 = half the size of the menu -1554 move-cursor screen, *nrows, menu-start -1555 start-reverse-video screen -1556 print-string screen, " ctrl-a " -1557 reset-formatting screen -1558 print-string screen, " ⏮ " -1559 start-reverse-video screen -1560 print-string screen, " ctrl-b " -1561 reset-formatting screen -1562 print-string screen, " ◀ word " -1563 start-reverse-video screen -1564 print-string screen, " ctrl-f " -1565 reset-formatting screen -1566 print-string screen, " word ▶ " -1567 start-reverse-video screen -1568 print-string screen, " ctrl-e " -1569 reset-formatting screen -1570 print-string screen, " ⏭ " -1571 start-reverse-video screen -1572 print-string screen, " ctrl-u " -1573 reset-formatting screen -1574 print-string screen, " clear line " -1575 start-reverse-video screen -1576 print-string screen, " ctrl-n " -1577 reset-formatting screen -1578 print-string screen, " name value " -1579 start-reverse-video screen -1580 print-string screen, " ctrl-d " -1581 reset-formatting screen -1582 print-string screen, " define function " -1583 # primitives -1584 var start-col/ecx: int <- copy repl-col -1585 start-col <- subtract 0x20 -1586 move-cursor screen, 1, start-col -1587 print-string screen, "primitives:" -1588 start-col <- add 2 -1589 move-cursor screen, 2, start-col -1590 print-string screen, "+ - * len" -1591 move-cursor screen, 3, start-col -1592 print-string screen, "open read slurp lines" -1593 move-cursor screen, 4, start-col -1594 print-string screen, "dup swap" -1595 # currently defined functions -1596 start-col <- subtract 2 -1597 move-cursor screen, 6, start-col -1598 print-string screen, "functions:" -1599 start-col <- add 2 -1600 var row/ebx: int <- copy 7 -1601 var functions/esi: (addr handle function) <- get env, functions -1602 { -1603 var curr/eax: (addr function) <- lookup *functions -1604 compare curr, 0 -1605 break-if-= -1606 row <- render-function screen, row, start-col, curr -1607 functions <- get curr, next -1608 row <- increment -1609 loop -1610 } -1611 } -1612 -1613 # only single-line functions supported for now -1614 fn render-function screen: (addr screen), row: int, col: int, _f: (addr function) -> _/ebx: int { -1615 var f/esi: (addr function) <- copy _f -1616 var args/ecx: (addr handle word) <- get f, args -1617 move-cursor screen, row, col -1618 print-words-in-reverse screen, args -1619 var name-ah/eax: (addr handle array byte) <- get f, name -1620 var name/eax: (addr array byte) <- lookup *name-ah -1621 start-bold screen -1622 print-string screen, name -1623 reset-formatting screen -1624 increment row -1625 add-to col, 2 -1626 move-cursor screen, row, col -1627 print-string screen, "= " -1628 var body-ah/eax: (addr handle line) <- get f, body -1629 var body/eax: (addr line) <- lookup *body-ah -1630 var body-words-ah/eax: (addr handle word) <- get body, data -1631 print-words screen, body-words-ah -1632 return row -1633 } -1634 -1635 fn real-grapheme? g: grapheme -> _/eax: boolean { -1636 # if g == newline return true -1637 compare g, 0xa -1638 { -1639 break-if-!= -1640 return 1 # true -1641 } -1642 # if g == tab return true -1643 compare g, 9 -1644 { -1645 break-if-!= -1646 return 1 # true -1647 } -1648 # if g < 32 return false -1649 compare g, 0x20 -1650 { -1651 break-if->= -1652 return 0 # false -1653 } -1654 # if g <= 255 return true -1655 compare g, 0xff -1656 { -1657 break-if-> -1658 return 1 # true -1659 } -1660 # if (g&0xff == Esc) it's an escape sequence -1661 and-with g, 0xff -1662 compare g, 0x1b # Esc -1663 { -1664 break-if-!= -1665 return 0 # false -1666 } -1667 # otherwise return true -1668 return 1 # true -1669 } + 856 fn arg-exists? _f-ah: (addr handle function), arg: (addr word) -> _/ebx: boolean { + 857 var f-ah/eax: (addr handle function) <- copy _f-ah + 858 var f/eax: (addr function) <- lookup *f-ah + 859 var args-ah/eax: (addr handle word) <- get f, args + 860 var result/ebx: boolean <- word-exists? args-ah, arg + 861 return result + 862 } + 863 + 864 # construct a call to `f` with copies of exactly its args + 865 fn construct-call _f-ah: (addr handle function), _dest-ah: (addr handle word) { + 866 var f-ah/eax: (addr handle function) <- copy _f-ah + 867 var _f/eax: (addr function) <- lookup *f-ah + 868 var f/esi: (addr function) <- copy _f + 869 # append args in reverse + 870 var args-ah/eax: (addr handle word) <- get f, args + 871 var dest-ah/edi: (addr handle word) <- copy _dest-ah + 872 copy-words-in-reverse args-ah, dest-ah + 873 # append name + 874 var name-ah/eax: (addr handle array byte) <- get f, name + 875 var name/eax: (addr array byte) <- lookup *name-ah + 876 append-word-at-end-with dest-ah, name + 877 } + 878 + 879 fn word-index _words: (addr handle word), _n: int, out: (addr handle word) { + 880 $word-index:body: { + 881 var n/ecx: int <- copy _n + 882 { + 883 compare n, 0 + 884 break-if-!= + 885 copy-object _words, out + 886 break $word-index:body + 887 } + 888 var words-ah/eax: (addr handle word) <- copy _words + 889 var words/eax: (addr word) <- lookup *words-ah + 890 var next/eax: (addr handle word) <- get words, next + 891 n <- decrement + 892 word-index next, n, out + 893 } + 894 } + 895 + 896 fn toggle-cursor-word _sandbox: (addr sandbox) { + 897 $toggle-cursor-word:body: { + 898 var sandbox/esi: (addr sandbox) <- copy _sandbox + 899 var expanded-words/edi: (addr handle call-path) <- get sandbox, expanded-words + 900 var cursor-call-path/ecx: (addr handle call-path-element) <- get sandbox, cursor-call-path + 901 #? print-string 0, "cursor call path: " + 902 #? dump-call-path-element 0, cursor-call-path + 903 #? print-string 0, "expanded words:\n" + 904 #? dump-call-paths 0, expanded-words + 905 var already-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path + 906 compare already-expanded?, 0 # false + 907 { + 908 break-if-!= + 909 #? print-string 0, "expand\n" + 910 # if not already-expanded, insert + 911 insert-in-call-path expanded-words cursor-call-path + 912 #? print-string 0, "expanded words now:\n" + 913 #? dump-call-paths 0, expanded-words + 914 break $toggle-cursor-word:body + 915 } + 916 { + 917 break-if-= + 918 # otherwise delete + 919 delete-in-call-path expanded-words cursor-call-path + 920 } + 921 } + 922 } + 923 + 924 fn append-line _sandbox: (addr sandbox) { + 925 var sandbox/esi: (addr sandbox) <- copy _sandbox + 926 var line-ah/ecx: (addr handle line) <- get sandbox, data + 927 { + 928 var line/eax: (addr line) <- lookup *line-ah + 929 var next-line-ah/edx: (addr handle line) <- get line, next + 930 var next-line/eax: (addr line) <- lookup *next-line-ah + 931 compare next-line, 0 + 932 break-if-= + 933 line-ah <- copy next-line-ah + 934 loop + 935 } + 936 var line/eax: (addr line) <- lookup *line-ah + 937 var final-line-ah/edx: (addr handle line) <- get line, next + 938 allocate final-line-ah + 939 var final-line/eax: (addr line) <- lookup *final-line-ah + 940 initialize-line final-line + 941 var final-prev/eax: (addr handle line) <- get final-line, prev + 942 copy-object line-ah, final-prev + 943 # clear cursor + 944 var final-line/eax: (addr line) <- lookup *final-line-ah + 945 var word-ah/ecx: (addr handle word) <- get final-line, data + 946 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path + 947 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah + 948 var dest/eax: (addr handle word) <- get cursor-call-path, word + 949 copy-object word-ah, dest + 950 } + 951 + 952 ############# + 953 # Visualize + 954 ############# + 955 + 956 fn evaluate-environment _env: (addr environment), stack: (addr value-stack) { + 957 var env/esi: (addr environment) <- copy _env + 958 # functions + 959 var functions/edx: (addr handle function) <- get env, functions + 960 # line + 961 var sandbox-ah/esi: (addr handle sandbox) <- get env, sandboxes + 962 var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah + 963 var line-ah/eax: (addr handle line) <- get sandbox, data + 964 var _line/eax: (addr line) <- lookup *line-ah + 965 var line/esi: (addr line) <- copy _line + 966 evaluate functions, 0, line, 0, stack + 967 } + 968 + 969 fn render _env: (addr environment) { + 970 #? print-string 0, "== render\n" + 971 var env/esi: (addr environment) <- copy _env + 972 clear-canvas env + 973 # screen + 974 var screen-ah/eax: (addr handle screen) <- get env, screen + 975 var _screen/eax: (addr screen) <- lookup *screen-ah + 976 var screen/edi: (addr screen) <- copy _screen + 977 # repl-col + 978 var _repl-col/eax: (addr int) <- get env, code-separator-col + 979 var repl-col/ecx: int <- copy *_repl-col + 980 repl-col <- add 2 # repl-margin-left + 981 # functions + 982 var functions/edx: (addr handle function) <- get env, functions + 983 # sandbox + 984 var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes + 985 var sandbox/eax: (addr sandbox) <- lookup *sandbox-ah + 986 # bindings + 987 var bindings-storage: table + 988 var bindings/ebx: (addr table) <- address bindings-storage + 989 initialize-table bindings, 0x10 + 990 #? print-string 0, "render-sandbox {\n" + 991 render-sandbox screen, functions, bindings, sandbox, 3, repl-col + 992 #? print-string 0, "render-sandbox }\n" + 993 } + 994 + 995 fn render-sandbox screen: (addr screen), functions: (addr handle function), bindings: (addr table), _sandbox: (addr sandbox), top-row: int, left-col: int { + 996 var sandbox/esi: (addr sandbox) <- copy _sandbox + 997 # line + 998 var curr-line-ah/eax: (addr handle line) <- get sandbox, data + 999 var _curr-line/eax: (addr line) <- lookup *curr-line-ah +1000 var curr-line/ecx: (addr line) <- copy _curr-line +1001 # +1002 var curr-row/edx: int <- copy top-row +1003 # cursor row, col +1004 var cursor-row: int +1005 var cursor-row-addr: (addr int) +1006 var tmp/eax: (addr int) <- address cursor-row +1007 copy-to cursor-row-addr, tmp +1008 var cursor-col: int +1009 var cursor-col-addr: (addr int) +1010 tmp <- address cursor-col +1011 copy-to cursor-col-addr, tmp +1012 # render all but final line without stack +1013 #? print-string 0, "render all but final line\n" +1014 { +1015 var next-line-ah/eax: (addr handle line) <- get curr-line, next +1016 var next-line/eax: (addr line) <- lookup *next-line-ah +1017 compare next-line, 0 +1018 break-if-= +1019 { +1020 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path +1021 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah +1022 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word +1023 var cursor-word/eax: (addr word) <- lookup *cursor-word-ah +1024 # it's enough to pass in the first word of the path, because if the path isn't a singleton the word is guaranteed to be unique +1025 render-line-without-stack screen, curr-line, curr-row, left-col, cursor-word, cursor-row-addr, cursor-col-addr +1026 } +1027 curr-line <- copy next-line +1028 curr-row <- add 2 +1029 loop +1030 } +1031 # +1032 render-final-line-with-stack screen, functions, bindings, sandbox, curr-row, left-col, cursor-row-addr, cursor-col-addr +1033 # at most one of the following dialogs will be rendered +1034 render-rename-dialog screen, sandbox, cursor-row, cursor-col +1035 render-define-dialog screen, sandbox, cursor-row, cursor-col +1036 move-cursor screen, cursor-row, cursor-col +1037 } +1038 +1039 fn render-final-line-with-stack screen: (addr screen), functions: (addr handle function), bindings: (addr table), _sandbox: (addr sandbox), top-row: int, left-col: int, cursor-row-addr: (addr int), cursor-col-addr: (addr int) { +1040 var sandbox/esi: (addr sandbox) <- copy _sandbox +1041 # expanded-words +1042 var expanded-words/edi: (addr handle call-path) <- get sandbox, expanded-words +1043 # cursor-word +1044 var cursor-call-path-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path +1045 var cursor-call-path/eax: (addr call-path-element) <- lookup *cursor-call-path-ah +1046 var cursor-word-ah/eax: (addr handle word) <- get cursor-call-path, word +1047 var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah +1048 var cursor-word/ebx: (addr word) <- copy _cursor-word +1049 #? print-string 0, "word at cursor: " +1050 #? print-word 0, cursor-word +1051 #? print-string 0, "\n" +1052 # cursor-call-path +1053 var cursor-call-path: (addr handle call-path-element) +1054 { +1055 var src/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path +1056 copy-to cursor-call-path, src +1057 } +1058 # first line +1059 var first-line-ah/eax: (addr handle line) <- get sandbox, data +1060 var _first-line/eax: (addr line) <- lookup *first-line-ah +1061 var first-line/edx: (addr line) <- copy _first-line +1062 # final line +1063 var final-line-storage: (handle line) +1064 var final-line-ah/eax: (addr handle line) <- address final-line-storage +1065 final-line sandbox, final-line-ah +1066 var final-line/eax: (addr line) <- lookup *final-line-ah +1067 # curr-path +1068 var curr-path-storage: (handle call-path-element) +1069 var curr-path/ecx: (addr handle call-path-element) <- address curr-path-storage +1070 allocate curr-path # leak +1071 initialize-path-from-line final-line, curr-path +1072 # +1073 var dummy/ecx: int <- render-line screen, functions, bindings, first-line, final-line, expanded-words, top-row, left-col, curr-path, cursor-word, cursor-call-path, cursor-row-addr, cursor-col-addr +1074 } +1075 +1076 fn final-line _sandbox: (addr sandbox), out: (addr handle line) { +1077 var sandbox/esi: (addr sandbox) <- copy _sandbox +1078 var curr-line-ah/ecx: (addr handle line) <- get sandbox, data +1079 { +1080 var curr-line/eax: (addr line) <- lookup *curr-line-ah +1081 var next-line-ah/edx: (addr handle line) <- get curr-line, next +1082 var next-line/eax: (addr line) <- lookup *next-line-ah +1083 compare next-line, 0 +1084 break-if-= +1085 curr-line-ah <- copy next-line-ah +1086 loop +1087 } +1088 copy-object curr-line-ah, out +1089 } +1090 +1091 fn render-rename-dialog screen: (addr screen), _sandbox: (addr sandbox), cursor-row: int, cursor-col: int { +1092 var sandbox/edi: (addr sandbox) <- copy _sandbox +1093 var rename-word-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-cursor-word +1094 var rename-word-mode?/eax: (addr word) <- lookup *rename-word-mode-ah? +1095 compare rename-word-mode?, 0 +1096 break-if-= +1097 # clear a space for the dialog +1098 var top-row/eax: int <- copy cursor-row +1099 top-row <- subtract 3 +1100 var bottom-row/ecx: int <- copy cursor-row +1101 bottom-row <- add 3 +1102 var left-col/edx: int <- copy cursor-col +1103 left-col <- subtract 0x10 +1104 var right-col/ebx: int <- copy cursor-col +1105 right-col <- add 0x10 +1106 clear-rect screen, top-row, left-col, bottom-row, right-col +1107 draw-box screen, top-row, left-col, bottom-row, right-col +1108 # render a little menu for the dialog +1109 var menu-row/ecx: int <- copy bottom-row +1110 menu-row <- decrement +1111 var menu-col/edx: int <- copy left-col +1112 menu-col <- add 2 +1113 move-cursor screen, menu-row, menu-col +1114 start-reverse-video screen +1115 print-string screen, " esc " +1116 reset-formatting screen +1117 print-string screen, " cancel " +1118 start-reverse-video screen +1119 print-string screen, " enter " +1120 reset-formatting screen +1121 print-string screen, " rename " +1122 # draw the word, positioned appropriately around the cursor +1123 var start-col/ecx: int <- copy cursor-col +1124 var word-ah?/edx: (addr handle word) <- get sandbox, partial-name-for-cursor-word +1125 var word/eax: (addr word) <- lookup *word-ah? +1126 var cursor-index/eax: int <- cursor-index word +1127 start-col <- subtract cursor-index +1128 move-cursor screen, cursor-row, start-col +1129 var word/eax: (addr word) <- lookup *word-ah? +1130 print-word screen, word +1131 } +1132 +1133 fn render-define-dialog screen: (addr screen), _sandbox: (addr sandbox), cursor-row: int, cursor-col: int { +1134 var sandbox/edi: (addr sandbox) <- copy _sandbox +1135 var define-function-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-function +1136 var define-function-mode?/eax: (addr word) <- lookup *define-function-mode-ah? +1137 compare define-function-mode?, 0 +1138 break-if-= +1139 # clear a space for the dialog +1140 var top-row/eax: int <- copy cursor-row +1141 top-row <- subtract 3 +1142 var bottom-row/ecx: int <- copy cursor-row +1143 bottom-row <- add 3 +1144 var left-col/edx: int <- copy cursor-col +1145 left-col <- subtract 0x10 +1146 var right-col/ebx: int <- copy cursor-col +1147 right-col <- add 0x10 +1148 clear-rect screen, top-row, left-col, bottom-row, right-col +1149 draw-box screen, top-row, left-col, bottom-row, right-col +1150 # render a little menu for the dialog +1151 var menu-row/ecx: int <- copy bottom-row +1152 menu-row <- decrement +1153 var menu-col/edx: int <- copy left-col +1154 menu-col <- add 2 +1155 move-cursor screen, menu-row, menu-col +1156 start-reverse-video screen +1157 print-string screen, " esc " +1158 reset-formatting screen +1159 print-string screen, " cancel " +1160 start-reverse-video screen +1161 print-string screen, " enter " +1162 reset-formatting screen +1163 print-string screen, " define " +1164 # draw the word, positioned appropriately around the cursor +1165 var start-col/ecx: int <- copy cursor-col +1166 var word-ah?/edx: (addr handle word) <- get sandbox, partial-name-for-function +1167 var word/eax: (addr word) <- lookup *word-ah? +1168 var cursor-index/eax: int <- cursor-index word +1169 start-col <- subtract cursor-index +1170 move-cursor screen, cursor-row, start-col +1171 var word/eax: (addr word) <- lookup *word-ah? +1172 print-word screen, word +1173 } +1174 +1175 # Render just the words in 'line'. +1176 fn render-line-without-stack screen: (addr screen), _line: (addr line), curr-row: int, left-col: int, cursor-word: (addr word), cursor-row-addr: (addr int), cursor-col-addr: (addr int) { +1177 # curr-word +1178 var line/eax: (addr line) <- copy _line +1179 var first-word-ah/eax: (addr handle word) <- get line, data +1180 var _curr-word/eax: (addr word) <- lookup *first-word-ah +1181 var curr-word/esi: (addr word) <- copy _curr-word +1182 # +1183 # loop-carried dependency +1184 var curr-col/ecx: int <- copy left-col +1185 # +1186 { +1187 compare curr-word, 0 +1188 break-if-= +1189 #? print-string 0, "-- word in penultimate lines: " +1190 #? { +1191 #? var foo/eax: int <- copy curr-word +1192 #? print-int32-hex 0, foo +1193 #? } +1194 #? print-string 0, "\n" +1195 var old-col/edx: int <- copy curr-col +1196 reset-formatting screen +1197 move-cursor screen, curr-row, curr-col +1198 print-word screen, curr-word +1199 { +1200 var max-width/eax: int <- word-length curr-word +1201 curr-col <- add max-width +1202 curr-col <- add 1 # margin-right +1203 } +1204 # cache cursor column if necessary +1205 { +1206 compare curr-word, cursor-word +1207 break-if-!= +1208 #? print-string 0, "Cursor at " +1209 #? print-int32-decimal 0, curr-row +1210 #? print-string 0, ", " +1211 #? print-int32-decimal 0, old-col +1212 #? print-string 0, "\n" +1213 #? print-string 0, "contents: " +1214 #? print-word 0, cursor-word +1215 #? print-string 0, "\n" +1216 #? { +1217 #? var foo/eax: int <- copy cursor-word +1218 #? print-int32-hex 0, foo +1219 #? print-string 0, "\n" +1220 #? } +1221 var dest/ecx: (addr int) <- copy cursor-row-addr +1222 var src/eax: int <- copy curr-row +1223 copy-to *dest, src +1224 dest <- copy cursor-col-addr +1225 copy-to *dest, old-col +1226 var cursor-index-in-word/eax: int <- cursor-index curr-word +1227 add-to *dest, cursor-index-in-word +1228 } +1229 # loop update +1230 var next-word-ah/edx: (addr handle word) <- get curr-word, next +1231 var _curr-word/eax: (addr word) <- lookup *next-word-ah +1232 curr-word <- copy _curr-word +1233 loop +1234 } +1235 } +1236 +1237 fn call-depth-at-cursor _sandbox: (addr sandbox) -> _/eax: int { +1238 var sandbox/esi: (addr sandbox) <- copy _sandbox +1239 var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path +1240 var result/eax: int <- call-path-element-length cursor-call-path +1241 result <- add 2 # input-row - 1 +1242 return result +1243 } +1244 +1245 fn call-path-element-length _x: (addr handle call-path-element) -> _/eax: int { +1246 var curr-ah/ecx: (addr handle call-path-element) <- copy _x +1247 var result/edi: int <- copy 0 +1248 { +1249 var curr/eax: (addr call-path-element) <- lookup *curr-ah +1250 compare curr, 0 +1251 break-if-= +1252 curr-ah <- get curr, next +1253 result <- increment +1254 loop +1255 } +1256 return result +1257 } +1258 +1259 # Render the line of words in line, along with the state of the stack under each word. +1260 # Also render any expanded function calls using recursive calls. +1261 # +1262 # Along the way, compute the column the cursor should be positioned at (cursor-col-addr). +1263 fn render-line screen: (addr screen), functions: (addr handle function), bindings: (addr table), first-line: (addr line), _line: (addr line), expanded-words: (addr handle call-path), top-row: int, left-col: int, curr-path: (addr handle call-path-element), cursor-word: (addr word), cursor-call-path: (addr handle call-path-element), cursor-row-addr: (addr int), cursor-col-addr: (addr int) -> _/ecx: int { +1264 #? print-string 0, "render-line\n" +1265 #? dump-table bindings +1266 # curr-word +1267 var line/esi: (addr line) <- copy _line +1268 var first-word-ah/eax: (addr handle word) <- get line, data +1269 var curr-word/eax: (addr word) <- lookup *first-word-ah +1270 # +1271 # loop-carried dependency +1272 var curr-col/ecx: int <- copy left-col +1273 # +1274 { +1275 compare curr-word, 0 +1276 break-if-= +1277 #? print-string 0, "-- word " +1278 #? print-word 0, curr-word +1279 #? print-string 0, "\n" +1280 # if necessary, first render columns for subsidiary stack +1281 $render-line:subsidiary: { +1282 { +1283 #? print-string 0, "check sub\n" +1284 var display-subsidiary-stack?/eax: boolean <- find-in-call-paths expanded-words, curr-path +1285 compare display-subsidiary-stack?, 0 # false +1286 break-if-= $render-line:subsidiary +1287 } +1288 #? print-string 0, "render subsidiary stack\n" +1289 # does function exist? +1290 var callee/edi: (addr function) <- copy 0 +1291 { +1292 var callee-h: (handle function) +1293 var callee-ah/ecx: (addr handle function) <- address callee-h +1294 callee functions, curr-word, callee-ah +1295 var _callee/eax: (addr function) <- lookup *callee-ah +1296 callee <- copy _callee +1297 compare callee, 0 +1298 break-if-= $render-line:subsidiary +1299 } +1300 move-cursor screen, top-row, curr-col +1301 start-color screen, 8, 7 +1302 print-word screen, curr-word +1303 { +1304 var word-len/eax: int <- word-length curr-word +1305 curr-col <- add word-len +1306 curr-col <- add 2 +1307 increment top-row +1308 } +1309 # obtain stack at call site +1310 var stack-storage: value-stack +1311 var stack/edx: (addr value-stack) <- address stack-storage +1312 initialize-value-stack stack, 0x10 +1313 { +1314 var prev-word-ah/eax: (addr handle word) <- get curr-word, prev +1315 var prev-word/eax: (addr word) <- lookup *prev-word-ah +1316 compare prev-word, 0 +1317 break-if-= +1318 var bindings2-storage: table +1319 var bindings2/ebx: (addr table) <- address bindings2-storage +1320 deep-copy-table bindings, bindings2 +1321 evaluate functions, bindings2, first-line, prev-word, stack +1322 } +1323 # construct new bindings +1324 var callee-bindings-storage: table +1325 var callee-bindings/esi: (addr table) <- address callee-bindings-storage +1326 initialize-table callee-bindings, 0x10 +1327 bind-args callee, stack, callee-bindings +1328 # obtain body +1329 var callee-body-ah/eax: (addr handle line) <- get callee, body +1330 var callee-body/eax: (addr line) <- lookup *callee-body-ah +1331 var callee-body-first-word/edx: (addr handle word) <- get callee-body, data +1332 # - render subsidiary stack +1333 push-to-call-path-element curr-path, callee-body-first-word # leak +1334 #? print-string 0, "subsidiary {\n" +1335 #? dump-table callee-bindings +1336 #? syscall_exit +1337 curr-col <- render-line screen, functions, callee-bindings, callee-body, callee-body, expanded-words, top-row, curr-col, curr-path, cursor-word, cursor-call-path, cursor-row-addr, cursor-col-addr +1338 #? print-string 0, "}\n" +1339 drop-from-call-path-element curr-path +1340 # +1341 move-cursor screen, top-row, curr-col +1342 print-code-point screen, 0x21d7 # ⇗ +1343 # +1344 curr-col <- add 2 +1345 decrement top-row +1346 } +1347 # render main column +1348 var old-col/edx: int <- copy curr-col +1349 var bindings2-storage: table +1350 var bindings2/ebx: (addr table) <- address bindings2-storage +1351 #? print-string 0, "deep-copy {\n" +1352 deep-copy-table bindings, bindings2 +1353 #? print-string 0, "}\n" +1354 #? print-string 0, "render column {\n" +1355 curr-col <- render-column screen, functions, bindings2, first-line, line, curr-word, top-row, curr-col +1356 #? print-string 0, "}\n" +1357 # cache cursor column if necessary +1358 $render-line:cache-cursor-column: { +1359 { +1360 var found?/eax: boolean <- call-path-element-match? curr-path, cursor-call-path +1361 compare found?, 0 # false +1362 break-if-= $render-line:cache-cursor-column +1363 } +1364 var dest/edi: (addr int) <- copy cursor-row-addr +1365 { +1366 var src/eax: int <- copy top-row +1367 copy-to *dest, src +1368 } +1369 dest <- copy cursor-col-addr +1370 copy-to *dest, old-col +1371 var cursor-index-in-word/eax: int <- cursor-index curr-word +1372 add-to *dest, cursor-index-in-word +1373 } +1374 # loop update +1375 #? print-string 0, "next word\n" +1376 var next-word-ah/edx: (addr handle word) <- get curr-word, next +1377 curr-word <- lookup *next-word-ah +1378 #? { +1379 #? var foo/eax: int <- copy curr-word +1380 #? print-int32-hex 0, foo +1381 #? print-string 0, "\n" +1382 #? } +1383 increment-final-element curr-path +1384 loop +1385 } +1386 return curr-col +1387 } +1388 +1389 fn callee functions: (addr handle function), word: (addr word), out: (addr handle function) { +1390 var stream-storage: (stream byte 0x10) +1391 var stream/esi: (addr stream byte) <- address stream-storage +1392 emit-word word, stream +1393 find-function functions, stream, out +1394 } +1395 +1396 # Render: +1397 # - starting at top-row, left-col: final-word +1398 # - starting somewhere below at left-col: the stack result from interpreting first-world to final-word (inclusive) +1399 # +1400 # Return the farthest column written. +1401 fn render-column screen: (addr screen), functions: (addr handle function), bindings: (addr table), first-line: (addr line), line: (addr line), final-word: (addr word), top-row: int, left-col: int -> _/ecx: int { +1402 #? print-string 0, "render-column\n" +1403 #? dump-table bindings +1404 var max-width/esi: int <- copy 0 +1405 { +1406 # compute stack +1407 var stack: value-stack +1408 var stack-addr/edi: (addr value-stack) <- address stack +1409 initialize-value-stack stack-addr, 0x10 # max-words +1410 # copy bindings +1411 var bindings2-storage: table +1412 var bindings2/ebx: (addr table) <- address bindings2-storage +1413 #? print-string 0, "deep copy table {\n" +1414 deep-copy-table bindings, bindings2 +1415 #? print-string 0, "}\n" +1416 evaluate functions, bindings2, first-line, final-word, stack-addr +1417 # indent stack +1418 var indented-col/ebx: int <- copy left-col +1419 indented-col <- add 1 # margin-right +1420 # render stack +1421 var curr-row/edx: int <- copy top-row +1422 curr-row <- add 2 # stack-margin-top +1423 var _max-width/eax: int <- value-stack-max-width stack-addr +1424 max-width <- copy _max-width +1425 { +1426 var top-addr/ecx: (addr int) <- get stack-addr, top +1427 compare *top-addr, 0 +1428 break-if-<= +1429 decrement *top-addr +1430 var data-ah/eax: (addr handle array value) <- get stack-addr, data +1431 var data/eax: (addr array value) <- lookup *data-ah +1432 var top/ecx: int <- copy *top-addr +1433 var dest-offset/ecx: (offset value) <- compute-offset data, top +1434 var val/eax: (addr value) <- index data, dest-offset +1435 render-value-at screen, curr-row, indented-col, val, max-width +1436 var height/eax: int <- value-height val +1437 curr-row <- add height +1438 loop +1439 } +1440 } +1441 +1442 max-width <- add 2 # spaces on either side of items on the stack +1443 +1444 # render word, initialize result +1445 reset-formatting screen +1446 move-cursor screen, top-row, left-col +1447 print-word screen, final-word +1448 { +1449 var size/eax: int <- word-length final-word +1450 compare size, max-width +1451 break-if-<= +1452 max-width <- copy size +1453 } +1454 +1455 # post-process right-col +1456 var right-col/ecx: int <- copy left-col +1457 right-col <- add max-width +1458 right-col <- add 1 # margin-right +1459 #? print-int32-decimal 0, left-col +1460 #? print-string 0, " => " +1461 #? print-int32-decimal 0, right-col +1462 #? print-string 0, "\n" +1463 return right-col +1464 } +1465 +1466 fn clear-canvas _env: (addr environment) { +1467 var env/esi: (addr environment) <- copy _env +1468 var screen-ah/edi: (addr handle screen) <- get env, screen +1469 var _screen/eax: (addr screen) <- lookup *screen-ah +1470 var screen/edi: (addr screen) <- copy _screen +1471 clear-screen screen +1472 var nrows/eax: (addr int) <- get env, nrows +1473 var _repl-col/ecx: (addr int) <- get env, code-separator-col +1474 var repl-col/ecx: int <- copy *_repl-col +1475 draw-vertical-line screen, 1, *nrows, repl-col +1476 # wordstar-style cheatsheet of shortcuts +1477 move-cursor screen, *nrows, 0 +1478 start-reverse-video screen +1479 print-string screen, " ctrl-q " +1480 reset-formatting screen +1481 print-string screen, " quit " +1482 var menu-start/ebx: int <- copy repl-col +1483 menu-start <- subtract 0x40 # 64 = half the size of the menu +1484 move-cursor screen, *nrows, menu-start +1485 start-reverse-video screen +1486 print-string screen, " ctrl-a " +1487 reset-formatting screen +1488 print-string screen, " ⏮ " +1489 start-reverse-video screen +1490 print-string screen, " ctrl-b " +1491 reset-formatting screen +1492 print-string screen, " ◀ word " +1493 start-reverse-video screen +1494 print-string screen, " ctrl-f " +1495 reset-formatting screen +1496 print-string screen, " word ▶ " +1497 start-reverse-video screen +1498 print-string screen, " ctrl-e " +1499 reset-formatting screen +1500 print-string screen, " ⏭ " +1501 start-reverse-video screen +1502 print-string screen, " ctrl-u " +1503 reset-formatting screen +1504 print-string screen, " clear line " +1505 start-reverse-video screen +1506 print-string screen, " ctrl-n " +1507 reset-formatting screen +1508 print-string screen, " name value " +1509 start-reverse-video screen +1510 print-string screen, " ctrl-d " +1511 reset-formatting screen +1512 print-string screen, " define function " +1513 # primitives +1514 var start-col/ecx: int <- copy repl-col +1515 start-col <- subtract 0x28 +1516 move-cursor screen, 1, start-col +1517 print-string screen, "primitives:" +1518 start-col <- add 2 +1519 move-cursor screen, 2, start-col +1520 print-string screen, "+ - * len" +1521 move-cursor screen, 3, start-col +1522 print-string screen, "open read slurp lines" +1523 move-cursor screen, 4, start-col +1524 print-string screen, "fake-screen print move" +1525 move-cursor screen, 5, start-col +1526 print-string screen, "up down left right" +1527 move-cursor screen, 6, start-col +1528 print-string screen, "dup swap" +1529 # currently defined functions +1530 start-col <- subtract 2 +1531 move-cursor screen, 8, start-col +1532 print-string screen, "functions:" +1533 start-col <- add 2 +1534 var row/ebx: int <- copy 9 +1535 var functions/esi: (addr handle function) <- get env, functions +1536 { +1537 var curr/eax: (addr function) <- lookup *functions +1538 compare curr, 0 +1539 break-if-= +1540 row <- render-function screen, row, start-col, curr +1541 functions <- get curr, next +1542 row <- increment +1543 loop +1544 } +1545 } +1546 +1547 # only single-line functions supported for now +1548 fn render-function screen: (addr screen), row: int, col: int, _f: (addr function) -> _/ebx: int { +1549 var f/esi: (addr function) <- copy _f +1550 var args/ecx: (addr handle word) <- get f, args +1551 move-cursor screen, row, col +1552 print-words-in-reverse screen, args +1553 var name-ah/eax: (addr handle array byte) <- get f, name +1554 var name/eax: (addr array byte) <- lookup *name-ah +1555 start-bold screen +1556 print-string screen, name +1557 reset-formatting screen +1558 increment row +1559 add-to col, 2 +1560 move-cursor screen, row, col +1561 print-string screen, "= " +1562 var body-ah/eax: (addr handle line) <- get f, body +1563 var body/eax: (addr line) <- lookup *body-ah +1564 var body-words-ah/eax: (addr handle word) <- get body, data +1565 print-words screen, body-words-ah +1566 return row +1567 } +1568 +1569 fn real-grapheme? g: grapheme -> _/eax: boolean { +1570 # if g == newline return true +1571 compare g, 0xa +1572 { +1573 break-if-!= +1574 return 1 # true +1575 } +1576 # if g == tab return true +1577 compare g, 9 +1578 { +1579 break-if-!= +1580 return 1 # true +1581 } +1582 # if g < 32 return false +1583 compare g, 0x20 +1584 { +1585 break-if->= +1586 return 0 # false +1587 } +1588 # if g <= 255 return true +1589 compare g, 0xff +1590 { +1591 break-if-> +1592 return 1 # true +1593 } +1594 # if (g&0xff == Esc) it's an escape sequence +1595 and-with g, 0xff +1596 compare g, 0x1b # Esc +1597 { +1598 break-if-!= +1599 return 0 # false +1600 } +1601 # otherwise return true +1602 return 1 # true +1603 } diff --git a/html/apps/tile/main.mu.html b/html/apps/tile/main.mu.html index 745ba507..1629a012 100644 --- a/html/apps/tile/main.mu.html +++ b/html/apps/tile/main.mu.html @@ -85,7 +85,7 @@ if ('onhashchange' in window) { 26 compare tmp2, 0 # false 27 { 28 break-if-= - 29 repl + 29 repl 30 return 0 31 } 32 # if single arg is 'test' ... @@ -125,61 +125,78 @@ if ('onhashchange' in window) { 66 } 67 68 fn test { - 69 test-surface-pin-at-origin - 70 #? var env-storage: environment - 71 #? var env/esi: (addr environment) <- address env-storage - 72 #? initialize-environment-with-fake-screen env, 5, 0xa - 73 #? var g/eax: grapheme <- copy 0x22 # '"' - 74 #? process env, g - 75 #? g <- copy 0x61 # 'a' - 76 #? process env, g - 77 #? g <- copy 0x22 # '"' - 78 #? process env, g - 79 #? render env - 80 } - 81 - 82 fn repl { - 83 { - 84 # prompt - 85 print-string-to-real-screen "> " - 86 # read - 87 var line-storage: (stream byte 0x100) - 88 var line/ecx: (addr stream byte) <- address line-storage - 89 clear-stream line - 90 read-line-from-real-keyboard line - 91 var done?/eax: boolean <- stream-empty? line - 92 compare done?, 0 # false - 93 break-if-!= - 94 # parse - 95 var env-storage: environment - 96 var env/esi: (addr environment) <- address env-storage - 97 initialize-environment env - 98 { - 99 var done?/eax: boolean <- stream-empty? line -100 compare done?, 0 # false -101 break-if-!= -102 var g/eax: grapheme <- read-grapheme line -103 process env, g -104 loop -105 } -106 # eval -107 var stack-storage: value-stack -108 var stack/edi: (addr value-stack) <- address stack-storage -109 initialize-value-stack stack, 0x10 -110 evaluate-environment env, stack -111 # print -112 var empty?/eax: boolean <- value-stack-empty? stack -113 { -114 compare empty?, 0 # false -115 break-if-!= -116 var result/eax: int <- pop-int-from-value-stack stack -117 print-int32-decimal-to-real-screen result -118 print-string-to-real-screen "\n" -119 } -120 # -121 loop -122 } -123 } + 69 var env-storage: environment + 70 var env/esi: (addr environment) <- address env-storage + 71 initialize-environment-with-fake-screen env, 0x20, 0xa0 + 72 process-all env, "3 3 fake-screen =s" + 73 process env, 0xc # ctrl-l + 74 process-all env, "s 1 down 1 right" + 75 process env, 4 # ctrl-d: start defining function + 76 process-all env, "foo" + 77 process env, 0xa # newline: define function + 78 process env, 0x435b1b # right-arrow + 79 #? process env, 5 # ctrl-e: end of line + 80 print-string 0, "==\n" + 81 process env, 0xa # newline: expand + 82 render env + 83 } + 84 + 85 fn process-all env: (addr environment), cmds: (addr array byte) { + 86 var cmds-stream: (stream byte 0x100) + 87 var cmds-stream-a/esi: (addr stream byte) <- address cmds-stream + 88 write cmds-stream-a, cmds + 89 { + 90 var done?/eax: boolean <- stream-empty? cmds-stream-a + 91 compare done?, 0 # false + 92 break-if-!= + 93 var g/eax: grapheme <- read-grapheme cmds-stream-a + 94 process env, g + 95 loop + 96 } + 97 } + 98 + 99 fn repl { +100 { +101 # prompt +102 print-string-to-real-screen "> " +103 # read +104 var line-storage: (stream byte 0x100) +105 var line/ecx: (addr stream byte) <- address line-storage +106 clear-stream line +107 read-line-from-real-keyboard line +108 var done?/eax: boolean <- stream-empty? line +109 compare done?, 0 # false +110 break-if-!= +111 # parse +112 var env-storage: environment +113 var env/esi: (addr environment) <- address env-storage +114 initialize-environment env +115 { +116 var done?/eax: boolean <- stream-empty? line +117 compare done?, 0 # false +118 break-if-!= +119 var g/eax: grapheme <- read-grapheme line +120 process env, g +121 loop +122 } +123 # eval +124 var stack-storage: value-stack +125 var stack/edi: (addr value-stack) <- address stack-storage +126 initialize-value-stack stack, 0x10 +127 evaluate-environment env, stack +128 # print +129 var empty?/eax: boolean <- value-stack-empty? stack +130 { +131 compare empty?, 0 # false +132 break-if-!= +133 var result/eax: int <- pop-int-from-value-stack stack +134 print-int32-decimal-to-real-screen result +135 print-string-to-real-screen "\n" +136 } +137 # +138 loop +139 } +140 } diff --git a/html/apps/tile/rpn.mu.html b/html/apps/tile/rpn.mu.html index 54af3e40..c67a5d75 100644 --- a/html/apps/tile/rpn.mu.html +++ b/html/apps/tile/rpn.mu.html @@ -71,603 +71,884 @@ if ('onhashchange' in window) { 11 break-if-= 12 # update curr-stream 13 emit-word curr, curr-stream - 14 #? print-stream-to-real-screen curr-stream - 15 #? print-string-to-real-screen "\n" - 16 $evaluate:process-word: { - 17 # if curr-stream is an operator, perform it - 18 { - 19 var is-add?/eax: boolean <- stream-data-equal? curr-stream, "+" - 20 compare is-add?, 0 - 21 break-if-= - 22 var _b/eax: int <- pop-int-from-value-stack out - 23 var b/edx: int <- copy _b - 24 var a/eax: int <- pop-int-from-value-stack out - 25 a <- add b - 26 push-int-to-value-stack out, a - 27 break $evaluate:process-word - 28 } - 29 { - 30 var is-sub?/eax: boolean <- stream-data-equal? curr-stream, "-" - 31 compare is-sub?, 0 - 32 break-if-= - 33 var _b/eax: int <- pop-int-from-value-stack out - 34 var b/edx: int <- copy _b - 35 var a/eax: int <- pop-int-from-value-stack out - 36 a <- subtract b - 37 push-int-to-value-stack out, a - 38 break $evaluate:process-word - 39 } - 40 { - 41 var is-mul?/eax: boolean <- stream-data-equal? curr-stream, "*" - 42 compare is-mul?, 0 - 43 break-if-= - 44 var _b/eax: int <- pop-int-from-value-stack out - 45 var b/edx: int <- copy _b - 46 var a/eax: int <- pop-int-from-value-stack out - 47 a <- multiply b - 48 push-int-to-value-stack out, a - 49 break $evaluate:process-word - 50 } - 51 { - 52 var is-len?/eax: boolean <- stream-data-equal? curr-stream, "len" - 53 compare is-len?, 0 - 54 break-if-= - 55 #? print-string 0, "is len\n" - 56 # pop target-val from out - 57 var out2/esi: (addr value-stack) <- copy out - 58 var top-addr/ecx: (addr int) <- get out2, top - 59 compare *top-addr, 0 - 60 break-if-<= - 61 #? print-string 0, "stack has stuff\n" - 62 var data-ah/eax: (addr handle array value) <- get out2, data - 63 var data/eax: (addr array value) <- lookup *data-ah - 64 var top/edx: int <- copy *top-addr - 65 top <- decrement - 66 var dest-offset/edx: (offset value) <- compute-offset data, top - 67 var target-val/edx: (addr value) <- index data, dest-offset - 68 # check target-val is a string or array - 69 var target-type-addr/eax: (addr int) <- get target-val, type - 70 compare *target-type-addr, 1 # string - 71 { - 72 break-if-!= - 73 # compute length - 74 var src-ah/eax: (addr handle array byte) <- get target-val, text-data - 75 var src/eax: (addr array byte) <- lookup *src-ah - 76 var result/ebx: int <- length src - 77 # save result into target-val - 78 var type-addr/eax: (addr int) <- get target-val, type - 79 copy-to *type-addr, 0 # int - 80 var target-string-ah/eax: (addr handle array byte) <- get target-val, text-data - 81 var empty: (handle array byte) - 82 copy-handle empty, target-string-ah - 83 var target/eax: (addr int) <- get target-val, int-data - 84 copy-to *target, result - 85 break $evaluate:process-word - 86 } - 87 compare *target-type-addr, 2 # array of ints - 88 { - 89 break-if-!= - 90 # compute length - 91 var src-ah/eax: (addr handle array value) <- get target-val, array-data - 92 var src/eax: (addr array value) <- lookup *src-ah - 93 var result/ebx: int <- length src - 94 # save result into target-val - 95 var type-addr/eax: (addr int) <- get target-val, type - 96 copy-to *type-addr, 0 # int - 97 var target-array-ah/eax: (addr handle array value) <- get target-val, array-data - 98 var empty: (handle array value) - 99 copy-handle empty, target-array-ah -100 var target/eax: (addr int) <- get target-val, int-data -101 copy-to *target, result -102 break $evaluate:process-word -103 } -104 } -105 { -106 var is-open?/eax: boolean <- stream-data-equal? curr-stream, "open" -107 compare is-open?, 0 -108 break-if-= -109 # pop target-val from out -110 var out2/esi: (addr value-stack) <- copy out -111 var top-addr/ecx: (addr int) <- get out2, top -112 compare *top-addr, 0 -113 break-if-<= -114 var data-ah/eax: (addr handle array value) <- get out2, data -115 var data/eax: (addr array value) <- lookup *data-ah -116 var top/edx: int <- copy *top-addr -117 top <- decrement -118 var dest-offset/edx: (offset value) <- compute-offset data, top -119 var target-val/edx: (addr value) <- index data, dest-offset -120 # check target-val is a string -121 var target-type-addr/eax: (addr int) <- get target-val, type -122 compare *target-type-addr, 1 # string -123 break-if-!= -124 # open target-val as a filename and save the handle in target-val -125 var src-ah/eax: (addr handle array byte) <- get target-val, text-data -126 var src/eax: (addr array byte) <- lookup *src-ah -127 var result-ah/ecx: (addr handle buffered-file) <- get target-val, file-data -128 open src, 0, result-ah # write? = false -129 # save result into target-val -130 var type-addr/eax: (addr int) <- get target-val, type -131 copy-to *type-addr, 3 # file -132 var target-string-ah/eax: (addr handle array byte) <- get target-val, text-data -133 var empty: (handle array byte) -134 copy-handle empty, target-string-ah -135 break $evaluate:process-word -136 } -137 { -138 var is-read?/eax: boolean <- stream-data-equal? curr-stream, "read" -139 compare is-read?, 0 -140 break-if-= -141 # pop target-val from out -142 var out2/esi: (addr value-stack) <- copy out -143 var top-addr/ecx: (addr int) <- get out2, top -144 compare *top-addr, 0 -145 break-if-<= -146 var data-ah/eax: (addr handle array value) <- get out2, data -147 var data/eax: (addr array value) <- lookup *data-ah -148 var top/edx: int <- copy *top-addr -149 top <- decrement -150 var dest-offset/edx: (offset value) <- compute-offset data, top -151 var target-val/edx: (addr value) <- index data, dest-offset -152 # check target-val is a file -153 var target-type-addr/eax: (addr int) <- get target-val, type -154 compare *target-type-addr, 3 # file -155 break-if-!= -156 # read a line from the file and save in target-val -157 # read target-val as a filename and save the handle in target-val -158 var file-ah/eax: (addr handle buffered-file) <- get target-val, file-data -159 var file/eax: (addr buffered-file) <- lookup *file-ah -160 var s: (stream byte 0x100) -161 var s-addr/ecx: (addr stream byte) <- address s -162 read-line-buffered file, s-addr -163 var target/eax: (addr handle array byte) <- get target-val, text-data -164 stream-to-array s-addr, target -165 # save result into target-val -166 var type-addr/eax: (addr int) <- get target-val, type -167 copy-to *type-addr, 1 # string -168 var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data -169 var empty: (handle buffered-file) -170 copy-handle empty, target-file-ah -171 break $evaluate:process-word -172 } -173 { -174 var is-slurp?/eax: boolean <- stream-data-equal? curr-stream, "slurp" -175 compare is-slurp?, 0 -176 break-if-= -177 # pop target-val from out -178 var out2/esi: (addr value-stack) <- copy out -179 var top-addr/ecx: (addr int) <- get out2, top -180 compare *top-addr, 0 -181 break-if-<= -182 var data-ah/eax: (addr handle array value) <- get out2, data -183 var data/eax: (addr array value) <- lookup *data-ah -184 var top/edx: int <- copy *top-addr -185 top <- decrement -186 var dest-offset/edx: (offset value) <- compute-offset data, top -187 var target-val/edx: (addr value) <- index data, dest-offset -188 # check target-val is a file -189 var target-type-addr/eax: (addr int) <- get target-val, type -190 compare *target-type-addr, 3 # file -191 break-if-!= -192 # slurp all contents from file and save in target-val -193 # read target-val as a filename and save the handle in target-val -194 var file-ah/eax: (addr handle buffered-file) <- get target-val, file-data -195 var file/eax: (addr buffered-file) <- lookup *file-ah -196 var s: (stream byte 0x100) -197 var s-addr/ecx: (addr stream byte) <- address s -198 slurp file, s-addr -199 var target/eax: (addr handle array byte) <- get target-val, text-data -200 stream-to-array s-addr, target -201 # save result into target-val -202 var type-addr/eax: (addr int) <- get target-val, type -203 copy-to *type-addr, 1 # string -204 var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data -205 var empty: (handle buffered-file) -206 copy-handle empty, target-file-ah -207 break $evaluate:process-word -208 } -209 { -210 var is-lines?/eax: boolean <- stream-data-equal? curr-stream, "lines" -211 compare is-lines?, 0 -212 break-if-= -213 # pop target-val from out -214 var out2/esi: (addr value-stack) <- copy out -215 var top-addr/ecx: (addr int) <- get out2, top -216 compare *top-addr, 0 -217 break-if-<= -218 var data-ah/eax: (addr handle array value) <- get out2, data -219 var data/eax: (addr array value) <- lookup *data-ah -220 var top/edx: int <- copy *top-addr -221 top <- decrement -222 var dest-offset/edx: (offset value) <- compute-offset data, top -223 var target-val/edx: (addr value) <- index data, dest-offset -224 # check target-val is a file -225 var target-type-addr/eax: (addr int) <- get target-val, type -226 compare *target-type-addr, 3 # file -227 break-if-!= -228 # read all lines from file and save as an array of strings in target-val -229 # read target-val as a filename and save the handle in target-val -230 var file-ah/eax: (addr handle buffered-file) <- get target-val, file-data -231 var file/eax: (addr buffered-file) <- lookup *file-ah -232 var s: (stream byte 0x100) -233 var s-addr/ecx: (addr stream byte) <- address s -234 slurp file, s-addr -235 var tmp-ah/eax: (addr handle array byte) <- get target-val, text-data -236 stream-to-array s-addr, tmp-ah -237 var tmp/eax: (addr array byte) <- lookup *tmp-ah -238 #? enable-screen-type-mode -239 #? print-string 0, tmp -240 var h: (handle array (handle array byte)) -241 { -242 var ah/edx: (addr handle array (handle array byte)) <- address h -243 split-string tmp, 0xa, ah -244 } -245 var target/eax: (addr handle array value) <- get target-val, array-data -246 save-lines h, target -247 # save result into target-val -248 var type-addr/eax: (addr int) <- get target-val, type -249 copy-to *type-addr, 2 # array -250 var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data -251 var empty-file: (handle buffered-file) -252 copy-handle empty-file, target-file-ah -253 var target-text-ah/eax: (addr handle array byte) <- get target-val, text-data -254 var empty-text: (handle array byte) -255 copy-handle empty-text, target-text-ah -256 break $evaluate:process-word -257 } -258 # if curr-stream defines a binding, save top of stack to bindings -259 { -260 var done?/eax: boolean <- stream-empty? curr-stream -261 compare done?, 0 # false -262 break-if-!= -263 var new-byte/eax: byte <- read-byte curr-stream -264 compare new-byte, 0x3d # '=' -265 break-if-!= -266 # pop target-val from out -267 var out2/esi: (addr value-stack) <- copy out -268 var top-addr/ecx: (addr int) <- get out2, top -269 compare *top-addr, 0 -270 break-if-<= -271 var data-ah/eax: (addr handle array value) <- get out2, data -272 var data/eax: (addr array value) <- lookup *data-ah -273 var top/edx: int <- copy *top-addr -274 top <- decrement -275 var dest-offset/edx: (offset value) <- compute-offset data, top -276 var target-val/edx: (addr value) <- index data, dest-offset -277 # create binding from curr-stream to target-val -278 var key-h: (handle array byte) -279 var key/ecx: (addr handle array byte) <- address key-h -280 stream-to-array curr-stream, key -281 bind-in-table bindings, key, target-val -282 break $evaluate:process-word -283 } -284 rewind-stream curr-stream -285 # if curr-stream is a known function name, call it appropriately -286 { -287 var callee-h: (handle function) -288 var callee-ah/eax: (addr handle function) <- address callee-h -289 find-function functions, curr-stream, callee-ah -290 var callee/eax: (addr function) <- lookup *callee-ah -291 compare callee, 0 -292 break-if-= -293 perform-call callee, out, functions -294 break $evaluate:process-word -295 } -296 # HACKS: we're trying to avoid turning this into Forth + 14 #? print-string-to-real-screen "eval: " + 15 #? print-stream-to-real-screen curr-stream + 16 #? print-string-to-real-screen "\n" + 17 $evaluate:process-word: { + 18 ### if curr-stream is an operator, perform it + 19 ## numbers + 20 { + 21 var is-add?/eax: boolean <- stream-data-equal? curr-stream, "+" + 22 compare is-add?, 0 + 23 break-if-= + 24 var _b/eax: int <- pop-int-from-value-stack out + 25 var b/edx: int <- copy _b + 26 var a/eax: int <- pop-int-from-value-stack out + 27 a <- add b + 28 push-int-to-value-stack out, a + 29 break $evaluate:process-word + 30 } + 31 { + 32 var is-sub?/eax: boolean <- stream-data-equal? curr-stream, "-" + 33 compare is-sub?, 0 + 34 break-if-= + 35 var _b/eax: int <- pop-int-from-value-stack out + 36 var b/edx: int <- copy _b + 37 var a/eax: int <- pop-int-from-value-stack out + 38 a <- subtract b + 39 push-int-to-value-stack out, a + 40 break $evaluate:process-word + 41 } + 42 { + 43 var is-mul?/eax: boolean <- stream-data-equal? curr-stream, "*" + 44 compare is-mul?, 0 + 45 break-if-= + 46 var _b/eax: int <- pop-int-from-value-stack out + 47 var b/edx: int <- copy _b + 48 var a/eax: int <- pop-int-from-value-stack out + 49 a <- multiply b + 50 push-int-to-value-stack out, a + 51 break $evaluate:process-word + 52 } + 53 ## strings/arrays + 54 { + 55 var is-len?/eax: boolean <- stream-data-equal? curr-stream, "len" + 56 compare is-len?, 0 + 57 break-if-= + 58 #? print-string 0, "is len\n" + 59 # pop target-val from out + 60 var out2/esi: (addr value-stack) <- copy out + 61 var top-addr/ecx: (addr int) <- get out2, top + 62 compare *top-addr, 0 + 63 break-if-<= + 64 #? print-string 0, "stack has stuff\n" + 65 var data-ah/eax: (addr handle array value) <- get out2, data + 66 var data/eax: (addr array value) <- lookup *data-ah + 67 var top/edx: int <- copy *top-addr + 68 top <- decrement + 69 var dest-offset/edx: (offset value) <- compute-offset data, top + 70 var target-val/edx: (addr value) <- index data, dest-offset + 71 # check target-val is a string or array + 72 var target-type-addr/eax: (addr int) <- get target-val, type + 73 compare *target-type-addr, 1 # string + 74 { + 75 break-if-!= + 76 # compute length + 77 var src-ah/eax: (addr handle array byte) <- get target-val, text-data + 78 var src/eax: (addr array byte) <- lookup *src-ah + 79 var result/ebx: int <- length src + 80 # save result into target-val + 81 var type-addr/eax: (addr int) <- get target-val, type + 82 copy-to *type-addr, 0 # int + 83 var target-string-ah/eax: (addr handle array byte) <- get target-val, text-data + 84 var empty: (handle array byte) + 85 copy-handle empty, target-string-ah + 86 var target/eax: (addr int) <- get target-val, int-data + 87 copy-to *target, result + 88 break $evaluate:process-word + 89 } + 90 compare *target-type-addr, 2 # array of ints + 91 { + 92 break-if-!= + 93 # compute length + 94 var src-ah/eax: (addr handle array value) <- get target-val, array-data + 95 var src/eax: (addr array value) <- lookup *src-ah + 96 var result/ebx: int <- length src + 97 # save result into target-val + 98 var type-addr/eax: (addr int) <- get target-val, type + 99 copy-to *type-addr, 0 # int +100 var target-array-ah/eax: (addr handle array value) <- get target-val, array-data +101 var empty: (handle array value) +102 copy-handle empty, target-array-ah +103 var target/eax: (addr int) <- get target-val, int-data +104 copy-to *target, result +105 break $evaluate:process-word +106 } +107 } +108 ## files +109 { +110 var is-open?/eax: boolean <- stream-data-equal? curr-stream, "open" +111 compare is-open?, 0 +112 break-if-= +113 # pop target-val from out +114 var out2/esi: (addr value-stack) <- copy out +115 var top-addr/ecx: (addr int) <- get out2, top +116 compare *top-addr, 0 +117 break-if-<= +118 var data-ah/eax: (addr handle array value) <- get out2, data +119 var data/eax: (addr array value) <- lookup *data-ah +120 var top/edx: int <- copy *top-addr +121 top <- decrement +122 var dest-offset/edx: (offset value) <- compute-offset data, top +123 var target-val/edx: (addr value) <- index data, dest-offset +124 # check target-val is a string +125 var target-type-addr/eax: (addr int) <- get target-val, type +126 compare *target-type-addr, 1 # string +127 break-if-!= +128 # open target-val as a filename and save the handle in target-val +129 var src-ah/eax: (addr handle array byte) <- get target-val, text-data +130 var src/eax: (addr array byte) <- lookup *src-ah +131 var result-ah/ecx: (addr handle buffered-file) <- get target-val, file-data +132 open src, 0, result-ah # write? = false +133 # save result into target-val +134 var type-addr/eax: (addr int) <- get target-val, type +135 copy-to *type-addr, 3 # file +136 var target-string-ah/eax: (addr handle array byte) <- get target-val, text-data +137 var filename-ah/ecx: (addr handle array byte) <- get target-val, filename +138 copy-object target-string-ah, filename-ah +139 var empty: (handle array byte) +140 copy-handle empty, target-string-ah +141 break $evaluate:process-word +142 } +143 { +144 var is-read?/eax: boolean <- stream-data-equal? curr-stream, "read" +145 compare is-read?, 0 +146 break-if-= +147 # pop target-val from out +148 var out2/esi: (addr value-stack) <- copy out +149 var top-addr/ecx: (addr int) <- get out2, top +150 compare *top-addr, 0 +151 break-if-<= +152 var data-ah/eax: (addr handle array value) <- get out2, data +153 var data/eax: (addr array value) <- lookup *data-ah +154 var top/edx: int <- copy *top-addr +155 top <- decrement +156 var dest-offset/edx: (offset value) <- compute-offset data, top +157 var target-val/edx: (addr value) <- index data, dest-offset +158 # check target-val is a file +159 var target-type-addr/eax: (addr int) <- get target-val, type +160 compare *target-type-addr, 3 # file +161 break-if-!= +162 # read a line from the file and save in target-val +163 # read target-val as a filename and save the handle in target-val +164 var file-ah/eax: (addr handle buffered-file) <- get target-val, file-data +165 var file/eax: (addr buffered-file) <- lookup *file-ah +166 var s: (stream byte 0x100) +167 var s-addr/ecx: (addr stream byte) <- address s +168 read-line-buffered file, s-addr +169 var target/eax: (addr handle array byte) <- get target-val, text-data +170 stream-to-array s-addr, target +171 # save result into target-val +172 var type-addr/eax: (addr int) <- get target-val, type +173 copy-to *type-addr, 1 # string +174 var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data +175 var empty: (handle buffered-file) +176 copy-handle empty, target-file-ah +177 break $evaluate:process-word +178 } +179 { +180 var is-slurp?/eax: boolean <- stream-data-equal? curr-stream, "slurp" +181 compare is-slurp?, 0 +182 break-if-= +183 # pop target-val from out +184 var out2/esi: (addr value-stack) <- copy out +185 var top-addr/ecx: (addr int) <- get out2, top +186 compare *top-addr, 0 +187 break-if-<= +188 var data-ah/eax: (addr handle array value) <- get out2, data +189 var data/eax: (addr array value) <- lookup *data-ah +190 var top/edx: int <- copy *top-addr +191 top <- decrement +192 var dest-offset/edx: (offset value) <- compute-offset data, top +193 var target-val/edx: (addr value) <- index data, dest-offset +194 # check target-val is a file +195 var target-type-addr/eax: (addr int) <- get target-val, type +196 compare *target-type-addr, 3 # file +197 break-if-!= +198 # slurp all contents from file and save in target-val +199 # read target-val as a filename and save the handle in target-val +200 var file-ah/eax: (addr handle buffered-file) <- get target-val, file-data +201 var file/eax: (addr buffered-file) <- lookup *file-ah +202 var s: (stream byte 0x100) +203 var s-addr/ecx: (addr stream byte) <- address s +204 slurp file, s-addr +205 var target/eax: (addr handle array byte) <- get target-val, text-data +206 stream-to-array s-addr, target +207 # save result into target-val +208 var type-addr/eax: (addr int) <- get target-val, type +209 copy-to *type-addr, 1 # string +210 var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data +211 var empty: (handle buffered-file) +212 copy-handle empty, target-file-ah +213 break $evaluate:process-word +214 } +215 { +216 var is-lines?/eax: boolean <- stream-data-equal? curr-stream, "lines" +217 compare is-lines?, 0 +218 break-if-= +219 # pop target-val from out +220 var out2/esi: (addr value-stack) <- copy out +221 var top-addr/ecx: (addr int) <- get out2, top +222 compare *top-addr, 0 +223 break-if-<= +224 var data-ah/eax: (addr handle array value) <- get out2, data +225 var data/eax: (addr array value) <- lookup *data-ah +226 var top/edx: int <- copy *top-addr +227 top <- decrement +228 var dest-offset/edx: (offset value) <- compute-offset data, top +229 var target-val/edx: (addr value) <- index data, dest-offset +230 # check target-val is a file +231 var target-type-addr/eax: (addr int) <- get target-val, type +232 compare *target-type-addr, 3 # file +233 break-if-!= +234 # read all lines from file and save as an array of strings in target-val +235 # read target-val as a filename and save the handle in target-val +236 var file-ah/eax: (addr handle buffered-file) <- get target-val, file-data +237 var file/eax: (addr buffered-file) <- lookup *file-ah +238 var s: (stream byte 0x100) +239 var s-addr/ecx: (addr stream byte) <- address s +240 slurp file, s-addr +241 var tmp-ah/eax: (addr handle array byte) <- get target-val, text-data +242 stream-to-array s-addr, tmp-ah +243 var tmp/eax: (addr array byte) <- lookup *tmp-ah +244 #? enable-screen-type-mode +245 #? print-string 0, tmp +246 var h: (handle array (handle array byte)) +247 { +248 var ah/edx: (addr handle array (handle array byte)) <- address h +249 split-string tmp, 0xa, ah +250 } +251 var target/eax: (addr handle array value) <- get target-val, array-data +252 save-lines h, target +253 # save result into target-val +254 var type-addr/eax: (addr int) <- get target-val, type +255 copy-to *type-addr, 2 # array +256 var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data +257 var empty-file: (handle buffered-file) +258 copy-handle empty-file, target-file-ah +259 var target-text-ah/eax: (addr handle array byte) <- get target-val, text-data +260 var empty-text: (handle array byte) +261 copy-handle empty-text, target-text-ah +262 break $evaluate:process-word +263 } +264 ## screens +265 { +266 var is-fake-screen?/eax: boolean <- stream-data-equal? curr-stream, "fake-screen" +267 compare is-fake-screen?, 0 +268 break-if-= +269 var out2/esi: (addr value-stack) <- copy out +270 var top-addr/ecx: (addr int) <- get out2, top +271 compare *top-addr, 0 +272 break-if-<= +273 # pop width and height from out +274 var _nrows/eax: int <- pop-int-from-value-stack out2 +275 var nrows/edx: int <- copy _nrows +276 var _ncols/eax: int <- pop-int-from-value-stack out2 +277 var ncols/ebx: int <- copy _ncols +278 # define a new screen with those dimensions +279 var screen-h: (handle screen) +280 var screen-ah/eax: (addr handle screen) <- address screen-h +281 allocate screen-ah +282 var screen/eax: (addr screen) <- lookup screen-h +283 initialize-screen screen, nrows, ncols +284 # push screen to stack +285 var data-ah/eax: (addr handle array value) <- get out2, data +286 var data/eax: (addr array value) <- lookup *data-ah +287 var top/edx: int <- copy *top-addr +288 increment *top-addr +289 var dest-offset/edx: (offset value) <- compute-offset data, top +290 var target-val/edx: (addr value) <- index data, dest-offset +291 var type/eax: (addr int) <- get target-val, type +292 copy-to *type, 4 # screen +293 var dest/eax: (addr handle screen) <- get target-val, screen-data +294 copy-handle screen-h, dest +295 break $evaluate:process-word +296 } 297 { -298 var is-dup?/eax: boolean <- stream-data-equal? curr-stream, "dup" -299 compare is-dup?, 0 +298 var is-print?/eax: boolean <- stream-data-equal? curr-stream, "print" +299 compare is-print?, 0 300 break-if-= -301 # read src-val from out -302 var out2/esi: (addr value-stack) <- copy out -303 var top-addr/ecx: (addr int) <- get out2, top -304 compare *top-addr, 0 -305 break-if-<= -306 var data-ah/eax: (addr handle array value) <- get out2, data -307 var data/eax: (addr array value) <- lookup *data-ah -308 var top/ecx: int <- copy *top-addr -309 top <- decrement -310 var offset/edx: (offset value) <- compute-offset data, top -311 var src-val/edx: (addr value) <- index data, offset -312 # push a copy of it -313 top <- increment -314 var offset/ebx: (offset value) <- compute-offset data, top -315 var target-val/ebx: (addr value) <- index data, offset -316 copy-object src-val, target-val -317 # commit -318 var top-addr/ecx: (addr int) <- get out2, top -319 increment *top-addr -320 break $evaluate:process-word -321 } -322 { -323 var is-swap?/eax: boolean <- stream-data-equal? curr-stream, "swap" -324 compare is-swap?, 0 -325 break-if-= -326 # read top-val from out -327 var out2/esi: (addr value-stack) <- copy out -328 var top-addr/ecx: (addr int) <- get out2, top -329 compare *top-addr, 0 -330 break-if-<= -331 var data-ah/eax: (addr handle array value) <- get out2, data -332 var data/eax: (addr array value) <- lookup *data-ah -333 var top/ecx: int <- copy *top-addr -334 top <- decrement -335 var offset/edx: (offset value) <- compute-offset data, top -336 var top-val/edx: (addr value) <- index data, offset -337 # read next val from out -338 top <- decrement -339 var offset/ebx: (offset value) <- compute-offset data, top -340 var pen-top-val/ebx: (addr value) <- index data, offset -341 # swap -342 var tmp: value -343 var tmp-a/eax: (addr value) <- address tmp -344 copy-object top-val, tmp-a -345 copy-object pen-top-val, top-val -346 copy-object tmp-a, pen-top-val -347 break $evaluate:process-word -348 } -349 # END HACKS -350 # if it's a name, push its value -351 { -352 compare bindings, 0 -353 break-if-= -354 var tmp: (handle array byte) -355 var curr-string-ah/edx: (addr handle array byte) <- address tmp -356 stream-to-array curr-stream, curr-string-ah # unfortunate leak -357 var curr-string/eax: (addr array byte) <- lookup *curr-string-ah -358 var val-storage: (handle value) -359 var val-ah/edi: (addr handle value) <- address val-storage -360 lookup-binding bindings, curr-string, val-ah -361 var val/eax: (addr value) <- lookup *val-ah -362 compare val, 0 -363 break-if-= -364 push-value-stack out, val -365 break $evaluate:process-word -366 } -367 # if the word starts with a quote and ends with a quote, turn it into a string -368 { -369 var start/eax: byte <- stream-first curr-stream -370 compare start, 0x22 # double-quote -371 break-if-!= -372 var end/eax: byte <- stream-final curr-stream -373 compare end, 0x22 # double-quote -374 break-if-!= -375 var h: (handle array byte) -376 var s/eax: (addr handle array byte) <- address h -377 unquote-stream-to-array curr-stream, s # leak -378 push-string-to-value-stack out, *s -379 break $evaluate:process-word -380 } -381 # if the word starts with a '[' and ends with a ']', turn it into an array -382 { -383 var start/eax: byte <- stream-first curr-stream -384 compare start, 0x5b # '[' -385 break-if-!= -386 var end/eax: byte <- stream-final curr-stream -387 compare end, 0x5d # ']' -388 break-if-!= -389 # wastefully create a new input string to strip quotes -390 var h: (handle array value) -391 var input-ah/eax: (addr handle array byte) <- address h -392 unquote-stream-to-array curr-stream, input-ah # leak -393 # wastefully parse input into int-array -394 # TODO: support parsing arrays of other types -395 var input/eax: (addr array byte) <- lookup *input-ah -396 var h2: (handle array int) -397 var int-array-ah/esi: (addr handle array int) <- address h2 -398 parse-array-of-decimal-ints input, int-array-ah # leak -399 var _int-array/eax: (addr array int) <- lookup *int-array-ah -400 var int-array/esi: (addr array int) <- copy _int-array -401 var len/ebx: int <- length int-array -402 # push value-array of same size as int-array -403 var h3: (handle array value) -404 var value-array-ah/eax: (addr handle array value) <- address h3 -405 populate value-array-ah, len -406 push-array-to-value-stack out, *value-array-ah -407 # copy int-array into value-array -408 var _value-array/eax: (addr array value) <- lookup *value-array-ah -409 var value-array/edi: (addr array value) <- copy _value-array -410 var i/eax: int <- copy 0 -411 { -412 compare i, len -413 break-if->= -414 var src-addr/ecx: (addr int) <- index int-array, i -415 var src/ecx: int <- copy *src-addr -416 var dest-offset/edx: (offset value) <- compute-offset value-array, i -417 var dest-val/edx: (addr value) <- index value-array, dest-offset -418 var dest/edx: (addr int) <- get dest-val, int-data -419 copy-to *dest, src -420 i <- increment -421 loop -422 } -423 break $evaluate:process-word -424 } -425 # otherwise assume it's a literal int and push it -426 { -427 var n/eax: int <- parse-decimal-int-from-stream curr-stream -428 push-int-to-value-stack out, n -429 } -430 } -431 # termination check -432 compare curr, end -433 break-if-= -434 # update -435 var next-word-ah/edx: (addr handle word) <- get curr, next -436 curr <- lookup *next-word-ah -437 # -438 loop -439 } -440 # process next line if necessary -441 var line/eax: (addr line) <- copy scratch -442 var next-line-ah/eax: (addr handle line) <- get line, next -443 var next-line/eax: (addr line) <- lookup *next-line-ah -444 compare next-line, 0 -445 break-if-= -446 evaluate functions, bindings, next-line, end, out -447 } -448 -449 fn test-evaluate { -450 var line-storage: line -451 var line/esi: (addr line) <- address line-storage -452 var first-word-ah/eax: (addr handle word) <- get line-storage, data -453 allocate-word-with first-word-ah, "3" -454 append-word-with *first-word-ah, "=a" -455 var next-line-ah/eax: (addr handle line) <- get line-storage, next -456 allocate next-line-ah -457 var next-line/eax: (addr line) <- lookup *next-line-ah -458 var first-word-ah/eax: (addr handle word) <- get next-line, data -459 allocate-word-with first-word-ah, "a" -460 var functions-storage: (handle function) -461 var functions/ecx: (addr handle function) <- address functions-storage -462 var table-storage: table -463 var table/ebx: (addr table) <- address table-storage -464 initialize-table table, 0x10 -465 var stack-storage: value-stack -466 var stack/edi: (addr value-stack) <- address stack-storage -467 initialize-value-stack stack, 0x10 -468 evaluate functions, table, line, 0, stack -469 var x/eax: int <- pop-int-from-value-stack stack -470 check-ints-equal x, 3, "F - test-evaluate" -471 } -472 -473 fn find-function first: (addr handle function), name: (addr stream byte), out: (addr handle function) { -474 var curr/esi: (addr handle function) <- copy first -475 $find-function:loop: { -476 var _f/eax: (addr function) <- lookup *curr -477 var f/ecx: (addr function) <- copy _f -478 compare f, 0 -479 break-if-= -480 var curr-name-ah/eax: (addr handle array byte) <- get f, name -481 var curr-name/eax: (addr array byte) <- lookup *curr-name-ah -482 var done?/eax: boolean <- stream-data-equal? name, curr-name -483 compare done?, 0 # false -484 { -485 break-if-= -486 copy-handle *curr, out -487 break $find-function:loop -488 } -489 curr <- get f, next -490 loop -491 } -492 } -493 -494 fn perform-call _callee: (addr function), caller-stack: (addr value-stack), functions: (addr handle function) { -495 var callee/ecx: (addr function) <- copy _callee -496 # create bindings for args -497 var table-storage: table -498 var table/esi: (addr table) <- address table-storage -499 initialize-table table, 0x10 -500 bind-args callee, caller-stack, table -501 # obtain body -502 var body-ah/eax: (addr handle line) <- get callee, body -503 var body/eax: (addr line) <- lookup *body-ah -504 # perform call -505 var stack-storage: value-stack -506 var stack/edi: (addr value-stack) <- address stack-storage -507 initialize-value-stack stack, 0x10 -508 #? print-string-to-real-screen "about to enter recursive eval\n" -509 evaluate functions, table, body, 0, stack -510 #? print-string-to-real-screen "exited recursive eval\n" -511 # pop target-val from out -512 var top-addr/ecx: (addr int) <- get stack, top -513 compare *top-addr, 0 -514 break-if-<= -515 var data-ah/eax: (addr handle array value) <- get stack, data -516 var data/eax: (addr array value) <- lookup *data-ah -517 var top/edx: int <- copy *top-addr -518 top <- decrement -519 var dest-offset/edx: (offset value) <- compute-offset data, top -520 var target-val/edx: (addr value) <- index data, dest-offset -521 # stitch target-val into caller-stack -522 push-value-stack caller-stack, target-val -523 } -524 -525 # pop args from the caller-stack and bind them to successive args -526 # implies: function args are stored in reverse order -527 fn bind-args _callee: (addr function), _caller-stack: (addr value-stack), table: (addr table) { -528 var callee/ecx: (addr function) <- copy _callee -529 var curr-arg-ah/eax: (addr handle word) <- get callee, args -530 var curr-arg/eax: (addr word) <- lookup *curr-arg-ah -531 # -532 var curr-key-storage: (handle array byte) -533 var curr-key/edx: (addr handle array byte) <- address curr-key-storage -534 { -535 compare curr-arg, 0 -536 break-if-= -537 # create binding -538 word-to-string curr-arg, curr-key -539 { -540 # pop target-val from caller-stack -541 var caller-stack/esi: (addr value-stack) <- copy _caller-stack -542 var top-addr/ecx: (addr int) <- get caller-stack, top -543 compare *top-addr, 0 -544 break-if-<= -545 decrement *top-addr -546 var data-ah/eax: (addr handle array value) <- get caller-stack, data -547 var data/eax: (addr array value) <- lookup *data-ah -548 var top/ebx: int <- copy *top-addr -549 var dest-offset/ebx: (offset value) <- compute-offset data, top -550 var target-val/ebx: (addr value) <- index data, dest-offset -551 # create binding from curr-key to target-val -552 bind-in-table table, curr-key, target-val -553 } -554 # -555 var next-arg-ah/edx: (addr handle word) <- get curr-arg, next -556 curr-arg <- lookup *next-arg-ah -557 loop -558 } -559 } -560 -561 # Copy of 'simplify' that just tracks the maximum stack depth needed -562 # Doesn't actually need to simulate the stack, since every word has a predictable effect. -563 fn max-stack-depth first-word: (addr word), final-word: (addr word) -> _/edi: int { -564 var curr-word/eax: (addr word) <- copy first-word -565 var curr-depth/ecx: int <- copy 0 -566 var result/edi: int <- copy 0 -567 $max-stack-depth:loop: { -568 $max-stack-depth:process-word: { -569 # handle operators -570 { -571 var is-add?/eax: boolean <- word-equal? curr-word, "+" -572 compare is-add?, 0 -573 break-if-= -574 curr-depth <- decrement -575 break $max-stack-depth:process-word -576 } -577 { -578 var is-sub?/eax: boolean <- word-equal? curr-word, "-" -579 compare is-sub?, 0 -580 break-if-= -581 curr-depth <- decrement -582 break $max-stack-depth:process-word -583 } -584 { -585 var is-mul?/eax: boolean <- word-equal? curr-word, "*" -586 compare is-mul?, 0 -587 break-if-= -588 curr-depth <- decrement -589 break $max-stack-depth:process-word -590 } -591 # otherwise it's an int (do we need error-checking?) -592 curr-depth <- increment -593 # update max depth if necessary +301 var out2/esi: (addr value-stack) <- copy out +302 var top-addr/ecx: (addr int) <- get out2, top +303 compare *top-addr, 0 +304 break-if-<= +305 # pop string from out +306 var top-addr/ecx: (addr int) <- get out2, top +307 compare *top-addr, 0 +308 break-if-<= +309 decrement *top-addr +310 var data-ah/eax: (addr handle array value) <- get out2, data +311 var _data/eax: (addr array value) <- lookup *data-ah +312 var data/edi: (addr array value) <- copy _data +313 var top/eax: int <- copy *top-addr +314 var dest-offset/edx: (offset value) <- compute-offset data, top +315 var s/esi: (addr value) <- index data, dest-offset +316 # select target screen from top of out (but don't pop it) +317 compare *top-addr, 0 +318 break-if-<= +319 var top/eax: int <- copy *top-addr +320 top <- decrement +321 var dest-offset/edx: (offset value) <- compute-offset data, top +322 var target-val/edx: (addr value) <- index data, dest-offset +323 var type/eax: (addr int) <- get target-val, type +324 compare *type, 4 # screen +325 break-if-!= +326 # print string to target screen +327 var dest-ah/eax: (addr handle screen) <- get target-val, screen-data +328 var dest/eax: (addr screen) <- lookup *dest-ah +329 var r/ecx: (addr int) <- get dest, cursor-row +330 var c/edx: (addr int) <- get dest, cursor-col +331 render-value-at dest, *r, *c, s, 0 +332 break $evaluate:process-word +333 } +334 { +335 var is-move?/eax: boolean <- stream-data-equal? curr-stream, "move" +336 compare is-move?, 0 +337 break-if-= +338 var out2/esi: (addr value-stack) <- copy out +339 # pop args +340 var _r/eax: int <- pop-int-from-value-stack out2 +341 var r/ecx: int <- copy _r +342 var _c/eax: int <- pop-int-from-value-stack out2 +343 var c/edx: int <- copy _c +344 # select screen from top of out (but don't pop it) +345 var top-addr/ebx: (addr int) <- get out2, top +346 compare *top-addr, 0 +347 break-if-<= +348 var data-ah/eax: (addr handle array value) <- get out2, data +349 var _data/eax: (addr array value) <- lookup *data-ah +350 var data/edi: (addr array value) <- copy _data +351 var top/eax: int <- copy *top-addr +352 top <- decrement +353 var target-offset/eax: (offset value) <- compute-offset data, top +354 var target-val/ebx: (addr value) <- index data, target-offset +355 var type/eax: (addr int) <- get target-val, type +356 compare *type, 4 # screen +357 break-if-!= +358 var target-ah/eax: (addr handle screen) <- get target-val, screen-data +359 var target/eax: (addr screen) <- lookup *target-ah +360 move-cursor target, r, c +361 break $evaluate:process-word +362 } +363 { +364 var is-up?/eax: boolean <- stream-data-equal? curr-stream, "up" +365 compare is-up?, 0 +366 break-if-= +367 var out2/esi: (addr value-stack) <- copy out +368 var top-addr/ebx: (addr int) <- get out2, top +369 compare *top-addr, 0 +370 break-if-<= +371 # pop args +372 var _d/eax: int <- pop-int-from-value-stack out2 +373 var d/ecx: int <- copy _d +374 # select screen from top of out (but don't pop it) +375 compare *top-addr, 0 +376 break-if-<= +377 var data-ah/eax: (addr handle array value) <- get out2, data +378 var _data/eax: (addr array value) <- lookup *data-ah +379 var data/edi: (addr array value) <- copy _data +380 var top/eax: int <- copy *top-addr +381 top <- decrement +382 var target-offset/eax: (offset value) <- compute-offset data, top +383 var target-val/ebx: (addr value) <- index data, target-offset +384 var type/eax: (addr int) <- get target-val, type +385 compare *type, 4 # screen +386 break-if-!= +387 var target-ah/eax: (addr handle screen) <- get target-val, screen-data +388 var _target/eax: (addr screen) <- lookup *target-ah +389 var target/edi: (addr screen) <- copy _target +390 var r/edx: (addr int) <- get target, cursor-row +391 var c/eax: (addr int) <- get target, cursor-col +392 var col/eax: int <- copy *c +393 { +394 compare d, 0 +395 break-if-<= +396 compare *r, 1 +397 break-if-<= +398 print-string target "│" +399 decrement *r +400 move-cursor target, *r, col +401 d <- decrement +402 loop +403 } +404 break $evaluate:process-word +405 } +406 { +407 var is-down?/eax: boolean <- stream-data-equal? curr-stream, "down" +408 compare is-down?, 0 +409 break-if-= +410 var out2/esi: (addr value-stack) <- copy out +411 var top-addr/ebx: (addr int) <- get out2, top +412 compare *top-addr, 0 +413 break-if-<= +414 # pop args +415 var _d/eax: int <- pop-int-from-value-stack out2 +416 var d/ecx: int <- copy _d +417 # select screen from top of out (but don't pop it) +418 compare *top-addr, 0 +419 break-if-<= +420 var data-ah/eax: (addr handle array value) <- get out2, data +421 var _data/eax: (addr array value) <- lookup *data-ah +422 var data/edi: (addr array value) <- copy _data +423 var top/eax: int <- copy *top-addr +424 top <- decrement +425 var target-offset/eax: (offset value) <- compute-offset data, top +426 var target-val/ebx: (addr value) <- index data, target-offset +427 var type/eax: (addr int) <- get target-val, type +428 compare *type, 4 # screen +429 break-if-!= +430 var target-ah/eax: (addr handle screen) <- get target-val, screen-data +431 var _target/eax: (addr screen) <- lookup *target-ah +432 var target/edi: (addr screen) <- copy _target +433 var bound-a/ebx: (addr int) <- get target, num-rows +434 var bound/ebx: int <- copy *bound-a +435 var r/edx: (addr int) <- get target, cursor-row +436 var c/eax: (addr int) <- get target, cursor-col +437 var col/eax: int <- copy *c +438 { +439 compare d, 0 +440 break-if-<= +441 compare *r, bound +442 break-if->= +443 print-string target "│" +444 increment *r +445 move-cursor target, *r, col +446 d <- decrement +447 loop +448 } +449 break $evaluate:process-word +450 } +451 { +452 var is-left?/eax: boolean <- stream-data-equal? curr-stream, "left" +453 compare is-left?, 0 +454 break-if-= +455 var out2/esi: (addr value-stack) <- copy out +456 var top-addr/ebx: (addr int) <- get out2, top +457 compare *top-addr, 0 +458 break-if-<= +459 # pop args +460 var _d/eax: int <- pop-int-from-value-stack out2 +461 var d/ecx: int <- copy _d +462 # select screen from top of out (but don't pop it) +463 compare *top-addr, 0 +464 break-if-<= +465 var data-ah/eax: (addr handle array value) <- get out2, data +466 var _data/eax: (addr array value) <- lookup *data-ah +467 var data/edi: (addr array value) <- copy _data +468 var top/eax: int <- copy *top-addr +469 top <- decrement +470 var target-offset/eax: (offset value) <- compute-offset data, top +471 var target-val/ebx: (addr value) <- index data, target-offset +472 var type/eax: (addr int) <- get target-val, type +473 compare *type, 4 # screen +474 break-if-!= +475 var target-ah/eax: (addr handle screen) <- get target-val, screen-data +476 var _target/eax: (addr screen) <- lookup *target-ah +477 var target/edi: (addr screen) <- copy _target +478 var c/edx: (addr int) <- get target, cursor-col +479 var r/eax: (addr int) <- get target, cursor-row +480 var row/eax: int <- copy *r +481 { +482 compare d, 0 +483 break-if-<= +484 compare *c, 1 +485 break-if-<= +486 print-string target "─" +487 decrement *c +488 decrement *c # second one to undo the print above +489 move-cursor target, row, *c +490 d <- decrement +491 loop +492 } +493 break $evaluate:process-word +494 } +495 { +496 var is-right?/eax: boolean <- stream-data-equal? curr-stream, "right" +497 compare is-right?, 0 +498 break-if-= +499 var out2/esi: (addr value-stack) <- copy out +500 var top-addr/ebx: (addr int) <- get out2, top +501 compare *top-addr, 0 +502 break-if-<= +503 # pop args +504 var _d/eax: int <- pop-int-from-value-stack out2 +505 var d/ecx: int <- copy _d +506 # select screen from top of out (but don't pop it) +507 compare *top-addr, 0 +508 break-if-<= +509 var data-ah/eax: (addr handle array value) <- get out2, data +510 var _data/eax: (addr array value) <- lookup *data-ah +511 var data/edi: (addr array value) <- copy _data +512 var top/eax: int <- copy *top-addr +513 top <- decrement +514 var target-offset/eax: (offset value) <- compute-offset data, top +515 var target-val/ebx: (addr value) <- index data, target-offset +516 var type/eax: (addr int) <- get target-val, type +517 compare *type, 4 # screen +518 break-if-!= +519 var target-ah/eax: (addr handle screen) <- get target-val, screen-data +520 var _target/eax: (addr screen) <- lookup *target-ah +521 var target/edi: (addr screen) <- copy _target +522 var bound-a/ebx: (addr int) <- get target, num-rows +523 var bound/ebx: int <- copy *bound-a +524 var c/edx: (addr int) <- get target, cursor-col +525 var r/eax: (addr int) <- get target, cursor-row +526 var row/eax: int <- copy *r +527 { +528 compare d, 0 +529 break-if-<= +530 compare *c, bound +531 break-if->= +532 print-string target "─" +533 # no increment; the print took care of it +534 move-cursor target, row, *c +535 d <- decrement +536 loop +537 } +538 break $evaluate:process-word +539 } +540 ## HACKS: we're trying to avoid turning this into Forth +541 { +542 var is-dup?/eax: boolean <- stream-data-equal? curr-stream, "dup" +543 compare is-dup?, 0 +544 break-if-= +545 # read src-val from out +546 var out2/esi: (addr value-stack) <- copy out +547 var top-addr/ecx: (addr int) <- get out2, top +548 compare *top-addr, 0 +549 break-if-<= +550 var data-ah/eax: (addr handle array value) <- get out2, data +551 var data/eax: (addr array value) <- lookup *data-ah +552 var top/ecx: int <- copy *top-addr +553 top <- decrement +554 var offset/edx: (offset value) <- compute-offset data, top +555 var src-val/edx: (addr value) <- index data, offset +556 # push a copy of it +557 top <- increment +558 var offset/ebx: (offset value) <- compute-offset data, top +559 var target-val/ebx: (addr value) <- index data, offset +560 copy-object src-val, target-val +561 # commit +562 var top-addr/ecx: (addr int) <- get out2, top +563 increment *top-addr +564 break $evaluate:process-word +565 } +566 { +567 var is-swap?/eax: boolean <- stream-data-equal? curr-stream, "swap" +568 compare is-swap?, 0 +569 break-if-= +570 # read top-val from out +571 var out2/esi: (addr value-stack) <- copy out +572 var top-addr/ecx: (addr int) <- get out2, top +573 compare *top-addr, 0 +574 break-if-<= +575 var data-ah/eax: (addr handle array value) <- get out2, data +576 var data/eax: (addr array value) <- lookup *data-ah +577 var top/ecx: int <- copy *top-addr +578 top <- decrement +579 var offset/edx: (offset value) <- compute-offset data, top +580 var top-val/edx: (addr value) <- index data, offset +581 # read next val from out +582 top <- decrement +583 var offset/ebx: (offset value) <- compute-offset data, top +584 var pen-top-val/ebx: (addr value) <- index data, offset +585 # swap +586 var tmp: value +587 var tmp-a/eax: (addr value) <- address tmp +588 copy-object top-val, tmp-a +589 copy-object pen-top-val, top-val +590 copy-object tmp-a, pen-top-val +591 break $evaluate:process-word +592 } +593 ### if curr-stream defines a binding, save top of stack to bindings 594 { -595 compare curr-depth, result -596 break-if-<= -597 result <- copy curr-depth -598 } -599 } -600 # if curr-word == final-word break -601 compare curr-word, final-word -602 break-if-= -603 # curr-word = curr-word->next -604 var next-word-ah/edx: (addr handle word) <- get curr-word, next -605 curr-word <- lookup *next-word-ah -606 # -607 loop -608 } -609 return result -610 } +595 var done?/eax: boolean <- stream-empty? curr-stream +596 compare done?, 0 # false +597 break-if-!= +598 var new-byte/eax: byte <- read-byte curr-stream +599 compare new-byte, 0x3d # '=' +600 break-if-!= +601 # pop target-val from out +602 var out2/esi: (addr value-stack) <- copy out +603 var top-addr/ecx: (addr int) <- get out2, top +604 compare *top-addr, 0 +605 break-if-<= +606 var data-ah/eax: (addr handle array value) <- get out2, data +607 var data/eax: (addr array value) <- lookup *data-ah +608 var top/edx: int <- copy *top-addr +609 top <- decrement +610 var dest-offset/edx: (offset value) <- compute-offset data, top +611 var target-val/edx: (addr value) <- index data, dest-offset +612 # create binding from curr-stream to target-val +613 var key-h: (handle array byte) +614 var key/ecx: (addr handle array byte) <- address key-h +615 stream-to-array curr-stream, key +616 bind-in-table bindings, key, target-val +617 break $evaluate:process-word +618 } +619 rewind-stream curr-stream +620 ### if curr-stream is a known function name, call it appropriately +621 { +622 var callee-h: (handle function) +623 var callee-ah/eax: (addr handle function) <- address callee-h +624 find-function functions, curr-stream, callee-ah +625 var callee/eax: (addr function) <- lookup *callee-ah +626 compare callee, 0 +627 break-if-= +628 perform-call callee, out, functions +629 break $evaluate:process-word +630 } +631 ### if it's a name, push its value +632 { +633 compare bindings, 0 +634 break-if-= +635 var tmp: (handle array byte) +636 var curr-string-ah/edx: (addr handle array byte) <- address tmp +637 stream-to-array curr-stream, curr-string-ah # unfortunate leak +638 var curr-string/eax: (addr array byte) <- lookup *curr-string-ah +639 var val-storage: (handle value) +640 var val-ah/edi: (addr handle value) <- address val-storage +641 lookup-binding bindings, curr-string, val-ah +642 var val/eax: (addr value) <- lookup *val-ah +643 compare val, 0 +644 break-if-= +645 push-value-stack out, val +646 break $evaluate:process-word +647 } +648 ### if the word starts with a quote and ends with a quote, turn it into a string +649 { +650 var start/eax: byte <- stream-first curr-stream +651 compare start, 0x22 # double-quote +652 break-if-!= +653 var end/eax: byte <- stream-final curr-stream +654 compare end, 0x22 # double-quote +655 break-if-!= +656 var h: (handle array byte) +657 var s/eax: (addr handle array byte) <- address h +658 unquote-stream-to-array curr-stream, s # leak +659 push-string-to-value-stack out, *s +660 break $evaluate:process-word +661 } +662 ### if the word starts with a '[' and ends with a ']', turn it into an array +663 { +664 var start/eax: byte <- stream-first curr-stream +665 compare start, 0x5b # '[' +666 break-if-!= +667 var end/eax: byte <- stream-final curr-stream +668 compare end, 0x5d # ']' +669 break-if-!= +670 # wastefully create a new input string to strip quotes +671 var h: (handle array value) +672 var input-ah/eax: (addr handle array byte) <- address h +673 unquote-stream-to-array curr-stream, input-ah # leak +674 # wastefully parse input into int-array +675 # TODO: support parsing arrays of other types +676 var input/eax: (addr array byte) <- lookup *input-ah +677 var h2: (handle array int) +678 var int-array-ah/esi: (addr handle array int) <- address h2 +679 parse-array-of-decimal-ints input, int-array-ah # leak +680 var _int-array/eax: (addr array int) <- lookup *int-array-ah +681 var int-array/esi: (addr array int) <- copy _int-array +682 var len/ebx: int <- length int-array +683 # push value-array of same size as int-array +684 var h3: (handle array value) +685 var value-array-ah/eax: (addr handle array value) <- address h3 +686 populate value-array-ah, len +687 push-array-to-value-stack out, *value-array-ah +688 # copy int-array into value-array +689 var _value-array/eax: (addr array value) <- lookup *value-array-ah +690 var value-array/edi: (addr array value) <- copy _value-array +691 var i/eax: int <- copy 0 +692 { +693 compare i, len +694 break-if->= +695 var src-addr/ecx: (addr int) <- index int-array, i +696 var src/ecx: int <- copy *src-addr +697 var dest-offset/edx: (offset value) <- compute-offset value-array, i +698 var dest-val/edx: (addr value) <- index value-array, dest-offset +699 var dest/edx: (addr int) <- get dest-val, int-data +700 copy-to *dest, src +701 i <- increment +702 loop +703 } +704 break $evaluate:process-word +705 } +706 ### otherwise assume it's a literal number and push it +707 { +708 var n/eax: int <- parse-decimal-int-from-stream curr-stream +709 push-int-to-value-stack out, n +710 } +711 } +712 # termination check +713 compare curr, end +714 break-if-= +715 # update +716 var next-word-ah/edx: (addr handle word) <- get curr, next +717 curr <- lookup *next-word-ah +718 # +719 loop +720 } +721 # process next line if necessary +722 var line/eax: (addr line) <- copy scratch +723 var next-line-ah/eax: (addr handle line) <- get line, next +724 var next-line/eax: (addr line) <- lookup *next-line-ah +725 compare next-line, 0 +726 break-if-= +727 evaluate functions, bindings, next-line, end, out +728 } +729 +730 fn test-evaluate { +731 var line-storage: line +732 var line/esi: (addr line) <- address line-storage +733 var first-word-ah/eax: (addr handle word) <- get line-storage, data +734 allocate-word-with first-word-ah, "3" +735 append-word-with *first-word-ah, "=a" +736 var next-line-ah/eax: (addr handle line) <- get line-storage, next +737 allocate next-line-ah +738 var next-line/eax: (addr line) <- lookup *next-line-ah +739 var first-word-ah/eax: (addr handle word) <- get next-line, data +740 allocate-word-with first-word-ah, "a" +741 var functions-storage: (handle function) +742 var functions/ecx: (addr handle function) <- address functions-storage +743 var table-storage: table +744 var table/ebx: (addr table) <- address table-storage +745 initialize-table table, 0x10 +746 var stack-storage: value-stack +747 var stack/edi: (addr value-stack) <- address stack-storage +748 initialize-value-stack stack, 0x10 +749 evaluate functions, table, line, 0, stack +750 var x/eax: int <- pop-int-from-value-stack stack +751 check-ints-equal x, 3, "F - test-evaluate" +752 } +753 +754 fn find-function first: (addr handle function), name: (addr stream byte), out: (addr handle function) { +755 var curr/esi: (addr handle function) <- copy first +756 $find-function:loop: { +757 var _f/eax: (addr function) <- lookup *curr +758 var f/ecx: (addr function) <- copy _f +759 compare f, 0 +760 break-if-= +761 var curr-name-ah/eax: (addr handle array byte) <- get f, name +762 var curr-name/eax: (addr array byte) <- lookup *curr-name-ah +763 var done?/eax: boolean <- stream-data-equal? name, curr-name +764 compare done?, 0 # false +765 { +766 break-if-= +767 copy-handle *curr, out +768 break $find-function:loop +769 } +770 curr <- get f, next +771 loop +772 } +773 } +774 +775 fn perform-call _callee: (addr function), caller-stack: (addr value-stack), functions: (addr handle function) { +776 var callee/ecx: (addr function) <- copy _callee +777 # create bindings for args +778 var table-storage: table +779 var table/esi: (addr table) <- address table-storage +780 initialize-table table, 0x10 +781 bind-args callee, caller-stack, table +782 # obtain body +783 var body-ah/eax: (addr handle line) <- get callee, body +784 var body/eax: (addr line) <- lookup *body-ah +785 # perform call +786 var stack-storage: value-stack +787 var stack/edi: (addr value-stack) <- address stack-storage +788 initialize-value-stack stack, 0x10 +789 #? print-string-to-real-screen "about to enter recursive eval\n" +790 evaluate functions, table, body, 0, stack +791 #? print-string-to-real-screen "exited recursive eval\n" +792 # pop target-val from out +793 var top-addr/ecx: (addr int) <- get stack, top +794 compare *top-addr, 0 +795 break-if-<= +796 var data-ah/eax: (addr handle array value) <- get stack, data +797 var data/eax: (addr array value) <- lookup *data-ah +798 var top/edx: int <- copy *top-addr +799 top <- decrement +800 var dest-offset/edx: (offset value) <- compute-offset data, top +801 var target-val/edx: (addr value) <- index data, dest-offset +802 # stitch target-val into caller-stack +803 push-value-stack caller-stack, target-val +804 } +805 +806 # pop args from the caller-stack and bind them to successive args +807 # implies: function args are stored in reverse order +808 fn bind-args _callee: (addr function), _caller-stack: (addr value-stack), table: (addr table) { +809 var callee/ecx: (addr function) <- copy _callee +810 var curr-arg-ah/eax: (addr handle word) <- get callee, args +811 var curr-arg/eax: (addr word) <- lookup *curr-arg-ah +812 # +813 var curr-key-storage: (handle array byte) +814 var curr-key/edx: (addr handle array byte) <- address curr-key-storage +815 { +816 compare curr-arg, 0 +817 break-if-= +818 # create binding +819 word-to-string curr-arg, curr-key +820 { +821 # pop target-val from caller-stack +822 var caller-stack/esi: (addr value-stack) <- copy _caller-stack +823 var top-addr/ecx: (addr int) <- get caller-stack, top +824 compare *top-addr, 0 +825 break-if-<= +826 decrement *top-addr +827 var data-ah/eax: (addr handle array value) <- get caller-stack, data +828 var data/eax: (addr array value) <- lookup *data-ah +829 var top/ebx: int <- copy *top-addr +830 var dest-offset/ebx: (offset value) <- compute-offset data, top +831 var target-val/ebx: (addr value) <- index data, dest-offset +832 # create binding from curr-key to target-val +833 bind-in-table table, curr-key, target-val +834 } +835 # +836 var next-arg-ah/edx: (addr handle word) <- get curr-arg, next +837 curr-arg <- lookup *next-arg-ah +838 loop +839 } +840 } +841 +842 # Copy of 'simplify' that just tracks the maximum stack depth needed +843 # Doesn't actually need to simulate the stack, since every word has a predictable effect. +844 fn max-stack-depth first-word: (addr word), final-word: (addr word) -> _/edi: int { +845 var curr-word/eax: (addr word) <- copy first-word +846 var curr-depth/ecx: int <- copy 0 +847 var result/edi: int <- copy 0 +848 $max-stack-depth:loop: { +849 $max-stack-depth:process-word: { +850 # handle operators +851 { +852 var is-add?/eax: boolean <- word-equal? curr-word, "+" +853 compare is-add?, 0 +854 break-if-= +855 curr-depth <- decrement +856 break $max-stack-depth:process-word +857 } +858 { +859 var is-sub?/eax: boolean <- word-equal? curr-word, "-" +860 compare is-sub?, 0 +861 break-if-= +862 curr-depth <- decrement +863 break $max-stack-depth:process-word +864 } +865 { +866 var is-mul?/eax: boolean <- word-equal? curr-word, "*" +867 compare is-mul?, 0 +868 break-if-= +869 curr-depth <- decrement +870 break $max-stack-depth:process-word +871 } +872 # otherwise it's an int (do we need error-checking?) +873 curr-depth <- increment +874 # update max depth if necessary +875 { +876 compare curr-depth, result +877 break-if-<= +878 result <- copy curr-depth +879 } +880 } +881 # if curr-word == final-word break +882 compare curr-word, final-word +883 break-if-= +884 # curr-word = curr-word->next +885 var next-word-ah/edx: (addr handle word) <- get curr-word, next +886 curr-word <- lookup *next-word-ah +887 # +888 loop +889 } +890 return result +891 } diff --git a/html/apps/tile/surface.mu.html b/html/apps/tile/surface.mu.html index 16332221..21a13126 100644 --- a/html/apps/tile/surface.mu.html +++ b/html/apps/tile/surface.mu.html @@ -190,33 +190,33 @@ if ('onhashchange' in window) { 130 # print a cell with all its formatting at the cursor location 131 fn print-screen-cell screen: (addr screen), _cell: (addr screen-cell) { 132 var cell/esi: (addr screen-cell) <- copy _cell -133 reset-formatting screen +133 reset-formatting screen 134 var fg/eax: (addr int) <- get cell, color 135 var bg/ecx: (addr int) <- get cell, background-color -136 start-color screen, *fg, *bg +136 start-color screen, *fg, *bg 137 var tmp/eax: (addr boolean) <- get cell, bold? 138 { 139 compare *tmp, 0 140 break-if-= -141 start-bold screen +141 start-bold screen 142 } 143 { 144 tmp <- get cell, underline? 145 compare *tmp, 0 146 break-if-= -147 start-underline screen +147 start-underline screen 148 } 149 { 150 tmp <- get cell, reverse? 151 compare *tmp, 0 152 break-if-= -153 start-reverse-video screen +153 start-reverse-video screen 154 } 155 { 156 tmp <- get cell, blink? 157 compare *tmp, 0 158 break-if-= -159 start-blinking screen +159 start-blinking screen 160 } 161 var g/eax: (addr grapheme) <- get cell, data 162 print-grapheme screen, *g @@ -387,9 +387,9 @@ if ('onhashchange' in window) { 327 render-surface s-addr 328 var screen-ah/eax: (addr handle screen) <- get s-addr, screen 329 var screen-addr/eax: (addr screen) <- lookup *screen-ah -330 check-screen-row screen-addr, 1, "abcd", "F - test-surface-pin-at-origin" -331 check-screen-row screen-addr, 2, "ghij", "F - test-surface-pin-at-origin" -332 check-screen-row screen-addr, 3, "mnop", "F - test-surface-pin-at-origin" +330 check-screen-row screen-addr, 1, "abcd", "F - test-surface-pin-at-origin" +331 check-screen-row screen-addr, 2, "ghij", "F - test-surface-pin-at-origin" +332 check-screen-row screen-addr, 3, "mnop", "F - test-surface-pin-at-origin" 333 } 334 335 # pin (1, 1) to (2, 1) on screen; screen goes past edge of the universe @@ -405,9 +405,9 @@ if ('onhashchange' in window) { 345 var screen-ah/eax: (addr handle screen) <- get s-addr, screen 346 var screen-addr/eax: (addr screen) <- lookup *screen-ah 347 # surface edge reached (should seldom happen in the app) -348 check-screen-row screen-addr, 1, " ", "F - test-surface-pin-2" -349 check-screen-row screen-addr, 2, "abcd", "F - test-surface-pin-2" -350 check-screen-row screen-addr, 3, "ghij", "F - test-surface-pin-2" +348 check-screen-row screen-addr, 1, " ", "F - test-surface-pin-2" +349 check-screen-row screen-addr, 2, "abcd", "F - test-surface-pin-2" +350 check-screen-row screen-addr, 3, "ghij", "F - test-surface-pin-2" 351 } 352 353 # pin (2, 1) to (1, 1) on screen @@ -422,9 +422,9 @@ if ('onhashchange' in window) { 362 render-surface s-addr 363 var screen-ah/eax: (addr handle screen) <- get s-addr, screen 364 var screen-addr/eax: (addr screen) <- lookup *screen-ah -365 check-screen-row screen-addr, 1, "ghij", "F - test-surface-pin-3" -366 check-screen-row screen-addr, 2, "mnop", "F - test-surface-pin-3" -367 check-screen-row screen-addr, 3, "stuv", "F - test-surface-pin-3" +365 check-screen-row screen-addr, 1, "ghij", "F - test-surface-pin-3" +366 check-screen-row screen-addr, 2, "mnop", "F - test-surface-pin-3" +367 check-screen-row screen-addr, 3, "stuv", "F - test-surface-pin-3" 368 } 369 370 # pin (1, 1) to (1, 2) on screen; screen goes past edge of the universe @@ -440,9 +440,9 @@ if ('onhashchange' in window) { 380 var screen-ah/eax: (addr handle screen) <- get s-addr, screen 381 var screen-addr/eax: (addr screen) <- lookup *screen-ah 382 # surface edge reached (should seldom happen in the app) -383 check-screen-row screen-addr, 1, " abc", "F - test-surface-pin-4" -384 check-screen-row screen-addr, 2, " ghi", "F - test-surface-pin-4" -385 check-screen-row screen-addr, 3, " mno", "F - test-surface-pin-4" +383 check-screen-row screen-addr, 1, " abc", "F - test-surface-pin-4" +384 check-screen-row screen-addr, 2, " ghi", "F - test-surface-pin-4" +385 check-screen-row screen-addr, 3, " mno", "F - test-surface-pin-4" 386 } 387 388 # pin (1, 2) to (1, 1) on screen @@ -457,9 +457,9 @@ if ('onhashchange' in window) { 397 render-surface s-addr 398 var screen-ah/eax: (addr handle screen) <- get s-addr, screen 399 var screen-addr/eax: (addr screen) <- lookup *screen-ah -400 check-screen-row screen-addr, 1, "bcde", "F - test-surface-pin-5" -401 check-screen-row screen-addr, 2, "hijk", "F - test-surface-pin-5" -402 check-screen-row screen-addr, 3, "nopq", "F - test-surface-pin-5" +400 check-screen-row screen-addr, 1, "bcde", "F - test-surface-pin-5" +401 check-screen-row screen-addr, 2, "hijk", "F - test-surface-pin-5" +402 check-screen-row screen-addr, 3, "nopq", "F - test-surface-pin-5" 403 } 404 405 fn initialize-surface-with-fake-screen _self: (addr surface), nrows: int, ncols: int, in: (addr array byte) { diff --git a/html/apps/tile/table.mu.html b/html/apps/tile/table.mu.html index 88a51f9d..5a924e7e 100644 --- a/html/apps/tile/table.mu.html +++ b/html/apps/tile/table.mu.html @@ -14,6 +14,7 @@ pre { white-space: pre-wrap; font-family: monospace; color: #000000; background- body { font-size:12pt; font-family: monospace; color: #000000; background-color: #c6c6c6; } a { color:inherit; } * { font-size:12pt; font-size: 1em; } +.CommentedCode { color: #8a8a8a; } .muComment { color: #005faf; } .LineNr { } .SpecialChar { color: #d70000; } @@ -56,97 +57,171 @@ if ('onhashchange' in window) { https://github.com/akkartik/mu/blob/master/apps/tile/table.mu
- 1 fn initialize-table _self: (addr table), n: int {
- 2   var self/esi: (addr table) <- copy _self
- 3   var data-ah/eax: (addr handle array bind) <- get self, data
- 4   populate data-ah, n
- 5 }
- 6 
- 7 fn bind-in-table _self: (addr table), key: (addr handle array byte), val: (addr value) {
- 8   var self/esi: (addr table) <- copy _self
- 9   var data-ah/esi: (addr handle array bind) <- get self, data
-10   var _data/eax: (addr array bind) <- lookup *data-ah
-11   var data/esi: (addr array bind) <- copy _data
-12   var next-empty-slot-index/eax: (offset bind) <- next-empty-slot data, key
-13   var dest/eax: (addr bind) <- index data, next-empty-slot-index
-14   make-binding dest, key, val
-15 }
-16 
-17 # manual test: full array of binds
-18 fn next-empty-slot _data: (addr array bind), key: (addr handle array byte) -> _/eax: (offset bind) {
-19   var data/esi: (addr array bind) <- copy _data
-20   var len/ecx: int <- length data
-21   var i/edx: int <- copy 0
-22   var result/eax: (offset bind) <- copy 0
-23   $next-empty-slot:loop: {
-24     result <- compute-offset data, i
-25     compare i, len
-26     break-if->=
-27     {
-28       var target/esi: (addr bind) <- index data, result
-29       var target2/esi: (addr handle array byte) <- get target, key
-30       var target3/eax: (addr array byte) <- lookup *target2
-31       compare target3, 0
-32       break-if-= $next-empty-slot:loop
-33       # TODO: how to indicate that key already exists? we don't want to permit rebinding
-34     }
-35     i <- increment
-36     loop
-37   }
-38   return result
-39 }
-40 
-41 fn make-int-binding _self: (addr bind), key: (addr handle array byte), _val: int {
-42   var self/esi: (addr bind) <- copy _self
-43   var dest/eax: (addr handle array byte) <- get self, key
-44   copy-object key, dest
-45   var dest2/eax: (addr handle value) <- get self, value
-46   allocate dest2
-47   var dest3/eax: (addr value) <- lookup *dest2
-48   var dest4/eax: (addr int) <- get dest3, int-data
-49   var val/ecx: int <- copy _val
-50   copy-to *dest4, val
-51 }
-52 
-53 fn make-binding _self: (addr bind), key: (addr handle array byte), val: (addr value) {
-54   var self/esi: (addr bind) <- copy _self
-55   var dest/eax: (addr handle array byte) <- get self, key
-56   copy-object key, dest
-57   var dest2/eax: (addr handle value) <- get self, value
-58   allocate dest2
-59   var dest3/eax: (addr value) <- lookup *dest2
-60   copy-object val, dest3
-61 }
-62 
-63 fn lookup-binding _self: (addr table), key: (addr array byte), out: (addr handle value) {
-64   var self/esi: (addr table) <- copy _self
-65   var data-ah/esi: (addr handle array bind) <- get self, data
-66   var _data/eax: (addr array bind) <- lookup *data-ah
-67   var data/esi: (addr array bind) <- copy _data
-68   var len/edx: int <- length data
-69   var i/ebx: int <- copy 0
-70   $lookup-binding:loop: {
-71     compare i, len
-72     break-if->=
-73     {
-74       var offset/edx: (offset bind) <- compute-offset data, i
-75       var target-bind/esi: (addr bind) <- index data, offset
-76       var target2/edx: (addr handle array byte) <- get target-bind, key
-77       var target3/eax: (addr array byte) <- lookup *target2
-78       compare target3, 0
-79       break-if-= $lookup-binding:loop
-80       var is-match?/eax: boolean <- string-equal? target3, key
-81       compare is-match?, 0  # false
-82       break-if-=
-83       # found
-84       var target/eax: (addr handle value) <- get target-bind, value
-85       copy-object target, out
-86       break $lookup-binding:loop
-87     }
-88     i <- increment
-89     loop
-90   }
-91 }
+  1 fn initialize-table _self: (addr table), n: int {
+  2   var self/esi: (addr table) <- copy _self
+  3   var data-ah/eax: (addr handle array bind) <- get self, data
+  4   populate data-ah, n
+  5 }
+  6 
+  7 fn deep-copy-table _src: (addr table), _dest: (addr table) {
+  8 #?   print-string 0, "deep-copy-table\n"
+  9   var src/eax: (addr table) <- copy _src
+ 10   var src-data-ah/eax: (addr handle array bind) <- get src, data
+ 11   var _src-data/eax: (addr array bind) <- lookup *src-data-ah
+ 12   var src-data/esi: (addr array bind) <- copy _src-data
+ 13   var n/ecx: int <- length src-data
+ 14   var dest/eax: (addr table) <- copy _dest
+ 15   initialize-table dest, n
+ 16   var dest-data-ah/eax: (addr handle array bind) <- get dest, data
+ 17   var _dest-data/eax: (addr array bind) <- lookup *dest-data-ah
+ 18   var dest-data/edi: (addr array bind) <- copy _dest-data
+ 19   var i/eax: int <- copy 0
+ 20   {
+ 21     compare i, n
+ 22     break-if->=
+ 23 #?     print-string 0, "iter\n"
+ 24     $deep-copy:element: {
+ 25       var offset/edx: (offset bind) <- compute-offset src-data, i
+ 26       var src-bind/ecx: (addr bind) <- index src-data, offset
+ 27       var dest-bind/edx: (addr bind) <- index dest-data, offset
+ 28       var src-key-ah/ebx: (addr handle array byte) <- get src-bind, key
+ 29       var src-key/eax: (addr array byte) <- lookup *src-key-ah
+ 30       compare src-key, 0
+ 31       break-if-=
+ 32       # copy key
+ 33       var dest-key-ah/eax: (addr handle array byte) <- get dest-bind, key
+ 34       copy-object src-key-ah, dest-key-ah
+ 35       # deep copy value
+ 36       var src-val-ah/eax: (addr handle value) <- get src-bind, value
+ 37       var _src-val/eax: (addr value) <- lookup *src-val-ah
+ 38       var src-val/ecx: (addr value) <- copy _src-val
+ 39       var dest-val-ah/eax: (addr handle value) <- get dest-bind, value
+ 40       allocate dest-val-ah
+ 41       var dest-val/eax: (addr value) <- lookup *dest-val-ah
+ 42 #?       print-string 0, "deep copy value {\n"
+ 43       deep-copy-value src-val, dest-val
+ 44 #?       print-string 0, "}\n"
+ 45     }
+ 46     i <- increment
+ 47     loop
+ 48   }
+ 49 #?   print-string 0, "end deep-copy-table\n"
+ 50 }
+ 51 
+ 52 fn bind-in-table _self: (addr table), key: (addr handle array byte), val: (addr value) {
+ 53   var self/esi: (addr table) <- copy _self
+ 54   var data-ah/esi: (addr handle array bind) <- get self, data
+ 55   var _data/eax: (addr array bind) <- lookup *data-ah
+ 56   var data/esi: (addr array bind) <- copy _data
+ 57   var next-empty-slot-index/eax: (offset bind) <- next-empty-slot data, key
+ 58   var dest/eax: (addr bind) <- index data, next-empty-slot-index
+ 59   make-binding dest, key, val
+ 60 }
+ 61 
+ 62 # manual test: full array of binds
+ 63 fn next-empty-slot _data: (addr array bind), key: (addr handle array byte) -> _/eax: (offset bind) {
+ 64   var data/esi: (addr array bind) <- copy _data
+ 65   var len/ecx: int <- length data
+ 66   var i/edx: int <- copy 0
+ 67   var result/eax: (offset bind) <- copy 0
+ 68   $next-empty-slot:loop: {
+ 69     result <- compute-offset data, i
+ 70     compare i, len
+ 71     break-if->=
+ 72     {
+ 73       var target/esi: (addr bind) <- index data, result
+ 74       var target2/esi: (addr handle array byte) <- get target, key
+ 75       var target3/eax: (addr array byte) <- lookup *target2
+ 76       compare target3, 0
+ 77       break-if-= $next-empty-slot:loop
+ 78       # TODO: how to indicate that key already exists? we don't want to permit rebinding
+ 79     }
+ 80     i <- increment
+ 81     loop
+ 82   }
+ 83   return result
+ 84 }
+ 85 
+ 86 fn make-int-binding _self: (addr bind), key: (addr handle array byte), _val: int {
+ 87   var self/esi: (addr bind) <- copy _self
+ 88   var dest/eax: (addr handle array byte) <- get self, key
+ 89   copy-object key, dest
+ 90   var dest2/eax: (addr handle value) <- get self, value
+ 91   allocate dest2
+ 92   var dest3/eax: (addr value) <- lookup *dest2
+ 93   var dest4/eax: (addr int) <- get dest3, int-data
+ 94   var val/ecx: int <- copy _val
+ 95   copy-to *dest4, val
+ 96 }
+ 97 
+ 98 fn make-binding _self: (addr bind), key: (addr handle array byte), val: (addr value) {
+ 99   var self/esi: (addr bind) <- copy _self
+100   var dest/eax: (addr handle array byte) <- get self, key
+101   copy-object key, dest
+102   var dest2/eax: (addr handle value) <- get self, value
+103   allocate dest2
+104   var dest3/eax: (addr value) <- lookup *dest2
+105   copy-object val, dest3
+106 }
+107 
+108 fn lookup-binding _self: (addr table), key: (addr array byte), out: (addr handle value) {
+109   var self/esi: (addr table) <- copy _self
+110   var data-ah/esi: (addr handle array bind) <- get self, data
+111   var _data/eax: (addr array bind) <- lookup *data-ah
+112   var data/esi: (addr array bind) <- copy _data
+113   var len/edx: int <- length data
+114   var i/ebx: int <- copy 0
+115   $lookup-binding:loop: {
+116     compare i, len
+117     break-if->=
+118     {
+119       var offset/edx: (offset bind) <- compute-offset data, i
+120       var target-bind/esi: (addr bind) <- index data, offset
+121       var target2/edx: (addr handle array byte) <- get target-bind, key
+122       var target3/eax: (addr array byte) <- lookup *target2
+123       compare target3, 0
+124       break-if-= $lookup-binding:loop
+125       var is-match?/eax: boolean <- string-equal? target3, key
+126       compare is-match?, 0  # false
+127       break-if-=
+128       # found
+129       var target/eax: (addr handle value) <- get target-bind, value
+130       copy-object target, out
+131       break $lookup-binding:loop
+132     }
+133     i <- increment
+134     loop
+135   }
+136 }
+137 
+138 fn dump-table _self: (addr table) {
+139   var self/esi: (addr table) <- copy _self
+140   var data-ah/esi: (addr handle array bind) <- get self, data
+141   var _data/eax: (addr array bind) <- lookup *data-ah
+142   var data/esi: (addr array bind) <- copy _data
+143   var len/edx: int <- length data
+144   var i/ebx: int <- copy 0
+145   {
+146     compare i, len
+147     break-if->=
+148     var offset/edx: (offset bind) <- compute-offset data, i
+149     var target-bind/esi: (addr bind) <- index data, offset
+150     var key-ah/edx: (addr handle array byte) <- get target-bind, key
+151     var key/eax: (addr array byte) <- lookup *key-ah
+152     compare key, 0
+153     break-if-=
+154     print-string 0, key
+155     print-string 0, ": "
+156     var val-ah/eax: (addr handle value) <- get target-bind, value
+157     var val/eax: (addr value) <- lookup *val-ah
+158     var type/eax: (addr int) <- get val, type
+159     print-int32-hex 0, *type
+160     print-string 0, "\n"
+161     i <- increment
+162     loop
+163   }
+164   print-string 0, "\n"
+165 }
 
diff --git a/html/apps/tile/value-stack.mu.html b/html/apps/tile/value-stack.mu.html index 50db3d41..532df190 100644 --- a/html/apps/tile/value-stack.mu.html +++ b/html/apps/tile/value-stack.mu.html @@ -91,227 +91,145 @@ if ('onhashchange' in window) { 32 #? print-int32-hex-to-real-screen val 33 copy-to *dest-addr2, val 34 increment *top-addr - 35 } - 36 - 37 fn push-string-to-value-stack _self: (addr value-stack), val: (handle array byte) { - 38 var self/esi: (addr value-stack) <- copy _self - 39 var top-addr/ecx: (addr int) <- get self, top - 40 var data-ah/edx: (addr handle array value) <- get self, data - 41 var data/eax: (addr array value) <- lookup *data-ah - 42 var top/edx: int <- copy *top-addr - 43 var dest-offset/edx: (offset value) <- compute-offset data, top - 44 var dest-addr/edx: (addr value) <- index data, dest-offset - 45 var dest-addr2/eax: (addr handle array byte) <- get dest-addr, text-data - 46 copy-handle val, dest-addr2 - 47 var dest-addr3/eax: (addr int) <- get dest-addr, type - 48 #? print-string 0, "setting type to 1: " - 49 #? { - 50 #? var foo/eax: int <- copy dest-addr3 - 51 #? print-int32-hex 0, foo - 52 #? } - 53 #? print-string 0, "\n" - 54 copy-to *dest-addr3, 1 # type string - 55 increment *top-addr - 56 } - 57 - 58 fn push-array-to-value-stack _self: (addr value-stack), val: (handle array value) { - 59 var self/esi: (addr value-stack) <- copy _self - 60 var top-addr/ecx: (addr int) <- get self, top - 61 var data-ah/edx: (addr handle array value) <- get self, data - 62 var data/eax: (addr array value) <- lookup *data-ah - 63 var top/edx: int <- copy *top-addr - 64 var dest-offset/edx: (offset value) <- compute-offset data, top - 65 var dest-addr/edx: (addr value) <- index data, dest-offset - 66 var dest-addr2/eax: (addr handle array value) <- get dest-addr, array-data - 67 copy-handle val, dest-addr2 - 68 # update type - 69 var dest-addr3/eax: (addr int) <- get dest-addr, type - 70 copy-to *dest-addr3, 2 # type array - 71 increment *top-addr - 72 } - 73 - 74 fn push-value-stack _self: (addr value-stack), val: (addr value) { - 75 var self/esi: (addr value-stack) <- copy _self - 76 var top-addr/ecx: (addr int) <- get self, top - 77 var data-ah/edx: (addr handle array value) <- get self, data - 78 var data/eax: (addr array value) <- lookup *data-ah - 79 var top/edx: int <- copy *top-addr - 80 var dest-offset/edx: (offset value) <- compute-offset data, top - 81 var dest-addr/edx: (addr value) <- index data, dest-offset - 82 copy-object val, dest-addr - 83 increment *top-addr - 84 } - 85 - 86 fn pop-int-from-value-stack _self: (addr value-stack) -> _/eax: int { - 87 var self/esi: (addr value-stack) <- copy _self - 88 var top-addr/ecx: (addr int) <- get self, top - 89 { - 90 compare *top-addr, 0 - 91 break-if-> - 92 return -1 - 93 } - 94 decrement *top-addr - 95 var data-ah/edx: (addr handle array value) <- get self, data - 96 var data/eax: (addr array value) <- lookup *data-ah - 97 var top/edx: int <- copy *top-addr - 98 var dest-offset/edx: (offset value) <- compute-offset data, top - 99 var result-addr/eax: (addr value) <- index data, dest-offset -100 var result-addr2/eax: (addr int) <- get result-addr, int-data -101 return *result-addr2 -102 } -103 -104 fn value-stack-empty? _self: (addr value-stack) -> _/eax: boolean { -105 var self/esi: (addr value-stack) <- copy _self -106 var top/eax: (addr int) <- get self, top -107 compare *top, 0 -108 { -109 break-if-!= -110 return 1 # true -111 } -112 return 0 # false -113 } -114 -115 fn value-stack-length _self: (addr value-stack) -> _/eax: int { -116 var self/esi: (addr value-stack) <- copy _self -117 var top-addr/eax: (addr int) <- get self, top -118 return *top-addr -119 } -120 -121 fn value-stack-max-width _self: (addr value-stack) -> _/eax: int { -122 var self/esi: (addr value-stack) <- copy _self -123 var data-ah/edi: (addr handle array value) <- get self, data -124 var _data/eax: (addr array value) <- lookup *data-ah -125 var data/edi: (addr array value) <- copy _data -126 var top-addr/ecx: (addr int) <- get self, top -127 var i/ebx: int <- copy 0 -128 var result: int -129 { -130 compare i, *top-addr -131 break-if->= -132 var o/edx: (offset value) <- compute-offset data, i -133 var v/edx: (addr value) <- index data, o -134 var w/eax: int <- value-width v, 1 # top-level=true -135 # if (w > result) w = result -136 { -137 compare w, result -138 break-if-<= -139 copy-to result, w -140 } -141 i <- increment -142 loop -143 } -144 return result -145 } -146 -147 fn value-width _v: (addr value), top-level: boolean -> _/eax: int { -148 var v/esi: (addr value) <- copy _v -149 var type/eax: (addr int) <- get v, type -150 { -151 compare *type, 0 # int -152 break-if-!= -153 var v-int/edx: (addr int) <- get v, int-data -154 var result/eax: int <- decimal-size *v-int -155 return result -156 } -157 { -158 compare *type, 1 # string -159 break-if-!= -160 var s-ah/eax: (addr handle array byte) <- get v, text-data -161 var s/eax: (addr array byte) <- lookup *s-ah -162 compare s, 0 -163 break-if-= -164 var result/eax: int <- length s -165 compare result, 0xd # max string size -166 { -167 break-if-<= -168 result <- copy 0xd -169 } -170 # if it's a nested string, include space for quotes -171 # we don't do this for the top-level, where the quotes will overflow -172 # into surrounding padding. -173 compare top-level, 0 # false -174 { -175 break-if-!= -176 result <- add 2 -177 } -178 return result -179 } -180 { -181 compare *type, 2 # array -182 break-if-!= -183 var a-ah/eax: (addr handle array value) <- get v, array-data -184 var a/eax: (addr array value) <- lookup *a-ah -185 compare a, 0 -186 break-if-= -187 var result/eax: int <- array-width a -188 return result -189 } -190 { -191 compare *type, 3 # file handle -192 break-if-!= -193 var f-ah/eax: (addr handle buffered-file) <- get v, file-data -194 var f/eax: (addr buffered-file) <- lookup *f-ah -195 compare f, 0 -196 break-if-= -197 # TODO: visualizing file handles -198 return 4 -199 } -200 return 0 -201 } -202 -203 # keep sync'd with render-array -204 fn array-width _a: (addr array value) -> _/eax: int { -205 var a/esi: (addr array value) <- copy _a -206 var max/ecx: int <- length a -207 var i/eax: int <- copy 0 -208 var result/edi: int <- copy 0 -209 { -210 compare i, max -211 break-if->= -212 { -213 compare i, 0 -214 break-if-= -215 result <- increment # for space -216 } -217 var off/ecx: (offset value) <- compute-offset a, i -218 var x/ecx: (addr value) <- index a, off -219 { -220 var w/eax: int <- value-width x, 0 -221 result <- add w -222 } -223 i <- increment -224 loop -225 } -226 # we won't add 2 for surrounding brackets since we don't surround arrays in -227 # spaces like other value types -228 return result -229 } -230 -231 fn save-lines in-h: (handle array (handle array byte)), _out-ah: (addr handle array value) { -232 var _in/eax: (addr array (handle array byte)) <- lookup in-h -233 var in/esi: (addr array (handle array byte)) <- copy _in -234 var len/ecx: int <- length in -235 var out-ah/edi: (addr handle array value) <- copy _out-ah -236 populate out-ah, len -237 var out/eax: (addr array value) <- lookup *out-ah -238 # copy in into out -239 var i/ebx: int <- copy 0 -240 { -241 compare i, len -242 break-if->= -243 #? print-int32-hex 0, i -244 #? print-string 0, "\n" -245 var src/ecx: (addr handle array byte) <- index in, i -246 var dest-offset/edx: (offset value) <- compute-offset out, i -247 var dest-val/edx: (addr value) <- index out, dest-offset -248 var dest/eax: (addr handle array byte) <- get dest-val, text-data -249 copy-object src, dest -250 var type/edx: (addr int) <- get dest-val, type -251 copy-to *type, 1 # string -252 i <- increment -253 loop -254 } -255 } + 35 dest-addr2 <- get dest-addr, type + 36 copy-to *dest-addr2, 0 # int + 37 } + 38 + 39 fn push-string-to-value-stack _self: (addr value-stack), val: (handle array byte) { + 40 var self/esi: (addr value-stack) <- copy _self + 41 var top-addr/ecx: (addr int) <- get self, top + 42 var data-ah/edx: (addr handle array value) <- get self, data + 43 var data/eax: (addr array value) <- lookup *data-ah + 44 var top/edx: int <- copy *top-addr + 45 var dest-offset/edx: (offset value) <- compute-offset data, top + 46 var dest-addr/edx: (addr value) <- index data, dest-offset + 47 var dest-addr2/eax: (addr handle array byte) <- get dest-addr, text-data + 48 copy-handle val, dest-addr2 + 49 var dest-addr3/eax: (addr int) <- get dest-addr, type + 50 #? print-string 0, "setting type to 1: " + 51 #? { + 52 #? var foo/eax: int <- copy dest-addr3 + 53 #? print-int32-hex 0, foo + 54 #? } + 55 #? print-string 0, "\n" + 56 copy-to *dest-addr3, 1 # type string + 57 increment *top-addr + 58 } + 59 + 60 fn push-array-to-value-stack _self: (addr value-stack), val: (handle array value) { + 61 var self/esi: (addr value-stack) <- copy _self + 62 var top-addr/ecx: (addr int) <- get self, top + 63 var data-ah/edx: (addr handle array value) <- get self, data + 64 var data/eax: (addr array value) <- lookup *data-ah + 65 var top/edx: int <- copy *top-addr + 66 var dest-offset/edx: (offset value) <- compute-offset data, top + 67 var dest-addr/edx: (addr value) <- index data, dest-offset + 68 var dest-addr2/eax: (addr handle array value) <- get dest-addr, array-data + 69 copy-handle val, dest-addr2 + 70 # update type + 71 var dest-addr3/eax: (addr int) <- get dest-addr, type + 72 copy-to *dest-addr3, 2 # type array + 73 increment *top-addr + 74 } + 75 + 76 fn push-value-stack _self: (addr value-stack), val: (addr value) { + 77 var self/esi: (addr value-stack) <- copy _self + 78 var top-addr/ecx: (addr int) <- get self, top + 79 var data-ah/edx: (addr handle array value) <- get self, data + 80 var data/eax: (addr array value) <- lookup *data-ah + 81 var top/edx: int <- copy *top-addr + 82 var dest-offset/edx: (offset value) <- compute-offset data, top + 83 var dest-addr/edx: (addr value) <- index data, dest-offset + 84 copy-object val, dest-addr + 85 increment *top-addr + 86 } + 87 + 88 fn pop-int-from-value-stack _self: (addr value-stack) -> _/eax: int { + 89 var self/esi: (addr value-stack) <- copy _self + 90 var top-addr/ecx: (addr int) <- get self, top + 91 { + 92 compare *top-addr, 0 + 93 break-if-> + 94 return -1 + 95 } + 96 decrement *top-addr + 97 var data-ah/edx: (addr handle array value) <- get self, data + 98 var data/eax: (addr array value) <- lookup *data-ah + 99 var top/edx: int <- copy *top-addr +100 var dest-offset/edx: (offset value) <- compute-offset data, top +101 var result-addr/eax: (addr value) <- index data, dest-offset +102 var result-addr2/eax: (addr int) <- get result-addr, int-data +103 return *result-addr2 +104 } +105 +106 fn value-stack-empty? _self: (addr value-stack) -> _/eax: boolean { +107 var self/esi: (addr value-stack) <- copy _self +108 var top/eax: (addr int) <- get self, top +109 compare *top, 0 +110 { +111 break-if-!= +112 return 1 # true +113 } +114 return 0 # false +115 } +116 +117 fn value-stack-length _self: (addr value-stack) -> _/eax: int { +118 var self/esi: (addr value-stack) <- copy _self +119 var top-addr/eax: (addr int) <- get self, top +120 return *top-addr +121 } +122 +123 fn value-stack-max-width _self: (addr value-stack) -> _/eax: int { +124 var self/esi: (addr value-stack) <- copy _self +125 var data-ah/edi: (addr handle array value) <- get self, data +126 var _data/eax: (addr array value) <- lookup *data-ah +127 var data/edi: (addr array value) <- copy _data +128 var top-addr/ecx: (addr int) <- get self, top +129 var i/ebx: int <- copy 0 +130 var result: int +131 { +132 compare i, *top-addr +133 break-if->= +134 var o/edx: (offset value) <- compute-offset data, i +135 var v/edx: (addr value) <- index data, o +136 var w/eax: int <- value-width v, 1 # top-level=true +137 # if (w > result) w = result +138 { +139 compare w, result +140 break-if-<= +141 copy-to result, w +142 } +143 i <- increment +144 loop +145 } +146 return result +147 } +148 +149 fn save-lines in-h: (handle array (handle array byte)), _out-ah: (addr handle array value) { +150 var _in/eax: (addr array (handle array byte)) <- lookup in-h +151 var in/esi: (addr array (handle array byte)) <- copy _in +152 var len/ecx: int <- length in +153 var out-ah/edi: (addr handle array value) <- copy _out-ah +154 populate out-ah, len +155 var out/eax: (addr array value) <- lookup *out-ah +156 # copy in into out +157 var i/ebx: int <- copy 0 +158 { +159 compare i, len +160 break-if->= +161 #? print-int32-hex 0, i +162 #? print-string 0, "\n" +163 var src/ecx: (addr handle array byte) <- index in, i +164 var dest-offset/edx: (offset value) <- compute-offset out, i +165 var dest-val/edx: (addr value) <- index out, dest-offset +166 var dest/eax: (addr handle array byte) <- get dest-val, text-data +167 copy-object src, dest +168 var type/edx: (addr int) <- get dest-val, type +169 copy-to *type, 1 # string +170 i <- increment +171 loop +172 } +173 } diff --git a/html/apps/tile/value.mu.html b/html/apps/tile/value.mu.html new file mode 100644 index 00000000..6da9cb3d --- /dev/null +++ b/html/apps/tile/value.mu.html @@ -0,0 +1,487 @@ + + + + +Mu - apps/tile/value.mu + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/apps/tile/value.mu +
+  1 fn render-value-at screen: (addr screen), row: int, col: int, _val: (addr value), max-width: int {
+  2   move-cursor screen, row, col
+  3   var val/esi: (addr value) <- copy _val
+  4   var val-type/ecx: (addr int) <- get val, type
+  5   # per-type rendering logic goes here
+  6   compare *val-type, 1  # string
+  7   {
+  8     break-if-!=
+  9     var val-ah/eax: (addr handle array byte) <- get val, text-data
+ 10     var val-string/eax: (addr array byte) <- lookup *val-ah
+ 11     compare val-string, 0
+ 12     break-if-=
+ 13     var orig-len/ecx: int <- length val-string
+ 14     var truncated: (handle array byte)
+ 15     var truncated-ah/esi: (addr handle array byte) <- address truncated
+ 16     substring val-string, 0, 0xc, truncated-ah
+ 17     var truncated-string/eax: (addr array byte) <- lookup *truncated-ah
+ 18     var len/edx: int <- length truncated-string
+ 19     start-color screen, 0xf2, 7
+ 20     print-code-point screen, 0x275d  # open-quote
+ 21     print-string screen, truncated-string
+ 22     compare len, orig-len
+ 23     {
+ 24       break-if-=
+ 25       print-code-point screen, 0x2026  # ellipses
+ 26     }
+ 27     print-code-point screen, 0x275e  # close-quote
+ 28     reset-formatting screen
+ 29     return
+ 30   }
+ 31   compare *val-type, 2  # array
+ 32   {
+ 33     break-if-!=
+ 34     var val-ah/eax: (addr handle array value) <- get val, array-data
+ 35     var val-array/eax: (addr array value) <- lookup *val-ah
+ 36     render-array-at screen, row, col, val-array
+ 37     return
+ 38   }
+ 39   compare *val-type, 3  # file
+ 40   {
+ 41     break-if-!=
+ 42     var val-ah/eax: (addr handle buffered-file) <- get val, file-data
+ 43     var val-file/eax: (addr buffered-file) <- lookup *val-ah
+ 44     start-color screen, 0, 7
+ 45     # TODO
+ 46     print-string screen, " FILE "
+ 47     return
+ 48   }
+ 49   compare *val-type, 4  # screen
+ 50   {
+ 51     break-if-!=
+ 52 #?     print-string 0, "render-screen"
+ 53     var val-ah/eax: (addr handle screen) <- get val, screen-data
+ 54     var val-screen/eax: (addr screen) <- lookup *val-ah
+ 55     render-screen screen, row, col, val-screen
+ 56 #?     print-string 0, "}\n"
+ 57     return
+ 58   }
+ 59   # render ints by default for now
+ 60   var val-int/eax: (addr int) <- get val, int-data
+ 61   render-integer screen, *val-int, max-width
+ 62 }
+ 63 
+ 64 # synaesthesia
+ 65 fn render-integer screen: (addr screen), val: int, max-width: int {
+ 66 $render-integer:body: {
+ 67   # if max-width is 0, we're inside an array. No coloring.
+ 68   compare max-width, 0
+ 69   {
+ 70     break-if-!=
+ 71     print-int32-decimal screen, val
+ 72     break $render-integer:body
+ 73   }
+ 74   var bg/eax: int <- hash-color val
+ 75   var fg/ecx: int <- copy 7
+ 76   {
+ 77     compare bg, 2
+ 78     break-if-!=
+ 79     fg <- copy 0
+ 80   }
+ 81   {
+ 82     compare bg, 3
+ 83     break-if-!=
+ 84     fg <- copy 0
+ 85   }
+ 86   {
+ 87     compare bg, 6
+ 88     break-if-!=
+ 89     fg <- copy 0
+ 90   }
+ 91   start-color screen, fg, bg
+ 92   print-grapheme screen, 0x20  # space
+ 93   print-int32-decimal-right-justified screen, val, max-width
+ 94   print-grapheme screen, 0x20  # space
+ 95 }
+ 96 }
+ 97 
+ 98 fn render-array-at screen: (addr screen), row: int, col: int, _a: (addr array value) {
+ 99   start-color screen, 0xf2, 7
+100   # don't surround in spaces
+101   print-grapheme screen, 0x5b  # '['
+102   increment col
+103   var a/esi: (addr array value) <- copy _a
+104   var max/ecx: int <- length a
+105   var i/eax: int <- copy 0
+106   {
+107     compare i, max
+108     break-if->=
+109     {
+110       compare i, 0
+111       break-if-=
+112       print-string screen, " "
+113     }
+114     var off/ecx: (offset value) <- compute-offset a, i
+115     var x/ecx: (addr value) <- index a, off
+116     render-value-at screen, row, col, x, 0
+117     {
+118       var w/eax: int <- value-width x, 0
+119       add-to col, w
+120       increment col
+121     }
+122     i <- increment
+123     loop
+124   }
+125   print-grapheme screen, 0x5d  # ']'
+126 }
+127 
+128 fn render-screen screen: (addr screen), row: int, col: int, _target-screen: (addr screen) {
+129   reset-formatting screen
+130   start-color screen, 0xf2, 7
+131   move-cursor screen, row, col
+132   var target-screen/esi: (addr screen) <- copy _target-screen
+133   var ncols-a/ecx: (addr int) <- get target-screen, num-cols
+134   print-upper-border screen, *ncols-a
+135   var r/edx: int <- copy 1
+136   var nrows-a/ebx: (addr int) <- get target-screen, num-rows
+137   {
+138     compare r, *nrows-a
+139     break-if->
+140     increment row  # mutate arg
+141     move-cursor screen, row, col
+142     print-string screen, " "
+143     var c/edi: int <- copy 1
+144     {
+145       compare c, *ncols-a
+146       break-if->
+147       print-screen-cell-of-fake-screen screen, target-screen, r, c
+148       c <- increment
+149       loop
+150     }
+151     print-string screen, " "
+152     r <- increment
+153     loop
+154   }
+155   increment row  # mutate arg
+156   move-cursor screen, row, col
+157   start-color screen, 0xf2, 7
+158   print-lower-border screen, *ncols-a
+159 }
+160 
+161 fn hash-color val: int -> _/eax: int {
+162   var result/eax: int <- try-modulo val, 7  # assumes that 7 is always the background color
+163   return result
+164 }
+165 
+166 fn print-screen-cell-of-fake-screen screen: (addr screen), _target: (addr screen), _row: int, _col: int {
+167   start-color screen, 0, 0xf6
+168   var target/esi: (addr screen) <- copy _target
+169   var row/ecx: int <- copy _row
+170   var col/edx: int <- copy _col
+171   # if cursor is at screen-cell, add some fancy
+172   {
+173     var cursor-row/eax: (addr int) <- get target, cursor-row
+174     compare *cursor-row, row
+175     break-if-!=
+176     var cursor-col/eax: (addr int) <- get target, cursor-col
+177     compare *cursor-col, col
+178     break-if-!=
+179     start-blinking screen
+180     start-color screen, 0, 1
+181   }
+182   var g/eax: grapheme <- screen-grapheme-at target, row, col
+183   {
+184     compare g, 0
+185     break-if-!=
+186     g <- copy 0x20  # space
+187   }
+188   print-grapheme screen, g
+189   reset-formatting screen
+190 }
+191 
+192 fn print-upper-border screen: (addr screen), width: int {
+193   print-code-point screen, 0x250c  # top-left corner
+194   var i/eax: int <- copy 0
+195   {
+196     compare i, width
+197     break-if->=
+198     print-code-point screen, 0x2500  # horizontal line
+199     i <- increment
+200     loop
+201   }
+202   print-code-point screen, 0x2510  # top-right corner
+203 }
+204 
+205 fn print-lower-border screen: (addr screen), width: int {
+206   print-code-point screen, 0x2514  # bottom-left corner
+207   var i/eax: int <- copy 0
+208   {
+209     compare i, width
+210     break-if->=
+211     print-code-point screen, 0x2500  # horizontal line
+212     i <- increment
+213     loop
+214   }
+215   print-code-point screen, 0x2518  # bottom-right corner
+216 }
+217 
+218 fn value-width _v: (addr value), top-level: boolean -> _/eax: int {
+219   var v/esi: (addr value) <- copy _v
+220   var type/eax: (addr int) <- get v, type
+221   {
+222     compare *type, 0  # int
+223     break-if-!=
+224     var v-int/edx: (addr int) <- get v, int-data
+225     var result/eax: int <- decimal-size *v-int
+226     return result
+227   }
+228   {
+229     compare *type, 1  # string
+230     break-if-!=
+231     var s-ah/eax: (addr handle array byte) <- get v, text-data
+232     var s/eax: (addr array byte) <- lookup *s-ah
+233     compare s, 0
+234     break-if-=
+235     var result/eax: int <- length s
+236     compare result, 0xd  # max string size
+237     {
+238       break-if-<=
+239       result <- copy 0xd
+240     }
+241     # if it's a nested string, include space for quotes
+242     # we don't do this for the top-level, where the quotes will overflow
+243     # into surrounding padding.
+244     compare top-level, 0  # false
+245     {
+246       break-if-!=
+247       result <- add 2
+248     }
+249     return result
+250   }
+251   {
+252     compare *type, 2  # array
+253     break-if-!=
+254     var a-ah/eax: (addr handle array value) <- get v, array-data
+255     var a/eax: (addr array value) <- lookup *a-ah
+256     compare a, 0
+257     break-if-=
+258     var result/eax: int <- array-width a
+259     return result
+260   }
+261   {
+262     compare *type, 3  # file handle
+263     break-if-!=
+264     var f-ah/eax: (addr handle buffered-file) <- get v, file-data
+265     var f/eax: (addr buffered-file) <- lookup *f-ah
+266     compare f, 0
+267     break-if-=
+268     # TODO: visualizing file handles
+269     return 4
+270   }
+271   {
+272     compare *type, 4  # screen
+273     break-if-!=
+274     var screen-ah/eax: (addr handle screen) <- get v, screen-data
+275     var screen/eax: (addr screen) <- lookup *screen-ah
+276     compare screen, 0
+277     break-if-=
+278     var ncols/ecx: (addr int) <- get screen, num-cols
+279     var result/eax: int <- copy *ncols
+280     result <- add 2  # left/right margins
+281     return *ncols
+282   }
+283   return 0
+284 }
+285 
+286 # keep sync'd with render-array-at
+287 fn array-width _a: (addr array value) -> _/eax: int {
+288   var a/esi: (addr array value) <- copy _a
+289   var max/ecx: int <- length a
+290   var i/eax: int <- copy 0
+291   var result/edi: int <- copy 0
+292   {
+293     compare i, max
+294     break-if->=
+295     {
+296       compare i, 0
+297       break-if-=
+298       result <- increment  # for space
+299     }
+300     var off/ecx: (offset value) <- compute-offset a, i
+301     var x/ecx: (addr value) <- index a, off
+302     {
+303       var w/eax: int <- value-width x, 0
+304       result <- add w
+305     }
+306     i <- increment
+307     loop
+308   }
+309   # we won't add 2 for surrounding brackets since we don't surround arrays in
+310   # spaces like other value types
+311   return result
+312 }
+313 
+314 fn value-height _v: (addr value) -> _/eax: int {
+315   var v/esi: (addr value) <- copy _v
+316   var type/eax: (addr int) <- get v, type
+317   {
+318     compare *type, 3  # file handle
+319     break-if-!=
+320     # TODO: visualizing file handles
+321     return 1
+322   }
+323   {
+324     compare *type, 4  # screen
+325     break-if-!=
+326     var screen-ah/eax: (addr handle screen) <- get v, screen-data
+327     var screen/eax: (addr screen) <- lookup *screen-ah
+328     compare screen, 0
+329     break-if-=
+330     var nrows/ecx: (addr int) <- get screen, num-rows
+331     var result/eax: int <- copy *nrows
+332     result <- add 2  # top and bottom border
+333     return result
+334   }
+335   return 1
+336 }
+337 
+338 fn deep-copy-value _src: (addr value), _dest: (addr value) {
+339 #?   print-string 0, "deep-copy-value\n"
+340   var src/esi: (addr value) <- copy _src
+341   var dest/edi: (addr value) <- copy _dest
+342   var type/ebx: (addr int) <- get src, type
+343   var y/ecx: (addr int) <- get dest, type
+344   copy-object type, y
+345   compare *type, 0   # int
+346   {
+347     break-if-!=
+348 #?     print-string 0, "int value\n"
+349     var x/eax: (addr int) <- get src, int-data
+350     y <- get dest, int-data
+351     copy-object x, y
+352     return
+353   }
+354   compare *type, 1  # string
+355   {
+356     break-if-!=
+357 #?     print-string 0, "string value\n"
+358     var src-ah/eax: (addr handle array byte) <- get src, text-data
+359     var src/eax: (addr array byte) <- lookup *src-ah
+360     var dest-ah/edx: (addr handle array byte) <- get dest, text-data
+361     copy-array-object src, dest-ah
+362     return
+363   }
+364   compare *type, 2  # array
+365   {
+366     break-if-!=
+367 #?     print-string 0, "array value\n"
+368     var src-ah/eax: (addr handle array value) <- get src, array-data
+369     var _src/eax: (addr array value) <- lookup *src-ah
+370     var src/esi: (addr array value) <- copy _src
+371     var n/ecx: int <- length src
+372     var dest-ah/edx: (addr handle array value) <- get dest, array-data
+373     populate dest-ah, n
+374     var _dest/eax: (addr array value) <- lookup *dest-ah
+375     var dest/edi: (addr array value) <- copy _dest
+376     var i/eax: int <- copy 0
+377     {
+378       compare i, n
+379       break-if->=
+380       {
+381         var offset/edx: (offset value) <- compute-offset src, i
+382         var src-element/eax: (addr value) <- index src, offset
+383         var dest-element/ecx: (addr value) <- index dest, offset
+384         deep-copy-value src-element, dest-element
+385       }
+386       i <- increment
+387       loop
+388     }
+389     copy-array-object src, dest-ah
+390     return
+391   }
+392   compare *type, 3  # file
+393   {
+394     break-if-!=
+395 #?     print-string 0, "file value\n"
+396     var src-filename-ah/eax: (addr handle array byte) <- get src, filename
+397     var _src-filename/eax: (addr array byte) <- lookup *src-filename-ah
+398     var src-filename/ecx: (addr array byte) <- copy _src-filename
+399     var dest-filename-ah/ebx: (addr handle array byte) <- get dest, filename
+400     copy-array-object src-filename, dest-filename-ah
+401     var src-file-ah/eax: (addr handle buffered-file) <- get src, file-data
+402     var src-file/eax: (addr buffered-file) <- lookup *src-file-ah
+403     var dest-file-ah/edx: (addr handle buffered-file) <- get dest, file-data
+404     copy-file src-file, dest-file-ah, src-filename
+405     return
+406   }
+407   compare *type, 4  # screen
+408   {
+409     break-if-!=
+410 #?     print-string 0, "screen value\n"
+411     var src-screen-ah/eax: (addr handle screen) <- get src, screen-data
+412     var _src-screen/eax: (addr screen) <- lookup *src-screen-ah
+413     var src-screen/ecx: (addr screen) <- copy _src-screen
+414     var dest-screen-ah/eax: (addr handle screen) <- get dest, screen-data
+415     allocate dest-screen-ah
+416     var dest-screen/eax: (addr screen) <- lookup *dest-screen-ah
+417     copy-object src-screen, dest-screen
+418     var dest-screen-data-ah/ebx: (addr handle array screen-cell) <- get dest-screen, data
+419     var src-screen-data-ah/eax: (addr handle array screen-cell) <- get src-screen, data
+420     var src-screen-data/eax: (addr array screen-cell) <- lookup *src-screen-data-ah
+421     copy-array-object src-screen-data, dest-screen-data-ah
+422     return
+423   }
+424 }
+
+ + + diff --git a/html/apps/tui.mu.html b/html/apps/tui.mu.html index b5fc6487..35454832 100644 --- a/html/apps/tui.mu.html +++ b/html/apps/tui.mu.html @@ -68,15 +68,15 @@ if ('onhashchange' in window) { 10 nrows, ncols <- screen-size 0 11 enable-screen-grid-mode 12 move-cursor 0, 5, 0x22 -13 start-color 0, 1, 0x7a -14 start-blinking 0 +13 start-color 0, 1, 0x7a +14 start-blinking 0 15 print-string 0, "Hello world!" -16 reset-formatting 0 +16 reset-formatting 0 17 move-cursor 0, 6, 0x22 18 print-string 0, "tty dimensions: " -19 print-int32-hex 0, nrows +19 print-int32-hex 0, nrows 20 print-string 0, " rows, " -21 print-int32-hex 0, ncols +21 print-int32-hex 0, ncols 22 print-string 0, " rows\n" 23 24 print-string 0, "press a key to see its code: " @@ -86,7 +86,7 @@ if ('onhashchange' in window) { 28 enable-screen-type-mode 29 print-string 0, "You pressed " 30 var x-int/eax: int <- copy x -31 print-int32-hex 0, x-int +31 print-int32-hex 0, x-int 32 print-string 0, "\n" 33 return 0 34 } -- cgit 1.4.1-2-gfad0